aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig29
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/ioctls.h3
-rw-r--r--arch/alpha/include/asm/mman.h11
-rw-r--r--arch/alpha/include/asm/mmzone.h2
-rw-r--r--arch/alpha/include/asm/ptrace.h1
-rw-r--r--arch/alpha/include/asm/signal.h3
-rw-r--r--arch/alpha/include/asm/socket.h1
-rw-r--r--arch/alpha/include/asm/unistd.h3
-rw-r--r--arch/alpha/kernel/binfmt_loader.c4
-rw-r--r--arch/alpha/kernel/entry.S51
-rw-r--r--arch/alpha/kernel/pci_iommu.c12
-rw-r--r--arch/alpha/kernel/process.c62
-rw-r--r--arch/alpha/kernel/signal.c16
-rw-r--r--arch/alpha/kernel/srmcons.c5
-rw-r--r--arch/alpha/kernel/systbls.S6
-rw-r--r--arch/arm/Kconfig75
-rw-r--r--arch/arm/Kconfig.debug112
-rw-r--r--arch/arm/Makefile10
-rw-r--r--arch/arm/boot/Makefile12
-rw-r--r--arch/arm/boot/compressed/Makefile9
-rw-r--r--arch/arm/boot/compressed/head-vt8500.S46
-rw-r--r--arch/arm/boot/compressed/head.S14
-rw-r--r--arch/arm/boot/dts/Makefile101
-rw-r--r--arch/arm/boot/dts/am335x-bone.dts58
-rw-r--r--arch/arm/boot/dts/am335x-evm.dts126
-rw-r--r--arch/arm/boot/dts/am335x-evmsk.dts250
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi203
-rw-r--r--arch/arm/boot/dts/animeo_ip.dts178
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi349
-rw-r--r--arch/arm/boot/dts/at91rm9200ek.dts79
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi309
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi321
-rw-r--r--arch/arm/boot/dts/at91sam9263ek.dts29
-rw-r--r--arch/arm/boot/dts/at91sam9g15.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9g15ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_2mmc.dts26
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_common.dtsi62
-rw-r--r--arch/arm/boot/dts/at91sam9g25.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9g25ek.dts49
-rw-r--r--arch/arm/boot/dts/at91sam9g35.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9g35ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi323
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts48
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi225
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts22
-rw-r--r--arch/arm/boot/dts/at91sam9x25.dtsi49
-rw-r--r--arch/arm/boot/dts/at91sam9x25ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9x35.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9x35ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi278
-rw-r--r--arch/arm/boot/dts/at91sam9x5ek.dtsi101
-rw-r--r--arch/arm/boot/dts/bcm11351-brt.dts30
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi50
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi-b.dts15
-rw-r--r--arch/arm/boot/dts/bcm2835.dtsi28
-rw-r--r--arch/arm/boot/dts/ccu9540.dts72
-rw-r--r--arch/arm/boot/dts/cros5250-common.dtsi184
-rw-r--r--arch/arm/boot/dts/da850-enbw-cmc.dts30
-rw-r--r--arch/arm/boot/dts/da850-evm.dts28
-rw-r--r--arch/arm/boot/dts/da850.dtsi60
-rw-r--r--arch/arm/boot/dts/dbx5x0.dtsi98
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts10
-rw-r--r--arch/arm/boot/dts/dove.dtsi19
-rw-r--r--arch/arm/boot/dts/ecx-2000.dts104
-rw-r--r--arch/arm/boot/dts/ecx-common.dtsi237
-rw-r--r--arch/arm/boot/dts/evk-pro3.dts12
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi60
-rw-r--r--arch/arm/boot/dts/exynos4210-origen.dts70
-rw-r--r--arch/arm/boot/dts/exynos4210-pinctrl.dtsi334
-rw-r--r--arch/arm/boot/dts/exynos4210-smdkv310.dts16
-rw-r--r--arch/arm/boot/dts/exynos4210-trats.dts87
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi249
-rw-r--r--arch/arm/boot/dts/exynos4212.dtsi28
-rw-r--r--arch/arm/boot/dts/exynos4412-smdk4412.dts45
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi28
-rw-r--r--arch/arm/boot/dts/exynos4x12-pinctrl.dtsi965
-rw-r--r--arch/arm/boot/dts/exynos4x12.dtsi69
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts56
-rw-r--r--arch/arm/boot/dts/exynos5250-snow.dts43
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi62
-rw-r--r--arch/arm/boot/dts/exynos5440-ssdk5440.dts46
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi159
-rw-r--r--arch/arm/boot/dts/highbank.dts212
-rw-r--r--arch/arm/boot/dts/href.dtsi273
-rw-r--r--arch/arm/boot/dts/hrefprev60.dts48
-rw-r--r--arch/arm/boot/dts/hrefv60plus.dts217
-rw-r--r--arch/arm/boot/dts/imx23-olinuxino.dts23
-rw-r--r--arch/arm/boot/dts/imx23.dtsi13
-rw-r--r--arch/arm/boot/dts/imx25-karo-tx25.dts44
-rw-r--r--arch/arm/boot/dts/imx25.dtsi515
-rw-r--r--arch/arm/boot/dts/imx27-3ds.dts4
-rw-r--r--arch/arm/boot/dts/imx27-apf27.dts89
-rw-r--r--arch/arm/boot/dts/imx27.dtsi9
-rw-r--r--arch/arm/boot/dts/imx28-apf28.dts85
-rw-r--r--arch/arm/boot/dts/imx28-apf28dev.dts154
-rw-r--r--arch/arm/boot/dts/imx28-cfa10036.dts46
-rw-r--r--arch/arm/boot/dts/imx28-cfa10049.dts33
-rw-r--r--arch/arm/boot/dts/imx28-evk.dts13
-rw-r--r--arch/arm/boot/dts/imx28-sps1.dts169
-rw-r--r--arch/arm/boot/dts/imx28.dtsi36
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts16
-rw-r--r--arch/arm/boot/dts/imx51.dtsi171
-rw-r--r--arch/arm/boot/dts/imx53-qsb.dts62
-rw-r--r--arch/arm/boot/dts/imx53.dtsi171
-rw-r--r--arch/arm/boot/dts/imx6q-sabreauto.dts64
-rw-r--r--arch/arm/boot/dts/imx6q-sabresd.dts18
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi159
-rw-r--r--arch/arm/boot/dts/integratorap.dts5
-rw-r--r--arch/arm/boot/dts/integratorcp.dts5
-rw-r--r--arch/arm/boot/dts/kirkwood-6281.dtsi44
-rw-r--r--arch/arm/boot/dts/kirkwood-6282.dtsi45
-rw-r--r--arch/arm/boot/dts/kirkwood-98dx4122.dtsi31
-rw-r--r--arch/arm/boot/dts/kirkwood-dnskw.dtsi140
-rw-r--r--arch/arm/boot/dts/kirkwood-dockstar.dts37
-rw-r--r--arch/arm/boot/dts/kirkwood-dreamplug.dts21
-rw-r--r--arch/arm/boot/dts/kirkwood-goflexnet.dts73
-rw-r--r--arch/arm/boot/dts/kirkwood-ib62x0.dts40
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts51
-rw-r--r--arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts89
-rw-r--r--arch/arm/boot/dts/kirkwood-is2.dts30
-rw-r--r--arch/arm/boot/dts/kirkwood-km_kirkwood.dts17
-rw-r--r--arch/arm/boot/dts/kirkwood-lsxl.dtsi106
-rw-r--r--arch/arm/boot/dts/kirkwood-mplcec4.dts178
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2-common.dtsi63
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2.dts30
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2lite.dts30
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2max.dts49
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2mini.dts49
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310.dts144
-rw-r--r--arch/arm/boot/dts/kirkwood-openblocks_a6.dts98
-rw-r--r--arch/arm/boot/dts/kirkwood-topkick.dts85
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6281.dts31
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6282.dts31
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi17
-rw-r--r--arch/arm/boot/dts/lpc32xx.dtsi7
-rw-r--r--arch/arm/boot/dts/omap2.dtsi86
-rw-r--r--arch/arm/boot/dts/omap2420.dtsi16
-rw-r--r--arch/arm/boot/dts/omap2430.dtsi19
-rw-r--r--arch/arm/boot/dts/omap3-beagle-xm.dts6
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts67
-rw-r--r--arch/arm/boot/dts/omap3.dtsi107
-rw-r--r--arch/arm/boot/dts/omap4-panda-a4.dts17
-rw-r--r--arch/arm/boot/dts/omap4-panda-es.dts (renamed from arch/arm/boot/dts/omap4-pandaES.dts)9
-rw-r--r--arch/arm/boot/dts/omap4-panda.dts22
-rw-r--r--arch/arm/boot/dts/omap4-sdp-es23plus.dts17
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts22
-rw-r--r--arch/arm/boot/dts/omap4-var-som.dts (renamed from arch/arm/boot/dts/omap4-var_som.dts)0
-rw-r--r--arch/arm/boot/dts/omap4.dtsi105
-rw-r--r--arch/arm/boot/dts/omap5-evm.dts13
-rw-r--r--arch/arm/boot/dts/omap5.dtsi178
-rw-r--r--arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts55
-rw-r--r--arch/arm/boot/dts/orion5x.dtsi98
-rw-r--r--arch/arm/boot/dts/pm9g45.dts165
-rw-r--r--arch/arm/boot/dts/samsung_k3pe0e000b.dtsi67
-rw-r--r--arch/arm/boot/dts/sh7372-mackerel.dts (renamed from arch/arm/boot/dts/sh7377.dtsi)13
-rw-r--r--arch/arm/boot/dts/snowball.dts171
-rw-r--r--arch/arm/boot/dts/spear1310-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi27
-rw-r--r--arch/arm/boot/dts/spear1340-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi26
-rw-r--r--arch/arm/boot/dts/spear310.dtsi22
-rw-r--r--arch/arm/boot/dts/spear320-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear320.dtsi23
-rw-r--r--arch/arm/boot/dts/stuib.dtsi78
-rw-r--r--arch/arm/boot/dts/sun4i-cubieboard.dts38
-rw-r--r--arch/arm/boot/dts/sun4i.dtsi19
-rw-r--r--arch/arm/boot/dts/sun5i-olinuxino.dts30
-rw-r--r--arch/arm/boot/dts/sun5i.dtsi20
-rw-r--r--arch/arm/boot/dts/sunxi.dtsi80
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts84
-rw-r--r--arch/arm/boot/dts/tegra20-paz00.dts59
-rw-r--r--arch/arm/boot/dts/tegra20-plutux.dts6
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts69
-rw-r--r--arch/arm/boot/dts/tegra20-tamonten.dtsi147
-rw-r--r--arch/arm/boot/dts/tegra20-tec.dts9
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts54
-rw-r--r--arch/arm/boot/dts/tegra20-ventana.dts149
-rw-r--r--arch/arm/boot/dts/tegra20-whistler.dts136
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi167
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu-a02.dts6
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu-a04.dts6
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi84
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi179
-rw-r--r--arch/arm/boot/dts/twl4030.dtsi27
-rw-r--r--arch/arm/boot/dts/twl6030.dtsi5
-rw-r--r--arch/arm/boot/dts/u9540.dts72
-rw-r--r--arch/arm/boot/dts/vexpress-v2m-rs1.dtsi146
-rw-r--r--arch/arm/boot/dts/vexpress-v2m.dtsi146
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts121
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts186
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca5s.dts84
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca9.dts136
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi166
-rw-r--r--arch/arm/boot/dts/zynq-ep107.dts52
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts44
-rw-r--r--arch/arm/common/gic.c45
-rw-r--r--arch/arm/common/timer-sp.c2
-rw-r--r--arch/arm/common/vic.c19
-rw-r--r--arch/arm/configs/afeb9260_defconfig106
-rw-r--r--arch/arm/configs/ap4evb_defconfig1
-rw-r--r--arch/arm/configs/armadillo800eva_defconfig3
-rw-r--r--arch/arm/configs/at91_dt_defconfig1
-rw-r--r--arch/arm/configs/at91sam9260_defconfig2
-rw-r--r--arch/arm/configs/at91sam9261_defconfig2
-rw-r--r--arch/arm/configs/at91sam9263_defconfig2
-rw-r--r--arch/arm/configs/at91sam9g20_defconfig2
-rw-r--r--arch/arm/configs/bcm2835_defconfig2
-rw-r--r--arch/arm/configs/bcm_defconfig114
-rw-r--r--arch/arm/configs/cam60_defconfig173
-rw-r--r--arch/arm/configs/clps711x_defconfig90
-rw-r--r--arch/arm/configs/corgi_defconfig2
-rw-r--r--arch/arm/configs/cpu9260_defconfig116
-rw-r--r--arch/arm/configs/cpu9g20_defconfig116
-rw-r--r--arch/arm/configs/da8xx_omapl_defconfig3
-rw-r--r--arch/arm/configs/davinci_all_defconfig2
-rw-r--r--arch/arm/configs/dove_defconfig24
-rw-r--r--arch/arm/configs/edb7211_defconfig27
-rw-r--r--arch/arm/configs/fortunet_defconfig28
-rw-r--r--arch/arm/configs/g3evm_defconfig57
-rw-r--r--arch/arm/configs/g4evm_defconfig57
-rw-r--r--arch/arm/configs/h7202_defconfig3
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig5
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig5
-rw-r--r--arch/arm/configs/kirkwood_defconfig9
-rw-r--r--arch/arm/configs/kota2_defconfig1
-rw-r--r--arch/arm/configs/kzm9g_defconfig5
-rw-r--r--arch/arm/configs/mackerel_defconfig19
-rw-r--r--arch/arm/configs/magician_defconfig2
-rw-r--r--arch/arm/configs/marzen_defconfig18
-rw-r--r--arch/arm/configs/mini2440_defconfig2
-rw-r--r--arch/arm/configs/mxs_defconfig6
-rw-r--r--arch/arm/configs/omap1_defconfig3
-rw-r--r--arch/arm/configs/omap2plus_defconfig3
-rw-r--r--arch/arm/configs/orion5x_defconfig36
-rw-r--r--arch/arm/configs/prima2_defconfig1
-rw-r--r--arch/arm/configs/qil-a9260_defconfig114
-rw-r--r--arch/arm/configs/sam9_l9260_defconfig148
-rw-r--r--arch/arm/configs/spitz_defconfig2
-rw-r--r--arch/arm/configs/stamp9g20_defconfig128
-rw-r--r--arch/arm/configs/tegra_defconfig21
-rw-r--r--arch/arm/configs/u8500_defconfig3
-rw-r--r--arch/arm/configs/usb-a9260_defconfig105
-rw-r--r--arch/arm/configs/viper_defconfig2
-rw-r--r--arch/arm/configs/zeus_defconfig2
-rw-r--r--arch/arm/include/asm/Kbuild2
-rw-r--r--arch/arm/include/asm/assembler.h8
-rw-r--r--arch/arm/include/asm/cpu.h1
-rw-r--r--arch/arm/include/asm/cputype.h13
-rw-r--r--arch/arm/include/asm/cti.h20
-rw-r--r--arch/arm/include/asm/dma-mapping.h7
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h5
-rw-r--r--arch/arm/include/asm/hardware/sp810.h6
-rw-r--r--arch/arm/include/asm/hardware/vic.h2
-rw-r--r--arch/arm/include/asm/hw_breakpoint.h8
-rw-r--r--arch/arm/include/asm/io.h2
-rw-r--r--arch/arm/include/asm/mach/map.h7
-rw-r--r--arch/arm/include/asm/mach/serial_at91.h33
-rw-r--r--arch/arm/include/asm/mach/serial_sa1100.h31
-rw-r--r--arch/arm/include/asm/mach/udc_pxa2xx.h26
-rw-r--r--arch/arm/include/asm/mmu.h13
-rw-r--r--arch/arm/include/asm/mmu_context.h88
-rw-r--r--arch/arm/include/asm/percpu.h45
-rw-r--r--arch/arm/include/asm/perf_event.h7
-rw-r--r--arch/arm/include/asm/pgtable-2level.h2
-rw-r--r--arch/arm/include/asm/pgtable-3level.h4
-rw-r--r--arch/arm/include/asm/pgtable.h10
-rw-r--r--arch/arm/include/asm/pmu.h28
-rw-r--r--arch/arm/include/asm/prom.h4
-rw-r--r--arch/arm/include/asm/signal.h1
-rw-r--r--arch/arm/include/asm/smp.h1
-rw-r--r--arch/arm/include/asm/smp_plat.h17
-rw-r--r--arch/arm/include/asm/syscall.h9
-rw-r--r--arch/arm/include/asm/thread_info.h7
-rw-r--r--arch/arm/include/asm/unistd.h3
-rw-r--r--arch/arm/include/asm/xen/interface.h1
-rw-r--r--arch/arm/include/debug/imx.S74
-rw-r--r--arch/arm/include/debug/sunxi.S27
-rw-r--r--arch/arm/include/debug/tegra.S223
-rw-r--r--arch/arm/include/debug/vexpress.S11
-rw-r--r--arch/arm/include/debug/zynq.S (renamed from arch/arm/mach-zynq/include/mach/debug-macro.S)23
-rw-r--r--arch/arm/kernel/calls.S6
-rw-r--r--arch/arm/kernel/debug.S14
-rw-r--r--arch/arm/kernel/devtree.c104
-rw-r--r--arch/arm/kernel/entry-common.S32
-rw-r--r--arch/arm/kernel/head-nommu.S2
-rw-r--r--arch/arm/kernel/hw_breakpoint.c154
-rw-r--r--arch/arm/kernel/kprobes-test.c2
-rw-r--r--arch/arm/kernel/perf_event.c85
-rw-r--r--arch/arm/kernel/perf_event_cpu.c74
-rw-r--r--arch/arm/kernel/perf_event_v6.c126
-rw-r--r--arch/arm/kernel/perf_event_v7.c246
-rw-r--r--arch/arm/kernel/perf_event_xscale.c157
-rw-r--r--arch/arm/kernel/process.c15
-rw-r--r--arch/arm/kernel/ptrace.c43
-rw-r--r--arch/arm/kernel/setup.c84
-rw-r--r--arch/arm/kernel/smp.c12
-rw-r--r--arch/arm/kernel/smp_twd.c60
-rw-r--r--arch/arm/kernel/sys_arm.c31
-rw-r--r--arch/arm/kernel/topology.c42
-rw-r--r--arch/arm/kernel/vmlinux.lds.S19
-rw-r--r--arch/arm/mach-at91/Kconfig13
-rw-r--r--arch/arm/mach-at91/Makefile1
-rw-r--r--arch/arm/mach-at91/at91_aic.h (renamed from arch/arm/mach-at91/include/mach/at91_aic.h)0
-rw-r--r--arch/arm/mach-at91/at91_rstc.h (renamed from arch/arm/mach-at91/include/mach/at91_rstc.h)0
-rw-r--r--arch/arm/mach-at91/at91_shdwc.h (renamed from arch/arm/mach-at91/include/mach/at91_shdwc.h)0
-rw-r--r--arch/arm/mach-at91/at91_tc.h (renamed from arch/arm/mach-at91/include/mach/at91_tc.h)0
-rw-r--r--arch/arm/mach-at91/at91rm9200.c33
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c8
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c63
-rw-r--r--arch/arm/mach-at91/at91sam9260.c15
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9261.c17
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c8
-rw-r--r--arch/arm/mach-at91/at91sam9263.c21
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c14
-rw-r--r--arch/arm/mach-at91/at91sam9_alt_reset.S2
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c21
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9g45_reset.S3
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c18
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c14
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c24
-rw-r--r--arch/arm/mach-at91/at91x40.c3
-rw-r--r--arch/arm/mach-at91/at91x40_time.c3
-rw-r--r--arch/arm/mach-at91/board-1arm.c4
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c5
-rw-r--r--arch/arm/mach-at91/board-cam60.c4
-rw-r--r--arch/arm/mach-at91/board-carmeva.c4
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c4
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c4
-rw-r--r--arch/arm/mach-at91/board-csb337.c6
-rw-r--r--arch/arm/mach-at91/board-csb637.c4
-rw-r--r--arch/arm/mach-at91/board-dt.c7
-rw-r--r--arch/arm/mach-at91/board-eb01.c5
-rw-r--r--arch/arm/mach-at91/board-eb9200.c5
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c4
-rw-r--r--arch/arm/mach-at91/board-eco920.c4
-rw-r--r--arch/arm/mach-at91/board-flexibity.c4
-rw-r--r--arch/arm/mach-at91/board-foxg20.c4
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c8
-rw-r--r--arch/arm/mach-at91/board-kafa.c4
-rw-r--r--arch/arm/mach-at91/board-kb9202.c4
-rw-r--r--arch/arm/mach-at91/board-neocore926.c4
-rw-r--r--arch/arm/mach-at91/board-pcontrol-g20.c6
-rw-r--r--arch/arm/mach-at91/board-picotux200.c4
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c6
-rw-r--r--arch/arm/mach-at91/board-rm9200-dt.c57
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c4
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c4
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c4
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c4
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c6
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c6
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c6
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c15
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c6
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c7
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c4
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c4
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c6
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c4
-rw-r--r--arch/arm/mach-at91/board.h (renamed from arch/arm/mach-at91/include/mach/board.h)65
-rw-r--r--arch/arm/mach-at91/generic.h1
-rw-r--r--arch/arm/mach-at91/gpio.c190
-rw-r--r--arch/arm/mach-at91/gsia18s.h (renamed from arch/arm/mach-at91/include/mach/gsia18s.h)0
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pit.h32
-rw-r--r--arch/arm/mach-at91/include/mach/at91_rtc.h75
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200_emac.h138
-rw-r--r--arch/arm/mach-at91/include/mach/atmel-mci.h7
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-at91/irq.c2
-rw-r--r--arch/arm/mach-at91/leds.c2
-rw-r--r--arch/arm/mach-at91/pm.c6
-rw-r--r--arch/arm/mach-at91/setup.c22
-rw-r--r--arch/arm/mach-at91/soc.h12
-rw-r--r--arch/arm/mach-at91/stamp9g20.h (renamed from arch/arm/mach-at91/include/mach/stamp9g20.h)0
-rw-r--r--arch/arm/mach-bcm/Kconfig19
-rw-r--r--arch/arm/mach-bcm/Makefile13
-rw-r--r--arch/arm/mach-bcm/board_bcm.c57
-rw-r--r--arch/arm/mach-bcm2835/Makefile.boot4
-rw-r--r--arch/arm/mach-bcm2835/bcm2835.c50
-rw-r--r--arch/arm/mach-bcm2835/include/mach/gpio.h1
-rw-r--r--arch/arm/mach-clps711x/Kconfig2
-rw-r--r--arch/arm/mach-clps711x/Makefile12
-rw-r--r--arch/arm/mach-clps711x/Makefile.boot1
-rw-r--r--arch/arm/mach-clps711x/autcpu12.c92
-rw-r--r--arch/arm/mach-clps711x/board-autcpu12.c179
-rw-r--r--arch/arm/mach-clps711x/board-cdb89712.c147
-rw-r--r--arch/arm/mach-clps711x/board-clep7312.c (renamed from arch/arm/mach-clps711x/clep7312.c)4
-rw-r--r--arch/arm/mach-clps711x/board-edb7211.c180
-rw-r--r--arch/arm/mach-clps711x/board-fortunet.c (renamed from arch/arm/mach-clps711x/fortunet.c)2
-rw-r--r--arch/arm/mach-clps711x/board-p720t.c232
-rw-r--r--arch/arm/mach-clps711x/cdb89712.c63
-rw-r--r--arch/arm/mach-clps711x/common.c181
-rw-r--r--arch/arm/mach-clps711x/common.h7
-rw-r--r--arch/arm/mach-clps711x/edb7211-arch.c66
-rw-r--r--arch/arm/mach-clps711x/edb7211-mm.c82
-rw-r--r--arch/arm/mach-clps711x/include/mach/autcpu12.h23
-rw-r--r--arch/arm/mach-clps711x/include/mach/clps711x.h27
-rw-r--r--arch/arm/mach-clps711x/include/mach/entry-macro.S51
-rw-r--r--arch/arm/mach-clps711x/include/mach/hardware.h67
-rw-r--r--arch/arm/mach-clps711x/include/mach/irqs.h50
-rw-r--r--arch/arm/mach-clps711x/include/mach/syspld.h9
-rw-r--r--arch/arm/mach-clps711x/p720t.c181
-rw-r--r--arch/arm/mach-cns3xxx/Kconfig1
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c53
-rw-r--r--arch/arm/mach-davinci/Kconfig8
-rw-r--r--arch/arm/mach-davinci/Makefile1
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c58
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c2
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c4
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c7
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c2
-rw-r--r--arch/arm/mach-davinci/common.c2
-rw-r--r--arch/arm/mach-davinci/da850.c17
-rw-r--r--arch/arm/mach-davinci/da8xx-dt.c66
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c77
-rw-r--r--arch/arm/mach-davinci/devices-tnetv107x.c2
-rw-r--r--arch/arm/mach-davinci/dm355.c6
-rw-r--r--arch/arm/mach-davinci/dm365.c6
-rw-r--r--arch/arm/mach-davinci/dm644x.c6
-rw-r--r--arch/arm/mach-davinci/dm646x.c6
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/sram.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/uncompress.h6
-rw-r--r--arch/arm/mach-davinci/serial.c39
-rw-r--r--arch/arm/mach-davinci/sram.c23
-rw-r--r--arch/arm/mach-davinci/time.c4
-rw-r--r--arch/arm/mach-davinci/usb.c6
-rw-r--r--arch/arm/mach-dove/include/mach/pm.h2
-rw-r--r--arch/arm/mach-dove/irq.c14
-rw-r--r--arch/arm/mach-exynos/Kconfig17
-rw-r--r--arch/arm/mach-exynos/Makefile4
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c9
-rw-r--r--arch/arm/mach-exynos/clock-exynos5.c39
-rw-r--r--arch/arm/mach-exynos/common.c144
-rw-r--r--arch/arm/mach-exynos/cpuidle.c3
-rw-r--r--arch/arm/mach-exynos/dev-audio.c2
-rw-r--r--arch/arm/mach-exynos/dev-drm.c29
-rw-r--r--arch/arm/mach-exynos/dev-dwmci.c75
-rw-r--r--arch/arm/mach-exynos/dev-ohci.c2
-rw-r--r--arch/arm/mach-exynos/dev-uart.c24
-rw-r--r--arch/arm/mach-exynos/hotplug.c45
-rw-r--r--arch/arm/mach-exynos/include/mach/dwmci.h20
-rw-r--r--arch/arm/mach-exynos/include/mach/irqs.h13
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h8
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-mem.h23
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-pmu.h3
-rw-r--r--arch/arm/mach-exynos/mach-armlex4210.c1
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c5
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c76
-rw-r--r--arch/arm/mach-exynos/mach-nuri.c10
-rw-r--r--arch/arm/mach-exynos/mach-origen.c11
-rw-r--r--arch/arm/mach-exynos/mach-smdk4x12.c5
-rw-r--r--arch/arm/mach-exynos/mach-smdkv310.c10
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c8
-rw-r--r--arch/arm/mach-exynos/mct.c11
-rw-r--r--arch/arm/mach-exynos/platsmp.c30
-rw-r--r--arch/arm/mach-exynos/pm.c7
-rw-r--r--arch/arm/mach-exynos/pm_domains.c93
-rw-r--r--arch/arm/mach-exynos/setup-i2c0.c2
-rw-r--r--arch/arm/mach-highbank/Kconfig2
-rw-r--r--arch/arm/mach-highbank/Makefile1
-rw-r--r--arch/arm/mach-highbank/core.h10
-rw-r--r--arch/arm/mach-highbank/highbank.c33
-rw-r--r--arch/arm/mach-highbank/hotplug.c6
-rw-r--r--arch/arm/mach-highbank/lluart.c34
-rw-r--r--arch/arm/mach-highbank/platsmp.c7
-rw-r--r--arch/arm/mach-highbank/pm.c3
-rw-r--r--arch/arm/mach-highbank/sysregs.h19
-rw-r--r--arch/arm/mach-highbank/system.c2
-rw-r--r--arch/arm/mach-imx/3ds_debugboard.c (renamed from arch/arm/plat-mxc/3ds_debugboard.c)2
-rw-r--r--arch/arm/mach-imx/3ds_debugboard.h (renamed from arch/arm/plat-mxc/include/mach/3ds_debugboard.h)0
-rw-r--r--arch/arm/mach-imx/Kconfig110
-rw-r--r--arch/arm/mach-imx/Makefile23
-rw-r--r--arch/arm/mach-imx/avic.c (renamed from arch/arm/plat-mxc/avic.c)5
-rw-r--r--arch/arm/mach-imx/board-mx31lilly.h (renamed from arch/arm/plat-mxc/include/mach/board-mx31lilly.h)0
-rw-r--r--arch/arm/mach-imx/board-mx31lite.h (renamed from arch/arm/plat-mxc/include/mach/board-mx31lite.h)0
-rw-r--r--arch/arm/mach-imx/board-mx31moboard.h (renamed from arch/arm/plat-mxc/include/mach/board-mx31moboard.h)0
-rw-r--r--arch/arm/mach-imx/board-pcm038.h (renamed from arch/arm/plat-mxc/include/mach/board-pcm038.h)0
-rw-r--r--arch/arm/mach-imx/clk-imx1.c17
-rw-r--r--arch/arm/mach-imx/clk-imx21.c18
-rw-r--r--arch/arm/mach-imx/clk-imx25.c145
-rw-r--r--arch/arm/mach-imx/clk-imx27.c58
-rw-r--r--arch/arm/mach-imx/clk-imx31.c21
-rw-r--r--arch/arm/mach-imx/clk-imx35.c13
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c59
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c46
-rw-r--r--arch/arm/mach-imx/clk-pllv1.c4
-rw-r--r--arch/arm/mach-imx/clk-pllv3.c72
-rw-r--r--arch/arm/mach-imx/clk.h3
-rw-r--r--arch/arm/mach-imx/common.h (renamed from arch/arm/plat-mxc/include/mach/common.h)2
-rw-r--r--arch/arm/mach-imx/cpu-imx25.c5
-rw-r--r--arch/arm/mach-imx/cpu-imx27.c2
-rw-r--r--arch/arm/mach-imx/cpu-imx31.c7
-rw-r--r--arch/arm/mach-imx/cpu-imx35.c5
-rw-r--r--arch/arm/mach-imx/cpu-imx5.c3
-rw-r--r--arch/arm/mach-imx/cpu.c (renamed from arch/arm/plat-mxc/cpu.c)3
-rw-r--r--arch/arm/mach-imx/cpu_op-mx51.c3
-rw-r--r--arch/arm/mach-imx/cpufreq.c (renamed from arch/arm/plat-mxc/cpufreq.c)3
-rw-r--r--arch/arm/mach-imx/cpuidle.c (renamed from arch/arm/plat-mxc/cpuidle.c)0
-rw-r--r--arch/arm/mach-imx/cpuidle.h (renamed from arch/arm/plat-mxc/include/mach/cpuidle.h)0
-rw-r--r--arch/arm/mach-imx/devices-imx1.h3
-rw-r--r--arch/arm/mach-imx/devices-imx21.h3
-rw-r--r--arch/arm/mach-imx/devices-imx25.h3
-rw-r--r--arch/arm/mach-imx/devices-imx27.h7
-rw-r--r--arch/arm/mach-imx/devices-imx31.h3
-rw-r--r--arch/arm/mach-imx/devices-imx35.h3
-rw-r--r--arch/arm/mach-imx/devices-imx50.h3
-rw-r--r--arch/arm/mach-imx/devices-imx51.h3
-rw-r--r--arch/arm/mach-imx/devices/Kconfig (renamed from arch/arm/plat-mxc/devices/Kconfig)3
-rw-r--r--arch/arm/mach-imx/devices/Makefile (renamed from arch/arm/plat-mxc/devices/Makefile)3
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h (renamed from arch/arm/plat-mxc/include/mach/devices-common.h)18
-rw-r--r--arch/arm/mach-imx/devices/devices.c (renamed from arch/arm/plat-mxc/devices.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-ahci-imx.c (renamed from arch/arm/plat-mxc/devices/platform-ahci-imx.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-fec.c (renamed from arch/arm/plat-mxc/devices/platform-fec.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-flexcan.c (renamed from arch/arm/plat-mxc/devices/platform-flexcan.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c (renamed from arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-gpio-mxc.c (renamed from arch/arm/plat-mxc/devices/platform-gpio-mxc.c)2
-rw-r--r--arch/arm/mach-imx/devices/platform-gpio_keys.c (renamed from arch/arm/plat-mxc/devices/platform-gpio_keys.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-dma.c (renamed from arch/arm/plat-mxc/devices/platform-imx-dma.c)23
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-fb.c (renamed from arch/arm/plat-mxc/devices/platform-imx-fb.c)16
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-i2c.c (renamed from arch/arm/plat-mxc/devices/platform-imx-i2c.c)32
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-keypad.c (renamed from arch/arm/plat-mxc/devices/platform-imx-keypad.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-ssi.c (renamed from arch/arm/plat-mxc/devices/platform-imx-ssi.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-uart.c (renamed from arch/arm/plat-mxc/devices/platform-imx-uart.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-imx2-wdt.c (renamed from arch/arm/plat-mxc/devices/platform-imx2-wdt.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-imx21-hcd.c (renamed from arch/arm/plat-mxc/devices/platform-imx21-hcd.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-imx27-coda.c (renamed from arch/arm/plat-mxc/devices/platform-imx27-coda.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-imx_udc.c (renamed from arch/arm/plat-mxc/devices/platform-imx_udc.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-imxdi_rtc.c (renamed from arch/arm/plat-mxc/devices/platform-imxdi_rtc.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-ipu-core.c (renamed from arch/arm/plat-mxc/devices/platform-ipu-core.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-mx1-camera.c (renamed from arch/arm/plat-mxc/devices/platform-mx1-camera.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-mx2-camera.c (renamed from arch/arm/plat-mxc/devices/platform-mx2-camera.c)33
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc-ehci.c (renamed from arch/arm/plat-mxc/devices/platform-mxc-ehci.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc-mmc.c (renamed from arch/arm/plat-mxc/devices/platform-mxc-mmc.c)20
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_nand.c (renamed from arch/arm/plat-mxc/devices/platform-mxc_nand.c)25
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_pwm.c (renamed from arch/arm/plat-mxc/devices/platform-mxc_pwm.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_rnga.c (renamed from arch/arm/plat-mxc/devices/platform-mxc_rnga.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_rtc.c (renamed from arch/arm/plat-mxc/devices/platform-mxc_rtc.c)13
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_w1.c (renamed from arch/arm/plat-mxc/devices/platform-mxc_w1.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-pata_imx.c (renamed from arch/arm/plat-mxc/devices/platform-pata_imx.c)4
-rw-r--r--arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c (renamed from arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c)5
-rw-r--r--arch/arm/mach-imx/devices/platform-spi_imx.c (renamed from arch/arm/plat-mxc/devices/platform-spi_imx.c)4
-rw-r--r--arch/arm/mach-imx/ehci-imx25.c4
-rw-r--r--arch/arm/mach-imx/ehci-imx27.c4
-rw-r--r--arch/arm/mach-imx/ehci-imx31.c4
-rw-r--r--arch/arm/mach-imx/ehci-imx35.c4
-rw-r--r--arch/arm/mach-imx/ehci-imx5.c4
-rw-r--r--arch/arm/mach-imx/epit.c (renamed from arch/arm/plat-mxc/epit.c)6
-rw-r--r--arch/arm/mach-imx/eukrea-baseboards.h (renamed from arch/arm/plat-mxc/include/mach/eukrea-baseboards.h)0
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c7
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c8
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c7
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c7
-rw-r--r--arch/arm/mach-imx/hardware.h (renamed from arch/arm/plat-mxc/include/mach/hardware.h)26
-rw-r--r--arch/arm/mach-imx/hotplug.c3
-rw-r--r--arch/arm/mach-imx/iim.h (renamed from arch/arm/plat-mxc/include/mach/iim.h)0
-rw-r--r--arch/arm/mach-imx/imx25-dt.c48
-rw-r--r--arch/arm/mach-imx/imx27-dt.c11
-rw-r--r--arch/arm/mach-imx/imx31-dt.c5
-rw-r--r--arch/arm/mach-imx/imx51-dt.c31
-rw-r--r--arch/arm/mach-imx/include/mach/dma-mx1-mx2.h10
-rw-r--r--arch/arm/mach-imx/iomux-imx31.c5
-rw-r--r--arch/arm/mach-imx/iomux-mx1.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx1.h)2
-rw-r--r--arch/arm/mach-imx/iomux-mx21.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx21.h)4
-rw-r--r--arch/arm/mach-imx/iomux-mx25.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx25.h)2
-rw-r--r--arch/arm/mach-imx/iomux-mx27.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx27.h)4
-rw-r--r--arch/arm/mach-imx/iomux-mx2x.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx2x.h)0
-rw-r--r--arch/arm/mach-imx/iomux-mx3.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx3.h)0
-rw-r--r--arch/arm/mach-imx/iomux-mx35.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx35.h)2
-rw-r--r--arch/arm/mach-imx/iomux-mx50.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx50.h)2
-rw-r--r--arch/arm/mach-imx/iomux-mx51.h (renamed from arch/arm/plat-mxc/include/mach/iomux-mx51.h)2
-rw-r--r--arch/arm/mach-imx/iomux-v1.c (renamed from arch/arm/plat-mxc/iomux-v1.c)5
-rw-r--r--arch/arm/mach-imx/iomux-v1.h (renamed from arch/arm/plat-mxc/include/mach/iomux-v1.h)0
-rw-r--r--arch/arm/mach-imx/iomux-v3.c (renamed from arch/arm/plat-mxc/iomux-v3.c)5
-rw-r--r--arch/arm/mach-imx/iomux-v3.h (renamed from arch/arm/plat-mxc/include/mach/iomux-v3.h)0
-rw-r--r--arch/arm/mach-imx/iram.h (renamed from arch/arm/plat-mxc/include/mach/iram.h)0
-rw-r--r--arch/arm/mach-imx/iram_alloc.c (renamed from arch/arm/plat-mxc/iram_alloc.c)3
-rw-r--r--arch/arm/mach-imx/irq-common.c (renamed from arch/arm/plat-mxc/irq-common.c)0
-rw-r--r--arch/arm/mach-imx/irq-common.h (renamed from arch/arm/plat-mxc/irq-common.h)3
-rw-r--r--arch/arm/mach-imx/lluart.c31
-rw-r--r--arch/arm/mach-imx/mach-apf9328.c7
-rw-r--r--arch/arm/mach-imx/mach-armadillo5x0.c9
-rw-r--r--arch/arm/mach-imx/mach-bug.c7
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c11
-rw-r--r--arch/arm/mach-imx/mach-cpuimx35.c9
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c9
-rw-r--r--arch/arm/mach-imx/mach-eukrea_cpuimx25.c10
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c58
-rw-r--r--arch/arm/mach-imx/mach-imx27ipcam.c6
-rw-r--r--arch/arm/mach-imx/mach-imx27lite.c6
-rw-r--r--arch/arm/mach-imx/mach-imx53.c34
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c53
-rw-r--r--arch/arm/mach-imx/mach-kzm_arm11_01.c7
-rw-r--r--arch/arm/mach-imx/mach-mx1ads.c7
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c6
-rw-r--r--arch/arm/mach-imx/mach-mx25_3ds.c8
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c10
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c6
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c12
-rw-r--r--arch/arm/mach-imx/mach-mx31ads.c5
-rw-r--r--arch/arm/mach-imx/mach-mx31lilly.c11
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c11
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c14
-rw-r--r--arch/arm/mach-imx/mach-mx35_3ds.c8
-rw-r--r--arch/arm/mach-imx/mach-mx50_rdp.c7
-rw-r--r--arch/arm/mach-imx/mach-mx51_3ds.c9
-rw-r--r--arch/arm/mach-imx/mach-mx51_babbage.c7
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c6
-rw-r--r--arch/arm/mach-imx/mach-pca100.c8
-rw-r--r--arch/arm/mach-imx/mach-pcm037.c8
-rw-r--r--arch/arm/mach-imx/mach-pcm037_eet.c5
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c13
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c9
-rw-r--r--arch/arm/mach-imx/mach-qong.c6
-rw-r--r--arch/arm/mach-imx/mach-scb9328.c7
-rw-r--r--arch/arm/mach-imx/mach-vpr200.c7
-rw-r--r--arch/arm/mach-imx/mm-imx1.c9
-rw-r--r--arch/arm/mach-imx/mm-imx21.c14
-rw-r--r--arch/arm/mach-imx/mm-imx25.c12
-rw-r--r--arch/arm/mach-imx/mm-imx27.c14
-rw-r--r--arch/arm/mach-imx/mm-imx3.c13
-rw-r--r--arch/arm/mach-imx/mm-imx5.c32
-rw-r--r--arch/arm/mach-imx/mx1.h (renamed from arch/arm/plat-mxc/include/mach/mx1.h)0
-rw-r--r--arch/arm/mach-imx/mx21.h (renamed from arch/arm/plat-mxc/include/mach/mx21.h)0
-rw-r--r--arch/arm/mach-imx/mx25.h (renamed from arch/arm/plat-mxc/include/mach/mx25.h)0
-rw-r--r--arch/arm/mach-imx/mx27.h (renamed from arch/arm/plat-mxc/include/mach/mx27.h)0
-rw-r--r--arch/arm/mach-imx/mx2x.h (renamed from arch/arm/plat-mxc/include/mach/mx2x.h)0
-rw-r--r--arch/arm/mach-imx/mx31.h (renamed from arch/arm/plat-mxc/include/mach/mx31.h)0
-rw-r--r--arch/arm/mach-imx/mx31lilly-db.c9
-rw-r--r--arch/arm/mach-imx/mx31lite-db.c9
-rw-r--r--arch/arm/mach-imx/mx31moboard-devboard.c9
-rw-r--r--arch/arm/mach-imx/mx31moboard-marxbot.c9
-rw-r--r--arch/arm/mach-imx/mx31moboard-smartbot.c11
-rw-r--r--arch/arm/mach-imx/mx35.h (renamed from arch/arm/plat-mxc/include/mach/mx35.h)0
-rw-r--r--arch/arm/mach-imx/mx3x.h (renamed from arch/arm/plat-mxc/include/mach/mx3x.h)0
-rw-r--r--arch/arm/mach-imx/mx50.h (renamed from arch/arm/plat-mxc/include/mach/mx50.h)0
-rw-r--r--arch/arm/mach-imx/mx51.h (renamed from arch/arm/plat-mxc/include/mach/mx51.h)0
-rw-r--r--arch/arm/mach-imx/mx53.h (renamed from arch/arm/plat-mxc/include/mach/mx53.h)0
-rw-r--r--arch/arm/mach-imx/mx6q.h (renamed from arch/arm/plat-mxc/include/mach/mx6q.h)4
-rw-r--r--arch/arm/mach-imx/mxc.h (renamed from arch/arm/plat-mxc/include/mach/mxc.h)0
-rw-r--r--arch/arm/mach-imx/pcm970-baseboard.c7
-rw-r--r--arch/arm/mach-imx/platsmp.c5
-rw-r--r--arch/arm/mach-imx/pm-imx27.c3
-rw-r--r--arch/arm/mach-imx/pm-imx3.c7
-rw-r--r--arch/arm/mach-imx/pm-imx5.c7
-rw-r--r--arch/arm/mach-imx/pm-imx6q.c5
-rw-r--r--arch/arm/mach-imx/ssi-fiq-ksym.c (renamed from arch/arm/plat-mxc/ssi-fiq-ksym.c)0
-rw-r--r--arch/arm/mach-imx/ssi-fiq.S (renamed from arch/arm/plat-mxc/ssi-fiq.S)0
-rw-r--r--arch/arm/mach-imx/system.c (renamed from arch/arm/plat-mxc/system.c)5
-rw-r--r--arch/arm/mach-imx/time.c (renamed from arch/arm/plat-mxc/time.c)5
-rw-r--r--arch/arm/mach-imx/tzic.c (renamed from arch/arm/plat-mxc/tzic.c)6
-rw-r--r--arch/arm/mach-imx/ulpi.c (renamed from arch/arm/plat-mxc/ulpi.c)2
-rw-r--r--arch/arm/mach-imx/ulpi.h (renamed from arch/arm/plat-mxc/include/mach/ulpi.h)0
-rw-r--r--arch/arm/mach-integrator/Kconfig2
-rw-r--r--arch/arm/mach-integrator/common.h8
-rw-r--r--arch/arm/mach-integrator/core.c141
-rw-r--r--arch/arm/mach-integrator/impd1.c76
-rw-r--r--arch/arm/mach-integrator/include/mach/irqs.h109
-rw-r--r--arch/arm/mach-integrator/include/mach/platform.h1
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c163
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c121
-rw-r--r--arch/arm/mach-integrator/pci_v3.c32
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c1
-rw-r--r--arch/arm/mach-ixp4xx/common.c13
-rw-r--r--arch/arm/mach-ixp4xx/goramo_mlr.c3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/debug-macro.S4
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h46
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/qmgr.h12
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/udc.h2
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_npe.c9
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_qmgr.c12
-rw-r--r--arch/arm/mach-kirkwood/Kconfig70
-rw-r--r--arch/arm/mach-kirkwood/Makefile9
-rw-r--r--arch/arm/mach-kirkwood/board-dnskw.c54
-rw-r--r--arch/arm/mach-kirkwood/board-dockstar.c29
-rw-r--r--arch/arm/mach-kirkwood/board-dreamplug.c30
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c34
-rw-r--r--arch/arm/mach-kirkwood/board-goflexnet.c37
-rw-r--r--arch/arm/mach-kirkwood/board-ib62x0.c41
-rw-r--r--arch/arm/mach-kirkwood/board-iconnect.c26
-rw-r--r--arch/arm/mach-kirkwood/board-iomega_ix2_200.c28
-rw-r--r--arch/arm/mach-kirkwood/board-km_kirkwood.c13
-rw-r--r--arch/arm/mach-kirkwood/board-lsxl.c83
-rw-r--r--arch/arm/mach-kirkwood/board-mplcec4.c44
-rw-r--r--arch/arm/mach-kirkwood/board-ns2.c86
-rw-r--r--arch/arm/mach-kirkwood/board-nsa310.c101
-rw-r--r--arch/arm/mach-kirkwood/board-openblocks_a6.c70
-rw-r--r--arch/arm/mach-kirkwood/board-ts219.c29
-rw-r--r--arch/arm/mach-kirkwood/board-usi_topkick.c81
-rw-r--r--arch/arm/mach-kirkwood/common.c12
-rw-r--r--arch/arm/mach-kirkwood/common.h37
-rw-r--r--arch/arm/mach-kirkwood/cpuidle.c2
-rw-r--r--arch/arm/mach-kirkwood/dockstar-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/irq.c1
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.c1
-rw-r--r--arch/arm/mach-kirkwood/mpp.c4
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c4
-rw-r--r--arch/arm/mach-kirkwood/openrd-setup.c14
-rw-r--r--arch/arm/mach-kirkwood/pcie.c42
-rw-r--r--arch/arm/mach-kirkwood/sheevaplug-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/t5325-setup.c6
-rw-r--r--arch/arm/mach-kirkwood/ts41x-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/tsx1x-common.c7
-rw-r--r--arch/arm/mach-lpc32xx/clock.c8
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/platform.h1
-rw-r--r--arch/arm/mach-lpc32xx/irq.c23
-rw-r--r--arch/arm/mach-mmp/Kconfig4
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c56
-rw-r--r--arch/arm/mach-mxs/timer.c10
-rw-r--r--arch/arm/mach-netx/xc.c2
-rw-r--r--arch/arm/mach-nomadik/Kconfig2
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c13
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c2
-rw-r--r--arch/arm/mach-nomadik/i2c-8815nhk.c3
-rw-r--r--arch/arm/mach-nomadik/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-omap1/Makefile3
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c1
-rw-r--r--arch/arm/mach-omap1/board-fsample.c12
-rw-r--r--arch/arm/mach-omap1/board-generic.c1
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c5
-rw-r--r--arch/arm/mach-omap1/board-h2.c9
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c8
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c3
-rw-r--r--arch/arm/mach-omap1/board-innovator.c30
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c5
-rw-r--r--arch/arm/mach-omap1/board-osk.c3
-rw-r--r--arch/arm/mach-omap1/board-palmte.c6
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c8
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c6
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c12
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-sx1.c6
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c3
-rw-r--r--arch/arm/mach-omap1/clock.c507
-rw-r--r--arch/arm/mach-omap1/clock.h178
-rw-r--r--arch/arm/mach-omap1/clock_data.c16
-rw-r--r--arch/arm/mach-omap1/common.h7
-rw-r--r--arch/arm/mach-omap1/devices.c35
-rw-r--r--arch/arm/mach-omap1/dma.c9
-rw-r--r--arch/arm/mach-omap1/dma.h83
-rw-r--r--arch/arm/mach-omap1/flash.c2
-rw-r--r--arch/arm/mach-omap1/fpga.c4
-rw-r--r--arch/arm/mach-omap1/fpga.h52
-rw-r--r--arch/arm/mach-omap1/gpio15xx.c2
-rw-r--r--arch/arm/mach-omap1/gpio16xx.c2
-rw-r--r--arch/arm/mach-omap1/gpio7xx.c2
-rw-r--r--arch/arm/mach-omap1/i2c.c64
-rw-r--r--arch/arm/mach-omap1/id.c2
-rw-r--r--arch/arm/mach-omap1/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-omap1/include/mach/entry-macro.S2
-rw-r--r--arch/arm/mach-omap1/include/mach/gpio.h3
-rw-r--r--arch/arm/mach-omap1/include/mach/hardware.h9
-rw-r--r--arch/arm/mach-omap1/include/mach/memory.h2
-rw-r--r--arch/arm/mach-omap1/include/mach/omap1510.h113
-rw-r--r--arch/arm/mach-omap1/include/mach/serial.h53
-rw-r--r--arch/arm/mach-omap1/include/mach/soc.h229
-rw-r--r--arch/arm/mach-omap1/include/mach/tc.h (renamed from arch/arm/plat-omap/include/plat/tc.h)0
-rw-r--r--arch/arm/mach-omap1/include/mach/uncompress.h121
-rw-r--r--arch/arm/mach-omap1/io.c5
-rw-r--r--arch/arm/mach-omap1/iomap.h3
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c4
-rw-r--r--arch/arm/mach-omap1/mcbsp.c5
-rw-r--r--arch/arm/mach-omap1/mmc.h18
-rw-r--r--arch/arm/mach-omap1/opp_data.c2
-rw-r--r--arch/arm/mach-omap1/pm.c10
-rw-r--r--arch/arm/mach-omap1/pm_bus.c3
-rw-r--r--arch/arm/mach-omap1/reset.c41
-rw-r--r--arch/arm/mach-omap1/serial.c1
-rw-r--r--arch/arm/mach-omap1/sleep.S2
-rw-r--r--arch/arm/mach-omap1/soc.h4
-rw-r--r--arch/arm/mach-omap1/sram-init.c76
-rw-r--r--arch/arm/mach-omap1/sram.h7
-rw-r--r--arch/arm/mach-omap1/timer.c1
-rw-r--r--arch/arm/mach-omap1/timer32k.c2
-rw-r--r--arch/arm/mach-omap1/usb.c6
-rw-r--r--arch/arm/mach-omap2/Kconfig9
-rw-r--r--arch/arm/mach-omap2/Makefile132
-rw-r--r--arch/arm/mach-omap2/am33xx.h1
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.c2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c6
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c8
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c5
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c163
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c3
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c4
-rw-r--r--arch/arm/mach-omap2/board-apollon.c6
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c28
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c10
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c13
-rw-r--r--arch/arm/mach-omap2/board-flash.c52
-rw-r--r--arch/arm/mach-omap2/board-flash.h8
-rw-r--r--arch/arm/mach-omap2/board-generic.c37
-rw-r--r--arch/arm/mach-omap2/board-h4.c10
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c13
-rw-r--r--arch/arm/mach-omap2/board-ldp.c11
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c11
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c18
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c13
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c11
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c6
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c5
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c13
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c75
-rw-r--r--arch/arm/mach-omap2/board-overo.c14
-rw-r--r--arch/arm/mach-omap2/board-rm680.c15
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c7
-rw-r--r--arch/arm/mach-omap2/board-rx51.c12
-rw-r--r--arch/arm/mach-omap2/board-ti8168evm.c7
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c4
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c3
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c3
-rw-r--r--arch/arm/mach-omap2/board-zoom.c12
-rw-r--r--arch/arm/mach-omap2/board-zoom.h (renamed from arch/arm/mach-omap2/include/mach/board-zoom.h)0
-rw-r--r--arch/arm/mach-omap2/cclock2420_data.c1950
-rw-r--r--arch/arm/mach-omap2/cclock2430_data.c2065
-rw-r--r--arch/arm/mach-omap2/cclock33xx_data.c961
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c3595
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c1987
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_apll.c92
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpll.c12
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c49
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c15
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_sys.c9
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c85
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c13
-rw-r--r--arch/arm/mach-omap2/clkt_clksel.c196
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c30
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c32
-rw-r--r--arch/arm/mach-omap2/clock.c470
-rw-r--r--arch/arm/mach-omap2/clock.h452
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c1990
-rw-r--r--arch/arm/mach-omap2/clock2430.c12
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c2089
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c19
-rw-r--r--arch/arm/mach-omap2/clock2xxx.h48
-rw-r--r--arch/arm/mach-omap2/clock33xx_data.c1112
-rw-r--r--arch/arm/mach-omap2/clock34xx.c55
-rw-r--r--arch/arm/mach-omap2/clock3517.c28
-rw-r--r--arch/arm/mach-omap2/clock36xx.c24
-rw-r--r--arch/arm/mach-omap2/clock36xx.h2
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c8
-rw-r--r--arch/arm/mach-omap2/clock3xxx.h6
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c3617
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c3402
-rw-r--r--arch/arm/mach-omap2/clock_common_data.c22
-rw-r--r--arch/arm/mach-omap2/clockdomain.c92
-rw-r--r--arch/arm/mach-omap2/clockdomain.h5
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c339
-rw-r--r--arch/arm/mach-omap2/clockdomain33xx.c74
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c151
-rw-r--r--arch/arm/mach-omap2/clockdomains2420_data.c1
-rw-r--r--arch/arm/mach-omap2/clockdomains2430_data.c1
-rw-r--r--arch/arm/mach-omap2/clockdomains3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/cm-regbits-24xx.h7
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h31
-rw-r--r--arch/arm/mach-omap2/cm.h30
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c381
-rw-r--r--arch/arm/mach-omap2/cm2xxx.h70
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h126
-rw-r--r--arch/arm/mach-omap2/cm33xx.c58
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c (renamed from arch/arm/mach-omap2/cm2xxx_3xxx.c)371
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h91
-rw-r--r--arch/arm/mach-omap2/cm_common.c140
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c142
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h2
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c46
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h1
-rw-r--r--arch/arm/mach-omap2/common.c187
-rw-r--r--arch/arm/mach-omap2/common.h151
-rw-r--r--arch/arm/mach-omap2/control.c18
-rw-r--r--arch/arm/mach-omap2/control.h3
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c1
-rw-r--r--arch/arm/mach-omap2/devices.c46
-rw-r--r--arch/arm/mach-omap2/display.c47
-rw-r--r--arch/arm/mach-omap2/dma.c11
-rw-r--r--arch/arm/mach-omap2/dma.h131
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c185
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c23
-rw-r--r--arch/arm/mach-omap2/drm.c11
-rw-r--r--arch/arm/mach-omap2/dsp.c2
-rw-r--r--arch/arm/mach-omap2/dss-common.c276
-rw-r--r--arch/arm/mach-omap2/dss-common.h14
-rw-r--r--arch/arm/mach-omap2/gpio.c6
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c85
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.h27
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c343
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.h24
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c45
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c2
-rw-r--r--arch/arm/mach-omap2/gpmc.c837
-rw-r--r--arch/arm/mach-omap2/gpmc.h (renamed from arch/arm/plat-omap/include/plat/gpmc.h)168
-rw-r--r--arch/arm/mach-omap2/hdq1w.c8
-rw-r--r--arch/arm/mach-omap2/hdq1w.h2
-rw-r--r--arch/arm/mach-omap2/hsmmc.c8
-rw-r--r--arch/arm/mach-omap2/hwspinlock.c4
-rw-r--r--arch/arm/mach-omap2/i2c.c73
-rw-r--r--arch/arm/mach-omap2/i2c.h42
-rw-r--r--arch/arm/mach-omap2/id.c32
-rw-r--r--arch/arm/mach-omap2/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-omap2/include/mach/gpio.h3
-rw-r--r--arch/arm/mach-omap2/include/mach/serial.h (renamed from arch/arm/plat-omap/include/plat/serial.h)29
-rw-r--r--arch/arm/mach-omap2/include/mach/uncompress.h175
-rw-r--r--arch/arm/mach-omap2/io.c126
-rw-r--r--arch/arm/mach-omap2/iommu2.c361
-rw-r--r--arch/arm/mach-omap2/mcbsp.c9
-rw-r--r--arch/arm/mach-omap2/mmc.h23
-rw-r--r--arch/arm/mach-omap2/msdi.c11
-rw-r--r--arch/arm/mach-omap2/mux.c3
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S38
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c2
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c10
-rw-r--r--arch/arm/mach-omap2/omap-pm-noop.c (renamed from arch/arm/plat-omap/omap-pm-noop.c)5
-rw-r--r--arch/arm/mach-omap2/omap-pm.h (renamed from arch/arm/plat-omap/include/plat/omap-pm.h)0
-rw-r--r--arch/arm/mach-omap2/omap-secure.c1
-rw-r--r--arch/arm/mach-omap2/omap-secure.h7
-rw-r--r--arch/arm/mach-omap2/omap-smp.c41
-rw-r--r--arch/arm/mach-omap2/omap2-restart.c65
-rw-r--r--arch/arm/mach-omap2/omap3-restart.c36
-rw-r--r--arch/arm/mach-omap2/omap4-common.c69
-rw-r--r--arch/arm/mach-omap2/omap_device.c (renamed from arch/arm/plat-omap/omap_device.c)92
-rw-r--r--arch/arm/mach-omap2/omap_device.h (renamed from arch/arm/plat-omap/include/plat/omap_device.h)2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c208
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h (renamed from arch/arm/plat-omap/include/plat/omap_hwmod.h)13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c14
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c21
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c41
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c57
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c18
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h2
-rw-r--r--arch/arm/mach-omap2/omap_opp_data.h11
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c36
-rw-r--r--arch/arm/mach-omap2/omap_twl.c74
-rw-r--r--arch/arm/mach-omap2/opp.c2
-rw-r--r--arch/arm/mach-omap2/opp3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/opp4xxx_data.c98
-rw-r--r--arch/arm/mach-omap2/pm-debug.c6
-rw-r--r--arch/arm/mach-omap2/pm.c37
-rw-r--r--arch/arm/mach-omap2/pm.h19
-rw-r--r--arch/arm/mach-omap2/pm24xx.c17
-rw-r--r--arch/arm/mach-omap2/pm34xx.c16
-rw-r--r--arch/arm/mach-omap2/pm44xx.c8
-rw-r--r--arch/arm/mach-omap2/pmu.c7
-rw-r--r--arch/arm/mach-omap2/powerdomain.c2
-rw-r--r--arch/arm/mach-omap2/powerdomain.h2
-rw-r--r--arch/arm/mach-omap2/powerdomain2xxx_3xxx.c242
-rw-r--r--arch/arm/mach-omap2/powerdomain33xx.c229
-rw-r--r--arch/arm/mach-omap2/powerdomain44xx.c285
-rw-r--r--arch/arm/mach-omap2/powerdomains2xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/prcm-common.h22
-rw-r--r--arch/arm/mach-omap2/prcm.c188
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.c17
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h9
-rw-r--r--arch/arm/mach-omap2/prm-regbits-24xx.h8
-rw-r--r--arch/arm/mach-omap2/prm-regbits-34xx.h13
-rw-r--r--arch/arm/mach-omap2/prm.h86
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c138
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h133
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c332
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h285
-rw-r--r--arch/arm/mach-omap2/prm33xx.c204
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c420
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h163
-rw-r--r--arch/arm/mach-omap2/prm44xx.c391
-rw-r--r--arch/arm/mach-omap2/prm44xx.h3
-rw-r--r--arch/arm/mach-omap2/prm_common.c155
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h2
-rw-r--r--arch/arm/mach-omap2/scrm44xx.h2
-rw-r--r--arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h2
-rw-r--r--arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h2
-rw-r--r--arch/arm/mach-omap2/sdram-nokia.c4
-rw-r--r--arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h2
-rw-r--r--arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h2
-rw-r--r--arch/arm/mach-omap2/sdrc.c29
-rw-r--r--arch/arm/mach-omap2/sdrc.h148
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c7
-rw-r--r--arch/arm/mach-omap2/serial.c13
-rw-r--r--arch/arm/mach-omap2/serial.h1
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S7
-rw-r--r--arch/arm/mach-omap2/soc.h464
-rw-r--r--arch/arm/mach-omap2/sr_device.c17
-rw-r--r--arch/arm/mach-omap2/sram.c305
-rw-r--r--arch/arm/mach-omap2/sram.h83
-rw-r--r--arch/arm/mach-omap2/sram242x.S4
-rw-r--r--arch/arm/mach-omap2/sram243x.S4
-rw-r--r--arch/arm/mach-omap2/sram34xx.S2
-rw-r--r--arch/arm/mach-omap2/ti81xx.h9
-rw-r--r--arch/arm/mach-omap2/timer.c391
-rw-r--r--arch/arm/mach-omap2/twl-common.c3
-rw-r--r--arch/arm/mach-omap2/usb-host.c6
-rw-r--r--arch/arm/mach-omap2/usb-musb.c8
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c184
-rw-r--r--arch/arm/mach-omap2/usb.h82
-rw-r--r--arch/arm/mach-omap2/vc.c453
-rw-r--r--arch/arm/mach-omap2/vc.h8
-rw-r--r--arch/arm/mach-omap2/vc3xxx_data.c22
-rw-r--r--arch/arm/mach-omap2/vc44xx_data.c28
-rw-r--r--arch/arm/mach-omap2/voltage.h44
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c5
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c25
-rw-r--r--arch/arm/mach-omap2/vp.c19
-rw-r--r--arch/arm/mach-omap2/vp.h7
-rw-r--r--arch/arm/mach-omap2/vp3xxx_data.c10
-rw-r--r--arch/arm/mach-omap2/vp44xx_data.c15
-rw-r--r--arch/arm/mach-omap2/wd_timer.c40
-rw-r--r--arch/arm/mach-omap2/wd_timer.h2
-rw-r--r--arch/arm/mach-orion5x/Kconfig14
-rw-r--r--arch/arm/mach-orion5x/Makefile4
-rw-r--r--arch/arm/mach-orion5x/board-dt.c79
-rw-r--r--arch/arm/mach-orion5x/common.c4
-rw-r--r--arch/arm/mach-orion5x/common.h9
-rw-r--r--arch/arm/mach-orion5x/edmini_v2-setup.c88
-rw-r--r--arch/arm/mach-pxa/Kconfig34
-rw-r--r--arch/arm/mach-pxa/Makefile3
-rw-r--r--arch/arm/mach-pxa/clock.h2
-rw-r--r--arch/arm/mach-pxa/devices.c8
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h28
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa95x.h7
-rw-r--r--arch/arm/mach-pxa/include/mach/udc.h2
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c6
-rw-r--r--arch/arm/mach-pxa/pxa25x.c6
-rw-r--r--arch/arm/mach-pxa/pxa3xx-ulpi.c13
-rw-r--r--arch/arm/mach-pxa/pxa95x.c295
-rw-r--r--arch/arm/mach-pxa/saarb.c115
-rw-r--r--arch/arm/mach-pxa/tavorevb3.c136
-rw-r--r--arch/arm/mach-realview/realview_eb.c1
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig3
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2440.c1
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2443.c6
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/bast-map.h2
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/dma.h2
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/vr1000-map.h2
-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-mini2440.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c1
-rw-r--r--arch/arm/mach-s3c24xx/pm.c2
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig2
-rw-r--r--arch/arm/mach-s3c64xx/clock.c20
-rw-r--r--arch/arm/mach-s3c64xx/common.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410-module.c141
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c50
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c1
-rw-r--r--arch/arm/mach-s5p64x0/common.c2
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6440.c1
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6450.c1
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c1
-rw-r--r--arch/arm/mach-s5pv210/common.c2
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c1
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkc110.c1
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c1
-rw-r--r--arch/arm/mach-sa1100/assabet.c2
-rw-r--r--arch/arm/mach-sa1100/badge4.c2
-rw-r--r--arch/arm/mach-sa1100/cerf.c2
-rw-r--r--arch/arm/mach-sa1100/collie.c2
-rw-r--r--arch/arm/mach-sa1100/h3xxx.c2
-rw-r--r--arch/arm/mach-sa1100/hackkit.c2
-rw-r--r--arch/arm/mach-sa1100/jornada720.c2
-rw-r--r--arch/arm/mach-sa1100/lart.c2
-rw-r--r--arch/arm/mach-sa1100/nanoengine.c2
-rw-r--r--arch/arm/mach-sa1100/neponset.c2
-rw-r--r--arch/arm/mach-sa1100/pleb.c2
-rw-r--r--arch/arm/mach-sa1100/shannon.c2
-rw-r--r--arch/arm/mach-sa1100/simpad.c2
-rw-r--r--arch/arm/mach-shmobile/Kconfig31
-rw-r--r--arch/arm/mach-shmobile/Makefile8
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c139
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c46
-rw-r--r--arch/arm/mach-shmobile/board-g3evm.c343
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c384
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c16
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c88
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c211
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c34
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c23
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c355
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c94
-rw-r--r--arch/arm/mach-shmobile/clock-sh7377.c366
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h18
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h2
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7367.h332
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h6
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7377.h360
-rw-r--r--arch/arm/mach-shmobile/intc-sh7367.c413
-rw-r--r--arch/arm/mach-shmobile/intc-sh7377.c592
-rw-r--r--arch/arm/mach-shmobile/pfc-r8a7779.c16
-rw-r--r--arch/arm/mach-shmobile/pfc-sh7367.c1727
-rw-r--r--arch/arm/mach-shmobile/pfc-sh7377.c1688
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c24
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c77
-rw-r--r--arch/arm/mach-shmobile/setup-sh7367.c481
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c26
-rw-r--r--arch/arm/mach-shmobile/setup-sh7377.c549
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c22
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c25
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c23
-rw-r--r--arch/arm/mach-sunxi/Kconfig9
-rw-r--r--arch/arm/mach-sunxi/Makefile1
-rw-r--r--arch/arm/mach-sunxi/Makefile.boot1
-rw-r--r--arch/arm/mach-sunxi/sunxi.c96
-rw-r--r--arch/arm/mach-sunxi/sunxi.h20
-rw-r--r--arch/arm/mach-tegra/Kconfig53
-rw-r--r--arch/arm/mach-tegra/Makefile13
-rw-r--r--arch/arm/mach-tegra/apbio.c5
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c27
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra30.c28
-rw-r--r--arch/arm/mach-tegra/clock.c2
-rw-r--r--arch/arm/mach-tegra/common.c33
-rw-r--r--arch/arm/mach-tegra/cpu-tegra.c3
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra20.c66
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra30.c188
-rw-r--r--arch/arm/mach-tegra/cpuidle.c85
-rw-r--r--arch/arm/mach-tegra/cpuidle.h32
-rw-r--r--arch/arm/mach-tegra/flowctrl.c50
-rw-r--r--arch/arm/mach-tegra/flowctrl.h8
-rw-r--r--arch/arm/mach-tegra/fuse.c52
-rw-r--r--arch/arm/mach-tegra/fuse.h16
-rw-r--r--arch/arm/mach-tegra/headsmp.S74
-rw-r--r--arch/arm/mach-tegra/include/mach/debug-macro.S100
-rw-r--r--arch/arm/mach-tegra/include/mach/dma.h54
-rw-r--r--arch/arm/mach-tegra/include/mach/irqs.h182
-rw-r--r--arch/arm/mach-tegra/include/mach/powergate.h2
-rw-r--r--arch/arm/mach-tegra/include/mach/tegra-ahb.h19
-rw-r--r--arch/arm/mach-tegra/include/mach/uncompress.h67
-rw-r--r--arch/arm/mach-tegra/io.c3
-rw-r--r--arch/arm/mach-tegra/iomap.h (renamed from arch/arm/mach-tegra/include/mach/iomap.h)16
-rw-r--r--arch/arm/mach-tegra/irammap.h (renamed from arch/arm/mach-tegra/include/mach/irammap.h)9
-rw-r--r--arch/arm/mach-tegra/irq.c3
-rw-r--r--arch/arm/mach-tegra/pcie.c5
-rw-r--r--arch/arm/mach-tegra/platsmp.c3
-rw-r--r--arch/arm/mach-tegra/pm.c216
-rw-r--r--arch/arm/mach-tegra/pm.h35
-rw-r--r--arch/arm/mach-tegra/pmc.c2
-rw-r--r--arch/arm/mach-tegra/powergate.c2
-rw-r--r--arch/arm/mach-tegra/reset.c11
-rw-r--r--arch/arm/mach-tegra/reset.h9
-rw-r--r--arch/arm/mach-tegra/sleep-tegra20.S (renamed from arch/arm/mach-tegra/sleep-t20.S)2
-rw-r--r--arch/arm/mach-tegra/sleep-tegra30.S (renamed from arch/arm/mach-tegra/sleep-t30.S)68
-rw-r--r--arch/arm/mach-tegra/sleep.S80
-rw-r--r--arch/arm/mach-tegra/sleep.h39
-rw-r--r--arch/arm/mach-tegra/tegra20_clocks.c3
-rw-r--r--arch/arm/mach-tegra/tegra20_clocks_data.c13
-rw-r--r--arch/arm/mach-tegra/tegra20_speedo.c109
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.c2
-rw-r--r--arch/arm/mach-tegra/tegra30_clocks.c215
-rw-r--r--arch/arm/mach-tegra/tegra30_clocks.h1
-rw-r--r--arch/arm/mach-tegra/tegra30_clocks_data.c51
-rw-r--r--arch/arm/mach-tegra/tegra30_speedo.c292
-rw-r--r--arch/arm/mach-tegra/tegra_cpu_car.h37
-rw-r--r--arch/arm/mach-tegra/timer.c78
-rw-r--r--arch/arm/mach-u300/core.c7
-rw-r--r--arch/arm/mach-u300/include/mach/irqs.h126
-rw-r--r--arch/arm/mach-ux500/Kconfig2
-rw-r--r--arch/arm/mach-ux500/board-mop500-audio.c22
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c428
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500-stuib.c22
-rw-r--r--arch/arm/mach-ux500/board-mop500.c222
-rw-r--r--arch/arm/mach-ux500/board-mop500.h10
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c123
-rw-r--r--arch/arm/mach-ux500/cpu.c3
-rw-r--r--arch/arm/mach-ux500/devices-common.c4
-rw-r--r--arch/arm/mach-ux500/devices-common.h8
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c4
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h1
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-ux500/include/mach/msp.h2
-rw-r--r--arch/arm/mach-ux500/timer.c5
-rw-r--r--arch/arm/mach-ux500/usb.c4
-rw-r--r--arch/arm/mach-versatile/core.c2
-rw-r--r--arch/arm/mach-vexpress/Kconfig4
-rw-r--r--arch/arm/mach-vexpress/Makefile2
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c41
-rw-r--r--arch/arm/mach-vexpress/include/mach/motherboard.h81
-rw-r--r--arch/arm/mach-vexpress/platsmp.c3
-rw-r--r--arch/arm/mach-vexpress/reset.c141
-rw-r--r--arch/arm/mach-vexpress/v2m.c351
-rw-r--r--arch/arm/mach-vt8500/Kconfig12
-rw-r--r--arch/arm/mach-vt8500/common.h3
-rw-r--r--arch/arm/mach-vt8500/include/mach/entry-macro.S26
-rw-r--r--arch/arm/mach-vt8500/include/mach/hardware.h12
-rw-r--r--arch/arm/mach-vt8500/include/mach/i8042.h18
-rw-r--r--arch/arm/mach-vt8500/include/mach/irqs.h22
-rw-r--r--arch/arm/mach-vt8500/include/mach/restart.h17
-rw-r--r--arch/arm/mach-vt8500/irq.c108
-rw-r--r--arch/arm/mach-vt8500/timer.c2
-rw-r--r--arch/arm/mach-vt8500/vt8500.c3
-rw-r--r--arch/arm/mach-zynq/Kconfig13
-rw-r--r--arch/arm/mach-zynq/common.c80
-rw-r--r--arch/arm/mach-zynq/common.h4
-rw-r--r--arch/arm/mach-zynq/include/mach/clkdev.h32
-rw-r--r--arch/arm/mach-zynq/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-zynq/include/mach/irqs.h21
-rw-r--r--arch/arm/mach-zynq/include/mach/timex.h23
-rw-r--r--arch/arm/mach-zynq/include/mach/uart.h25
-rw-r--r--arch/arm/mach-zynq/include/mach/uncompress.h51
-rw-r--r--arch/arm/mach-zynq/include/mach/zynq_soc.h48
-rw-r--r--arch/arm/mach-zynq/timer.c298
-rw-r--r--arch/arm/mm/cache-aurora-l2.h55
-rw-r--r--arch/arm/mm/cache-l2x0.c278
-rw-r--r--arch/arm/mm/context.c207
-rw-r--r--arch/arm/mm/idmap.c14
-rw-r--r--arch/arm/mm/ioremap.c16
-rw-r--r--arch/arm/mm/mmap.c134
-rw-r--r--arch/arm/mm/mmu.c18
-rw-r--r--arch/arm/mm/proc-macros.S4
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/mm/proc-v7-2level.S10
-rw-r--r--arch/arm/mm/proc-v7-3level.S5
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/net/bpf_jit_32.c35
-rw-r--r--arch/arm/net/bpf_jit_32.h2
-rw-r--r--arch/arm/plat-mxc/Kconfig89
-rw-r--r--arch/arm/plat-mxc/Makefile24
-rw-r--r--arch/arm/plat-mxc/devices/platform-mx2-emma.c40
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S51
-rw-r--r--arch/arm/plat-mxc/include/mach/ipu.h177
-rw-r--r--arch/arm/plat-mxc/include/mach/irqs.h21
-rw-r--r--arch/arm/plat-mxc/include/mach/timex.h22
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h132
-rw-r--r--arch/arm/plat-nomadik/Kconfig29
-rw-r--r--arch/arm/plat-nomadik/Makefile5
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio-nomadik.h102
-rw-r--r--arch/arm/plat-nomadik/include/plat/mtu.h9
-rw-r--r--arch/arm/plat-nomadik/include/plat/pincfg.h173
-rw-r--r--arch/arm/plat-nomadik/include/plat/ste_dma40.h223
-rw-r--r--arch/arm/plat-nomadik/timer.c223
-rw-r--r--arch/arm/plat-omap/Kconfig6
-rw-r--r--arch/arm/plat-omap/Makefile4
-rw-r--r--arch/arm/plat-omap/clock.c544
-rw-r--r--arch/arm/plat-omap/common.c48
-rw-r--r--arch/arm/plat-omap/counter_32k.c3
-rw-r--r--arch/arm/plat-omap/debug-devices.c3
-rw-r--r--arch/arm/plat-omap/debug-leds.c25
-rw-r--r--arch/arm/plat-omap/dma.c132
-rw-r--r--arch/arm/plat-omap/dmtimer.c236
-rw-r--r--arch/arm/plat-omap/fb.c62
-rw-r--r--arch/arm/plat-omap/i2c.c174
-rw-r--r--arch/arm/plat-omap/include/plat/clkdev_omap.h51
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h309
-rw-r--r--arch/arm/plat-omap/include/plat/common.h42
-rw-r--r--arch/arm/plat-omap/include/plat/counter-32k.h1
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h468
-rw-r--r--arch/arm/plat-omap/include/plat/debug-devices.h (renamed from arch/arm/mach-omap2/debug-devices.h)7
-rw-r--r--arch/arm/plat-omap/include/plat/dma-44xx.h147
-rw-r--r--arch/arm/plat-omap/include/plat/dma.h546
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h143
-rw-r--r--arch/arm/plat-omap/include/plat/fpga.h193
-rw-r--r--arch/arm/plat-omap/include/plat/i2c.h30
-rw-r--r--arch/arm/plat-omap/include/plat/iommu.h221
-rw-r--r--arch/arm/plat-omap/include/plat/iommu2.h96
-rw-r--r--arch/arm/plat-omap/include/plat/iopgtable.h120
-rw-r--r--arch/arm/plat-omap/include/plat/iovmm.h89
-rw-r--r--arch/arm/plat-omap/include/plat/led.h24
-rw-r--r--arch/arm/plat-omap/include/plat/menelaus.h49
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h188
-rw-r--r--arch/arm/plat-omap/include/plat/multi.h120
-rw-r--r--arch/arm/plat-omap/include/plat/omap-secure.h14
-rw-r--r--arch/arm/plat-omap/include/plat/omap-serial.h55
-rw-r--r--arch/arm/plat-omap/include/plat/prcm.h37
-rw-r--r--arch/arm/plat-omap/include/plat/sdrc.h164
-rw-r--r--arch/arm/plat-omap/include/plat/sram.h97
-rw-r--r--arch/arm/plat-omap/include/plat/uncompress.h204
-rw-r--r--arch/arm/plat-omap/include/plat/usb.h179
-rw-r--r--arch/arm/plat-omap/include/plat/vrfb.h66
-rw-r--r--arch/arm/plat-omap/sram.c366
-rw-r--r--arch/arm/plat-omap/sram.h6
-rw-r--r--arch/arm/plat-orion/irq.c6
-rw-r--r--arch/arm/plat-pxa/Makefile1
-rw-r--r--arch/arm/plat-pxa/include/plat/mfp.h4
-rw-r--r--arch/arm/plat-s3c24xx/dma.c11
-rw-r--r--arch/arm/plat-samsung/Kconfig6
-rw-r--r--arch/arm/plat-samsung/Makefile1
-rw-r--r--arch/arm/plat-samsung/adc.c48
-rw-r--r--arch/arm/plat-samsung/devs.c14
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h8
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/mfc.h11
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h2
-rw-r--r--arch/arm/plat-samsung/s5p-dev-mfc.c34
-rw-r--r--arch/arm/plat-samsung/s5p-irq-gpioint.c8
-rw-r--r--arch/arm/plat-samsung/setup-camif.c70
-rw-r--r--arch/arm/plat-spear/Kconfig1
-rw-r--r--arch/arm/plat-versatile/Kconfig11
-rw-r--r--arch/arm/plat-versatile/Makefile1
-rw-r--r--arch/arm/plat-versatile/fpga-irq.c210
-rw-r--r--arch/arm/plat-versatile/include/plat/fpga-irq.h13
-rw-r--r--arch/arm/xen/enlighten.c123
-rw-r--r--arch/arm64/Kconfig5
-rw-r--r--arch/arm64/Makefile17
-rw-r--r--arch/arm64/boot/Makefile5
-rw-r--r--arch/arm64/boot/dts/.gitignore1
-rw-r--r--arch/arm64/boot/dts/Makefile5
-rw-r--r--arch/arm64/include/asm/Kbuild2
-rw-r--r--arch/arm64/include/asm/arm_generic.h8
-rw-r--r--arch/arm64/include/asm/assembler.h8
-rw-r--r--arch/arm64/include/asm/cacheflush.h11
-rw-r--r--arch/arm64/include/asm/fpsimdmacros.h64
-rw-r--r--arch/arm64/include/asm/pgtable.h2
-rw-r--r--arch/arm64/include/asm/processor.h5
-rw-r--r--arch/arm64/include/asm/ptrace.h31
-rw-r--r--arch/arm64/include/asm/syscalls.h8
-rw-r--r--arch/arm64/include/asm/unistd.h4
-rw-r--r--arch/arm64/include/asm/unistd32.h12
-rw-r--r--arch/arm64/include/asm/virt.h54
-rw-r--r--arch/arm64/kernel/Makefile3
-rw-r--r--arch/arm64/kernel/entry-fpsimd.S43
-rw-r--r--arch/arm64/kernel/entry.S21
-rw-r--r--arch/arm64/kernel/head.S33
-rw-r--r--arch/arm64/kernel/hyp-stub.S109
-rw-r--r--arch/arm64/kernel/process.c86
-rw-r--r--arch/arm64/kernel/signal.c49
-rw-r--r--arch/arm64/kernel/signal32.c20
-rw-r--r--arch/arm64/kernel/sys.c81
-rw-r--r--arch/arm64/kernel/sys32.S19
-rw-r--r--arch/arm64/kernel/sys_compat.c39
-rw-r--r--arch/arm64/kernel/vdso.c2
-rw-r--r--arch/arm64/kernel/vdso/gettimeofday.S100
-rw-r--r--arch/arm64/mm/fault.c13
-rw-r--r--arch/arm64/mm/flush.c9
-rw-r--r--arch/arm64/mm/init.c4
-rw-r--r--arch/avr32/Kconfig6
-rw-r--r--arch/avr32/configs/atngw100_defconfig2
-rw-r--r--arch/avr32/configs/atngw100_evklcd100_defconfig2
-rw-r--r--arch/avr32/configs/atngw100_evklcd101_defconfig2
-rw-r--r--arch/avr32/configs/atngw100_mrmt_defconfig2
-rw-r--r--arch/avr32/configs/atngw100mkii_defconfig2
-rw-r--r--arch/avr32/configs/atngw100mkii_evklcd100_defconfig2
-rw-r--r--arch/avr32/configs/atngw100mkii_evklcd101_defconfig2
-rw-r--r--arch/avr32/configs/atstk1002_defconfig2
-rw-r--r--arch/avr32/configs/atstk1003_defconfig2
-rw-r--r--arch/avr32/configs/atstk1004_defconfig2
-rw-r--r--arch/avr32/configs/atstk1006_defconfig2
-rw-r--r--arch/avr32/configs/favr-32_defconfig2
-rw-r--r--arch/avr32/configs/hammerhead_defconfig2
-rw-r--r--arch/avr32/include/asm/Kbuild1
-rw-r--r--arch/avr32/include/asm/mach/serial_at91.h33
-rw-r--r--arch/avr32/include/asm/processor.h3
-rw-r--r--arch/avr32/include/asm/signal.h2
-rw-r--r--arch/avr32/include/asm/unistd.h4
-rw-r--r--arch/avr32/include/uapi/asm/socket.h1
-rw-r--r--arch/avr32/kernel/Makefile2
-rw-r--r--arch/avr32/kernel/entry-avr32b.S14
-rw-r--r--arch/avr32/kernel/process.c115
-rw-r--r--arch/avr32/kernel/sys_avr32.c24
-rw-r--r--arch/avr32/kernel/syscall-stubs.S24
-rw-r--r--arch/avr32/kernel/syscall_table.S8
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h8
-rw-r--r--arch/blackfin/Kconfig2
-rw-r--r--arch/blackfin/configs/CM-BF527_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF548_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF561_defconfig2
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/processor.h2
-rw-r--r--arch/blackfin/include/asm/unistd.h2
-rw-r--r--arch/blackfin/kernel/entry.S55
-rw-r--r--arch/blackfin/kernel/process.c98
-rw-r--r--arch/blackfin/kernel/signal.c4
-rw-r--r--arch/blackfin/mach-bf609/Kconfig2
-rw-r--r--arch/blackfin/mach-common/entry.S57
-rw-r--r--arch/blackfin/mm/sram-alloc.c2
-rw-r--r--arch/c6x/Kconfig1
-rw-r--r--arch/c6x/Makefile2
-rw-r--r--arch/c6x/boot/Makefile20
-rw-r--r--arch/c6x/boot/dts/Makefile20
-rw-r--r--arch/c6x/boot/dts/linked_dtb.S2
-rw-r--r--arch/c6x/boot/linked_dtb.S2
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/c6x/include/asm/setup.h33
-rw-r--r--arch/c6x/include/asm/syscalls.h4
-rw-r--r--arch/c6x/include/uapi/asm/Kbuild2
-rw-r--r--arch/c6x/include/uapi/asm/kvm_para.h1
-rw-r--r--arch/c6x/include/uapi/asm/setup.h33
-rw-r--r--arch/c6x/include/uapi/asm/unistd.h2
-rw-r--r--arch/c6x/kernel/entry.S29
-rw-r--r--arch/c6x/kernel/process.c25
-rw-r--r--arch/cris/Kconfig3
-rw-r--r--arch/cris/arch-v10/kernel/entry.S17
-rw-r--r--arch/cris/arch-v10/kernel/process.c121
-rw-r--r--arch/cris/arch-v32/kernel/entry.S22
-rw-r--r--arch/cris/arch-v32/kernel/process.c118
-rw-r--r--arch/cris/include/arch-v10/arch/irq.h2
-rw-r--r--arch/cris/include/arch-v32/arch/irq.h2
-rw-r--r--arch/cris/include/asm/Kbuild1
-rw-r--r--arch/cris/include/asm/processor.h2
-rw-r--r--arch/cris/include/asm/signal.h6
-rw-r--r--arch/cris/include/asm/socket.h1
-rw-r--r--arch/cris/include/asm/unistd.h4
-rw-r--r--arch/cris/kernel/crisksyms.c1
-rw-r--r--arch/frv/include/asm/Kbuild1
-rw-r--r--arch/frv/include/asm/unistd.h3
-rw-r--r--arch/frv/include/uapi/asm/socket.h1
-rw-r--r--arch/frv/kernel/process.c45
-rw-r--r--arch/frv/mm/pgalloc.c2
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/h8300/include/asm/Kbuild1
-rw-r--r--arch/h8300/include/asm/processor.h2
-rw-r--r--arch/h8300/include/asm/ptrace.h3
-rw-r--r--arch/h8300/include/asm/signal.h2
-rw-r--r--arch/h8300/include/asm/socket.h1
-rw-r--r--arch/h8300/include/asm/unistd.h4
-rw-r--r--arch/h8300/kernel/entry.S9
-rw-r--r--arch/h8300/kernel/h8300_ksyms.c1
-rw-r--r--arch/h8300/kernel/process.c100
-rw-r--r--arch/h8300/kernel/sys_h8300.c26
-rw-r--r--arch/h8300/kernel/syscalls.S9
-rw-r--r--arch/hexagon/Kconfig2
-rw-r--r--arch/hexagon/include/asm/Kbuild1
-rw-r--r--arch/hexagon/include/asm/processor.h1
-rw-r--r--arch/hexagon/include/asm/syscall.h8
-rw-r--r--arch/hexagon/include/uapi/asm/ptrace.h4
-rw-r--r--arch/hexagon/include/uapi/asm/unistd.h2
-rw-r--r--arch/hexagon/kernel/Makefile3
-rw-r--r--arch/hexagon/kernel/process.c100
-rw-r--r--arch/hexagon/kernel/signal.c4
-rw-r--r--arch/hexagon/kernel/syscall.c89
-rw-r--r--arch/hexagon/kernel/vm_entry.S4
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/hp/sim/simserial.c1
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/cputime.h2
-rw-r--r--arch/ia64/include/asm/device.h3
-rw-r--r--arch/ia64/include/asm/io.h2
-rw-r--r--arch/ia64/include/asm/processor.h16
-rw-r--r--arch/ia64/include/asm/signal.h2
-rw-r--r--arch/ia64/include/asm/unistd.h1
-rw-r--r--arch/ia64/include/uapi/asm/socket.h1
-rw-r--r--arch/ia64/kernel/acpi.c2
-rw-r--r--arch/ia64/kernel/efi.c2
-rw-r--r--arch/ia64/kernel/entry.S53
-rw-r--r--arch/ia64/kernel/head.S13
-rw-r--r--arch/ia64/kernel/process.c161
-rw-r--r--arch/ia64/kernel/smpboot.c5
-rw-r--r--arch/ia64/kernel/time.c22
-rw-r--r--arch/ia64/kernel/topology.c4
-rw-r--r--arch/ia64/kvm/kvm-ia64.c9
-rw-r--r--arch/m32r/Kconfig2
-rw-r--r--arch/m32r/include/asm/Kbuild1
-rw-r--r--arch/m32r/include/asm/processor.h5
-rw-r--r--arch/m32r/include/asm/ptrace.h2
-rw-r--r--arch/m32r/include/asm/signal.h4
-rw-r--r--arch/m32r/include/asm/socket.h1
-rw-r--r--arch/m32r/include/asm/unistd.h4
-rw-r--r--arch/m32r/kernel/entry.S9
-rw-r--r--arch/m32r/kernel/m32r_ksyms.c1
-rw-r--r--arch/m32r/kernel/process.c126
-rw-r--r--arch/m32r/kernel/sys_m32r.c21
-rw-r--r--arch/m68k/Kconfig1
-rw-r--r--arch/m68k/Kconfig.bus4
-rw-r--r--arch/m68k/Kconfig.cpu3
-rw-r--r--arch/m68k/Kconfig.debug2
-rw-r--r--arch/m68k/Kconfig.devices6
-rw-r--r--arch/m68k/emu/nfcon.c6
-rw-r--r--arch/m68k/include/asm/Kbuild5
-rw-r--r--arch/m68k/include/asm/hw_irq.h6
-rw-r--r--arch/m68k/include/asm/shmparam.h6
-rw-r--r--arch/m68k/include/asm/signal.h8
-rw-r--r--arch/m68k/include/asm/spinlock.h6
-rw-r--r--arch/m68k/include/asm/termios.h50
-rw-r--r--arch/m68k/include/asm/unistd.h3
-rw-r--r--arch/m68k/include/uapi/asm/Kbuild17
-rw-r--r--arch/m68k/include/uapi/asm/auxvec.h4
-rw-r--r--arch/m68k/include/uapi/asm/msgbuf.h31
-rw-r--r--arch/m68k/include/uapi/asm/sembuf.h25
-rw-r--r--arch/m68k/include/uapi/asm/shmbuf.h42
-rw-r--r--arch/m68k/include/uapi/asm/socket.h72
-rw-r--r--arch/m68k/include/uapi/asm/sockios.h13
-rw-r--r--arch/m68k/include/uapi/asm/termbits.h201
-rw-r--r--arch/m68k/include/uapi/asm/termios.h44
-rw-r--r--arch/m68k/kernel/entry.S30
-rw-r--r--arch/m68k/kernel/process.c87
-rw-r--r--arch/m68k/kernel/signal.c3
-rw-r--r--arch/m68k/kernel/syscalltable.S6
-rw-r--r--arch/m68k/kernel/traps.c2
-rw-r--r--arch/m68k/math-emu/fp_log.c2
-rw-r--r--arch/m68k/mm/init.c224
-rw-r--r--arch/m68k/mm/init_mm.c176
-rw-r--r--arch/m68k/mm/init_no.c145
-rw-r--r--arch/m68k/mm/mcfmmu.c4
-rw-r--r--arch/m68k/mm/motorola.c14
-rw-r--r--arch/m68k/mm/sun3mmu.c4
-rw-r--r--arch/m68k/sun3/sun3ints.c29
-rw-r--r--arch/microblaze/Kconfig3
-rw-r--r--arch/microblaze/Makefile2
-rw-r--r--arch/microblaze/boot/Makefile19
-rw-r--r--arch/microblaze/boot/dts/Makefile22
-rw-r--r--arch/microblaze/boot/dts/linked_dtb.S2
-rw-r--r--arch/microblaze/boot/linked_dtb.S3
-rw-r--r--arch/microblaze/include/asm/Kbuild2
-rw-r--r--arch/microblaze/include/asm/processor.h8
-rw-r--r--arch/microblaze/include/asm/syscalls.h16
-rw-r--r--arch/microblaze/include/asm/unistd.h6
-rw-r--r--arch/microblaze/kernel/entry-nommu.S20
-rw-r--r--arch/microblaze/kernel/entry.S57
-rw-r--r--arch/microblaze/kernel/process.c75
-rw-r--r--arch/microblaze/kernel/signal.c2
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c53
-rw-r--r--arch/microblaze/kernel/syscall_table.S6
-rw-r--r--arch/microblaze/pci/pci-common.c4
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/alchemy/common/Makefile2
-rw-r--r--arch/mips/alchemy/common/platform.c58
-rw-r--r--arch/mips/alchemy/common/usb.c614
-rw-r--r--arch/mips/ath79/dev-usb.c2
-rw-r--r--arch/mips/bcm47xx/nvram.c4
-rw-r--r--arch/mips/bcm47xx/wgt634u.c8
-rw-r--r--arch/mips/cavium-octeon/Makefile3
-rw-r--r--arch/mips/configs/bcm47xx_defconfig2
-rw-r--r--arch/mips/configs/db1000_defconfig1
-rw-r--r--arch/mips/configs/db1235_defconfig2
-rw-r--r--arch/mips/configs/gpr_defconfig1
-rw-r--r--arch/mips/configs/ls1b_defconfig1
-rw-r--r--arch/mips/configs/mtx1_defconfig3
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/hugetlb.h12
-rw-r--r--arch/mips/include/asm/pgtable.h11
-rw-r--r--arch/mips/include/asm/processor.h2
-rw-r--r--arch/mips/include/asm/ptrace.h6
-rw-r--r--arch/mips/include/asm/signal.h2
-rw-r--r--arch/mips/include/asm/unistd.h1
-rw-r--r--arch/mips/include/uapi/asm/ioctls.h3
-rw-r--r--arch/mips/include/uapi/asm/mman.h11
-rw-r--r--arch/mips/include/uapi/asm/socket.h1
-rw-r--r--arch/mips/kernel/cpu-probe.c1
-rw-r--r--arch/mips/kernel/entry.S13
-rw-r--r--arch/mips/kernel/linux32.c23
-rw-r--r--arch/mips/kernel/mips_ksyms.c2
-rw-r--r--arch/mips/kernel/process.c64
-rw-r--r--arch/mips/kernel/scall64-n32.S8
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/syscall.c57
-rw-r--r--arch/mips/lantiq/dts/Makefile3
-rw-r--r--arch/mips/loongson1/common/platform.c7
-rw-r--r--arch/mips/mm/mmap.c111
-rw-r--r--arch/mips/mm/tlb-r4k.c18
-rw-r--r--arch/mips/netlogic/dts/Makefile3
-rw-r--r--arch/mips/netlogic/xlr/platform.c17
-rw-r--r--arch/mips/pci/pci.c2
-rw-r--r--arch/mips/pnx8550/common/platform.c31
-rw-r--r--arch/mips/txx9/generic/pci.c2
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/include/asm/Kbuild1
-rw-r--r--arch/mn10300/include/asm/io.h3
-rw-r--r--arch/mn10300/include/asm/signal.h4
-rw-r--r--arch/mn10300/include/asm/unistd.h4
-rw-r--r--arch/mn10300/include/uapi/asm/socket.h1
-rw-r--r--arch/mn10300/kernel/asm-offsets.c2
-rw-r--r--arch/mn10300/kernel/entry.S7
-rw-r--r--arch/mn10300/kernel/irq.c50
-rw-r--r--arch/mn10300/kernel/mn10300-serial-low.S9
-rw-r--r--arch/mn10300/kernel/mn10300-serial.c213
-rw-r--r--arch/mn10300/kernel/mn10300-serial.h10
-rw-r--r--arch/mn10300/kernel/process.c33
-rw-r--r--arch/mn10300/kernel/smp.c10
-rw-r--r--arch/mn10300/mm/fault.c33
-rw-r--r--arch/mn10300/mm/pgtable.c2
-rw-r--r--arch/mn10300/unit-asb2305/pci-iomap.c35
-rw-r--r--arch/mn10300/unit-asb2305/pci.c5
-rw-r--r--arch/openrisc/Kconfig4
-rw-r--r--arch/openrisc/Makefile2
-rw-r--r--arch/openrisc/boot/dts/Makefile (renamed from arch/openrisc/boot/Makefile)5
-rw-r--r--arch/openrisc/include/asm/Kbuild1
-rw-r--r--arch/openrisc/include/asm/processor.h2
-rw-r--r--arch/openrisc/include/asm/syscalls.h7
-rw-r--r--arch/openrisc/include/uapi/asm/unistd.h4
-rw-r--r--arch/openrisc/kernel/Makefile2
-rw-r--r--arch/openrisc/kernel/entry.S55
-rw-r--r--arch/openrisc/kernel/process.c164
-rw-r--r--arch/openrisc/kernel/signal.c6
-rw-r--r--arch/openrisc/kernel/sys_or32.c57
-rw-r--r--arch/parisc/Kconfig3
-rw-r--r--arch/parisc/include/asm/Kbuild1
-rw-r--r--arch/parisc/include/asm/processor.h1
-rw-r--r--arch/parisc/include/asm/signal.h2
-rw-r--r--arch/parisc/include/asm/unistd.h4
-rw-r--r--arch/parisc/include/uapi/asm/ioctls.h3
-rw-r--r--arch/parisc/include/uapi/asm/mman.h11
-rw-r--r--arch/parisc/include/uapi/asm/socket.h1
-rw-r--r--arch/parisc/kernel/entry.S241
-rw-r--r--arch/parisc/kernel/pdc_cons.c5
-rw-r--r--arch/parisc/kernel/process.c142
-rw-r--r--arch/parisc/kernel/sys_parisc32.c22
-rw-r--r--arch/parisc/kernel/syscall_table.S4
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/include/asm/Kbuild2
-rw-r--r--arch/powerpc/include/asm/cputime.h2
-rw-r--r--arch/powerpc/include/asm/epapr_hcalls.h83
-rw-r--r--arch/powerpc/include/asm/fsl_hcalls.h36
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h1
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h12
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h33
-rw-r--r--arch/powerpc/include/asm/kvm_booke_hv_asm.h29
-rw-r--r--arch/powerpc/include/asm/kvm_host.h68
-rw-r--r--arch/powerpc/include/asm/kvm_para.h15
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h87
-rw-r--r--arch/powerpc/include/asm/mmu-book3e.h2
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h10
-rw-r--r--arch/powerpc/include/asm/oprofile_impl.h2
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h3
-rw-r--r--arch/powerpc/include/asm/pte-hash64-64k.h2
-rw-r--r--arch/powerpc/include/asm/reg.h1
-rw-r--r--arch/powerpc/include/asm/reg_booke.h7
-rw-r--r--arch/powerpc/include/asm/signal.h2
-rw-r--r--arch/powerpc/include/asm/smp.h8
-rw-r--r--arch/powerpc/include/asm/smu.h4
-rw-r--r--arch/powerpc/include/asm/syscalls.h9
-rw-r--r--arch/powerpc/include/asm/unistd.h4
-rw-r--r--arch/powerpc/include/uapi/asm/Kbuild1
-rw-r--r--arch/powerpc/include/uapi/asm/epapr_hcalls.h98
-rw-r--r--arch/powerpc/include/uapi/asm/ioctls.h3
-rw-r--r--arch/powerpc/include/uapi/asm/kvm.h86
-rw-r--r--arch/powerpc/include/uapi/asm/kvm_para.h7
-rw-r--r--arch/powerpc/include/uapi/asm/socket.h1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c4
-rw-r--r--arch/powerpc/kernel/entry_32.S5
-rw-r--r--arch/powerpc/kernel/entry_64.S8
-rw-r--r--arch/powerpc/kernel/epapr_hcalls.S28
-rw-r--r--arch/powerpc/kernel/epapr_paravirt.c11
-rw-r--r--arch/powerpc/kernel/kvm.c2
-rw-r--r--arch/powerpc/kernel/legacy_serial.c2
-rw-r--r--arch/powerpc/kernel/of_platform.c2
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c5
-rw-r--r--arch/powerpc/kernel/process.c64
-rw-r--r--arch/powerpc/kernel/signal.c4
-rw-r--r--arch/powerpc/kernel/signal_64.c2
-rw-r--r--arch/powerpc/kernel/smp.c46
-rw-r--r--arch/powerpc/kernel/sysfs.c4
-rw-r--r--arch/powerpc/kernel/time.c20
-rw-r--r--arch/powerpc/kernel/uprobes.c6
-rw-r--r--arch/powerpc/kvm/44x.c1
-rw-r--r--arch/powerpc/kvm/44x_emulate.c112
-rw-r--r--arch/powerpc/kvm/Kconfig4
-rw-r--r--arch/powerpc/kvm/Makefile5
-rw-r--r--arch/powerpc/kvm/book3s.c125
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c3
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c3
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c474
-rw-r--r--arch/powerpc/kvm/book3s_emulate.c16
-rw-r--r--arch/powerpc/kvm/book3s_exports.c3
-rw-r--r--arch/powerpc/kvm/book3s_hv.c655
-rw-r--r--arch/powerpc/kvm/book3s_hv_builtin.c4
-rw-r--r--arch/powerpc/kvm/book3s_hv_ras.c144
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c143
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S142
-rw-r--r--arch/powerpc/kvm/book3s_mmu_hpte.c5
-rw-r--r--arch/powerpc/kvm/book3s_pr.c294
-rw-r--r--arch/powerpc/kvm/book3s_rmhandlers.S18
-rw-r--r--arch/powerpc/kvm/booke.c346
-rw-r--r--arch/powerpc/kvm/booke.h1
-rw-r--r--arch/powerpc/kvm/booke_emulate.c36
-rw-r--r--arch/powerpc/kvm/bookehv_interrupts.S145
-rw-r--r--arch/powerpc/kvm/e500.h11
-rw-r--r--arch/powerpc/kvm/e500_emulate.c14
-rw-r--r--arch/powerpc/kvm/e500_tlb.c132
-rw-r--r--arch/powerpc/kvm/emulate.c221
-rw-r--r--arch/powerpc/kvm/powerpc.c187
-rw-r--r--arch/powerpc/kvm/trace.h200
-rw-r--r--arch/powerpc/mm/fault.c27
-rw-r--r--arch/powerpc/mm/slice.c2
-rw-r--r--arch/powerpc/net/bpf_jit.h6
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c25
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpt.c2
-rw-r--r--arch/powerpc/platforms/Kconfig1
-rw-r--r--arch/powerpc/platforms/cell/celleb_pci.c4
-rw-r--r--arch/powerpc/platforms/cell/iommu.c2
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c6
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_core.c2
-rw-r--r--arch/powerpc/platforms/powermac/pic.c2
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c4
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c3
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c9
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c2
-rw-r--r--arch/powerpc/sysdev/scom.c2
-rw-r--r--arch/s390/Kbuild1
-rw-r--r--arch/s390/Kconfig72
-rw-r--r--arch/s390/Makefile1
-rw-r--r--arch/s390/crypto/aes_s390.c18
-rw-r--r--arch/s390/crypto/des_s390.c12
-rw-r--r--arch/s390/crypto/ghash_s390.c21
-rw-r--r--arch/s390/crypto/sha_common.c9
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/bitops.h81
-rw-r--r--arch/s390/include/asm/ccwdev.h6
-rw-r--r--arch/s390/include/asm/ccwgroup.h3
-rw-r--r--arch/s390/include/asm/clp.h28
-rw-r--r--arch/s390/include/asm/cputime.h1
-rw-r--r--arch/s390/include/asm/dma-mapping.h76
-rw-r--r--arch/s390/include/asm/dma.h19
-rw-r--r--arch/s390/include/asm/hw_irq.h22
-rw-r--r--arch/s390/include/asm/io.h55
-rw-r--r--arch/s390/include/asm/irq.h12
-rw-r--r--arch/s390/include/asm/isc.h1
-rw-r--r--arch/s390/include/asm/page.h5
-rw-r--r--arch/s390/include/asm/pci.h156
-rw-r--r--arch/s390/include/asm/pci_clp.h182
-rw-r--r--arch/s390/include/asm/pci_dma.h196
-rw-r--r--arch/s390/include/asm/pci_insn.h280
-rw-r--r--arch/s390/include/asm/pci_io.h194
-rw-r--r--arch/s390/include/asm/pgtable.h22
-rw-r--r--arch/s390/include/asm/sclp.h2
-rw-r--r--arch/s390/include/asm/signal.h2
-rw-r--r--arch/s390/include/asm/topology.h34
-rw-r--r--arch/s390/include/asm/unistd.h4
-rw-r--r--arch/s390/include/asm/vga.h6
-rw-r--r--arch/s390/include/uapi/asm/socket.h1
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/compat_wrapper.S2
-rw-r--r--arch/s390/kernel/dis.c578
-rw-r--r--arch/s390/kernel/entry.S39
-rw-r--r--arch/s390/kernel/entry.h25
-rw-r--r--arch/s390/kernel/entry64.S62
-rw-r--r--arch/s390/kernel/head.S74
-rw-r--r--arch/s390/kernel/irq.c2
-rw-r--r--arch/s390/kernel/pgm_check.S152
-rw-r--r--arch/s390/kernel/process.c53
-rw-r--r--arch/s390/kernel/setup.c39
-rw-r--r--arch/s390/kernel/signal.c2
-rw-r--r--arch/s390/kernel/topology.c113
-rw-r--r--arch/s390/kernel/traps.c52
-rw-r--r--arch/s390/kernel/vtime.c13
-rw-r--r--arch/s390/kvm/interrupt.c19
-rw-r--r--arch/s390/kvm/kvm-s390.c11
-rw-r--r--arch/s390/mm/Makefile12
-rw-r--r--arch/s390/mm/dump_pagetables.c7
-rw-r--r--arch/s390/mm/fault.c31
-rw-r--r--arch/s390/mm/init.c29
-rw-r--r--arch/s390/mm/pageattr.c82
-rw-r--r--arch/s390/mm/pgtable.c16
-rw-r--r--arch/s390/mm/vmem.c46
-rw-r--r--arch/s390/net/bpf_jit_comp.c28
-rw-r--r--arch/s390/pci/Makefile6
-rw-r--r--arch/s390/pci/pci.c1103
-rw-r--r--arch/s390/pci/pci_clp.c324
-rw-r--r--arch/s390/pci/pci_dma.c506
-rw-r--r--arch/s390/pci/pci_event.c93
-rw-r--r--arch/s390/pci/pci_msi.c141
-rw-r--r--arch/s390/pci/pci_sysfs.c86
-rw-r--r--arch/score/Kconfig3
-rw-r--r--arch/score/include/asm/Kbuild1
-rw-r--r--arch/score/include/asm/processor.h1
-rw-r--r--arch/score/include/asm/syscalls.h2
-rw-r--r--arch/score/include/asm/unistd.h4
-rw-r--r--arch/score/kernel/entry.S30
-rw-r--r--arch/score/kernel/process.c57
-rw-r--r--arch/score/kernel/signal.c7
-rw-r--r--arch/score/kernel/sys_score.c89
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/boards/board-espt.c2
-rw-r--r--arch/sh/configs/ecovec24_defconfig2
-rw-r--r--arch/sh/configs/se7724_defconfig2
-rw-r--r--arch/sh/drivers/pci/pci.c2
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/io.h2
-rw-r--r--arch/sh/include/asm/processor_32.h5
-rw-r--r--arch/sh/include/asm/processor_64.h5
-rw-r--r--arch/sh/include/asm/syscalls_32.h14
-rw-r--r--arch/sh/include/asm/syscalls_64.h17
-rw-r--r--arch/sh/include/asm/unistd.h4
-rw-r--r--arch/sh/include/uapi/asm/ioctls.h3
-rw-r--r--arch/sh/kernel/Makefile3
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7720.c6
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c6
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7763.c6
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c6
-rw-r--r--arch/sh/kernel/cpu/sh5/entry.S19
-rw-r--r--arch/sh/kernel/entry-common.S13
-rw-r--r--arch/sh/kernel/process_32.c134
-rw-r--r--arch/sh/kernel/process_64.c127
-rw-r--r--arch/sh/kernel/signal_64.c6
-rw-r--r--arch/sh/kernel/sys_sh32.c24
-rw-r--r--arch/sh/kernel/sys_sh64.c50
-rw-r--r--arch/sh/mm/fault.c19
-rw-r--r--arch/sh/mm/mmap.c139
-rw-r--r--arch/sparc/Kconfig2
-rw-r--r--arch/sparc/boot/piggyback.c12
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/processor_32.h1
-rw-r--r--arch/sparc/include/asm/processor_64.h11
-rw-r--r--arch/sparc/include/asm/ptrace.h10
-rw-r--r--arch/sparc/include/asm/signal.h2
-rw-r--r--arch/sparc/include/asm/switch_to_64.h2
-rw-r--r--arch/sparc/include/asm/syscalls.h2
-rw-r--r--arch/sparc/include/asm/thread_info_64.h25
-rw-r--r--arch/sparc/include/asm/uaccess_64.h4
-rw-r--r--arch/sparc/include/asm/unistd.h1
-rw-r--r--arch/sparc/include/uapi/asm/ioctls.h3
-rw-r--r--arch/sparc/include/uapi/asm/socket.h1
-rw-r--r--arch/sparc/kernel/entry.S51
-rw-r--r--arch/sparc/kernel/etrap_64.S8
-rw-r--r--arch/sparc/kernel/pci_impl.h2
-rw-r--r--arch/sparc/kernel/process_32.c158
-rw-r--r--arch/sparc/kernel/process_64.c148
-rw-r--r--arch/sparc/kernel/sys32.S2
-rw-r--r--arch/sparc/kernel/sys_sparc32.c36
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c51
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c172
-rw-r--r--arch/sparc/kernel/syscalls.S44
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/sparc/kernel/traps_64.c4
-rw-r--r--arch/sparc/mm/hugetlbpage.c124
-rw-r--r--arch/sparc/mm/init_64.c2
-rw-r--r--arch/sparc/net/bpf_jit_comp.c19
-rw-r--r--arch/tile/Kconfig2
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/compat.h15
-rw-r--r--arch/tile/include/asm/elf.h1
-rw-r--r--arch/tile/include/asm/processor.h6
-rw-r--r--arch/tile/include/asm/switch_to.h5
-rw-r--r--arch/tile/include/asm/syscalls.h13
-rw-r--r--arch/tile/include/asm/unistd.h2
-rw-r--r--arch/tile/kernel/compat.c4
-rw-r--r--arch/tile/kernel/compat_signal.c10
-rw-r--r--arch/tile/kernel/entry.S11
-rw-r--r--arch/tile/kernel/intvec_32.S29
-rw-r--r--arch/tile/kernel/intvec_64.S30
-rw-r--r--arch/tile/kernel/process.c171
-rw-r--r--arch/tile/kernel/signal.c9
-rw-r--r--arch/tile/kernel/sys.c8
-rw-r--r--arch/tile/mm/fault.c5
-rw-r--r--arch/tile/mm/hugetlbpage.c139
-rw-r--r--arch/um/drivers/chan_kern.c17
-rw-r--r--arch/um/drivers/line.c2
-rw-r--r--arch/um/drivers/mconsole_kern.c2
-rw-r--r--arch/um/include/asm/Kbuild1
-rw-r--r--arch/um/kernel/exec.c3
-rw-r--r--arch/um/kernel/process.c5
-rw-r--r--arch/um/kernel/syscall.c23
-rw-r--r--arch/unicore32/include/asm/Kbuild1
-rw-r--r--arch/unicore32/include/uapi/asm/unistd.h1
-rw-r--r--arch/unicore32/kernel/entry.S6
-rw-r--r--arch/unicore32/kernel/pci.c2
-rw-r--r--arch/unicore32/kernel/process.c11
-rw-r--r--arch/unicore32/kernel/sys.c14
-rw-r--r--arch/x86/Kconfig61
-rw-r--r--arch/x86/Kconfig.cpu73
-rw-r--r--arch/x86/Makefile_32.cpu1
-rw-r--r--arch/x86/boot/.gitignore1
-rw-r--r--arch/x86/boot/compressed/eboot.c118
-rw-r--r--arch/x86/ia32/ia32_aout.c5
-rw-r--r--arch/x86/ia32/ia32entry.S7
-rw-r--r--arch/x86/ia32/sys_ia32.c11
-rw-r--r--arch/x86/include/asm/Kbuild3
-rw-r--r--arch/x86/include/asm/atomic.h16
-rw-r--r--arch/x86/include/asm/bootparam.h1
-rw-r--r--arch/x86/include/asm/clocksource.h1
-rw-r--r--arch/x86/include/asm/cmpxchg_32.h55
-rw-r--r--arch/x86/include/asm/context_tracking.h (renamed from arch/x86/include/asm/rcu.h)15
-rw-r--r--arch/x86/include/asm/cpu.h4
-rw-r--r--arch/x86/include/asm/cpufeature.h8
-rw-r--r--arch/x86/include/asm/device.h3
-rw-r--r--arch/x86/include/asm/efi.h28
-rw-r--r--arch/x86/include/asm/elf.h6
-rw-r--r--arch/x86/include/asm/fixmap.h5
-rw-r--r--arch/x86/include/asm/fpu-internal.h15
-rw-r--r--arch/x86/include/asm/futex.h12
-rw-r--r--arch/x86/include/asm/kexec.h3
-rw-r--r--arch/x86/include/asm/kvm_guest.h6
-rw-r--r--arch/x86/include/asm/kvm_host.h24
-rw-r--r--arch/x86/include/asm/local.h18
-rw-r--r--arch/x86/include/asm/mce.h21
-rw-r--r--arch/x86/include/asm/mman.h3
-rw-r--r--arch/x86/include/asm/module.h2
-rw-r--r--arch/x86/include/asm/msr-index.h3
-rw-r--r--arch/x86/include/asm/numachip/numachip.h19
-rw-r--r--arch/x86/include/asm/pci.h12
-rw-r--r--arch/x86/include/asm/percpu.h3
-rw-r--r--arch/x86/include/asm/processor.h37
-rw-r--r--arch/x86/include/asm/ptrace.h9
-rw-r--r--arch/x86/include/asm/pvclock.h47
-rw-r--r--arch/x86/include/asm/signal.h2
-rw-r--r--arch/x86/include/asm/smp.h1
-rw-r--r--arch/x86/include/asm/swab.h29
-rw-r--r--arch/x86/include/asm/sys_ia32.h2
-rw-r--r--arch/x86/include/asm/syscalls.h9
-rw-r--r--arch/x86/include/asm/tlbflush.h3
-rw-r--r--arch/x86/include/asm/trace_clock.h20
-rw-r--r--arch/x86/include/asm/uaccess.h42
-rw-r--r--arch/x86/include/asm/unistd.h3
-rw-r--r--arch/x86/include/asm/vmx.h3
-rw-r--r--arch/x86/include/asm/vsyscall.h20
-rw-r--r--arch/x86/include/asm/xen/interface.h1
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/acpi/boot.c12
-rw-r--r--arch/x86/kernel/acpi/sleep.c2
-rw-r--r--arch/x86/kernel/apic/apic.c73
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c35
-rw-r--r--arch/x86/kernel/cpu/amd.c12
-rw-r--r--arch/x86/kernel/cpu/bugs.c41
-rw-r--r--arch/x86/kernel/cpu/common.c14
-rw-r--r--arch/x86/kernel/cpu/intel.c4
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c75
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-internal.h2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-severity.c4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c209
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c8
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c11
-rw-r--r--arch/x86/kernel/cpu/perf_event.c121
-rw-r--r--arch/x86/kernel/cpu/perf_event.h5
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c9
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c9
-rw-r--r--arch/x86/kernel/cpu/perf_event_p6.c2
-rw-r--r--arch/x86/kernel/crash.c32
-rw-r--r--arch/x86/kernel/entry_32.S18
-rw-r--r--arch/x86/kernel/entry_64.S65
-rw-r--r--arch/x86/kernel/head_32.S22
-rw-r--r--arch/x86/kernel/head_64.S16
-rw-r--r--arch/x86/kernel/hpet.c4
-rw-r--r--arch/x86/kernel/i387.c6
-rw-r--r--arch/x86/kernel/kvm.c20
-rw-r--r--arch/x86/kernel/kvmclock.c88
-rw-r--r--arch/x86/kernel/process.c69
-rw-r--r--arch/x86/kernel/process_32.c12
-rw-r--r--arch/x86/kernel/process_64.c10
-rw-r--r--arch/x86/kernel/ptrace.c12
-rw-r--r--arch/x86/kernel/pvclock.c143
-rw-r--r--arch/x86/kernel/rtc.c6
-rw-r--r--arch/x86/kernel/setup.c8
-rw-r--r--arch/x86/kernel/signal.c5
-rw-r--r--arch/x86/kernel/smpboot.c156
-rw-r--r--arch/x86/kernel/sys_x86_64.c151
-rw-r--r--arch/x86/kernel/tboot.c78
-rw-r--r--arch/x86/kernel/topology.c101
-rw-r--r--arch/x86/kernel/trace_clock.c21
-rw-r--r--arch/x86/kernel/traps.c2
-rw-r--r--arch/x86/kernel/tsc.c6
-rw-r--r--arch/x86/kernel/uprobes.c54
-rw-r--r--arch/x86/kernel/vm86_32.c2
-rw-r--r--arch/x86/kvm/cpuid.c3
-rw-r--r--arch/x86/kvm/cpuid.h8
-rw-r--r--arch/x86/kvm/emulate.c8
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/mmu.c65
-rw-r--r--arch/x86/kvm/paging_tmpl.h115
-rw-r--r--arch/x86/kvm/svm.c48
-rw-r--r--arch/x86/kvm/trace.h63
-rw-r--r--arch/x86/kvm/vmx.c203
-rw-r--r--arch/x86/kvm/x86.c548
-rw-r--r--arch/x86/kvm/x86.h2
-rw-r--r--arch/x86/lguest/boot.c2
-rw-r--r--arch/x86/lib/Makefile1
-rw-r--r--arch/x86/lib/cmpxchg.c54
-rw-r--r--arch/x86/lib/copy_page_64.S120
-rw-r--r--arch/x86/lib/usercopy_32.c57
-rw-r--r--arch/x86/mm/fault.c25
-rw-r--r--arch/x86/mm/hugetlbpage.c130
-rw-r--r--arch/x86/mm/init_32.c5
-rw-r--r--arch/x86/mm/init_64.c13
-rw-r--r--arch/x86/mm/ioremap.c105
-rw-r--r--arch/x86/mm/pageattr.c10
-rw-r--r--arch/x86/mm/pgtable.c2
-rw-r--r--arch/x86/mm/tlb.c8
-rw-r--r--arch/x86/net/bpf_jit_comp.c21
-rw-r--r--arch/x86/pci/Makefile1
-rw-r--r--arch/x86/pci/acpi.c46
-rw-r--r--arch/x86/pci/common.c32
-rw-r--r--arch/x86/pci/numachip.c129
-rw-r--r--arch/x86/platform/ce4100/ce4100.c3
-rw-r--r--arch/x86/platform/efi/efi-bgrt.c2
-rw-r--r--arch/x86/platform/efi/efi.c30
-rw-r--r--arch/x86/platform/efi/efi_64.c15
-rw-r--r--arch/x86/power/cpu.c82
-rw-r--r--arch/x86/realmode/init.c17
-rw-r--r--arch/x86/syscalls/syscall_32.tbl6
-rw-r--r--arch/x86/tools/gen-insn-attr-x86.awk6
-rw-r--r--arch/x86/um/Kconfig3
-rw-r--r--arch/x86/um/shared/sysdep/syscalls.h2
-rw-r--r--arch/x86/um/sys_call_table_32.c3
-rw-r--r--arch/x86/um/syscalls_32.c15
-rw-r--r--arch/x86/vdso/vclock_gettime.c81
-rw-r--r--arch/x86/vdso/vgetcpu.c11
-rw-r--r--arch/x86/vdso/vma.c2
-rw-r--r--arch/x86/xen/Kconfig3
-rw-r--r--arch/x86/xen/enlighten.c102
-rw-r--r--arch/x86/xen/mmu.c17
-rw-r--r--arch/x86/xen/suspend.c2
-rw-r--r--arch/x86/xen/xen-ops.h2
-rw-r--r--arch/xtensa/Kconfig1
-rw-r--r--arch/xtensa/include/asm/Kbuild1
-rw-r--r--arch/xtensa/include/asm/signal.h1
-rw-r--r--arch/xtensa/include/asm/syscall.h2
-rw-r--r--arch/xtensa/include/asm/unistd.h1
-rw-r--r--arch/xtensa/include/uapi/asm/ioctls.h3
-rw-r--r--arch/xtensa/include/uapi/asm/mman.h11
-rw-r--r--arch/xtensa/include/uapi/asm/socket.h1
-rw-r--r--arch/xtensa/include/uapi/asm/unistd.h2
-rw-r--r--arch/xtensa/kernel/process.c12
-rw-r--r--arch/xtensa/platforms/iss/console.c1
2009 files changed, 60642 insertions, 51904 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 366ec06a518..34884faf98c 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -300,15 +300,16 @@ config SECCOMP_FILTER
300 300
301 See Documentation/prctl/seccomp_filter.txt for details. 301 See Documentation/prctl/seccomp_filter.txt for details.
302 302
303config HAVE_RCU_USER_QS 303config HAVE_CONTEXT_TRACKING
304 bool 304 bool
305 help 305 help
306 Provide kernel entry/exit hooks necessary for userspace 306 Provide kernel/user boundaries probes necessary for subsystems
307 RCU extended quiescent state. Syscalls need to be wrapped inside 307 that need it, such as userspace RCU extended quiescent state.
308 rcu_user_exit()-rcu_user_enter() through the slow path using 308 Syscalls need to be wrapped inside user_exit()-user_enter() through
309 TIF_NOHZ flag. Exceptions handlers must be wrapped as well. Irqs 309 the slow path using TIF_NOHZ flag. Exceptions handlers must be
310 are already protected inside rcu_irq_enter/rcu_irq_exit() but 310 wrapped as well. Irqs are already protected inside
311 preemption or signal handling on irq exit still need to be protected. 311 rcu_irq_enter/rcu_irq_exit() but preemption or signal handling on
312 irq exit still need to be protected.
312 313
313config HAVE_VIRT_CPU_ACCOUNTING 314config HAVE_VIRT_CPU_ACCOUNTING
314 bool 315 bool
@@ -341,4 +342,18 @@ config MODULES_USE_ELF_REL
341 Modules only use ELF REL relocations. Modules with ELF RELA 342 Modules only use ELF REL relocations. Modules with ELF RELA
342 relocations will give an error. 343 relocations will give an error.
343 344
345#
346# ABI hall of shame
347#
348config CLONE_BACKWARDS
349 bool
350 help
351 Architecture has tls passed as the 4th argument of clone(2),
352 not the 5th one.
353
354config CLONE_BACKWARDS2
355 bool
356 help
357 Architecture has the first two arguments of clone(2) swapped.
358
344source "kernel/gcov/Kconfig" 359source "kernel/gcov/Kconfig"
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index 64ffc9e9e54..dcfabb9f05a 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -11,3 +11,4 @@ header-y += reg.h
11header-y += regdef.h 11header-y += regdef.h
12header-y += sysinfo.h 12header-y += sysinfo.h
13generic-y += exec.h 13generic-y += exec.h
14generic-y += trace_clock.h
diff --git a/arch/alpha/include/asm/ioctls.h b/arch/alpha/include/asm/ioctls.h
index 80e1cee90f1..92c557be49f 100644
--- a/arch/alpha/include/asm/ioctls.h
+++ b/arch/alpha/include/asm/ioctls.h
@@ -95,6 +95,9 @@
95#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 95#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
96#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ 96#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
97#define TIOCVHANGUP 0x5437 97#define TIOCVHANGUP 0x5437
98#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
99#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
100#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
98 101
99#define TIOCSERCONFIG 0x5453 102#define TIOCSERCONFIG 0x5453
100#define TIOCSERGWILD 0x5454 103#define TIOCSERGWILD 0x5454
diff --git a/arch/alpha/include/asm/mman.h b/arch/alpha/include/asm/mman.h
index cbeb3616a28..0086b472bc2 100644
--- a/arch/alpha/include/asm/mman.h
+++ b/arch/alpha/include/asm/mman.h
@@ -63,4 +63,15 @@
63/* compatibility flags */ 63/* compatibility flags */
64#define MAP_FILE 0 64#define MAP_FILE 0
65 65
66/*
67 * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
68 * This gives us 6 bits, which is enough until someone invents 128 bit address
69 * spaces.
70 *
71 * Assume these are all power of twos.
72 * When 0 use the default page size.
73 */
74#define MAP_HUGE_SHIFT 26
75#define MAP_HUGE_MASK 0x3f
76
66#endif /* __ALPHA_MMAN_H__ */ 77#endif /* __ALPHA_MMAN_H__ */
diff --git a/arch/alpha/include/asm/mmzone.h b/arch/alpha/include/asm/mmzone.h
index 445dc42e033..c5b5d6bac9e 100644
--- a/arch/alpha/include/asm/mmzone.h
+++ b/arch/alpha/include/asm/mmzone.h
@@ -66,7 +66,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
66 ((unsigned long)__va(NODE_DATA(kvaddr_to_nid(kaddr))->node_start_pfn \ 66 ((unsigned long)__va(NODE_DATA(kvaddr_to_nid(kaddr))->node_start_pfn \
67 << PAGE_SHIFT)) 67 << PAGE_SHIFT))
68 68
69/* XXX: FIXME -- wli */ 69/* XXX: FIXME -- nyc */
70#define kern_addr_valid(kaddr) (0) 70#define kern_addr_valid(kaddr) (0)
71 71
72#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 72#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index b87755a1955..b4c5b2fbb64 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -78,6 +78,7 @@ struct switch_stack {
78 78
79#define current_pt_regs() \ 79#define current_pt_regs() \
80 ((struct pt_regs *) ((char *)current_thread_info() + 2*PAGE_SIZE) - 1) 80 ((struct pt_regs *) ((char *)current_thread_info() + 2*PAGE_SIZE) - 1)
81#define signal_pt_regs current_pt_regs
81 82
82#define force_successful_syscall_return() (current_pt_regs()->r0 = 0) 83#define force_successful_syscall_return() (current_pt_regs()->r0 = 0)
83 84
diff --git a/arch/alpha/include/asm/signal.h b/arch/alpha/include/asm/signal.h
index a9388300abb..45552862cc1 100644
--- a/arch/alpha/include/asm/signal.h
+++ b/arch/alpha/include/asm/signal.h
@@ -164,9 +164,6 @@ struct sigstack {
164 164
165#ifdef __KERNEL__ 165#ifdef __KERNEL__
166#include <asm/sigcontext.h> 166#include <asm/sigcontext.h>
167
168#define ptrace_signal_deliver(regs, cookie) do { } while (0)
169
170#endif 167#endif
171 168
172#endif 169#endif
diff --git a/arch/alpha/include/asm/socket.h b/arch/alpha/include/asm/socket.h
index 7d2f75be932..0087d053b77 100644
--- a/arch/alpha/include/asm/socket.h
+++ b/arch/alpha/include/asm/socket.h
@@ -47,6 +47,7 @@
47/* Socket filtering */ 47/* Socket filtering */
48#define SO_ATTACH_FILTER 26 48#define SO_ATTACH_FILTER 26
49#define SO_DETACH_FILTER 27 49#define SO_DETACH_FILTER 27
50#define SO_GET_FILTER SO_ATTACH_FILTER
50 51
51#define SO_PEERNAME 28 52#define SO_PEERNAME 28
52#define SO_TIMESTAMP 29 53#define SO_TIMESTAMP 29
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index 7826e227e4d..eb3a4664ced 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -482,6 +482,9 @@
482#define __ARCH_WANT_SYS_SIGPENDING 482#define __ARCH_WANT_SYS_SIGPENDING
483#define __ARCH_WANT_SYS_RT_SIGSUSPEND 483#define __ARCH_WANT_SYS_RT_SIGSUSPEND
484#define __ARCH_WANT_SYS_EXECVE 484#define __ARCH_WANT_SYS_EXECVE
485#define __ARCH_WANT_SYS_FORK
486#define __ARCH_WANT_SYS_VFORK
487#define __ARCH_WANT_SYS_CLONE
485 488
486/* "Conditional" syscalls. What we want is 489/* "Conditional" syscalls. What we want is
487 490
diff --git a/arch/alpha/kernel/binfmt_loader.c b/arch/alpha/kernel/binfmt_loader.c
index d1f474d1d44..9525660c93c 100644
--- a/arch/alpha/kernel/binfmt_loader.c
+++ b/arch/alpha/kernel/binfmt_loader.c
@@ -5,7 +5,7 @@
5#include <linux/binfmts.h> 5#include <linux/binfmts.h>
6#include <linux/a.out.h> 6#include <linux/a.out.h>
7 7
8static int load_binary(struct linux_binprm *bprm, struct pt_regs *regs) 8static int load_binary(struct linux_binprm *bprm)
9{ 9{
10 struct exec *eh = (struct exec *)bprm->buf; 10 struct exec *eh = (struct exec *)bprm->buf;
11 unsigned long loader; 11 unsigned long loader;
@@ -37,7 +37,7 @@ static int load_binary(struct linux_binprm *bprm, struct pt_regs *regs)
37 retval = prepare_binprm(bprm); 37 retval = prepare_binprm(bprm);
38 if (retval < 0) 38 if (retval < 0)
39 return retval; 39 return retval;
40 return search_binary_handler(bprm,regs); 40 return search_binary_handler(bprm);
41} 41}
42 42
43static struct linux_binfmt loader_format = { 43static struct linux_binfmt loader_format = {
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index a7607832dd4..f62a994ef12 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -612,47 +612,24 @@ ret_from_kernel_thread:
612 * Special system calls. Most of these are special in that they either 612 * Special system calls. Most of these are special in that they either
613 * have to play switch_stack games or in some way use the pt_regs struct. 613 * have to play switch_stack games or in some way use the pt_regs struct.
614 */ 614 */
615 .align 4
616 .globl sys_fork
617 .ent sys_fork
618sys_fork:
619 .prologue 0
620 mov $sp, $21
621 bsr $1, do_switch_stack
622 bis $31, SIGCHLD, $16
623 mov $31, $17
624 mov $31, $18
625 mov $31, $19
626 mov $31, $20
627 jsr $26, alpha_clone
628 bsr $1, undo_switch_stack
629 ret
630.end sys_fork
631 615
616.macro fork_like name
632 .align 4 617 .align 4
633 .globl sys_clone 618 .globl alpha_\name
634 .ent sys_clone 619 .ent alpha_\name
635sys_clone: 620alpha_\name:
636 .prologue 0 621 .prologue 0
637 mov $sp, $21
638 bsr $1, do_switch_stack 622 bsr $1, do_switch_stack
639 /* $16, $17, $18, $19, $20 come from the user. */ 623 jsr $26, sys_\name
640 jsr $26, alpha_clone 624 ldq $26, 56($sp)
641 bsr $1, undo_switch_stack 625 lda $sp, SWITCH_STACK_SIZE($sp)
642 ret 626 ret
643.end sys_clone 627.end alpha_\name
628.endm
644 629
645 .align 4 630fork_like fork
646 .globl sys_vfork 631fork_like vfork
647 .ent sys_vfork 632fork_like clone
648sys_vfork:
649 .prologue 0
650 mov $sp, $16
651 bsr $1, do_switch_stack
652 jsr $26, alpha_vfork
653 bsr $1, undo_switch_stack
654 ret
655.end sys_vfork
656 633
657 .align 4 634 .align 4
658 .globl sys_sigreturn 635 .globl sys_sigreturn
@@ -661,8 +638,6 @@ sys_sigreturn:
661 .prologue 0 638 .prologue 0
662 lda $9, ret_from_straced 639 lda $9, ret_from_straced
663 cmpult $26, $9, $9 640 cmpult $26, $9, $9
664 mov $sp, $17
665 lda $18, -SWITCH_STACK_SIZE($sp)
666 lda $sp, -SWITCH_STACK_SIZE($sp) 641 lda $sp, -SWITCH_STACK_SIZE($sp)
667 jsr $26, do_sigreturn 642 jsr $26, do_sigreturn
668 bne $9, 1f 643 bne $9, 1f
@@ -678,8 +653,6 @@ sys_rt_sigreturn:
678 .prologue 0 653 .prologue 0
679 lda $9, ret_from_straced 654 lda $9, ret_from_straced
680 cmpult $26, $9, $9 655 cmpult $26, $9, $9
681 mov $sp, $17
682 lda $18, -SWITCH_STACK_SIZE($sp)
683 lda $sp, -SWITCH_STACK_SIZE($sp) 656 lda $sp, -SWITCH_STACK_SIZE($sp)
684 jsr $26, do_rt_sigreturn 657 jsr $26, do_rt_sigreturn
685 bne $9, 1f 658 bne $9, 1f
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 3f844d26d2c..a21d0ab3b19 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -354,8 +354,7 @@ static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page,
354 struct pci_dev *pdev = alpha_gendev_to_pci(dev); 354 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
355 int dac_allowed; 355 int dac_allowed;
356 356
357 if (dir == PCI_DMA_NONE) 357 BUG_ON(dir == PCI_DMA_NONE);
358 BUG();
359 358
360 dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 359 dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
361 return pci_map_single_1(pdev, (char *)page_address(page) + offset, 360 return pci_map_single_1(pdev, (char *)page_address(page) + offset,
@@ -378,8 +377,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
378 struct pci_iommu_arena *arena; 377 struct pci_iommu_arena *arena;
379 long dma_ofs, npages; 378 long dma_ofs, npages;
380 379
381 if (dir == PCI_DMA_NONE) 380 BUG_ON(dir == PCI_DMA_NONE);
382 BUG();
383 381
384 if (dma_addr >= __direct_map_base 382 if (dma_addr >= __direct_map_base
385 && dma_addr < __direct_map_base + __direct_map_size) { 383 && dma_addr < __direct_map_base + __direct_map_size) {
@@ -662,8 +660,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
662 dma_addr_t max_dma; 660 dma_addr_t max_dma;
663 int dac_allowed; 661 int dac_allowed;
664 662
665 if (dir == PCI_DMA_NONE) 663 BUG_ON(dir == PCI_DMA_NONE);
666 BUG();
667 664
668 dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 665 dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
669 666
@@ -742,8 +739,7 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,
742 dma_addr_t max_dma; 739 dma_addr_t max_dma;
743 dma_addr_t fbeg, fend; 740 dma_addr_t fbeg, fend;
744 741
745 if (dir == PCI_DMA_NONE) 742 BUG_ON(dir == PCI_DMA_NONE);
746 BUG();
747 743
748 if (! alpha_mv.mv_pci_tbi) 744 if (! alpha_mv.mv_pci_tbi)
749 return; 745 return;
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 51987dcf79b..b5d0d092369 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -235,51 +235,28 @@ release_thread(struct task_struct *dead_task)
235} 235}
236 236
237/* 237/*
238 * "alpha_clone()".. By the time we get here, the
239 * non-volatile registers have also been saved on the
240 * stack. We do some ugly pointer stuff here.. (see
241 * also copy_thread)
242 *
243 * Notice that "fork()" is implemented in terms of clone,
244 * with parameters (SIGCHLD, 0).
245 */
246int
247alpha_clone(unsigned long clone_flags, unsigned long usp,
248 int __user *parent_tid, int __user *child_tid,
249 unsigned long tls_value, struct pt_regs *regs)
250{
251 if (!usp)
252 usp = rdusp();
253
254 return do_fork(clone_flags, usp, regs, 0, parent_tid, child_tid);
255}
256
257int
258alpha_vfork(struct pt_regs *regs)
259{
260 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(),
261 regs, 0, NULL, NULL);
262}
263
264/*
265 * Copy an alpha thread.. 238 * Copy an alpha thread..
266 */ 239 */
267 240
268int 241int
269copy_thread(unsigned long clone_flags, unsigned long usp, 242copy_thread(unsigned long clone_flags, unsigned long usp,
270 unsigned long arg, 243 unsigned long arg,
271 struct task_struct * p, struct pt_regs * regs) 244 struct task_struct *p)
272{ 245{
273 extern void ret_from_fork(void); 246 extern void ret_from_fork(void);
274 extern void ret_from_kernel_thread(void); 247 extern void ret_from_kernel_thread(void);
275 248
276 struct thread_info *childti = task_thread_info(p); 249 struct thread_info *childti = task_thread_info(p);
277 struct pt_regs *childregs = task_pt_regs(p); 250 struct pt_regs *childregs = task_pt_regs(p);
251 struct pt_regs *regs = current_pt_regs();
278 struct switch_stack *childstack, *stack; 252 struct switch_stack *childstack, *stack;
279 unsigned long settls; 253 unsigned long settls;
280 254
281 childstack = ((struct switch_stack *) childregs) - 1; 255 childstack = ((struct switch_stack *) childregs) - 1;
282 if (unlikely(!regs)) { 256 childti->pcb.ksp = (unsigned long) childstack;
257 childti->pcb.flags = 1; /* set FEN, clear everything else */
258
259 if (unlikely(p->flags & PF_KTHREAD)) {
283 /* kernel thread */ 260 /* kernel thread */
284 memset(childstack, 0, 261 memset(childstack, 0,
285 sizeof(struct switch_stack) + sizeof(struct pt_regs)); 262 sizeof(struct switch_stack) + sizeof(struct pt_regs));
@@ -288,12 +265,17 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
288 childstack->r10 = arg; 265 childstack->r10 = arg;
289 childregs->hae = alpha_mv.hae_cache, 266 childregs->hae = alpha_mv.hae_cache,
290 childti->pcb.usp = 0; 267 childti->pcb.usp = 0;
291 childti->pcb.ksp = (unsigned long) childstack;
292 childti->pcb.flags = 1; /* set FEN, clear everything else */
293 return 0; 268 return 0;
294 } 269 }
270 /* Note: if CLONE_SETTLS is not set, then we must inherit the
271 value from the parent, which will have been set by the block
272 copy in dup_task_struct. This is non-intuitive, but is
273 required for proper operation in the case of a threaded
274 application calling fork. */
275 if (clone_flags & CLONE_SETTLS)
276 childti->pcb.unique = regs->r20;
277 childti->pcb.usp = usp ?: rdusp();
295 *childregs = *regs; 278 *childregs = *regs;
296 settls = regs->r20;
297 childregs->r0 = 0; 279 childregs->r0 = 0;
298 childregs->r19 = 0; 280 childregs->r19 = 0;
299 childregs->r20 = 1; /* OSF/1 has some strange fork() semantics. */ 281 childregs->r20 = 1; /* OSF/1 has some strange fork() semantics. */
@@ -301,22 +283,6 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
301 stack = ((struct switch_stack *) regs) - 1; 283 stack = ((struct switch_stack *) regs) - 1;
302 *childstack = *stack; 284 *childstack = *stack;
303 childstack->r26 = (unsigned long) ret_from_fork; 285 childstack->r26 = (unsigned long) ret_from_fork;
304 childti->pcb.usp = usp;
305 childti->pcb.ksp = (unsigned long) childstack;
306 childti->pcb.flags = 1; /* set FEN, clear everything else */
307
308 /* Set a new TLS for the child thread? Peek back into the
309 syscall arguments that we saved on syscall entry. Oops,
310 except we'd have clobbered it with the parent/child set
311 of r20. Read the saved copy. */
312 /* Note: if CLONE_SETTLS is not set, then we must inherit the
313 value from the parent, which will have been set by the block
314 copy in dup_task_struct. This is non-intuitive, but is
315 required for proper operation in the case of a threaded
316 application calling fork. */
317 if (clone_flags & CLONE_SETTLS)
318 childti->pcb.unique = settls;
319
320 return 0; 286 return 0;
321} 287}
322 288
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index 32575f85507..336393c9c11 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -160,10 +160,10 @@ extern char compile_time_assert
160#define INSN_CALLSYS 0x00000083 160#define INSN_CALLSYS 0x00000083
161 161
162static long 162static long
163restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, 163restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs)
164 struct switch_stack *sw)
165{ 164{
166 unsigned long usp; 165 unsigned long usp;
166 struct switch_stack *sw = (struct switch_stack *)regs - 1;
167 long i, err = __get_user(regs->pc, &sc->sc_pc); 167 long i, err = __get_user(regs->pc, &sc->sc_pc);
168 168
169 current_thread_info()->restart_block.fn = do_no_restart_syscall; 169 current_thread_info()->restart_block.fn = do_no_restart_syscall;
@@ -215,9 +215,9 @@ restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
215 registers and transfer control from userland. */ 215 registers and transfer control from userland. */
216 216
217asmlinkage void 217asmlinkage void
218do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs, 218do_sigreturn(struct sigcontext __user *sc)
219 struct switch_stack *sw)
220{ 219{
220 struct pt_regs *regs = current_pt_regs();
221 sigset_t set; 221 sigset_t set;
222 222
223 /* Verify that it's a good sigcontext before using it */ 223 /* Verify that it's a good sigcontext before using it */
@@ -228,7 +228,7 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
228 228
229 set_current_blocked(&set); 229 set_current_blocked(&set);
230 230
231 if (restore_sigcontext(sc, regs, sw)) 231 if (restore_sigcontext(sc, regs))
232 goto give_sigsegv; 232 goto give_sigsegv;
233 233
234 /* Send SIGTRAP if we're single-stepping: */ 234 /* Send SIGTRAP if we're single-stepping: */
@@ -249,9 +249,9 @@ give_sigsegv:
249} 249}
250 250
251asmlinkage void 251asmlinkage void
252do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs, 252do_rt_sigreturn(struct rt_sigframe __user *frame)
253 struct switch_stack *sw)
254{ 253{
254 struct pt_regs *regs = current_pt_regs();
255 sigset_t set; 255 sigset_t set;
256 256
257 /* Verify that it's a good ucontext_t before using it */ 257 /* Verify that it's a good ucontext_t before using it */
@@ -262,7 +262,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
262 262
263 set_current_blocked(&set); 263 set_current_blocked(&set);
264 264
265 if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw)) 265 if (restore_sigcontext(&frame->uc.uc_mcontext, regs))
266 goto give_sigsegv; 266 goto give_sigsegv;
267 267
268 /* Send SIGTRAP if we're single-stepping: */ 268 /* Send SIGTRAP if we're single-stepping: */
diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c
index 5d5865204a1..59b7bbad839 100644
--- a/arch/alpha/kernel/srmcons.c
+++ b/arch/alpha/kernel/srmcons.c
@@ -205,7 +205,6 @@ static const struct tty_operations srmcons_ops = {
205static int __init 205static int __init
206srmcons_init(void) 206srmcons_init(void)
207{ 207{
208 tty_port_init(&srmcons_singleton.port);
209 setup_timer(&srmcons_singleton.timer, srmcons_receive_chars, 208 setup_timer(&srmcons_singleton.timer, srmcons_receive_chars,
210 (unsigned long)&srmcons_singleton); 209 (unsigned long)&srmcons_singleton);
211 if (srm_is_registered_console) { 210 if (srm_is_registered_console) {
@@ -215,6 +214,9 @@ srmcons_init(void)
215 driver = alloc_tty_driver(MAX_SRM_CONSOLE_DEVICES); 214 driver = alloc_tty_driver(MAX_SRM_CONSOLE_DEVICES);
216 if (!driver) 215 if (!driver)
217 return -ENOMEM; 216 return -ENOMEM;
217
218 tty_port_init(&srmcons_singleton.port);
219
218 driver->driver_name = "srm"; 220 driver->driver_name = "srm";
219 driver->name = "srm"; 221 driver->name = "srm";
220 driver->major = 0; /* dynamic */ 222 driver->major = 0; /* dynamic */
@@ -227,6 +229,7 @@ srmcons_init(void)
227 err = tty_register_driver(driver); 229 err = tty_register_driver(driver);
228 if (err) { 230 if (err) {
229 put_tty_driver(driver); 231 put_tty_driver(driver);
232 tty_port_destroy(&srmcons_singleton.port);
230 return err; 233 return err;
231 } 234 }
232 srmcons_driver = driver; 235 srmcons_driver = driver;
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 2ac6b45c3e0..4284ec798ec 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -12,7 +12,7 @@
12sys_call_table: 12sys_call_table:
13 .quad alpha_ni_syscall /* 0 */ 13 .quad alpha_ni_syscall /* 0 */
14 .quad sys_exit 14 .quad sys_exit
15 .quad sys_fork 15 .quad alpha_fork
16 .quad sys_read 16 .quad sys_read
17 .quad sys_write 17 .quad sys_write
18 .quad alpha_ni_syscall /* 5 */ 18 .quad alpha_ni_syscall /* 5 */
@@ -76,7 +76,7 @@ sys_call_table:
76 .quad sys_getpgrp 76 .quad sys_getpgrp
77 .quad sys_getpagesize 77 .quad sys_getpagesize
78 .quad alpha_ni_syscall /* 65 */ 78 .quad alpha_ni_syscall /* 65 */
79 .quad sys_vfork 79 .quad alpha_vfork
80 .quad sys_newstat 80 .quad sys_newstat
81 .quad sys_newlstat 81 .quad sys_newlstat
82 .quad alpha_ni_syscall 82 .quad alpha_ni_syscall
@@ -330,7 +330,7 @@ sys_call_table:
330 .quad sys_ni_syscall /* 309: old get_kernel_syms */ 330 .quad sys_ni_syscall /* 309: old get_kernel_syms */
331 .quad sys_syslog /* 310 */ 331 .quad sys_syslog /* 310 */
332 .quad sys_reboot 332 .quad sys_reboot
333 .quad sys_clone 333 .quad alpha_clone
334 .quad sys_uselib 334 .quad sys_uselib
335 .quad sys_mlock 335 .quad sys_mlock
336 .quad sys_munlock /* 315 */ 336 .quad sys_munlock /* 315 */
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ade7e924bef..2277f9530b0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -5,8 +5,9 @@ config ARM
5 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 5 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
6 select ARCH_HAVE_CUSTOM_GPIO_H 6 select ARCH_HAVE_CUSTOM_GPIO_H
7 select ARCH_WANT_IPC_PARSE_VERSION 7 select ARCH_WANT_IPC_PARSE_VERSION
8 select BUILDTIME_EXTABLE_SORT if MMU
8 select CPU_PM if (SUSPEND || CPU_IDLE) 9 select CPU_PM if (SUSPEND || CPU_IDLE)
9 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN 10 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU
10 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) 11 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI)
11 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 12 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
12 select GENERIC_IRQ_PROBE 13 select GENERIC_IRQ_PROBE
@@ -21,6 +22,7 @@ config ARM
21 select HAVE_AOUT 22 select HAVE_AOUT
22 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 23 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
23 select HAVE_ARCH_KGDB 24 select HAVE_ARCH_KGDB
25 select HAVE_ARCH_SECCOMP_FILTER
24 select HAVE_ARCH_TRACEHOOK 26 select HAVE_ARCH_TRACEHOOK
25 select HAVE_BPF_JIT 27 select HAVE_BPF_JIT
26 select HAVE_C_RECORDMCOUNT 28 select HAVE_C_RECORDMCOUNT
@@ -55,6 +57,7 @@ config ARM
55 select SYS_SUPPORTS_APM_EMULATION 57 select SYS_SUPPORTS_APM_EMULATION
56 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND 58 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
57 select MODULES_USE_ELF_REL 59 select MODULES_USE_ELF_REL
60 select CLONE_BACKWARDS
58 help 61 help
59 The ARM series is a line of low-power-consumption RISC chip designs 62 The ARM series is a line of low-power-consumption RISC chip designs
60 licensed by ARM Ltd and targeted at embedded applications and 63 licensed by ARM Ltd and targeted at embedded applications and
@@ -284,8 +287,8 @@ config ARCH_INTEGRATOR
284 select MULTI_IRQ_HANDLER 287 select MULTI_IRQ_HANDLER
285 select NEED_MACH_MEMORY_H 288 select NEED_MACH_MEMORY_H
286 select PLAT_VERSATILE 289 select PLAT_VERSATILE
287 select PLAT_VERSATILE_FPGA_IRQ
288 select SPARSE_IRQ 290 select SPARSE_IRQ
291 select VERSATILE_FPGA_IRQ
289 help 292 help
290 Support for ARM's Integrator platform. 293 Support for ARM's Integrator platform.
291 294
@@ -318,7 +321,7 @@ config ARCH_VERSATILE
318 select PLAT_VERSATILE 321 select PLAT_VERSATILE
319 select PLAT_VERSATILE_CLCD 322 select PLAT_VERSATILE_CLCD
320 select PLAT_VERSATILE_CLOCK 323 select PLAT_VERSATILE_CLOCK
321 select PLAT_VERSATILE_FPGA_IRQ 324 select VERSATILE_FPGA_IRQ
322 help 325 help
323 This enables support for ARM Ltd Versatile board. 326 This enables support for ARM Ltd Versatile board.
324 327
@@ -330,13 +333,15 @@ config ARCH_AT91
330 select IRQ_DOMAIN 333 select IRQ_DOMAIN
331 select NEED_MACH_GPIO_H 334 select NEED_MACH_GPIO_H
332 select NEED_MACH_IO_H if PCCARD 335 select NEED_MACH_IO_H if PCCARD
336 select PINCTRL
337 select PINCTRL_AT91 if USE_OF
333 help 338 help
334 This enables support for systems based on Atmel 339 This enables support for systems based on Atmel
335 AT91RM9200 and AT91SAM9* processors. 340 AT91RM9200 and AT91SAM9* processors.
336 341
337config ARCH_BCM2835 342config ARCH_BCM2835
338 bool "Broadcom BCM2835 family" 343 bool "Broadcom BCM2835 family"
339 select ARCH_WANT_OPTIONAL_GPIOLIB 344 select ARCH_REQUIRE_GPIOLIB
340 select ARM_AMBA 345 select ARM_AMBA
341 select ARM_ERRATA_411920 346 select ARM_ERRATA_411920
342 select ARM_TIMER_SP804 347 select ARM_TIMER_SP804
@@ -344,7 +349,10 @@ config ARCH_BCM2835
344 select COMMON_CLK 349 select COMMON_CLK
345 select CPU_V6 350 select CPU_V6
346 select GENERIC_CLOCKEVENTS 351 select GENERIC_CLOCKEVENTS
352 select GENERIC_GPIO
347 select MULTI_IRQ_HANDLER 353 select MULTI_IRQ_HANDLER
354 select PINCTRL
355 select PINCTRL_BCM2835
348 select SPARSE_IRQ 356 select SPARSE_IRQ
349 select USE_OF 357 select USE_OF
350 help 358 help
@@ -364,11 +372,16 @@ config ARCH_CNS3XXX
364 372
365config ARCH_CLPS711X 373config ARCH_CLPS711X
366 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" 374 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
375 select ARCH_REQUIRE_GPIOLIB
367 select ARCH_USES_GETTIMEOFFSET 376 select ARCH_USES_GETTIMEOFFSET
377 select AUTO_ZRELADDR
368 select CLKDEV_LOOKUP 378 select CLKDEV_LOOKUP
369 select COMMON_CLK 379 select COMMON_CLK
370 select CPU_ARM720T 380 select CPU_ARM720T
381 select GENERIC_CLOCKEVENTS
382 select MULTI_IRQ_HANDLER
371 select NEED_MACH_MEMORY_H 383 select NEED_MACH_MEMORY_H
384 select SPARSE_IRQ
372 help 385 help
373 Support for Cirrus Logic 711x/721x/731x based boards. 386 Support for Cirrus Logic 711x/721x/731x based boards.
374 387
@@ -433,19 +446,6 @@ config ARCH_FOOTBRIDGE
433 Support for systems based on the DC21285 companion chip 446 Support for systems based on the DC21285 companion chip
434 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. 447 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
435 448
436config ARCH_MXC
437 bool "Freescale MXC/iMX-based"
438 select ARCH_REQUIRE_GPIOLIB
439 select CLKDEV_LOOKUP
440 select CLKSRC_MMIO
441 select GENERIC_CLOCKEVENTS
442 select GENERIC_IRQ_CHIP
443 select MULTI_IRQ_HANDLER
444 select SPARSE_IRQ
445 select USE_OF
446 help
447 Support for Freescale MXC/iMX-based family of processors
448
449config ARCH_MXS 449config ARCH_MXS
450 bool "Freescale MXS-based" 450 bool "Freescale MXS-based"
451 select ARCH_REQUIRE_GPIOLIB 451 select ARCH_REQUIRE_GPIOLIB
@@ -536,6 +536,8 @@ config ARCH_DOVE
536 select CPU_V7 536 select CPU_V7
537 select GENERIC_CLOCKEVENTS 537 select GENERIC_CLOCKEVENTS
538 select MIGHT_HAVE_PCI 538 select MIGHT_HAVE_PCI
539 select PINCTRL
540 select PINCTRL_DOVE
539 select PLAT_ORION_LEGACY 541 select PLAT_ORION_LEGACY
540 select USB_ARCH_HAS_EHCI 542 select USB_ARCH_HAS_EHCI
541 help 543 help
@@ -547,6 +549,9 @@ config ARCH_KIRKWOOD
547 select CPU_FEROCEON 549 select CPU_FEROCEON
548 select GENERIC_CLOCKEVENTS 550 select GENERIC_CLOCKEVENTS
549 select PCI 551 select PCI
552 select PCI_QUIRKS
553 select PINCTRL
554 select PINCTRL_KIRKWOOD
550 select PLAT_ORION_LEGACY 555 select PLAT_ORION_LEGACY
551 help 556 help
552 Support for the following Marvell Kirkwood series SoCs: 557 Support for the following Marvell Kirkwood series SoCs:
@@ -586,6 +591,7 @@ config ARCH_MMP
586 select GPIO_PXA 591 select GPIO_PXA
587 select IRQ_DOMAIN 592 select IRQ_DOMAIN
588 select NEED_MACH_GPIO_H 593 select NEED_MACH_GPIO_H
594 select PINCTRL
589 select PLAT_PXA 595 select PLAT_PXA
590 select SPARSE_IRQ 596 select SPARSE_IRQ
591 help 597 help
@@ -644,6 +650,7 @@ config ARCH_TEGRA
644 select HAVE_CLK 650 select HAVE_CLK
645 select HAVE_SMP 651 select HAVE_SMP
646 select MIGHT_HAVE_CACHE_L2X0 652 select MIGHT_HAVE_CACHE_L2X0
653 select SPARSE_IRQ
647 select USE_OF 654 select USE_OF
648 help 655 help
649 This enables support for NVIDIA Tegra based systems (Tegra APX, 656 This enables support for NVIDIA Tegra based systems (Tegra APX,
@@ -885,6 +892,7 @@ config ARCH_U8500
885 select GENERIC_CLOCKEVENTS 892 select GENERIC_CLOCKEVENTS
886 select HAVE_SMP 893 select HAVE_SMP
887 select MIGHT_HAVE_CACHE_L2X0 894 select MIGHT_HAVE_CACHE_L2X0
895 select SPARSE_IRQ
888 help 896 help
889 Support for ST-Ericsson's Ux500 architecture 897 Support for ST-Ericsson's Ux500 architecture
890 898
@@ -899,11 +907,13 @@ config ARCH_NOMADIK
899 select MIGHT_HAVE_CACHE_L2X0 907 select MIGHT_HAVE_CACHE_L2X0
900 select PINCTRL 908 select PINCTRL
901 select PINCTRL_STN8815 909 select PINCTRL_STN8815
910 select SPARSE_IRQ
902 help 911 help
903 Support for the Nomadik platform by ST-Ericsson 912 Support for the Nomadik platform by ST-Ericsson
904 913
905config PLAT_SPEAR 914config PLAT_SPEAR
906 bool "ST SPEAr" 915 bool "ST SPEAr"
916 select ARCH_HAS_CPUFREQ
907 select ARCH_REQUIRE_GPIOLIB 917 select ARCH_REQUIRE_GPIOLIB
908 select ARM_AMBA 918 select ARM_AMBA
909 select CLKDEV_LOOKUP 919 select CLKDEV_LOOKUP
@@ -924,6 +934,7 @@ config ARCH_DAVINCI
924 select GENERIC_IRQ_CHIP 934 select GENERIC_IRQ_CHIP
925 select HAVE_IDE 935 select HAVE_IDE
926 select NEED_MACH_GPIO_H 936 select NEED_MACH_GPIO_H
937 select USE_OF
927 select ZONE_DMA 938 select ZONE_DMA
928 help 939 help
929 Support for TI's DaVinci platform. 940 Support for TI's DaVinci platform.
@@ -937,11 +948,10 @@ config ARCH_OMAP
937 select CLKSRC_MMIO 948 select CLKSRC_MMIO
938 select GENERIC_CLOCKEVENTS 949 select GENERIC_CLOCKEVENTS
939 select HAVE_CLK 950 select HAVE_CLK
940 select NEED_MACH_GPIO_H
941 help 951 help
942 Support for TI's OMAP platform (OMAP1/2/3/4). 952 Support for TI's OMAP platform (OMAP1/2/3/4).
943 953
944config ARCH_VT8500 954config ARCH_VT8500_SINGLE
945 bool "VIA/WonderMedia 85xx" 955 bool "VIA/WonderMedia 85xx"
946 select ARCH_HAS_CPUFREQ 956 select ARCH_HAS_CPUFREQ
947 select ARCH_REQUIRE_GPIOLIB 957 select ARCH_REQUIRE_GPIOLIB
@@ -951,22 +961,12 @@ config ARCH_VT8500
951 select GENERIC_CLOCKEVENTS 961 select GENERIC_CLOCKEVENTS
952 select GENERIC_GPIO 962 select GENERIC_GPIO
953 select HAVE_CLK 963 select HAVE_CLK
964 select MULTI_IRQ_HANDLER
965 select SPARSE_IRQ
954 select USE_OF 966 select USE_OF
955 help 967 help
956 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. 968 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
957 969
958config ARCH_ZYNQ
959 bool "Xilinx Zynq ARM Cortex A9 Platform"
960 select ARM_AMBA
961 select ARM_GIC
962 select CLKDEV_LOOKUP
963 select CPU_V7
964 select GENERIC_CLOCKEVENTS
965 select ICST
966 select MIGHT_HAVE_CACHE_L2X0
967 select USE_OF
968 help
969 Support for Xilinx Zynq ARM Cortex A9 Platform
970endchoice 970endchoice
971 971
972menu "Multiple platform selection" 972menu "Multiple platform selection"
@@ -1022,6 +1022,8 @@ source "arch/arm/mach-mvebu/Kconfig"
1022 1022
1023source "arch/arm/mach-at91/Kconfig" 1023source "arch/arm/mach-at91/Kconfig"
1024 1024
1025source "arch/arm/mach-bcm/Kconfig"
1026
1025source "arch/arm/mach-clps711x/Kconfig" 1027source "arch/arm/mach-clps711x/Kconfig"
1026 1028
1027source "arch/arm/mach-cns3xxx/Kconfig" 1029source "arch/arm/mach-cns3xxx/Kconfig"
@@ -1058,14 +1060,13 @@ source "arch/arm/mach-msm/Kconfig"
1058 1060
1059source "arch/arm/mach-mv78xx0/Kconfig" 1061source "arch/arm/mach-mv78xx0/Kconfig"
1060 1062
1061source "arch/arm/plat-mxc/Kconfig" 1063source "arch/arm/mach-imx/Kconfig"
1062 1064
1063source "arch/arm/mach-mxs/Kconfig" 1065source "arch/arm/mach-mxs/Kconfig"
1064 1066
1065source "arch/arm/mach-netx/Kconfig" 1067source "arch/arm/mach-netx/Kconfig"
1066 1068
1067source "arch/arm/mach-nomadik/Kconfig" 1069source "arch/arm/mach-nomadik/Kconfig"
1068source "arch/arm/plat-nomadik/Kconfig"
1069 1070
1070source "arch/arm/plat-omap/Kconfig" 1071source "arch/arm/plat-omap/Kconfig"
1071 1072
@@ -1113,6 +1114,8 @@ source "arch/arm/mach-exynos/Kconfig"
1113 1114
1114source "arch/arm/mach-shmobile/Kconfig" 1115source "arch/arm/mach-shmobile/Kconfig"
1115 1116
1117source "arch/arm/mach-sunxi/Kconfig"
1118
1116source "arch/arm/mach-prima2/Kconfig" 1119source "arch/arm/mach-prima2/Kconfig"
1117 1120
1118source "arch/arm/mach-tegra/Kconfig" 1121source "arch/arm/mach-tegra/Kconfig"
@@ -1126,8 +1129,12 @@ source "arch/arm/mach-versatile/Kconfig"
1126source "arch/arm/mach-vexpress/Kconfig" 1129source "arch/arm/mach-vexpress/Kconfig"
1127source "arch/arm/plat-versatile/Kconfig" 1130source "arch/arm/plat-versatile/Kconfig"
1128 1131
1132source "arch/arm/mach-vt8500/Kconfig"
1133
1129source "arch/arm/mach-w90x900/Kconfig" 1134source "arch/arm/mach-w90x900/Kconfig"
1130 1135
1136source "arch/arm/mach-zynq/Kconfig"
1137
1131# Definitions to make life easier 1138# Definitions to make life easier
1132config ARCH_ACORN 1139config ARCH_ACORN
1133 bool 1140 bool
@@ -1168,7 +1175,7 @@ config ARM_NR_BANKS
1168config IWMMXT 1175config IWMMXT
1169 bool "Enable iWMMXt support" 1176 bool "Enable iWMMXt support"
1170 depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4 1177 depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4
1171 default y if PXA27x || PXA3xx || PXA95x || ARCH_MMP 1178 default y if PXA27x || PXA3xx || ARCH_MMP
1172 help 1179 help
1173 Enable support for iWMMXt context switching at run time if 1180 Enable support for iWMMXt context switching at run time if
1174 running on a CPU that supports it. 1181 running on a CPU that supports it.
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index b0f3857b3a4..661030d6bc6 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -132,6 +132,23 @@ choice
132 their output to UART1 serial port on DaVinci TNETV107X 132 their output to UART1 serial port on DaVinci TNETV107X
133 devices. 133 devices.
134 134
135 config DEBUG_ZYNQ_UART0
136 bool "Kernel low-level debugging on Xilinx Zynq using UART0"
137 depends on ARCH_ZYNQ
138 help
139 Say Y here if you want the debug print routines to direct
140 their output to UART0 on the Zynq platform.
141
142 config DEBUG_ZYNQ_UART1
143 bool "Kernel low-level debugging on Xilinx Zynq using UART1"
144 depends on ARCH_ZYNQ
145 help
146 Say Y here if you want the debug print routines to direct
147 their output to UART1 on the Zynq platform.
148
149 If you have a ZC702 board and want early boot messages to
150 appear on the USB serial adaptor, select this option.
151
135 config DEBUG_DC21285_PORT 152 config DEBUG_DC21285_PORT
136 bool "Kernel low-level debugging messages via footbridge serial port" 153 bool "Kernel low-level debugging messages via footbridge serial port"
137 depends on FOOTBRIDGE 154 depends on FOOTBRIDGE
@@ -209,20 +226,12 @@ choice
209 Say Y here if you want kernel low-level debugging support 226 Say Y here if you want kernel low-level debugging support
210 on i.MX50 or i.MX53. 227 on i.MX50 or i.MX53.
211 228
212 config DEBUG_IMX6Q_UART2 229 config DEBUG_IMX6Q_UART
213 bool "i.MX6Q Debug UART2" 230 bool "i.MX6Q Debug UART"
214 depends on SOC_IMX6Q
215 help
216 Say Y here if you want kernel low-level debugging support
217 on i.MX6Q UART2. This is correct for e.g. the SabreLite
218 board.
219
220 config DEBUG_IMX6Q_UART4
221 bool "i.MX6Q Debug UART4"
222 depends on SOC_IMX6Q 231 depends on SOC_IMX6Q
223 help 232 help
224 Say Y here if you want kernel low-level debugging support 233 Say Y here if you want kernel low-level debugging support
225 on i.MX6Q UART4. 234 on i.MX6Q.
226 235
227 config DEBUG_MMP_UART2 236 config DEBUG_MMP_UART2
228 bool "Kernel low-level debugging message via MMP UART2" 237 bool "Kernel low-level debugging message via MMP UART2"
@@ -338,6 +347,17 @@ choice
338 The uncompressor code port configuration is now handled 347 The uncompressor code port configuration is now handled
339 by CONFIG_S3C_LOWLEVEL_UART_PORT. 348 by CONFIG_S3C_LOWLEVEL_UART_PORT.
340 349
350 config DEBUG_S3C_UART3
351 depends on PLAT_SAMSUNG && ARCH_EXYNOS
352 bool "Use S3C UART 3 for low-level debug"
353 help
354 Say Y here if you want the debug print routines to direct
355 their output to UART 3. The port must have been initialised
356 by the boot-loader before use.
357
358 The uncompressor code port configuration is now handled
359 by CONFIG_S3C_LOWLEVEL_UART_PORT.
360
341 config DEBUG_SOCFPGA_UART 361 config DEBUG_SOCFPGA_UART
342 depends on ARCH_SOCFPGA 362 depends on ARCH_SOCFPGA
343 bool "Use SOCFPGA UART for low-level debug" 363 bool "Use SOCFPGA UART for low-level debug"
@@ -345,6 +365,27 @@ choice
345 Say Y here if you want kernel low-level debugging support 365 Say Y here if you want kernel low-level debugging support
346 on SOCFPGA based platforms. 366 on SOCFPGA based platforms.
347 367
368 config DEBUG_SUNXI_UART0
369 bool "Kernel low-level debugging messages via sunXi UART0"
370 depends on ARCH_SUNXI
371 help
372 Say Y here if you want kernel low-level debugging support
373 on Allwinner A1X based platforms on the UART0.
374
375 config DEBUG_SUNXI_UART1
376 bool "Kernel low-level debugging messages via sunXi UART1"
377 depends on ARCH_SUNXI
378 help
379 Say Y here if you want kernel low-level debugging support
380 on Allwinner A1X based platforms on the UART1.
381
382 config DEBUG_TEGRA_UART
383 depends on ARCH_TEGRA
384 bool "Use Tegra UART for low-level debug"
385 help
386 Say Y here if you want kernel low-level debugging support
387 on Tegra based platforms.
388
348 config DEBUG_VEXPRESS_UART0_DETECT 389 config DEBUG_VEXPRESS_UART0_DETECT
349 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" 390 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles"
350 depends on ARCH_VEXPRESS && CPU_CP15_MMU 391 depends on ARCH_VEXPRESS && CPU_CP15_MMU
@@ -409,15 +450,64 @@ choice
409 450
410endchoice 451endchoice
411 452
453config DEBUG_IMX6Q_UART_PORT
454 int "i.MX6Q Debug UART Port (1-5)" if DEBUG_IMX6Q_UART
455 range 1 5
456 default 1
457 depends on SOC_IMX6Q
458 help
459 Choose UART port on which kernel low-level debug messages
460 should be output.
461
462choice
463 prompt "Low-level debug console UART"
464 depends on DEBUG_LL && DEBUG_TEGRA_UART
465
466 config TEGRA_DEBUG_UART_AUTO_ODMDATA
467 bool "Via ODMDATA"
468 help
469 Automatically determines which UART to use for low-level debug based
470 on the ODMDATA value. This value is part of the BCT, and is written
471 to the boot memory device using nvflash, or other flashing tool.
472 When bits 19:18 are 3, then bits 17:15 indicate which UART to use;
473 0/1/2/3/4 are UART A/B/C/D/E.
474
475 config TEGRA_DEBUG_UARTA
476 bool "UART A"
477
478 config TEGRA_DEBUG_UARTB
479 bool "UART B"
480
481 config TEGRA_DEBUG_UARTC
482 bool "UART C"
483
484 config TEGRA_DEBUG_UARTD
485 bool "UART D"
486
487 config TEGRA_DEBUG_UARTE
488 bool "UART E"
489
490endchoice
491
412config DEBUG_LL_INCLUDE 492config DEBUG_LL_INCLUDE
413 string 493 string
414 default "debug/icedcc.S" if DEBUG_ICEDCC 494 default "debug/icedcc.S" if DEBUG_ICEDCC
495 default "debug/imx.S" if DEBUG_IMX1_UART || \
496 DEBUG_IMX25_UART || \
497 DEBUG_IMX21_IMX27_UART || \
498 DEBUG_IMX31_IMX35_UART || \
499 DEBUG_IMX51_UART || \
500 DEBUG_IMX50_IMX53_UART ||\
501 DEBUG_IMX6Q_UART
415 default "debug/highbank.S" if DEBUG_HIGHBANK_UART 502 default "debug/highbank.S" if DEBUG_HIGHBANK_UART
416 default "debug/mvebu.S" if DEBUG_MVEBU_UART 503 default "debug/mvebu.S" if DEBUG_MVEBU_UART
417 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART 504 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
418 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART 505 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
506 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
419 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \ 507 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
420 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1 508 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1
509 default "debug/tegra.S" if DEBUG_TEGRA_UART
510 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
421 default "mach/debug-macro.S" 511 default "mach/debug-macro.S"
422 512
423config EARLY_PRINTK 513config EARLY_PRINTK
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 5f914fca911..30c443c406f 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -32,6 +32,7 @@ KBUILD_DEFCONFIG := versatile_defconfig
32# defines filename extension depending memory management type. 32# defines filename extension depending memory management type.
33ifeq ($(CONFIG_MMU),) 33ifeq ($(CONFIG_MMU),)
34MMUEXT := -nommu 34MMUEXT := -nommu
35KBUILD_CFLAGS += $(call cc-option,-mno-unaligned-access)
35endif 36endif
36 37
37ifeq ($(CONFIG_FRAME_POINTER),y) 38ifeq ($(CONFIG_FRAME_POINTER),y)
@@ -137,6 +138,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
137# Machine directory name. This list is sorted alphanumerically 138# Machine directory name. This list is sorted alphanumerically
138# by CONFIG_* macro name. 139# by CONFIG_* macro name.
139machine-$(CONFIG_ARCH_AT91) += at91 140machine-$(CONFIG_ARCH_AT91) += at91
141machine-$(CONFIG_ARCH_BCM) += bcm
140machine-$(CONFIG_ARCH_BCM2835) += bcm2835 142machine-$(CONFIG_ARCH_BCM2835) += bcm2835
141machine-$(CONFIG_ARCH_CLPS711X) += clps711x 143machine-$(CONFIG_ARCH_CLPS711X) += clps711x
142machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx 144machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
@@ -193,15 +195,13 @@ machine-$(CONFIG_ARCH_SPEAR13XX) += spear13xx
193machine-$(CONFIG_ARCH_SPEAR3XX) += spear3xx 195machine-$(CONFIG_ARCH_SPEAR3XX) += spear3xx
194machine-$(CONFIG_MACH_SPEAR600) += spear6xx 196machine-$(CONFIG_MACH_SPEAR600) += spear6xx
195machine-$(CONFIG_ARCH_ZYNQ) += zynq 197machine-$(CONFIG_ARCH_ZYNQ) += zynq
198machine-$(CONFIG_ARCH_SUNXI) += sunxi
196 199
197# Platform directory name. This list is sorted alphanumerically 200# Platform directory name. This list is sorted alphanumerically
198# by CONFIG_* macro name. 201# by CONFIG_* macro name.
199plat-$(CONFIG_ARCH_MXC) += mxc
200plat-$(CONFIG_ARCH_OMAP) += omap 202plat-$(CONFIG_ARCH_OMAP) += omap
201plat-$(CONFIG_ARCH_S3C64XX) += samsung 203plat-$(CONFIG_ARCH_S3C64XX) += samsung
202plat-$(CONFIG_ARCH_ZYNQ) += versatile
203plat-$(CONFIG_PLAT_IOP) += iop 204plat-$(CONFIG_PLAT_IOP) += iop
204plat-$(CONFIG_PLAT_NOMADIK) += nomadik
205plat-$(CONFIG_PLAT_ORION) += orion 205plat-$(CONFIG_PLAT_ORION) += orion
206plat-$(CONFIG_PLAT_PXA) += pxa 206plat-$(CONFIG_PLAT_PXA) += pxa
207plat-$(CONFIG_PLAT_S3C24XX) += s3c24xx samsung 207plat-$(CONFIG_PLAT_S3C24XX) += s3c24xx samsung
@@ -292,10 +292,10 @@ zinstall uinstall install: vmlinux
292 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 292 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
293 293
294%.dtb: scripts 294%.dtb: scripts
295 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 295 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
296 296
297dtbs: scripts 297dtbs: scripts
298 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 298 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
299 299
300# We use MRPROPER_FILES and CLEAN_FILES now 300# We use MRPROPER_FILES and CLEAN_FILES now
301archclean: 301archclean:
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 9137df539b6..abfce280f57 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -15,8 +15,6 @@ ifneq ($(MACHINE),)
15include $(srctree)/$(MACHINE)/Makefile.boot 15include $(srctree)/$(MACHINE)/Makefile.boot
16endif 16endif
17 17
18include $(srctree)/arch/arm/boot/dts/Makefile
19
20# Note: the following conditions must always be true: 18# Note: the following conditions must always be true:
21# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET) 19# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
22# PARAMS_PHYS must be within 4MB of ZRELADDR 20# PARAMS_PHYS must be within 4MB of ZRELADDR
@@ -59,16 +57,6 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
59 57
60endif 58endif
61 59
62targets += $(dtb-y)
63
64# Rule to build device tree blobs
65$(obj)/%.dtb: $(src)/dts/%.dts FORCE
66 $(call if_changed_dep,dtc)
67
68$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
69
70clean-files := *.dtb
71
72ifneq ($(LOADADDR),) 60ifneq ($(LOADADDR),)
73 UIMAGE_LOADADDR=$(LOADADDR) 61 UIMAGE_LOADADDR=$(LOADADDR)
74else 62else
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index a517153a13e..5cad8a6dadb 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -45,19 +45,10 @@ ifeq ($(CONFIG_ARCH_SHARK),y)
45OBJS += head-shark.o ofw-shark.o 45OBJS += head-shark.o ofw-shark.o
46endif 46endif
47 47
48ifeq ($(CONFIG_ARCH_P720T),y)
49# Borrow this code from SA1100
50OBJS += head-sa1100.o
51endif
52
53ifeq ($(CONFIG_ARCH_SA1100),y) 48ifeq ($(CONFIG_ARCH_SA1100),y)
54OBJS += head-sa1100.o 49OBJS += head-sa1100.o
55endif 50endif
56 51
57ifeq ($(CONFIG_ARCH_VT8500),y)
58OBJS += head-vt8500.o
59endif
60
61ifeq ($(CONFIG_CPU_XSCALE),y) 52ifeq ($(CONFIG_CPU_XSCALE),y)
62OBJS += head-xscale.o 53OBJS += head-xscale.o
63endif 54endif
diff --git a/arch/arm/boot/compressed/head-vt8500.S b/arch/arm/boot/compressed/head-vt8500.S
deleted file mode 100644
index 1dc1e21a3be..00000000000
--- a/arch/arm/boot/compressed/head-vt8500.S
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * linux/arch/arm/boot/compressed/head-vt8500.S
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
5 *
6 * VIA VT8500 specific tweaks. This is merged into head.S by the linker.
7 *
8 */
9
10#include <linux/linkage.h>
11#include <asm/mach-types.h>
12
13 .section ".start", "ax"
14
15__VT8500_start:
16 @ Compare the SCC ID register against a list of known values
17 ldr r1, .SCCID
18 ldr r3, [r1]
19
20 @ VT8500 override
21 ldr r4, .VT8500SCC
22 cmp r3, r4
23 ldreq r7, .ID_BV07
24 beq .Lendvt8500
25
26 @ WM8505 override
27 ldr r4, .WM8505SCC
28 cmp r3, r4
29 ldreq r7, .ID_8505
30 beq .Lendvt8500
31
32 @ Otherwise, leave the bootloader's machine id untouched
33
34.SCCID:
35 .word 0xd8120000
36.VT8500SCC:
37 .word 0x34000102
38.WM8505SCC:
39 .word 0x34260103
40
41.ID_BV07:
42 .word MACH_TYPE_BV07
43.ID_8505:
44 .word MACH_TYPE_WM8505_7IN_NETBOOK
45
46.Lendvt8500:
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 90275f036cd..49ca86e37b8 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -652,6 +652,15 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
652 mov pc, lr 652 mov pc, lr
653ENDPROC(__setup_mmu) 653ENDPROC(__setup_mmu)
654 654
655@ Enable unaligned access on v6, to allow better code generation
656@ for the decompressor C code:
657__armv6_mmu_cache_on:
658 mrc p15, 0, r0, c1, c0, 0 @ read SCTLR
659 bic r0, r0, #2 @ A (no unaligned access fault)
660 orr r0, r0, #1 << 22 @ U (v6 unaligned access model)
661 mcr p15, 0, r0, c1, c0, 0 @ write SCTLR
662 b __armv4_mmu_cache_on
663
655__arm926ejs_mmu_cache_on: 664__arm926ejs_mmu_cache_on:
656#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 665#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
657 mov r0, #4 @ put dcache in WT mode 666 mov r0, #4 @ put dcache in WT mode
@@ -694,6 +703,9 @@ __armv7_mmu_cache_on:
694 bic r0, r0, #1 << 28 @ clear SCTLR.TRE 703 bic r0, r0, #1 << 28 @ clear SCTLR.TRE
695 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement 704 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
696 orr r0, r0, #0x003c @ write buffer 705 orr r0, r0, #0x003c @ write buffer
706 bic r0, r0, #2 @ A (no unaligned access fault)
707 orr r0, r0, #1 << 22 @ U (v6 unaligned access model)
708 @ (needed for ARM1176)
697#ifdef CONFIG_MMU 709#ifdef CONFIG_MMU
698#ifdef CONFIG_CPU_ENDIAN_BE8 710#ifdef CONFIG_CPU_ENDIAN_BE8
699 orr r0, r0, #1 << 25 @ big-endian page tables 711 orr r0, r0, #1 << 25 @ big-endian page tables
@@ -914,7 +926,7 @@ proc_types:
914 926
915 .word 0x0007b000 @ ARMv6 927 .word 0x0007b000 @ ARMv6
916 .word 0x000ff000 928 .word 0x000ff000
917 W(b) __armv4_mmu_cache_on 929 W(b) __armv6_mmu_cache_on
918 W(b) __armv4_mmu_cache_off 930 W(b) __armv4_mmu_cache_off
919 W(b) __armv6_mmu_cache_flush 931 W(b) __armv6_mmu_cache_flush
920 932
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index f37cf9fa5fa..2af359cfe98 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1,30 +1,54 @@
1ifeq ($(CONFIG_OF),y) 1ifeq ($(CONFIG_OF),y)
2 2
3dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb \ 3# Keep at91 dtb files sorted alphabetically for each SoC
4 at91sam9263ek.dtb \ 4# rm9200
5 at91sam9g20ek_2mmc.dtb \ 5dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb
6 at91sam9g20ek.dtb \ 6# sam9260
7 at91sam9g25ek.dtb \ 7dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb
8 at91sam9m10g45ek.dtb \ 8dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb
9 at91sam9n12ek.dtb \ 9dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb
10 ethernut5.dtb \ 10dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb
11 evk-pro3.dtb \ 11dtb-$(CONFIG_ARCH_AT91) += tny_a9260.dtb
12 kizbox.dtb \ 12dtb-$(CONFIG_ARCH_AT91) += usb_a9260.dtb
13 tny_a9260.dtb \ 13# sam9263
14 tny_a9263.dtb \ 14dtb-$(CONFIG_ARCH_AT91) += at91sam9263ek.dtb
15 tny_a9g20.dtb \ 15dtb-$(CONFIG_ARCH_AT91) += tny_a9263.dtb
16 usb_a9260.dtb \ 16dtb-$(CONFIG_ARCH_AT91) += usb_a9263.dtb
17 usb_a9263.dtb \ 17# sam9g20
18 usb_a9g20.dtb 18dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek.dtb
19dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek_2mmc.dtb
20dtb-$(CONFIG_ARCH_AT91) += kizbox.dtb
21dtb-$(CONFIG_ARCH_AT91) += tny_a9g20.dtb
22dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb
23# sam9g45
24dtb-$(CONFIG_ARCH_AT91) += at91sam9m10g45ek.dtb
25dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb
26# sam9n12
27dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb
28# sam9x5
29dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb
30dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb
31dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb
32dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb
33dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb
34
19dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 35dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
36dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb
37dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
38 da850-evm.dtb
20dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ 39dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
21 dove-cubox.dtb \ 40 dove-cubox.dtb \
22 dove-dove-db.dtb 41 dove-dove-db.dtb
23dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ 42dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
24 exynos4210-smdkv310.dtb \ 43 exynos4210-smdkv310.dtb \
25 exynos4210-trats.dtb \ 44 exynos4210-trats.dtb \
26 exynos5250-smdk5250.dtb 45 exynos5250-smdk5250.dtb \
27dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb 46 exynos5440-ssdk5440.dtb \
47 exynos4412-smdk4412.dtb \
48 exynos5250-smdk5250.dtb \
49 exynos5250-snow.dtb
50dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
51 ecx-2000.dtb
28dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ 52dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
29 integratorcp.dtb 53 integratorcp.dtb
30dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 54dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
@@ -36,11 +60,20 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
36 kirkwood-ib62x0.dtb \ 60 kirkwood-ib62x0.dtb \
37 kirkwood-iconnect.dtb \ 61 kirkwood-iconnect.dtb \
38 kirkwood-iomega_ix2_200.dtb \ 62 kirkwood-iomega_ix2_200.dtb \
63 kirkwood-is2.dtb \
39 kirkwood-km_kirkwood.dtb \ 64 kirkwood-km_kirkwood.dtb \
40 kirkwood-lschlv2.dtb \ 65 kirkwood-lschlv2.dtb \
41 kirkwood-lsxhl.dtb \ 66 kirkwood-lsxhl.dtb \
67 kirkwood-mplcec4.dtb \
68 kirkwood-ns2.dtb \
69 kirkwood-ns2lite.dtb \
70 kirkwood-ns2max.dtb \
71 kirkwood-ns2mini.dtb \
72 kirkwood-nsa310.dtb \
73 kirkwood-topkick.dtb \
42 kirkwood-ts219-6281.dtb \ 74 kirkwood-ts219-6281.dtb \
43 kirkwood-ts219-6282.dtb 75 kirkwood-ts219-6282.dtb \
76 kirkwood-openblocks_a6.dtb
44dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \ 77dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
45 msm8960-cdp.dtb 78 msm8960-cdp.dtb
46dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \ 79dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
@@ -51,39 +84,52 @@ dtb-$(CONFIG_ARCH_MXC) += imx51-babbage.dtb \
51 imx53-qsb.dtb \ 84 imx53-qsb.dtb \
52 imx53-smd.dtb \ 85 imx53-smd.dtb \
53 imx6q-arm2.dtb \ 86 imx6q-arm2.dtb \
87 imx6q-sabreauto.dtb \
54 imx6q-sabrelite.dtb \ 88 imx6q-sabrelite.dtb \
55 imx6q-sabresd.dtb 89 imx6q-sabresd.dtb
56dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \ 90dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
57 imx23-olinuxino.dtb \ 91 imx23-olinuxino.dtb \
58 imx23-stmp378x_devb.dtb \ 92 imx23-stmp378x_devb.dtb \
93 imx28-apf28.dtb \
94 imx28-apf28dev.dtb \
59 imx28-apx4devkit.dtb \ 95 imx28-apx4devkit.dtb \
60 imx28-cfa10036.dtb \ 96 imx28-cfa10036.dtb \
61 imx28-cfa10049.dtb \ 97 imx28-cfa10049.dtb \
62 imx28-evk.dtb \ 98 imx28-evk.dtb \
63 imx28-m28evk.dtb \ 99 imx28-m28evk.dtb \
100 imx28-sps1.dtb \
64 imx28-tx28.dtb 101 imx28-tx28.dtb
65dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \ 102dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
103 omap3-beagle.dtb \
66 omap3-beagle-xm.dtb \ 104 omap3-beagle-xm.dtb \
67 omap3-evm.dtb \ 105 omap3-evm.dtb \
68 omap3-tobi.dtb \ 106 omap3-tobi.dtb \
69 omap4-panda.dtb \ 107 omap4-panda.dtb \
70 omap4-pandaES.dtb \ 108 omap4-panda-es.dtb \
71 omap4-var_som.dtb \ 109 omap4-var-som.dtb \
72 omap4-sdp.dtb \ 110 omap4-sdp.dtb \
73 omap5-evm.dtb \ 111 omap5-evm.dtb \
74 am335x-evm.dtb \ 112 am335x-evm.dtb \
113 am335x-evmsk.dtb \
75 am335x-bone.dtb 114 am335x-bone.dtb
115dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb
76dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb 116dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
77dtb-$(CONFIG_ARCH_U8500) += snowball.dtb 117dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
118 hrefprev60.dtb \
119 hrefv60plus.dtb \
120 ccu9540.dtb
78dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ 121dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
79 r8a7740-armadillo800eva.dtb \ 122 r8a7740-armadillo800eva.dtb \
80 sh73a0-kzm9g.dtb 123 sh73a0-kzm9g.dtb \
124 sh7372-mackerel.dtb
81dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \ 125dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \
82 spear1340-evb.dtb 126 spear1340-evb.dtb
83dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \ 127dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \
84 spear310-evb.dtb \ 128 spear310-evb.dtb \
85 spear320-evb.dtb 129 spear320-evb.dtb
86dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb 130dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb
131dtb-$(CONFIG_ARCH_SUNXI) += sun4i-cubieboard.dtb \
132 sun5i-olinuxino.dtb
87dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ 133dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
88 tegra20-medcom-wide.dtb \ 134 tegra20-medcom-wide.dtb \
89 tegra20-paz00.dtb \ 135 tegra20-paz00.dtb \
@@ -103,5 +149,14 @@ dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \
103dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \ 149dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
104 wm8505-ref.dtb \ 150 wm8505-ref.dtb \
105 wm8650-mid.dtb 151 wm8650-mid.dtb
152dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
106 153
154targets += dtbs
107endif 155endif
156
157# *.dtb used to be generated in the directory above. Clean out the
158# old build results so people don't accidentally use them.
159dtbs: $(addprefix $(obj)/, $(dtb-y))
160 $(Q)rm -f $(obj)/../*.dtb
161
162clean-files := *.dtb
diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index c634f87e230..11b240c5d32 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -13,11 +13,31 @@
13 model = "TI AM335x BeagleBone"; 13 model = "TI AM335x BeagleBone";
14 compatible = "ti,am335x-bone", "ti,am33xx"; 14 compatible = "ti,am335x-bone", "ti,am33xx";
15 15
16 cpus {
17 cpu@0 {
18 cpu0-supply = <&dcdc2_reg>;
19 };
20 };
21
16 memory { 22 memory {
17 device_type = "memory"; 23 device_type = "memory";
18 reg = <0x80000000 0x10000000>; /* 256 MB */ 24 reg = <0x80000000 0x10000000>; /* 256 MB */
19 }; 25 };
20 26
27 am33xx_pinmux: pinmux@44e10800 {
28 pinctrl-names = "default";
29 pinctrl-0 = <&user_leds_s0>;
30
31 user_leds_s0: user_leds_s0 {
32 pinctrl-single,pins = <
33 0x54 0x7 /* gpmc_a5.gpio1_21, OUTPUT | MODE7 */
34 0x58 0x17 /* gpmc_a6.gpio1_22, OUTPUT_PULLUP | MODE7 */
35 0x5c 0x7 /* gpmc_a7.gpio1_23, OUTPUT | MODE7 */
36 0x60 0x17 /* gpmc_a8.gpio1_24, OUTPUT_PULLUP | MODE7 */
37 >;
38 };
39 };
40
21 ocp { 41 ocp {
22 uart1: serial@44e09000 { 42 uart1: serial@44e09000 {
23 status = "okay"; 43 status = "okay";
@@ -33,6 +53,36 @@
33 53
34 }; 54 };
35 }; 55 };
56
57 leds {
58 compatible = "gpio-leds";
59
60 led@2 {
61 label = "beaglebone:green:heartbeat";
62 gpios = <&gpio2 21 0>;
63 linux,default-trigger = "heartbeat";
64 default-state = "off";
65 };
66
67 led@3 {
68 label = "beaglebone:green:mmc0";
69 gpios = <&gpio2 22 0>;
70 linux,default-trigger = "mmc0";
71 default-state = "off";
72 };
73
74 led@4 {
75 label = "beaglebone:green:usr2";
76 gpios = <&gpio2 23 0>;
77 default-state = "off";
78 };
79
80 led@5 {
81 label = "beaglebone:green:usr3";
82 gpios = <&gpio2 24 0>;
83 default-state = "off";
84 };
85 };
36}; 86};
37 87
38/include/ "tps65217.dtsi" 88/include/ "tps65217.dtsi"
@@ -78,3 +128,11 @@
78 }; 128 };
79 }; 129 };
80}; 130};
131
132&cpsw_emac0 {
133 phy_id = <&davinci_mdio>, <0>;
134};
135
136&cpsw_emac1 {
137 phy_id = <&davinci_mdio>, <1>;
138};
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index 185d6325a45..d6496440fce 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -13,11 +13,39 @@
13 model = "TI AM335x EVM"; 13 model = "TI AM335x EVM";
14 compatible = "ti,am335x-evm", "ti,am33xx"; 14 compatible = "ti,am335x-evm", "ti,am33xx";
15 15
16 cpus {
17 cpu@0 {
18 cpu0-supply = <&vdd1_reg>;
19 };
20 };
21
16 memory { 22 memory {
17 device_type = "memory"; 23 device_type = "memory";
18 reg = <0x80000000 0x10000000>; /* 256 MB */ 24 reg = <0x80000000 0x10000000>; /* 256 MB */
19 }; 25 };
20 26
27 am33xx_pinmux: pinmux@44e10800 {
28 pinctrl-names = "default";
29 pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0>;
30
31 matrix_keypad_s0: matrix_keypad_s0 {
32 pinctrl-single,pins = <
33 0x54 0x7 /* gpmc_a5.gpio1_21, OUTPUT | MODE7 */
34 0x58 0x7 /* gpmc_a6.gpio1_22, OUTPUT | MODE7 */
35 0x64 0x27 /* gpmc_a9.gpio1_25, INPUT | MODE7 */
36 0x68 0x27 /* gpmc_a10.gpio1_26, INPUT | MODE7 */
37 0x6c 0x27 /* gpmc_a11.gpio1_27, INPUT | MODE7 */
38 >;
39 };
40
41 volume_keys_s0: volume_keys_s0 {
42 pinctrl-single,pins = <
43 0x150 0x27 /* spi0_sclk.gpio0_2, INPUT | MODE7 */
44 0x154 0x27 /* spi0_d0.gpio0_3, INPUT | MODE7 */
45 >;
46 };
47 };
48
21 ocp { 49 ocp {
22 uart1: serial@44e09000 { 50 uart1: serial@44e09000 {
23 status = "okay"; 51 status = "okay";
@@ -31,6 +59,49 @@
31 reg = <0x2d>; 59 reg = <0x2d>;
32 }; 60 };
33 }; 61 };
62
63 i2c2: i2c@4802a000 {
64 status = "okay";
65 clock-frequency = <100000>;
66
67 lis331dlh: lis331dlh@18 {
68 compatible = "st,lis331dlh", "st,lis3lv02d";
69 reg = <0x18>;
70 Vdd-supply = <&lis3_reg>;
71 Vdd_IO-supply = <&lis3_reg>;
72
73 st,click-single-x;
74 st,click-single-y;
75 st,click-single-z;
76 st,click-thresh-x = <10>;
77 st,click-thresh-y = <10>;
78 st,click-thresh-z = <10>;
79 st,irq1-click;
80 st,irq2-click;
81 st,wakeup-x-lo;
82 st,wakeup-x-hi;
83 st,wakeup-y-lo;
84 st,wakeup-y-hi;
85 st,wakeup-z-lo;
86 st,wakeup-z-hi;
87 st,min-limit-x = <120>;
88 st,min-limit-y = <120>;
89 st,min-limit-z = <140>;
90 st,max-limit-x = <550>;
91 st,max-limit-y = <550>;
92 st,max-limit-z = <750>;
93 };
94
95 tsl2550: tsl2550@39 {
96 compatible = "taos,tsl2550";
97 reg = <0x39>;
98 };
99
100 tmp275: tmp275@48 {
101 compatible = "ti,tmp275";
102 reg = <0x48>;
103 };
104 };
34 }; 105 };
35 106
36 vbat: fixedregulator@0 { 107 vbat: fixedregulator@0 {
@@ -40,6 +111,53 @@
40 regulator-max-microvolt = <5000000>; 111 regulator-max-microvolt = <5000000>;
41 regulator-boot-on; 112 regulator-boot-on;
42 }; 113 };
114
115 lis3_reg: fixedregulator@1 {
116 compatible = "regulator-fixed";
117 regulator-name = "lis3_reg";
118 regulator-boot-on;
119 };
120
121 matrix_keypad: matrix_keypad@0 {
122 compatible = "gpio-matrix-keypad";
123 debounce-delay-ms = <5>;
124 col-scan-delay-us = <2>;
125
126 row-gpios = <&gpio2 25 0 /* Bank1, pin25 */
127 &gpio2 26 0 /* Bank1, pin26 */
128 &gpio2 27 0>; /* Bank1, pin27 */
129
130 col-gpios = <&gpio2 21 0 /* Bank1, pin21 */
131 &gpio2 22 0>; /* Bank1, pin22 */
132
133 linux,keymap = <0x0000008b /* MENU */
134 0x0100009e /* BACK */
135 0x02000069 /* LEFT */
136 0x0001006a /* RIGHT */
137 0x0101001c /* ENTER */
138 0x0201006c>; /* DOWN */
139 };
140
141 gpio_keys: volume_keys@0 {
142 compatible = "gpio-keys";
143 #address-cells = <1>;
144 #size-cells = <0>;
145 autorepeat;
146
147 switch@9 {
148 label = "volume-up";
149 linux,code = <115>;
150 gpios = <&gpio1 2 1>;
151 gpio-key,wakeup;
152 };
153
154 switch@10 {
155 label = "volume-down";
156 linux,code = <114>;
157 gpios = <&gpio1 3 1>;
158 gpio-key,wakeup;
159 };
160 };
43}; 161};
44 162
45/include/ "tps65910.dtsi" 163/include/ "tps65910.dtsi"
@@ -118,3 +236,11 @@
118 }; 236 };
119 }; 237 };
120}; 238};
239
240&cpsw_emac0 {
241 phy_id = <&davinci_mdio>, <0>;
242};
243
244&cpsw_emac1 {
245 phy_id = <&davinci_mdio>, <1>;
246};
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
new file mode 100644
index 00000000000..f5a6162a4ff
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -0,0 +1,250 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/*
10 * AM335x Starter Kit
11 * http://www.ti.com/tool/tmdssk3358
12 */
13
14/dts-v1/;
15
16/include/ "am33xx.dtsi"
17
18/ {
19 model = "TI AM335x EVM-SK";
20 compatible = "ti,am335x-evmsk", "ti,am33xx";
21
22 cpus {
23 cpu@0 {
24 cpu0-supply = <&vdd1_reg>;
25 };
26 };
27
28 memory {
29 device_type = "memory";
30 reg = <0x80000000 0x10000000>; /* 256 MB */
31 };
32
33 am33xx_pinmux: pinmux@44e10800 {
34 pinctrl-names = "default";
35 pinctrl-0 = <&user_leds_s0 &gpio_keys_s0>;
36
37 user_leds_s0: user_leds_s0 {
38 pinctrl-single,pins = <
39 0x10 0x7 /* gpmc_ad4.gpio1_4, OUTPUT | MODE7 */
40 0x14 0x7 /* gpmc_ad5.gpio1_5, OUTPUT | MODE7 */
41 0x18 0x7 /* gpmc_ad6.gpio1_6, OUTPUT | MODE7 */
42 0x1c 0x7 /* gpmc_ad7.gpio1_7, OUTPUT | MODE7 */
43 >;
44 };
45
46 gpio_keys_s0: gpio_keys_s0 {
47 pinctrl-single,pins = <
48 0x94 0x27 /* gpmc_oen_ren.gpio2_3, INPUT | MODE7 */
49 0x90 0x27 /* gpmc_advn_ale.gpio2_2, INPUT | MODE7 */
50 0x70 0x27 /* gpmc_wait0.gpio0_30, INPUT | MODE7 */
51 0x9c 0x27 /* gpmc_ben0_cle.gpio2_5, INPUT | MODE7 */
52 >;
53 };
54 };
55
56 ocp {
57 uart1: serial@44e09000 {
58 status = "okay";
59 };
60
61 i2c1: i2c@44e0b000 {
62 status = "okay";
63 clock-frequency = <400000>;
64
65 tps: tps@2d {
66 reg = <0x2d>;
67 };
68
69 lis331dlh: lis331dlh@18 {
70 compatible = "st,lis331dlh", "st,lis3lv02d";
71 reg = <0x18>;
72 Vdd-supply = <&lis3_reg>;
73 Vdd_IO-supply = <&lis3_reg>;
74
75 st,click-single-x;
76 st,click-single-y;
77 st,click-single-z;
78 st,click-thresh-x = <10>;
79 st,click-thresh-y = <10>;
80 st,click-thresh-z = <10>;
81 st,irq1-click;
82 st,irq2-click;
83 st,wakeup-x-lo;
84 st,wakeup-x-hi;
85 st,wakeup-y-lo;
86 st,wakeup-y-hi;
87 st,wakeup-z-lo;
88 st,wakeup-z-hi;
89 st,min-limit-x = <120>;
90 st,min-limit-y = <120>;
91 st,min-limit-z = <140>;
92 st,max-limit-x = <550>;
93 st,max-limit-y = <550>;
94 st,max-limit-z = <750>;
95 };
96 };
97 };
98
99 vbat: fixedregulator@0 {
100 compatible = "regulator-fixed";
101 regulator-name = "vbat";
102 regulator-min-microvolt = <5000000>;
103 regulator-max-microvolt = <5000000>;
104 regulator-boot-on;
105 };
106
107 lis3_reg: fixedregulator@1 {
108 compatible = "regulator-fixed";
109 regulator-name = "lis3_reg";
110 regulator-boot-on;
111 };
112
113 leds {
114 compatible = "gpio-leds";
115
116 led@1 {
117 label = "evmsk:green:usr0";
118 gpios = <&gpio2 4 0>;
119 default-state = "off";
120 };
121
122 led@2 {
123 label = "evmsk:green:usr1";
124 gpios = <&gpio2 5 0>;
125 default-state = "off";
126 };
127
128 led@3 {
129 label = "evmsk:green:mmc0";
130 gpios = <&gpio2 6 0>;
131 linux,default-trigger = "mmc0";
132 default-state = "off";
133 };
134
135 led@4 {
136 label = "evmsk:green:heartbeat";
137 gpios = <&gpio2 7 0>;
138 linux,default-trigger = "heartbeat";
139 default-state = "off";
140 };
141 };
142
143 gpio_buttons: gpio_buttons@0 {
144 compatible = "gpio-keys";
145 #address-cells = <1>;
146 #size-cells = <0>;
147
148 switch@1 {
149 label = "button0";
150 linux,code = <0x100>;
151 gpios = <&gpio3 3 0>;
152 };
153
154 switch@2 {
155 label = "button1";
156 linux,code = <0x101>;
157 gpios = <&gpio3 2 0>;
158 };
159
160 switch@3 {
161 label = "button2";
162 linux,code = <0x102>;
163 gpios = <&gpio1 30 0>;
164 gpio-key,wakeup;
165 };
166
167 switch@4 {
168 label = "button3";
169 linux,code = <0x103>;
170 gpios = <&gpio3 5 0>;
171 };
172 };
173};
174
175/include/ "tps65910.dtsi"
176
177&tps {
178 vcc1-supply = <&vbat>;
179 vcc2-supply = <&vbat>;
180 vcc3-supply = <&vbat>;
181 vcc4-supply = <&vbat>;
182 vcc5-supply = <&vbat>;
183 vcc6-supply = <&vbat>;
184 vcc7-supply = <&vbat>;
185 vccio-supply = <&vbat>;
186
187 regulators {
188 vrtc_reg: regulator@0 {
189 regulator-always-on;
190 };
191
192 vio_reg: regulator@1 {
193 regulator-always-on;
194 };
195
196 vdd1_reg: regulator@2 {
197 /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
198 regulator-name = "vdd_mpu";
199 regulator-min-microvolt = <912500>;
200 regulator-max-microvolt = <1312500>;
201 regulator-boot-on;
202 regulator-always-on;
203 };
204
205 vdd2_reg: regulator@3 {
206 /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
207 regulator-name = "vdd_core";
208 regulator-min-microvolt = <912500>;
209 regulator-max-microvolt = <1150000>;
210 regulator-boot-on;
211 regulator-always-on;
212 };
213
214 vdd3_reg: regulator@4 {
215 regulator-always-on;
216 };
217
218 vdig1_reg: regulator@5 {
219 regulator-always-on;
220 };
221
222 vdig2_reg: regulator@6 {
223 regulator-always-on;
224 };
225
226 vpll_reg: regulator@7 {
227 regulator-always-on;
228 };
229
230 vdac_reg: regulator@8 {
231 regulator-always-on;
232 };
233
234 vaux1_reg: regulator@9 {
235 regulator-always-on;
236 };
237
238 vaux2_reg: regulator@10 {
239 regulator-always-on;
240 };
241
242 vaux33_reg: regulator@11 {
243 regulator-always-on;
244 };
245
246 vmmc_reg: regulator@12 {
247 regulator-always-on;
248 };
249 };
250};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index bb31bff0199..c2f14e875eb 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -12,6 +12,7 @@
12 12
13/ { 13/ {
14 compatible = "ti,am33xx"; 14 compatible = "ti,am33xx";
15 interrupt-parent = <&intc>;
15 16
16 aliases { 17 aliases {
17 serial0 = &uart1; 18 serial0 = &uart1;
@@ -25,6 +26,21 @@
25 cpus { 26 cpus {
26 cpu@0 { 27 cpu@0 {
27 compatible = "arm,cortex-a8"; 28 compatible = "arm,cortex-a8";
29
30 /*
31 * To consider voltage drop between PMIC and SoC,
32 * tolerance value is reduced to 2% from 4% and
33 * voltage value is increased as a precaution.
34 */
35 operating-points = <
36 /* kHz uV */
37 720000 1285000
38 600000 1225000
39 500000 1125000
40 275000 1125000
41 >;
42 voltage-tolerance = <2>; /* 2 percentage */
43 clock-latency = <300000>; /* From omap-cpufreq driver */
28 }; 44 };
29 }; 45 };
30 46
@@ -40,6 +56,15 @@
40 }; 56 };
41 }; 57 };
42 58
59 am33xx_pinmux: pinmux@44e10800 {
60 compatible = "pinctrl-single";
61 reg = <0x44e10800 0x0238>;
62 #address-cells = <1>;
63 #size-cells = <0>;
64 pinctrl-single,register-width = <32>;
65 pinctrl-single,function-mask = <0x7f>;
66 };
67
43 /* 68 /*
44 * XXX: Use a flat representation of the AM33XX interconnect. 69 * XXX: Use a flat representation of the AM33XX interconnect.
45 * The real AM33XX interconnect network is quite complex.Since 70 * The real AM33XX interconnect network is quite complex.Since
@@ -70,7 +95,6 @@
70 interrupt-controller; 95 interrupt-controller;
71 #interrupt-cells = <1>; 96 #interrupt-cells = <1>;
72 reg = <0x44e07000 0x1000>; 97 reg = <0x44e07000 0x1000>;
73 interrupt-parent = <&intc>;
74 interrupts = <96>; 98 interrupts = <96>;
75 }; 99 };
76 100
@@ -82,7 +106,6 @@
82 interrupt-controller; 106 interrupt-controller;
83 #interrupt-cells = <1>; 107 #interrupt-cells = <1>;
84 reg = <0x4804c000 0x1000>; 108 reg = <0x4804c000 0x1000>;
85 interrupt-parent = <&intc>;
86 interrupts = <98>; 109 interrupts = <98>;
87 }; 110 };
88 111
@@ -94,7 +117,6 @@
94 interrupt-controller; 117 interrupt-controller;
95 #interrupt-cells = <1>; 118 #interrupt-cells = <1>;
96 reg = <0x481ac000 0x1000>; 119 reg = <0x481ac000 0x1000>;
97 interrupt-parent = <&intc>;
98 interrupts = <32>; 120 interrupts = <32>;
99 }; 121 };
100 122
@@ -106,7 +128,6 @@
106 interrupt-controller; 128 interrupt-controller;
107 #interrupt-cells = <1>; 129 #interrupt-cells = <1>;
108 reg = <0x481ae000 0x1000>; 130 reg = <0x481ae000 0x1000>;
109 interrupt-parent = <&intc>;
110 interrupts = <62>; 131 interrupts = <62>;
111 }; 132 };
112 133
@@ -115,7 +136,6 @@
115 ti,hwmods = "uart1"; 136 ti,hwmods = "uart1";
116 clock-frequency = <48000000>; 137 clock-frequency = <48000000>;
117 reg = <0x44e09000 0x2000>; 138 reg = <0x44e09000 0x2000>;
118 interrupt-parent = <&intc>;
119 interrupts = <72>; 139 interrupts = <72>;
120 status = "disabled"; 140 status = "disabled";
121 }; 141 };
@@ -125,7 +145,6 @@
125 ti,hwmods = "uart2"; 145 ti,hwmods = "uart2";
126 clock-frequency = <48000000>; 146 clock-frequency = <48000000>;
127 reg = <0x48022000 0x2000>; 147 reg = <0x48022000 0x2000>;
128 interrupt-parent = <&intc>;
129 interrupts = <73>; 148 interrupts = <73>;
130 status = "disabled"; 149 status = "disabled";
131 }; 150 };
@@ -135,7 +154,6 @@
135 ti,hwmods = "uart3"; 154 ti,hwmods = "uart3";
136 clock-frequency = <48000000>; 155 clock-frequency = <48000000>;
137 reg = <0x48024000 0x2000>; 156 reg = <0x48024000 0x2000>;
138 interrupt-parent = <&intc>;
139 interrupts = <74>; 157 interrupts = <74>;
140 status = "disabled"; 158 status = "disabled";
141 }; 159 };
@@ -145,7 +163,6 @@
145 ti,hwmods = "uart4"; 163 ti,hwmods = "uart4";
146 clock-frequency = <48000000>; 164 clock-frequency = <48000000>;
147 reg = <0x481a6000 0x2000>; 165 reg = <0x481a6000 0x2000>;
148 interrupt-parent = <&intc>;
149 interrupts = <44>; 166 interrupts = <44>;
150 status = "disabled"; 167 status = "disabled";
151 }; 168 };
@@ -155,7 +172,6 @@
155 ti,hwmods = "uart5"; 172 ti,hwmods = "uart5";
156 clock-frequency = <48000000>; 173 clock-frequency = <48000000>;
157 reg = <0x481a8000 0x2000>; 174 reg = <0x481a8000 0x2000>;
158 interrupt-parent = <&intc>;
159 interrupts = <45>; 175 interrupts = <45>;
160 status = "disabled"; 176 status = "disabled";
161 }; 177 };
@@ -165,7 +181,6 @@
165 ti,hwmods = "uart6"; 181 ti,hwmods = "uart6";
166 clock-frequency = <48000000>; 182 clock-frequency = <48000000>;
167 reg = <0x481aa000 0x2000>; 183 reg = <0x481aa000 0x2000>;
168 interrupt-parent = <&intc>;
169 interrupts = <46>; 184 interrupts = <46>;
170 status = "disabled"; 185 status = "disabled";
171 }; 186 };
@@ -176,7 +191,6 @@
176 #size-cells = <0>; 191 #size-cells = <0>;
177 ti,hwmods = "i2c1"; 192 ti,hwmods = "i2c1";
178 reg = <0x44e0b000 0x1000>; 193 reg = <0x44e0b000 0x1000>;
179 interrupt-parent = <&intc>;
180 interrupts = <70>; 194 interrupts = <70>;
181 status = "disabled"; 195 status = "disabled";
182 }; 196 };
@@ -187,7 +201,6 @@
187 #size-cells = <0>; 201 #size-cells = <0>;
188 ti,hwmods = "i2c2"; 202 ti,hwmods = "i2c2";
189 reg = <0x4802a000 0x1000>; 203 reg = <0x4802a000 0x1000>;
190 interrupt-parent = <&intc>;
191 interrupts = <71>; 204 interrupts = <71>;
192 status = "disabled"; 205 status = "disabled";
193 }; 206 };
@@ -198,7 +211,6 @@
198 #size-cells = <0>; 211 #size-cells = <0>;
199 ti,hwmods = "i2c3"; 212 ti,hwmods = "i2c3";
200 reg = <0x4819c000 0x1000>; 213 reg = <0x4819c000 0x1000>;
201 interrupt-parent = <&intc>;
202 interrupts = <30>; 214 interrupts = <30>;
203 status = "disabled"; 215 status = "disabled";
204 }; 216 };
@@ -207,8 +219,171 @@
207 compatible = "ti,omap3-wdt"; 219 compatible = "ti,omap3-wdt";
208 ti,hwmods = "wd_timer2"; 220 ti,hwmods = "wd_timer2";
209 reg = <0x44e35000 0x1000>; 221 reg = <0x44e35000 0x1000>;
210 interrupt-parent = <&intc>;
211 interrupts = <91>; 222 interrupts = <91>;
212 }; 223 };
224
225 dcan0: d_can@481cc000 {
226 compatible = "bosch,d_can";
227 ti,hwmods = "d_can0";
228 reg = <0x481cc000 0x2000>;
229 interrupts = <52>;
230 status = "disabled";
231 };
232
233 dcan1: d_can@481d0000 {
234 compatible = "bosch,d_can";
235 ti,hwmods = "d_can1";
236 reg = <0x481d0000 0x2000>;
237 interrupts = <55>;
238 status = "disabled";
239 };
240
241 timer1: timer@44e31000 {
242 compatible = "ti,omap2-timer";
243 reg = <0x44e31000 0x400>;
244 interrupts = <67>;
245 ti,hwmods = "timer1";
246 ti,timer-alwon;
247 };
248
249 timer2: timer@48040000 {
250 compatible = "ti,omap2-timer";
251 reg = <0x48040000 0x400>;
252 interrupts = <68>;
253 ti,hwmods = "timer2";
254 };
255
256 timer3: timer@48042000 {
257 compatible = "ti,omap2-timer";
258 reg = <0x48042000 0x400>;
259 interrupts = <69>;
260 ti,hwmods = "timer3";
261 };
262
263 timer4: timer@48044000 {
264 compatible = "ti,omap2-timer";
265 reg = <0x48044000 0x400>;
266 interrupts = <92>;
267 ti,hwmods = "timer4";
268 ti,timer-pwm;
269 };
270
271 timer5: timer@48046000 {
272 compatible = "ti,omap2-timer";
273 reg = <0x48046000 0x400>;
274 interrupts = <93>;
275 ti,hwmods = "timer5";
276 ti,timer-pwm;
277 };
278
279 timer6: timer@48048000 {
280 compatible = "ti,omap2-timer";
281 reg = <0x48048000 0x400>;
282 interrupts = <94>;
283 ti,hwmods = "timer6";
284 ti,timer-pwm;
285 };
286
287 timer7: timer@4804a000 {
288 compatible = "ti,omap2-timer";
289 reg = <0x4804a000 0x400>;
290 interrupts = <95>;
291 ti,hwmods = "timer7";
292 ti,timer-pwm;
293 };
294
295 rtc@44e3e000 {
296 compatible = "ti,da830-rtc";
297 reg = <0x44e3e000 0x1000>;
298 interrupts = <75
299 76>;
300 ti,hwmods = "rtc";
301 };
302
303 spi0: spi@48030000 {
304 compatible = "ti,omap4-mcspi";
305 #address-cells = <1>;
306 #size-cells = <0>;
307 reg = <0x48030000 0x400>;
308 interrupt = <65>;
309 ti,spi-num-cs = <2>;
310 ti,hwmods = "spi0";
311 status = "disabled";
312 };
313
314 spi1: spi@481a0000 {
315 compatible = "ti,omap4-mcspi";
316 #address-cells = <1>;
317 #size-cells = <0>;
318 reg = <0x481a0000 0x400>;
319 interrupt = <125>;
320 ti,spi-num-cs = <2>;
321 ti,hwmods = "spi1";
322 status = "disabled";
323 };
324
325 usb@47400000 {
326 compatible = "ti,musb-am33xx";
327 reg = <0x47400000 0x1000 /* usbss */
328 0x47401000 0x800 /* musb instance 0 */
329 0x47401800 0x800>; /* musb instance 1 */
330 interrupts = <17 /* usbss */
331 18 /* musb instance 0 */
332 19>; /* musb instance 1 */
333 multipoint = <1>;
334 num-eps = <16>;
335 ram-bits = <12>;
336 port0-mode = <3>;
337 port1-mode = <3>;
338 power = <250>;
339 ti,hwmods = "usb_otg_hs";
340 };
341
342 mac: ethernet@4a100000 {
343 compatible = "ti,cpsw";
344 ti,hwmods = "cpgmac0";
345 cpdma_channels = <8>;
346 ale_entries = <1024>;
347 bd_ram_size = <0x2000>;
348 no_bd_ram = <0>;
349 rx_descs = <64>;
350 mac_control = <0x20>;
351 slaves = <2>;
352 cpts_active_slave = <0>;
353 cpts_clock_mult = <0x80000000>;
354 cpts_clock_shift = <29>;
355 reg = <0x4a100000 0x800
356 0x4a101200 0x100>;
357 #address-cells = <1>;
358 #size-cells = <1>;
359 interrupt-parent = <&intc>;
360 /*
361 * c0_rx_thresh_pend
362 * c0_rx_pend
363 * c0_tx_pend
364 * c0_misc_pend
365 */
366 interrupts = <40 41 42 43>;
367 ranges;
368
369 davinci_mdio: mdio@4a101000 {
370 compatible = "ti,davinci_mdio";
371 #address-cells = <1>;
372 #size-cells = <0>;
373 ti,hwmods = "davinci_mdio";
374 bus_freq = <1000000>;
375 reg = <0x4a101000 0x100>;
376 };
377
378 cpsw_emac0: slave@4a100200 {
379 /* Filled in by U-Boot */
380 mac-address = [ 00 00 00 00 00 00 ];
381 };
382
383 cpsw_emac1: slave@4a100300 {
384 /* Filled in by U-Boot */
385 mac-address = [ 00 00 00 00 00 00 ];
386 };
387 };
213 }; 388 };
214}; 389};
diff --git a/arch/arm/boot/dts/animeo_ip.dts b/arch/arm/boot/dts/animeo_ip.dts
new file mode 100644
index 00000000000..74d92cd29d8
--- /dev/null
+++ b/arch/arm/boot/dts/animeo_ip.dts
@@ -0,0 +1,178 @@
1/*
2 * animeo_ip.dts - Device Tree file for Somfy Animeo IP Boards
3 *
4 * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 only.
7 */
8
9/dts-v1/;
10/include/ "at91sam9260.dtsi"
11
12/ {
13 model = "Somfy Animeo IP";
14 compatible = "somfy,animeo-ip", "atmel,at91sam9260", "atmel,at91sam9";
15
16 aliases {
17 serial0 = &usart1;
18 serial1 = &usart2;
19 serial2 = &usart0;
20 serial3 = &dbgu;
21 serial4 = &usart3;
22 serial5 = &uart0;
23 serial6 = &uart1;
24 };
25
26 chosen {
27 linux,stdout-path = &usart2;
28 };
29
30 memory {
31 reg = <0x20000000 0x4000000>;
32 };
33
34 clocks {
35 #address-cells = <1>;
36 #size-cells = <1>;
37 ranges;
38
39 main_clock: clock@0 {
40 compatible = "atmel,osc", "fixed-clock";
41 clock-frequency = <18432000>;
42 };
43 };
44
45 ahb {
46 apb {
47 usart0: serial@fffb0000 {
48 pinctrl-0 = <&pinctrl_usart0 &pinctrl_usart0_rts>;
49 linux,rs485-enabled-at-boot-time;
50 status = "okay";
51 };
52
53 usart1: serial@fffb4000 {
54 pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts>;
55 linux,rs485-enabled-at-boot-time;
56 status = "okay";
57 };
58
59 usart2: serial@fffb8000 {
60 pinctrl-0 = <&pinctrl_usart2>;
61 status = "okay";
62 };
63
64 macb0: ethernet@fffc4000 {
65 pinctrl-0 = <&pinctrl_macb_rmii &pinctrl_macb_rmii_mii>;
66 phy-mode = "mii";
67 status = "okay";
68 };
69
70 mmc0: mmc@fffa8000 {
71 pinctrl-0 = <&pinctrl_mmc0_clk
72 &pinctrl_mmc0_slot1_cmd_dat0
73 &pinctrl_mmc0_slot1_dat1_3>;
74 status = "okay";
75
76 slot@1 {
77 reg = <1>;
78 bus-width = <4>;
79 };
80 };
81 };
82
83 nand0: nand@40000000 {
84 nand-bus-width = <8>;
85 nand-ecc-mode = "soft";
86 nand-on-flash-bbt;
87 status = "okay";
88
89 at91bootstrap@0 {
90 label = "at91bootstrap";
91 reg = <0x0 0x8000>;
92 };
93
94 barebox@8000 {
95 label = "barebox";
96 reg = <0x8000 0x40000>;
97 };
98
99 bareboxenv@48000 {
100 label = "bareboxenv";
101 reg = <0x48000 0x8000>;
102 };
103
104 user_block@0x50000 {
105 label = "user_block";
106 reg = <0x50000 0xb0000>;
107 };
108
109 kernel@100000 {
110 label = "kernel";
111 reg = <0x100000 0x1b0000>;
112 };
113
114 root@2b0000 {
115 label = "root";
116 reg = <0x2b0000 0x1D50000>;
117 };
118 };
119
120 usb0: ohci@00500000 {
121 num-ports = <2>;
122 atmel,vbus-gpio = <&pioB 15 1>;
123 status = "okay";
124 };
125 };
126
127 leds {
128 compatible = "gpio-leds";
129
130 power_green {
131 label = "power_green";
132 gpios = <&pioC 17 0>;
133 linux,default-trigger = "heartbeat";
134 };
135
136 power_red {
137 label = "power_red";
138 gpios = <&pioA 2 0>;
139 };
140
141 tx_green {
142 label = "tx_green";
143 gpios = <&pioC 19 0>;
144 };
145
146 tx_red {
147 label = "tx_red";
148 gpios = <&pioC 18 0>;
149 };
150 };
151
152 gpio_keys {
153 compatible = "gpio-keys";
154 #address-cells = <1>;
155 #size-cells = <0>;
156
157 keyswitch_in {
158 label = "keyswitch_in";
159 gpios = <&pioB 1 0>;
160 linux,code = <28>;
161 gpio-key,wakeup;
162 };
163
164 error_in {
165 label = "error_in";
166 gpios = <&pioB 2 0>;
167 linux,code = <29>;
168 gpio-key,wakeup;
169 };
170
171 btn {
172 label = "btn";
173 gpios = <&pioC 23 0>;
174 linux,code = <31>;
175 gpio-key,wakeup;
176 };
177 };
178};
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
new file mode 100644
index 00000000000..e154f242c68
--- /dev/null
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -0,0 +1,349 @@
1/*
2 * at91rm9200.dtsi - Device Tree Include file for AT91RM9200 family SoC
3 *
4 * Copyright (C) 2011 Atmel,
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>,
6 * 2012 Joachim Eastwood <manabian@gmail.com>
7 *
8 * Based on at91sam9260.dtsi
9 *
10 * Licensed under GPLv2 or later.
11 */
12
13/include/ "skeleton.dtsi"
14
15/ {
16 model = "Atmel AT91RM9200 family SoC";
17 compatible = "atmel,at91rm9200";
18 interrupt-parent = <&aic>;
19
20 aliases {
21 serial0 = &dbgu;
22 serial1 = &usart0;
23 serial2 = &usart1;
24 serial3 = &usart2;
25 serial4 = &usart3;
26 gpio0 = &pioA;
27 gpio1 = &pioB;
28 gpio2 = &pioC;
29 gpio3 = &pioD;
30 tcb0 = &tcb0;
31 tcb1 = &tcb1;
32 };
33 cpus {
34 cpu@0 {
35 compatible = "arm,arm920t";
36 };
37 };
38
39 memory {
40 reg = <0x20000000 0x04000000>;
41 };
42
43 ahb {
44 compatible = "simple-bus";
45 #address-cells = <1>;
46 #size-cells = <1>;
47 ranges;
48
49 apb {
50 compatible = "simple-bus";
51 #address-cells = <1>;
52 #size-cells = <1>;
53 ranges;
54
55 aic: interrupt-controller@fffff000 {
56 #interrupt-cells = <3>;
57 compatible = "atmel,at91rm9200-aic";
58 interrupt-controller;
59 reg = <0xfffff000 0x200>;
60 atmel,external-irqs = <25 26 27 28 29 30 31>;
61 };
62
63 ramc0: ramc@ffffff00 {
64 compatible = "atmel,at91rm9200-sdramc";
65 reg = <0xffffff00 0x100>;
66 };
67
68 pmc: pmc@fffffc00 {
69 compatible = "atmel,at91rm9200-pmc";
70 reg = <0xfffffc00 0x100>;
71 };
72
73 st: timer@fffffd00 {
74 compatible = "atmel,at91rm9200-st";
75 reg = <0xfffffd00 0x100>;
76 interrupts = <1 4 7>;
77 };
78
79 tcb0: timer@fffa0000 {
80 compatible = "atmel,at91rm9200-tcb";
81 reg = <0xfffa0000 0x100>;
82 interrupts = <17 4 0 18 4 0 19 4 0>;
83 };
84
85 tcb1: timer@fffa4000 {
86 compatible = "atmel,at91rm9200-tcb";
87 reg = <0xfffa4000 0x100>;
88 interrupts = <20 4 0 21 4 0 22 4 0>;
89 };
90
91 pinctrl@fffff400 {
92 #address-cells = <1>;
93 #size-cells = <1>;
94 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
95 ranges = <0xfffff400 0xfffff400 0x800>;
96
97 atmel,mux-mask = <
98 /* A B */
99 0xffffffff 0xffffffff /* pioA */
100 0xffffffff 0x083fffff /* pioB */
101 0xffff3fff 0x00000000 /* pioC */
102 0x03ff87ff 0x0fffff80 /* pioD */
103 >;
104
105 /* shared pinctrl settings */
106 dbgu {
107 pinctrl_dbgu: dbgu-0 {
108 atmel,pins =
109 <0 30 0x1 0x0 /* PA30 periph A */
110 0 31 0x1 0x1>; /* PA31 periph with pullup */
111 };
112 };
113
114 uart0 {
115 pinctrl_uart0: uart0-0 {
116 atmel,pins =
117 <0 17 0x1 0x0 /* PA17 periph A */
118 0 18 0x1 0x0>; /* PA18 periph A */
119 };
120
121 pinctrl_uart0_rts: uart0_rts-0 {
122 atmel,pins =
123 <0 20 0x1 0x0>; /* PA20 periph A */
124 };
125
126 pinctrl_uart0_cts: uart0_cts-0 {
127 atmel,pins =
128 <0 21 0x1 0x0>; /* PA21 periph A */
129 };
130 };
131
132 uart1 {
133 pinctrl_uart1: uart1-0 {
134 atmel,pins =
135 <1 20 0x1 0x1 /* PB20 periph A with pullup */
136 1 21 0x1 0x0>; /* PB21 periph A */
137 };
138
139 pinctrl_uart1_rts: uart1_rts-0 {
140 atmel,pins =
141 <1 24 0x1 0x0>; /* PB24 periph A */
142 };
143
144 pinctrl_uart1_cts: uart1_cts-0 {
145 atmel,pins =
146 <1 26 0x1 0x0>; /* PB26 periph A */
147 };
148
149 pinctrl_uart1_dtr_dsr: uart1_dtr_dsr-0 {
150 atmel,pins =
151 <1 19 0x1 0x0 /* PB19 periph A */
152 1 25 0x1 0x0>; /* PB25 periph A */
153 };
154
155 pinctrl_uart1_dcd: uart1_dcd-0 {
156 atmel,pins =
157 <1 23 0x1 0x0>; /* PB23 periph A */
158 };
159
160 pinctrl_uart1_ri: uart1_ri-0 {
161 atmel,pins =
162 <1 18 0x1 0x0>; /* PB18 periph A */
163 };
164 };
165
166 uart2 {
167 pinctrl_uart2: uart2-0 {
168 atmel,pins =
169 <0 22 0x1 0x0 /* PA22 periph A */
170 0 23 0x1 0x1>; /* PA23 periph A with pullup */
171 };
172
173 pinctrl_uart2_rts: uart2_rts-0 {
174 atmel,pins =
175 <0 30 0x2 0x0>; /* PA30 periph B */
176 };
177
178 pinctrl_uart2_cts: uart2_cts-0 {
179 atmel,pins =
180 <0 31 0x2 0x0>; /* PA31 periph B */
181 };
182 };
183
184 uart3 {
185 pinctrl_uart3: uart3-0 {
186 atmel,pins =
187 <0 5 0x2 0x1 /* PA5 periph B with pullup */
188 0 6 0x2 0x0>; /* PA6 periph B */
189 };
190
191 pinctrl_uart3_rts: uart3_rts-0 {
192 atmel,pins =
193 <1 0 0x2 0x0>; /* PB0 periph B */
194 };
195
196 pinctrl_uart3_cts: uart3_cts-0 {
197 atmel,pins =
198 <1 1 0x2 0x0>; /* PB1 periph B */
199 };
200 };
201
202 nand {
203 pinctrl_nand: nand-0 {
204 atmel,pins =
205 <2 2 0x0 0x1 /* PC2 gpio RDY pin pull_up */
206 1 1 0x0 0x1>; /* PB1 gpio CD pin pull_up */
207 };
208 };
209
210 pioA: gpio@fffff400 {
211 compatible = "atmel,at91rm9200-gpio";
212 reg = <0xfffff400 0x200>;
213 interrupts = <2 4 1>;
214 #gpio-cells = <2>;
215 gpio-controller;
216 interrupt-controller;
217 #interrupt-cells = <2>;
218 };
219
220 pioB: gpio@fffff600 {
221 compatible = "atmel,at91rm9200-gpio";
222 reg = <0xfffff600 0x200>;
223 interrupts = <3 4 1>;
224 #gpio-cells = <2>;
225 gpio-controller;
226 interrupt-controller;
227 #interrupt-cells = <2>;
228 };
229
230 pioC: gpio@fffff800 {
231 compatible = "atmel,at91rm9200-gpio";
232 reg = <0xfffff800 0x200>;
233 interrupts = <4 4 1>;
234 #gpio-cells = <2>;
235 gpio-controller;
236 interrupt-controller;
237 #interrupt-cells = <2>;
238 };
239
240 pioD: gpio@fffffa00 {
241 compatible = "atmel,at91rm9200-gpio";
242 reg = <0xfffffa00 0x200>;
243 interrupts = <5 4 1>;
244 #gpio-cells = <2>;
245 gpio-controller;
246 interrupt-controller;
247 #interrupt-cells = <2>;
248 };
249 };
250
251 dbgu: serial@fffff200 {
252 compatible = "atmel,at91rm9200-usart";
253 reg = <0xfffff200 0x200>;
254 interrupts = <1 4 7>;
255 pinctrl-names = "default";
256 pinctrl-0 = <&pinctrl_dbgu>;
257 status = "disabled";
258 };
259
260 usart0: serial@fffc0000 {
261 compatible = "atmel,at91rm9200-usart";
262 reg = <0xfffc0000 0x200>;
263 interrupts = <6 4 5>;
264 atmel,use-dma-rx;
265 atmel,use-dma-tx;
266 pinctrl-names = "default";
267 pinctrl-0 = <&pinctrl_uart0>;
268 status = "disabled";
269 };
270
271 usart1: serial@fffc4000 {
272 compatible = "atmel,at91rm9200-usart";
273 reg = <0xfffc4000 0x200>;
274 interrupts = <7 4 5>;
275 atmel,use-dma-rx;
276 atmel,use-dma-tx;
277 pinctrl-names = "default";
278 pinctrl-0 = <&pinctrl_uart1>;
279 status = "disabled";
280 };
281
282 usart2: serial@fffc8000 {
283 compatible = "atmel,at91rm9200-usart";
284 reg = <0xfffc8000 0x200>;
285 interrupts = <8 4 5>;
286 atmel,use-dma-rx;
287 atmel,use-dma-tx;
288 pinctrl-names = "default";
289 pinctrl-0 = <&pinctrl_uart2>;
290 status = "disabled";
291 };
292
293 usart3: serial@fffcc000 {
294 compatible = "atmel,at91rm9200-usart";
295 reg = <0xfffcc000 0x200>;
296 interrupts = <23 4 5>;
297 atmel,use-dma-rx;
298 atmel,use-dma-tx;
299 pinctrl-names = "default";
300 pinctrl-0 = <&pinctrl_uart3>;
301 status = "disabled";
302 };
303
304 usb1: gadget@fffb0000 {
305 compatible = "atmel,at91rm9200-udc";
306 reg = <0xfffb0000 0x4000>;
307 interrupts = <11 4 2>;
308 status = "disabled";
309 };
310 };
311
312 nand0: nand@40000000 {
313 compatible = "atmel,at91rm9200-nand";
314 #address-cells = <1>;
315 #size-cells = <1>;
316 reg = <0x40000000 0x10000000>;
317 atmel,nand-addr-offset = <21>;
318 atmel,nand-cmd-offset = <22>;
319 pinctrl-names = "default";
320 pinctrl-0 = <&pinctrl_nand>;
321 nand-ecc-mode = "soft";
322 gpios = <&pioC 2 0
323 0
324 &pioB 1 0
325 >;
326 status = "disabled";
327 };
328
329 usb0: ohci@00300000 {
330 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
331 reg = <0x00300000 0x100000>;
332 interrupts = <23 4 2>;
333 status = "disabled";
334 };
335 };
336
337 i2c@0 {
338 compatible = "i2c-gpio";
339 gpios = <&pioA 23 0 /* sda */
340 &pioA 24 0 /* scl */
341 >;
342 i2c-gpio,sda-open-drain;
343 i2c-gpio,scl-open-drain;
344 i2c-gpio,delay-us = <2>; /* ~100 kHz */
345 #address-cells = <1>;
346 #size-cells = <0>;
347 status = "disabled";
348 };
349};
diff --git a/arch/arm/boot/dts/at91rm9200ek.dts b/arch/arm/boot/dts/at91rm9200ek.dts
new file mode 100644
index 00000000000..8aa48931e0a
--- /dev/null
+++ b/arch/arm/boot/dts/at91rm9200ek.dts
@@ -0,0 +1,79 @@
1/*
2 * at91rm9200ek.dts - Device Tree file for Atmel AT91RM9200 evaluation kit
3 *
4 * Copyright (C) 2012 Joachim Eastwood <manabian@gmail.com>
5 *
6 * Licensed under GPLv2 only
7 */
8/dts-v1/;
9/include/ "at91rm9200.dtsi"
10
11/ {
12 model = "Atmel AT91RM9200 evaluation kit";
13 compatible = "atmel,at91rm9200ek", "atmel,at91rm9200";
14
15 memory {
16 reg = <0x20000000 0x4000000>;
17 };
18
19 clocks {
20 #address-cells = <1>;
21 #size-cells = <1>;
22 ranges;
23
24 main_clock: clock@0 {
25 compatible = "atmel,osc", "fixed-clock";
26 clock-frequency = <18432000>;
27 };
28 };
29
30 ahb {
31 apb {
32 dbgu: serial@fffff200 {
33 status = "okay";
34 };
35
36 usart1: serial@fffc4000 {
37 pinctrl-0 =
38 <&pinctrl_uart1
39 &pinctrl_uart1_rts
40 &pinctrl_uart1_cts
41 &pinctrl_uart1_dtr_dsr
42 &pinctrl_uart1_dcd
43 &pinctrl_uart1_ri>;
44 status = "okay";
45 };
46
47 usb1: gadget@fffb0000 {
48 atmel,vbus-gpio = <&pioD 4 0>;
49 status = "okay";
50 };
51 };
52
53 usb0: ohci@00300000 {
54 num-ports = <2>;
55 status = "okay";
56 };
57 };
58
59 leds {
60 compatible = "gpio-leds";
61
62 ds2 {
63 label = "green";
64 gpios = <&pioB 0 0x1>;
65 linux,default-trigger = "mmc0";
66 };
67
68 ds4 {
69 label = "yellow";
70 gpios = <&pioB 1 0x1>;
71 linux,default-trigger = "heartbeat";
72 };
73
74 ds6 {
75 label = "red";
76 gpios = <&pioB 2 0x1>;
77 };
78 };
79};
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index d410581a5a8..68bccf41a2c 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -21,14 +21,15 @@
21 serial2 = &usart1; 21 serial2 = &usart1;
22 serial3 = &usart2; 22 serial3 = &usart2;
23 serial4 = &usart3; 23 serial4 = &usart3;
24 serial5 = &usart4; 24 serial5 = &uart0;
25 serial6 = &usart5; 25 serial6 = &uart1;
26 gpio0 = &pioA; 26 gpio0 = &pioA;
27 gpio1 = &pioB; 27 gpio1 = &pioB;
28 gpio2 = &pioC; 28 gpio2 = &pioC;
29 tcb0 = &tcb0; 29 tcb0 = &tcb0;
30 tcb1 = &tcb1; 30 tcb1 = &tcb1;
31 i2c0 = &i2c0; 31 i2c0 = &i2c0;
32 ssc0 = &ssc0;
32 }; 33 };
33 cpus { 34 cpus {
34 cpu@0 { 35 cpu@0 {
@@ -98,40 +99,250 @@
98 interrupts = <26 4 0 27 4 0 28 4 0>; 99 interrupts = <26 4 0 27 4 0 28 4 0>;
99 }; 100 };
100 101
101 pioA: gpio@fffff400 { 102 pinctrl@fffff400 {
102 compatible = "atmel,at91rm9200-gpio"; 103 #address-cells = <1>;
103 reg = <0xfffff400 0x100>; 104 #size-cells = <1>;
104 interrupts = <2 4 1>; 105 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
105 #gpio-cells = <2>; 106 ranges = <0xfffff400 0xfffff400 0x600>;
106 gpio-controller; 107
107 interrupt-controller; 108 atmel,mux-mask = <
108 #interrupt-cells = <2>; 109 /* A B */
109 }; 110 0xffffffff 0xffc00c3b /* pioA */
111 0xffffffff 0x7fff3ccf /* pioB */
112 0xffffffff 0x007fffff /* pioC */
113 >;
114
115 /* shared pinctrl settings */
116 dbgu {
117 pinctrl_dbgu: dbgu-0 {
118 atmel,pins =
119 <1 14 0x1 0x0 /* PB14 periph A */
120 1 15 0x1 0x1>; /* PB15 periph with pullup */
121 };
122 };
110 123
111 pioB: gpio@fffff600 { 124 usart0 {
112 compatible = "atmel,at91rm9200-gpio"; 125 pinctrl_usart0: usart0-0 {
113 reg = <0xfffff600 0x100>; 126 atmel,pins =
114 interrupts = <3 4 1>; 127 <1 4 0x1 0x0 /* PB4 periph A */
115 #gpio-cells = <2>; 128 1 5 0x1 0x0>; /* PB5 periph A */
116 gpio-controller; 129 };
117 interrupt-controller; 130
118 #interrupt-cells = <2>; 131 pinctrl_usart0_rts: usart0_rts-0 {
119 }; 132 atmel,pins =
133 <1 26 0x1 0x0>; /* PB26 periph A */
134 };
135
136 pinctrl_usart0_cts: usart0_cts-0 {
137 atmel,pins =
138 <1 27 0x1 0x0>; /* PB27 periph A */
139 };
140
141 pinctrl_usart0_dtr_dsr: usart0_dtr_dsr-0 {
142 atmel,pins =
143 <1 24 0x1 0x0 /* PB24 periph A */
144 1 22 0x1 0x0>; /* PB22 periph A */
145 };
146
147 pinctrl_usart0_dcd: usart0_dcd-0 {
148 atmel,pins =
149 <1 23 0x1 0x0>; /* PB23 periph A */
150 };
151
152 pinctrl_usart0_ri: usart0_ri-0 {
153 atmel,pins =
154 <1 25 0x1 0x0>; /* PB25 periph A */
155 };
156 };
120 157
121 pioC: gpio@fffff800 { 158 usart1 {
122 compatible = "atmel,at91rm9200-gpio"; 159 pinctrl_usart1: usart1-0 {
123 reg = <0xfffff800 0x100>; 160 atmel,pins =
124 interrupts = <4 4 1>; 161 <2 6 0x1 0x1 /* PB6 periph A with pullup */
125 #gpio-cells = <2>; 162 2 7 0x1 0x0>; /* PB7 periph A */
126 gpio-controller; 163 };
127 interrupt-controller; 164
128 #interrupt-cells = <2>; 165 pinctrl_usart1_rts: usart1_rts-0 {
166 atmel,pins =
167 <1 28 0x1 0x0>; /* PB28 periph A */
168 };
169
170 pinctrl_usart1_cts: usart1_cts-0 {
171 atmel,pins =
172 <1 29 0x1 0x0>; /* PB29 periph A */
173 };
174 };
175
176 usart2 {
177 pinctrl_usart2: usart2-0 {
178 atmel,pins =
179 <1 8 0x1 0x1 /* PB8 periph A with pullup */
180 1 9 0x1 0x0>; /* PB9 periph A */
181 };
182
183 pinctrl_usart2_rts: usart2_rts-0 {
184 atmel,pins =
185 <0 4 0x1 0x0>; /* PA4 periph A */
186 };
187
188 pinctrl_usart2_cts: usart2_cts-0 {
189 atmel,pins =
190 <0 5 0x1 0x0>; /* PA5 periph A */
191 };
192 };
193
194 usart3 {
195 pinctrl_usart3: usart3-0 {
196 atmel,pins =
197 <2 10 0x1 0x1 /* PB10 periph A with pullup */
198 2 11 0x1 0x0>; /* PB11 periph A */
199 };
200
201 pinctrl_usart3_rts: usart3_rts-0 {
202 atmel,pins =
203 <3 8 0x2 0x0>; /* PB8 periph B */
204 };
205
206 pinctrl_usart3_cts: usart3_cts-0 {
207 atmel,pins =
208 <3 10 0x2 0x0>; /* PB10 periph B */
209 };
210 };
211
212 uart0 {
213 pinctrl_uart0: uart0-0 {
214 atmel,pins =
215 <0 31 0x2 0x1 /* PA31 periph B with pullup */
216 0 30 0x2 0x0>; /* PA30 periph B */
217 };
218 };
219
220 uart1 {
221 pinctrl_uart1: uart1-0 {
222 atmel,pins =
223 <2 12 0x1 0x1 /* PB12 periph A with pullup */
224 2 13 0x1 0x0>; /* PB13 periph A */
225 };
226 };
227
228 nand {
229 pinctrl_nand: nand-0 {
230 atmel,pins =
231 <2 13 0x0 0x1 /* PC13 gpio RDY pin pull_up */
232 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */
233 };
234 };
235
236 macb {
237 pinctrl_macb_rmii: macb_rmii-0 {
238 atmel,pins =
239 <0 12 0x1 0x0 /* PA12 periph A */
240 0 13 0x1 0x0 /* PA13 periph A */
241 0 14 0x1 0x0 /* PA14 periph A */
242 0 15 0x1 0x0 /* PA15 periph A */
243 0 16 0x1 0x0 /* PA16 periph A */
244 0 17 0x1 0x0 /* PA17 periph A */
245 0 18 0x1 0x0 /* PA18 periph A */
246 0 19 0x1 0x0 /* PA19 periph A */
247 0 20 0x1 0x0 /* PA20 periph A */
248 0 21 0x1 0x0>; /* PA21 periph A */
249 };
250
251 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
252 atmel,pins =
253 <0 22 0x2 0x0 /* PA22 periph B */
254 0 23 0x2 0x0 /* PA23 periph B */
255 0 24 0x2 0x0 /* PA24 periph B */
256 0 25 0x2 0x0 /* PA25 periph B */
257 0 26 0x2 0x0 /* PA26 periph B */
258 0 27 0x2 0x0 /* PA27 periph B */
259 0 28 0x2 0x0 /* PA28 periph B */
260 0 29 0x2 0x0>; /* PA29 periph B */
261 };
262
263 pinctrl_macb_rmii_mii_alt: macb_rmii_mii-1 {
264 atmel,pins =
265 <0 10 0x2 0x0 /* PA10 periph B */
266 0 11 0x2 0x0 /* PA11 periph B */
267 0 24 0x2 0x0 /* PA24 periph B */
268 0 25 0x2 0x0 /* PA25 periph B */
269 0 26 0x2 0x0 /* PA26 periph B */
270 0 27 0x2 0x0 /* PA27 periph B */
271 0 28 0x2 0x0 /* PA28 periph B */
272 0 29 0x2 0x0>; /* PA29 periph B */
273 };
274 };
275
276 mmc0 {
277 pinctrl_mmc0_clk: mmc0_clk-0 {
278 atmel,pins =
279 <0 8 0x1 0x0>; /* PA8 periph A */
280 };
281
282 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 {
283 atmel,pins =
284 <0 7 0x1 0x1 /* PA7 periph A with pullup */
285 0 6 0x1 0x1>; /* PA6 periph A with pullup */
286 };
287
288 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
289 atmel,pins =
290 <0 9 0x1 0x1 /* PA9 periph A with pullup */
291 0 10 0x1 0x1 /* PA10 periph A with pullup */
292 0 11 0x1 0x1>; /* PA11 periph A with pullup */
293 };
294
295 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 {
296 atmel,pins =
297 <0 1 0x2 0x1 /* PA1 periph B with pullup */
298 0 0 0x2 0x1>; /* PA0 periph B with pullup */
299 };
300
301 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 {
302 atmel,pins =
303 <0 5 0x2 0x1 /* PA5 periph B with pullup */
304 0 4 0x2 0x1 /* PA4 periph B with pullup */
305 0 3 0x2 0x1>; /* PA3 periph B with pullup */
306 };
307 };
308
309 pioA: gpio@fffff400 {
310 compatible = "atmel,at91rm9200-gpio";
311 reg = <0xfffff400 0x200>;
312 interrupts = <2 4 1>;
313 #gpio-cells = <2>;
314 gpio-controller;
315 interrupt-controller;
316 #interrupt-cells = <2>;
317 };
318
319 pioB: gpio@fffff600 {
320 compatible = "atmel,at91rm9200-gpio";
321 reg = <0xfffff600 0x200>;
322 interrupts = <3 4 1>;
323 #gpio-cells = <2>;
324 gpio-controller;
325 interrupt-controller;
326 #interrupt-cells = <2>;
327 };
328
329 pioC: gpio@fffff800 {
330 compatible = "atmel,at91rm9200-gpio";
331 reg = <0xfffff800 0x200>;
332 interrupts = <4 4 1>;
333 #gpio-cells = <2>;
334 gpio-controller;
335 interrupt-controller;
336 #interrupt-cells = <2>;
337 };
129 }; 338 };
130 339
131 dbgu: serial@fffff200 { 340 dbgu: serial@fffff200 {
132 compatible = "atmel,at91sam9260-usart"; 341 compatible = "atmel,at91sam9260-usart";
133 reg = <0xfffff200 0x200>; 342 reg = <0xfffff200 0x200>;
134 interrupts = <1 4 7>; 343 interrupts = <1 4 7>;
344 pinctrl-names = "default";
345 pinctrl-0 = <&pinctrl_dbgu>;
135 status = "disabled"; 346 status = "disabled";
136 }; 347 };
137 348
@@ -141,6 +352,8 @@
141 interrupts = <6 4 5>; 352 interrupts = <6 4 5>;
142 atmel,use-dma-rx; 353 atmel,use-dma-rx;
143 atmel,use-dma-tx; 354 atmel,use-dma-tx;
355 pinctrl-names = "default";
356 pinctrl-0 = <&pinctrl_usart0>;
144 status = "disabled"; 357 status = "disabled";
145 }; 358 };
146 359
@@ -150,6 +363,8 @@
150 interrupts = <7 4 5>; 363 interrupts = <7 4 5>;
151 atmel,use-dma-rx; 364 atmel,use-dma-rx;
152 atmel,use-dma-tx; 365 atmel,use-dma-tx;
366 pinctrl-names = "default";
367 pinctrl-0 = <&pinctrl_usart1>;
153 status = "disabled"; 368 status = "disabled";
154 }; 369 };
155 370
@@ -159,6 +374,8 @@
159 interrupts = <8 4 5>; 374 interrupts = <8 4 5>;
160 atmel,use-dma-rx; 375 atmel,use-dma-rx;
161 atmel,use-dma-tx; 376 atmel,use-dma-tx;
377 pinctrl-names = "default";
378 pinctrl-0 = <&pinctrl_usart2>;
162 status = "disabled"; 379 status = "disabled";
163 }; 380 };
164 381
@@ -168,24 +385,30 @@
168 interrupts = <23 4 5>; 385 interrupts = <23 4 5>;
169 atmel,use-dma-rx; 386 atmel,use-dma-rx;
170 atmel,use-dma-tx; 387 atmel,use-dma-tx;
388 pinctrl-names = "default";
389 pinctrl-0 = <&pinctrl_usart3>;
171 status = "disabled"; 390 status = "disabled";
172 }; 391 };
173 392
174 usart4: serial@fffd4000 { 393 uart0: serial@fffd4000 {
175 compatible = "atmel,at91sam9260-usart"; 394 compatible = "atmel,at91sam9260-usart";
176 reg = <0xfffd4000 0x200>; 395 reg = <0xfffd4000 0x200>;
177 interrupts = <24 4 5>; 396 interrupts = <24 4 5>;
178 atmel,use-dma-rx; 397 atmel,use-dma-rx;
179 atmel,use-dma-tx; 398 atmel,use-dma-tx;
399 pinctrl-names = "default";
400 pinctrl-0 = <&pinctrl_uart0>;
180 status = "disabled"; 401 status = "disabled";
181 }; 402 };
182 403
183 usart5: serial@fffd8000 { 404 uart1: serial@fffd8000 {
184 compatible = "atmel,at91sam9260-usart"; 405 compatible = "atmel,at91sam9260-usart";
185 reg = <0xfffd8000 0x200>; 406 reg = <0xfffd8000 0x200>;
186 interrupts = <25 4 5>; 407 interrupts = <25 4 5>;
187 atmel,use-dma-rx; 408 atmel,use-dma-rx;
188 atmel,use-dma-tx; 409 atmel,use-dma-tx;
410 pinctrl-names = "default";
411 pinctrl-0 = <&pinctrl_uart1>;
189 status = "disabled"; 412 status = "disabled";
190 }; 413 };
191 414
@@ -193,6 +416,8 @@
193 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 416 compatible = "cdns,at32ap7000-macb", "cdns,macb";
194 reg = <0xfffc4000 0x100>; 417 reg = <0xfffc4000 0x100>;
195 interrupts = <21 4 3>; 418 interrupts = <21 4 3>;
419 pinctrl-names = "default";
420 pinctrl-0 = <&pinctrl_macb_rmii>;
196 status = "disabled"; 421 status = "disabled";
197 }; 422 };
198 423
@@ -212,6 +437,22 @@
212 status = "disabled"; 437 status = "disabled";
213 }; 438 };
214 439
440 mmc0: mmc@fffa8000 {
441 compatible = "atmel,hsmci";
442 reg = <0xfffa8000 0x600>;
443 interrupts = <9 4 0>;
444 #address-cells = <1>;
445 #size-cells = <0>;
446 status = "disabled";
447 };
448
449 ssc0: ssc@fffbc000 {
450 compatible = "atmel,at91rm9200-ssc";
451 reg = <0xfffbc000 0x4000>;
452 interrupts = <14 4 5>;
453 status = "disabled";
454 };
455
215 adc0: adc@fffe0000 { 456 adc0: adc@fffe0000 {
216 compatible = "atmel,at91sam9260-adc"; 457 compatible = "atmel,at91sam9260-adc";
217 reg = <0xfffe0000 0x100>; 458 reg = <0xfffe0000 0x100>;
@@ -246,6 +487,12 @@
246 trigger-external; 487 trigger-external;
247 }; 488 };
248 }; 489 };
490
491 watchdog@fffffd40 {
492 compatible = "atmel,at91sam9260-wdt";
493 reg = <0xfffffd40 0x10>;
494 status = "disabled";
495 };
249 }; 496 };
250 497
251 nand0: nand@40000000 { 498 nand0: nand@40000000 {
@@ -257,6 +504,8 @@
257 >; 504 >;
258 atmel,nand-addr-offset = <21>; 505 atmel,nand-addr-offset = <21>;
259 atmel,nand-cmd-offset = <22>; 506 atmel,nand-cmd-offset = <22>;
507 pinctrl-names = "default";
508 pinctrl-0 = <&pinctrl_nand>;
260 gpios = <&pioC 13 0 509 gpios = <&pioC 13 0
261 &pioC 14 0 510 &pioC 14 0
262 0 511 0
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 3e6e5c1abbf..8e6251f1f7a 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -25,6 +25,8 @@
25 gpio4 = &pioE; 25 gpio4 = &pioE;
26 tcb0 = &tcb0; 26 tcb0 = &tcb0;
27 i2c0 = &i2c0; 27 i2c0 = &i2c0;
28 ssc0 = &ssc0;
29 ssc1 = &ssc1;
28 }; 30 };
29 cpus { 31 cpus {
30 cpu@0 { 32 cpu@0 {
@@ -89,60 +91,243 @@
89 reg = <0xfffffd10 0x10>; 91 reg = <0xfffffd10 0x10>;
90 }; 92 };
91 93
92 pioA: gpio@fffff200 { 94 pinctrl@fffff200 {
93 compatible = "atmel,at91rm9200-gpio"; 95 #address-cells = <1>;
94 reg = <0xfffff200 0x100>; 96 #size-cells = <1>;
95 interrupts = <2 4 1>; 97 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
96 #gpio-cells = <2>; 98 ranges = <0xfffff200 0xfffff200 0xa00>;
97 gpio-controller;
98 interrupt-controller;
99 #interrupt-cells = <2>;
100 };
101 99
102 pioB: gpio@fffff400 { 100 atmel,mux-mask = <
103 compatible = "atmel,at91rm9200-gpio"; 101 /* A B */
104 reg = <0xfffff400 0x100>; 102 0xfffffffb 0xffffe07f /* pioA */
105 interrupts = <3 4 1>; 103 0x0007ffff 0x39072fff /* pioB */
106 #gpio-cells = <2>; 104 0xffffffff 0x3ffffff8 /* pioC */
107 gpio-controller; 105 0xfffffbff 0xffffffff /* pioD */
108 interrupt-controller; 106 0xffe00fff 0xfbfcff00 /* pioE */
109 #interrupt-cells = <2>; 107 >;
110 };
111 108
112 pioC: gpio@fffff600 { 109 /* shared pinctrl settings */
113 compatible = "atmel,at91rm9200-gpio"; 110 dbgu {
114 reg = <0xfffff600 0x100>; 111 pinctrl_dbgu: dbgu-0 {
115 interrupts = <4 4 1>; 112 atmel,pins =
116 #gpio-cells = <2>; 113 <2 30 0x1 0x0 /* PC30 periph A */
117 gpio-controller; 114 2 31 0x1 0x1>; /* PC31 periph with pullup */
118 interrupt-controller; 115 };
119 #interrupt-cells = <2>; 116 };
120 };
121 117
122 pioD: gpio@fffff800 { 118 usart0 {
123 compatible = "atmel,at91rm9200-gpio"; 119 pinctrl_usart0: usart0-0 {
124 reg = <0xfffff800 0x100>; 120 atmel,pins =
125 interrupts = <4 4 1>; 121 <0 26 0x1 0x1 /* PA26 periph A with pullup */
126 #gpio-cells = <2>; 122 0 27 0x1 0x0>; /* PA27 periph A */
127 gpio-controller; 123 };
128 interrupt-controller;
129 #interrupt-cells = <2>;
130 };
131 124
132 pioE: gpio@fffffa00 { 125 pinctrl_usart0_rts: usart0_rts-0 {
133 compatible = "atmel,at91rm9200-gpio"; 126 atmel,pins =
134 reg = <0xfffffa00 0x100>; 127 <0 28 0x1 0x0>; /* PA28 periph A */
135 interrupts = <4 4 1>; 128 };
136 #gpio-cells = <2>; 129
137 gpio-controller; 130 pinctrl_usart0_cts: usart0_cts-0 {
138 interrupt-controller; 131 atmel,pins =
139 #interrupt-cells = <2>; 132 <0 29 0x1 0x0>; /* PA29 periph A */
133 };
134 };
135
136 usart1 {
137 pinctrl_usart1: usart1-0 {
138 atmel,pins =
139 <3 0 0x1 0x1 /* PD0 periph A with pullup */
140 3 1 0x1 0x0>; /* PD1 periph A */
141 };
142
143 pinctrl_usart1_rts: usart1_rts-0 {
144 atmel,pins =
145 <3 7 0x2 0x0>; /* PD7 periph B */
146 };
147
148 pinctrl_usart1_cts: usart1_cts-0 {
149 atmel,pins =
150 <3 8 0x2 0x0>; /* PD8 periph B */
151 };
152 };
153
154 usart2 {
155 pinctrl_usart2: usart2-0 {
156 atmel,pins =
157 <3 2 0x1 0x1 /* PD2 periph A with pullup */
158 3 3 0x1 0x0>; /* PD3 periph A */
159 };
160
161 pinctrl_usart2_rts: usart2_rts-0 {
162 atmel,pins =
163 <3 5 0x2 0x0>; /* PD5 periph B */
164 };
165
166 pinctrl_usart2_cts: usart2_cts-0 {
167 atmel,pins =
168 <4 6 0x2 0x0>; /* PD6 periph B */
169 };
170 };
171
172 nand {
173 pinctrl_nand: nand-0 {
174 atmel,pins =
175 <0 22 0x0 0x1 /* PA22 gpio RDY pin pull_up*/
176 3 15 0x0 0x1>; /* PD15 gpio enable pin pull_up */
177 };
178 };
179
180 macb {
181 pinctrl_macb_rmii: macb_rmii-0 {
182 atmel,pins =
183 <2 25 0x2 0x0 /* PC25 periph B */
184 4 21 0x1 0x0 /* PE21 periph A */
185 4 23 0x1 0x0 /* PE23 periph A */
186 4 24 0x1 0x0 /* PE24 periph A */
187 4 25 0x1 0x0 /* PE25 periph A */
188 4 26 0x1 0x0 /* PE26 periph A */
189 4 27 0x1 0x0 /* PE27 periph A */
190 4 28 0x1 0x0 /* PE28 periph A */
191 4 29 0x1 0x0 /* PE29 periph A */
192 4 30 0x1 0x0>; /* PE30 periph A */
193 };
194
195 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
196 atmel,pins =
197 <2 20 0x2 0x0 /* PC20 periph B */
198 2 21 0x2 0x0 /* PC21 periph B */
199 2 22 0x2 0x0 /* PC22 periph B */
200 2 23 0x2 0x0 /* PC23 periph B */
201 2 24 0x2 0x0 /* PC24 periph B */
202 2 25 0x2 0x0 /* PC25 periph B */
203 2 27 0x2 0x0 /* PC27 periph B */
204 4 22 0x2 0x0>; /* PE22 periph B */
205 };
206 };
207
208 mmc0 {
209 pinctrl_mmc0_clk: mmc0_clk-0 {
210 atmel,pins =
211 <0 12 0x1 0x0>; /* PA12 periph A */
212 };
213
214 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 {
215 atmel,pins =
216 <0 1 0x1 0x1 /* PA1 periph A with pullup */
217 0 0 0x1 0x1>; /* PA0 periph A with pullup */
218 };
219
220 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
221 atmel,pins =
222 <0 3 0x1 0x1 /* PA3 periph A with pullup */
223 0 4 0x1 0x1 /* PA4 periph A with pullup */
224 0 5 0x1 0x1>; /* PA5 periph A with pullup */
225 };
226
227 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 {
228 atmel,pins =
229 <0 16 0x1 0x1 /* PA16 periph A with pullup */
230 0 17 0x1 0x1>; /* PA17 periph A with pullup */
231 };
232
233 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 {
234 atmel,pins =
235 <0 18 0x1 0x1 /* PA18 periph A with pullup */
236 0 19 0x1 0x1 /* PA19 periph A with pullup */
237 0 20 0x1 0x1>; /* PA20 periph A with pullup */
238 };
239 };
240
241 mmc1 {
242 pinctrl_mmc1_clk: mmc1_clk-0 {
243 atmel,pins =
244 <0 6 0x1 0x0>; /* PA6 periph A */
245 };
246
247 pinctrl_mmc1_slot0_cmd_dat0: mmc1_slot0_cmd_dat0-0 {
248 atmel,pins =
249 <0 7 0x1 0x1 /* PA7 periph A with pullup */
250 0 8 0x1 0x1>; /* PA8 periph A with pullup */
251 };
252
253 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
254 atmel,pins =
255 <0 9 0x1 0x1 /* PA9 periph A with pullup */
256 0 10 0x1 0x1 /* PA10 periph A with pullup */
257 0 11 0x1 0x1>; /* PA11 periph A with pullup */
258 };
259
260 pinctrl_mmc1_slot1_cmd_dat0: mmc1_slot1_cmd_dat0-0 {
261 atmel,pins =
262 <0 21 0x1 0x1 /* PA21 periph A with pullup */
263 0 22 0x1 0x1>; /* PA22 periph A with pullup */
264 };
265
266 pinctrl_mmc1_slot1_dat1_3: mmc1_slot1_dat1_3-0 {
267 atmel,pins =
268 <0 23 0x1 0x1 /* PA23 periph A with pullup */
269 0 24 0x1 0x1 /* PA24 periph A with pullup */
270 0 25 0x1 0x1>; /* PA25 periph A with pullup */
271 };
272 };
273
274 pioA: gpio@fffff200 {
275 compatible = "atmel,at91rm9200-gpio";
276 reg = <0xfffff200 0x200>;
277 interrupts = <2 4 1>;
278 #gpio-cells = <2>;
279 gpio-controller;
280 interrupt-controller;
281 #interrupt-cells = <2>;
282 };
283
284 pioB: gpio@fffff400 {
285 compatible = "atmel,at91rm9200-gpio";
286 reg = <0xfffff400 0x200>;
287 interrupts = <3 4 1>;
288 #gpio-cells = <2>;
289 gpio-controller;
290 interrupt-controller;
291 #interrupt-cells = <2>;
292 };
293
294 pioC: gpio@fffff600 {
295 compatible = "atmel,at91rm9200-gpio";
296 reg = <0xfffff600 0x200>;
297 interrupts = <4 4 1>;
298 #gpio-cells = <2>;
299 gpio-controller;
300 interrupt-controller;
301 #interrupt-cells = <2>;
302 };
303
304 pioD: gpio@fffff800 {
305 compatible = "atmel,at91rm9200-gpio";
306 reg = <0xfffff800 0x200>;
307 interrupts = <4 4 1>;
308 #gpio-cells = <2>;
309 gpio-controller;
310 interrupt-controller;
311 #interrupt-cells = <2>;
312 };
313
314 pioE: gpio@fffffa00 {
315 compatible = "atmel,at91rm9200-gpio";
316 reg = <0xfffffa00 0x200>;
317 interrupts = <4 4 1>;
318 #gpio-cells = <2>;
319 gpio-controller;
320 interrupt-controller;
321 #interrupt-cells = <2>;
322 };
140 }; 323 };
141 324
142 dbgu: serial@ffffee00 { 325 dbgu: serial@ffffee00 {
143 compatible = "atmel,at91sam9260-usart"; 326 compatible = "atmel,at91sam9260-usart";
144 reg = <0xffffee00 0x200>; 327 reg = <0xffffee00 0x200>;
145 interrupts = <1 4 7>; 328 interrupts = <1 4 7>;
329 pinctrl-names = "default";
330 pinctrl-0 = <&pinctrl_dbgu>;
146 status = "disabled"; 331 status = "disabled";
147 }; 332 };
148 333
@@ -152,6 +337,8 @@
152 interrupts = <7 4 5>; 337 interrupts = <7 4 5>;
153 atmel,use-dma-rx; 338 atmel,use-dma-rx;
154 atmel,use-dma-tx; 339 atmel,use-dma-tx;
340 pinctrl-names = "default";
341 pinctrl-0 = <&pinctrl_usart0>;
155 status = "disabled"; 342 status = "disabled";
156 }; 343 };
157 344
@@ -161,6 +348,8 @@
161 interrupts = <8 4 5>; 348 interrupts = <8 4 5>;
162 atmel,use-dma-rx; 349 atmel,use-dma-rx;
163 atmel,use-dma-tx; 350 atmel,use-dma-tx;
351 pinctrl-names = "default";
352 pinctrl-0 = <&pinctrl_usart1>;
164 status = "disabled"; 353 status = "disabled";
165 }; 354 };
166 355
@@ -170,13 +359,31 @@
170 interrupts = <9 4 5>; 359 interrupts = <9 4 5>;
171 atmel,use-dma-rx; 360 atmel,use-dma-rx;
172 atmel,use-dma-tx; 361 atmel,use-dma-tx;
362 pinctrl-names = "default";
363 pinctrl-0 = <&pinctrl_usart2>;
173 status = "disabled"; 364 status = "disabled";
174 }; 365 };
175 366
367 ssc0: ssc@fff98000 {
368 compatible = "atmel,at91rm9200-ssc";
369 reg = <0xfff98000 0x4000>;
370 interrupts = <16 4 5>;
371 status = "disable";
372 };
373
374 ssc1: ssc@fff9c000 {
375 compatible = "atmel,at91rm9200-ssc";
376 reg = <0xfff9c000 0x4000>;
377 interrupts = <17 4 5>;
378 status = "disable";
379 };
380
176 macb0: ethernet@fffbc000 { 381 macb0: ethernet@fffbc000 {
177 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 382 compatible = "cdns,at32ap7000-macb", "cdns,macb";
178 reg = <0xfffbc000 0x100>; 383 reg = <0xfffbc000 0x100>;
179 interrupts = <21 4 3>; 384 interrupts = <21 4 3>;
385 pinctrl-names = "default";
386 pinctrl-0 = <&pinctrl_macb_rmii>;
180 status = "disabled"; 387 status = "disabled";
181 }; 388 };
182 389
@@ -195,6 +402,30 @@
195 #size-cells = <0>; 402 #size-cells = <0>;
196 status = "disabled"; 403 status = "disabled";
197 }; 404 };
405
406 mmc0: mmc@fff80000 {
407 compatible = "atmel,hsmci";
408 reg = <0xfff80000 0x600>;
409 interrupts = <10 4 0>;
410 #address-cells = <1>;
411 #size-cells = <0>;
412 status = "disabled";
413 };
414
415 mmc1: mmc@fff84000 {
416 compatible = "atmel,hsmci";
417 reg = <0xfff84000 0x600>;
418 interrupts = <11 4 0>;
419 #address-cells = <1>;
420 #size-cells = <0>;
421 status = "disabled";
422 };
423
424 watchdog@fffffd40 {
425 compatible = "atmel,at91sam9260-wdt";
426 reg = <0xfffffd40 0x10>;
427 status = "disabled";
428 };
198 }; 429 };
199 430
200 nand0: nand@40000000 { 431 nand0: nand@40000000 {
@@ -206,6 +437,8 @@
206 >; 437 >;
207 atmel,nand-addr-offset = <21>; 438 atmel,nand-addr-offset = <21>;
208 atmel,nand-cmd-offset = <22>; 439 atmel,nand-cmd-offset = <22>;
440 pinctrl-names = "default";
441 pinctrl-0 = <&pinctrl_nand>;
209 gpios = <&pioA 22 0 442 gpios = <&pioA 22 0
210 &pioD 15 0 443 &pioD 15 0
211 0 444 0
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index f86ac4b609f..1eb08728f52 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -38,6 +38,10 @@
38 }; 38 };
39 39
40 usart0: serial@fff8c000 { 40 usart0: serial@fff8c000 {
41 pinctrl-0 = <
42 &pinctrl_usart0
43 &pinctrl_usart0_rts
44 &pinctrl_usart0_cts>;
41 status = "okay"; 45 status = "okay";
42 }; 46 };
43 47
@@ -50,6 +54,31 @@
50 atmel,vbus-gpio = <&pioA 25 0>; 54 atmel,vbus-gpio = <&pioA 25 0>;
51 status = "okay"; 55 status = "okay";
52 }; 56 };
57
58 mmc0: mmc@fff80000 {
59 pinctrl-0 = <
60 &pinctrl_board_mmc0
61 &pinctrl_mmc0_clk
62 &pinctrl_mmc0_slot0_cmd_dat0
63 &pinctrl_mmc0_slot0_dat1_3>;
64 status = "okay";
65 slot@0 {
66 reg = <0>;
67 bus-width = <4>;
68 cd-gpios = <&pioE 18 0>;
69 wp-gpios = <&pioE 19 0>;
70 };
71 };
72
73 pinctrl@fffff200 {
74 mmc0 {
75 pinctrl_board_mmc0: mmc0-board {
76 atmel,pins =
77 <5 18 0x0 0x5 /* PE18 gpio CD pin pull up and deglitch */
78 5 19 0x0 0x1>; /* PE19 gpio WP pin pull up */
79 };
80 };
81 };
53 }; 82 };
54 83
55 nand0: nand@40000000 { 84 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9g15.dtsi b/arch/arm/boot/dts/at91sam9g15.dtsi
new file mode 100644
index 00000000000..fbe7a7089c2
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g15.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9g15.dtsi - Device Tree Include file for AT91SAM9G15 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9G15 SoC";
13 compatible = "atmel, at91sam9g15, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe0399f 0x00000000 /* pioA */
21 0x00040000 0x00047e3f 0x00000000 /* pioB */
22 0xfdffffff 0x00000000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9g15ek.dts b/arch/arm/boot/dts/at91sam9g15ek.dts
new file mode 100644
index 00000000000..86dd3f6d938
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g15ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9g15ek.dts - Device Tree file for AT91SAM9G15-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9g15.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9g15ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
index f1b2e148ac8..66467b11312 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
+++ b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
@@ -12,6 +12,32 @@
12 model = "Atmel at91sam9g20ek 2 mmc"; 12 model = "Atmel at91sam9g20ek 2 mmc";
13 compatible = "atmel,at91sam9g20ek_2mmc", "atmel,at91sam9g20", "atmel,at91sam9"; 13 compatible = "atmel,at91sam9g20ek_2mmc", "atmel,at91sam9g20", "atmel,at91sam9";
14 14
15 ahb {
16 apb{
17 mmc0: mmc@fffa8000 {
18 /* clk already mux wuth slot0 */
19 pinctrl-0 = <
20 &pinctrl_board_mmc0_slot0
21 &pinctrl_mmc0_slot0_cmd_dat0
22 &pinctrl_mmc0_slot0_dat1_3>;
23 slot@0 {
24 reg = <0>;
25 bus-width = <4>;
26 cd-gpios = <&pioC 2 0>;
27 };
28 };
29
30 pinctrl@fffff400 {
31 mmc0_slot0 {
32 pinctrl_board_mmc0_slot0: mmc0_slot0-board {
33 atmel,pins =
34 <2 2 0x0 0x5>; /* PC2 gpio CD pin pull up and deglitch */
35 };
36 };
37 };
38 };
39 };
40
15 leds { 41 leds {
16 compatible = "gpio-leds"; 42 compatible = "gpio-leds";
17 43
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index e6391a4e664..da15e83e7f1 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -30,11 +30,28 @@
30 30
31 ahb { 31 ahb {
32 apb { 32 apb {
33 pinctrl@fffff400 {
34 board {
35 pinctrl_pck0_as_mck: pck0_as_mck {
36 atmel,pins =
37 <2 1 0x2 0x0>; /* PC1 periph B */
38 };
39
40 };
41 };
42
33 dbgu: serial@fffff200 { 43 dbgu: serial@fffff200 {
34 status = "okay"; 44 status = "okay";
35 }; 45 };
36 46
37 usart0: serial@fffb0000 { 47 usart0: serial@fffb0000 {
48 pinctrl-0 =
49 <&pinctrl_usart0
50 &pinctrl_usart0_rts
51 &pinctrl_usart0_cts
52 &pinctrl_usart0_dtr_dsr
53 &pinctrl_usart0_dcd
54 &pinctrl_usart0_ri>;
38 status = "okay"; 55 status = "okay";
39 }; 56 };
40 57
@@ -51,6 +68,34 @@
51 atmel,vbus-gpio = <&pioC 5 0>; 68 atmel,vbus-gpio = <&pioC 5 0>;
52 status = "okay"; 69 status = "okay";
53 }; 70 };
71
72 mmc0: mmc@fffa8000 {
73 pinctrl-0 = <
74 &pinctrl_board_mmc0_slot1
75 &pinctrl_mmc0_clk
76 &pinctrl_mmc0_slot1_cmd_dat0
77 &pinctrl_mmc0_slot1_dat1_3>;
78 status = "okay";
79 slot@1 {
80 reg = <1>;
81 bus-width = <4>;
82 cd-gpios = <&pioC 9 0>;
83 };
84 };
85
86 pinctrl@fffff400 {
87 mmc0_slot1 {
88 pinctrl_board_mmc0_slot1: mmc0_slot1-board {
89 atmel,pins =
90 <2 9 0x0 0x5>; /* PC9 gpio CD pin pull up and deglitch */
91 };
92 };
93 };
94
95 ssc0: ssc@fffbc000 {
96 status = "okay";
97 pinctrl-0 = <&pinctrl_ssc0_tx>;
98 };
54 }; 99 };
55 100
56 nand0: nand@40000000 { 101 nand0: nand@40000000 {
@@ -114,7 +159,7 @@
114 reg = <0x50>; 159 reg = <0x50>;
115 }; 160 };
116 161
117 wm8731@1b { 162 wm8731: wm8731@1b {
118 compatible = "wm8731"; 163 compatible = "wm8731";
119 reg = <0x1b>; 164 reg = <0x1b>;
120 }; 165 };
@@ -139,4 +184,19 @@
139 gpio-key,wakeup; 184 gpio-key,wakeup;
140 }; 185 };
141 }; 186 };
187
188 sound {
189 compatible = "atmel,at91sam9g20ek-wm8731-audio";
190 pinctrl-names = "default";
191 pinctrl-0 = <&pinctrl_pck0_as_mck>;
192
193 atmel,model = "wm8731 @ AT91SAMG20EK";
194
195 atmel,audio-routing =
196 "Ext Spk", "LHPOUT",
197 "Int Mic", "MICIN";
198
199 atmel,ssc-controller = <&ssc0>;
200 atmel,audio-codec = <&wm8731>;
201 };
142}; 202};
diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi
new file mode 100644
index 00000000000..05a718fb83c
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g25.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9g25.dtsi - Device Tree Include file for AT91SAM9G25 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9G25 SoC";
13 compatible = "atmel, at91sam9g25, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe0399f 0xc000001c /* pioA */
21 0x0007ffff 0x8000fe3f 0x00000000 /* pioB */
22 0x80000000 0x07c0ffff 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index 877c08f0676..c5ab16fba05 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -7,55 +7,10 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9x5.dtsi" 10/include/ "at91sam9g25.dtsi"
11/include/ "at91sam9x5cm.dtsi" 11/include/ "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9G25-EK"; 14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16
17 chosen {
18 bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
19 };
20
21 ahb {
22 apb {
23 dbgu: serial@fffff200 {
24 status = "okay";
25 };
26
27 usart0: serial@f801c000 {
28 status = "okay";
29 };
30
31 macb0: ethernet@f802c000 {
32 phy-mode = "rmii";
33 status = "okay";
34 };
35
36 i2c0: i2c@f8010000 {
37 status = "okay";
38 };
39
40 i2c1: i2c@f8014000 {
41 status = "okay";
42 };
43
44 i2c2: i2c@f8018000 {
45 status = "okay";
46 };
47 };
48
49 usb0: ohci@00600000 {
50 status = "okay";
51 num-ports = <2>;
52 atmel,vbus-gpio = <&pioD 19 1
53 &pioD 20 1
54 >;
55 };
56
57 usb1: ehci@00700000 {
58 status = "okay";
59 };
60 };
61}; 16};
diff --git a/arch/arm/boot/dts/at91sam9g35.dtsi b/arch/arm/boot/dts/at91sam9g35.dtsi
new file mode 100644
index 00000000000..f9d14a72279
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g35.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9g35.dtsi - Device Tree Include file for AT91SAM9G35 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9G35 SoC";
13 compatible = "atmel, at91sam9g35, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe0399f 0xc000000c /* pioA */
21 0x000406ff 0x00047e3f 0x00000000 /* pioB */
22 0xfdffffff 0x00000000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9g35ek.dts b/arch/arm/boot/dts/at91sam9g35ek.dts
new file mode 100644
index 00000000000..95944bdd798
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g35ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9g35ek.dts - Device Tree file for AT91SAM9G35-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9g35.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9G35-EK";
15 compatible = "atmel,at91sam9g35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 3add030d61f..fa1ae0c5479 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -31,6 +31,8 @@
31 tcb1 = &tcb1; 31 tcb1 = &tcb1;
32 i2c0 = &i2c0; 32 i2c0 = &i2c0;
33 i2c1 = &i2c1; 33 i2c1 = &i2c1;
34 ssc0 = &ssc0;
35 ssc1 = &ssc1;
34 }; 36 };
35 cpus { 37 cpus {
36 cpu@0 { 38 cpu@0 {
@@ -108,60 +110,243 @@
108 interrupts = <21 4 0>; 110 interrupts = <21 4 0>;
109 }; 111 };
110 112
111 pioA: gpio@fffff200 { 113 pinctrl@fffff200 {
112 compatible = "atmel,at91rm9200-gpio"; 114 #address-cells = <1>;
113 reg = <0xfffff200 0x100>; 115 #size-cells = <1>;
114 interrupts = <2 4 1>; 116 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
115 #gpio-cells = <2>; 117 ranges = <0xfffff200 0xfffff200 0xa00>;
116 gpio-controller; 118
117 interrupt-controller; 119 atmel,mux-mask = <
118 #interrupt-cells = <2>; 120 /* A B */
119 }; 121 0xffffffff 0xffc003ff /* pioA */
122 0xffffffff 0x800f8f00 /* pioB */
123 0xffffffff 0x00000e00 /* pioC */
124 0xffffffff 0xff0c1381 /* pioD */
125 0xffffffff 0x81ffff81 /* pioE */
126 >;
127
128 /* shared pinctrl settings */
129 dbgu {
130 pinctrl_dbgu: dbgu-0 {
131 atmel,pins =
132 <1 12 0x1 0x0 /* PB12 periph A */
133 1 13 0x1 0x0>; /* PB13 periph A */
134 };
135 };
120 136
121 pioB: gpio@fffff400 { 137 usart0 {
122 compatible = "atmel,at91rm9200-gpio"; 138 pinctrl_usart0: usart0-0 {
123 reg = <0xfffff400 0x100>; 139 atmel,pins =
124 interrupts = <3 4 1>; 140 <1 19 0x1 0x1 /* PB19 periph A with pullup */
125 #gpio-cells = <2>; 141 1 18 0x1 0x0>; /* PB18 periph A */
126 gpio-controller; 142 };
127 interrupt-controller; 143
128 #interrupt-cells = <2>; 144 pinctrl_usart0_rts: usart0_rts-0 {
129 }; 145 atmel,pins =
146 <1 17 0x2 0x0>; /* PB17 periph B */
147 };
148
149 pinctrl_usart0_cts: usart0_cts-0 {
150 atmel,pins =
151 <1 15 0x2 0x0>; /* PB15 periph B */
152 };
153 };
130 154
131 pioC: gpio@fffff600 { 155 uart1 {
132 compatible = "atmel,at91rm9200-gpio"; 156 pinctrl_usart1: usart1-0 {
133 reg = <0xfffff600 0x100>; 157 atmel,pins =
134 interrupts = <4 4 1>; 158 <1 4 0x1 0x1 /* PB4 periph A with pullup */
135 #gpio-cells = <2>; 159 1 5 0x1 0x0>; /* PB5 periph A */
136 gpio-controller; 160 };
137 interrupt-controller; 161
138 #interrupt-cells = <2>; 162 pinctrl_usart1_rts: usart1_rts-0 {
139 }; 163 atmel,pins =
164 <3 16 0x1 0x0>; /* PD16 periph A */
165 };
166
167 pinctrl_usart1_cts: usart1_cts-0 {
168 atmel,pins =
169 <3 17 0x1 0x0>; /* PD17 periph A */
170 };
171 };
140 172
141 pioD: gpio@fffff800 { 173 usart2 {
142 compatible = "atmel,at91rm9200-gpio"; 174 pinctrl_usart2: usart2-0 {
143 reg = <0xfffff800 0x100>; 175 atmel,pins =
144 interrupts = <5 4 1>; 176 <1 6 0x1 0x1 /* PB6 periph A with pullup */
145 #gpio-cells = <2>; 177 1 7 0x1 0x0>; /* PB7 periph A */
146 gpio-controller; 178 };
147 interrupt-controller; 179
148 #interrupt-cells = <2>; 180 pinctrl_usart2_rts: usart2_rts-0 {
149 }; 181 atmel,pins =
182 <2 9 0x2 0x0>; /* PC9 periph B */
183 };
184
185 pinctrl_usart2_cts: usart2_cts-0 {
186 atmel,pins =
187 <2 11 0x2 0x0>; /* PC11 periph B */
188 };
189 };
150 190
151 pioE: gpio@fffffa00 { 191 usart3 {
152 compatible = "atmel,at91rm9200-gpio"; 192 pinctrl_usart3: usart3-0 {
153 reg = <0xfffffa00 0x100>; 193 atmel,pins =
154 interrupts = <5 4 1>; 194 <1 8 0x1 0x1 /* PB9 periph A with pullup */
155 #gpio-cells = <2>; 195 1 9 0x1 0x0>; /* PB8 periph A */
156 gpio-controller; 196 };
157 interrupt-controller; 197
158 #interrupt-cells = <2>; 198 pinctrl_usart3_rts: usart3_rts-0 {
199 atmel,pins =
200 <0 23 0x2 0x0>; /* PA23 periph B */
201 };
202
203 pinctrl_usart3_cts: usart3_cts-0 {
204 atmel,pins =
205 <0 24 0x2 0x0>; /* PA24 periph B */
206 };
207 };
208
209 nand {
210 pinctrl_nand: nand-0 {
211 atmel,pins =
212 <2 8 0x0 0x1 /* PC8 gpio RDY pin pull_up*/
213 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */
214 };
215 };
216
217 macb {
218 pinctrl_macb_rmii: macb_rmii-0 {
219 atmel,pins =
220 <0 10 0x1 0x0 /* PA10 periph A */
221 0 11 0x1 0x0 /* PA11 periph A */
222 0 12 0x1 0x0 /* PA12 periph A */
223 0 13 0x1 0x0 /* PA13 periph A */
224 0 14 0x1 0x0 /* PA14 periph A */
225 0 15 0x1 0x0 /* PA15 periph A */
226 0 16 0x1 0x0 /* PA16 periph A */
227 0 17 0x1 0x0 /* PA17 periph A */
228 0 18 0x1 0x0 /* PA18 periph A */
229 0 19 0x1 0x0>; /* PA19 periph A */
230 };
231
232 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
233 atmel,pins =
234 <0 6 0x2 0x0 /* PA6 periph B */
235 0 7 0x2 0x0 /* PA7 periph B */
236 0 8 0x2 0x0 /* PA8 periph B */
237 0 9 0x2 0x0 /* PA9 periph B */
238 0 27 0x2 0x0 /* PA27 periph B */
239 0 28 0x2 0x0 /* PA28 periph B */
240 0 29 0x2 0x0 /* PA29 periph B */
241 0 30 0x2 0x0>; /* PA30 periph B */
242 };
243 };
244
245 mmc0 {
246 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
247 atmel,pins =
248 <0 0 0x1 0x0 /* PA0 periph A */
249 0 1 0x1 0x1 /* PA1 periph A with pullup */
250 0 2 0x1 0x1>; /* PA2 periph A with pullup */
251 };
252
253 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
254 atmel,pins =
255 <0 3 0x1 0x1 /* PA3 periph A with pullup */
256 0 4 0x1 0x1 /* PA4 periph A with pullup */
257 0 5 0x1 0x1>; /* PA5 periph A with pullup */
258 };
259
260 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 {
261 atmel,pins =
262 <0 6 0x1 0x1 /* PA6 periph A with pullup */
263 0 7 0x1 0x1 /* PA7 periph A with pullup */
264 0 8 0x1 0x1 /* PA8 periph A with pullup */
265 0 9 0x1 0x1>; /* PA9 periph A with pullup */
266 };
267 };
268
269 mmc1 {
270 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 {
271 atmel,pins =
272 <0 31 0x1 0x0 /* PA31 periph A */
273 0 22 0x1 0x1 /* PA22 periph A with pullup */
274 0 23 0x1 0x1>; /* PA23 periph A with pullup */
275 };
276
277 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
278 atmel,pins =
279 <0 24 0x1 0x1 /* PA24 periph A with pullup */
280 0 25 0x1 0x1 /* PA25 periph A with pullup */
281 0 26 0x1 0x1>; /* PA26 periph A with pullup */
282 };
283
284 pinctrl_mmc1_slot0_dat4_7: mmc1_slot0_dat4_7-0 {
285 atmel,pins =
286 <0 27 0x1 0x1 /* PA27 periph A with pullup */
287 0 28 0x1 0x1 /* PA28 periph A with pullup */
288 0 29 0x1 0x1 /* PA29 periph A with pullup */
289 0 20 0x1 0x1>; /* PA30 periph A with pullup */
290 };
291 };
292
293 pioA: gpio@fffff200 {
294 compatible = "atmel,at91rm9200-gpio";
295 reg = <0xfffff200 0x200>;
296 interrupts = <2 4 1>;
297 #gpio-cells = <2>;
298 gpio-controller;
299 interrupt-controller;
300 #interrupt-cells = <2>;
301 };
302
303 pioB: gpio@fffff400 {
304 compatible = "atmel,at91rm9200-gpio";
305 reg = <0xfffff400 0x200>;
306 interrupts = <3 4 1>;
307 #gpio-cells = <2>;
308 gpio-controller;
309 interrupt-controller;
310 #interrupt-cells = <2>;
311 };
312
313 pioC: gpio@fffff600 {
314 compatible = "atmel,at91rm9200-gpio";
315 reg = <0xfffff600 0x200>;
316 interrupts = <4 4 1>;
317 #gpio-cells = <2>;
318 gpio-controller;
319 interrupt-controller;
320 #interrupt-cells = <2>;
321 };
322
323 pioD: gpio@fffff800 {
324 compatible = "atmel,at91rm9200-gpio";
325 reg = <0xfffff800 0x200>;
326 interrupts = <5 4 1>;
327 #gpio-cells = <2>;
328 gpio-controller;
329 interrupt-controller;
330 #interrupt-cells = <2>;
331 };
332
333 pioE: gpio@fffffa00 {
334 compatible = "atmel,at91rm9200-gpio";
335 reg = <0xfffffa00 0x200>;
336 interrupts = <5 4 1>;
337 #gpio-cells = <2>;
338 gpio-controller;
339 interrupt-controller;
340 #interrupt-cells = <2>;
341 };
159 }; 342 };
160 343
161 dbgu: serial@ffffee00 { 344 dbgu: serial@ffffee00 {
162 compatible = "atmel,at91sam9260-usart"; 345 compatible = "atmel,at91sam9260-usart";
163 reg = <0xffffee00 0x200>; 346 reg = <0xffffee00 0x200>;
164 interrupts = <1 4 7>; 347 interrupts = <1 4 7>;
348 pinctrl-names = "default";
349 pinctrl-0 = <&pinctrl_dbgu>;
165 status = "disabled"; 350 status = "disabled";
166 }; 351 };
167 352
@@ -171,6 +356,8 @@
171 interrupts = <7 4 5>; 356 interrupts = <7 4 5>;
172 atmel,use-dma-rx; 357 atmel,use-dma-rx;
173 atmel,use-dma-tx; 358 atmel,use-dma-tx;
359 pinctrl-names = "default";
360 pinctrl-0 = <&pinctrl_usart0>;
174 status = "disabled"; 361 status = "disabled";
175 }; 362 };
176 363
@@ -180,6 +367,8 @@
180 interrupts = <8 4 5>; 367 interrupts = <8 4 5>;
181 atmel,use-dma-rx; 368 atmel,use-dma-rx;
182 atmel,use-dma-tx; 369 atmel,use-dma-tx;
370 pinctrl-names = "default";
371 pinctrl-0 = <&pinctrl_usart1>;
183 status = "disabled"; 372 status = "disabled";
184 }; 373 };
185 374
@@ -189,6 +378,8 @@
189 interrupts = <9 4 5>; 378 interrupts = <9 4 5>;
190 atmel,use-dma-rx; 379 atmel,use-dma-rx;
191 atmel,use-dma-tx; 380 atmel,use-dma-tx;
381 pinctrl-names = "default";
382 pinctrl-0 = <&pinctrl_usart2>;
192 status = "disabled"; 383 status = "disabled";
193 }; 384 };
194 385
@@ -198,6 +389,8 @@
198 interrupts = <10 4 5>; 389 interrupts = <10 4 5>;
199 atmel,use-dma-rx; 390 atmel,use-dma-rx;
200 atmel,use-dma-tx; 391 atmel,use-dma-tx;
392 pinctrl-names = "default";
393 pinctrl-0 = <&pinctrl_usart3>;
201 status = "disabled"; 394 status = "disabled";
202 }; 395 };
203 396
@@ -205,6 +398,8 @@
205 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 398 compatible = "cdns,at32ap7000-macb", "cdns,macb";
206 reg = <0xfffbc000 0x100>; 399 reg = <0xfffbc000 0x100>;
207 interrupts = <25 4 3>; 400 interrupts = <25 4 3>;
401 pinctrl-names = "default";
402 pinctrl-0 = <&pinctrl_macb_rmii>;
208 status = "disabled"; 403 status = "disabled";
209 }; 404 };
210 405
@@ -226,6 +421,20 @@
226 status = "disabled"; 421 status = "disabled";
227 }; 422 };
228 423
424 ssc0: ssc@fff9c000 {
425 compatible = "atmel,at91sam9g45-ssc";
426 reg = <0xfff9c000 0x4000>;
427 interrupts = <16 4 5>;
428 status = "disable";
429 };
430
431 ssc1: ssc@fffa0000 {
432 compatible = "atmel,at91sam9g45-ssc";
433 reg = <0xfffa0000 0x4000>;
434 interrupts = <17 4 5>;
435 status = "disable";
436 };
437
229 adc0: adc@fffb0000 { 438 adc0: adc@fffb0000 {
230 compatible = "atmel,at91sam9260-adc"; 439 compatible = "atmel,at91sam9260-adc";
231 reg = <0xfffb0000 0x100>; 440 reg = <0xfffb0000 0x100>;
@@ -262,6 +471,30 @@
262 trigger-value = <0x6>; 471 trigger-value = <0x6>;
263 }; 472 };
264 }; 473 };
474
475 mmc0: mmc@fff80000 {
476 compatible = "atmel,hsmci";
477 reg = <0xfff80000 0x600>;
478 interrupts = <11 4 0>;
479 #address-cells = <1>;
480 #size-cells = <0>;
481 status = "disabled";
482 };
483
484 mmc1: mmc@fffd0000 {
485 compatible = "atmel,hsmci";
486 reg = <0xfffd0000 0x600>;
487 interrupts = <29 4 0>;
488 #address-cells = <1>;
489 #size-cells = <0>;
490 status = "disabled";
491 };
492
493 watchdog@fffffd40 {
494 compatible = "atmel,at91sam9260-wdt";
495 reg = <0xfffffd40 0x10>;
496 status = "disabled";
497 };
265 }; 498 };
266 499
267 nand0: nand@40000000 { 500 nand0: nand@40000000 {
@@ -273,6 +506,8 @@
273 >; 506 >;
274 atmel,nand-addr-offset = <21>; 507 atmel,nand-addr-offset = <21>;
275 atmel,nand-cmd-offset = <22>; 508 atmel,nand-cmd-offset = <22>;
509 pinctrl-names = "default";
510 pinctrl-0 = <&pinctrl_nand>;
276 gpios = <&pioC 8 0 511 gpios = <&pioC 8 0
277 &pioC 14 0 512 &pioC 14 0
278 0 513 0
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 15e1dd43f62..20c31913c27 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -39,6 +39,10 @@
39 }; 39 };
40 40
41 usart1: serial@fff90000 { 41 usart1: serial@fff90000 {
42 pinctrl-0 =
43 <&pinctrl_usart1
44 &pinctrl_usart1_rts
45 &pinctrl_usart1_cts>;
42 status = "okay"; 46 status = "okay";
43 }; 47 };
44 48
@@ -54,6 +58,50 @@
54 i2c1: i2c@fff88000 { 58 i2c1: i2c@fff88000 {
55 status = "okay"; 59 status = "okay";
56 }; 60 };
61
62 mmc0: mmc@fff80000 {
63 pinctrl-0 = <
64 &pinctrl_board_mmc0
65 &pinctrl_mmc0_slot0_clk_cmd_dat0
66 &pinctrl_mmc0_slot0_dat1_3>;
67 status = "okay";
68 slot@0 {
69 reg = <0>;
70 bus-width = <4>;
71 cd-gpios = <&pioD 10 0>;
72 };
73 };
74
75 mmc1: mmc@fffd0000 {
76 pinctrl-0 = <
77 &pinctrl_board_mmc1
78 &pinctrl_mmc1_slot0_clk_cmd_dat0
79 &pinctrl_mmc1_slot0_dat1_3>;
80 status = "okay";
81 slot@0 {
82 reg = <0>;
83 bus-width = <4>;
84 cd-gpios = <&pioD 11 0>;
85 wp-gpios = <&pioD 29 0>;
86 };
87 };
88
89 pinctrl@fffff200 {
90 mmc0 {
91 pinctrl_board_mmc0: mmc0-board {
92 atmel,pins =
93 <3 10 0x0 0x5>; /* PD10 gpio CD pin pull up and deglitch */
94 };
95 };
96
97 mmc1 {
98 pinctrl_board_mmc1: mmc1-board {
99 atmel,pins =
100 <3 11 0x0 0x5 /* PD11 gpio CD pin pull up and deglitch */
101 3 29 0x0 0x1>; /* PD29 gpio WP pin pull up */
102 };
103 };
104 };
57 }; 105 };
58 106
59 nand0: nand@40000000 { 107 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 82508d68aa7..e9efb34f437 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -84,6 +84,15 @@
84 reg = <0xfffffe10 0x10>; 84 reg = <0xfffffe10 0x10>;
85 }; 85 };
86 86
87 mmc0: mmc@f0008000 {
88 compatible = "atmel,hsmci";
89 reg = <0xf0008000 0x600>;
90 interrupts = <12 4 0>;
91 #address-cells = <1>;
92 #size-cells = <0>;
93 status = "disabled";
94 };
95
87 tcb0: timer@f8008000 { 96 tcb0: timer@f8008000 {
88 compatible = "atmel,at91sam9x5-tcb"; 97 compatible = "atmel,at91sam9x5-tcb";
89 reg = <0xf8008000 0x100>; 98 reg = <0xf8008000 0x100>;
@@ -102,50 +111,186 @@
102 interrupts = <20 4 0>; 111 interrupts = <20 4 0>;
103 }; 112 };
104 113
105 pioA: gpio@fffff400 { 114 pinctrl@fffff400 {
106 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 115 #address-cells = <1>;
107 reg = <0xfffff400 0x100>; 116 #size-cells = <1>;
108 interrupts = <2 4 1>; 117 compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
109 #gpio-cells = <2>; 118 ranges = <0xfffff400 0xfffff400 0x800>;
110 gpio-controller;
111 interrupt-controller;
112 #interrupt-cells = <2>;
113 };
114 119
115 pioB: gpio@fffff600 { 120 atmel,mux-mask = <
116 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 121 /* A B C */
117 reg = <0xfffff600 0x100>; 122 0xffffffff 0xffe07983 0x00000000 /* pioA */
118 interrupts = <2 4 1>; 123 0x00040000 0x00047e0f 0x00000000 /* pioB */
119 #gpio-cells = <2>; 124 0xfdffffff 0x07c00000 0xb83fffff /* pioC */
120 gpio-controller; 125 0x003fffff 0x003f8000 0x00000000 /* pioD */
121 interrupt-controller; 126 >;
122 #interrupt-cells = <2>;
123 };
124 127
125 pioC: gpio@fffff800 { 128 /* shared pinctrl settings */
126 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 129 dbgu {
127 reg = <0xfffff800 0x100>; 130 pinctrl_dbgu: dbgu-0 {
128 interrupts = <3 4 1>; 131 atmel,pins =
129 #gpio-cells = <2>; 132 <0 9 0x1 0x0 /* PA9 periph A */
130 gpio-controller; 133 0 10 0x1 0x1>; /* PA10 periph with pullup */
131 interrupt-controller; 134 };
132 #interrupt-cells = <2>; 135 };
133 };
134 136
135 pioD: gpio@fffffa00 { 137 usart0 {
136 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 138 pinctrl_usart0: usart0-0 {
137 reg = <0xfffffa00 0x100>; 139 atmel,pins =
138 interrupts = <3 4 1>; 140 <0 1 0x1 0x1 /* PA1 periph A with pullup */
139 #gpio-cells = <2>; 141 0 0 0x1 0x0>; /* PA0 periph A */
140 gpio-controller; 142 };
141 interrupt-controller; 143
142 #interrupt-cells = <2>; 144 pinctrl_usart0_rts: usart0_rts-0 {
145 atmel,pins =
146 <0 2 0x1 0x0>; /* PA2 periph A */
147 };
148
149 pinctrl_usart0_cts: usart0_cts-0 {
150 atmel,pins =
151 <0 3 0x1 0x0>; /* PA3 periph A */
152 };
153 };
154
155 usart1 {
156 pinctrl_usart1: usart1-0 {
157 atmel,pins =
158 <0 6 0x1 0x1 /* PA6 periph A with pullup */
159 0 5 0x1 0x0>; /* PA5 periph A */
160 };
161 };
162
163 usart2 {
164 pinctrl_usart2: usart2-0 {
165 atmel,pins =
166 <0 8 0x1 0x1 /* PA8 periph A with pullup */
167 0 7 0x1 0x0>; /* PA7 periph A */
168 };
169
170 pinctrl_usart2_rts: usart2_rts-0 {
171 atmel,pins =
172 <1 0 0x2 0x0>; /* PB0 periph B */
173 };
174
175 pinctrl_usart2_cts: usart2_cts-0 {
176 atmel,pins =
177 <1 1 0x2 0x0>; /* PB1 periph B */
178 };
179 };
180
181 usart3 {
182 pinctrl_usart3: usart3-0 {
183 atmel,pins =
184 <2 23 0x2 0x1 /* PC23 periph B with pullup */
185 2 22 0x2 0x0>; /* PC22 periph B */
186 };
187
188 pinctrl_usart3_rts: usart3_rts-0 {
189 atmel,pins =
190 <2 24 0x2 0x0>; /* PC24 periph B */
191 };
192
193 pinctrl_usart3_cts: usart3_cts-0 {
194 atmel,pins =
195 <2 25 0x2 0x0>; /* PC25 periph B */
196 };
197 };
198
199 uart0 {
200 pinctrl_uart0: uart0-0 {
201 atmel,pins =
202 <2 9 0x3 0x1 /* PC9 periph C with pullup */
203 2 8 0x3 0x0>; /* PC8 periph C */
204 };
205 };
206
207 uart1 {
208 pinctrl_uart1: uart1-0 {
209 atmel,pins =
210 <2 16 0x3 0x1 /* PC17 periph C with pullup */
211 2 17 0x3 0x0>; /* PC16 periph C */
212 };
213 };
214
215 nand {
216 pinctrl_nand: nand-0 {
217 atmel,pins =
218 <3 5 0x0 0x1 /* PD5 gpio RDY pin pull_up*/
219 3 4 0x0 0x1>; /* PD4 gpio enable pin pull_up */
220 };
221 };
222
223 mmc0 {
224 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
225 atmel,pins =
226 <0 17 0x1 0x0 /* PA17 periph A */
227 0 16 0x1 0x1 /* PA16 periph A with pullup */
228 0 15 0x1 0x1>; /* PA15 periph A with pullup */
229 };
230
231 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
232 atmel,pins =
233 <0 18 0x1 0x1 /* PA18 periph A with pullup */
234 0 19 0x1 0x1 /* PA19 periph A with pullup */
235 0 20 0x1 0x1>; /* PA20 periph A with pullup */
236 };
237
238 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 {
239 atmel,pins =
240 <0 11 0x2 0x1 /* PA11 periph B with pullup */
241 0 12 0x2 0x1 /* PA12 periph B with pullup */
242 0 13 0x2 0x1 /* PA13 periph B with pullup */
243 0 14 0x2 0x1>; /* PA14 periph B with pullup */
244 };
245 };
246
247 pioA: gpio@fffff400 {
248 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
249 reg = <0xfffff400 0x200>;
250 interrupts = <2 4 1>;
251 #gpio-cells = <2>;
252 gpio-controller;
253 interrupt-controller;
254 #interrupt-cells = <2>;
255 };
256
257 pioB: gpio@fffff600 {
258 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
259 reg = <0xfffff600 0x200>;
260 interrupts = <2 4 1>;
261 #gpio-cells = <2>;
262 gpio-controller;
263 interrupt-controller;
264 #interrupt-cells = <2>;
265 };
266
267 pioC: gpio@fffff800 {
268 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
269 reg = <0xfffff800 0x200>;
270 interrupts = <3 4 1>;
271 #gpio-cells = <2>;
272 gpio-controller;
273 interrupt-controller;
274 #interrupt-cells = <2>;
275 };
276
277 pioD: gpio@fffffa00 {
278 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
279 reg = <0xfffffa00 0x200>;
280 interrupts = <3 4 1>;
281 #gpio-cells = <2>;
282 gpio-controller;
283 interrupt-controller;
284 #interrupt-cells = <2>;
285 };
143 }; 286 };
144 287
145 dbgu: serial@fffff200 { 288 dbgu: serial@fffff200 {
146 compatible = "atmel,at91sam9260-usart"; 289 compatible = "atmel,at91sam9260-usart";
147 reg = <0xfffff200 0x200>; 290 reg = <0xfffff200 0x200>;
148 interrupts = <1 4 7>; 291 interrupts = <1 4 7>;
292 pinctrl-names = "default";
293 pinctrl-0 = <&pinctrl_dbgu>;
149 status = "disabled"; 294 status = "disabled";
150 }; 295 };
151 296
@@ -155,6 +300,8 @@
155 interrupts = <5 4 5>; 300 interrupts = <5 4 5>;
156 atmel,use-dma-rx; 301 atmel,use-dma-rx;
157 atmel,use-dma-tx; 302 atmel,use-dma-tx;
303 pinctrl-names = "default";
304 pinctrl-0 = <&pinctrl_usart0>;
158 status = "disabled"; 305 status = "disabled";
159 }; 306 };
160 307
@@ -164,6 +311,8 @@
164 interrupts = <6 4 5>; 311 interrupts = <6 4 5>;
165 atmel,use-dma-rx; 312 atmel,use-dma-rx;
166 atmel,use-dma-tx; 313 atmel,use-dma-tx;
314 pinctrl-names = "default";
315 pinctrl-0 = <&pinctrl_usart1>;
167 status = "disabled"; 316 status = "disabled";
168 }; 317 };
169 318
@@ -173,6 +322,8 @@
173 interrupts = <7 4 5>; 322 interrupts = <7 4 5>;
174 atmel,use-dma-rx; 323 atmel,use-dma-rx;
175 atmel,use-dma-tx; 324 atmel,use-dma-tx;
325 pinctrl-names = "default";
326 pinctrl-0 = <&pinctrl_usart2>;
176 status = "disabled"; 327 status = "disabled";
177 }; 328 };
178 329
@@ -182,6 +333,8 @@
182 interrupts = <8 4 5>; 333 interrupts = <8 4 5>;
183 atmel,use-dma-rx; 334 atmel,use-dma-rx;
184 atmel,use-dma-tx; 335 atmel,use-dma-tx;
336 pinctrl-names = "default";
337 pinctrl-0 = <&pinctrl_usart3>;
185 status = "disabled"; 338 status = "disabled";
186 }; 339 };
187 340
@@ -215,6 +368,8 @@
215 >; 368 >;
216 atmel,nand-addr-offset = <21>; 369 atmel,nand-addr-offset = <21>;
217 atmel,nand-cmd-offset = <22>; 370 atmel,nand-cmd-offset = <22>;
371 pinctrl-names = "default";
372 pinctrl-0 = <&pinctrl_nand>;
218 gpios = <&pioD 5 0 373 gpios = <&pioD 5 0
219 &pioD 4 0 374 &pioD 4 0
220 0 375 0
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index 912b2c283d6..0376bf4fd66 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -45,6 +45,28 @@
45 i2c1: i2c@f8014000 { 45 i2c1: i2c@f8014000 {
46 status = "okay"; 46 status = "okay";
47 }; 47 };
48
49 mmc0: mmc@f0008000 {
50 pinctrl-0 = <
51 &pinctrl_board_mmc0
52 &pinctrl_mmc0_slot0_clk_cmd_dat0
53 &pinctrl_mmc0_slot0_dat1_3>;
54 status = "okay";
55 slot@0 {
56 reg = <0>;
57 bus-width = <4>;
58 cd-gpios = <&pioA 7 0>;
59 };
60 };
61
62 pinctrl@fffff400 {
63 mmc0 {
64 pinctrl_board_mmc0: mmc0-board {
65 atmel,pins =
66 <0 7 0x0 0x5>; /* PA7 gpio CD pin pull up and deglitch */
67 };
68 };
69 };
48 }; 70 };
49 71
50 nand0: nand@40000000 { 72 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi b/arch/arm/boot/dts/at91sam9x25.dtsi
new file mode 100644
index 00000000000..54eb33ba6d2
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -0,0 +1,49 @@
1/*
2 * at91sam9x25.dtsi - Device Tree Include file for AT91SAM9X25 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9X25 SoC";
13 compatible = "atmel, at91sam9x25, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe03fff 0xc000001c /* pioA */
21 0x0007ffff 0x00047e3f 0x00000000 /* pioB */
22 0x80000000 0xfffd0000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25
26 macb1 {
27 pinctrl_macb1_rmii: macb1_rmii-0 {
28 atmel,pins =
29 <2 16 0x2 0x0 /* PC16 periph B */
30 2 18 0x2 0x0 /* PC18 periph B */
31 2 19 0x2 0x0 /* PC19 periph B */
32 2 20 0x2 0x0 /* PC20 periph B */
33 2 21 0x2 0x0 /* PC21 periph B */
34 2 27 0x2 0x0 /* PC27 periph B */
35 2 28 0x2 0x0 /* PC28 periph B */
36 2 29 0x2 0x0 /* PC29 periph B */
37 2 30 0x2 0x0 /* PC30 periph B */
38 2 31 0x2 0x0>; /* PC31 periph B */
39 };
40 };
41 };
42
43 macb1: ethernet@f8030000 {
44 pinctrl-names = "default";
45 pinctrl-0 = <&pinctrl_macb1_rmii>;
46 };
47 };
48 };
49};
diff --git a/arch/arm/boot/dts/at91sam9x25ek.dts b/arch/arm/boot/dts/at91sam9x25ek.dts
new file mode 100644
index 00000000000..af907eaa1f2
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x25ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9x25ek.dts - Device Tree file for AT91SAM9X25-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9x25.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9x25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9x35.dtsi b/arch/arm/boot/dts/at91sam9x35.dtsi
new file mode 100644
index 00000000000..fb102d6126c
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x35.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9x35.dtsi - Device Tree Include file for AT91SAM9X35 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9X35 SoC";
13 compatible = "atmel, at91sam9x35, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe03fff 0xc000000c /* pioA */
21 0x000406ff 0x00047e3f 0x00000000 /* pioB */
22 0xfdffffff 0x00000000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9x35ek.dts b/arch/arm/boot/dts/at91sam9x35ek.dts
new file mode 100644
index 00000000000..5ccb607b541
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x35ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9x35ek.dts - Device Tree file for AT91SAM9X35-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9x35.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9X35-EK";
15 compatible = "atmel,at91sam9x35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 03fc136421c..617ede541ca 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -30,6 +30,7 @@
30 i2c0 = &i2c0; 30 i2c0 = &i2c0;
31 i2c1 = &i2c1; 31 i2c1 = &i2c1;
32 i2c2 = &i2c2; 32 i2c2 = &i2c2;
33 ssc0 = &ssc0;
33 }; 34 };
34 cpus { 35 cpus {
35 cpu@0 { 36 cpu@0 {
@@ -87,6 +88,13 @@
87 interrupts = <1 4 7>; 88 interrupts = <1 4 7>;
88 }; 89 };
89 90
91 ssc0: ssc@f0010000 {
92 compatible = "atmel,at91sam9g45-ssc";
93 reg = <0xf0010000 0x4000>;
94 interrupts = <28 4 5>;
95 status = "disable";
96 };
97
90 tcb0: timer@f8008000 { 98 tcb0: timer@f8008000 {
91 compatible = "atmel,at91sam9x5-tcb"; 99 compatible = "atmel,at91sam9x5-tcb";
92 reg = <0xf8008000 0x100>; 100 reg = <0xf8008000 0x100>;
@@ -111,50 +119,244 @@
111 interrupts = <21 4 0>; 119 interrupts = <21 4 0>;
112 }; 120 };
113 121
114 pioA: gpio@fffff400 { 122 pinctrl@fffff400 {
115 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 123 #address-cells = <1>;
116 reg = <0xfffff400 0x100>; 124 #size-cells = <1>;
117 interrupts = <2 4 1>; 125 compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
118 #gpio-cells = <2>; 126 ranges = <0xfffff400 0xfffff400 0x800>;
119 gpio-controller; 127
120 interrupt-controller; 128 /* shared pinctrl settings */
121 #interrupt-cells = <2>; 129 dbgu {
122 }; 130 pinctrl_dbgu: dbgu-0 {
131 atmel,pins =
132 <0 9 0x1 0x0 /* PA9 periph A */
133 0 10 0x1 0x1>; /* PA10 periph A with pullup */
134 };
135 };
123 136
124 pioB: gpio@fffff600 { 137 usart0 {
125 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 138 pinctrl_usart0: usart0-0 {
126 reg = <0xfffff600 0x100>; 139 atmel,pins =
127 interrupts = <2 4 1>; 140 <0 0 0x1 0x1 /* PA0 periph A with pullup */
128 #gpio-cells = <2>; 141 0 1 0x1 0x0>; /* PA1 periph A */
129 gpio-controller; 142 };
130 interrupt-controller; 143
131 #interrupt-cells = <2>; 144 pinctrl_usart0_rts: usart0_rts-0 {
145 atmel,pins =
146 <0 2 0x1 0x0>; /* PA2 periph A */
147 };
148
149 pinctrl_usart0_cts: usart0_cts-0 {
150 atmel,pins =
151 <0 3 0x1 0x0>; /* PA3 periph A */
152 };
153 };
154
155 usart1 {
156 pinctrl_usart1: usart1-0 {
157 atmel,pins =
158 <0 5 0x1 0x1 /* PA5 periph A with pullup */
159 0 6 0x1 0x0>; /* PA6 periph A */
160 };
161
162 pinctrl_usart1_rts: usart1_rts-0 {
163 atmel,pins =
164 <3 27 0x3 0x0>; /* PC27 periph C */
165 };
166
167 pinctrl_usart1_cts: usart1_cts-0 {
168 atmel,pins =
169 <3 28 0x3 0x0>; /* PC28 periph C */
170 };
171 };
172
173 usart2 {
174 pinctrl_usart2: usart2-0 {
175 atmel,pins =
176 <0 7 0x1 0x1 /* PA7 periph A with pullup */
177 0 8 0x1 0x0>; /* PA8 periph A */
178 };
179
180 pinctrl_uart2_rts: uart2_rts-0 {
181 atmel,pins =
182 <0 0 0x2 0x0>; /* PB0 periph B */
183 };
184
185 pinctrl_uart2_cts: uart2_cts-0 {
186 atmel,pins =
187 <0 1 0x2 0x0>; /* PB1 periph B */
188 };
189 };
190
191 usart3 {
192 pinctrl_uart3: usart3-0 {
193 atmel,pins =
194 <3 23 0x2 0x1 /* PC22 periph B with pullup */
195 3 23 0x2 0x0>; /* PC23 periph B */
196 };
197
198 pinctrl_usart3_rts: usart3_rts-0 {
199 atmel,pins =
200 <3 24 0x2 0x0>; /* PC24 periph B */
201 };
202
203 pinctrl_usart3_cts: usart3_cts-0 {
204 atmel,pins =
205 <3 25 0x2 0x0>; /* PC25 periph B */
206 };
207 };
208
209 uart0 {
210 pinctrl_uart0: uart0-0 {
211 atmel,pins =
212 <3 8 0x3 0x0 /* PC8 periph C */
213 3 9 0x3 0x1>; /* PC9 periph C with pullup */
214 };
215 };
216
217 uart1 {
218 pinctrl_uart1: uart1-0 {
219 atmel,pins =
220 <3 16 0x3 0x0 /* PC16 periph C */
221 3 17 0x3 0x1>; /* PC17 periph C with pullup */
222 };
223 };
224
225 nand {
226 pinctrl_nand: nand-0 {
227 atmel,pins =
228 <3 4 0x0 0x1 /* PD5 gpio RDY pin pull_up */
229 3 5 0x0 0x1>; /* PD4 gpio enable pin pull_up */
230 };
231 };
232
233 macb0 {
234 pinctrl_macb0_rmii: macb0_rmii-0 {
235 atmel,pins =
236 <1 0 0x1 0x0 /* PB0 periph A */
237 1 1 0x1 0x0 /* PB1 periph A */
238 1 2 0x1 0x0 /* PB2 periph A */
239 1 3 0x1 0x0 /* PB3 periph A */
240 1 4 0x1 0x0 /* PB4 periph A */
241 1 5 0x1 0x0 /* PB5 periph A */
242 1 6 0x1 0x0 /* PB6 periph A */
243 1 7 0x1 0x0 /* PB7 periph A */
244 1 9 0x1 0x0 /* PB9 periph A */
245 1 10 0x1 0x0>; /* PB10 periph A */
246 };
247
248 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 {
249 atmel,pins =
250 <1 8 0x1 0x0 /* PA8 periph A */
251 1 11 0x1 0x0 /* PA11 periph A */
252 1 12 0x1 0x0 /* PA12 periph A */
253 1 13 0x1 0x0 /* PA13 periph A */
254 1 14 0x1 0x0 /* PA14 periph A */
255 1 15 0x1 0x0 /* PA15 periph A */
256 1 16 0x1 0x0 /* PA16 periph A */
257 1 17 0x1 0x0>; /* PA17 periph A */
258 };
259 };
260
261 mmc0 {
262 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
263 atmel,pins =
264 <0 17 0x1 0x0 /* PA17 periph A */
265 0 16 0x1 0x1 /* PA16 periph A with pullup */
266 0 15 0x1 0x1>; /* PA15 periph A with pullup */
267 };
268
269 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
270 atmel,pins =
271 <0 18 0x1 0x1 /* PA18 periph A with pullup */
272 0 19 0x1 0x1 /* PA19 periph A with pullup */
273 0 20 0x1 0x1>; /* PA20 periph A with pullup */
274 };
275 };
276
277 mmc1 {
278 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 {
279 atmel,pins =
280 <0 13 0x2 0x0 /* PA13 periph B */
281 0 12 0x2 0x1 /* PA12 periph B with pullup */
282 0 11 0x2 0x1>; /* PA11 periph B with pullup */
283 };
284
285 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
286 atmel,pins =
287 <0 2 0x2 0x1 /* PA2 periph B with pullup */
288 0 3 0x2 0x1 /* PA3 periph B with pullup */
289 0 4 0x2 0x1>; /* PA4 periph B with pullup */
290 };
291 };
292
293 pioA: gpio@fffff400 {
294 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
295 reg = <0xfffff400 0x200>;
296 interrupts = <2 4 1>;
297 #gpio-cells = <2>;
298 gpio-controller;
299 interrupt-controller;
300 #interrupt-cells = <2>;
301 };
302
303 pioB: gpio@fffff600 {
304 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
305 reg = <0xfffff600 0x200>;
306 interrupts = <2 4 1>;
307 #gpio-cells = <2>;
308 gpio-controller;
309 #gpio-lines = <19>;
310 interrupt-controller;
311 #interrupt-cells = <2>;
312 };
313
314 pioC: gpio@fffff800 {
315 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
316 reg = <0xfffff800 0x200>;
317 interrupts = <3 4 1>;
318 #gpio-cells = <2>;
319 gpio-controller;
320 interrupt-controller;
321 #interrupt-cells = <2>;
322 };
323
324 pioD: gpio@fffffa00 {
325 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
326 reg = <0xfffffa00 0x200>;
327 interrupts = <3 4 1>;
328 #gpio-cells = <2>;
329 gpio-controller;
330 #gpio-lines = <22>;
331 interrupt-controller;
332 #interrupt-cells = <2>;
333 };
132 }; 334 };
133 335
134 pioC: gpio@fffff800 { 336 mmc0: mmc@f0008000 {
135 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 337 compatible = "atmel,hsmci";
136 reg = <0xfffff800 0x100>; 338 reg = <0xf0008000 0x600>;
137 interrupts = <3 4 1>; 339 interrupts = <12 4 0>;
138 #gpio-cells = <2>; 340 #address-cells = <1>;
139 gpio-controller; 341 #size-cells = <0>;
140 interrupt-controller; 342 status = "disabled";
141 #interrupt-cells = <2>;
142 }; 343 };
143 344
144 pioD: gpio@fffffa00 { 345 mmc1: mmc@f000c000 {
145 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 346 compatible = "atmel,hsmci";
146 reg = <0xfffffa00 0x100>; 347 reg = <0xf000c000 0x600>;
147 interrupts = <3 4 1>; 348 interrupts = <26 4 0>;
148 #gpio-cells = <2>; 349 #address-cells = <1>;
149 gpio-controller; 350 #size-cells = <0>;
150 interrupt-controller; 351 status = "disabled";
151 #interrupt-cells = <2>;
152 }; 352 };
153 353
154 dbgu: serial@fffff200 { 354 dbgu: serial@fffff200 {
155 compatible = "atmel,at91sam9260-usart"; 355 compatible = "atmel,at91sam9260-usart";
156 reg = <0xfffff200 0x200>; 356 reg = <0xfffff200 0x200>;
157 interrupts = <1 4 7>; 357 interrupts = <1 4 7>;
358 pinctrl-names = "default";
359 pinctrl-0 = <&pinctrl_dbgu>;
158 status = "disabled"; 360 status = "disabled";
159 }; 361 };
160 362
@@ -164,6 +366,8 @@
164 interrupts = <5 4 5>; 366 interrupts = <5 4 5>;
165 atmel,use-dma-rx; 367 atmel,use-dma-rx;
166 atmel,use-dma-tx; 368 atmel,use-dma-tx;
369 pinctrl-names = "default";
370 pinctrl-0 = <&pinctrl_usart0>;
167 status = "disabled"; 371 status = "disabled";
168 }; 372 };
169 373
@@ -173,6 +377,8 @@
173 interrupts = <6 4 5>; 377 interrupts = <6 4 5>;
174 atmel,use-dma-rx; 378 atmel,use-dma-rx;
175 atmel,use-dma-tx; 379 atmel,use-dma-tx;
380 pinctrl-names = "default";
381 pinctrl-0 = <&pinctrl_usart1>;
176 status = "disabled"; 382 status = "disabled";
177 }; 383 };
178 384
@@ -182,6 +388,8 @@
182 interrupts = <7 4 5>; 388 interrupts = <7 4 5>;
183 atmel,use-dma-rx; 389 atmel,use-dma-rx;
184 atmel,use-dma-tx; 390 atmel,use-dma-tx;
391 pinctrl-names = "default";
392 pinctrl-0 = <&pinctrl_usart2>;
185 status = "disabled"; 393 status = "disabled";
186 }; 394 };
187 395
@@ -189,6 +397,8 @@
189 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 397 compatible = "cdns,at32ap7000-macb", "cdns,macb";
190 reg = <0xf802c000 0x100>; 398 reg = <0xf802c000 0x100>;
191 interrupts = <24 4 3>; 399 interrupts = <24 4 3>;
400 pinctrl-names = "default";
401 pinctrl-0 = <&pinctrl_macb0_rmii>;
192 status = "disabled"; 402 status = "disabled";
193 }; 403 };
194 404
@@ -273,6 +483,8 @@
273 >; 483 >;
274 atmel,nand-addr-offset = <21>; 484 atmel,nand-addr-offset = <21>;
275 atmel,nand-cmd-offset = <22>; 485 atmel,nand-cmd-offset = <22>;
486 pinctrl-names = "default";
487 pinctrl-0 = <&pinctrl_nand>;
276 gpios = <&pioD 5 0 488 gpios = <&pioD 5 0
277 &pioD 4 0 489 &pioD 4 0
278 0 490 0
diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
new file mode 100644
index 00000000000..8a7cf1d9cf5
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -0,0 +1,101 @@
1/*
2 * at91sam9x5ek.dtsi - Device Tree file for AT91SAM9x5CM Base board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/include/ "at91sam9x5cm.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9X5-EK";
13 compatible = "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
17 };
18
19 ahb {
20 apb {
21 mmc0: mmc@f0008000 {
22 pinctrl-0 = <
23 &pinctrl_board_mmc0
24 &pinctrl_mmc0_slot0_clk_cmd_dat0
25 &pinctrl_mmc0_slot0_dat1_3>;
26 status = "okay";
27 slot@0 {
28 reg = <0>;
29 bus-width = <4>;
30 cd-gpios = <&pioD 15 0>;
31 };
32 };
33
34 mmc1: mmc@f000c000 {
35 pinctrl-0 = <
36 &pinctrl_board_mmc1
37 &pinctrl_mmc1_slot0_clk_cmd_dat0
38 &pinctrl_mmc1_slot0_dat1_3>;
39 status = "okay";
40 slot@0 {
41 reg = <0>;
42 bus-width = <4>;
43 cd-gpios = <&pioD 14 0>;
44 };
45 };
46
47 dbgu: serial@fffff200 {
48 status = "okay";
49 };
50
51 usart0: serial@f801c000 {
52 status = "okay";
53 };
54
55 macb0: ethernet@f802c000 {
56 phy-mode = "rmii";
57 status = "okay";
58 };
59
60 i2c0: i2c@f8010000 {
61 status = "okay";
62 };
63
64 i2c1: i2c@f8014000 {
65 status = "okay";
66 };
67
68 i2c2: i2c@f8018000 {
69 status = "okay";
70 };
71
72 pinctrl@fffff400 {
73 mmc0 {
74 pinctrl_board_mmc0: mmc0-board {
75 atmel,pins =
76 <3 15 0x0 0x5>; /* PD15 gpio CD pin pull up and deglitch */
77 };
78 };
79
80 mmc1 {
81 pinctrl_board_mmc1: mmc1-board {
82 atmel,pins =
83 <3 14 0x0 0x5>; /* PD14 gpio CD pin pull up and deglitch */
84 };
85 };
86 };
87 };
88
89 usb0: ohci@00600000 {
90 status = "okay";
91 num-ports = <2>;
92 atmel,vbus-gpio = <&pioD 19 1
93 &pioD 20 1
94 >;
95 };
96
97 usb1: ehci@00700000 {
98 status = "okay";
99 };
100 };
101};
diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts
new file mode 100644
index 00000000000..248067cf706
--- /dev/null
+++ b/arch/arm/boot/dts/bcm11351-brt.dts
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2012 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14/dts-v1/;
15
16/include/ "bcm11351.dtsi"
17
18/ {
19 model = "BCM11351 BRT board";
20 compatible = "bcm,bcm11351-brt", "bcm,bcm11351";
21
22 memory {
23 reg = <0x80000000 0x40000000>; /* 1 GB */
24 };
25
26 uart@3e000000 {
27 status = "okay";
28 };
29
30};
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
new file mode 100644
index 00000000000..ad135885bd2
--- /dev/null
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2012 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 model = "BCM11351 SoC";
18 compatible = "bcm,bcm11351";
19 interrupt-parent = <&gic>;
20
21 chosen {
22 bootargs = "console=ttyS0,115200n8";
23 };
24
25 gic: interrupt-controller@3ff00100 {
26 compatible = "arm,cortex-a9-gic";
27 #interrupt-cells = <3>;
28 #address-cells = <0>;
29 interrupt-controller;
30 reg = <0x3ff01000 0x1000>,
31 <0x3ff00100 0x100>;
32 };
33
34 uart@3e000000 {
35 compatible = "bcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
36 status = "disabled";
37 reg = <0x3e000000 0x1000>;
38 clock-frequency = <13000000>;
39 interrupts = <0x0 67 0x4>;
40 reg-shift = <2>;
41 reg-io-width = <4>;
42 };
43
44 L2: l2-cache {
45 compatible = "arm,pl310-cache";
46 reg = <0x3ff20000 0x1000>;
47 cache-unified;
48 cache-level = <2>;
49 };
50};
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 7dd860f83f9..9b72054a0bc 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -10,3 +10,18 @@
10 reg = <0 0x10000000>; 10 reg = <0 0x10000000>;
11 }; 11 };
12}; 12};
13
14&gpio {
15 pinctrl-names = "default";
16 pinctrl-0 = <&alt0 &alt3>;
17
18 alt0: alt0 {
19 brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 14 15 40 45>;
20 brcm,function = <4>; /* alt0 */
21 };
22
23 alt3: alt3 {
24 brcm,pins = <48 49 50 51 52 53>;
25 brcm,function = <7>; /* alt3 */
26 };
27};
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 0b619398532..8917550fd1b 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -29,11 +29,39 @@
29 #interrupt-cells = <2>; 29 #interrupt-cells = <2>;
30 }; 30 };
31 31
32 watchdog {
33 compatible = "brcm,bcm2835-pm-wdt";
34 reg = <0x7e100000 0x28>;
35 };
36
32 uart@20201000 { 37 uart@20201000 {
33 compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; 38 compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
34 reg = <0x7e201000 0x1000>; 39 reg = <0x7e201000 0x1000>;
35 interrupts = <2 25>; 40 interrupts = <2 25>;
36 clock-frequency = <3000000>; 41 clock-frequency = <3000000>;
37 }; 42 };
43
44 gpio: gpio {
45 compatible = "brcm,bcm2835-gpio";
46 reg = <0x7e200000 0xb4>;
47 /*
48 * The GPIO IP block is designed for 3 banks of GPIOs.
49 * Each bank has a GPIO interrupt for itself.
50 * There is an overall "any bank" interrupt.
51 * In order, these are GIC interrupts 17, 18, 19, 20.
52 * Since the BCM2835 only has 2 banks, the 2nd bank
53 * interrupt output appears to be mirrored onto the
54 * 3rd bank's interrupt signal.
55 * So, a bank0 interrupt shows up on 17, 20, and
56 * a bank1 interrupt shows up on 18, 19, 20!
57 */
58 interrupts = <2 17>, <2 18>, <2 19>, <2 20>;
59
60 gpio-controller;
61 #gpio-cells = <2>;
62
63 interrupt-controller;
64 #interrupt-cells = <2>;
65 };
38 }; 66 };
39}; 67};
diff --git a/arch/arm/boot/dts/ccu9540.dts b/arch/arm/boot/dts/ccu9540.dts
new file mode 100644
index 00000000000..04305463f00
--- /dev/null
+++ b/arch/arm/boot/dts/ccu9540.dts
@@ -0,0 +1,72 @@
1/*
2 * Copyright 2012 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "dbx5x0.dtsi"
14
15/ {
16 model = "ST-Ericsson CCU9540 platform with Device Tree";
17 compatible = "st-ericsson,ccu9540", "st-ericsson,u9540";
18
19 memory {
20 reg = <0x00000000 0x20000000>;
21 };
22
23 soc-u9500 {
24 uart@80120000 {
25 status = "okay";
26 };
27
28 uart@80121000 {
29 status = "okay";
30 };
31
32 uart@80007000 {
33 status = "okay";
34 };
35
36 // External Micro SD slot
37 sdi0_per1@80126000 {
38 arm,primecell-periphid = <0x10480180>;
39 max-frequency = <100000000>;
40 bus-width = <4>;
41 mmc-cap-sd-highspeed;
42 mmc-cap-mmc-highspeed;
43 vmmc-supply = <&ab8500_ldo_aux3_reg>;
44
45 cd-gpios = <&gpio7 6 0x4>; // 230
46 cd-inverted;
47
48 status = "okay";
49 };
50
51
52 // WLAN SDIO channel
53 sdi1_per2@80118000 {
54 arm,primecell-periphid = <0x10480180>;
55 max-frequency = <50000000>;
56 bus-width = <4>;
57
58 status = "okay";
59 };
60
61 // On-board eMMC
62 sdi4_per2@80114000 {
63 arm,primecell-periphid = <0x10480180>;
64 max-frequency = <100000000>;
65 bus-width = <8>;
66 mmc-cap-mmc-highspeed;
67 vmmc-supply = <&ab8500_ldo_aux2_reg>;
68
69 status = "okay";
70 };
71 };
72};
diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi
new file mode 100644
index 00000000000..fddd1741743
--- /dev/null
+++ b/arch/arm/boot/dts/cros5250-common.dtsi
@@ -0,0 +1,184 @@
1/*
2 * Common device tree include for all Exynos 5250 boards based off of Daisy.
3 *
4 * Copyright (c) 2012 Google, Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11/ {
12 aliases {
13 };
14
15 memory {
16 reg = <0x40000000 0x80000000>;
17 };
18
19 chosen {
20 };
21
22 i2c@12C60000 {
23 samsung,i2c-sda-delay = <100>;
24 samsung,i2c-max-bus-freq = <378000>;
25 gpios = <&gpb3 0 2 3 0>,
26 <&gpb3 1 2 3 0>;
27 };
28
29 i2c@12C70000 {
30 samsung,i2c-sda-delay = <100>;
31 samsung,i2c-max-bus-freq = <378000>;
32 gpios = <&gpb3 2 2 3 0>,
33 <&gpb3 3 2 3 0>;
34 };
35
36 i2c@12C80000 {
37 samsung,i2c-sda-delay = <100>;
38 samsung,i2c-max-bus-freq = <66000>;
39
40 /*
41 * Disabled pullups since external part has its own pullups and
42 * double-pulling gets us out of spec in some cases.
43 */
44 gpios = <&gpa0 6 3 0 0>,
45 <&gpa0 7 3 0 0>;
46
47 hdmiddc@50 {
48 compatible = "samsung,exynos5-hdmiddc";
49 reg = <0x50>;
50 };
51 };
52
53 i2c@12C90000 {
54 samsung,i2c-sda-delay = <100>;
55 samsung,i2c-max-bus-freq = <66000>;
56 gpios = <&gpa1 2 3 3 0>,
57 <&gpa1 3 3 3 0>;
58 };
59
60 i2c@12CA0000 {
61 status = "disabled";
62 };
63
64 i2c@12CB0000 {
65 samsung,i2c-sda-delay = <100>;
66 samsung,i2c-max-bus-freq = <66000>;
67 gpios = <&gpa2 2 3 3 0>,
68 <&gpa2 3 3 3 0>;
69 };
70
71 i2c@12CC0000 {
72 status = "disabled";
73 };
74
75 i2c@12CD0000 {
76 samsung,i2c-sda-delay = <100>;
77 samsung,i2c-max-bus-freq = <66000>;
78 gpios = <&gpb2 2 3 3 0>,
79 <&gpb2 3 3 3 0>;
80 };
81
82 i2c@12CE0000 {
83 samsung,i2c-sda-delay = <100>;
84 samsung,i2c-max-bus-freq = <378000>;
85
86 hdmiphy@38 {
87 compatible = "samsung,exynos5-hdmiphy";
88 reg = <0x38>;
89 };
90 };
91
92 dwmmc0@12200000 {
93 num-slots = <1>;
94 supports-highspeed;
95 broken-cd;
96 fifo-depth = <0x80>;
97 card-detect-delay = <200>;
98 samsung,dw-mshc-ciu-div = <3>;
99 samsung,dw-mshc-sdr-timing = <2 3 3>;
100 samsung,dw-mshc-ddr-timing = <1 2 3>;
101
102 slot@0 {
103 reg = <0>;
104 bus-width = <8>;
105 gpios = <&gpc0 0 2 0 3>, <&gpc0 1 2 0 3>,
106 <&gpc1 0 2 3 3>, <&gpc1 1 2 3 3>,
107 <&gpc1 2 2 3 3>, <&gpc1 3 2 3 3>,
108 <&gpc0 3 2 3 3>, <&gpc0 4 2 3 3>,
109 <&gpc0 5 2 3 3>, <&gpc0 6 2 3 3>;
110 };
111 };
112
113 dwmmc1@12210000 {
114 status = "disabled";
115 };
116
117 dwmmc2@12220000 {
118 num-slots = <1>;
119 supports-highspeed;
120 fifo-depth = <0x80>;
121 card-detect-delay = <200>;
122 samsung,dw-mshc-ciu-div = <3>;
123 samsung,dw-mshc-sdr-timing = <2 3 3>;
124 samsung,dw-mshc-ddr-timing = <1 2 3>;
125
126 slot@0 {
127 reg = <0>;
128 bus-width = <4>;
129 samsung,cd-pinmux-gpio = <&gpc3 2 2 3 3>;
130 wp-gpios = <&gpc2 1 0 0 3>;
131 gpios = <&gpc3 0 2 0 3>, <&gpc3 1 2 0 3>,
132 <&gpc3 3 2 3 3>, <&gpc3 4 2 3 3>,
133 <&gpc3 5 2 3 3>, <&gpc3 6 2 3 3>;
134 };
135 };
136
137 dwmmc3@12230000 {
138 num-slots = <1>;
139 supports-highspeed;
140 broken-cd;
141 fifo-depth = <0x80>;
142 card-detect-delay = <200>;
143 samsung,dw-mshc-ciu-div = <3>;
144 samsung,dw-mshc-sdr-timing = <2 3 3>;
145 samsung,dw-mshc-ddr-timing = <1 2 3>;
146
147 slot@0 {
148 reg = <0>;
149 bus-width = <4>;
150 /* See board-specific dts files for GPIOs */
151 };
152 };
153
154 spi_0: spi@12d20000 {
155 status = "disabled";
156 };
157
158 spi_1: spi@12d30000 {
159 gpios = <&gpa2 4 2 3 0>,
160 <&gpa2 6 2 3 0>,
161 <&gpa2 7 2 3 0>;
162 samsung,spi-src-clk = <0>;
163 num-cs = <1>;
164 };
165
166 spi_2: spi@12d40000 {
167 status = "disabled";
168 };
169
170 hdmi {
171 hpd-gpio = <&gpx3 7 0xf 1 3>;
172 };
173
174 gpio-keys {
175 compatible = "gpio-keys";
176
177 power {
178 label = "Power";
179 gpios = <&gpx1 3 0 0x10000 0>;
180 linux,code = <116>; /* KEY_POWER */
181 gpio-key,wakeup;
182 };
183 };
184};
diff --git a/arch/arm/boot/dts/da850-enbw-cmc.dts b/arch/arm/boot/dts/da850-enbw-cmc.dts
new file mode 100644
index 00000000000..422fdb3fcfc
--- /dev/null
+++ b/arch/arm/boot/dts/da850-enbw-cmc.dts
@@ -0,0 +1,30 @@
1/*
2 * Device Tree for AM1808 EnBW CMC board
3 *
4 * Copyright 2012 DENX Software Engineering GmbH
5 * Heiko Schocher <hs@denx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12/dts-v1/;
13/include/ "da850.dtsi"
14
15/ {
16 compatible = "enbw,cmc", "ti,da850";
17 model = "EnBW CMC";
18
19 soc {
20 serial0: serial@1c42000 {
21 status = "okay";
22 };
23 serial1: serial@1d0c000 {
24 status = "okay";
25 };
26 serial2: serial@1d0d000 {
27 status = "okay";
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
new file mode 100644
index 00000000000..37dc5a3243b
--- /dev/null
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -0,0 +1,28 @@
1/*
2 * Device Tree for DA850 EVM board
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
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, version 2.
9 */
10/dts-v1/;
11/include/ "da850.dtsi"
12
13/ {
14 compatible = "ti,da850-evm", "ti,da850";
15 model = "DA850/AM1808/OMAP-L138 EVM";
16
17 soc {
18 serial0: serial@1c42000 {
19 status = "okay";
20 };
21 serial1: serial@1d0c000 {
22 status = "okay";
23 };
24 serial2: serial@1d0d000 {
25 status = "okay";
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
new file mode 100644
index 00000000000..640ab75c20d
--- /dev/null
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -0,0 +1,60 @@
1/*
2 * Copyright 2012 DENX Software Engineering GmbH
3 * Heiko Schocher <hs@denx.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10/include/ "skeleton.dtsi"
11
12/ {
13 arm {
14 #address-cells = <1>;
15 #size-cells = <1>;
16 ranges;
17 intc: interrupt-controller {
18 compatible = "ti,cp-intc";
19 interrupt-controller;
20 #interrupt-cells = <1>;
21 ti,intc-size = <100>;
22 reg = <0xfffee000 0x2000>;
23 };
24 };
25 soc {
26 compatible = "simple-bus";
27 model = "da850";
28 #address-cells = <1>;
29 #size-cells = <1>;
30 ranges = <0x0 0x01c00000 0x400000>;
31
32 serial0: serial@1c42000 {
33 compatible = "ns16550a";
34 reg = <0x42000 0x100>;
35 clock-frequency = <150000000>;
36 reg-shift = <2>;
37 interrupts = <25>;
38 interrupt-parent = <&intc>;
39 status = "disabled";
40 };
41 serial1: serial@1d0c000 {
42 compatible = "ns16550a";
43 reg = <0x10c000 0x100>;
44 clock-frequency = <150000000>;
45 reg-shift = <2>;
46 interrupts = <53>;
47 interrupt-parent = <&intc>;
48 status = "disabled";
49 };
50 serial2: serial@1d0d000 {
51 compatible = "ns16550a";
52 reg = <0x10d000 0x100>;
53 clock-frequency = <150000000>;
54 reg-shift = <2>;
55 interrupts = <61>;
56 interrupt-parent = <&intc>;
57 status = "disabled";
58 };
59 };
60};
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 4b0e0ca08f4..2efd9c891bc 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -203,129 +203,117 @@
203 reg = <0x80157450 0xC>; 203 reg = <0x80157450 0xC>;
204 }; 204 };
205 205
206 thermal@801573c0 {
207 compatible = "stericsson,db8500-thermal";
208 reg = <0x801573c0 0x40>;
209 interrupts = <21 0x4>, <22 0x4>;
210 interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH";
211 status = "disabled";
212 };
213
206 db8500-prcmu-regulators { 214 db8500-prcmu-regulators {
207 compatible = "stericsson,db8500-prcmu-regulator"; 215 compatible = "stericsson,db8500-prcmu-regulator";
208 216
209 // DB8500_REGULATOR_VAPE 217 // DB8500_REGULATOR_VAPE
210 db8500_vape_reg: db8500_vape { 218 db8500_vape_reg: db8500_vape {
211 regulator-compatible = "db8500_vape"; 219 regulator-compatible = "db8500_vape";
212 regulator-name = "db8500-vape";
213 regulator-always-on; 220 regulator-always-on;
214 }; 221 };
215 222
216 // DB8500_REGULATOR_VARM 223 // DB8500_REGULATOR_VARM
217 db8500_varm_reg: db8500_varm { 224 db8500_varm_reg: db8500_varm {
218 regulator-compatible = "db8500_varm"; 225 regulator-compatible = "db8500_varm";
219 regulator-name = "db8500-varm";
220 }; 226 };
221 227
222 // DB8500_REGULATOR_VMODEM 228 // DB8500_REGULATOR_VMODEM
223 db8500_vmodem_reg: db8500_vmodem { 229 db8500_vmodem_reg: db8500_vmodem {
224 regulator-compatible = "db8500_vmodem"; 230 regulator-compatible = "db8500_vmodem";
225 regulator-name = "db8500-vmodem";
226 }; 231 };
227 232
228 // DB8500_REGULATOR_VPLL 233 // DB8500_REGULATOR_VPLL
229 db8500_vpll_reg: db8500_vpll { 234 db8500_vpll_reg: db8500_vpll {
230 regulator-compatible = "db8500_vpll"; 235 regulator-compatible = "db8500_vpll";
231 regulator-name = "db8500-vpll";
232 }; 236 };
233 237
234 // DB8500_REGULATOR_VSMPS1 238 // DB8500_REGULATOR_VSMPS1
235 db8500_vsmps1_reg: db8500_vsmps1 { 239 db8500_vsmps1_reg: db8500_vsmps1 {
236 regulator-compatible = "db8500_vsmps1"; 240 regulator-compatible = "db8500_vsmps1";
237 regulator-name = "db8500-vsmps1";
238 }; 241 };
239 242
240 // DB8500_REGULATOR_VSMPS2 243 // DB8500_REGULATOR_VSMPS2
241 db8500_vsmps2_reg: db8500_vsmps2 { 244 db8500_vsmps2_reg: db8500_vsmps2 {
242 regulator-compatible = "db8500_vsmps2"; 245 regulator-compatible = "db8500_vsmps2";
243 regulator-name = "db8500-vsmps2";
244 }; 246 };
245 247
246 // DB8500_REGULATOR_VSMPS3 248 // DB8500_REGULATOR_VSMPS3
247 db8500_vsmps3_reg: db8500_vsmps3 { 249 db8500_vsmps3_reg: db8500_vsmps3 {
248 regulator-compatible = "db8500_vsmps3"; 250 regulator-compatible = "db8500_vsmps3";
249 regulator-name = "db8500-vsmps3";
250 }; 251 };
251 252
252 // DB8500_REGULATOR_VRF1 253 // DB8500_REGULATOR_VRF1
253 db8500_vrf1_reg: db8500_vrf1 { 254 db8500_vrf1_reg: db8500_vrf1 {
254 regulator-compatible = "db8500_vrf1"; 255 regulator-compatible = "db8500_vrf1";
255 regulator-name = "db8500-vrf1";
256 }; 256 };
257 257
258 // DB8500_REGULATOR_SWITCH_SVAMMDSP 258 // DB8500_REGULATOR_SWITCH_SVAMMDSP
259 db8500_sva_mmdsp_reg: db8500_sva_mmdsp { 259 db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
260 regulator-compatible = "db8500_sva_mmdsp"; 260 regulator-compatible = "db8500_sva_mmdsp";
261 regulator-name = "db8500-sva-mmdsp";
262 }; 261 };
263 262
264 // DB8500_REGULATOR_SWITCH_SVAMMDSPRET 263 // DB8500_REGULATOR_SWITCH_SVAMMDSPRET
265 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret { 264 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
266 regulator-compatible = "db8500_sva_mmdsp_ret"; 265 regulator-compatible = "db8500_sva_mmdsp_ret";
267 regulator-name = "db8500-sva-mmdsp-ret";
268 }; 266 };
269 267
270 // DB8500_REGULATOR_SWITCH_SVAPIPE 268 // DB8500_REGULATOR_SWITCH_SVAPIPE
271 db8500_sva_pipe_reg: db8500_sva_pipe { 269 db8500_sva_pipe_reg: db8500_sva_pipe {
272 regulator-compatible = "db8500_sva_pipe"; 270 regulator-compatible = "db8500_sva_pipe";
273 regulator-name = "db8500_sva_pipe";
274 }; 271 };
275 272
276 // DB8500_REGULATOR_SWITCH_SIAMMDSP 273 // DB8500_REGULATOR_SWITCH_SIAMMDSP
277 db8500_sia_mmdsp_reg: db8500_sia_mmdsp { 274 db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
278 regulator-compatible = "db8500_sia_mmdsp"; 275 regulator-compatible = "db8500_sia_mmdsp";
279 regulator-name = "db8500_sia_mmdsp";
280 }; 276 };
281 277
282 // DB8500_REGULATOR_SWITCH_SIAMMDSPRET 278 // DB8500_REGULATOR_SWITCH_SIAMMDSPRET
283 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret { 279 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
284 regulator-name = "db8500-sia-mmdsp-ret";
285 }; 280 };
286 281
287 // DB8500_REGULATOR_SWITCH_SIAPIPE 282 // DB8500_REGULATOR_SWITCH_SIAPIPE
288 db8500_sia_pipe_reg: db8500_sia_pipe { 283 db8500_sia_pipe_reg: db8500_sia_pipe {
289 regulator-compatible = "db8500_sia_pipe"; 284 regulator-compatible = "db8500_sia_pipe";
290 regulator-name = "db8500-sia-pipe";
291 }; 285 };
292 286
293 // DB8500_REGULATOR_SWITCH_SGA 287 // DB8500_REGULATOR_SWITCH_SGA
294 db8500_sga_reg: db8500_sga { 288 db8500_sga_reg: db8500_sga {
295 regulator-compatible = "db8500_sga"; 289 regulator-compatible = "db8500_sga";
296 regulator-name = "db8500-sga";
297 vin-supply = <&db8500_vape_reg>; 290 vin-supply = <&db8500_vape_reg>;
298 }; 291 };
299 292
300 // DB8500_REGULATOR_SWITCH_B2R2_MCDE 293 // DB8500_REGULATOR_SWITCH_B2R2_MCDE
301 db8500_b2r2_mcde_reg: db8500_b2r2_mcde { 294 db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
302 regulator-compatible = "db8500_b2r2_mcde"; 295 regulator-compatible = "db8500_b2r2_mcde";
303 regulator-name = "db8500-b2r2-mcde";
304 vin-supply = <&db8500_vape_reg>; 296 vin-supply = <&db8500_vape_reg>;
305 }; 297 };
306 298
307 // DB8500_REGULATOR_SWITCH_ESRAM12 299 // DB8500_REGULATOR_SWITCH_ESRAM12
308 db8500_esram12_reg: db8500_esram12 { 300 db8500_esram12_reg: db8500_esram12 {
309 regulator-compatible = "db8500_esram12"; 301 regulator-compatible = "db8500_esram12";
310 regulator-name = "db8500-esram12";
311 }; 302 };
312 303
313 // DB8500_REGULATOR_SWITCH_ESRAM12RET 304 // DB8500_REGULATOR_SWITCH_ESRAM12RET
314 db8500_esram12_ret_reg: db8500_esram12_ret { 305 db8500_esram12_ret_reg: db8500_esram12_ret {
315 regulator-compatible = "db8500_esram12_ret"; 306 regulator-compatible = "db8500_esram12_ret";
316 regulator-name = "db8500-esram12-ret";
317 }; 307 };
318 308
319 // DB8500_REGULATOR_SWITCH_ESRAM34 309 // DB8500_REGULATOR_SWITCH_ESRAM34
320 db8500_esram34_reg: db8500_esram34 { 310 db8500_esram34_reg: db8500_esram34 {
321 regulator-compatible = "db8500_esram34"; 311 regulator-compatible = "db8500_esram34";
322 regulator-name = "db8500-esram34";
323 }; 312 };
324 313
325 // DB8500_REGULATOR_SWITCH_ESRAM34RET 314 // DB8500_REGULATOR_SWITCH_ESRAM34RET
326 db8500_esram34_ret_reg: db8500_esram34_ret { 315 db8500_esram34_ret_reg: db8500_esram34_ret {
327 regulator-compatible = "db8500_esram34_ret"; 316 regulator-compatible = "db8500_esram34_ret";
328 regulator-name = "db8500-esram34-ret";
329 }; 317 };
330 }; 318 };
331 319
@@ -352,7 +340,33 @@
352 vddadc-supply = <&ab8500_ldo_tvout_reg>; 340 vddadc-supply = <&ab8500_ldo_tvout_reg>;
353 }; 341 };
354 342
355 ab8500-usb { 343 ab8500_battery: ab8500_battery {
344 stericsson,battery-type = "LIPO";
345 thermistor-on-batctrl;
346 };
347
348 ab8500_fg {
349 compatible = "stericsson,ab8500-fg";
350 battery = <&ab8500_battery>;
351 };
352
353 ab8500_btemp {
354 compatible = "stericsson,ab8500-btemp";
355 battery = <&ab8500_battery>;
356 };
357
358 ab8500_charger {
359 compatible = "stericsson,ab8500-charger";
360 battery = <&ab8500_battery>;
361 vddadc-supply = <&ab8500_ldo_tvout_reg>;
362 };
363
364 ab8500_chargalg {
365 compatible = "stericsson,ab8500-chargalg";
366 battery = <&ab8500_battery>;
367 };
368
369 ab8500_usb {
356 compatible = "stericsson,ab8500-usb"; 370 compatible = "stericsson,ab8500-usb";
357 interrupts = < 90 0x4 371 interrupts = < 90 0x4
358 96 0x4 372 96 0x4
@@ -404,7 +418,6 @@
404 // supplies to the display/camera 418 // supplies to the display/camera
405 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 419 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
406 regulator-compatible = "ab8500_ldo_aux1"; 420 regulator-compatible = "ab8500_ldo_aux1";
407 regulator-name = "V-DISPLAY";
408 regulator-min-microvolt = <2500000>; 421 regulator-min-microvolt = <2500000>;
409 regulator-max-microvolt = <2900000>; 422 regulator-max-microvolt = <2900000>;
410 regulator-boot-on; 423 regulator-boot-on;
@@ -415,7 +428,6 @@
415 // supplies to the on-board eMMC 428 // supplies to the on-board eMMC
416 ab8500_ldo_aux2_reg: ab8500_ldo_aux2 { 429 ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
417 regulator-compatible = "ab8500_ldo_aux2"; 430 regulator-compatible = "ab8500_ldo_aux2";
418 regulator-name = "V-eMMC1";
419 regulator-min-microvolt = <1100000>; 431 regulator-min-microvolt = <1100000>;
420 regulator-max-microvolt = <3300000>; 432 regulator-max-microvolt = <3300000>;
421 }; 433 };
@@ -423,7 +435,6 @@
423 // supply for VAUX3; SDcard slots 435 // supply for VAUX3; SDcard slots
424 ab8500_ldo_aux3_reg: ab8500_ldo_aux3 { 436 ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
425 regulator-compatible = "ab8500_ldo_aux3"; 437 regulator-compatible = "ab8500_ldo_aux3";
426 regulator-name = "V-MMC-SD";
427 regulator-min-microvolt = <1100000>; 438 regulator-min-microvolt = <1100000>;
428 regulator-max-microvolt = <3300000>; 439 regulator-max-microvolt = <3300000>;
429 }; 440 };
@@ -431,49 +442,41 @@
431 // supply for v-intcore12; VINTCORE12 LDO 442 // supply for v-intcore12; VINTCORE12 LDO
432 ab8500_ldo_initcore_reg: ab8500_ldo_initcore { 443 ab8500_ldo_initcore_reg: ab8500_ldo_initcore {
433 regulator-compatible = "ab8500_ldo_initcore"; 444 regulator-compatible = "ab8500_ldo_initcore";
434 regulator-name = "V-INTCORE";
435 }; 445 };
436 446
437 // supply for tvout; gpadc; TVOUT LDO 447 // supply for tvout; gpadc; TVOUT LDO
438 ab8500_ldo_tvout_reg: ab8500_ldo_tvout { 448 ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
439 regulator-compatible = "ab8500_ldo_tvout"; 449 regulator-compatible = "ab8500_ldo_tvout";
440 regulator-name = "V-TVOUT";
441 }; 450 };
442 451
443 // supply for ab8500-usb; USB LDO 452 // supply for ab8500-usb; USB LDO
444 ab8500_ldo_usb_reg: ab8500_ldo_usb { 453 ab8500_ldo_usb_reg: ab8500_ldo_usb {
445 regulator-compatible = "ab8500_ldo_usb"; 454 regulator-compatible = "ab8500_ldo_usb";
446 regulator-name = "dummy";
447 }; 455 };
448 456
449 // supply for ab8500-vaudio; VAUDIO LDO 457 // supply for ab8500-vaudio; VAUDIO LDO
450 ab8500_ldo_audio_reg: ab8500_ldo_audio { 458 ab8500_ldo_audio_reg: ab8500_ldo_audio {
451 regulator-compatible = "ab8500_ldo_audio"; 459 regulator-compatible = "ab8500_ldo_audio";
452 regulator-name = "V-AUD";
453 }; 460 };
454 461
455 // supply for v-anamic1 VAMic1-LDO 462 // supply for v-anamic1 VAMic1-LDO
456 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 { 463 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
457 regulator-compatible = "ab8500_ldo_anamic1"; 464 regulator-compatible = "ab8500_ldo_anamic1";
458 regulator-name = "V-AMIC1";
459 }; 465 };
460 466
461 // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1 467 // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1
462 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { 468 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 {
463 regulator-compatible = "ab8500_ldo_amamic2"; 469 regulator-compatible = "ab8500_ldo_amamic2";
464 regulator-name = "V-AMIC2";
465 }; 470 };
466 471
467 // supply for v-dmic; VDMIC LDO 472 // supply for v-dmic; VDMIC LDO
468 ab8500_ldo_dmic_reg: ab8500_ldo_dmic { 473 ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
469 regulator-compatible = "ab8500_ldo_dmic"; 474 regulator-compatible = "ab8500_ldo_dmic";
470 regulator-name = "V-DMIC";
471 }; 475 };
472 476
473 // supply for U8500 CSI/DSI; VANA LDO 477 // supply for U8500 CSI/DSI; VANA LDO
474 ab8500_ldo_ana_reg: ab8500_ldo_ana { 478 ab8500_ldo_ana_reg: ab8500_ldo_ana {
475 regulator-compatible = "ab8500_ldo_ana"; 479 regulator-compatible = "ab8500_ldo_ana";
476 regulator-name = "V-CSI/DSI";
477 }; 480 };
478 }; 481 };
479 }; 482 };
@@ -577,42 +580,42 @@
577 status = "disabled"; 580 status = "disabled";
578 }; 581 };
579 582
580 sdi@80126000 { 583 sdi0_per1@80126000 {
581 compatible = "arm,pl18x", "arm,primecell"; 584 compatible = "arm,pl18x", "arm,primecell";
582 reg = <0x80126000 0x1000>; 585 reg = <0x80126000 0x1000>;
583 interrupts = <0 60 0x4>; 586 interrupts = <0 60 0x4>;
584 status = "disabled"; 587 status = "disabled";
585 }; 588 };
586 589
587 sdi@80118000 { 590 sdi1_per2@80118000 {
588 compatible = "arm,pl18x", "arm,primecell"; 591 compatible = "arm,pl18x", "arm,primecell";
589 reg = <0x80118000 0x1000>; 592 reg = <0x80118000 0x1000>;
590 interrupts = <0 50 0x4>; 593 interrupts = <0 50 0x4>;
591 status = "disabled"; 594 status = "disabled";
592 }; 595 };
593 596
594 sdi@80005000 { 597 sdi2_per3@80005000 {
595 compatible = "arm,pl18x", "arm,primecell"; 598 compatible = "arm,pl18x", "arm,primecell";
596 reg = <0x80005000 0x1000>; 599 reg = <0x80005000 0x1000>;
597 interrupts = <0 41 0x4>; 600 interrupts = <0 41 0x4>;
598 status = "disabled"; 601 status = "disabled";
599 }; 602 };
600 603
601 sdi@80119000 { 604 sdi3_per2@80119000 {
602 compatible = "arm,pl18x", "arm,primecell"; 605 compatible = "arm,pl18x", "arm,primecell";
603 reg = <0x80119000 0x1000>; 606 reg = <0x80119000 0x1000>;
604 interrupts = <0 59 0x4>; 607 interrupts = <0 59 0x4>;
605 status = "disabled"; 608 status = "disabled";
606 }; 609 };
607 610
608 sdi@80114000 { 611 sdi4_per2@80114000 {
609 compatible = "arm,pl18x", "arm,primecell"; 612 compatible = "arm,pl18x", "arm,primecell";
610 reg = <0x80114000 0x1000>; 613 reg = <0x80114000 0x1000>;
611 interrupts = <0 99 0x4>; 614 interrupts = <0 99 0x4>;
612 status = "disabled"; 615 status = "disabled";
613 }; 616 };
614 617
615 sdi@80008000 { 618 sdi5_per3@80008000 {
616 compatible = "arm,pl18x", "arm,primecell"; 619 compatible = "arm,pl18x", "arm,primecell";
617 reg = <0x80008000 0x1000>; 620 reg = <0x80008000 0x1000>;
618 interrupts = <0 100 0x4>; 621 interrupts = <0 100 0x4>;
@@ -660,5 +663,24 @@
660 ranges = <0 0x50000000 0x4000000>; 663 ranges = <0 0x50000000 0x4000000>;
661 status = "disabled"; 664 status = "disabled";
662 }; 665 };
666
667 cpufreq-cooling {
668 compatible = "stericsson,db8500-cpufreq-cooling";
669 status = "disabled";
670 };
671
672 vmmci: regulator-gpio {
673 compatible = "regulator-gpio";
674
675 regulator-min-microvolt = <1800000>;
676 regulator-max-microvolt = <2600000>;
677 regulator-name = "mmci-reg";
678 regulator-type = "voltage";
679
680 states = <1800000 0x1
681 2900000 0x0>;
682
683 status = "disabled";
684 };
663 }; 685 };
664}; 686};
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index 0adbd5a3809..fed7d3f9f43 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -40,3 +40,13 @@
40 reg = <0>; 40 reg = <0>;
41 }; 41 };
42}; 42};
43
44&pinctrl {
45 pinctrl-0 = <&pmx_gpio_18>;
46 pinctrl-names = "default";
47
48 pmx_gpio_18: pmx-gpio-18 {
49 marvell,pins = "mpp18";
50 marvell,function = "gpio";
51 };
52};
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 5a00022383e..61f391412a5 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -4,6 +4,12 @@
4 compatible = "marvell,dove"; 4 compatible = "marvell,dove";
5 model = "Marvell Armada 88AP510 SoC"; 5 model = "Marvell Armada 88AP510 SoC";
6 6
7 aliases {
8 gpio0 = &gpio0;
9 gpio1 = &gpio1;
10 gpio2 = &gpio2;
11 };
12
7 soc@f1000000 { 13 soc@f1000000 {
8 compatible = "simple-bus"; 14 compatible = "simple-bus";
9 #address-cells = <1>; 15 #address-cells = <1>;
@@ -72,7 +78,8 @@
72 #gpio-cells = <2>; 78 #gpio-cells = <2>;
73 gpio-controller; 79 gpio-controller;
74 reg = <0xd0400 0x20>; 80 reg = <0xd0400 0x20>;
75 ngpio = <32>; 81 ngpios = <32>;
82 interrupt-controller;
76 interrupts = <12>, <13>, <14>, <60>; 83 interrupts = <12>, <13>, <14>, <60>;
77 }; 84 };
78 85
@@ -81,7 +88,8 @@
81 #gpio-cells = <2>; 88 #gpio-cells = <2>;
82 gpio-controller; 89 gpio-controller;
83 reg = <0xd0420 0x20>; 90 reg = <0xd0420 0x20>;
84 ngpio = <32>; 91 ngpios = <32>;
92 interrupt-controller;
85 interrupts = <61>; 93 interrupts = <61>;
86 }; 94 };
87 95
@@ -90,7 +98,12 @@
90 #gpio-cells = <2>; 98 #gpio-cells = <2>;
91 gpio-controller; 99 gpio-controller;
92 reg = <0xe8400 0x0c>; 100 reg = <0xe8400 0x0c>;
93 ngpio = <8>; 101 ngpios = <8>;
102 };
103
104 pinctrl: pinctrl@d0200 {
105 compatible = "marvell,dove-pinctrl";
106 reg = <0xd0200 0x10>;
94 }; 107 };
95 108
96 spi0: spi@10600 { 109 spi0: spi@10600 {
diff --git a/arch/arm/boot/dts/ecx-2000.dts b/arch/arm/boot/dts/ecx-2000.dts
new file mode 100644
index 00000000000..46477ac1de9
--- /dev/null
+++ b/arch/arm/boot/dts/ecx-2000.dts
@@ -0,0 +1,104 @@
1/*
2 * Copyright 2011-2012 Calxeda, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/dts-v1/;
18
19/* First 4KB has pen for secondary cores. */
20/memreserve/ 0x00000000 0x0001000;
21
22/ {
23 model = "Calxeda ECX-2000";
24 compatible = "calxeda,ecx-2000";
25 #address-cells = <2>;
26 #size-cells = <2>;
27 clock-ranges;
28
29 cpus {
30 #address-cells = <1>;
31 #size-cells = <0>;
32
33 cpu@0 {
34 compatible = "arm,cortex-a15";
35 reg = <0>;
36 clocks = <&a9pll>;
37 clock-names = "cpu";
38 };
39
40 cpu@1 {
41 compatible = "arm,cortex-a15";
42 reg = <1>;
43 clocks = <&a9pll>;
44 clock-names = "cpu";
45 };
46
47 cpu@2 {
48 compatible = "arm,cortex-a15";
49 reg = <2>;
50 clocks = <&a9pll>;
51 clock-names = "cpu";
52 };
53
54 cpu@3 {
55 compatible = "arm,cortex-a15";
56 reg = <3>;
57 clocks = <&a9pll>;
58 clock-names = "cpu";
59 };
60 };
61
62 memory@0 {
63 name = "memory";
64 device_type = "memory";
65 reg = <0x00000000 0x00000000 0x00000000 0xff800000>;
66 };
67
68 memory@200000000 {
69 name = "memory";
70 device_type = "memory";
71 reg = <0x00000002 0x00000000 0x00000003 0x00000000>;
72 };
73
74 soc {
75 ranges = <0x00000000 0x00000000 0x00000000 0xffffffff>;
76
77 timer {
78 compatible = "arm,cortex-a15-timer", "arm,armv7-timer"; interrupts = <1 13 0xf08>,
79 <1 14 0xf08>,
80 <1 11 0xf08>,
81 <1 10 0xf08>;
82 };
83
84 intc: interrupt-controller@fff11000 {
85 compatible = "arm,cortex-a15-gic";
86 #interrupt-cells = <3>;
87 #size-cells = <0>;
88 #address-cells = <1>;
89 interrupt-controller;
90 interrupts = <1 9 0xf04>;
91 reg = <0xfff11000 0x1000>,
92 <0xfff12000 0x1000>,
93 <0xfff14000 0x2000>,
94 <0xfff16000 0x2000>;
95 };
96
97 pmu {
98 compatible = "arm,cortex-a9-pmu";
99 interrupts = <0 76 4 0 75 4 0 74 4 0 73 4>;
100 };
101 };
102};
103
104/include/ "ecx-common.dtsi"
diff --git a/arch/arm/boot/dts/ecx-common.dtsi b/arch/arm/boot/dts/ecx-common.dtsi
new file mode 100644
index 00000000000..d61b535f682
--- /dev/null
+++ b/arch/arm/boot/dts/ecx-common.dtsi
@@ -0,0 +1,237 @@
1/*
2 * Copyright 2011-2012 Calxeda, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/ {
18 chosen {
19 bootargs = "console=ttyAMA0";
20 };
21
22 soc {
23 #address-cells = <1>;
24 #size-cells = <1>;
25 compatible = "simple-bus";
26 interrupt-parent = <&intc>;
27
28 sata@ffe08000 {
29 compatible = "calxeda,hb-ahci";
30 reg = <0xffe08000 0x10000>;
31 interrupts = <0 83 4>;
32 dma-coherent;
33 calxeda,port-phys = <&combophy5 0 &combophy0 0
34 &combophy0 1 &combophy0 2
35 &combophy0 3>;
36 };
37
38 sdhci@ffe0e000 {
39 compatible = "calxeda,hb-sdhci";
40 reg = <0xffe0e000 0x1000>;
41 interrupts = <0 90 4>;
42 clocks = <&eclk>;
43 status = "disabled";
44 };
45
46 memory-controller@fff00000 {
47 compatible = "calxeda,hb-ddr-ctrl";
48 reg = <0xfff00000 0x1000>;
49 interrupts = <0 91 4>;
50 };
51
52 ipc@fff20000 {
53 compatible = "arm,pl320", "arm,primecell";
54 reg = <0xfff20000 0x1000>;
55 interrupts = <0 7 4>;
56 clocks = <&pclk>;
57 clock-names = "apb_pclk";
58 };
59
60 gpioe: gpio@fff30000 {
61 #gpio-cells = <2>;
62 compatible = "arm,pl061", "arm,primecell";
63 gpio-controller;
64 reg = <0xfff30000 0x1000>;
65 interrupts = <0 14 4>;
66 clocks = <&pclk>;
67 clock-names = "apb_pclk";
68 status = "disabled";
69 };
70
71 gpiof: gpio@fff31000 {
72 #gpio-cells = <2>;
73 compatible = "arm,pl061", "arm,primecell";
74 gpio-controller;
75 reg = <0xfff31000 0x1000>;
76 interrupts = <0 15 4>;
77 clocks = <&pclk>;
78 clock-names = "apb_pclk";
79 status = "disabled";
80 };
81
82 gpiog: gpio@fff32000 {
83 #gpio-cells = <2>;
84 compatible = "arm,pl061", "arm,primecell";
85 gpio-controller;
86 reg = <0xfff32000 0x1000>;
87 interrupts = <0 16 4>;
88 clocks = <&pclk>;
89 clock-names = "apb_pclk";
90 status = "disabled";
91 };
92
93 gpioh: gpio@fff33000 {
94 #gpio-cells = <2>;
95 compatible = "arm,pl061", "arm,primecell";
96 gpio-controller;
97 reg = <0xfff33000 0x1000>;
98 interrupts = <0 17 4>;
99 clocks = <&pclk>;
100 clock-names = "apb_pclk";
101 status = "disabled";
102 };
103
104 timer@fff34000 {
105 compatible = "arm,sp804", "arm,primecell";
106 reg = <0xfff34000 0x1000>;
107 interrupts = <0 18 4>;
108 clocks = <&pclk>;
109 clock-names = "apb_pclk";
110 };
111
112 rtc@fff35000 {
113 compatible = "arm,pl031", "arm,primecell";
114 reg = <0xfff35000 0x1000>;
115 interrupts = <0 19 4>;
116 clocks = <&pclk>;
117 clock-names = "apb_pclk";
118 };
119
120 serial@fff36000 {
121 compatible = "arm,pl011", "arm,primecell";
122 reg = <0xfff36000 0x1000>;
123 interrupts = <0 20 4>;
124 clocks = <&pclk>;
125 clock-names = "apb_pclk";
126 };
127
128 smic@fff3a000 {
129 compatible = "ipmi-smic";
130 device_type = "ipmi";
131 reg = <0xfff3a000 0x1000>;
132 interrupts = <0 24 4>;
133 reg-size = <4>;
134 reg-spacing = <4>;
135 };
136
137 sregs@fff3c000 {
138 compatible = "calxeda,hb-sregs";
139 reg = <0xfff3c000 0x1000>;
140
141 clocks {
142 #address-cells = <1>;
143 #size-cells = <0>;
144
145 osc: oscillator {
146 #clock-cells = <0>;
147 compatible = "fixed-clock";
148 clock-frequency = <33333000>;
149 };
150
151 ddrpll: ddrpll {
152 #clock-cells = <0>;
153 compatible = "calxeda,hb-pll-clock";
154 clocks = <&osc>;
155 reg = <0x108>;
156 };
157
158 a9pll: a9pll {
159 #clock-cells = <0>;
160 compatible = "calxeda,hb-pll-clock";
161 clocks = <&osc>;
162 reg = <0x100>;
163 };
164
165 a9periphclk: a9periphclk {
166 #clock-cells = <0>;
167 compatible = "calxeda,hb-a9periph-clock";
168 clocks = <&a9pll>;
169 reg = <0x104>;
170 };
171
172 a9bclk: a9bclk {
173 #clock-cells = <0>;
174 compatible = "calxeda,hb-a9bus-clock";
175 clocks = <&a9pll>;
176 reg = <0x104>;
177 };
178
179 emmcpll: emmcpll {
180 #clock-cells = <0>;
181 compatible = "calxeda,hb-pll-clock";
182 clocks = <&osc>;
183 reg = <0x10C>;
184 };
185
186 eclk: eclk {
187 #clock-cells = <0>;
188 compatible = "calxeda,hb-emmc-clock";
189 clocks = <&emmcpll>;
190 reg = <0x114>;
191 };
192
193 pclk: pclk {
194 #clock-cells = <0>;
195 compatible = "fixed-clock";
196 clock-frequency = <150000000>;
197 };
198 };
199 };
200
201 dma@fff3d000 {
202 compatible = "arm,pl330", "arm,primecell";
203 reg = <0xfff3d000 0x1000>;
204 interrupts = <0 92 4>;
205 clocks = <&pclk>;
206 clock-names = "apb_pclk";
207 };
208
209 ethernet@fff50000 {
210 compatible = "calxeda,hb-xgmac";
211 reg = <0xfff50000 0x1000>;
212 interrupts = <0 77 4 0 78 4 0 79 4>;
213 dma-coherent;
214 };
215
216 ethernet@fff51000 {
217 compatible = "calxeda,hb-xgmac";
218 reg = <0xfff51000 0x1000>;
219 interrupts = <0 80 4 0 81 4 0 82 4>;
220 dma-coherent;
221 };
222
223 combophy0: combo-phy@fff58000 {
224 compatible = "calxeda,hb-combophy";
225 #phy-cells = <1>;
226 reg = <0xfff58000 0x1000>;
227 phydev = <5>;
228 };
229
230 combophy5: combo-phy@fff5d000 {
231 compatible = "calxeda,hb-combophy";
232 #phy-cells = <1>;
233 reg = <0xfff5d000 0x1000>;
234 phydev = <31>;
235 };
236 };
237};
diff --git a/arch/arm/boot/dts/evk-pro3.dts b/arch/arm/boot/dts/evk-pro3.dts
index b7354e6506d..96e50f56943 100644
--- a/arch/arm/boot/dts/evk-pro3.dts
+++ b/arch/arm/boot/dts/evk-pro3.dts
@@ -22,10 +22,22 @@
22 status = "okay"; 22 status = "okay";
23 }; 23 };
24 24
25 usart0: serial@fffb0000 {
26 status = "okay";
27 };
28
29 usart2: serial@fffb8000 {
30 status = "okay";
31 };
32
25 usb1: gadget@fffa4000 { 33 usb1: gadget@fffa4000 {
26 atmel,vbus-gpio = <&pioC 5 0>; 34 atmel,vbus-gpio = <&pioC 5 0>;
27 status = "okay"; 35 status = "okay";
28 }; 36 };
37
38 watchdog@fffffd40 {
39 status = "okay";
40 };
29 }; 41 };
30 42
31 usb0: ohci@00500000 { 43 usb0: ohci@00500000 {
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index a26c3dd5826..e1347fceb5b 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -28,6 +28,44 @@
28 spi0 = &spi_0; 28 spi0 = &spi_0;
29 spi1 = &spi_1; 29 spi1 = &spi_1;
30 spi2 = &spi_2; 30 spi2 = &spi_2;
31 i2c0 = &i2c_0;
32 i2c1 = &i2c_1;
33 i2c2 = &i2c_2;
34 i2c3 = &i2c_3;
35 i2c4 = &i2c_4;
36 i2c5 = &i2c_5;
37 i2c6 = &i2c_6;
38 i2c7 = &i2c_7;
39 };
40
41 pd_mfc: mfc-power-domain@10023C40 {
42 compatible = "samsung,exynos4210-pd";
43 reg = <0x10023C40 0x20>;
44 };
45
46 pd_g3d: g3d-power-domain@10023C60 {
47 compatible = "samsung,exynos4210-pd";
48 reg = <0x10023C60 0x20>;
49 };
50
51 pd_lcd0: lcd0-power-domain@10023C80 {
52 compatible = "samsung,exynos4210-pd";
53 reg = <0x10023C80 0x20>;
54 };
55
56 pd_tv: tv-power-domain@10023C20 {
57 compatible = "samsung,exynos4210-pd";
58 reg = <0x10023C20 0x20>;
59 };
60
61 pd_cam: cam-power-domain@10023C00 {
62 compatible = "samsung,exynos4210-pd";
63 reg = <0x10023C00 0x20>;
64 };
65
66 pd_gps: gps-power-domain@10023CE0 {
67 compatible = "samsung,exynos4210-pd";
68 reg = <0x10023CE0 0x20>;
31 }; 69 };
32 70
33 gic:interrupt-controller@10490000 { 71 gic:interrupt-controller@10490000 {
@@ -121,7 +159,7 @@
121 status = "disabled"; 159 status = "disabled";
122 }; 160 };
123 161
124 i2c@13860000 { 162 i2c_0: i2c@13860000 {
125 #address-cells = <1>; 163 #address-cells = <1>;
126 #size-cells = <0>; 164 #size-cells = <0>;
127 compatible = "samsung,s3c2440-i2c"; 165 compatible = "samsung,s3c2440-i2c";
@@ -130,7 +168,7 @@
130 status = "disabled"; 168 status = "disabled";
131 }; 169 };
132 170
133 i2c@13870000 { 171 i2c_1: i2c@13870000 {
134 #address-cells = <1>; 172 #address-cells = <1>;
135 #size-cells = <0>; 173 #size-cells = <0>;
136 compatible = "samsung,s3c2440-i2c"; 174 compatible = "samsung,s3c2440-i2c";
@@ -139,7 +177,7 @@
139 status = "disabled"; 177 status = "disabled";
140 }; 178 };
141 179
142 i2c@13880000 { 180 i2c_2: i2c@13880000 {
143 #address-cells = <1>; 181 #address-cells = <1>;
144 #size-cells = <0>; 182 #size-cells = <0>;
145 compatible = "samsung,s3c2440-i2c"; 183 compatible = "samsung,s3c2440-i2c";
@@ -148,7 +186,7 @@
148 status = "disabled"; 186 status = "disabled";
149 }; 187 };
150 188
151 i2c@13890000 { 189 i2c_3: i2c@13890000 {
152 #address-cells = <1>; 190 #address-cells = <1>;
153 #size-cells = <0>; 191 #size-cells = <0>;
154 compatible = "samsung,s3c2440-i2c"; 192 compatible = "samsung,s3c2440-i2c";
@@ -157,7 +195,7 @@
157 status = "disabled"; 195 status = "disabled";
158 }; 196 };
159 197
160 i2c@138A0000 { 198 i2c_4: i2c@138A0000 {
161 #address-cells = <1>; 199 #address-cells = <1>;
162 #size-cells = <0>; 200 #size-cells = <0>;
163 compatible = "samsung,s3c2440-i2c"; 201 compatible = "samsung,s3c2440-i2c";
@@ -166,7 +204,7 @@
166 status = "disabled"; 204 status = "disabled";
167 }; 205 };
168 206
169 i2c@138B0000 { 207 i2c_5: i2c@138B0000 {
170 #address-cells = <1>; 208 #address-cells = <1>;
171 #size-cells = <0>; 209 #size-cells = <0>;
172 compatible = "samsung,s3c2440-i2c"; 210 compatible = "samsung,s3c2440-i2c";
@@ -175,7 +213,7 @@
175 status = "disabled"; 213 status = "disabled";
176 }; 214 };
177 215
178 i2c@138C0000 { 216 i2c_6: i2c@138C0000 {
179 #address-cells = <1>; 217 #address-cells = <1>;
180 #size-cells = <0>; 218 #size-cells = <0>;
181 compatible = "samsung,s3c2440-i2c"; 219 compatible = "samsung,s3c2440-i2c";
@@ -184,7 +222,7 @@
184 status = "disabled"; 222 status = "disabled";
185 }; 223 };
186 224
187 i2c@138D0000 { 225 i2c_7: i2c@138D0000 {
188 #address-cells = <1>; 226 #address-cells = <1>;
189 #size-cells = <0>; 227 #size-cells = <0>;
190 compatible = "samsung,s3c2440-i2c"; 228 compatible = "samsung,s3c2440-i2c";
@@ -244,5 +282,11 @@
244 reg = <0x12690000 0x1000>; 282 reg = <0x12690000 0x1000>;
245 interrupts = <0 36 0>; 283 interrupts = <0 36 0>;
246 }; 284 };
285
286 mdma1: mdma@12850000 {
287 compatible = "arm,pl330", "arm,primecell";
288 reg = <0x12850000 0x1000>;
289 interrupts = <0 34 0>;
290 };
247 }; 291 };
248}; 292};
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts
index 3e68f52e845..f2710018e84 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -22,38 +22,54 @@
22 compatible = "insignal,origen", "samsung,exynos4210"; 22 compatible = "insignal,origen", "samsung,exynos4210";
23 23
24 memory { 24 memory {
25 reg = <0x40000000 0x40000000>; 25 reg = <0x40000000 0x10000000
26 0x50000000 0x10000000
27 0x60000000 0x10000000
28 0x70000000 0x10000000>;
26 }; 29 };
27 30
28 chosen { 31 chosen {
29 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; 32 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc";
30 }; 33 };
31 34
35 mmc_reg: voltage-regulator {
36 compatible = "regulator-fixed";
37 regulator-name = "VMEM_VDD_2.8V";
38 regulator-min-microvolt = <2800000>;
39 regulator-max-microvolt = <2800000>;
40 gpio = <&gpx1 1 0>;
41 enable-active-high;
42 };
43
32 sdhci@12530000 { 44 sdhci@12530000 {
33 samsung,sdhci-bus-width = <4>; 45 bus-width = <4>;
34 linux,mmc_cap_4_bit_data; 46 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>;
35 samsung,sdhci-cd-internal; 47 pinctrl-names = "default";
36 gpio-cd = <&gpk2 2 2 3 3>; 48 vmmc-supply = <&mmc_reg>;
37 gpios = <&gpk2 0 2 0 3>,
38 <&gpk2 1 2 0 3>,
39 <&gpk2 3 2 3 3>,
40 <&gpk2 4 2 3 3>,
41 <&gpk2 5 2 3 3>,
42 <&gpk2 6 2 3 3>;
43 status = "okay"; 49 status = "okay";
44 }; 50 };
45 51
46 sdhci@12510000 { 52 sdhci@12510000 {
47 samsung,sdhci-bus-width = <4>; 53 bus-width = <4>;
48 linux,mmc_cap_4_bit_data; 54 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_cd>;
49 samsung,sdhci-cd-internal; 55 pinctrl-names = "default";
50 gpio-cd = <&gpk0 2 2 3 3>; 56 vmmc-supply = <&mmc_reg>;
51 gpios = <&gpk0 0 2 0 3>, 57 status = "okay";
52 <&gpk0 1 2 0 3>, 58 };
53 <&gpk0 3 2 3 3>, 59
54 <&gpk0 4 2 3 3>, 60 serial@13800000 {
55 <&gpk0 5 2 3 3>, 61 status = "okay";
56 <&gpk0 6 2 3 3>; 62 };
63
64 serial@13810000 {
65 status = "okay";
66 };
67
68 serial@13820000 {
69 status = "okay";
70 };
71
72 serial@13830000 {
57 status = "okay"; 73 status = "okay";
58 }; 74 };
59 75
@@ -64,35 +80,35 @@
64 80
65 up { 81 up {
66 label = "Up"; 82 label = "Up";
67 gpios = <&gpx2 0 0 0x10000 2>; 83 gpios = <&gpx2 0 1>;
68 linux,code = <103>; 84 linux,code = <103>;
69 gpio-key,wakeup; 85 gpio-key,wakeup;
70 }; 86 };
71 87
72 down { 88 down {
73 label = "Down"; 89 label = "Down";
74 gpios = <&gpx2 1 0 0x10000 2>; 90 gpios = <&gpx2 1 1>;
75 linux,code = <108>; 91 linux,code = <108>;
76 gpio-key,wakeup; 92 gpio-key,wakeup;
77 }; 93 };
78 94
79 back { 95 back {
80 label = "Back"; 96 label = "Back";
81 gpios = <&gpx1 7 0 0x10000 2>; 97 gpios = <&gpx1 7 1>;
82 linux,code = <158>; 98 linux,code = <158>;
83 gpio-key,wakeup; 99 gpio-key,wakeup;
84 }; 100 };
85 101
86 home { 102 home {
87 label = "Home"; 103 label = "Home";
88 gpios = <&gpx1 6 0 0x10000 2>; 104 gpios = <&gpx1 6 1>;
89 linux,code = <102>; 105 linux,code = <102>;
90 gpio-key,wakeup; 106 gpio-key,wakeup;
91 }; 107 };
92 108
93 menu { 109 menu {
94 label = "Menu"; 110 label = "Menu";
95 gpios = <&gpx1 5 0 0x10000 2>; 111 gpios = <&gpx1 5 1>;
96 linux,code = <139>; 112 linux,code = <139>;
97 gpio-key,wakeup; 113 gpio-key,wakeup;
98 }; 114 };
@@ -101,7 +117,7 @@
101 leds { 117 leds {
102 compatible = "gpio-leds"; 118 compatible = "gpio-leds";
103 status { 119 status {
104 gpios = <&gpx1 3 0 0x10000 2>; 120 gpios = <&gpx1 3 1>;
105 linux,default-trigger = "heartbeat"; 121 linux,default-trigger = "heartbeat";
106 }; 122 };
107 }; 123 };
diff --git a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
index b12cf272ad0..55a2efb763d 100644
--- a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
@@ -16,6 +16,134 @@
16 16
17/ { 17/ {
18 pinctrl@11400000 { 18 pinctrl@11400000 {
19 gpa0: gpa0 {
20 gpio-controller;
21 #gpio-cells = <2>;
22
23 interrupt-controller;
24 #interrupt-cells = <2>;
25 };
26
27 gpa1: gpa1 {
28 gpio-controller;
29 #gpio-cells = <2>;
30
31 interrupt-controller;
32 #interrupt-cells = <2>;
33 };
34
35 gpb: gpb {
36 gpio-controller;
37 #gpio-cells = <2>;
38
39 interrupt-controller;
40 #interrupt-cells = <2>;
41 };
42
43 gpc0: gpc0 {
44 gpio-controller;
45 #gpio-cells = <2>;
46
47 interrupt-controller;
48 #interrupt-cells = <2>;
49 };
50
51 gpc1: gpc1 {
52 gpio-controller;
53 #gpio-cells = <2>;
54
55 interrupt-controller;
56 #interrupt-cells = <2>;
57 };
58
59 gpd0: gpd0 {
60 gpio-controller;
61 #gpio-cells = <2>;
62
63 interrupt-controller;
64 #interrupt-cells = <2>;
65 };
66
67 gpd1: gpd1 {
68 gpio-controller;
69 #gpio-cells = <2>;
70
71 interrupt-controller;
72 #interrupt-cells = <2>;
73 };
74
75 gpe0: gpe0 {
76 gpio-controller;
77 #gpio-cells = <2>;
78
79 interrupt-controller;
80 #interrupt-cells = <2>;
81 };
82
83 gpe1: gpe1 {
84 gpio-controller;
85 #gpio-cells = <2>;
86
87 interrupt-controller;
88 #interrupt-cells = <2>;
89 };
90
91 gpe2: gpe2 {
92 gpio-controller;
93 #gpio-cells = <2>;
94
95 interrupt-controller;
96 #interrupt-cells = <2>;
97 };
98
99 gpe3: gpe3 {
100 gpio-controller;
101 #gpio-cells = <2>;
102
103 interrupt-controller;
104 #interrupt-cells = <2>;
105 };
106
107 gpe4: gpe4 {
108 gpio-controller;
109 #gpio-cells = <2>;
110
111 interrupt-controller;
112 #interrupt-cells = <2>;
113 };
114
115 gpf0: gpf0 {
116 gpio-controller;
117 #gpio-cells = <2>;
118
119 interrupt-controller;
120 #interrupt-cells = <2>;
121 };
122
123 gpf1: gpf1 {
124 gpio-controller;
125 #gpio-cells = <2>;
126
127 interrupt-controller;
128 #interrupt-cells = <2>;
129 };
130
131 gpf2: gpf2 {
132 gpio-controller;
133 #gpio-cells = <2>;
134
135 interrupt-controller;
136 #interrupt-cells = <2>;
137 };
138
139 gpf3: gpf3 {
140 gpio-controller;
141 #gpio-cells = <2>;
142
143 interrupt-controller;
144 #interrupt-cells = <2>;
145 };
146
19 uart0_data: uart0-data { 147 uart0_data: uart0-data {
20 samsung,pins = "gpa0-0", "gpa0-1"; 148 samsung,pins = "gpa0-0", "gpa0-1";
21 samsung,pin-function = <0x2>; 149 samsung,pin-function = <0x2>;
@@ -205,200 +333,345 @@
205 }; 333 };
206 334
207 pinctrl@11000000 { 335 pinctrl@11000000 {
336 gpj0: gpj0 {
337 gpio-controller;
338 #gpio-cells = <2>;
339
340 interrupt-controller;
341 #interrupt-cells = <2>;
342 };
343
344 gpj1: gpj1 {
345 gpio-controller;
346 #gpio-cells = <2>;
347
348 interrupt-controller;
349 #interrupt-cells = <2>;
350 };
351
352 gpk0: gpk0 {
353 gpio-controller;
354 #gpio-cells = <2>;
355
356 interrupt-controller;
357 #interrupt-cells = <2>;
358 };
359
360 gpk1: gpk1 {
361 gpio-controller;
362 #gpio-cells = <2>;
363
364 interrupt-controller;
365 #interrupt-cells = <2>;
366 };
367
368 gpk2: gpk2 {
369 gpio-controller;
370 #gpio-cells = <2>;
371
372 interrupt-controller;
373 #interrupt-cells = <2>;
374 };
375
376 gpk3: gpk3 {
377 gpio-controller;
378 #gpio-cells = <2>;
379
380 interrupt-controller;
381 #interrupt-cells = <2>;
382 };
383
384 gpl0: gpl0 {
385 gpio-controller;
386 #gpio-cells = <2>;
387
388 interrupt-controller;
389 #interrupt-cells = <2>;
390 };
391
392 gpl1: gpl1 {
393 gpio-controller;
394 #gpio-cells = <2>;
395
396 interrupt-controller;
397 #interrupt-cells = <2>;
398 };
399
400 gpl2: gpl2 {
401 gpio-controller;
402 #gpio-cells = <2>;
403
404 interrupt-controller;
405 #interrupt-cells = <2>;
406 };
407
408 gpy0: gpy0 {
409 gpio-controller;
410 #gpio-cells = <2>;
411 };
412
413 gpy1: gpy1 {
414 gpio-controller;
415 #gpio-cells = <2>;
416 };
417
418 gpy2: gpy2 {
419 gpio-controller;
420 #gpio-cells = <2>;
421 };
422
423 gpy3: gpy3 {
424 gpio-controller;
425 #gpio-cells = <2>;
426 };
427
428 gpy4: gpy4 {
429 gpio-controller;
430 #gpio-cells = <2>;
431 };
432
433 gpy5: gpy5 {
434 gpio-controller;
435 #gpio-cells = <2>;
436 };
437
438 gpy6: gpy6 {
439 gpio-controller;
440 #gpio-cells = <2>;
441 };
442
443 gpx0: gpx0 {
444 gpio-controller;
445 #gpio-cells = <2>;
446
447 interrupt-controller;
448 interrupt-parent = <&gic>;
449 interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
450 <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>;
451 #interrupt-cells = <2>;
452 };
453
454 gpx1: gpx1 {
455 gpio-controller;
456 #gpio-cells = <2>;
457
458 interrupt-controller;
459 interrupt-parent = <&gic>;
460 interrupts = <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
461 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
462 #interrupt-cells = <2>;
463 };
464
465 gpx2: gpx2 {
466 gpio-controller;
467 #gpio-cells = <2>;
468
469 interrupt-controller;
470 #interrupt-cells = <2>;
471 };
472
473 gpx3: gpx3 {
474 gpio-controller;
475 #gpio-cells = <2>;
476
477 interrupt-controller;
478 #interrupt-cells = <2>;
479 };
480
208 sd0_clk: sd0-clk { 481 sd0_clk: sd0-clk {
209 samsung,pins = "gpk0-0"; 482 samsung,pins = "gpk0-0";
210 samsung,pin-function = <2>; 483 samsung,pin-function = <2>;
211 samsung,pin-pud = <0>; 484 samsung,pin-pud = <0>;
212 samsung,pin-drv = <0>; 485 samsung,pin-drv = <3>;
213 }; 486 };
214 487
215 sd0_cmd: sd0-cmd { 488 sd0_cmd: sd0-cmd {
216 samsung,pins = "gpk0-1"; 489 samsung,pins = "gpk0-1";
217 samsung,pin-function = <2>; 490 samsung,pin-function = <2>;
218 samsung,pin-pud = <0>; 491 samsung,pin-pud = <0>;
219 samsung,pin-drv = <0>; 492 samsung,pin-drv = <3>;
220 }; 493 };
221 494
222 sd0_cd: sd0-cd { 495 sd0_cd: sd0-cd {
223 samsung,pins = "gpk0-2"; 496 samsung,pins = "gpk0-2";
224 samsung,pin-function = <2>; 497 samsung,pin-function = <2>;
225 samsung,pin-pud = <3>; 498 samsung,pin-pud = <3>;
226 samsung,pin-drv = <0>; 499 samsung,pin-drv = <3>;
227 }; 500 };
228 501
229 sd0_bus1: sd0-bus-width1 { 502 sd0_bus1: sd0-bus-width1 {
230 samsung,pins = "gpk0-3"; 503 samsung,pins = "gpk0-3";
231 samsung,pin-function = <2>; 504 samsung,pin-function = <2>;
232 samsung,pin-pud = <3>; 505 samsung,pin-pud = <3>;
233 samsung,pin-drv = <0>; 506 samsung,pin-drv = <3>;
234 }; 507 };
235 508
236 sd0_bus4: sd0-bus-width4 { 509 sd0_bus4: sd0-bus-width4 {
237 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6"; 510 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6";
238 samsung,pin-function = <2>; 511 samsung,pin-function = <2>;
239 samsung,pin-pud = <3>; 512 samsung,pin-pud = <3>;
240 samsung,pin-drv = <0>; 513 samsung,pin-drv = <3>;
241 }; 514 };
242 515
243 sd0_bus8: sd0-bus-width8 { 516 sd0_bus8: sd0-bus-width8 {
244 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; 517 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
245 samsung,pin-function = <3>; 518 samsung,pin-function = <3>;
246 samsung,pin-pud = <3>; 519 samsung,pin-pud = <3>;
247 samsung,pin-drv = <0>; 520 samsung,pin-drv = <3>;
248 }; 521 };
249 522
250 sd4_clk: sd4-clk { 523 sd4_clk: sd4-clk {
251 samsung,pins = "gpk0-0"; 524 samsung,pins = "gpk0-0";
252 samsung,pin-function = <3>; 525 samsung,pin-function = <3>;
253 samsung,pin-pud = <0>; 526 samsung,pin-pud = <0>;
254 samsung,pin-drv = <0>; 527 samsung,pin-drv = <3>;
255 }; 528 };
256 529
257 sd4_cmd: sd4-cmd { 530 sd4_cmd: sd4-cmd {
258 samsung,pins = "gpk0-1"; 531 samsung,pins = "gpk0-1";
259 samsung,pin-function = <3>; 532 samsung,pin-function = <3>;
260 samsung,pin-pud = <0>; 533 samsung,pin-pud = <0>;
261 samsung,pin-drv = <0>; 534 samsung,pin-drv = <3>;
262 }; 535 };
263 536
264 sd4_cd: sd4-cd { 537 sd4_cd: sd4-cd {
265 samsung,pins = "gpk0-2"; 538 samsung,pins = "gpk0-2";
266 samsung,pin-function = <3>; 539 samsung,pin-function = <3>;
267 samsung,pin-pud = <3>; 540 samsung,pin-pud = <3>;
268 samsung,pin-drv = <0>; 541 samsung,pin-drv = <3>;
269 }; 542 };
270 543
271 sd4_bus1: sd4-bus-width1 { 544 sd4_bus1: sd4-bus-width1 {
272 samsung,pins = "gpk0-3"; 545 samsung,pins = "gpk0-3";
273 samsung,pin-function = <3>; 546 samsung,pin-function = <3>;
274 samsung,pin-pud = <3>; 547 samsung,pin-pud = <3>;
275 samsung,pin-drv = <0>; 548 samsung,pin-drv = <3>;
276 }; 549 };
277 550
278 sd4_bus4: sd4-bus-width4 { 551 sd4_bus4: sd4-bus-width4 {
279 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6"; 552 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6";
280 samsung,pin-function = <3>; 553 samsung,pin-function = <3>;
281 samsung,pin-pud = <3>; 554 samsung,pin-pud = <3>;
282 samsung,pin-drv = <0>; 555 samsung,pin-drv = <3>;
283 }; 556 };
284 557
285 sd4_bus8: sd4-bus-width8 { 558 sd4_bus8: sd4-bus-width8 {
286 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; 559 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
287 samsung,pin-function = <3>; 560 samsung,pin-function = <3>;
288 samsung,pin-pud = <4>; 561 samsung,pin-pud = <4>;
289 samsung,pin-drv = <0>; 562 samsung,pin-drv = <3>;
290 }; 563 };
291 564
292 sd1_clk: sd1-clk { 565 sd1_clk: sd1-clk {
293 samsung,pins = "gpk1-0"; 566 samsung,pins = "gpk1-0";
294 samsung,pin-function = <2>; 567 samsung,pin-function = <2>;
295 samsung,pin-pud = <0>; 568 samsung,pin-pud = <0>;
296 samsung,pin-drv = <0>; 569 samsung,pin-drv = <3>;
297 }; 570 };
298 571
299 sd1_cmd: sd1-cmd { 572 sd1_cmd: sd1-cmd {
300 samsung,pins = "gpk1-1"; 573 samsung,pins = "gpk1-1";
301 samsung,pin-function = <2>; 574 samsung,pin-function = <2>;
302 samsung,pin-pud = <0>; 575 samsung,pin-pud = <0>;
303 samsung,pin-drv = <0>; 576 samsung,pin-drv = <3>;
304 }; 577 };
305 578
306 sd1_cd: sd1-cd { 579 sd1_cd: sd1-cd {
307 samsung,pins = "gpk1-2"; 580 samsung,pins = "gpk1-2";
308 samsung,pin-function = <2>; 581 samsung,pin-function = <2>;
309 samsung,pin-pud = <3>; 582 samsung,pin-pud = <3>;
310 samsung,pin-drv = <0>; 583 samsung,pin-drv = <3>;
311 }; 584 };
312 585
313 sd1_bus1: sd1-bus-width1 { 586 sd1_bus1: sd1-bus-width1 {
314 samsung,pins = "gpk1-3"; 587 samsung,pins = "gpk1-3";
315 samsung,pin-function = <2>; 588 samsung,pin-function = <2>;
316 samsung,pin-pud = <3>; 589 samsung,pin-pud = <3>;
317 samsung,pin-drv = <0>; 590 samsung,pin-drv = <3>;
318 }; 591 };
319 592
320 sd1_bus4: sd1-bus-width4 { 593 sd1_bus4: sd1-bus-width4 {
321 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; 594 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
322 samsung,pin-function = <2>; 595 samsung,pin-function = <2>;
323 samsung,pin-pud = <3>; 596 samsung,pin-pud = <3>;
324 samsung,pin-drv = <0>; 597 samsung,pin-drv = <3>;
325 }; 598 };
326 599
327 sd2_clk: sd2-clk { 600 sd2_clk: sd2-clk {
328 samsung,pins = "gpk2-0"; 601 samsung,pins = "gpk2-0";
329 samsung,pin-function = <2>; 602 samsung,pin-function = <2>;
330 samsung,pin-pud = <0>; 603 samsung,pin-pud = <0>;
331 samsung,pin-drv = <0>; 604 samsung,pin-drv = <3>;
332 }; 605 };
333 606
334 sd2_cmd: sd2-cmd { 607 sd2_cmd: sd2-cmd {
335 samsung,pins = "gpk2-1"; 608 samsung,pins = "gpk2-1";
336 samsung,pin-function = <2>; 609 samsung,pin-function = <2>;
337 samsung,pin-pud = <0>; 610 samsung,pin-pud = <0>;
338 samsung,pin-drv = <0>; 611 samsung,pin-drv = <3>;
339 }; 612 };
340 613
341 sd2_cd: sd2-cd { 614 sd2_cd: sd2-cd {
342 samsung,pins = "gpk2-2"; 615 samsung,pins = "gpk2-2";
343 samsung,pin-function = <2>; 616 samsung,pin-function = <2>;
344 samsung,pin-pud = <3>; 617 samsung,pin-pud = <3>;
345 samsung,pin-drv = <0>; 618 samsung,pin-drv = <3>;
346 }; 619 };
347 620
348 sd2_bus1: sd2-bus-width1 { 621 sd2_bus1: sd2-bus-width1 {
349 samsung,pins = "gpk2-3"; 622 samsung,pins = "gpk2-3";
350 samsung,pin-function = <2>; 623 samsung,pin-function = <2>;
351 samsung,pin-pud = <3>; 624 samsung,pin-pud = <3>;
352 samsung,pin-drv = <0>; 625 samsung,pin-drv = <3>;
353 }; 626 };
354 627
355 sd2_bus4: sd2-bus-width4 { 628 sd2_bus4: sd2-bus-width4 {
356 samsung,pins = "gpk2-3", "gpk2-4", "gpk2-5", "gpk2-6"; 629 samsung,pins = "gpk2-3", "gpk2-4", "gpk2-5", "gpk2-6";
357 samsung,pin-function = <2>; 630 samsung,pin-function = <2>;
358 samsung,pin-pud = <3>; 631 samsung,pin-pud = <3>;
359 samsung,pin-drv = <0>; 632 samsung,pin-drv = <3>;
360 }; 633 };
361 634
362 sd2_bus8: sd2-bus-width8 { 635 sd2_bus8: sd2-bus-width8 {
363 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6"; 636 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6";
364 samsung,pin-function = <3>; 637 samsung,pin-function = <3>;
365 samsung,pin-pud = <3>; 638 samsung,pin-pud = <3>;
366 samsung,pin-drv = <0>; 639 samsung,pin-drv = <3>;
367 }; 640 };
368 641
369 sd3_clk: sd3-clk { 642 sd3_clk: sd3-clk {
370 samsung,pins = "gpk3-0"; 643 samsung,pins = "gpk3-0";
371 samsung,pin-function = <2>; 644 samsung,pin-function = <2>;
372 samsung,pin-pud = <0>; 645 samsung,pin-pud = <0>;
373 samsung,pin-drv = <0>; 646 samsung,pin-drv = <3>;
374 }; 647 };
375 648
376 sd3_cmd: sd3-cmd { 649 sd3_cmd: sd3-cmd {
377 samsung,pins = "gpk3-1"; 650 samsung,pins = "gpk3-1";
378 samsung,pin-function = <2>; 651 samsung,pin-function = <2>;
379 samsung,pin-pud = <0>; 652 samsung,pin-pud = <0>;
380 samsung,pin-drv = <0>; 653 samsung,pin-drv = <3>;
381 }; 654 };
382 655
383 sd3_cd: sd3-cd { 656 sd3_cd: sd3-cd {
384 samsung,pins = "gpk3-2"; 657 samsung,pins = "gpk3-2";
385 samsung,pin-function = <2>; 658 samsung,pin-function = <2>;
386 samsung,pin-pud = <3>; 659 samsung,pin-pud = <3>;
387 samsung,pin-drv = <0>; 660 samsung,pin-drv = <3>;
388 }; 661 };
389 662
390 sd3_bus1: sd3-bus-width1 { 663 sd3_bus1: sd3-bus-width1 {
391 samsung,pins = "gpk3-3"; 664 samsung,pins = "gpk3-3";
392 samsung,pin-function = <2>; 665 samsung,pin-function = <2>;
393 samsung,pin-pud = <3>; 666 samsung,pin-pud = <3>;
394 samsung,pin-drv = <0>; 667 samsung,pin-drv = <3>;
395 }; 668 };
396 669
397 sd3_bus4: sd3-bus-width4 { 670 sd3_bus4: sd3-bus-width4 {
398 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6"; 671 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6";
399 samsung,pin-function = <2>; 672 samsung,pin-function = <2>;
400 samsung,pin-pud = <3>; 673 samsung,pin-pud = <3>;
401 samsung,pin-drv = <0>; 674 samsung,pin-drv = <3>;
402 }; 675 };
403 676
404 eint0: ext-int0 { 677 eint0: ext-int0 {
@@ -438,6 +711,11 @@
438 }; 711 };
439 712
440 pinctrl@03860000 { 713 pinctrl@03860000 {
714 gpz: gpz {
715 gpio-controller;
716 #gpio-cells = <2>;
717 };
718
441 i2s0_bus: i2s0-bus { 719 i2s0_bus: i2s0-bus {
442 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3", 720 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3",
443 "gpz-4", "gpz-5", "gpz-6"; 721 "gpz-4", "gpz-5", "gpz-6";
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 63610c3ba3a..9b23a8255e3 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -43,6 +43,22 @@
43 status = "okay"; 43 status = "okay";
44 }; 44 };
45 45
46 serial@13800000 {
47 status = "okay";
48 };
49
50 serial@13810000 {
51 status = "okay";
52 };
53
54 serial@13820000 {
55 status = "okay";
56 };
57
58 serial@13830000 {
59 status = "okay";
60 };
61
46 keypad@100A0000 { 62 keypad@100A0000 {
47 samsung,keypad-num-rows = <2>; 63 samsung,keypad-num-rows = <2>;
48 samsung,keypad-num-columns = <8>; 64 samsung,keypad-num-columns = <8>;
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts
index a21511c1407..c346b64dff5 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -35,24 +35,15 @@
35 regulator-name = "VMEM_VDD_2.8V"; 35 regulator-name = "VMEM_VDD_2.8V";
36 regulator-min-microvolt = <2800000>; 36 regulator-min-microvolt = <2800000>;
37 regulator-max-microvolt = <2800000>; 37 regulator-max-microvolt = <2800000>;
38 gpio = <&gpk0 2 1 0 0>; 38 gpio = <&gpk0 2 0>;
39 enable-active-high; 39 enable-active-high;
40 }; 40 };
41 41
42 sdhci_emmc: sdhci@12510000 { 42 sdhci_emmc: sdhci@12510000 {
43 bus-width = <8>; 43 bus-width = <8>;
44 non-removable; 44 non-removable;
45 broken-voltage; 45 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus8>;
46 gpios = <&gpk0 0 2 0 3>, 46 pinctrl-names = "default";
47 <&gpk0 1 2 0 3>,
48 <&gpk0 3 2 2 3>,
49 <&gpk0 4 2 2 3>,
50 <&gpk0 5 2 2 3>,
51 <&gpk0 6 2 2 3>,
52 <&gpk1 3 3 3 3>,
53 <&gpk1 4 3 3 3>,
54 <&gpk1 5 3 3 3>,
55 <&gpk1 6 3 3 3>;
56 vmmc-supply = <&vemmc_reg>; 47 vmmc-supply = <&vemmc_reg>;
57 status = "okay"; 48 status = "okay";
58 }; 49 };
@@ -73,12 +64,74 @@
73 status = "okay"; 64 status = "okay";
74 }; 65 };
75 66
67 gpio-keys {
68 compatible = "gpio-keys";
69
70 vol-down-key {
71 gpios = <&gpx2 1 1>;
72 linux,code = <114>;
73 label = "volume down";
74 debounce-interval = <10>;
75 };
76
77 vol-up-key {
78 gpios = <&gpx2 0 1>;
79 linux,code = <115>;
80 label = "volume up";
81 debounce-interval = <10>;
82 };
83
84 power-key {
85 gpios = <&gpx2 7 1>;
86 linux,code = <116>;
87 label = "power";
88 debounce-interval = <10>;
89 gpio-key,wakeup;
90 };
91
92 ok-key {
93 gpios = <&gpx3 5 1>;
94 linux,code = <352>;
95 label = "ok";
96 debounce-interval = <10>;
97 };
98 };
99
100 tsp_reg: voltage-regulator {
101 compatible = "regulator-fixed";
102 regulator-name = "TSP_FIXED_VOLTAGES";
103 regulator-min-microvolt = <2800000>;
104 regulator-max-microvolt = <2800000>;
105 gpio = <&gpl0 3 0>;
106 enable-active-high;
107 };
108
109 i2c@13890000 {
110 samsung,i2c-sda-delay = <100>;
111 samsung,i2c-slave-addr = <0x10>;
112 samsung,i2c-max-bus-freq = <400000>;
113 pinctrl-0 = <&i2c3_bus>;
114 pinctrl-names = "default";
115 status = "okay";
116
117 mms114-touchscreen@48 {
118 compatible = "melfas,mms114";
119 reg = <0x48>;
120 interrupt-parent = <&gpx0>;
121 interrupts = <4 2>;
122 x-size = <720>;
123 y-size = <1280>;
124 avdd-supply = <&tsp_reg>;
125 vdd-supply = <&tsp_reg>;
126 };
127 };
128
76 i2c@138B0000 { 129 i2c@138B0000 {
77 samsung,i2c-sda-delay = <100>; 130 samsung,i2c-sda-delay = <100>;
78 samsung,i2c-slave-addr = <0x10>; 131 samsung,i2c-slave-addr = <0x10>;
79 samsung,i2c-max-bus-freq = <100000>; 132 samsung,i2c-max-bus-freq = <100000>;
80 gpios = <&gpb 6 3 3 0>, 133 pinctrl-0 = <&i2c5_bus>;
81 <&gpb 7 3 3 0>; 134 pinctrl-names = "default";
82 status = "okay"; 135 status = "okay";
83 136
84 max8997_pmic@66 { 137 max8997_pmic@66 {
@@ -93,9 +146,9 @@
93 max8997,pmic-ignore-gpiodvs-side-effect; 146 max8997,pmic-ignore-gpiodvs-side-effect;
94 max8997,pmic-buck125-default-dvs-idx = <0>; 147 max8997,pmic-buck125-default-dvs-idx = <0>;
95 148
96 max8997,pmic-buck125-dvs-gpios = <&gpx0 5 1 0 0>, 149 max8997,pmic-buck125-dvs-gpios = <&gpx0 5 0>,
97 <&gpx0 6 1 0 0>, 150 <&gpx0 6 0>,
98 <&gpl0 0 1 0 0>; 151 <&gpl0 0 0>;
99 152
100 max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>, 153 max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>,
101 <1250000>, <1200000>, 154 <1250000>, <1200000>,
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 214c557eda7..e31bfc4a6f0 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -31,6 +31,11 @@
31 pinctrl2 = &pinctrl_2; 31 pinctrl2 = &pinctrl_2;
32 }; 32 };
33 33
34 pd_lcd1: lcd1-power-domain@10023CA0 {
35 compatible = "samsung,exynos4210-pd";
36 reg = <0x10023CA0 0x20>;
37 };
38
34 gic:interrupt-controller@10490000 { 39 gic:interrupt-controller@10490000 {
35 cpu-offset = <0x8000>; 40 cpu-offset = <0x8000>;
36 }; 41 };
@@ -46,27 +51,17 @@
46 compatible = "samsung,pinctrl-exynos4210"; 51 compatible = "samsung,pinctrl-exynos4210";
47 reg = <0x11400000 0x1000>; 52 reg = <0x11400000 0x1000>;
48 interrupts = <0 47 0>; 53 interrupts = <0 47 0>;
49 interrupt-controller;
50 #interrupt-cells = <2>;
51 }; 54 };
52 55
53 pinctrl_1: pinctrl@11000000 { 56 pinctrl_1: pinctrl@11000000 {
54 compatible = "samsung,pinctrl-exynos4210"; 57 compatible = "samsung,pinctrl-exynos4210";
55 reg = <0x11000000 0x1000>; 58 reg = <0x11000000 0x1000>;
56 interrupts = <0 46 0>; 59 interrupts = <0 46 0>;
57 interrupt-controller;
58 #interrupt-cells = <2>;
59 60
60 wakup_eint: wakeup-interrupt-controller { 61 wakup_eint: wakeup-interrupt-controller {
61 compatible = "samsung,exynos4210-wakeup-eint"; 62 compatible = "samsung,exynos4210-wakeup-eint";
62 interrupt-parent = <&gic>; 63 interrupt-parent = <&gic>;
63 interrupt-controller; 64 interrupts = <0 32 0>;
64 #interrupt-cells = <2>;
65 interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
66 <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>,
67 <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
68 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>,
69 <0 32 0>;
70 }; 65 };
71 }; 66 };
72 67
@@ -75,232 +70,10 @@
75 reg = <0x03860000 0x1000>; 70 reg = <0x03860000 0x1000>;
76 }; 71 };
77 72
78 gpio-controllers { 73 tmu@100C0000 {
79 #address-cells = <1>; 74 compatible = "samsung,exynos4210-tmu";
80 #size-cells = <1>; 75 interrupt-parent = <&combiner>;
81 gpio-controller; 76 reg = <0x100C0000 0x100>;
82 ranges; 77 interrupts = <2 4>;
83
84 gpa0: gpio-controller@11400000 {
85 compatible = "samsung,exynos4-gpio";
86 reg = <0x11400000 0x20>;
87 #gpio-cells = <4>;
88 };
89
90 gpa1: gpio-controller@11400020 {
91 compatible = "samsung,exynos4-gpio";
92 reg = <0x11400020 0x20>;
93 #gpio-cells = <4>;
94 };
95
96 gpb: gpio-controller@11400040 {
97 compatible = "samsung,exynos4-gpio";
98 reg = <0x11400040 0x20>;
99 #gpio-cells = <4>;
100 };
101
102 gpc0: gpio-controller@11400060 {
103 compatible = "samsung,exynos4-gpio";
104 reg = <0x11400060 0x20>;
105 #gpio-cells = <4>;
106 };
107
108 gpc1: gpio-controller@11400080 {
109 compatible = "samsung,exynos4-gpio";
110 reg = <0x11400080 0x20>;
111 #gpio-cells = <4>;
112 };
113
114 gpd0: gpio-controller@114000A0 {
115 compatible = "samsung,exynos4-gpio";
116 reg = <0x114000A0 0x20>;
117 #gpio-cells = <4>;
118 };
119
120 gpd1: gpio-controller@114000C0 {
121 compatible = "samsung,exynos4-gpio";
122 reg = <0x114000C0 0x20>;
123 #gpio-cells = <4>;
124 };
125
126 gpe0: gpio-controller@114000E0 {
127 compatible = "samsung,exynos4-gpio";
128 reg = <0x114000E0 0x20>;
129 #gpio-cells = <4>;
130 };
131
132 gpe1: gpio-controller@11400100 {
133 compatible = "samsung,exynos4-gpio";
134 reg = <0x11400100 0x20>;
135 #gpio-cells = <4>;
136 };
137
138 gpe2: gpio-controller@11400120 {
139 compatible = "samsung,exynos4-gpio";
140 reg = <0x11400120 0x20>;
141 #gpio-cells = <4>;
142 };
143
144 gpe3: gpio-controller@11400140 {
145 compatible = "samsung,exynos4-gpio";
146 reg = <0x11400140 0x20>;
147 #gpio-cells = <4>;
148 };
149
150 gpe4: gpio-controller@11400160 {
151 compatible = "samsung,exynos4-gpio";
152 reg = <0x11400160 0x20>;
153 #gpio-cells = <4>;
154 };
155
156 gpf0: gpio-controller@11400180 {
157 compatible = "samsung,exynos4-gpio";
158 reg = <0x11400180 0x20>;
159 #gpio-cells = <4>;
160 };
161
162 gpf1: gpio-controller@114001A0 {
163 compatible = "samsung,exynos4-gpio";
164 reg = <0x114001A0 0x20>;
165 #gpio-cells = <4>;
166 };
167
168 gpf2: gpio-controller@114001C0 {
169 compatible = "samsung,exynos4-gpio";
170 reg = <0x114001C0 0x20>;
171 #gpio-cells = <4>;
172 };
173
174 gpf3: gpio-controller@114001E0 {
175 compatible = "samsung,exynos4-gpio";
176 reg = <0x114001E0 0x20>;
177 #gpio-cells = <4>;
178 };
179
180 gpj0: gpio-controller@11000000 {
181 compatible = "samsung,exynos4-gpio";
182 reg = <0x11000000 0x20>;
183 #gpio-cells = <4>;
184 };
185
186 gpj1: gpio-controller@11000020 {
187 compatible = "samsung,exynos4-gpio";
188 reg = <0x11000020 0x20>;
189 #gpio-cells = <4>;
190 };
191
192 gpk0: gpio-controller@11000040 {
193 compatible = "samsung,exynos4-gpio";
194 reg = <0x11000040 0x20>;
195 #gpio-cells = <4>;
196 };
197
198 gpk1: gpio-controller@11000060 {
199 compatible = "samsung,exynos4-gpio";
200 reg = <0x11000060 0x20>;
201 #gpio-cells = <4>;
202 };
203
204 gpk2: gpio-controller@11000080 {
205 compatible = "samsung,exynos4-gpio";
206 reg = <0x11000080 0x20>;
207 #gpio-cells = <4>;
208 };
209
210 gpk3: gpio-controller@110000A0 {
211 compatible = "samsung,exynos4-gpio";
212 reg = <0x110000A0 0x20>;
213 #gpio-cells = <4>;
214 };
215
216 gpl0: gpio-controller@110000C0 {
217 compatible = "samsung,exynos4-gpio";
218 reg = <0x110000C0 0x20>;
219 #gpio-cells = <4>;
220 };
221
222 gpl1: gpio-controller@110000E0 {
223 compatible = "samsung,exynos4-gpio";
224 reg = <0x110000E0 0x20>;
225 #gpio-cells = <4>;
226 };
227
228 gpl2: gpio-controller@11000100 {
229 compatible = "samsung,exynos4-gpio";
230 reg = <0x11000100 0x20>;
231 #gpio-cells = <4>;
232 };
233
234 gpy0: gpio-controller@11000120 {
235 compatible = "samsung,exynos4-gpio";
236 reg = <0x11000120 0x20>;
237 #gpio-cells = <4>;
238 };
239
240 gpy1: gpio-controller@11000140 {
241 compatible = "samsung,exynos4-gpio";
242 reg = <0x11000140 0x20>;
243 #gpio-cells = <4>;
244 };
245
246 gpy2: gpio-controller@11000160 {
247 compatible = "samsung,exynos4-gpio";
248 reg = <0x11000160 0x20>;
249 #gpio-cells = <4>;
250 };
251
252 gpy3: gpio-controller@11000180 {
253 compatible = "samsung,exynos4-gpio";
254 reg = <0x11000180 0x20>;
255 #gpio-cells = <4>;
256 };
257
258 gpy4: gpio-controller@110001A0 {
259 compatible = "samsung,exynos4-gpio";
260 reg = <0x110001A0 0x20>;
261 #gpio-cells = <4>;
262 };
263
264 gpy5: gpio-controller@110001C0 {
265 compatible = "samsung,exynos4-gpio";
266 reg = <0x110001C0 0x20>;
267 #gpio-cells = <4>;
268 };
269
270 gpy6: gpio-controller@110001E0 {
271 compatible = "samsung,exynos4-gpio";
272 reg = <0x110001E0 0x20>;
273 #gpio-cells = <4>;
274 };
275
276 gpx0: gpio-controller@11000C00 {
277 compatible = "samsung,exynos4-gpio";
278 reg = <0x11000C00 0x20>;
279 #gpio-cells = <4>;
280 };
281
282 gpx1: gpio-controller@11000C20 {
283 compatible = "samsung,exynos4-gpio";
284 reg = <0x11000C20 0x20>;
285 #gpio-cells = <4>;
286 };
287
288 gpx2: gpio-controller@11000C40 {
289 compatible = "samsung,exynos4-gpio";
290 reg = <0x11000C40 0x20>;
291 #gpio-cells = <4>;
292 };
293
294 gpx3: gpio-controller@11000C60 {
295 compatible = "samsung,exynos4-gpio";
296 reg = <0x11000C60 0x20>;
297 #gpio-cells = <4>;
298 };
299
300 gpz: gpio-controller@03860000 {
301 compatible = "samsung,exynos4-gpio";
302 reg = <0x03860000 0x20>;
303 #gpio-cells = <4>;
304 };
305 }; 78 };
306}; 79};
diff --git a/arch/arm/boot/dts/exynos4212.dtsi b/arch/arm/boot/dts/exynos4212.dtsi
new file mode 100644
index 00000000000..c6ae2005961
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -0,0 +1,28 @@
1/*
2 * Samsung's Exynos4212 SoC device tree source
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Samsung's Exynos4212 SoC device nodes are listed in this file. Exynos4212
8 * based board files can include this file and provide values for board specfic
9 * bindings.
10 *
11 * Note: This file does not include device nodes for all the controllers in
12 * Exynos4212 SoC. As device tree coverage for Exynos4212 increases, additional
13 * nodes can be added to this file.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18*/
19
20/include/ "exynos4x12.dtsi"
21
22/ {
23 compatible = "samsung,exynos4212";
24
25 gic:interrupt-controller@10490000 {
26 cpu-offset = <0x8000>;
27 };
28};
diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts b/arch/arm/boot/dts/exynos4412-smdk4412.dts
new file mode 100644
index 00000000000..f05bf575cc4
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts
@@ -0,0 +1,45 @@
1/*
2 * Samsung's Exynos4412 based SMDK board device tree source
3 *
4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Device tree source file for Samsung's SMDK4412 board which is based on
8 * Samsung's Exynos4412 SoC.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/dts-v1/;
16/include/ "exynos4412.dtsi"
17
18/ {
19 model = "Samsung SMDK evaluation board based on Exynos4412";
20 compatible = "samsung,smdk4412", "samsung,exynos4412";
21
22 memory {
23 reg = <0x40000000 0x40000000>;
24 };
25
26 chosen {
27 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc";
28 };
29
30 serial@13800000 {
31 status = "okay";
32 };
33
34 serial@13810000 {
35 status = "okay";
36 };
37
38 serial@13820000 {
39 status = "okay";
40 };
41
42 serial@13830000 {
43 status = "okay";
44 };
45};
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
new file mode 100644
index 00000000000..d7dfe312772
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -0,0 +1,28 @@
1/*
2 * Samsung's Exynos4412 SoC device tree source
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Samsung's Exynos4412 SoC device nodes are listed in this file. Exynos4412
8 * based board files can include this file and provide values for board specfic
9 * bindings.
10 *
11 * Note: This file does not include device nodes for all the controllers in
12 * Exynos4412 SoC. As device tree coverage for Exynos4412 increases, additional
13 * nodes can be added to this file.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18*/
19
20/include/ "exynos4x12.dtsi"
21
22/ {
23 compatible = "samsung,exynos4412";
24
25 gic:interrupt-controller@10490000 {
26 cpu-offset = <0x4000>;
27 };
28};
diff --git a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
new file mode 100644
index 00000000000..8e6115adcd9
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
@@ -0,0 +1,965 @@
1/*
2 * Samsung's Exynos4x12 SoCs pin-mux and pin-config device tree source
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Samsung's Exynos4x12 SoCs pin-mux and pin-config optiosn are listed as device
8 * tree nodes are listed in this file.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/ {
16 pinctrl@11400000 {
17 gpa0: gpa0 {
18 gpio-controller;
19 #gpio-cells = <2>;
20
21 interrupt-controller;
22 #interrupt-cells = <2>;
23 };
24
25 gpa1: gpa1 {
26 gpio-controller;
27 #gpio-cells = <2>;
28
29 interrupt-controller;
30 #interrupt-cells = <2>;
31 };
32
33 gpb: gpb {
34 gpio-controller;
35 #gpio-cells = <2>;
36
37 interrupt-controller;
38 #interrupt-cells = <2>;
39 };
40
41 gpc0: gpc0 {
42 gpio-controller;
43 #gpio-cells = <2>;
44
45 interrupt-controller;
46 #interrupt-cells = <2>;
47 };
48
49 gpc1: gpc1 {
50 gpio-controller;
51 #gpio-cells = <2>;
52
53 interrupt-controller;
54 #interrupt-cells = <2>;
55 };
56
57 gpd0: gpd0 {
58 gpio-controller;
59 #gpio-cells = <2>;
60
61 interrupt-controller;
62 #interrupt-cells = <2>;
63 };
64
65 gpd1: gpd1 {
66 gpio-controller;
67 #gpio-cells = <2>;
68
69 interrupt-controller;
70 #interrupt-cells = <2>;
71 };
72
73 gpf0: gpf0 {
74 gpio-controller;
75 #gpio-cells = <2>;
76
77 interrupt-controller;
78 #interrupt-cells = <2>;
79 };
80
81 gpf1: gpf1 {
82 gpio-controller;
83 #gpio-cells = <2>;
84
85 interrupt-controller;
86 #interrupt-cells = <2>;
87 };
88
89 gpf2: gpf2 {
90 gpio-controller;
91 #gpio-cells = <2>;
92
93 interrupt-controller;
94 #interrupt-cells = <2>;
95 };
96
97 gpf3: gpf3 {
98 gpio-controller;
99 #gpio-cells = <2>;
100
101 interrupt-controller;
102 #interrupt-cells = <2>;
103 };
104
105 gpj0: gpj0 {
106 gpio-controller;
107 #gpio-cells = <2>;
108
109 interrupt-controller;
110 #interrupt-cells = <2>;
111 };
112
113 gpj1: gpj1 {
114 gpio-controller;
115 #gpio-cells = <2>;
116
117 interrupt-controller;
118 #interrupt-cells = <2>;
119 };
120
121 uart0_data: uart0-data {
122 samsung,pins = "gpa0-0", "gpa0-1";
123 samsung,pin-function = <0x2>;
124 samsung,pin-pud = <0>;
125 samsung,pin-drv = <0>;
126 };
127
128 uart0_fctl: uart0-fctl {
129 samsung,pins = "gpa0-2", "gpa0-3";
130 samsung,pin-function = <2>;
131 samsung,pin-pud = <0>;
132 samsung,pin-drv = <0>;
133 };
134
135 uart1_data: uart1-data {
136 samsung,pins = "gpa0-4", "gpa0-5";
137 samsung,pin-function = <2>;
138 samsung,pin-pud = <0>;
139 samsung,pin-drv = <0>;
140 };
141
142 uart1_fctl: uart1-fctl {
143 samsung,pins = "gpa0-6", "gpa0-7";
144 samsung,pin-function = <2>;
145 samsung,pin-pud = <0>;
146 samsung,pin-drv = <0>;
147 };
148
149 i2c2_bus: i2c2-bus {
150 samsung,pins = "gpa0-6", "gpa0-7";
151 samsung,pin-function = <3>;
152 samsung,pin-pud = <3>;
153 samsung,pin-drv = <0>;
154 };
155
156 uart2_data: uart2-data {
157 samsung,pins = "gpa1-0", "gpa1-1";
158 samsung,pin-function = <2>;
159 samsung,pin-pud = <0>;
160 samsung,pin-drv = <0>;
161 };
162
163 uart2_fctl: uart2-fctl {
164 samsung,pins = "gpa1-2", "gpa1-3";
165 samsung,pin-function = <2>;
166 samsung,pin-pud = <0>;
167 samsung,pin-drv = <0>;
168 };
169
170 uart_audio_a: uart-audio-a {
171 samsung,pins = "gpa1-0", "gpa1-1";
172 samsung,pin-function = <4>;
173 samsung,pin-pud = <0>;
174 samsung,pin-drv = <0>;
175 };
176
177 i2c3_bus: i2c3-bus {
178 samsung,pins = "gpa1-2", "gpa1-3";
179 samsung,pin-function = <3>;
180 samsung,pin-pud = <3>;
181 samsung,pin-drv = <0>;
182 };
183
184 uart3_data: uart3-data {
185 samsung,pins = "gpa1-4", "gpa1-5";
186 samsung,pin-function = <2>;
187 samsung,pin-pud = <0>;
188 samsung,pin-drv = <0>;
189 };
190
191 uart_audio_b: uart-audio-b {
192 samsung,pins = "gpa1-4", "gpa1-5";
193 samsung,pin-function = <4>;
194 samsung,pin-pud = <0>;
195 samsung,pin-drv = <0>;
196 };
197
198 spi0_bus: spi0-bus {
199 samsung,pins = "gpb-0", "gpb-2", "gpb-3";
200 samsung,pin-function = <2>;
201 samsung,pin-pud = <3>;
202 samsung,pin-drv = <0>;
203 };
204
205 i2c4_bus: i2c4-bus {
206 samsung,pins = "gpb-0", "gpb-1";
207 samsung,pin-function = <3>;
208 samsung,pin-pud = <3>;
209 samsung,pin-drv = <0>;
210 };
211
212 spi1_bus: spi1-bus {
213 samsung,pins = "gpb-4", "gpb-6", "gpb-7";
214 samsung,pin-function = <2>;
215 samsung,pin-pud = <3>;
216 samsung,pin-drv = <0>;
217 };
218
219 i2c5_bus: i2c5-bus {
220 samsung,pins = "gpb-2", "gpb-3";
221 samsung,pin-function = <3>;
222 samsung,pin-pud = <3>;
223 samsung,pin-drv = <0>;
224 };
225
226 i2s1_bus: i2s1-bus {
227 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
228 "gpc0-4";
229 samsung,pin-function = <2>;
230 samsung,pin-pud = <0>;
231 samsung,pin-drv = <0>;
232 };
233
234 pcm1_bus: pcm1-bus {
235 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
236 "gpc0-4";
237 samsung,pin-function = <3>;
238 samsung,pin-pud = <0>;
239 samsung,pin-drv = <0>;
240 };
241
242 ac97_bus: ac97-bus {
243 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
244 "gpc0-4";
245 samsung,pin-function = <4>;
246 samsung,pin-pud = <0>;
247 samsung,pin-drv = <0>;
248 };
249
250 i2s2_bus: i2s2-bus {
251 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
252 "gpc1-4";
253 samsung,pin-function = <2>;
254 samsung,pin-pud = <0>;
255 samsung,pin-drv = <0>;
256 };
257
258 pcm2_bus: pcm2-bus {
259 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
260 "gpc1-4";
261 samsung,pin-function = <3>;
262 samsung,pin-pud = <0>;
263 samsung,pin-drv = <0>;
264 };
265
266 spdif_bus: spdif-bus {
267 samsung,pins = "gpc1-0", "gpc1-1";
268 samsung,pin-function = <4>;
269 samsung,pin-pud = <0>;
270 samsung,pin-drv = <0>;
271 };
272
273 i2c6_bus: i2c6-bus {
274 samsung,pins = "gpc1-3", "gpc1-4";
275 samsung,pin-function = <4>;
276 samsung,pin-pud = <3>;
277 samsung,pin-drv = <0>;
278 };
279
280 spi2_bus: spi2-bus {
281 samsung,pins = "gpc1-1", "gpc1-3", "gpc1-4";
282 samsung,pin-function = <5>;
283 samsung,pin-pud = <3>;
284 samsung,pin-drv = <0>;
285 };
286
287 pwm0_out: pwm0-out {
288 samsung,pins = "gpd0-0";
289 samsung,pin-function = <2>;
290 samsung,pin-pud = <0>;
291 samsung,pin-drv = <0>;
292 };
293
294 pwm1_out: pwm1-out {
295 samsung,pins = "gpd0-1";
296 samsung,pin-function = <2>;
297 samsung,pin-pud = <0>;
298 samsung,pin-drv = <0>;
299 };
300
301 lcd_ctrl: lcd-ctrl {
302 samsung,pins = "gpd0-0", "gpd0-1";
303 samsung,pin-function = <3>;
304 samsung,pin-pud = <0>;
305 samsung,pin-drv = <0>;
306 };
307
308 i2c7_bus: i2c7-bus {
309 samsung,pins = "gpd0-2", "gpd0-3";
310 samsung,pin-function = <3>;
311 samsung,pin-pud = <3>;
312 samsung,pin-drv = <0>;
313 };
314
315 pwm2_out: pwm2-out {
316 samsung,pins = "gpd0-2";
317 samsung,pin-function = <2>;
318 samsung,pin-pud = <0>;
319 samsung,pin-drv = <0>;
320 };
321
322 pwm3_out: pwm3-out {
323 samsung,pins = "gpd0-3";
324 samsung,pin-function = <2>;
325 samsung,pin-pud = <0>;
326 samsung,pin-drv = <0>;
327 };
328
329 i2c0_bus: i2c0-bus {
330 samsung,pins = "gpd1-0", "gpd1-1";
331 samsung,pin-function = <2>;
332 samsung,pin-pud = <3>;
333 samsung,pin-drv = <0>;
334 };
335
336 mipi0_clk: mipi0-clk {
337 samsung,pins = "gpd1-0", "gpd1-1";
338 samsung,pin-function = <3>;
339 samsung,pin-pud = <0>;
340 samsung,pin-drv = <0>;
341 };
342
343 i2c1_bus: i2c1-bus {
344 samsung,pins = "gpd1-2", "gpd1-3";
345 samsung,pin-function = <2>;
346 samsung,pin-pud = <3>;
347 samsung,pin-drv = <0>;
348 };
349
350 mipi1_clk: mipi1-clk {
351 samsung,pins = "gpd1-2", "gpd1-3";
352 samsung,pin-function = <3>;
353 samsung,pin-pud = <0>;
354 samsung,pin-drv = <0>;
355 };
356
357 lcd_clk: lcd-clk {
358 samsung,pins = "gpf0-0", "gpf0-1", "gpf0-2", "gpf0-3";
359 samsung,pin-function = <2>;
360 samsung,pin-pud = <0>;
361 samsung,pin-drv = <0>;
362 };
363
364 lcd_data16: lcd-data-width16 {
365 samsung,pins = "gpf0-7", "gpf1-0", "gpf1-1", "gpf1-2",
366 "gpf1-3", "gpf1-6", "gpf1-7", "gpf2-0",
367 "gpf2-1", "gpf2-2", "gpf2-3", "gpf2-7",
368 "gpf3-0", "gpf3-1", "gpf3-2", "gpf3-3";
369 samsung,pin-function = <2>;
370 samsung,pin-pud = <0>;
371 samsung,pin-drv = <0>;
372 };
373
374 lcd_data18: lcd-data-width18 {
375 samsung,pins = "gpf0-6", "gpf0-7", "gpf1-0", "gpf1-1",
376 "gpf1-2", "gpf1-3", "gpf1-6", "gpf1-7",
377 "gpf2-0", "gpf2-1", "gpf2-2", "gpf2-3",
378 "gpf2-6", "gpf2-7", "gpf3-0", "gpf3-1",
379 "gpf3-2", "gpf3-3";
380 samsung,pin-function = <2>;
381 samsung,pin-pud = <0>;
382 samsung,pin-drv = <0>;
383 };
384
385 lcd_data24: lcd-data-width24 {
386 samsung,pins = "gpf0-4", "gpf0-5", "gpf0-6", "gpf0-7",
387 "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3",
388 "gpf1-4", "gpf1-5", "gpf1-6", "gpf1-7",
389 "gpf2-0", "gpf2-1", "gpf2-2", "gpf2-3",
390 "gpf2-4", "gpf2-5", "gpf2-6", "gpf2-7",
391 "gpf3-0", "gpf3-1", "gpf3-2", "gpf3-3";
392 samsung,pin-function = <2>;
393 samsung,pin-pud = <0>;
394 samsung,pin-drv = <0>;
395 };
396
397 lcd_ldi: lcd-ldi {
398 samsung,pins = "gpf3-4";
399 samsung,pin-function = <2>;
400 samsung,pin-pud = <0>;
401 samsung,pin-drv = <0>;
402 };
403
404 cam_port_a: cam-port-a {
405 samsung,pins = "gpj0-0", "gpj0-1", "gpj0-2", "gpj0-3",
406 "gpj0-4", "gpj0-5", "gpj0-6", "gpj0-7",
407 "gpj1-0", "gpj1-1", "gpj1-2", "gpj1-3",
408 "gpj1-4";
409 samsung,pin-function = <2>;
410 samsung,pin-pud = <3>;
411 samsung,pin-drv = <0>;
412 };
413 };
414
415 pinctrl@11000000 {
416 gpk0: gpk0 {
417 gpio-controller;
418 #gpio-cells = <2>;
419
420 interrupt-controller;
421 #interrupt-cells = <2>;
422 };
423
424 gpk1: gpk1 {
425 gpio-controller;
426 #gpio-cells = <2>;
427
428 interrupt-controller;
429 #interrupt-cells = <2>;
430 };
431
432 gpk2: gpk2 {
433 gpio-controller;
434 #gpio-cells = <2>;
435
436 interrupt-controller;
437 #interrupt-cells = <2>;
438 };
439
440 gpk3: gpk3 {
441 gpio-controller;
442 #gpio-cells = <2>;
443
444 interrupt-controller;
445 #interrupt-cells = <2>;
446 };
447
448 gpl0: gpl0 {
449 gpio-controller;
450 #gpio-cells = <2>;
451
452 interrupt-controller;
453 #interrupt-cells = <2>;
454 };
455
456 gpl1: gpl1 {
457 gpio-controller;
458 #gpio-cells = <2>;
459
460 interrupt-controller;
461 #interrupt-cells = <2>;
462 };
463
464 gpl2: gpl2 {
465 gpio-controller;
466 #gpio-cells = <2>;
467
468 interrupt-controller;
469 #interrupt-cells = <2>;
470 };
471
472 gpm0: gpm0 {
473 gpio-controller;
474 #gpio-cells = <2>;
475
476 interrupt-controller;
477 #interrupt-cells = <2>;
478 };
479
480 gpm1: gpm1 {
481 gpio-controller;
482 #gpio-cells = <2>;
483
484 interrupt-controller;
485 #interrupt-cells = <2>;
486 };
487
488 gpm2: gpm2 {
489 gpio-controller;
490 #gpio-cells = <2>;
491
492 interrupt-controller;
493 #interrupt-cells = <2>;
494 };
495
496 gpm3: gpm3 {
497 gpio-controller;
498 #gpio-cells = <2>;
499
500 interrupt-controller;
501 #interrupt-cells = <2>;
502 };
503
504 gpm4: gpm4 {
505 gpio-controller;
506 #gpio-cells = <2>;
507
508 interrupt-controller;
509 #interrupt-cells = <2>;
510 };
511
512 gpy0: gpy0 {
513 gpio-controller;
514 #gpio-cells = <2>;
515 };
516
517 gpy1: gpy1 {
518 gpio-controller;
519 #gpio-cells = <2>;
520 };
521
522 gpy2: gpy2 {
523 gpio-controller;
524 #gpio-cells = <2>;
525 };
526
527 gpy3: gpy3 {
528 gpio-controller;
529 #gpio-cells = <2>;
530 };
531
532 gpy4: gpy4 {
533 gpio-controller;
534 #gpio-cells = <2>;
535 };
536
537 gpy5: gpy5 {
538 gpio-controller;
539 #gpio-cells = <2>;
540 };
541
542 gpy6: gpy6 {
543 gpio-controller;
544 #gpio-cells = <2>;
545 };
546
547 gpx0: gpx0 {
548 gpio-controller;
549 #gpio-cells = <2>;
550
551 interrupt-controller;
552 interrupt-parent = <&gic>;
553 interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
554 <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>;
555 #interrupt-cells = <2>;
556 };
557
558 gpx1: gpx1 {
559 gpio-controller;
560 #gpio-cells = <2>;
561
562 interrupt-controller;
563 interrupt-parent = <&gic>;
564 interrupts = <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
565 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
566 #interrupt-cells = <2>;
567 };
568
569 gpx2: gpx2 {
570 gpio-controller;
571 #gpio-cells = <2>;
572
573 interrupt-controller;
574 #interrupt-cells = <2>;
575 };
576
577 gpx3: gpx3 {
578 gpio-controller;
579 #gpio-cells = <2>;
580
581 interrupt-controller;
582 #interrupt-cells = <2>;
583 };
584
585 sd0_clk: sd0-clk {
586 samsung,pins = "gpk0-0";
587 samsung,pin-function = <2>;
588 samsung,pin-pud = <0>;
589 samsung,pin-drv = <3>;
590 };
591
592 sd0_cmd: sd0-cmd {
593 samsung,pins = "gpk0-1";
594 samsung,pin-function = <2>;
595 samsung,pin-pud = <0>;
596 samsung,pin-drv = <3>;
597 };
598
599 sd0_cd: sd0-cd {
600 samsung,pins = "gpk0-2";
601 samsung,pin-function = <2>;
602 samsung,pin-pud = <3>;
603 samsung,pin-drv = <3>;
604 };
605
606 sd0_bus1: sd0-bus-width1 {
607 samsung,pins = "gpk0-3";
608 samsung,pin-function = <2>;
609 samsung,pin-pud = <3>;
610 samsung,pin-drv = <3>;
611 };
612
613 sd0_bus4: sd0-bus-width4 {
614 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6";
615 samsung,pin-function = <2>;
616 samsung,pin-pud = <3>;
617 samsung,pin-drv = <3>;
618 };
619
620 sd0_bus8: sd0-bus-width8 {
621 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
622 samsung,pin-function = <3>;
623 samsung,pin-pud = <3>;
624 samsung,pin-drv = <3>;
625 };
626
627 sd4_clk: sd4-clk {
628 samsung,pins = "gpk0-0";
629 samsung,pin-function = <3>;
630 samsung,pin-pud = <0>;
631 samsung,pin-drv = <3>;
632 };
633
634 sd4_cmd: sd4-cmd {
635 samsung,pins = "gpk0-1";
636 samsung,pin-function = <3>;
637 samsung,pin-pud = <0>;
638 samsung,pin-drv = <3>;
639 };
640
641 sd4_cd: sd4-cd {
642 samsung,pins = "gpk0-2";
643 samsung,pin-function = <3>;
644 samsung,pin-pud = <3>;
645 samsung,pin-drv = <3>;
646 };
647
648 sd4_bus1: sd4-bus-width1 {
649 samsung,pins = "gpk0-3";
650 samsung,pin-function = <3>;
651 samsung,pin-pud = <3>;
652 samsung,pin-drv = <3>;
653 };
654
655 sd4_bus4: sd4-bus-width4 {
656 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6";
657 samsung,pin-function = <3>;
658 samsung,pin-pud = <3>;
659 samsung,pin-drv = <3>;
660 };
661
662 sd4_bus8: sd4-bus-width8 {
663 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
664 samsung,pin-function = <3>;
665 samsung,pin-pud = <4>;
666 samsung,pin-drv = <3>;
667 };
668
669 sd1_clk: sd1-clk {
670 samsung,pins = "gpk1-0";
671 samsung,pin-function = <2>;
672 samsung,pin-pud = <0>;
673 samsung,pin-drv = <3>;
674 };
675
676 sd1_cmd: sd1-cmd {
677 samsung,pins = "gpk1-1";
678 samsung,pin-function = <2>;
679 samsung,pin-pud = <0>;
680 samsung,pin-drv = <3>;
681 };
682
683 sd1_cd: sd1-cd {
684 samsung,pins = "gpk1-2";
685 samsung,pin-function = <2>;
686 samsung,pin-pud = <3>;
687 samsung,pin-drv = <3>;
688 };
689
690 sd1_bus1: sd1-bus-width1 {
691 samsung,pins = "gpk1-3";
692 samsung,pin-function = <2>;
693 samsung,pin-pud = <3>;
694 samsung,pin-drv = <3>;
695 };
696
697 sd1_bus4: sd1-bus-width4 {
698 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
699 samsung,pin-function = <2>;
700 samsung,pin-pud = <3>;
701 samsung,pin-drv = <3>;
702 };
703
704 sd2_clk: sd2-clk {
705 samsung,pins = "gpk2-0";
706 samsung,pin-function = <2>;
707 samsung,pin-pud = <0>;
708 samsung,pin-drv = <3>;
709 };
710
711 sd2_cmd: sd2-cmd {
712 samsung,pins = "gpk2-1";
713 samsung,pin-function = <2>;
714 samsung,pin-pud = <0>;
715 samsung,pin-drv = <3>;
716 };
717
718 sd2_cd: sd2-cd {
719 samsung,pins = "gpk2-2";
720 samsung,pin-function = <2>;
721 samsung,pin-pud = <3>;
722 samsung,pin-drv = <3>;
723 };
724
725 sd2_bus1: sd2-bus-width1 {
726 samsung,pins = "gpk2-3";
727 samsung,pin-function = <2>;
728 samsung,pin-pud = <3>;
729 samsung,pin-drv = <3>;
730 };
731
732 sd2_bus4: sd2-bus-width4 {
733 samsung,pins = "gpk2-3", "gpk2-4", "gpk2-5", "gpk2-6";
734 samsung,pin-function = <2>;
735 samsung,pin-pud = <3>;
736 samsung,pin-drv = <3>;
737 };
738
739 sd2_bus8: sd2-bus-width8 {
740 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6";
741 samsung,pin-function = <3>;
742 samsung,pin-pud = <3>;
743 samsung,pin-drv = <3>;
744 };
745
746 sd3_clk: sd3-clk {
747 samsung,pins = "gpk3-0";
748 samsung,pin-function = <2>;
749 samsung,pin-pud = <0>;
750 samsung,pin-drv = <3>;
751 };
752
753 sd3_cmd: sd3-cmd {
754 samsung,pins = "gpk3-1";
755 samsung,pin-function = <2>;
756 samsung,pin-pud = <0>;
757 samsung,pin-drv = <3>;
758 };
759
760 sd3_cd: sd3-cd {
761 samsung,pins = "gpk3-2";
762 samsung,pin-function = <2>;
763 samsung,pin-pud = <3>;
764 samsung,pin-drv = <3>;
765 };
766
767 sd3_bus1: sd3-bus-width1 {
768 samsung,pins = "gpk3-3";
769 samsung,pin-function = <2>;
770 samsung,pin-pud = <3>;
771 samsung,pin-drv = <3>;
772 };
773
774 sd3_bus4: sd3-bus-width4 {
775 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6";
776 samsung,pin-function = <2>;
777 samsung,pin-pud = <3>;
778 samsung,pin-drv = <3>;
779 };
780
781 keypad_col0: keypad-col0 {
782 samsung,pins = "gpl2-0";
783 samsung,pin-function = <3>;
784 samsung,pin-pud = <0>;
785 samsung,pin-drv = <0>;
786 };
787
788 keypad_col1: keypad-col1 {
789 samsung,pins = "gpl2-1";
790 samsung,pin-function = <3>;
791 samsung,pin-pud = <0>;
792 samsung,pin-drv = <0>;
793 };
794
795 keypad_col2: keypad-col2 {
796 samsung,pins = "gpl2-2";
797 samsung,pin-function = <3>;
798 samsung,pin-pud = <0>;
799 samsung,pin-drv = <0>;
800 };
801
802 keypad_col3: keypad-col3 {
803 samsung,pins = "gpl2-3";
804 samsung,pin-function = <3>;
805 samsung,pin-pud = <0>;
806 samsung,pin-drv = <0>;
807 };
808
809 keypad_col4: keypad-col4 {
810 samsung,pins = "gpl2-4";
811 samsung,pin-function = <3>;
812 samsung,pin-pud = <0>;
813 samsung,pin-drv = <0>;
814 };
815
816 keypad_col5: keypad-col5 {
817 samsung,pins = "gpl2-5";
818 samsung,pin-function = <3>;
819 samsung,pin-pud = <0>;
820 samsung,pin-drv = <0>;
821 };
822
823 keypad_col6: keypad-col6 {
824 samsung,pins = "gpl2-6";
825 samsung,pin-function = <3>;
826 samsung,pin-pud = <0>;
827 samsung,pin-drv = <0>;
828 };
829
830 keypad_col7: keypad-col7 {
831 samsung,pins = "gpl2-7";
832 samsung,pin-function = <3>;
833 samsung,pin-pud = <0>;
834 samsung,pin-drv = <0>;
835 };
836
837 cam_port_b: cam-port-b {
838 samsung,pins = "gpm0-0", "gpm0-1", "gpm0-2", "gpm0-3",
839 "gpm0-4", "gpm0-5", "gpm0-6", "gpm0-7",
840 "gpm1-0", "gpm1-1", "gpm2-0", "gpm2-1",
841 "gpm2-2";
842 samsung,pin-function = <3>;
843 samsung,pin-pud = <3>;
844 samsung,pin-drv = <0>;
845 };
846
847 eint0: ext-int0 {
848 samsung,pins = "gpx0-0";
849 samsung,pin-function = <0xf>;
850 samsung,pin-pud = <0>;
851 samsung,pin-drv = <0>;
852 };
853
854 eint8: ext-int8 {
855 samsung,pins = "gpx1-0";
856 samsung,pin-function = <0xf>;
857 samsung,pin-pud = <0>;
858 samsung,pin-drv = <0>;
859 };
860
861 eint15: ext-int15 {
862 samsung,pins = "gpx1-7";
863 samsung,pin-function = <0xf>;
864 samsung,pin-pud = <0>;
865 samsung,pin-drv = <0>;
866 };
867
868 eint16: ext-int16 {
869 samsung,pins = "gpx2-0";
870 samsung,pin-function = <0xf>;
871 samsung,pin-pud = <0>;
872 samsung,pin-drv = <0>;
873 };
874
875 eint31: ext-int31 {
876 samsung,pins = "gpx3-7";
877 samsung,pin-function = <0xf>;
878 samsung,pin-pud = <0>;
879 samsung,pin-drv = <0>;
880 };
881 };
882
883 pinctrl@03860000 {
884 gpz: gpz {
885 gpio-controller;
886 #gpio-cells = <2>;
887
888 interrupt-controller;
889 #interrupt-cells = <2>;
890 };
891
892 i2s0_bus: i2s0-bus {
893 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3",
894 "gpz-4", "gpz-5", "gpz-6";
895 samsung,pin-function = <0x2>;
896 samsung,pin-pud = <0>;
897 samsung,pin-drv = <0>;
898 };
899
900 pcm0_bus: pcm0-bus {
901 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3",
902 "gpz-4";
903 samsung,pin-function = <0x3>;
904 samsung,pin-pud = <0>;
905 samsung,pin-drv = <0>;
906 };
907 };
908
909 pinctrl@106E0000 {
910 gpv0: gpv0 {
911 gpio-controller;
912 #gpio-cells = <2>;
913
914 interrupt-controller;
915 #interrupt-cells = <2>;
916 };
917
918 gpv1: gpv1 {
919 gpio-controller;
920 #gpio-cells = <2>;
921
922 interrupt-controller;
923 #interrupt-cells = <2>;
924 };
925
926 gpv2: gpv2 {
927 gpio-controller;
928 #gpio-cells = <2>;
929
930 interrupt-controller;
931 #interrupt-cells = <2>;
932 };
933
934 gpv3: gpv3 {
935 gpio-controller;
936 #gpio-cells = <2>;
937
938 interrupt-controller;
939 #interrupt-cells = <2>;
940 };
941
942 gpv4: gpv4 {
943 gpio-controller;
944 #gpio-cells = <2>;
945
946 interrupt-controller;
947 #interrupt-cells = <2>;
948 };
949
950 c2c_bus: c2c-bus {
951 samsung,pins = "gpv0-0", "gpv0-1", "gpv0-2", "gpv0-3",
952 "gpv0-4", "gpv0-5", "gpv0-6", "gpv0-7",
953 "gpv1-0", "gpv1-1", "gpv1-2", "gpv1-3",
954 "gpv1-4", "gpv1-5", "gpv1-6", "gpv1-7",
955 "gpv2-0", "gpv2-1", "gpv2-2", "gpv2-3",
956 "gpv2-4", "gpv2-5", "gpv2-6", "gpv2-7",
957 "gpv3-0", "gpv3-1", "gpv3-2", "gpv3-3",
958 "gpv3-4", "gpv3-5", "gpv3-6", "gpv3-7",
959 "gpv4-0", "gpv4-1";
960 samsung,pin-function = <0x2>;
961 samsung,pin-pud = <0>;
962 samsung,pin-drv = <0>;
963 };
964 };
965};
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
new file mode 100644
index 00000000000..179a62e46c9
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -0,0 +1,69 @@
1/*
2 * Samsung's Exynos4x12 SoCs device tree source
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Samsung's Exynos4x12 SoCs device nodes are listed in this file. Exynos4x12
8 * based board files can include this file and provide values for board specfic
9 * bindings.
10 *
11 * Note: This file does not include device nodes for all the controllers in
12 * Exynos4x12 SoC. As device tree coverage for Exynos4x12 increases, additional
13 * nodes can be added to this file.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18*/
19
20/include/ "exynos4.dtsi"
21/include/ "exynos4x12-pinctrl.dtsi"
22
23/ {
24 aliases {
25 pinctrl0 = &pinctrl_0;
26 pinctrl1 = &pinctrl_1;
27 pinctrl2 = &pinctrl_2;
28 pinctrl3 = &pinctrl_3;
29 };
30
31 combiner:interrupt-controller@10440000 {
32 interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
33 <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
34 <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
35 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
36 <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>;
37 };
38
39 pinctrl_0: pinctrl@11400000 {
40 compatible = "samsung,pinctrl-exynos4x12";
41 reg = <0x11400000 0x1000>;
42 interrupts = <0 47 0>;
43 };
44
45 pinctrl_1: pinctrl@11000000 {
46 compatible = "samsung,pinctrl-exynos4x12";
47 reg = <0x11000000 0x1000>;
48 interrupts = <0 46 0>;
49
50 wakup_eint: wakeup-interrupt-controller {
51 compatible = "samsung,exynos4210-wakeup-eint";
52 interrupt-parent = <&gic>;
53 interrupts = <0 32 0>;
54 };
55 };
56
57 pinctrl_2: pinctrl@03860000 {
58 compatible = "samsung,pinctrl-exynos4x12";
59 reg = <0x03860000 0x1000>;
60 interrupt-parent = <&combiner>;
61 interrupts = <10 0>;
62 };
63
64 pinctrl_3: pinctrl@106E0000 {
65 compatible = "samsung,pinctrl-exynos4x12";
66 reg = <0x106E0000 0x1000>;
67 interrupts = <0 72 0>;
68 };
69};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a352df403b7..942d5761ca9 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -17,10 +17,6 @@
17 compatible = "samsung,smdk5250", "samsung,exynos5250"; 17 compatible = "samsung,smdk5250", "samsung,exynos5250";
18 18
19 aliases { 19 aliases {
20 mshc0 = &dwmmc_0;
21 mshc1 = &dwmmc_1;
22 mshc2 = &dwmmc_2;
23 mshc3 = &dwmmc_3;
24 }; 20 };
25 21
26 memory { 22 memory {
@@ -55,8 +51,31 @@
55 }; 51 };
56 }; 52 };
57 53
54 i2c@121D0000 {
55 samsung,i2c-sda-delay = <100>;
56 samsung,i2c-max-bus-freq = <40000>;
57 samsung,i2c-slave-addr = <0x38>;
58
59 sata-phy {
60 compatible = "samsung,sata-phy";
61 reg = <0x38>;
62 };
63 };
64
65 sata@122F0000 {
66 samsung,sata-freq = <66>;
67 };
68
58 i2c@12C80000 { 69 i2c@12C80000 {
59 status = "disabled"; 70 samsung,i2c-sda-delay = <100>;
71 samsung,i2c-max-bus-freq = <66000>;
72 gpios = <&gpa0 6 3 3 0>,
73 <&gpa0 7 3 3 0>;
74
75 hdmiddc@50 {
76 compatible = "samsung,exynos5-hdmiddc";
77 reg = <0x50>;
78 };
60 }; 79 };
61 80
62 i2c@12C90000 { 81 i2c@12C90000 {
@@ -79,7 +98,17 @@
79 status = "disabled"; 98 status = "disabled";
80 }; 99 };
81 100
82 dwmmc_0: dwmmc0@12200000 { 101 i2c@12CE0000 {
102 samsung,i2c-sda-delay = <100>;
103 samsung,i2c-max-bus-freq = <66000>;
104
105 hdmiphy@38 {
106 compatible = "samsung,exynos5-hdmiphy";
107 reg = <0x38>;
108 };
109 };
110
111 dwmmc0@12200000 {
83 num-slots = <1>; 112 num-slots = <1>;
84 supports-highspeed; 113 supports-highspeed;
85 broken-cd; 114 broken-cd;
@@ -100,11 +129,11 @@
100 }; 129 };
101 }; 130 };
102 131
103 dwmmc_1: dwmmc1@12210000 { 132 dwmmc1@12210000 {
104 status = "disabled"; 133 status = "disabled";
105 }; 134 };
106 135
107 dwmmc_2: dwmmc2@12220000 { 136 dwmmc2@12220000 {
108 num-slots = <1>; 137 num-slots = <1>;
109 supports-highspeed; 138 supports-highspeed;
110 fifo-depth = <0x80>; 139 fifo-depth = <0x80>;
@@ -125,7 +154,7 @@
125 }; 154 };
126 }; 155 };
127 156
128 dwmmc_3: dwmmc3@12230000 { 157 dwmmc3@12230000 {
129 status = "disabled"; 158 status = "disabled";
130 }; 159 };
131 160
@@ -166,4 +195,13 @@
166 spi_2: spi@12d40000 { 195 spi_2: spi@12d40000 {
167 status = "disabled"; 196 status = "disabled";
168 }; 197 };
198
199 hdmi {
200 hpd-gpio = <&gpx3 7 0xf 1 3>;
201 };
202
203 codec@11000000 {
204 samsung,mfc-r = <0x43000000 0x800000>;
205 samsung,mfc-l = <0x51000000 0x800000>;
206 };
169}; 207};
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
new file mode 100644
index 00000000000..17dd951c1cd
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -0,0 +1,43 @@
1/*
2 * Google Snow board device tree source
3 *
4 * Copyright (c) 2012 Google, Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11/dts-v1/;
12/include/ "exynos5250.dtsi"
13/include/ "cros5250-common.dtsi"
14
15/ {
16 model = "Google Snow";
17 compatible = "google,snow", "samsung,exynos5250";
18
19 gpio-keys {
20 compatible = "gpio-keys";
21
22 lid-switch {
23 label = "Lid";
24 gpios = <&gpx3 5 0 0x10000 0>;
25 linux,input-type = <5>; /* EV_SW */
26 linux,code = <0>; /* SW_LID */
27 debounce-interval = <1>;
28 gpio-key,wakeup;
29 };
30 };
31
32 /*
33 * On Snow we've got SIP WiFi and so can keep drive strengths low to
34 * reduce EMI.
35 */
36 dwmmc3@12230000 {
37 slot@0 {
38 gpios = <&gpc4 0 2 0 0>, <&gpc4 1 2 3 0>,
39 <&gpc4 3 2 3 0>, <&gpc4 4 2 3 0>,
40 <&gpc4 5 2 3 0>, <&gpc4 6 2 3 0>;
41 };
42 };
43};
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index dddfd6e444d..36d8246ea50 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -31,6 +31,10 @@
31 gsc1 = &gsc_1; 31 gsc1 = &gsc_1;
32 gsc2 = &gsc_2; 32 gsc2 = &gsc_2;
33 gsc3 = &gsc_3; 33 gsc3 = &gsc_3;
34 mshc0 = &dwmmc_0;
35 mshc1 = &dwmmc_1;
36 mshc2 = &dwmmc_2;
37 mshc3 = &dwmmc_3;
34 }; 38 };
35 39
36 gic:interrupt-controller@10481000 { 40 gic:interrupt-controller@10481000 {
@@ -62,12 +66,24 @@
62 interrupts = <0 42 0>; 66 interrupts = <0 42 0>;
63 }; 67 };
64 68
69 codec@11000000 {
70 compatible = "samsung,mfc-v6";
71 reg = <0x11000000 0x10000>;
72 interrupts = <0 96 0>;
73 };
74
65 rtc { 75 rtc {
66 compatible = "samsung,s3c6410-rtc"; 76 compatible = "samsung,s3c6410-rtc";
67 reg = <0x101E0000 0x100>; 77 reg = <0x101E0000 0x100>;
68 interrupts = <0 43 0>, <0 44 0>; 78 interrupts = <0 43 0>, <0 44 0>;
69 }; 79 };
70 80
81 tmu@10060000 {
82 compatible = "samsung,exynos5250-tmu";
83 reg = <0x10060000 0x100>;
84 interrupts = <0 65 0>;
85 };
86
71 serial@12C00000 { 87 serial@12C00000 {
72 compatible = "samsung,exynos4210-uart"; 88 compatible = "samsung,exynos4210-uart";
73 reg = <0x12C00000 0x100>; 89 reg = <0x12C00000 0x100>;
@@ -92,6 +108,17 @@
92 interrupts = <0 54 0>; 108 interrupts = <0 54 0>;
93 }; 109 };
94 110
111 sata@122F0000 {
112 compatible = "samsung,exynos5-sata-ahci";
113 reg = <0x122F0000 0x1ff>;
114 interrupts = <0 115 0>;
115 };
116
117 sata-phy@12170000 {
118 compatible = "samsung,exynos5-sata-phy";
119 reg = <0x12170000 0x1ff>;
120 };
121
95 i2c@12C60000 { 122 i2c@12C60000 {
96 compatible = "samsung,s3c2440-i2c"; 123 compatible = "samsung,s3c2440-i2c";
97 reg = <0x12C60000 0x100>; 124 reg = <0x12C60000 0x100>;
@@ -156,6 +183,21 @@
156 #size-cells = <0>; 183 #size-cells = <0>;
157 }; 184 };
158 185
186 i2c@12CE0000 {
187 compatible = "samsung,s3c2440-hdmiphy-i2c";
188 reg = <0x12CE0000 0x1000>;
189 interrupts = <0 64 0>;
190 #address-cells = <1>;
191 #size-cells = <0>;
192 };
193
194 i2c@121D0000 {
195 compatible = "samsung,exynos5-sata-phy-i2c";
196 reg = <0x121D0000 0x100>;
197 #address-cells = <1>;
198 #size-cells = <0>;
199 };
200
159 spi_0: spi@12d20000 { 201 spi_0: spi@12d20000 {
160 compatible = "samsung,exynos4210-spi"; 202 compatible = "samsung,exynos4210-spi";
161 reg = <0x12d20000 0x100>; 203 reg = <0x12d20000 0x100>;
@@ -186,7 +228,7 @@
186 #size-cells = <0>; 228 #size-cells = <0>;
187 }; 229 };
188 230
189 dwmmc0@12200000 { 231 dwmmc_0: dwmmc0@12200000 {
190 compatible = "samsung,exynos5250-dw-mshc"; 232 compatible = "samsung,exynos5250-dw-mshc";
191 reg = <0x12200000 0x1000>; 233 reg = <0x12200000 0x1000>;
192 interrupts = <0 75 0>; 234 interrupts = <0 75 0>;
@@ -194,7 +236,7 @@
194 #size-cells = <0>; 236 #size-cells = <0>;
195 }; 237 };
196 238
197 dwmmc1@12210000 { 239 dwmmc_1: dwmmc1@12210000 {
198 compatible = "samsung,exynos5250-dw-mshc"; 240 compatible = "samsung,exynos5250-dw-mshc";
199 reg = <0x12210000 0x1000>; 241 reg = <0x12210000 0x1000>;
200 interrupts = <0 76 0>; 242 interrupts = <0 76 0>;
@@ -202,7 +244,7 @@
202 #size-cells = <0>; 244 #size-cells = <0>;
203 }; 245 };
204 246
205 dwmmc2@12220000 { 247 dwmmc_2: dwmmc2@12220000 {
206 compatible = "samsung,exynos5250-dw-mshc"; 248 compatible = "samsung,exynos5250-dw-mshc";
207 reg = <0x12220000 0x1000>; 249 reg = <0x12220000 0x1000>;
208 interrupts = <0 77 0>; 250 interrupts = <0 77 0>;
@@ -210,7 +252,7 @@
210 #size-cells = <0>; 252 #size-cells = <0>;
211 }; 253 };
212 254
213 dwmmc3@12230000 { 255 dwmmc_3: dwmmc3@12230000 {
214 compatible = "samsung,exynos5250-dw-mshc"; 256 compatible = "samsung,exynos5250-dw-mshc";
215 reg = <0x12230000 0x1000>; 257 reg = <0x12230000 0x1000>;
216 interrupts = <0 78 0>; 258 interrupts = <0 78 0>;
@@ -520,4 +562,16 @@
520 reg = <0x13e30000 0x1000>; 562 reg = <0x13e30000 0x1000>;
521 interrupts = <0 88 0>; 563 interrupts = <0 88 0>;
522 }; 564 };
565
566 hdmi {
567 compatible = "samsung,exynos5-hdmi";
568 reg = <0x14530000 0x100000>;
569 interrupts = <0 95 0>;
570 };
571
572 mixer {
573 compatible = "samsung,exynos5-mixer";
574 reg = <0x14450000 0x10000>;
575 interrupts = <0 94 0>;
576 };
523}; 577};
diff --git a/arch/arm/boot/dts/exynos5440-ssdk5440.dts b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
new file mode 100644
index 00000000000..921c83cf694
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
@@ -0,0 +1,46 @@
1/*
2 * SAMSUNG SSDK5440 board device tree source
3 *
4 * Copyright (c) 2012 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/ "exynos5440.dtsi"
14
15/ {
16 model = "SAMSUNG SSDK5440 board based on EXYNOS5440";
17 compatible = "samsung,ssdk5440", "samsung,exynos5440";
18
19 memory {
20 reg = <0x80000000 0x80000000>;
21 };
22
23 chosen {
24 bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x81000000,8M console=ttySAC2,115200 init=/linuxrc";
25 };
26
27 spi {
28 status = "disabled";
29 };
30
31 i2c@F0000 {
32 status = "disabled";
33 };
34
35 i2c@100000 {
36 status = "disabled";
37 };
38
39 watchdog {
40 status = "disabled";
41 };
42
43 rtc {
44 status = "disabled";
45 };
46};
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
new file mode 100644
index 00000000000..024269de8ee
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -0,0 +1,159 @@
1/*
2 * SAMSUNG EXYNOS5440 SoC device tree source
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12/include/ "skeleton.dtsi"
13
14/ {
15 compatible = "samsung,exynos5440";
16
17 interrupt-parent = <&gic>;
18
19 gic:interrupt-controller@2E0000 {
20 compatible = "arm,cortex-a15-gic";
21 #interrupt-cells = <3>;
22 interrupt-controller;
23 reg = <0x2E1000 0x1000>, <0x2E2000 0x1000>;
24 };
25
26 cpus {
27 cpu@0 {
28 compatible = "arm,cortex-a15";
29 timer {
30 compatible = "arm,armv7-timer";
31 interrupts = <1 13 0xf08>;
32 clock-frequency = <1000000>;
33 };
34 };
35 cpu@1 {
36 compatible = "arm,cortex-a15";
37 timer {
38 compatible = "arm,armv7-timer";
39 interrupts = <1 14 0xf08>;
40 clock-frequency = <1000000>;
41 };
42 };
43 cpu@2 {
44 compatible = "arm,cortex-a15";
45 timer {
46 compatible = "arm,armv7-timer";
47 interrupts = <1 14 0xf08>;
48 clock-frequency = <1000000>;
49 };
50 };
51 cpu@3 {
52 compatible = "arm,cortex-a15";
53 timer {
54 compatible = "arm,armv7-timer";
55 interrupts = <1 14 0xf08>;
56 clock-frequency = <1000000>;
57 };
58 };
59 };
60
61 common {
62 compatible = "samsung,exynos5440";
63
64 };
65
66 serial@B0000 {
67 compatible = "samsung,exynos4210-uart";
68 reg = <0xB0000 0x1000>;
69 interrupts = <0 2 0>;
70 };
71
72 serial@C0000 {
73 compatible = "samsung,exynos4210-uart";
74 reg = <0xC0000 0x1000>;
75 interrupts = <0 3 0>;
76 };
77
78 spi {
79 compatible = "samsung,exynos4210-spi";
80 reg = <0xD0000 0x1000>;
81 interrupts = <0 4 0>;
82 tx-dma-channel = <&pdma0 5>; /* preliminary */
83 rx-dma-channel = <&pdma0 4>; /* preliminary */
84 #address-cells = <1>;
85 #size-cells = <0>;
86 };
87
88 pinctrl {
89 compatible = "samsung,pinctrl-exynos5440";
90 reg = <0xE0000 0x1000>;
91 interrupt-controller;
92 #interrupt-cells = <2>;
93 #gpio-cells = <2>;
94
95 fan: fan {
96 samsung,exynos5440-pin-function = <1>;
97 };
98
99 hdd_led0: hdd_led0 {
100 samsung,exynos5440-pin-function = <2>;
101 };
102
103 hdd_led1: hdd_led1 {
104 samsung,exynos5440-pin-function = <3>;
105 };
106
107 uart1: uart1 {
108 samsung,exynos5440-pin-function = <4>;
109 };
110 };
111
112 i2c@F0000 {
113 compatible = "samsung,s3c2440-i2c";
114 reg = <0xF0000 0x1000>;
115 interrupts = <0 5 0>;
116 #address-cells = <1>;
117 #size-cells = <0>;
118 };
119
120 i2c@100000 {
121 compatible = "samsung,s3c2440-i2c";
122 reg = <0x100000 0x1000>;
123 interrupts = <0 6 0>;
124 #address-cells = <1>;
125 #size-cells = <0>;
126 };
127
128 watchdog {
129 compatible = "samsung,s3c2410-wdt";
130 reg = <0x110000 0x1000>;
131 interrupts = <0 1 0>;
132 };
133
134 amba {
135 #address-cells = <1>;
136 #size-cells = <1>;
137 compatible = "arm,amba-bus";
138 interrupt-parent = <&gic>;
139 ranges;
140
141 pdma0: pdma@121A0000 {
142 compatible = "arm,pl330", "arm,primecell";
143 reg = <0x120000 0x1000>;
144 interrupts = <0 34 0>;
145 };
146
147 pdma1: pdma@121B0000 {
148 compatible = "arm,pl330", "arm,primecell";
149 reg = <0x121000 0x1000>;
150 interrupts = <0 35 0>;
151 };
152 };
153
154 rtc {
155 compatible = "samsung,s3c6410-rtc";
156 reg = <0x130000 0x1000>;
157 interrupts = <0 16 0>, <0 17 0>;
158 };
159};
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
index 0c6fc34821f..a9ae5d32e80 100644
--- a/arch/arm/boot/dts/highbank.dts
+++ b/arch/arm/boot/dts/highbank.dts
@@ -69,16 +69,8 @@
69 reg = <0x00000000 0xff900000>; 69 reg = <0x00000000 0xff900000>;
70 }; 70 };
71 71
72 chosen {
73 bootargs = "console=ttyAMA0";
74 };
75
76 soc { 72 soc {
77 #address-cells = <1>; 73 ranges = <0x00000000 0x00000000 0xffffffff>;
78 #size-cells = <1>;
79 compatible = "simple-bus";
80 interrupt-parent = <&intc>;
81 ranges;
82 74
83 timer@fff10600 { 75 timer@fff10600 {
84 compatible = "arm,cortex-a9-twd-timer"; 76 compatible = "arm,cortex-a9-twd-timer";
@@ -117,173 +109,6 @@
117 interrupts = <0 76 4 0 75 4 0 74 4 0 73 4>; 109 interrupts = <0 76 4 0 75 4 0 74 4 0 73 4>;
118 }; 110 };
119 111
120 sata@ffe08000 {
121 compatible = "calxeda,hb-ahci";
122 reg = <0xffe08000 0x10000>;
123 interrupts = <0 83 4>;
124 calxeda,port-phys = <&combophy5 0 &combophy0 0
125 &combophy0 1 &combophy0 2
126 &combophy0 3>;
127 dma-coherent;
128 };
129
130 sdhci@ffe0e000 {
131 compatible = "calxeda,hb-sdhci";
132 reg = <0xffe0e000 0x1000>;
133 interrupts = <0 90 4>;
134 clocks = <&eclk>;
135 };
136
137 memory-controller@fff00000 {
138 compatible = "calxeda,hb-ddr-ctrl";
139 reg = <0xfff00000 0x1000>;
140 interrupts = <0 91 4>;
141 };
142
143 ipc@fff20000 {
144 compatible = "arm,pl320", "arm,primecell";
145 reg = <0xfff20000 0x1000>;
146 interrupts = <0 7 4>;
147 clocks = <&pclk>;
148 clock-names = "apb_pclk";
149 };
150
151 gpioe: gpio@fff30000 {
152 #gpio-cells = <2>;
153 compatible = "arm,pl061", "arm,primecell";
154 gpio-controller;
155 reg = <0xfff30000 0x1000>;
156 interrupts = <0 14 4>;
157 clocks = <&pclk>;
158 clock-names = "apb_pclk";
159 };
160
161 gpiof: gpio@fff31000 {
162 #gpio-cells = <2>;
163 compatible = "arm,pl061", "arm,primecell";
164 gpio-controller;
165 reg = <0xfff31000 0x1000>;
166 interrupts = <0 15 4>;
167 clocks = <&pclk>;
168 clock-names = "apb_pclk";
169 };
170
171 gpiog: gpio@fff32000 {
172 #gpio-cells = <2>;
173 compatible = "arm,pl061", "arm,primecell";
174 gpio-controller;
175 reg = <0xfff32000 0x1000>;
176 interrupts = <0 16 4>;
177 clocks = <&pclk>;
178 clock-names = "apb_pclk";
179 };
180
181 gpioh: gpio@fff33000 {
182 #gpio-cells = <2>;
183 compatible = "arm,pl061", "arm,primecell";
184 gpio-controller;
185 reg = <0xfff33000 0x1000>;
186 interrupts = <0 17 4>;
187 clocks = <&pclk>;
188 clock-names = "apb_pclk";
189 };
190
191 timer {
192 compatible = "arm,sp804", "arm,primecell";
193 reg = <0xfff34000 0x1000>;
194 interrupts = <0 18 4>;
195 clocks = <&pclk>;
196 clock-names = "apb_pclk";
197 };
198
199 rtc@fff35000 {
200 compatible = "arm,pl031", "arm,primecell";
201 reg = <0xfff35000 0x1000>;
202 interrupts = <0 19 4>;
203 clocks = <&pclk>;
204 clock-names = "apb_pclk";
205 };
206
207 serial@fff36000 {
208 compatible = "arm,pl011", "arm,primecell";
209 reg = <0xfff36000 0x1000>;
210 interrupts = <0 20 4>;
211 clocks = <&pclk>;
212 clock-names = "apb_pclk";
213 };
214
215 smic@fff3a000 {
216 compatible = "ipmi-smic";
217 device_type = "ipmi";
218 reg = <0xfff3a000 0x1000>;
219 interrupts = <0 24 4>;
220 reg-size = <4>;
221 reg-spacing = <4>;
222 };
223
224 sregs@fff3c000 {
225 compatible = "calxeda,hb-sregs";
226 reg = <0xfff3c000 0x1000>;
227
228 clocks {
229 #address-cells = <1>;
230 #size-cells = <0>;
231
232 osc: oscillator {
233 #clock-cells = <0>;
234 compatible = "fixed-clock";
235 clock-frequency = <33333000>;
236 };
237
238 ddrpll: ddrpll {
239 #clock-cells = <0>;
240 compatible = "calxeda,hb-pll-clock";
241 clocks = <&osc>;
242 reg = <0x108>;
243 };
244
245 a9pll: a9pll {
246 #clock-cells = <0>;
247 compatible = "calxeda,hb-pll-clock";
248 clocks = <&osc>;
249 reg = <0x100>;
250 };
251
252 a9periphclk: a9periphclk {
253 #clock-cells = <0>;
254 compatible = "calxeda,hb-a9periph-clock";
255 clocks = <&a9pll>;
256 reg = <0x104>;
257 };
258
259 a9bclk: a9bclk {
260 #clock-cells = <0>;
261 compatible = "calxeda,hb-a9bus-clock";
262 clocks = <&a9pll>;
263 reg = <0x104>;
264 };
265
266 emmcpll: emmcpll {
267 #clock-cells = <0>;
268 compatible = "calxeda,hb-pll-clock";
269 clocks = <&osc>;
270 reg = <0x10C>;
271 };
272
273 eclk: eclk {
274 #clock-cells = <0>;
275 compatible = "calxeda,hb-emmc-clock";
276 clocks = <&emmcpll>;
277 reg = <0x114>;
278 };
279
280 pclk: pclk {
281 #clock-cells = <0>;
282 compatible = "fixed-clock";
283 clock-frequency = <150000000>;
284 };
285 };
286 };
287 112
288 sregs@fff3c200 { 113 sregs@fff3c200 {
289 compatible = "calxeda,hb-sregs-l2-ecc"; 114 compatible = "calxeda,hb-sregs-l2-ecc";
@@ -291,38 +116,7 @@
291 interrupts = <0 71 4 0 72 4>; 116 interrupts = <0 71 4 0 72 4>;
292 }; 117 };
293 118
294 dma@fff3d000 {
295 compatible = "arm,pl330", "arm,primecell";
296 reg = <0xfff3d000 0x1000>;
297 interrupts = <0 92 4>;
298 clocks = <&pclk>;
299 clock-names = "apb_pclk";
300 };
301
302 ethernet@fff50000 {
303 compatible = "calxeda,hb-xgmac";
304 reg = <0xfff50000 0x1000>;
305 interrupts = <0 77 4 0 78 4 0 79 4>;
306 };
307
308 ethernet@fff51000 {
309 compatible = "calxeda,hb-xgmac";
310 reg = <0xfff51000 0x1000>;
311 interrupts = <0 80 4 0 81 4 0 82 4>;
312 };
313
314 combophy0: combo-phy@fff58000 {
315 compatible = "calxeda,hb-combophy";
316 #phy-cells = <1>;
317 reg = <0xfff58000 0x1000>;
318 phydev = <5>;
319 };
320
321 combophy5: combo-phy@fff5d000 {
322 compatible = "calxeda,hb-combophy";
323 #phy-cells = <1>;
324 reg = <0xfff5d000 0x1000>;
325 phydev = <31>;
326 };
327 }; 119 };
328}; 120};
121
122/include/ "ecx-common.dtsi"
diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi
new file mode 100644
index 00000000000..592fb9dc35b
--- /dev/null
+++ b/arch/arm/boot/dts/href.dtsi
@@ -0,0 +1,273 @@
1/*
2 * Copyright 2012 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/include/ "dbx5x0.dtsi"
13
14/ {
15 memory {
16 reg = <0x00000000 0x20000000>;
17 };
18
19 gpio_keys {
20 compatible = "gpio-keys";
21 #address-cells = <1>;
22 #size-cells = <0>;
23
24 button@1 {
25 linux,code = <11>;
26 label = "SFH7741 Proximity Sensor";
27 };
28 };
29
30 soc-u9500 {
31 uart@80120000 {
32 status = "okay";
33 };
34
35 uart@80121000 {
36 status = "okay";
37 };
38
39 uart@80007000 {
40 status = "okay";
41 };
42
43 i2c@80004000 {
44 tc3589x@42 {
45 compatible = "tc3589x";
46 reg = <0x42>;
47 interrupt-parent = <&gpio6>;
48 interrupts = <25 0x1>;
49
50 interrupt-controller;
51 #interrupt-cells = <2>;
52
53 tc3589x_gpio: tc3589x_gpio {
54 compatible = "tc3589x-gpio";
55 interrupts = <0 0x1>;
56
57 interrupt-controller;
58 #interrupt-cells = <2>;
59 gpio-controller;
60 #gpio-cells = <2>;
61 };
62 };
63 };
64
65 i2c@80128000 {
66 lp5521@0x33 {
67 compatible = "lp5521";
68 reg = <0x33>;
69 };
70
71 lp5521@0x34 {
72 compatible = "lp5521";
73 reg = <0x34>;
74 };
75
76 bh1780@0x29 {
77 compatible = "rohm,bh1780gli";
78 reg = <0x33>;
79 };
80 };
81
82 // External Micro SD slot
83 sdi0_per1@80126000 {
84 arm,primecell-periphid = <0x10480180>;
85 max-frequency = <50000000>;
86 bus-width = <4>;
87 mmc-cap-sd-highspeed;
88 mmc-cap-mmc-highspeed;
89 vmmc-supply = <&ab8500_ldo_aux3_reg>;
90
91 cd-gpios = <&tc3589x_gpio 3 0x4>;
92
93 status = "okay";
94 };
95
96 // WLAN SDIO channel
97 sdi1_per2@80118000 {
98 arm,primecell-periphid = <0x10480180>;
99 max-frequency = <50000000>;
100 bus-width = <4>;
101
102 status = "okay";
103 };
104
105 // PoP:ed eMMC
106 sdi2_per3@80005000 {
107 arm,primecell-periphid = <0x10480180>;
108 max-frequency = <50000000>;
109 bus-width = <8>;
110 mmc-cap-mmc-highspeed;
111
112 status = "okay";
113 };
114
115 // On-board eMMC
116 sdi4_per2@80114000 {
117 arm,primecell-periphid = <0x10480180>;
118 max-frequency = <50000000>;
119 bus-width = <8>;
120 mmc-cap-mmc-highspeed;
121 vmmc-supply = <&ab8500_ldo_aux2_reg>;
122
123 status = "okay";
124 };
125
126 sound {
127 compatible = "stericsson,snd-soc-mop500";
128
129 stericsson,cpu-dai = <&msp1 &msp3>;
130 stericsson,audio-codec = <&codec>;
131 };
132
133 msp1: msp@80124000 {
134 status = "okay";
135 };
136
137 msp3: msp@80125000 {
138 status = "okay";
139 };
140
141 prcmu@80157000 {
142 db8500-prcmu-regulators {
143 db8500_vape_reg: db8500_vape {
144 regulator-name = "db8500-vape";
145 };
146
147 db8500_varm_reg: db8500_varm {
148 regulator-name = "db8500-varm";
149 };
150
151 db8500_vmodem_reg: db8500_vmodem {
152 regulator-name = "db8500-vmodem";
153 };
154
155 db8500_vpll_reg: db8500_vpll {
156 regulator-name = "db8500-vpll";
157 };
158
159 db8500_vsmps1_reg: db8500_vsmps1 {
160 regulator-name = "db8500-vsmps1";
161 };
162
163 db8500_vsmps2_reg: db8500_vsmps2 {
164 regulator-name = "db8500-vsmps2";
165 };
166
167 db8500_vsmps3_reg: db8500_vsmps3 {
168 regulator-name = "db8500-vsmps3";
169 };
170
171 db8500_vrf1_reg: db8500_vrf1 {
172 regulator-name = "db8500-vrf1";
173 };
174
175 db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
176 regulator-name = "db8500-sva-mmdsp";
177 };
178
179 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
180 regulator-name = "db8500-sva-mmdsp-ret";
181 };
182
183 db8500_sva_pipe_reg: db8500_sva_pipe {
184 regulator-name = "db8500_sva_pipe";
185 };
186
187 db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
188 regulator-name = "db8500_sia_mmdsp";
189 };
190
191 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
192 regulator-name = "db8500-sia-mmdsp-ret";
193 };
194
195 db8500_sia_pipe_reg: db8500_sia_pipe {
196 regulator-name = "db8500-sia-pipe";
197 };
198
199 db8500_sga_reg: db8500_sga {
200 regulator-name = "db8500-sga";
201 };
202
203 db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
204 regulator-name = "db8500-b2r2-mcde";
205 };
206
207 db8500_esram12_reg: db8500_esram12 {
208 regulator-name = "db8500-esram12";
209 };
210
211 db8500_esram12_ret_reg: db8500_esram12_ret {
212 regulator-name = "db8500-esram12-ret";
213 };
214
215 db8500_esram34_reg: db8500_esram34 {
216 regulator-name = "db8500-esram34";
217 };
218
219 db8500_esram34_ret_reg: db8500_esram34_ret {
220 regulator-name = "db8500-esram34-ret";
221 };
222 };
223
224 ab8500@5 {
225 ab8500-regulators {
226 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
227 regulator-name = "V-DISPLAY";
228 };
229
230 ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
231 regulator-name = "V-eMMC1";
232 };
233
234 ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
235 regulator-name = "V-MMC-SD";
236 };
237
238 ab8500_ldo_initcore_reg: ab8500_ldo_initcore {
239 regulator-name = "V-INTCORE";
240 };
241
242 ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
243 regulator-name = "V-TVOUT";
244 };
245
246 ab8500_ldo_usb_reg: ab8500_ldo_usb {
247 regulator-name = "dummy";
248 };
249
250 ab8500_ldo_audio_reg: ab8500_ldo_audio {
251 regulator-name = "V-AUD";
252 };
253
254 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
255 regulator-name = "V-AMIC1";
256 };
257
258 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 {
259 regulator-name = "V-AMIC2";
260 };
261
262 ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
263 regulator-name = "V-DMIC";
264 };
265
266 ab8500_ldo_ana_reg: ab8500_ldo_ana {
267 regulator-name = "V-CSI/DSI";
268 };
269 };
270 };
271 };
272 };
273};
diff --git a/arch/arm/boot/dts/hrefprev60.dts b/arch/arm/boot/dts/hrefprev60.dts
new file mode 100644
index 00000000000..eec29c4a86d
--- /dev/null
+++ b/arch/arm/boot/dts/hrefprev60.dts
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2012 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "dbx5x0.dtsi"
14/include/ "href.dtsi"
15/include/ "stuib.dtsi"
16
17/ {
18 model = "ST-Ericsson HREF (pre-v60) platform with Device Tree";
19 compatible = "st-ericsson,mop500", "st-ericsson,u8500";
20
21 gpio_keys {
22 button@1 {
23 gpios = <&tc3589x_gpio 7 0x4>;
24 };
25 };
26
27 soc-u9500 {
28 i2c@80004000 {
29 tps61052@33 {
30 compatible = "tps61052";
31 reg = <0x33>;
32 };
33 };
34
35 i2c@80110000 {
36 bu21013_tp@0x5c {
37 reset-gpio = <&tc3589x_gpio 13 0x4>;
38 };
39 };
40
41 vmmci: regulator-gpio {
42 gpios = <&tc3589x_gpio 18 0x4>;
43 gpio-enable = <&tc3589x_gpio 17 0x4>;
44
45 status = "okay";
46 };
47 };
48};
diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/hrefv60plus.dts
index 2131d77dc9c..55f4191a626 100644
--- a/arch/arm/boot/dts/hrefv60plus.dts
+++ b/arch/arm/boot/dts/hrefv60plus.dts
@@ -11,85 +11,200 @@
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "dbx5x0.dtsi" 13/include/ "dbx5x0.dtsi"
14/include/ "href.dtsi"
15/include/ "stuib.dtsi"
14 16
15/ { 17/ {
16 model = "ST-Ericsson HREF platform with Device Tree"; 18 model = "ST-Ericsson HREF (v60+) platform with Device Tree";
17 compatible = "st-ericsson,hrefv60+"; 19 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
18 20
19 memory { 21 gpio_keys {
20 reg = <0x00000000 0x20000000>; 22 button@1 {
23 gpios = <&gpio6 25 0x4>;
24 };
21 }; 25 };
22 26
23 soc-u9500 { 27 soc-u9500 {
24 uart@80120000 { 28 i2c@80110000 {
29 bu21013_tp@0x5c {
30 reset-gpio = <&gpio4 15 0x4>;
31 };
32 };
33
34 // External Micro SD slot
35 sdi0_per1@80126000 {
36 arm,primecell-periphid = <0x10480180>;
37 max-frequency = <50000000>;
38 bus-width = <4>;
39 mmc-cap-sd-highspeed;
40 mmc-cap-mmc-highspeed;
41 vmmc-supply = <&ab8500_ldo_aux3_reg>;
42
43 cd-gpios = <&tc3589x_gpio 3 0x4>;
44
25 status = "okay"; 45 status = "okay";
26 }; 46 };
27 47
28 uart@80121000 { 48 // WLAN SDIO channel
49 sdi1_per2@80118000 {
50 arm,primecell-periphid = <0x10480180>;
51 max-frequency = <50000000>;
52 bus-width = <4>;
53
29 status = "okay"; 54 status = "okay";
30 }; 55 };
31 56
32 uart@80007000 { 57 // PoP:ed eMMC
58 sdi2_per3@80005000 {
59 arm,primecell-periphid = <0x10480180>;
60 max-frequency = <50000000>;
61 bus-width = <8>;
62 mmc-cap-mmc-highspeed;
63
33 status = "okay"; 64 status = "okay";
34 }; 65 };
35 66
36 i2c@80004000 { 67 // On-board eMMC
37 tc3589x@42 { 68 sdi4_per2@80114000 {
38 compatible = "tc3589x"; 69 arm,primecell-periphid = <0x10480180>;
39 reg = <0x42>; 70 max-frequency = <50000000>;
40 interrupt-parent = <&gpio6>; 71 bus-width = <8>;
41 interrupts = <25 0x1>; 72 mmc-cap-mmc-highspeed;
73 vmmc-supply = <&ab8500_ldo_aux2_reg>;
42 74
43 interrupt-controller; 75 status = "okay";
44 #interrupt-cells = <2>; 76 };
45 77
46 tc3589x_gpio: tc3589x_gpio { 78 prcmu@80157000 {
47 compatible = "tc3589x-gpio"; 79 db8500-prcmu-regulators {
48 interrupts = <0 0x1>; 80 db8500_vape_reg: db8500_vape {
81 regulator-name = "db8500-vape";
82 };
49 83
50 interrupt-controller; 84 db8500_varm_reg: db8500_varm {
51 #interrupt-cells = <2>; 85 regulator-name = "db8500-varm";
52 gpio-controller;
53 #gpio-cells = <2>;
54 }; 86 };
55 };
56 87
57 tps61052@33 { 88 db8500_vmodem_reg: db8500_vmodem {
58 compatible = "tps61052"; 89 regulator-name = "db8500-vmodem";
59 reg = <0x33>; 90 };
60 };
61 };
62 91
63 i2c@80128000 { 92 db8500_vpll_reg: db8500_vpll {
64 lp5521@0x33 { 93 regulator-name = "db8500-vpll";
65 compatible = "lp5521"; 94 };
66 reg = <0x33>;
67 };
68 95
69 lp5521@0x34 { 96 db8500_vsmps1_reg: db8500_vsmps1 {
70 compatible = "lp5521"; 97 regulator-name = "db8500-vsmps1";
71 reg = <0x34>; 98 };
72 }; 99
100 db8500_vsmps2_reg: db8500_vsmps2 {
101 regulator-name = "db8500-vsmps2";
102 };
103
104 db8500_vsmps3_reg: db8500_vsmps3 {
105 regulator-name = "db8500-vsmps3";
106 };
107
108 db8500_vrf1_reg: db8500_vrf1 {
109 regulator-name = "db8500-vrf1";
110 };
111
112 db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
113 regulator-name = "db8500-sva-mmdsp";
114 };
115
116 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
117 regulator-name = "db8500-sva-mmdsp-ret";
118 };
119
120 db8500_sva_pipe_reg: db8500_sva_pipe {
121 regulator-name = "db8500_sva_pipe";
122 };
73 123
74 bh1780@0x29 { 124 db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
75 compatible = "rohm,bh1780gli"; 125 regulator-name = "db8500_sia_mmdsp";
76 reg = <0x33>; 126 };
127
128 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
129 regulator-name = "db8500-sia-mmdsp-ret";
130 };
131
132 db8500_sia_pipe_reg: db8500_sia_pipe {
133 regulator-name = "db8500-sia-pipe";
134 };
135
136 db8500_sga_reg: db8500_sga {
137 regulator-name = "db8500-sga";
138 };
139
140 db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
141 regulator-name = "db8500-b2r2-mcde";
142 };
143
144 db8500_esram12_reg: db8500_esram12 {
145 regulator-name = "db8500-esram12";
146 };
147
148 db8500_esram12_ret_reg: db8500_esram12_ret {
149 regulator-name = "db8500-esram12-ret";
150 };
151
152 db8500_esram34_reg: db8500_esram34 {
153 regulator-name = "db8500-esram34";
154 };
155
156 db8500_esram34_ret_reg: db8500_esram34_ret {
157 regulator-name = "db8500-esram34-ret";
158 };
77 }; 159 };
78 };
79 160
80 sound { 161 ab8500@5 {
81 compatible = "stericsson,snd-soc-mop500"; 162 ab8500-regulators {
163 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
164 regulator-name = "V-DISPLAY";
165 };
82 166
83 stericsson,cpu-dai = <&msp1 &msp3>; 167 ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
84 stericsson,audio-codec = <&codec>; 168 regulator-name = "V-eMMC1";
85 }; 169 };
86 170
87 msp1: msp@80124000 { 171 ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
88 status = "okay"; 172 regulator-name = "V-MMC-SD";
89 }; 173 };
90 174
91 msp3: msp@80125000 { 175 ab8500_ldo_initcore_reg: ab8500_ldo_initcore {
92 status = "okay"; 176 regulator-name = "V-INTCORE";
177 };
178
179 ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
180 regulator-name = "V-TVOUT";
181 };
182
183 ab8500_ldo_usb_reg: ab8500_ldo_usb {
184 regulator-name = "dummy";
185 };
186
187 ab8500_ldo_audio_reg: ab8500_ldo_audio {
188 regulator-name = "V-AUD";
189 };
190
191 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
192 regulator-name = "V-AMIC1";
193 };
194
195 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 {
196 regulator-name = "V-AMIC2";
197 };
198
199 ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
200 regulator-name = "V-DMIC";
201 };
202
203 ab8500_ldo_ana_reg: ab8500_ldo_ana {
204 regulator-name = "V-CSI/DSI";
205 };
206 };
207 };
93 }; 208 };
94 }; 209 };
95}; 210};
diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts b/arch/arm/boot/dts/imx23-olinuxino.dts
index 384d8b66f33..7c43b8e70b9 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -40,6 +40,15 @@
40 reg = <0>; 40 reg = <0>;
41 fsl,pinmux-ids = < 41 fsl,pinmux-ids = <
42 0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */ 42 0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */
43 >;
44 fsl,drive-strength = <0>;
45 fsl,voltage = <1>;
46 fsl,pull-up = <0>;
47 };
48
49 led_pin_gpio0_17: led_gpio0_17@0 {
50 reg = <0>;
51 fsl,pinmux-ids = <
43 0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */ 52 0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */
44 >; 53 >;
45 fsl,drive-strength = <0>; 54 fsl,drive-strength = <0>;
@@ -47,6 +56,15 @@
47 fsl,pull-up = <0>; 56 fsl,pull-up = <0>;
48 }; 57 };
49 }; 58 };
59
60 ssp1: ssp@80034000 {
61 #address-cells = <1>;
62 #size-cells = <0>;
63 compatible = "fsl,imx23-spi";
64 pinctrl-names = "default";
65 pinctrl-0 = <&spi2_pins_a>;
66 status = "okay";
67 };
50 }; 68 };
51 69
52 apbx@80040000 { 70 apbx@80040000 {
@@ -91,11 +109,12 @@
91 109
92 leds { 110 leds {
93 compatible = "gpio-leds"; 111 compatible = "gpio-leds";
112 pinctrl-names = "default";
113 pinctrl-0 = <&led_pin_gpio0_17>;
94 114
95 user { 115 user {
96 label = "green"; 116 label = "green";
97 gpios = <&gpio2 1 0>; 117 gpios = <&gpio2 1 1>;
98 linux,default-trigger = "default-on";
99 }; 118 };
100 }; 119 };
101}; 120};
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 6d31aa38346..65415c598a5 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -279,6 +279,19 @@
279 fsl,voltage = <1>; 279 fsl,voltage = <1>;
280 fsl,pull-up = <0>; 280 fsl,pull-up = <0>;
281 }; 281 };
282
283 spi2_pins_a: spi2@0 {
284 reg = <0>;
285 fsl,pinmux-ids = <
286 0x0182 /* MX23_PAD_GPMI_WRN__SSP2_SCK */
287 0x0142 /* MX23_PAD_GPMI_RDY1__SSP2_CMD */
288 0x0002 /* MX23_PAD_GPMI_D00__SSP2_DATA0 */
289 0x0032 /* MX23_PAD_GPMI_D03__SSP2_DATA3 */
290 >;
291 fsl,drive-strength = <1>;
292 fsl,voltage = <1>;
293 fsl,pull-up = <1>;
294 };
282 }; 295 };
283 296
284 digctl@8001c000 { 297 digctl@8001c000 {
diff --git a/arch/arm/boot/dts/imx25-karo-tx25.dts b/arch/arm/boot/dts/imx25-karo-tx25.dts
new file mode 100644
index 00000000000..d81f8a0b979
--- /dev/null
+++ b/arch/arm/boot/dts/imx25-karo-tx25.dts
@@ -0,0 +1,44 @@
1/*
2 * Copyright 2012 Sascha Hauer, Pengutronix
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "imx25.dtsi"
14
15/ {
16 model = "Ka-Ro TX25";
17 compatible = "karo,imx25-tx25", "fsl,imx25";
18
19 memory {
20 reg = <0x80000000 0x02000000 0x90000000 0x02000000>;
21 };
22
23 soc {
24 aips@43f00000 {
25 uart1: serial@43f90000 {
26 status = "okay";
27 };
28 };
29
30 spba@50000000 {
31 fec: ethernet@50038000 {
32 status = "okay";
33 phy-mode = "rmii";
34 };
35 };
36
37 emi@80000000 {
38 nand@bb000000 {
39 nand-on-flash-bbt;
40 status = "okay";
41 };
42 };
43 };
44};
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
new file mode 100644
index 00000000000..e1b13ebc96d
--- /dev/null
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -0,0 +1,515 @@
1/*
2 * Copyright 2012 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/include/ "skeleton.dtsi"
13
14/ {
15 aliases {
16 serial0 = &uart1;
17 serial1 = &uart2;
18 serial2 = &uart3;
19 serial3 = &uart4;
20 serial4 = &uart5;
21 gpio0 = &gpio1;
22 gpio1 = &gpio2;
23 gpio2 = &gpio3;
24 gpio3 = &gpio4;
25 usb0 = &usbotg;
26 usb1 = &usbhost1;
27 };
28
29 asic: asic-interrupt-controller@68000000 {
30 compatible = "fsl,imx25-asic", "fsl,avic";
31 interrupt-controller;
32 #interrupt-cells = <1>;
33 reg = <0x68000000 0x8000000>;
34 };
35
36 clocks {
37 #address-cells = <1>;
38 #size-cells = <0>;
39
40 osc {
41 compatible = "fsl,imx-osc", "fixed-clock";
42 clock-frequency = <24000000>;
43 };
44 };
45
46 soc {
47 #address-cells = <1>;
48 #size-cells = <1>;
49 compatible = "simple-bus";
50 interrupt-parent = <&asic>;
51 ranges;
52
53 aips@43f00000 { /* AIPS1 */
54 compatible = "fsl,aips-bus", "simple-bus";
55 #address-cells = <1>;
56 #size-cells = <1>;
57 reg = <0x43f00000 0x100000>;
58 ranges;
59
60 i2c1: i2c@43f80000 {
61 #address-cells = <1>;
62 #size-cells = <0>;
63 compatible = "fsl,imx25-i2c", "fsl,imx21-i2c";
64 reg = <0x43f80000 0x4000>;
65 clocks = <&clks 48>;
66 clock-names = "";
67 interrupts = <3>;
68 status = "disabled";
69 };
70
71 i2c3: i2c@43f84000 {
72 #address-cells = <1>;
73 #size-cells = <0>;
74 compatible = "fsl,imx25-i2c", "fsl,imx21-i2c";
75 reg = <0x43f84000 0x4000>;
76 clocks = <&clks 48>;
77 clock-names = "";
78 interrupts = <10>;
79 status = "disabled";
80 };
81
82 can1: can@43f88000 {
83 compatible = "fsl,imx25-flexcan", "fsl,p1010-flexcan";
84 reg = <0x43f88000 0x4000>;
85 interrupts = <43>;
86 clocks = <&clks 75>, <&clks 75>;
87 clock-names = "ipg", "per";
88 status = "disabled";
89 };
90
91 can2: can@43f8c000 {
92 compatible = "fsl,imx25-flexcan", "fsl,p1010-flexcan";
93 reg = <0x43f8c000 0x4000>;
94 interrupts = <44>;
95 clocks = <&clks 76>, <&clks 76>;
96 clock-names = "ipg", "per";
97 status = "disabled";
98 };
99
100 uart1: serial@43f90000 {
101 compatible = "fsl,imx25-uart", "fsl,imx21-uart";
102 reg = <0x43f90000 0x4000>;
103 interrupts = <45>;
104 clocks = <&clks 120>, <&clks 57>;
105 clock-names = "ipg", "per";
106 status = "disabled";
107 };
108
109 uart2: serial@43f94000 {
110 compatible = "fsl,imx25-uart", "fsl,imx21-uart";
111 reg = <0x43f94000 0x4000>;
112 interrupts = <32>;
113 clocks = <&clks 121>, <&clks 57>;
114 clock-names = "ipg", "per";
115 status = "disabled";
116 };
117
118 i2c2: i2c@43f98000 {
119 #address-cells = <1>;
120 #size-cells = <0>;
121 compatible = "fsl,imx25-i2c", "fsl,imx21-i2c";
122 reg = <0x43f98000 0x4000>;
123 clocks = <&clks 48>;
124 clock-names = "";
125 interrupts = <4>;
126 status = "disabled";
127 };
128
129 owire@43f9c000 {
130 #address-cells = <1>;
131 #size-cells = <0>;
132 reg = <0x43f9c000 0x4000>;
133 clocks = <&clks 51>;
134 clock-names = "";
135 interrupts = <2>;
136 status = "disabled";
137 };
138
139 spi1: cspi@43fa4000 {
140 #address-cells = <1>;
141 #size-cells = <0>;
142 compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
143 reg = <0x43fa4000 0x4000>;
144 clocks = <&clks 62>;
145 clock-names = "ipg";
146 interrupts = <14>;
147 status = "disabled";
148 };
149
150 kpp@43fa8000 {
151 #address-cells = <1>;
152 #size-cells = <0>;
153 reg = <0x43fa8000 0x4000>;
154 clocks = <&clks 102>;
155 clock-names = "";
156 interrupts = <24>;
157 status = "disabled";
158 };
159
160 iomuxc@43fac000{
161 compatible = "fsl,imx25-iomuxc";
162 reg = <0x43fac000 0x4000>;
163 };
164
165 audmux@43fb0000 {
166 compatible = "fsl,imx25-audmux", "fsl,imx31-audmux";
167 reg = <0x43fb0000 0x4000>;
168 status = "disabled";
169 };
170 };
171
172 spba@50000000 {
173 compatible = "fsl,spba-bus", "simple-bus";
174 #address-cells = <1>;
175 #size-cells = <1>;
176 reg = <0x50000000 0x40000>;
177 ranges;
178
179 spi3: cspi@50004000 {
180 #address-cells = <1>;
181 #size-cells = <0>;
182 compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
183 reg = <0x50004000 0x4000>;
184 interrupts = <0>;
185 clocks = <&clks 80>;
186 clock-names = "ipg";
187 status = "disabled";
188 };
189
190 uart4: serial@50008000 {
191 compatible = "fsl,imx25-uart", "fsl,imx21-uart";
192 reg = <0x50008000 0x4000>;
193 interrupts = <5>;
194 clocks = <&clks 123>, <&clks 57>;
195 clock-names = "ipg", "per";
196 status = "disabled";
197 };
198
199 uart3: serial@5000c000 {
200 compatible = "fsl,imx25-uart", "fsl,imx21-uart";
201 reg = <0x5000c000 0x4000>;
202 interrupts = <18>;
203 clocks = <&clks 122>, <&clks 57>;
204 clock-names = "ipg", "per";
205 status = "disabled";
206 };
207
208 spi2: cspi@50010000 {
209 #address-cells = <1>;
210 #size-cells = <0>;
211 compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
212 reg = <0x50010000 0x4000>;
213 clocks = <&clks 79>;
214 clock-names = "ipg";
215 interrupts = <13>;
216 status = "disabled";
217 };
218
219 ssi2: ssi@50014000 {
220 compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
221 reg = <0x50014000 0x4000>;
222 interrupts = <11>;
223 status = "disabled";
224 };
225
226 esai@50018000 {
227 reg = <0x50018000 0x4000>;
228 interrupts = <7>;
229 };
230
231 uart5: serial@5002c000 {
232 compatible = "fsl,imx25-uart", "fsl,imx21-uart";
233 reg = <0x5002c000 0x4000>;
234 interrupts = <40>;
235 clocks = <&clks 124>, <&clks 57>;
236 clock-names = "ipg", "per";
237 status = "disabled";
238 };
239
240 tsc: tsc@50030000 {
241 compatible = "fsl,imx25-adc", "fsl,imx21-tsc";
242 reg = <0x50030000 0x4000>;
243 interrupts = <46>;
244 clocks = <&clks 119>;
245 clock-names = "ipg";
246 status = "disabled";
247 };
248
249 ssi1: ssi@50034000 {
250 compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
251 reg = <0x50034000 0x4000>;
252 interrupts = <12>;
253 status = "disabled";
254 };
255
256 fec: ethernet@50038000 {
257 compatible = "fsl,imx25-fec";
258 reg = <0x50038000 0x4000>;
259 interrupts = <57>;
260 clocks = <&clks 88>, <&clks 65>;
261 clock-names = "ipg", "ahb";
262 status = "disabled";
263 };
264 };
265
266 aips@53f00000 { /* AIPS2 */
267 compatible = "fsl,aips-bus", "simple-bus";
268 #address-cells = <1>;
269 #size-cells = <1>;
270 reg = <0x53f00000 0x100000>;
271 ranges;
272
273 clks: ccm@53f80000 {
274 compatible = "fsl,imx25-ccm";
275 reg = <0x53f80000 0x4000>;
276 interrupts = <31>;
277 #clock-cells = <1>;
278 };
279
280 gpt4: timer@53f84000 {
281 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
282 reg = <0x53f84000 0x4000>;
283 clocks = <&clks 9>, <&clks 45>;
284 clock-names = "ipg", "per";
285 interrupts = <1>;
286 };
287
288 gpt3: timer@53f88000 {
289 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
290 reg = <0x53f88000 0x4000>;
291 clocks = <&clks 9>, <&clks 47>;
292 clock-names = "ipg", "per";
293 interrupts = <29>;
294 };
295
296 gpt2: timer@53f8c000 {
297 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
298 reg = <0x53f8c000 0x4000>;
299 clocks = <&clks 9>, <&clks 47>;
300 clock-names = "ipg", "per";
301 interrupts = <53>;
302 };
303
304 gpt1: timer@53f90000 {
305 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
306 reg = <0x53f90000 0x4000>;
307 clocks = <&clks 9>, <&clks 47>;
308 clock-names = "ipg", "per";
309 interrupts = <54>;
310 };
311
312 epit1: timer@53f94000 {
313 compatible = "fsl,imx25-epit";
314 reg = <0x53f94000 0x4000>;
315 interrupts = <28>;
316 };
317
318 epit2: timer@53f98000 {
319 compatible = "fsl,imx25-epit";
320 reg = <0x53f98000 0x4000>;
321 interrupts = <27>;
322 };
323
324 gpio4: gpio@53f9c000 {
325 compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
326 reg = <0x53f9c000 0x4000>;
327 interrupts = <23>;
328 gpio-controller;
329 #gpio-cells = <2>;
330 interrupt-controller;
331 #interrupt-cells = <2>;
332 };
333
334 pwm2: pwm@53fa0000 {
335 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
336 #pwm-cells = <2>;
337 reg = <0x53fa0000 0x4000>;
338 clocks = <&clks 106>, <&clks 36>;
339 clock-names = "ipg", "per";
340 interrupts = <36>;
341 };
342
343 gpio3: gpio@53fa4000 {
344 compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
345 reg = <0x53fa4000 0x4000>;
346 interrupts = <16>;
347 gpio-controller;
348 #gpio-cells = <2>;
349 interrupt-controller;
350 #interrupt-cells = <2>;
351 };
352
353 pwm3: pwm@53fa8000 {
354 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
355 #pwm-cells = <2>;
356 reg = <0x53fa8000 0x4000>;
357 clocks = <&clks 107>, <&clks 36>;
358 clock-names = "ipg", "per";
359 interrupts = <41>;
360 };
361
362 esdhc1: esdhc@53fb4000 {
363 compatible = "fsl,imx25-esdhc";
364 reg = <0x53fb4000 0x4000>;
365 interrupts = <9>;
366 clocks = <&clks 86>, <&clks 63>, <&clks 45>;
367 clock-names = "ipg", "ahb", "per";
368 status = "disabled";
369 };
370
371 esdhc2: esdhc@53fb8000 {
372 compatible = "fsl,imx25-esdhc";
373 reg = <0x53fb8000 0x4000>;
374 interrupts = <8>;
375 clocks = <&clks 87>, <&clks 64>, <&clks 46>;
376 clock-names = "ipg", "ahb", "per";
377 status = "disabled";
378 };
379
380 lcdc@53fbc000 {
381 reg = <0x53fbc000 0x4000>;
382 interrupts = <39>;
383 clocks = <&clks 103>, <&clks 66>, <&clks 49>;
384 clock-names = "ipg", "ahb", "per";
385 status = "disabled";
386 };
387
388 slcdc@53fc0000 {
389 reg = <0x53fc0000 0x4000>;
390 interrupts = <38>;
391 status = "disabled";
392 };
393
394 pwm4: pwm@53fc8000 {
395 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
396 reg = <0x53fc8000 0x4000>;
397 clocks = <&clks 108>, <&clks 36>;
398 clock-names = "ipg", "per";
399 interrupts = <42>;
400 };
401
402 gpio1: gpio@53fcc000 {
403 compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
404 reg = <0x53fcc000 0x4000>;
405 interrupts = <52>;
406 gpio-controller;
407 #gpio-cells = <2>;
408 interrupt-controller;
409 #interrupt-cells = <2>;
410 };
411
412 gpio2: gpio@53fd0000 {
413 compatible = "fsl,imx25-gpio", "fsl,imx35-gpio";
414 reg = <0x53fd0000 0x4000>;
415 interrupts = <51>;
416 gpio-controller;
417 #gpio-cells = <2>;
418 interrupt-controller;
419 #interrupt-cells = <2>;
420 };
421
422 sdma@53fd4000 {
423 compatible = "fsl,imx25-sdma", "fsl,imx35-sdma";
424 reg = <0x53fd4000 0x4000>;
425 clocks = <&clks 112>, <&clks 68>;
426 clock-names = "ipg", "ahb";
427 interrupts = <34>;
428 };
429
430 wdog@53fdc000 {
431 compatible = "fsl,imx25-wdt", "fsl,imx21-wdt";
432 reg = <0x53fdc000 0x4000>;
433 clocks = <&clks 126>;
434 clock-names = "";
435 interrupts = <55>;
436 };
437
438 pwm1: pwm@53fe0000 {
439 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
440 #pwm-cells = <2>;
441 reg = <0x53fe0000 0x4000>;
442 clocks = <&clks 105>, <&clks 36>;
443 clock-names = "ipg", "per";
444 interrupts = <26>;
445 };
446
447 usbphy1: usbphy@1 {
448 compatible = "nop-usbphy";
449 status = "disabled";
450 };
451
452 usbphy2: usbphy@2 {
453 compatible = "nop-usbphy";
454 status = "disabled";
455 };
456
457 usbotg: usb@53ff4000 {
458 compatible = "fsl,imx25-usb", "fsl,imx27-usb";
459 reg = <0x53ff4000 0x0200>;
460 interrupts = <37>;
461 clocks = <&clks 9>, <&clks 70>, <&clks 8>;
462 clock-names = "ipg", "ahb", "per";
463 fsl,usbmisc = <&usbmisc 0>;
464 status = "disabled";
465 };
466
467 usbhost1: usb@53ff4400 {
468 compatible = "fsl,imx25-usb", "fsl,imx27-usb";
469 reg = <0x53ff4400 0x0200>;
470 interrupts = <35>;
471 clocks = <&clks 9>, <&clks 70>, <&clks 8>;
472 clock-names = "ipg", "ahb", "per";
473 fsl,usbmisc = <&usbmisc 1>;
474 status = "disabled";
475 };
476
477 usbmisc: usbmisc@53ff4600 {
478 #index-cells = <1>;
479 compatible = "fsl,imx25-usbmisc";
480 clocks = <&clks 9>, <&clks 70>, <&clks 8>;
481 clock-names = "ipg", "ahb", "per";
482 reg = <0x53ff4600 0x00f>;
483 status = "disabled";
484 };
485
486 dryice@53ffc000 {
487 compatible = "fsl,imx25-dryice", "fsl,imx25-rtc";
488 reg = <0x53ffc000 0x4000>;
489 clocks = <&clks 81>;
490 clock-names = "ipg";
491 interrupts = <25>;
492 };
493 };
494
495 emi@80000000 {
496 compatible = "fsl,emi-bus", "simple-bus";
497 #address-cells = <1>;
498 #size-cells = <1>;
499 reg = <0x80000000 0x3b002000>;
500 ranges;
501
502 nand@bb000000 {
503 #address-cells = <1>;
504 #size-cells = <1>;
505
506 compatible = "fsl,imx25-nand";
507 reg = <0xbb000000 0x2000>;
508 clocks = <&clks 50>;
509 clock-names = "";
510 interrupts = <33>;
511 status = "disabled";
512 };
513 };
514 };
515};
diff --git a/arch/arm/boot/dts/imx27-3ds.dts b/arch/arm/boot/dts/imx27-3ds.dts
index 0a8978a40ec..b01c0d745fc 100644
--- a/arch/arm/boot/dts/imx27-3ds.dts
+++ b/arch/arm/boot/dts/imx27-3ds.dts
@@ -23,10 +23,6 @@
23 soc { 23 soc {
24 aipi@10000000 { /* aipi */ 24 aipi@10000000 { /* aipi */
25 25
26 wdog@10002000 {
27 status = "okay";
28 };
29
30 uart1: serial@1000a000 { 26 uart1: serial@1000a000 {
31 fsl,uart-has-rtscts; 27 fsl,uart-has-rtscts;
32 status = "okay"; 28 status = "okay";
diff --git a/arch/arm/boot/dts/imx27-apf27.dts b/arch/arm/boot/dts/imx27-apf27.dts
new file mode 100644
index 00000000000..c0327c054de
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-apf27.dts
@@ -0,0 +1,89 @@
1/*
2 * Copyright 2012 Philippe Reynes <tremyfr@yahoo.fr>
3 * Copyright 2012 Armadeus Systems <support@armadeus.com>
4 *
5 * Based on code which is: Copyright 2012 Sascha Hauer, Pengutronix
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/ "imx27.dtsi"
17
18/ {
19 model = "Armadeus Systems APF27 module";
20 compatible = "armadeus,imx27-apf27", "fsl,imx27";
21
22 memory {
23 reg = <0xa0000000 0x04000000>;
24 };
25
26 clocks {
27 #address-cells = <1>;
28 #size-cells = <0>;
29
30 osc26m {
31 compatible = "fsl,imx-osc26m", "fixed-clock";
32 clock-frequency = <0>;
33 };
34 };
35
36 soc {
37 aipi@10000000 {
38 serial@1000a000 {
39 status = "okay";
40 };
41
42 ethernet@1002b000 {
43 status = "okay";
44 };
45 };
46
47 nand@d8000000 {
48 status = "okay";
49 nand-bus-width = <16>;
50 nand-ecc-mode = "hw";
51 nand-on-flash-bbt;
52
53 partition@0 {
54 label = "u-boot";
55 reg = <0x0 0x100000>;
56 };
57
58 partition@100000 {
59 label = "env";
60 reg = <0x100000 0x80000>;
61 };
62
63 partition@180000 {
64 label = "env2";
65 reg = <0x180000 0x80000>;
66 };
67
68 partition@200000 {
69 label = "firmware";
70 reg = <0x200000 0x80000>;
71 };
72
73 partition@280000 {
74 label = "dtb";
75 reg = <0x280000 0x80000>;
76 };
77
78 partition@300000 {
79 label = "kernel";
80 reg = <0x300000 0x500000>;
81 };
82
83 partition@800000 {
84 label = "rootfs";
85 reg = <0x800000 0xf800000>;
86 };
87 };
88 };
89};
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 3e54f149884..b8d3905915a 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -58,7 +58,7 @@
58 reg = <0x10000000 0x10000000>; 58 reg = <0x10000000 0x10000000>;
59 ranges; 59 ranges;
60 60
61 wdog@10002000 { 61 wdog: wdog@10002000 {
62 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt"; 62 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt";
63 reg = <0x10002000 0x4000>; 63 reg = <0x10002000 0x4000>;
64 interrupts = <27>; 64 interrupts = <27>;
@@ -113,7 +113,7 @@
113 i2c1: i2c@10012000 { 113 i2c1: i2c@10012000 {
114 #address-cells = <1>; 114 #address-cells = <1>;
115 #size-cells = <0>; 115 #size-cells = <0>;
116 compatible = "fsl,imx27-i2c", "fsl,imx1-i2c"; 116 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
117 reg = <0x10012000 0x1000>; 117 reg = <0x10012000 0x1000>;
118 interrupts = <12>; 118 interrupts = <12>;
119 status = "disabled"; 119 status = "disabled";
@@ -205,7 +205,7 @@
205 i2c2: i2c@1001d000 { 205 i2c2: i2c@1001d000 {
206 #address-cells = <1>; 206 #address-cells = <1>;
207 #size-cells = <0>; 207 #size-cells = <0>;
208 compatible = "fsl,imx27-i2c", "fsl,imx1-i2c"; 208 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
209 reg = <0x1001d000 0x1000>; 209 reg = <0x1001d000 0x1000>;
210 interrupts = <1>; 210 interrupts = <1>;
211 status = "disabled"; 211 status = "disabled";
@@ -218,7 +218,8 @@
218 status = "disabled"; 218 status = "disabled";
219 }; 219 };
220 }; 220 };
221 nand@d8000000 { 221
222 nfc: nand@d8000000 {
222 #address-cells = <1>; 223 #address-cells = <1>;
223 #size-cells = <1>; 224 #size-cells = <1>;
224 225
diff --git a/arch/arm/boot/dts/imx28-apf28.dts b/arch/arm/boot/dts/imx28-apf28.dts
new file mode 100644
index 00000000000..7eb075876c4
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-apf28.dts
@@ -0,0 +1,85 @@
1/*
2 * Copyright 2012 Armadeus Systems - <support@armadeus.com>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "imx28.dtsi"
14
15/ {
16 model = "Armadeus Systems APF28 module";
17 compatible = "armadeus,imx28-apf28", "fsl,imx28";
18
19 memory {
20 reg = <0x40000000 0x08000000>;
21 };
22
23 apb@80000000 {
24 apbh@80000000 {
25 gpmi-nand@8000c000 {
26 pinctrl-names = "default";
27 pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>;
28 status = "okay";
29
30 partition@0 {
31 label = "u-boot";
32 reg = <0x0 0x300000>;
33 };
34
35 partition@300000 {
36 label = "env";
37 reg = <0x300000 0x80000>;
38 };
39
40 partition@380000 {
41 label = "env2";
42 reg = <0x380000 0x80000>;
43 };
44
45 partition@400000 {
46 label = "dtb";
47 reg = <0x400000 0x80000>;
48 };
49
50 partition@480000 {
51 label = "splash";
52 reg = <0x480000 0x80000>;
53 };
54
55 partition@500000 {
56 label = "kernel";
57 reg = <0x500000 0x800000>;
58 };
59
60 partition@d00000 {
61 label = "rootfs";
62 reg = <0xd00000 0xf300000>;
63 };
64 };
65 };
66
67 apbx@80040000 {
68 duart: serial@80074000 {
69 pinctrl-names = "default";
70 pinctrl-0 = <&duart_pins_a>;
71 status = "okay";
72 };
73 };
74 };
75
76 ahb@80080000 {
77 mac0: ethernet@800f0000 {
78 phy-mode = "rmii";
79 pinctrl-names = "default";
80 pinctrl-0 = <&mac0_pins_a>;
81 phy-reset-gpios = <&gpio4 13 0>;
82 status = "okay";
83 };
84 };
85};
diff --git a/arch/arm/boot/dts/imx28-apf28dev.dts b/arch/arm/boot/dts/imx28-apf28dev.dts
new file mode 100644
index 00000000000..6d8865bfb4b
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-apf28dev.dts
@@ -0,0 +1,154 @@
1/*
2 * Copyright 2012 Armadeus Systems - <support@armadeus.com>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/* APF28Dev is a docking board for the APF28 SOM */
13/include/ "imx28-apf28.dts"
14
15/ {
16 model = "Armadeus Systems APF28Dev docking/development board";
17 compatible = "armadeus,imx28-apf28dev", "armadeus,imx28-apf28", "fsl,imx28";
18
19 apb@80000000 {
20 apbh@80000000 {
21 ssp0: ssp@80010000 {
22 compatible = "fsl,imx28-mmc";
23 pinctrl-names = "default";
24 pinctrl-0 = <&mmc0_4bit_pins_a
25 &mmc0_cd_cfg &mmc0_sck_cfg>;
26 bus-width = <4>;
27 status = "okay";
28 };
29
30 ssp2: ssp@80014000 {
31 compatible = "fsl,imx28-spi";
32 pinctrl-names = "default";
33 pinctrl-0 = <&spi2_pins_a>;
34 status = "okay";
35 };
36
37 pinctrl@80018000 {
38 pinctrl-names = "default";
39 pinctrl-0 = <&hog_pins_apf28dev>;
40
41 hog_pins_apf28dev: hog@0 {
42 reg = <0>;
43 fsl,pinmux-ids = <
44 0x1103 /* MX28_PAD_LCD_D16__GPIO_1_16 */
45 0x1113 /* MX28_PAD_LCD_D17__GPIO_1_17 */
46 0x1123 /* MX28_PAD_LCD_D18__GPIO_1_18 */
47 0x1133 /* MX28_PAD_LCD_D19__GPIO_1_19 */
48 0x1143 /* MX28_PAD_LCD_D20__GPIO_1_20 */
49 0x1153 /* MX28_PAD_LCD_D21__GPIO_1_21 */
50 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */
51 >;
52 fsl,drive-strength = <0>;
53 fsl,voltage = <1>;
54 fsl,pull-up = <0>;
55 };
56
57 lcdif_pins_apf28dev: lcdif-apf28dev@0 {
58 reg = <0>;
59 fsl,pinmux-ids = <
60 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */
61 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */
62 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */
63 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */
64 >;
65 fsl,drive-strength = <0>;
66 fsl,voltage = <1>;
67 fsl,pull-up = <0>;
68 };
69 };
70
71 lcdif@80030000 {
72 pinctrl-names = "default";
73 pinctrl-0 = <&lcdif_16bit_pins_a
74 &lcdif_pins_apf28dev>;
75 status = "okay";
76 };
77 };
78
79 apbx@80040000 {
80 lradc@80050000 {
81 status = "okay";
82 };
83
84 i2c0: i2c@80058000 {
85 pinctrl-names = "default";
86 pinctrl-0 = <&i2c0_pins_a>;
87 status = "okay";
88 };
89
90 pwm: pwm@80064000 {
91 pinctrl-names = "default";
92 pinctrl-0 = <&pwm3_pins_a &pwm4_pins_a>;
93 status = "okay";
94 };
95
96 usbphy0: usbphy@8007c000 {
97 status = "okay";
98 };
99
100 usbphy1: usbphy@8007e000 {
101 status = "okay";
102 };
103 };
104 };
105
106 ahb@80080000 {
107 usb0: usb@80080000 {
108 vbus-supply = <&reg_usb0_vbus>;
109 status = "okay";
110 };
111
112 usb1: usb@80090000 {
113 status = "okay";
114 };
115
116 mac1: ethernet@800f4000 {
117 phy-mode = "rmii";
118 pinctrl-names = "default";
119 pinctrl-0 = <&mac1_pins_a>;
120 phy-reset-gpios = <&gpio0 23 0>;
121 status = "okay";
122 };
123 };
124
125 regulators {
126 compatible = "simple-bus";
127
128 reg_usb0_vbus: usb0_vbus {
129 compatible = "regulator-fixed";
130 regulator-name = "usb0_vbus";
131 regulator-min-microvolt = <5000000>;
132 regulator-max-microvolt = <5000000>;
133 gpio = <&gpio1 23 1>;
134 };
135 };
136
137 leds {
138 compatible = "gpio-leds";
139
140 user {
141 label = "Heartbeat";
142 gpios = <&gpio0 21 0>;
143 linux,default-trigger = "heartbeat";
144 };
145 };
146
147 backlight {
148 compatible = "pwm-backlight";
149
150 pwms = <&pwm 3 191000>;
151 brightness-levels = <0 4 8 16 32 64 128 255>;
152 default-brightness-level = <6>;
153 };
154};
diff --git a/arch/arm/boot/dts/imx28-cfa10036.dts b/arch/arm/boot/dts/imx28-cfa10036.dts
index c03a577beca..1594694532b 100644
--- a/arch/arm/boot/dts/imx28-cfa10036.dts
+++ b/arch/arm/boot/dts/imx28-cfa10036.dts
@@ -22,6 +22,31 @@
22 22
23 apb@80000000 { 23 apb@80000000 {
24 apbh@80000000 { 24 apbh@80000000 {
25 pinctrl@80018000 {
26 pinctrl-names = "default";
27 pinctrl-0 = <&hog_pins_cfa10036>;
28
29 hog_pins_cfa10036: hog-10036@0 {
30 reg = <0>;
31 fsl,pinmux-ids = <
32 0x2073 /* MX28_PAD_SSP0_D7__GPIO_2_7 */
33 >;
34 fsl,drive-strength = <0>;
35 fsl,voltage = <1>;
36 fsl,pull-up = <0>;
37 };
38
39 led_pins_cfa10036: leds-10036@0 {
40 reg = <0>;
41 fsl,pinmux-ids = <
42 0x3043 /* MX28_PAD_AUART1_RX__GPIO_3_4 */
43 >;
44 fsl,drive-strength = <0>;
45 fsl,voltage = <1>;
46 fsl,pull-up = <0>;
47 };
48 };
49
25 ssp0: ssp@80010000 { 50 ssp0: ssp@80010000 {
26 compatible = "fsl,imx28-mmc"; 51 compatible = "fsl,imx28-mmc";
27 pinctrl-names = "default"; 52 pinctrl-names = "default";
@@ -33,16 +58,37 @@
33 }; 58 };
34 59
35 apbx@80040000 { 60 apbx@80040000 {
61 pwm: pwm@80064000 {
62 pinctrl-names = "default";
63 pinctrl-0 = <&pwm4_pins_a>;
64 status = "okay";
65 };
66
36 duart: serial@80074000 { 67 duart: serial@80074000 {
37 pinctrl-names = "default"; 68 pinctrl-names = "default";
38 pinctrl-0 = <&duart_pins_b>; 69 pinctrl-0 = <&duart_pins_b>;
39 status = "okay"; 70 status = "okay";
40 }; 71 };
72
73 i2c0: i2c@80058000 {
74 pinctrl-names = "default";
75 pinctrl-0 = <&i2c0_pins_b>;
76 status = "okay";
77
78 ssd1307: oled@3c {
79 compatible = "solomon,ssd1307fb-i2c";
80 reg = <0x3c>;
81 pwms = <&pwm 4 3000>;
82 reset-gpios = <&gpio2 7 0>;
83 };
84 };
41 }; 85 };
42 }; 86 };
43 87
44 leds { 88 leds {
45 compatible = "gpio-leds"; 89 compatible = "gpio-leds";
90 pinctrl-names = "default";
91 pinctrl-0 = <&led_pins_cfa10036>;
46 92
47 power { 93 power {
48 gpios = <&gpio3 4 1>; 94 gpios = <&gpio3 4 1>;
diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts
index 05c892e931e..b222614ac9e 100644
--- a/arch/arm/boot/dts/imx28-cfa10049.dts
+++ b/arch/arm/boot/dts/imx28-cfa10049.dts
@@ -22,6 +22,22 @@
22 apb@80000000 { 22 apb@80000000 {
23 apbh@80000000 { 23 apbh@80000000 {
24 pinctrl@80018000 { 24 pinctrl@80018000 {
25 pinctrl-names = "default", "default";
26 pinctrl-1 = <&hog_pins_cfa10049>;
27
28 hog_pins_cfa10049: hog-10049@0 {
29 reg = <0>;
30 fsl,pinmux-ids = <
31 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */
32 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */
33 0x1173 /* MX28_PAD_LCD_D22__GPIO_1_23 */
34 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */
35 >;
36 fsl,drive-strength = <0>;
37 fsl,voltage = <1>;
38 fsl,pull-up = <0>;
39 };
40
25 spi3_pins_cfa10049: spi3-cfa10049@0 { 41 spi3_pins_cfa10049: spi3-cfa10049@0 {
26 reg = <0>; 42 reg = <0>;
27 fsl,pinmux-ids = < 43 fsl,pinmux-ids = <
@@ -29,6 +45,7 @@
29 0x01c1 /* MX28_PAD_GPMI_RESETN__SSP3_CMD */ 45 0x01c1 /* MX28_PAD_GPMI_RESETN__SSP3_CMD */
30 0x0111 /* MX28_PAD_GPMI_CE1N__SSP3_D3 */ 46 0x0111 /* MX28_PAD_GPMI_CE1N__SSP3_D3 */
31 0x01a2 /* MX28_PAD_GPMI_ALE__SSP3_D4 */ 47 0x01a2 /* MX28_PAD_GPMI_ALE__SSP3_D4 */
48 0x01b2 /* MX28_PAD_GPMI_CLE__SSP3_D5 */
32 >; 49 >;
33 fsl,drive-strength = <1>; 50 fsl,drive-strength = <1>;
34 fsl,voltage = <1>; 51 fsl,voltage = <1>;
@@ -60,6 +77,11 @@
60 spi-max-frequency = <100000>; 77 spi-max-frequency = <100000>;
61 }; 78 };
62 79
80 dac0: dh2228@2 {
81 compatible = "rohm,dh2228fv";
82 reg = <2>;
83 spi-max-frequency = <100000>;
84 };
63 }; 85 };
64 }; 86 };
65 87
@@ -96,4 +118,15 @@
96 gpio = <&gpio0 7 1>; 118 gpio = <&gpio0 7 1>;
97 }; 119 };
98 }; 120 };
121
122 ahb@80080000 {
123 mac0: ethernet@800f0000 {
124 phy-mode = "rmii";
125 pinctrl-names = "default";
126 pinctrl-0 = <&mac0_pins_a>;
127 phy-reset-gpios = <&gpio2 21 0>;
128 phy-reset-duration = <100>;
129 status = "okay";
130 };
131 };
99}; 132};
diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts
index a0ad71ca3a4..2da316e0440 100644
--- a/arch/arm/boot/dts/imx28-evk.dts
+++ b/arch/arm/boot/dts/imx28-evk.dts
@@ -76,7 +76,6 @@
76 0x20c3 /* MX28_PAD_SSP1_SCK__GPIO_2_12 */ 76 0x20c3 /* MX28_PAD_SSP1_SCK__GPIO_2_12 */
77 0x31c3 /* MX28_PAD_PWM3__GPIO_3_28 */ 77 0x31c3 /* MX28_PAD_PWM3__GPIO_3_28 */
78 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */ 78 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
79 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
80 0x3083 /* MX28_PAD_AUART2_RX__GPIO_3_8 */ 79 0x3083 /* MX28_PAD_AUART2_RX__GPIO_3_8 */
81 0x3093 /* MX28_PAD_AUART2_TX__GPIO_3_9 */ 80 0x3093 /* MX28_PAD_AUART2_TX__GPIO_3_9 */
82 >; 81 >;
@@ -85,6 +84,16 @@
85 fsl,pull-up = <0>; 84 fsl,pull-up = <0>;
86 }; 85 };
87 86
87 led_pin_gpio3_5: led_gpio3_5@0 {
88 reg = <0>;
89 fsl,pinmux-ids = <
90 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
91 >;
92 fsl,drive-strength = <0>;
93 fsl,voltage = <1>;
94 fsl,pull-up = <0>;
95 };
96
88 gpmi_pins_evk: gpmi-nand-evk@0 { 97 gpmi_pins_evk: gpmi-nand-evk@0 {
89 reg = <0>; 98 reg = <0>;
90 fsl,pinmux-ids = < 99 fsl,pinmux-ids = <
@@ -288,6 +297,8 @@
288 297
289 leds { 298 leds {
290 compatible = "gpio-leds"; 299 compatible = "gpio-leds";
300 pinctrl-names = "default";
301 pinctrl-0 = <&led_pin_gpio3_5>;
291 302
292 user { 303 user {
293 label = "Heartbeat"; 304 label = "Heartbeat";
diff --git a/arch/arm/boot/dts/imx28-sps1.dts b/arch/arm/boot/dts/imx28-sps1.dts
new file mode 100644
index 00000000000..e6cde8aa7ff
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-sps1.dts
@@ -0,0 +1,169 @@
1/*
2 * Copyright (C) 2012 Marek Vasut <marex@denx.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "imx28.dtsi"
14
15/ {
16 model = "SchulerControl GmbH, SC SPS 1";
17 compatible = "schulercontrol,imx28-sps1", "fsl,imx28";
18
19 memory {
20 reg = <0x40000000 0x08000000>;
21 };
22
23 apb@80000000 {
24 apbh@80000000 {
25 pinctrl@80018000 {
26 pinctrl-names = "default";
27 pinctrl-0 = <&hog_pins_a>;
28
29 hog_pins_a: hog-gpios@0 {
30 reg = <0>;
31 fsl,pinmux-ids = <
32 0x0003 /* MX28_PAD_GPMI_D00__GPIO_0_0 */
33 0x0033 /* MX28_PAD_GPMI_D03__GPIO_0_3 */
34 0x0063 /* MX28_PAD_GPMI_D06__GPIO_0_6 */
35 >;
36 fsl,drive-strength = <0>;
37 fsl,voltage = <1>;
38 fsl,pull-up = <0>;
39 };
40
41 };
42
43 ssp0: ssp@80010000 {
44 compatible = "fsl,imx28-mmc";
45 pinctrl-names = "default";
46 pinctrl-0 = <&mmc0_4bit_pins_a>;
47 bus-width = <4>;
48 status = "okay";
49 };
50
51 ssp2: ssp@80014000 {
52 #address-cells = <1>;
53 #size-cells = <0>;
54 compatible = "fsl,imx28-spi";
55 pinctrl-names = "default";
56 pinctrl-0 = <&spi2_pins_a>;
57 status = "okay";
58
59 flash: m25p80@0 {
60 #address-cells = <1>;
61 #size-cells = <1>;
62 compatible = "everspin,mr25h256", "mr25h256";
63 spi-max-frequency = <40000000>;
64 reg = <0>;
65 };
66 };
67 };
68
69 apbx@80040000 {
70 i2c0: i2c@80058000 {
71 pinctrl-names = "default";
72 pinctrl-0 = <&i2c0_pins_a>;
73 clock-frequency = <400000>;
74 status = "okay";
75
76 rtc: rtc@51 {
77 compatible = "nxp,pcf8563";
78 reg = <0x51>;
79 };
80
81 eeprom: eeprom@52 {
82 compatible = "atmel,24c64";
83 reg = <0x52>;
84 pagesize = <32>;
85 };
86 };
87
88 duart: serial@80074000 {
89 pinctrl-names = "default";
90 pinctrl-0 = <&duart_pins_a>;
91 status = "okay";
92 };
93
94 usbphy0: usbphy@8007c000 {
95 status = "okay";
96 };
97
98 auart0: serial@8006a000 {
99 pinctrl-names = "default";
100 pinctrl-0 = <&auart0_pins_a>;
101 status = "okay";
102 };
103 };
104 };
105
106 ahb@80080000 {
107 usb0: usb@80080000 {
108 vbus-supply = <&reg_usb0_vbus>;
109 pinctrl-names = "default";
110 pinctrl-0 = <&usbphy0_pins_b>;
111 status = "okay";
112 };
113
114 mac0: ethernet@800f0000 {
115 phy-mode = "rmii";
116 pinctrl-names = "default";
117 pinctrl-0 = <&mac0_pins_a>;
118 status = "okay";
119 };
120
121 mac1: ethernet@800f4000 {
122 phy-mode = "rmii";
123 pinctrl-names = "default";
124 pinctrl-0 = <&mac1_pins_a>;
125 status = "okay";
126 };
127 };
128
129 regulators {
130 compatible = "simple-bus";
131
132 reg_usb0_vbus: usb0_vbus {
133 compatible = "regulator-fixed";
134 regulator-name = "usb0_vbus";
135 regulator-min-microvolt = <5000000>;
136 regulator-max-microvolt = <5000000>;
137 gpio = <&gpio3 9 0>;
138 };
139 };
140
141 leds {
142 #address-cells = <1>;
143 #size-cells = <0>;
144 compatible = "gpio-leds";
145 status = "okay";
146
147 led@1 {
148 label = "sps1-1:yellow:user";
149 gpios = <&gpio0 6 0>;
150 linux,default-trigger = "heartbeat";
151 reg = <0>;
152 };
153
154 led@2 {
155 label = "sps1-2:red:user";
156 gpios = <&gpio0 3 0>;
157 linux,default-trigger = "heartbeat";
158 reg = <1>;
159 };
160
161 led@3 {
162 label = "sps1-3:red:user";
163 gpios = <&gpio0 0 0>;
164 default-trigger = "heartbeat";
165 reg = <2>;
166 };
167
168 };
169};
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 55c57ea6169..13b7053d799 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -492,6 +492,16 @@
492 fsl,pull-up = <0>; 492 fsl,pull-up = <0>;
493 }; 493 };
494 494
495 pwm3_pins_a: pwm3@0 {
496 reg = <0>;
497 fsl,pinmux-ids = <
498 0x31c0 /* MX28_PAD_PWM3__PWM_3 */
499 >;
500 fsl,drive-strength = <0>;
501 fsl,voltage = <1>;
502 fsl,pull-up = <0>;
503 };
504
495 pwm4_pins_a: pwm4@0 { 505 pwm4_pins_a: pwm4@0 {
496 reg = <0>; 506 reg = <0>;
497 fsl,pinmux-ids = < 507 fsl,pinmux-ids = <
@@ -535,6 +545,31 @@
535 fsl,pull-up = <0>; 545 fsl,pull-up = <0>;
536 }; 546 };
537 547
548 lcdif_16bit_pins_a: lcdif-16bit@0 {
549 reg = <0>;
550 fsl,pinmux-ids = <
551 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */
552 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */
553 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */
554 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */
555 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */
556 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */
557 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */
558 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */
559 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */
560 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */
561 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */
562 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */
563 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */
564 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */
565 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */
566 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */
567 >;
568 fsl,drive-strength = <0>;
569 fsl,voltage = <1>;
570 fsl,pull-up = <0>;
571 };
572
538 can0_pins_a: can0@0 { 573 can0_pins_a: can0@0 {
539 reg = <0>; 574 reg = <0>;
540 fsl,pinmux-ids = < 575 fsl,pinmux-ids = <
@@ -799,6 +834,7 @@
799 compatible = "fsl,imx28-auart", "fsl,imx23-auart"; 834 compatible = "fsl,imx28-auart", "fsl,imx23-auart";
800 reg = <0x8006a000 0x2000>; 835 reg = <0x8006a000 0x2000>;
801 interrupts = <112 70 71>; 836 interrupts = <112 70 71>;
837 fsl,auart-dma-channel = <8 9>;
802 clocks = <&clks 45>; 838 clocks = <&clks 45>;
803 status = "disabled"; 839 status = "disabled";
804 }; 840 };
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index cbd2b1c7487..567e7ee72f9 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -22,6 +22,22 @@
22 }; 22 };
23 23
24 soc { 24 soc {
25 display@di0 {
26 compatible = "fsl,imx-parallel-display";
27 crtcs = <&ipu 0>;
28 interface-pix-fmt = "rgb24";
29 pinctrl-names = "default";
30 pinctrl-0 = <&pinctrl_ipu_disp1_1>;
31 };
32
33 display@di1 {
34 compatible = "fsl,imx-parallel-display";
35 crtcs = <&ipu 1>;
36 interface-pix-fmt = "rgb565";
37 pinctrl-names = "default";
38 pinctrl-0 = <&pinctrl_ipu_disp2_1>;
39 };
40
25 aips@70000000 { /* aips-1 */ 41 aips@70000000 { /* aips-1 */
26 spba@70000000 { 42 spba@70000000 {
27 esdhc@70004000 { /* ESDHC1 */ 43 esdhc@70004000 { /* ESDHC1 */
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 75d069fcf89..1f5d45eff45 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -62,6 +62,13 @@
62 interrupt-parent = <&tzic>; 62 interrupt-parent = <&tzic>;
63 ranges; 63 ranges;
64 64
65 ipu: ipu@40000000 {
66 #crtc-cells = <1>;
67 compatible = "fsl,imx51-ipu";
68 reg = <0x40000000 0x20000000>;
69 interrupts = <11 10>;
70 };
71
65 aips@70000000 { /* AIPS1 */ 72 aips@70000000 { /* AIPS1 */
66 compatible = "fsl,aips-bus", "simple-bus"; 73 compatible = "fsl,aips-bus", "simple-bus";
67 #address-cells = <1>; 74 #address-cells = <1>;
@@ -76,17 +83,22 @@
76 reg = <0x70000000 0x40000>; 83 reg = <0x70000000 0x40000>;
77 ranges; 84 ranges;
78 85
79 esdhc@70004000 { /* ESDHC1 */ 86 esdhc1: esdhc@70004000 {
80 compatible = "fsl,imx51-esdhc"; 87 compatible = "fsl,imx51-esdhc";
81 reg = <0x70004000 0x4000>; 88 reg = <0x70004000 0x4000>;
82 interrupts = <1>; 89 interrupts = <1>;
90 clocks = <&clks 44>, <&clks 0>, <&clks 71>;
91 clock-names = "ipg", "ahb", "per";
83 status = "disabled"; 92 status = "disabled";
84 }; 93 };
85 94
86 esdhc@70008000 { /* ESDHC2 */ 95 esdhc2: esdhc@70008000 {
87 compatible = "fsl,imx51-esdhc"; 96 compatible = "fsl,imx51-esdhc";
88 reg = <0x70008000 0x4000>; 97 reg = <0x70008000 0x4000>;
89 interrupts = <2>; 98 interrupts = <2>;
99 clocks = <&clks 45>, <&clks 0>, <&clks 72>;
100 clock-names = "ipg", "ahb", "per";
101 bus-width = <4>;
90 status = "disabled"; 102 status = "disabled";
91 }; 103 };
92 104
@@ -94,15 +106,19 @@
94 compatible = "fsl,imx51-uart", "fsl,imx21-uart"; 106 compatible = "fsl,imx51-uart", "fsl,imx21-uart";
95 reg = <0x7000c000 0x4000>; 107 reg = <0x7000c000 0x4000>;
96 interrupts = <33>; 108 interrupts = <33>;
109 clocks = <&clks 32>, <&clks 33>;
110 clock-names = "ipg", "per";
97 status = "disabled"; 111 status = "disabled";
98 }; 112 };
99 113
100 ecspi@70010000 { /* ECSPI1 */ 114 ecspi1: ecspi@70010000 {
101 #address-cells = <1>; 115 #address-cells = <1>;
102 #size-cells = <0>; 116 #size-cells = <0>;
103 compatible = "fsl,imx51-ecspi"; 117 compatible = "fsl,imx51-ecspi";
104 reg = <0x70010000 0x4000>; 118 reg = <0x70010000 0x4000>;
105 interrupts = <36>; 119 interrupts = <36>;
120 clocks = <&clks 51>, <&clks 52>;
121 clock-names = "ipg", "per";
106 status = "disabled"; 122 status = "disabled";
107 }; 123 };
108 124
@@ -110,48 +126,55 @@
110 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 126 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
111 reg = <0x70014000 0x4000>; 127 reg = <0x70014000 0x4000>;
112 interrupts = <30>; 128 interrupts = <30>;
129 clocks = <&clks 49>;
113 fsl,fifo-depth = <15>; 130 fsl,fifo-depth = <15>;
114 fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */ 131 fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
115 status = "disabled"; 132 status = "disabled";
116 }; 133 };
117 134
118 esdhc@70020000 { /* ESDHC3 */ 135 esdhc3: esdhc@70020000 {
119 compatible = "fsl,imx51-esdhc"; 136 compatible = "fsl,imx51-esdhc";
120 reg = <0x70020000 0x4000>; 137 reg = <0x70020000 0x4000>;
121 interrupts = <3>; 138 interrupts = <3>;
139 clocks = <&clks 46>, <&clks 0>, <&clks 73>;
140 clock-names = "ipg", "ahb", "per";
141 bus-width = <4>;
122 status = "disabled"; 142 status = "disabled";
123 }; 143 };
124 144
125 esdhc@70024000 { /* ESDHC4 */ 145 esdhc4: esdhc@70024000 {
126 compatible = "fsl,imx51-esdhc"; 146 compatible = "fsl,imx51-esdhc";
127 reg = <0x70024000 0x4000>; 147 reg = <0x70024000 0x4000>;
128 interrupts = <4>; 148 interrupts = <4>;
149 clocks = <&clks 47>, <&clks 0>, <&clks 74>;
150 clock-names = "ipg", "ahb", "per";
151 bus-width = <4>;
129 status = "disabled"; 152 status = "disabled";
130 }; 153 };
131 }; 154 };
132 155
133 usb@73f80000 { 156 usbotg: usb@73f80000 {
134 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 157 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
135 reg = <0x73f80000 0x0200>; 158 reg = <0x73f80000 0x0200>;
136 interrupts = <18>; 159 interrupts = <18>;
137 status = "disabled"; 160 status = "disabled";
138 }; 161 };
139 162
140 usb@73f80200 { 163 usbh1: usb@73f80200 {
141 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 164 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
142 reg = <0x73f80200 0x0200>; 165 reg = <0x73f80200 0x0200>;
143 interrupts = <14>; 166 interrupts = <14>;
144 status = "disabled"; 167 status = "disabled";
145 }; 168 };
146 169
147 usb@73f80400 { 170 usbh2: usb@73f80400 {
148 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 171 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
149 reg = <0x73f80400 0x0200>; 172 reg = <0x73f80400 0x0200>;
150 interrupts = <16>; 173 interrupts = <16>;
151 status = "disabled"; 174 status = "disabled";
152 }; 175 };
153 176
154 usb@73f80600 { 177 usbh3: usb@73f80600 {
155 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 178 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
156 reg = <0x73f80600 0x0200>; 179 reg = <0x73f80600 0x0200>;
157 interrupts = <17>; 180 interrupts = <17>;
@@ -198,20 +221,22 @@
198 #interrupt-cells = <2>; 221 #interrupt-cells = <2>;
199 }; 222 };
200 223
201 wdog@73f98000 { /* WDOG1 */ 224 wdog1: wdog@73f98000 {
202 compatible = "fsl,imx51-wdt", "fsl,imx21-wdt"; 225 compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
203 reg = <0x73f98000 0x4000>; 226 reg = <0x73f98000 0x4000>;
204 interrupts = <58>; 227 interrupts = <58>;
228 clocks = <&clks 0>;
205 }; 229 };
206 230
207 wdog@73f9c000 { /* WDOG2 */ 231 wdog2: wdog@73f9c000 {
208 compatible = "fsl,imx51-wdt", "fsl,imx21-wdt"; 232 compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
209 reg = <0x73f9c000 0x4000>; 233 reg = <0x73f9c000 0x4000>;
210 interrupts = <59>; 234 interrupts = <59>;
235 clocks = <&clks 0>;
211 status = "disabled"; 236 status = "disabled";
212 }; 237 };
213 238
214 iomuxc@73fa8000 { 239 iomuxc: iomuxc@73fa8000 {
215 compatible = "fsl,imx51-iomuxc"; 240 compatible = "fsl,imx51-iomuxc";
216 reg = <0x73fa8000 0x4000>; 241 reg = <0x73fa8000 0x4000>;
217 242
@@ -295,6 +320,66 @@
295 }; 320 };
296 }; 321 };
297 322
323 ipu_disp1 {
324 pinctrl_ipu_disp1_1: ipudisp1grp-1 {
325 fsl,pins = <
326 528 0x5 /* MX51_PAD_DISP1_DAT0__DISP1_DAT0 */
327 529 0x5 /* MX51_PAD_DISP1_DAT1__DISP1_DAT1 */
328 530 0x5 /* MX51_PAD_DISP1_DAT2__DISP1_DAT2 */
329 531 0x5 /* MX51_PAD_DISP1_DAT3__DISP1_DAT3 */
330 532 0x5 /* MX51_PAD_DISP1_DAT4__DISP1_DAT4 */
331 533 0x5 /* MX51_PAD_DISP1_DAT5__DISP1_DAT5 */
332 535 0x5 /* MX51_PAD_DISP1_DAT6__DISP1_DAT6 */
333 537 0x5 /* MX51_PAD_DISP1_DAT7__DISP1_DAT7 */
334 539 0x5 /* MX51_PAD_DISP1_DAT8__DISP1_DAT8 */
335 541 0x5 /* MX51_PAD_DISP1_DAT9__DISP1_DAT9 */
336 543 0x5 /* MX51_PAD_DISP1_DAT10__DISP1_DAT10 */
337 545 0x5 /* MX51_PAD_DISP1_DAT11__DISP1_DAT11 */
338 547 0x5 /* MX51_PAD_DISP1_DAT12__DISP1_DAT12 */
339 549 0x5 /* MX51_PAD_DISP1_DAT13__DISP1_DAT13 */
340 551 0x5 /* MX51_PAD_DISP1_DAT14__DISP1_DAT14 */
341 553 0x5 /* MX51_PAD_DISP1_DAT15__DISP1_DAT15 */
342 555 0x5 /* MX51_PAD_DISP1_DAT16__DISP1_DAT16 */
343 557 0x5 /* MX51_PAD_DISP1_DAT17__DISP1_DAT17 */
344 559 0x5 /* MX51_PAD_DISP1_DAT18__DISP1_DAT18 */
345 563 0x5 /* MX51_PAD_DISP1_DAT19__DISP1_DAT19 */
346 567 0x5 /* MX51_PAD_DISP1_DAT20__DISP1_DAT20 */
347 571 0x5 /* MX51_PAD_DISP1_DAT21__DISP1_DAT21 */
348 575 0x5 /* MX51_PAD_DISP1_DAT22__DISP1_DAT22 */
349 579 0x5 /* MX51_PAD_DISP1_DAT23__DISP1_DAT23 */
350 584 0x5 /* MX51_PAD_DI1_PIN2__DI1_PIN2 (hsync) */
351 583 0x5 /* MX51_PAD_DI1_PIN3__DI1_PIN3 (vsync) */
352 >;
353 };
354 };
355
356 ipu_disp2 {
357 pinctrl_ipu_disp2_1: ipudisp2grp-1 {
358 fsl,pins = <
359 603 0x5 /* MX51_PAD_DISP2_DAT0__DISP2_DAT0 */
360 608 0x5 /* MX51_PAD_DISP2_DAT1__DISP2_DAT1 */
361 613 0x5 /* MX51_PAD_DISP2_DAT2__DISP2_DAT2 */
362 614 0x5 /* MX51_PAD_DISP2_DAT3__DISP2_DAT3 */
363 615 0x5 /* MX51_PAD_DISP2_DAT4__DISP2_DAT4 */
364 616 0x5 /* MX51_PAD_DISP2_DAT5__DISP2_DAT5 */
365 617 0x5 /* MX51_PAD_DISP2_DAT6__DISP2_DAT6 */
366 622 0x5 /* MX51_PAD_DISP2_DAT7__DISP2_DAT7 */
367 627 0x5 /* MX51_PAD_DISP2_DAT8__DISP2_DAT8 */
368 633 0x5 /* MX51_PAD_DISP2_DAT9__DISP2_DAT9 */
369 637 0x5 /* MX51_PAD_DISP2_DAT10__DISP2_DAT10 */
370 643 0x5 /* MX51_PAD_DISP2_DAT11__DISP2_DAT11 */
371 648 0x5 /* MX51_PAD_DISP2_DAT12__DISP2_DAT12 */
372 652 0x5 /* MX51_PAD_DISP2_DAT13__DISP2_DAT13 */
373 656 0x5 /* MX51_PAD_DISP2_DAT14__DISP2_DAT14 */
374 661 0x5 /* MX51_PAD_DISP2_DAT15__DISP2_DAT15 */
375 593 0x5 /* MX51_PAD_DI2_PIN2__DI2_PIN2 (hsync) */
376 595 0x5 /* MX51_PAD_DI2_PIN3__DI2_PIN3 (vsync) */
377 597 0x5 /* MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK */
378 599 0x5 /* MX51_PAD_DI_GP4__DI2_PIN15 */
379 >;
380 };
381 };
382
298 uart1 { 383 uart1 {
299 pinctrl_uart1_1: uart1grp-1 { 384 pinctrl_uart1_1: uart1grp-1 {
300 fsl,pins = < 385 fsl,pins = <
@@ -327,10 +412,30 @@
327 }; 412 };
328 }; 413 };
329 414
415 pwm1: pwm@73fb4000 {
416 #pwm-cells = <2>;
417 compatible = "fsl,imx51-pwm", "fsl,imx27-pwm";
418 reg = <0x73fb4000 0x4000>;
419 clocks = <&clks 37>, <&clks 38>;
420 clock-names = "ipg", "per";
421 interrupts = <61>;
422 };
423
424 pwm2: pwm@73fb8000 {
425 #pwm-cells = <2>;
426 compatible = "fsl,imx51-pwm", "fsl,imx27-pwm";
427 reg = <0x73fb8000 0x4000>;
428 clocks = <&clks 39>, <&clks 40>;
429 clock-names = "ipg", "per";
430 interrupts = <94>;
431 };
432
330 uart1: serial@73fbc000 { 433 uart1: serial@73fbc000 {
331 compatible = "fsl,imx51-uart", "fsl,imx21-uart"; 434 compatible = "fsl,imx51-uart", "fsl,imx21-uart";
332 reg = <0x73fbc000 0x4000>; 435 reg = <0x73fbc000 0x4000>;
333 interrupts = <31>; 436 interrupts = <31>;
437 clocks = <&clks 28>, <&clks 29>;
438 clock-names = "ipg", "per";
334 status = "disabled"; 439 status = "disabled";
335 }; 440 };
336 441
@@ -338,8 +443,17 @@
338 compatible = "fsl,imx51-uart", "fsl,imx21-uart"; 443 compatible = "fsl,imx51-uart", "fsl,imx21-uart";
339 reg = <0x73fc0000 0x4000>; 444 reg = <0x73fc0000 0x4000>;
340 interrupts = <32>; 445 interrupts = <32>;
446 clocks = <&clks 30>, <&clks 31>;
447 clock-names = "ipg", "per";
341 status = "disabled"; 448 status = "disabled";
342 }; 449 };
450
451 clks: ccm@73fd4000{
452 compatible = "fsl,imx51-ccm";
453 reg = <0x73fd4000 0x4000>;
454 interrupts = <0 71 0x04 0 72 0x04>;
455 #clock-cells = <1>;
456 };
343 }; 457 };
344 458
345 aips@80000000 { /* AIPS2 */ 459 aips@80000000 { /* AIPS2 */
@@ -349,46 +463,54 @@
349 reg = <0x80000000 0x10000000>; 463 reg = <0x80000000 0x10000000>;
350 ranges; 464 ranges;
351 465
352 ecspi@83fac000 { /* ECSPI2 */ 466 ecspi2: ecspi@83fac000 {
353 #address-cells = <1>; 467 #address-cells = <1>;
354 #size-cells = <0>; 468 #size-cells = <0>;
355 compatible = "fsl,imx51-ecspi"; 469 compatible = "fsl,imx51-ecspi";
356 reg = <0x83fac000 0x4000>; 470 reg = <0x83fac000 0x4000>;
357 interrupts = <37>; 471 interrupts = <37>;
472 clocks = <&clks 53>, <&clks 54>;
473 clock-names = "ipg", "per";
358 status = "disabled"; 474 status = "disabled";
359 }; 475 };
360 476
361 sdma@83fb0000 { 477 sdma: sdma@83fb0000 {
362 compatible = "fsl,imx51-sdma", "fsl,imx35-sdma"; 478 compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
363 reg = <0x83fb0000 0x4000>; 479 reg = <0x83fb0000 0x4000>;
364 interrupts = <6>; 480 interrupts = <6>;
481 clocks = <&clks 56>, <&clks 56>;
482 clock-names = "ipg", "ahb";
365 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx51.bin"; 483 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx51.bin";
366 }; 484 };
367 485
368 cspi@83fc0000 { 486 cspi: cspi@83fc0000 {
369 #address-cells = <1>; 487 #address-cells = <1>;
370 #size-cells = <0>; 488 #size-cells = <0>;
371 compatible = "fsl,imx51-cspi", "fsl,imx35-cspi"; 489 compatible = "fsl,imx51-cspi", "fsl,imx35-cspi";
372 reg = <0x83fc0000 0x4000>; 490 reg = <0x83fc0000 0x4000>;
373 interrupts = <38>; 491 interrupts = <38>;
492 clocks = <&clks 55>, <&clks 0>;
493 clock-names = "ipg", "per";
374 status = "disabled"; 494 status = "disabled";
375 }; 495 };
376 496
377 i2c@83fc4000 { /* I2C2 */ 497 i2c2: i2c@83fc4000 {
378 #address-cells = <1>; 498 #address-cells = <1>;
379 #size-cells = <0>; 499 #size-cells = <0>;
380 compatible = "fsl,imx51-i2c", "fsl,imx1-i2c"; 500 compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
381 reg = <0x83fc4000 0x4000>; 501 reg = <0x83fc4000 0x4000>;
382 interrupts = <63>; 502 interrupts = <63>;
503 clocks = <&clks 35>;
383 status = "disabled"; 504 status = "disabled";
384 }; 505 };
385 506
386 i2c@83fc8000 { /* I2C1 */ 507 i2c1: i2c@83fc8000 {
387 #address-cells = <1>; 508 #address-cells = <1>;
388 #size-cells = <0>; 509 #size-cells = <0>;
389 compatible = "fsl,imx51-i2c", "fsl,imx1-i2c"; 510 compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
390 reg = <0x83fc8000 0x4000>; 511 reg = <0x83fc8000 0x4000>;
391 interrupts = <62>; 512 interrupts = <62>;
513 clocks = <&clks 34>;
392 status = "disabled"; 514 status = "disabled";
393 }; 515 };
394 516
@@ -396,21 +518,23 @@
396 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 518 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
397 reg = <0x83fcc000 0x4000>; 519 reg = <0x83fcc000 0x4000>;
398 interrupts = <29>; 520 interrupts = <29>;
521 clocks = <&clks 48>;
399 fsl,fifo-depth = <15>; 522 fsl,fifo-depth = <15>;
400 fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */ 523 fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
401 status = "disabled"; 524 status = "disabled";
402 }; 525 };
403 526
404 audmux@83fd0000 { 527 audmux: audmux@83fd0000 {
405 compatible = "fsl,imx51-audmux", "fsl,imx31-audmux"; 528 compatible = "fsl,imx51-audmux", "fsl,imx31-audmux";
406 reg = <0x83fd0000 0x4000>; 529 reg = <0x83fd0000 0x4000>;
407 status = "disabled"; 530 status = "disabled";
408 }; 531 };
409 532
410 nand@83fdb000 { 533 nfc: nand@83fdb000 {
411 compatible = "fsl,imx51-nand"; 534 compatible = "fsl,imx51-nand";
412 reg = <0x83fdb000 0x1000 0xcfff0000 0x10000>; 535 reg = <0x83fdb000 0x1000 0xcfff0000 0x10000>;
413 interrupts = <8>; 536 interrupts = <8>;
537 clocks = <&clks 60>;
414 status = "disabled"; 538 status = "disabled";
415 }; 539 };
416 540
@@ -418,15 +542,18 @@
418 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 542 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
419 reg = <0x83fe8000 0x4000>; 543 reg = <0x83fe8000 0x4000>;
420 interrupts = <96>; 544 interrupts = <96>;
545 clocks = <&clks 50>;
421 fsl,fifo-depth = <15>; 546 fsl,fifo-depth = <15>;
422 fsl,ssi-dma-events = <47 46 37 35>; /* TX0 RX0 TX1 RX1 */ 547 fsl,ssi-dma-events = <47 46 37 35>; /* TX0 RX0 TX1 RX1 */
423 status = "disabled"; 548 status = "disabled";
424 }; 549 };
425 550
426 ethernet@83fec000 { 551 fec: ethernet@83fec000 {
427 compatible = "fsl,imx51-fec", "fsl,imx27-fec"; 552 compatible = "fsl,imx51-fec", "fsl,imx27-fec";
428 reg = <0x83fec000 0x4000>; 553 reg = <0x83fec000 0x4000>;
429 interrupts = <87>; 554 interrupts = <87>;
555 clocks = <&clks 42>, <&clks 42>, <&clks 42>;
556 clock-names = "ipg", "ahb", "ptp";
430 status = "disabled"; 557 status = "disabled";
431 }; 558 };
432 }; 559 };
diff --git a/arch/arm/boot/dts/imx53-qsb.dts b/arch/arm/boot/dts/imx53-qsb.dts
index 08948af86d1..b0075537195 100644
--- a/arch/arm/boot/dts/imx53-qsb.dts
+++ b/arch/arm/boot/dts/imx53-qsb.dts
@@ -60,10 +60,17 @@
60 697 0x80000000 /* MX53_PAD_EIM_DA12__GPIO3_12 */ 60 697 0x80000000 /* MX53_PAD_EIM_DA12__GPIO3_12 */
61 701 0x80000000 /* MX53_PAD_EIM_DA13__GPIO3_13 */ 61 701 0x80000000 /* MX53_PAD_EIM_DA13__GPIO3_13 */
62 868 0x80000000 /* MX53_PAD_PATA_DA_0__GPIO7_6 */ 62 868 0x80000000 /* MX53_PAD_PATA_DA_0__GPIO7_6 */
63 1149 0x80000000 /* MX53_PAD_GPIO_16__GPIO7_11 */
64 >;
65 };
66
67 led_pin_gpio7_7: led_gpio7_7@0 {
68 fsl,pins = <
63 873 0x80000000 /* MX53_PAD_PATA_DA_1__GPIO7_7 */ 69 873 0x80000000 /* MX53_PAD_PATA_DA_1__GPIO7_7 */
64 >; 70 >;
65 }; 71 };
66 }; 72 };
73
67 }; 74 };
68 75
69 uart1: serial@53fbc000 { 76 uart1: serial@53fbc000 {
@@ -100,76 +107,93 @@
100 pmic: dialog@48 { 107 pmic: dialog@48 {
101 compatible = "dlg,da9053-aa", "dlg,da9052"; 108 compatible = "dlg,da9053-aa", "dlg,da9052";
102 reg = <0x48>; 109 reg = <0x48>;
110 interrupt-parent = <&gpio7>;
111 interrupts = <11 0x8>; /* low-level active IRQ at GPIO7_11 */
103 112
104 regulators { 113 regulators {
105 buck0 { 114 buck1_reg: buck1 {
106 regulator-min-microvolt = <500000>; 115 regulator-min-microvolt = <500000>;
107 regulator-max-microvolt = <2075000>; 116 regulator-max-microvolt = <2075000>;
117 regulator-always-on;
108 }; 118 };
109 119
110 buck1 { 120 buck2_reg: buck2 {
111 regulator-min-microvolt = <500000>; 121 regulator-min-microvolt = <500000>;
112 regulator-max-microvolt = <2075000>; 122 regulator-max-microvolt = <2075000>;
123 regulator-always-on;
113 }; 124 };
114 125
115 buck2 { 126 buck3_reg: buck3 {
116 regulator-min-microvolt = <925000>; 127 regulator-min-microvolt = <925000>;
117 regulator-max-microvolt = <2500000>; 128 regulator-max-microvolt = <2500000>;
129 regulator-always-on;
118 }; 130 };
119 131
120 buck3 { 132 buck4_reg: buck4 {
121 regulator-min-microvolt = <925000>; 133 regulator-min-microvolt = <925000>;
122 regulator-max-microvolt = <2500000>; 134 regulator-max-microvolt = <2500000>;
135 regulator-always-on;
123 }; 136 };
124 137
125 ldo4 { 138 ldo1_reg: ldo1 {
126 regulator-min-microvolt = <600000>; 139 regulator-min-microvolt = <600000>;
127 regulator-max-microvolt = <1800000>; 140 regulator-max-microvolt = <1800000>;
141 regulator-boot-on;
142 regulator-always-on;
128 }; 143 };
129 144
130 ldo5 { 145 ldo2_reg: ldo2 {
146 regulator-min-microvolt = <600000>;
147 regulator-max-microvolt = <1800000>;
148 regulator-always-on;
149 };
150
151 ldo3_reg: ldo3 {
131 regulator-min-microvolt = <600000>; 152 regulator-min-microvolt = <600000>;
132 regulator-max-microvolt = <1800000>; 153 regulator-max-microvolt = <1800000>;
154 regulator-always-on;
133 }; 155 };
134 156
135 ldo6 { 157 ldo4_reg: ldo4 {
136 regulator-min-microvolt = <1725000>; 158 regulator-min-microvolt = <1725000>;
137 regulator-max-microvolt = <3300000>; 159 regulator-max-microvolt = <3300000>;
160 regulator-always-on;
138 }; 161 };
139 162
140 ldo7 { 163 ldo5_reg: ldo5 {
141 regulator-min-microvolt = <1725000>; 164 regulator-min-microvolt = <1725000>;
142 regulator-max-microvolt = <3300000>; 165 regulator-max-microvolt = <3300000>;
166 regulator-always-on;
143 }; 167 };
144 168
145 ldo8 { 169 ldo6_reg: ldo6 {
146 regulator-min-microvolt = <1200000>; 170 regulator-min-microvolt = <1200000>;
147 regulator-max-microvolt = <3600000>; 171 regulator-max-microvolt = <3600000>;
172 regulator-always-on;
148 }; 173 };
149 174
150 ldo9 { 175 ldo7_reg: ldo7 {
151 regulator-min-microvolt = <1200000>; 176 regulator-min-microvolt = <1200000>;
152 regulator-max-microvolt = <3600000>; 177 regulator-max-microvolt = <3600000>;
178 regulator-always-on;
153 }; 179 };
154 180
155 ldo10 { 181 ldo8_reg: ldo8 {
156 regulator-min-microvolt = <1200000>; 182 regulator-min-microvolt = <1200000>;
157 regulator-max-microvolt = <3600000>; 183 regulator-max-microvolt = <3600000>;
184 regulator-always-on;
158 }; 185 };
159 186
160 ldo11 { 187 ldo9_reg: ldo9 {
161 regulator-min-microvolt = <1200000>; 188 regulator-min-microvolt = <1200000>;
162 regulator-max-microvolt = <3600000>; 189 regulator-max-microvolt = <3600000>;
190 regulator-always-on;
163 }; 191 };
164 192
165 ldo12 { 193 ldo10_reg: ldo10 {
166 regulator-min-microvolt = <1250000>; 194 regulator-min-microvolt = <1250000>;
167 regulator-max-microvolt = <3650000>; 195 regulator-max-microvolt = <3650000>;
168 }; 196 regulator-always-on;
169
170 ldo13 {
171 regulator-min-microvolt = <1200000>;
172 regulator-max-microvolt = <3600000>;
173 }; 197 };
174 }; 198 };
175 }; 199 };
@@ -216,6 +240,8 @@
216 240
217 leds { 241 leds {
218 compatible = "gpio-leds"; 242 compatible = "gpio-leds";
243 pinctrl-names = "default";
244 pinctrl-0 = <&led_pin_gpio7_7>;
219 245
220 user { 246 user {
221 label = "Heartbeat"; 247 label = "Heartbeat";
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 76ebb1ad267..552aed4ff98 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -67,6 +67,13 @@
67 interrupt-parent = <&tzic>; 67 interrupt-parent = <&tzic>;
68 ranges; 68 ranges;
69 69
70 ipu: ipu@18000000 {
71 #crtc-cells = <1>;
72 compatible = "fsl,imx53-ipu";
73 reg = <0x18000000 0x080000000>;
74 interrupts = <11 10>;
75 };
76
70 aips@50000000 { /* AIPS1 */ 77 aips@50000000 { /* AIPS1 */
71 compatible = "fsl,aips-bus", "simple-bus"; 78 compatible = "fsl,aips-bus", "simple-bus";
72 #address-cells = <1>; 79 #address-cells = <1>;
@@ -81,17 +88,23 @@
81 reg = <0x50000000 0x40000>; 88 reg = <0x50000000 0x40000>;
82 ranges; 89 ranges;
83 90
84 esdhc@50004000 { /* ESDHC1 */ 91 esdhc1: esdhc@50004000 {
85 compatible = "fsl,imx53-esdhc"; 92 compatible = "fsl,imx53-esdhc";
86 reg = <0x50004000 0x4000>; 93 reg = <0x50004000 0x4000>;
87 interrupts = <1>; 94 interrupts = <1>;
95 clocks = <&clks 44>, <&clks 0>, <&clks 71>;
96 clock-names = "ipg", "ahb", "per";
97 bus-width = <4>;
88 status = "disabled"; 98 status = "disabled";
89 }; 99 };
90 100
91 esdhc@50008000 { /* ESDHC2 */ 101 esdhc2: esdhc@50008000 {
92 compatible = "fsl,imx53-esdhc"; 102 compatible = "fsl,imx53-esdhc";
93 reg = <0x50008000 0x4000>; 103 reg = <0x50008000 0x4000>;
94 interrupts = <2>; 104 interrupts = <2>;
105 clocks = <&clks 45>, <&clks 0>, <&clks 72>;
106 clock-names = "ipg", "ahb", "per";
107 bus-width = <4>;
95 status = "disabled"; 108 status = "disabled";
96 }; 109 };
97 110
@@ -99,15 +112,19 @@
99 compatible = "fsl,imx53-uart", "fsl,imx21-uart"; 112 compatible = "fsl,imx53-uart", "fsl,imx21-uart";
100 reg = <0x5000c000 0x4000>; 113 reg = <0x5000c000 0x4000>;
101 interrupts = <33>; 114 interrupts = <33>;
115 clocks = <&clks 32>, <&clks 33>;
116 clock-names = "ipg", "per";
102 status = "disabled"; 117 status = "disabled";
103 }; 118 };
104 119
105 ecspi@50010000 { /* ECSPI1 */ 120 ecspi1: ecspi@50010000 {
106 #address-cells = <1>; 121 #address-cells = <1>;
107 #size-cells = <0>; 122 #size-cells = <0>;
108 compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi"; 123 compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
109 reg = <0x50010000 0x4000>; 124 reg = <0x50010000 0x4000>;
110 interrupts = <36>; 125 interrupts = <36>;
126 clocks = <&clks 51>, <&clks 52>;
127 clock-names = "ipg", "per";
111 status = "disabled"; 128 status = "disabled";
112 }; 129 };
113 130
@@ -115,48 +132,55 @@
115 compatible = "fsl,imx53-ssi", "fsl,imx21-ssi"; 132 compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
116 reg = <0x50014000 0x4000>; 133 reg = <0x50014000 0x4000>;
117 interrupts = <30>; 134 interrupts = <30>;
135 clocks = <&clks 49>;
118 fsl,fifo-depth = <15>; 136 fsl,fifo-depth = <15>;
119 fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */ 137 fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
120 status = "disabled"; 138 status = "disabled";
121 }; 139 };
122 140
123 esdhc@50020000 { /* ESDHC3 */ 141 esdhc3: esdhc@50020000 {
124 compatible = "fsl,imx53-esdhc"; 142 compatible = "fsl,imx53-esdhc";
125 reg = <0x50020000 0x4000>; 143 reg = <0x50020000 0x4000>;
126 interrupts = <3>; 144 interrupts = <3>;
145 clocks = <&clks 46>, <&clks 0>, <&clks 73>;
146 clock-names = "ipg", "ahb", "per";
147 bus-width = <4>;
127 status = "disabled"; 148 status = "disabled";
128 }; 149 };
129 150
130 esdhc@50024000 { /* ESDHC4 */ 151 esdhc4: esdhc@50024000 {
131 compatible = "fsl,imx53-esdhc"; 152 compatible = "fsl,imx53-esdhc";
132 reg = <0x50024000 0x4000>; 153 reg = <0x50024000 0x4000>;
133 interrupts = <4>; 154 interrupts = <4>;
155 clocks = <&clks 47>, <&clks 0>, <&clks 74>;
156 clock-names = "ipg", "ahb", "per";
157 bus-width = <4>;
134 status = "disabled"; 158 status = "disabled";
135 }; 159 };
136 }; 160 };
137 161
138 usb@53f80000 { 162 usbotg: usb@53f80000 {
139 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 163 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
140 reg = <0x53f80000 0x0200>; 164 reg = <0x53f80000 0x0200>;
141 interrupts = <18>; 165 interrupts = <18>;
142 status = "disabled"; 166 status = "disabled";
143 }; 167 };
144 168
145 usb@53f80200 { 169 usbh1: usb@53f80200 {
146 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 170 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
147 reg = <0x53f80200 0x0200>; 171 reg = <0x53f80200 0x0200>;
148 interrupts = <14>; 172 interrupts = <14>;
149 status = "disabled"; 173 status = "disabled";
150 }; 174 };
151 175
152 usb@53f80400 { 176 usbh2: usb@53f80400 {
153 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 177 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
154 reg = <0x53f80400 0x0200>; 178 reg = <0x53f80400 0x0200>;
155 interrupts = <16>; 179 interrupts = <16>;
156 status = "disabled"; 180 status = "disabled";
157 }; 181 };
158 182
159 usb@53f80600 { 183 usbh3: usb@53f80600 {
160 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 184 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
161 reg = <0x53f80600 0x0200>; 185 reg = <0x53f80600 0x0200>;
162 interrupts = <17>; 186 interrupts = <17>;
@@ -203,20 +227,22 @@
203 #interrupt-cells = <2>; 227 #interrupt-cells = <2>;
204 }; 228 };
205 229
206 wdog@53f98000 { /* WDOG1 */ 230 wdog1: wdog@53f98000 {
207 compatible = "fsl,imx53-wdt", "fsl,imx21-wdt"; 231 compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
208 reg = <0x53f98000 0x4000>; 232 reg = <0x53f98000 0x4000>;
209 interrupts = <58>; 233 interrupts = <58>;
234 clocks = <&clks 0>;
210 }; 235 };
211 236
212 wdog@53f9c000 { /* WDOG2 */ 237 wdog2: wdog@53f9c000 {
213 compatible = "fsl,imx53-wdt", "fsl,imx21-wdt"; 238 compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
214 reg = <0x53f9c000 0x4000>; 239 reg = <0x53f9c000 0x4000>;
215 interrupts = <59>; 240 interrupts = <59>;
241 clocks = <&clks 0>;
216 status = "disabled"; 242 status = "disabled";
217 }; 243 };
218 244
219 iomuxc@53fa8000 { 245 iomuxc: iomuxc@53fa8000 {
220 compatible = "fsl,imx53-iomuxc"; 246 compatible = "fsl,imx53-iomuxc";
221 reg = <0x53fa8000 0x4000>; 247 reg = <0x53fa8000 0x4000>;
222 248
@@ -316,6 +342,24 @@
316 }; 342 };
317 }; 343 };
318 344
345 can1 {
346 pinctrl_can1_1: can1grp-1 {
347 fsl,pins = <
348 847 0x80000000 /* MX53_PAD_PATA_INTRQ__CAN1_TXCAN */
349 853 0x80000000 /* MX53_PAD_PATA_DIOR__CAN1_RXCAN */
350 >;
351 };
352 };
353
354 can2 {
355 pinctrl_can2_1: can2grp-1 {
356 fsl,pins = <
357 67 0x80000000 /* MX53_PAD_KEY_COL4__CAN2_TXCAN */
358 74 0x80000000 /* MX53_PAD_KEY_ROW4__CAN2_RXCAN */
359 >;
360 };
361 };
362
319 i2c1 { 363 i2c1 {
320 pinctrl_i2c1_1: i2c1grp-1 { 364 pinctrl_i2c1_1: i2c1grp-1 {
321 fsl,pins = < 365 fsl,pins = <
@@ -334,6 +378,15 @@
334 }; 378 };
335 }; 379 };
336 380
381 i2c3 {
382 pinctrl_i2c3_1: i2c3grp-1 {
383 fsl,pins = <
384 1102 0xc0000000 /* MX53_PAD_GPIO_6__I2C3_SDA */
385 1130 0xc0000000 /* MX53_PAD_GPIO_5__I2C3_SCL */
386 >;
387 };
388 };
389
337 uart1 { 390 uart1 {
338 pinctrl_uart1_1: uart1grp-1 { 391 pinctrl_uart1_1: uart1grp-1 {
339 fsl,pins = < 392 fsl,pins = <
@@ -369,12 +422,51 @@
369 >; 422 >;
370 }; 423 };
371 }; 424 };
425
426 uart4 {
427 pinctrl_uart4_1: uart4grp-1 {
428 fsl,pins = <
429 11 0x1c5 /* MX53_PAD_KEY_COL0__UART4_TXD_MUX */
430 18 0x1c5 /* MX53_PAD_KEY_ROW0__UART4_RXD_MUX */
431 >;
432 };
433 };
434
435 uart5 {
436 pinctrl_uart5_1: uart5grp-1 {
437 fsl,pins = <
438 24 0x1c5 /* MX53_PAD_KEY_COL1__UART5_TXD_MUX */
439 31 0x1c5 /* MX53_PAD_KEY_ROW1__UART5_RXD_MUX */
440 >;
441 };
442 };
443
444 };
445
446 pwm1: pwm@53fb4000 {
447 #pwm-cells = <2>;
448 compatible = "fsl,imx53-pwm", "fsl,imx27-pwm";
449 reg = <0x53fb4000 0x4000>;
450 clocks = <&clks 37>, <&clks 38>;
451 clock-names = "ipg", "per";
452 interrupts = <61>;
453 };
454
455 pwm2: pwm@53fb8000 {
456 #pwm-cells = <2>;
457 compatible = "fsl,imx53-pwm", "fsl,imx27-pwm";
458 reg = <0x53fb8000 0x4000>;
459 clocks = <&clks 39>, <&clks 40>;
460 clock-names = "ipg", "per";
461 interrupts = <94>;
372 }; 462 };
373 463
374 uart1: serial@53fbc000 { 464 uart1: serial@53fbc000 {
375 compatible = "fsl,imx53-uart", "fsl,imx21-uart"; 465 compatible = "fsl,imx53-uart", "fsl,imx21-uart";
376 reg = <0x53fbc000 0x4000>; 466 reg = <0x53fbc000 0x4000>;
377 interrupts = <31>; 467 interrupts = <31>;
468 clocks = <&clks 28>, <&clks 29>;
469 clock-names = "ipg", "per";
378 status = "disabled"; 470 status = "disabled";
379 }; 471 };
380 472
@@ -382,6 +474,8 @@
382 compatible = "fsl,imx53-uart", "fsl,imx21-uart"; 474 compatible = "fsl,imx53-uart", "fsl,imx21-uart";
383 reg = <0x53fc0000 0x4000>; 475 reg = <0x53fc0000 0x4000>;
384 interrupts = <32>; 476 interrupts = <32>;
477 clocks = <&clks 30>, <&clks 31>;
478 clock-names = "ipg", "per";
385 status = "disabled"; 479 status = "disabled";
386 }; 480 };
387 481
@@ -389,6 +483,8 @@
389 compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan"; 483 compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan";
390 reg = <0x53fc8000 0x4000>; 484 reg = <0x53fc8000 0x4000>;
391 interrupts = <82>; 485 interrupts = <82>;
486 clocks = <&clks 158>, <&clks 157>;
487 clock-names = "ipg", "per";
392 status = "disabled"; 488 status = "disabled";
393 }; 489 };
394 490
@@ -396,9 +492,18 @@
396 compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan"; 492 compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan";
397 reg = <0x53fcc000 0x4000>; 493 reg = <0x53fcc000 0x4000>;
398 interrupts = <83>; 494 interrupts = <83>;
495 clocks = <&clks 158>, <&clks 157>;
496 clock-names = "ipg", "per";
399 status = "disabled"; 497 status = "disabled";
400 }; 498 };
401 499
500 clks: ccm@53fd4000{
501 compatible = "fsl,imx53-ccm";
502 reg = <0x53fd4000 0x4000>;
503 interrupts = <0 71 0x04 0 72 0x04>;
504 #clock-cells = <1>;
505 };
506
402 gpio5: gpio@53fdc000 { 507 gpio5: gpio@53fdc000 {
403 compatible = "fsl,imx53-gpio", "fsl,imx35-gpio"; 508 compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
404 reg = <0x53fdc000 0x4000>; 509 reg = <0x53fdc000 0x4000>;
@@ -429,12 +534,13 @@
429 #interrupt-cells = <2>; 534 #interrupt-cells = <2>;
430 }; 535 };
431 536
432 i2c@53fec000 { /* I2C3 */ 537 i2c3: i2c@53fec000 {
433 #address-cells = <1>; 538 #address-cells = <1>;
434 #size-cells = <0>; 539 #size-cells = <0>;
435 compatible = "fsl,imx53-i2c", "fsl,imx1-i2c"; 540 compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
436 reg = <0x53fec000 0x4000>; 541 reg = <0x53fec000 0x4000>;
437 interrupts = <64>; 542 interrupts = <64>;
543 clocks = <&clks 88>;
438 status = "disabled"; 544 status = "disabled";
439 }; 545 };
440 546
@@ -442,6 +548,8 @@
442 compatible = "fsl,imx53-uart", "fsl,imx21-uart"; 548 compatible = "fsl,imx53-uart", "fsl,imx21-uart";
443 reg = <0x53ff0000 0x4000>; 549 reg = <0x53ff0000 0x4000>;
444 interrupts = <13>; 550 interrupts = <13>;
551 clocks = <&clks 65>, <&clks 66>;
552 clock-names = "ipg", "per";
445 status = "disabled"; 553 status = "disabled";
446 }; 554 };
447 }; 555 };
@@ -457,49 +565,59 @@
457 compatible = "fsl,imx53-uart", "fsl,imx21-uart"; 565 compatible = "fsl,imx53-uart", "fsl,imx21-uart";
458 reg = <0x63f90000 0x4000>; 566 reg = <0x63f90000 0x4000>;
459 interrupts = <86>; 567 interrupts = <86>;
568 clocks = <&clks 67>, <&clks 68>;
569 clock-names = "ipg", "per";
460 status = "disabled"; 570 status = "disabled";
461 }; 571 };
462 572
463 ecspi@63fac000 { /* ECSPI2 */ 573 ecspi2: ecspi@63fac000 {
464 #address-cells = <1>; 574 #address-cells = <1>;
465 #size-cells = <0>; 575 #size-cells = <0>;
466 compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi"; 576 compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
467 reg = <0x63fac000 0x4000>; 577 reg = <0x63fac000 0x4000>;
468 interrupts = <37>; 578 interrupts = <37>;
579 clocks = <&clks 53>, <&clks 54>;
580 clock-names = "ipg", "per";
469 status = "disabled"; 581 status = "disabled";
470 }; 582 };
471 583
472 sdma@63fb0000 { 584 sdma: sdma@63fb0000 {
473 compatible = "fsl,imx53-sdma", "fsl,imx35-sdma"; 585 compatible = "fsl,imx53-sdma", "fsl,imx35-sdma";
474 reg = <0x63fb0000 0x4000>; 586 reg = <0x63fb0000 0x4000>;
475 interrupts = <6>; 587 interrupts = <6>;
588 clocks = <&clks 56>, <&clks 56>;
589 clock-names = "ipg", "ahb";
476 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin"; 590 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
477 }; 591 };
478 592
479 cspi@63fc0000 { 593 cspi: cspi@63fc0000 {
480 #address-cells = <1>; 594 #address-cells = <1>;
481 #size-cells = <0>; 595 #size-cells = <0>;
482 compatible = "fsl,imx53-cspi", "fsl,imx35-cspi"; 596 compatible = "fsl,imx53-cspi", "fsl,imx35-cspi";
483 reg = <0x63fc0000 0x4000>; 597 reg = <0x63fc0000 0x4000>;
484 interrupts = <38>; 598 interrupts = <38>;
599 clocks = <&clks 55>, <&clks 0>;
600 clock-names = "ipg", "per";
485 status = "disabled"; 601 status = "disabled";
486 }; 602 };
487 603
488 i2c@63fc4000 { /* I2C2 */ 604 i2c2: i2c@63fc4000 {
489 #address-cells = <1>; 605 #address-cells = <1>;
490 #size-cells = <0>; 606 #size-cells = <0>;
491 compatible = "fsl,imx53-i2c", "fsl,imx1-i2c"; 607 compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
492 reg = <0x63fc4000 0x4000>; 608 reg = <0x63fc4000 0x4000>;
493 interrupts = <63>; 609 interrupts = <63>;
610 clocks = <&clks 35>;
494 status = "disabled"; 611 status = "disabled";
495 }; 612 };
496 613
497 i2c@63fc8000 { /* I2C1 */ 614 i2c1: i2c@63fc8000 {
498 #address-cells = <1>; 615 #address-cells = <1>;
499 #size-cells = <0>; 616 #size-cells = <0>;
500 compatible = "fsl,imx53-i2c", "fsl,imx1-i2c"; 617 compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
501 reg = <0x63fc8000 0x4000>; 618 reg = <0x63fc8000 0x4000>;
502 interrupts = <62>; 619 interrupts = <62>;
620 clocks = <&clks 34>;
503 status = "disabled"; 621 status = "disabled";
504 }; 622 };
505 623
@@ -507,21 +625,23 @@
507 compatible = "fsl,imx53-ssi", "fsl,imx21-ssi"; 625 compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
508 reg = <0x63fcc000 0x4000>; 626 reg = <0x63fcc000 0x4000>;
509 interrupts = <29>; 627 interrupts = <29>;
628 clocks = <&clks 48>;
510 fsl,fifo-depth = <15>; 629 fsl,fifo-depth = <15>;
511 fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */ 630 fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
512 status = "disabled"; 631 status = "disabled";
513 }; 632 };
514 633
515 audmux@63fd0000 { 634 audmux: audmux@63fd0000 {
516 compatible = "fsl,imx53-audmux", "fsl,imx31-audmux"; 635 compatible = "fsl,imx53-audmux", "fsl,imx31-audmux";
517 reg = <0x63fd0000 0x4000>; 636 reg = <0x63fd0000 0x4000>;
518 status = "disabled"; 637 status = "disabled";
519 }; 638 };
520 639
521 nand@63fdb000 { 640 nfc: nand@63fdb000 {
522 compatible = "fsl,imx53-nand"; 641 compatible = "fsl,imx53-nand";
523 reg = <0x63fdb000 0x1000 0xf7ff0000 0x10000>; 642 reg = <0x63fdb000 0x1000 0xf7ff0000 0x10000>;
524 interrupts = <8>; 643 interrupts = <8>;
644 clocks = <&clks 60>;
525 status = "disabled"; 645 status = "disabled";
526 }; 646 };
527 647
@@ -529,15 +649,18 @@
529 compatible = "fsl,imx53-ssi", "fsl,imx21-ssi"; 649 compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
530 reg = <0x63fe8000 0x4000>; 650 reg = <0x63fe8000 0x4000>;
531 interrupts = <96>; 651 interrupts = <96>;
652 clocks = <&clks 50>;
532 fsl,fifo-depth = <15>; 653 fsl,fifo-depth = <15>;
533 fsl,ssi-dma-events = <47 46 45 44>; /* TX0 RX0 TX1 RX1 */ 654 fsl,ssi-dma-events = <47 46 45 44>; /* TX0 RX0 TX1 RX1 */
534 status = "disabled"; 655 status = "disabled";
535 }; 656 };
536 657
537 ethernet@63fec000 { 658 fec: ethernet@63fec000 {
538 compatible = "fsl,imx53-fec", "fsl,imx25-fec"; 659 compatible = "fsl,imx53-fec", "fsl,imx25-fec";
539 reg = <0x63fec000 0x4000>; 660 reg = <0x63fec000 0x4000>;
540 interrupts = <87>; 661 interrupts = <87>;
662 clocks = <&clks 42>, <&clks 42>, <&clks 42>;
663 clock-names = "ipg", "ahb", "ptp";
541 status = "disabled"; 664 status = "disabled";
542 }; 665 };
543 }; 666 };
diff --git a/arch/arm/boot/dts/imx6q-sabreauto.dts b/arch/arm/boot/dts/imx6q-sabreauto.dts
new file mode 100644
index 00000000000..826e4ad1477
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-sabreauto.dts
@@ -0,0 +1,64 @@
1/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/dts-v1/;
14/include/ "imx6q.dtsi"
15
16/ {
17 model = "Freescale i.MX6 Quad SABRE Automotive Board";
18 compatible = "fsl,imx6q-sabreauto", "fsl,imx6q";
19
20 memory {
21 reg = <0x10000000 0x80000000>;
22 };
23
24 soc {
25 aips-bus@02000000 { /* AIPS1 */
26 iomuxc@020e0000 {
27 pinctrl-names = "default";
28 pinctrl-0 = <&pinctrl_hog>;
29
30 hog {
31 pinctrl_hog: hoggrp {
32 fsl,pins = <
33 1376 0x80000000 /* MX6Q_PAD_NANDF_CS2__GPIO_6_15 */
34 13 0x80000000 /* MX6Q_PAD_SD2_DAT2__GPIO_1_13 */
35 >;
36 };
37 };
38 };
39 };
40
41 aips-bus@02100000 { /* AIPS2 */
42 uart4: serial@021f0000 {
43 pinctrl-names = "default";
44 pinctrl-0 = <&pinctrl_uart4_1>;
45 status = "okay";
46 };
47
48 ethernet@02188000 {
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_enet_2>;
51 phy-mode = "rgmii";
52 status = "okay";
53 };
54
55 usdhc@02198000 { /* uSDHC3 */
56 pinctrl-names = "default";
57 pinctrl-0 = <&pinctrl_usdhc3_1>;
58 cd-gpios = <&gpio6 15 0>;
59 wp-gpios = <&gpio1 13 0>;
60 status = "okay";
61 };
62 };
63 };
64};
diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts b/arch/arm/boot/dts/imx6q-sabresd.dts
index e596c28c214..a42402562b7 100644
--- a/arch/arm/boot/dts/imx6q-sabresd.dts
+++ b/arch/arm/boot/dts/imx6q-sabresd.dts
@@ -38,6 +38,8 @@
38 hog { 38 hog {
39 pinctrl_hog: hoggrp { 39 pinctrl_hog: hoggrp {
40 fsl,pins = < 40 fsl,pins = <
41 1004 0x80000000 /* MX6Q_PAD_GPIO_4__GPIO_1_4 */
42 1012 0x80000000 /* MX6Q_PAD_GPIO_5__GPIO_1_5 */
41 1402 0x80000000 /* MX6Q_PAD_NANDF_D0__GPIO_2_0 */ 43 1402 0x80000000 /* MX6Q_PAD_NANDF_D0__GPIO_2_0 */
42 1410 0x80000000 /* MX6Q_PAD_NANDF_D1__GPIO_2_1 */ 44 1410 0x80000000 /* MX6Q_PAD_NANDF_D1__GPIO_2_1 */
43 1418 0x80000000 /* MX6Q_PAD_NANDF_D2__GPIO_2_2 */ 45 1418 0x80000000 /* MX6Q_PAD_NANDF_D2__GPIO_2_2 */
@@ -73,4 +75,20 @@
73 }; 75 };
74 }; 76 };
75 }; 77 };
78
79 gpio-keys {
80 compatible = "gpio-keys";
81
82 volume-up {
83 label = "Volume Up";
84 gpios = <&gpio1 4 0>;
85 linux,code = <115>; /* KEY_VOLUMEUP */
86 };
87
88 volume-down {
89 label = "Volume Down";
90 gpios = <&gpio1 5 0>;
91 linux,code = <114>; /* KEY_VOLUMEDOWN */
92 };
93 };
76}; 94};
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index f3990b04fec..d6265ca9711 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -36,6 +36,14 @@
36 compatible = "arm,cortex-a9"; 36 compatible = "arm,cortex-a9";
37 reg = <0>; 37 reg = <0>;
38 next-level-cache = <&L2>; 38 next-level-cache = <&L2>;
39 operating-points = <
40 /* kHz uV */
41 792000 1100000
42 396000 950000
43 198000 850000
44 >;
45 clock-latency = <61036>; /* two CLK32 periods */
46 cpu0-supply = <&reg_cpu>;
39 }; 47 };
40 48
41 cpu@1 { 49 cpu@1 {
@@ -100,7 +108,7 @@
100 clocks = <&clks 106>; 108 clocks = <&clks 106>;
101 }; 109 };
102 110
103 gpmi-nand@00112000 { 111 nfc: gpmi-nand@00112000 {
104 compatible = "fsl,imx6q-gpmi-nand"; 112 compatible = "fsl,imx6q-gpmi-nand";
105 #address-cells = <1>; 113 #address-cells = <1>;
106 #size-cells = <1>; 114 #size-cells = <1>;
@@ -144,12 +152,12 @@
144 reg = <0x02000000 0x40000>; 152 reg = <0x02000000 0x40000>;
145 ranges; 153 ranges;
146 154
147 spdif@02004000 { 155 spdif: spdif@02004000 {
148 reg = <0x02004000 0x4000>; 156 reg = <0x02004000 0x4000>;
149 interrupts = <0 52 0x04>; 157 interrupts = <0 52 0x04>;
150 }; 158 };
151 159
152 ecspi@02008000 { /* eCSPI1 */ 160 ecspi1: ecspi@02008000 {
153 #address-cells = <1>; 161 #address-cells = <1>;
154 #size-cells = <0>; 162 #size-cells = <0>;
155 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 163 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
@@ -160,7 +168,7 @@
160 status = "disabled"; 168 status = "disabled";
161 }; 169 };
162 170
163 ecspi@0200c000 { /* eCSPI2 */ 171 ecspi2: ecspi@0200c000 {
164 #address-cells = <1>; 172 #address-cells = <1>;
165 #size-cells = <0>; 173 #size-cells = <0>;
166 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 174 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
@@ -171,7 +179,7 @@
171 status = "disabled"; 179 status = "disabled";
172 }; 180 };
173 181
174 ecspi@02010000 { /* eCSPI3 */ 182 ecspi3: ecspi@02010000 {
175 #address-cells = <1>; 183 #address-cells = <1>;
176 #size-cells = <0>; 184 #size-cells = <0>;
177 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 185 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
@@ -182,7 +190,7 @@
182 status = "disabled"; 190 status = "disabled";
183 }; 191 };
184 192
185 ecspi@02014000 { /* eCSPI4 */ 193 ecspi4: ecspi@02014000 {
186 #address-cells = <1>; 194 #address-cells = <1>;
187 #size-cells = <0>; 195 #size-cells = <0>;
188 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 196 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
@@ -193,7 +201,7 @@
193 status = "disabled"; 201 status = "disabled";
194 }; 202 };
195 203
196 ecspi@02018000 { /* eCSPI5 */ 204 ecspi5: ecspi@02018000 {
197 #address-cells = <1>; 205 #address-cells = <1>;
198 #size-cells = <0>; 206 #size-cells = <0>;
199 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 207 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
@@ -213,7 +221,7 @@
213 status = "disabled"; 221 status = "disabled";
214 }; 222 };
215 223
216 esai@02024000 { 224 esai: esai@02024000 {
217 reg = <0x02024000 0x4000>; 225 reg = <0x02024000 0x4000>;
218 interrupts = <0 51 0x04>; 226 interrupts = <0 51 0x04>;
219 }; 227 };
@@ -248,7 +256,7 @@
248 status = "disabled"; 256 status = "disabled";
249 }; 257 };
250 258
251 asrc@02034000 { 259 asrc: asrc@02034000 {
252 reg = <0x02034000 0x4000>; 260 reg = <0x02034000 0x4000>;
253 interrupts = <0 50 0x04>; 261 interrupts = <0 50 0x04>;
254 }; 262 };
@@ -258,7 +266,7 @@
258 }; 266 };
259 }; 267 };
260 268
261 vpu@02040000 { 269 vpu: vpu@02040000 {
262 reg = <0x02040000 0x3c000>; 270 reg = <0x02040000 0x3c000>;
263 interrupts = <0 3 0x04 0 12 0x04>; 271 interrupts = <0 3 0x04 0 12 0x04>;
264 }; 272 };
@@ -267,37 +275,53 @@
267 reg = <0x0207c000 0x4000>; 275 reg = <0x0207c000 0x4000>;
268 }; 276 };
269 277
270 pwm@02080000 { /* PWM1 */ 278 pwm1: pwm@02080000 {
279 #pwm-cells = <2>;
280 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
271 reg = <0x02080000 0x4000>; 281 reg = <0x02080000 0x4000>;
272 interrupts = <0 83 0x04>; 282 interrupts = <0 83 0x04>;
283 clocks = <&clks 62>, <&clks 145>;
284 clock-names = "ipg", "per";
273 }; 285 };
274 286
275 pwm@02084000 { /* PWM2 */ 287 pwm2: pwm@02084000 {
288 #pwm-cells = <2>;
289 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
276 reg = <0x02084000 0x4000>; 290 reg = <0x02084000 0x4000>;
277 interrupts = <0 84 0x04>; 291 interrupts = <0 84 0x04>;
292 clocks = <&clks 62>, <&clks 146>;
293 clock-names = "ipg", "per";
278 }; 294 };
279 295
280 pwm@02088000 { /* PWM3 */ 296 pwm3: pwm@02088000 {
297 #pwm-cells = <2>;
298 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
281 reg = <0x02088000 0x4000>; 299 reg = <0x02088000 0x4000>;
282 interrupts = <0 85 0x04>; 300 interrupts = <0 85 0x04>;
301 clocks = <&clks 62>, <&clks 147>;
302 clock-names = "ipg", "per";
283 }; 303 };
284 304
285 pwm@0208c000 { /* PWM4 */ 305 pwm4: pwm@0208c000 {
306 #pwm-cells = <2>;
307 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
286 reg = <0x0208c000 0x4000>; 308 reg = <0x0208c000 0x4000>;
287 interrupts = <0 86 0x04>; 309 interrupts = <0 86 0x04>;
310 clocks = <&clks 62>, <&clks 148>;
311 clock-names = "ipg", "per";
288 }; 312 };
289 313
290 flexcan@02090000 { /* CAN1 */ 314 can1: flexcan@02090000 {
291 reg = <0x02090000 0x4000>; 315 reg = <0x02090000 0x4000>;
292 interrupts = <0 110 0x04>; 316 interrupts = <0 110 0x04>;
293 }; 317 };
294 318
295 flexcan@02094000 { /* CAN2 */ 319 can2: flexcan@02094000 {
296 reg = <0x02094000 0x4000>; 320 reg = <0x02094000 0x4000>;
297 interrupts = <0 111 0x04>; 321 interrupts = <0 111 0x04>;
298 }; 322 };
299 323
300 gpt@02098000 { 324 gpt: gpt@02098000 {
301 compatible = "fsl,imx6q-gpt"; 325 compatible = "fsl,imx6q-gpt";
302 reg = <0x02098000 0x4000>; 326 reg = <0x02098000 0x4000>;
303 interrupts = <0 55 0x04>; 327 interrupts = <0 55 0x04>;
@@ -373,19 +397,19 @@
373 #interrupt-cells = <2>; 397 #interrupt-cells = <2>;
374 }; 398 };
375 399
376 kpp@020b8000 { 400 kpp: kpp@020b8000 {
377 reg = <0x020b8000 0x4000>; 401 reg = <0x020b8000 0x4000>;
378 interrupts = <0 82 0x04>; 402 interrupts = <0 82 0x04>;
379 }; 403 };
380 404
381 wdog@020bc000 { /* WDOG1 */ 405 wdog1: wdog@020bc000 {
382 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt"; 406 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
383 reg = <0x020bc000 0x4000>; 407 reg = <0x020bc000 0x4000>;
384 interrupts = <0 80 0x04>; 408 interrupts = <0 80 0x04>;
385 clocks = <&clks 0>; 409 clocks = <&clks 0>;
386 }; 410 };
387 411
388 wdog@020c0000 { /* WDOG2 */ 412 wdog2: wdog@020c0000 {
389 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt"; 413 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
390 reg = <0x020c0000 0x4000>; 414 reg = <0x020c0000 0x4000>;
391 interrupts = <0 81 0x04>; 415 interrupts = <0 81 0x04>;
@@ -447,7 +471,7 @@
447 anatop-max-voltage = <2750000>; 471 anatop-max-voltage = <2750000>;
448 }; 472 };
449 473
450 regulator-vddcore@140 { 474 reg_cpu: regulator-vddcore@140 {
451 compatible = "fsl,anatop-regulator"; 475 compatible = "fsl,anatop-regulator";
452 regulator-name = "cpu"; 476 regulator-name = "cpu";
453 regulator-min-microvolt = <725000>; 477 regulator-min-microvolt = <725000>;
@@ -505,27 +529,35 @@
505 }; 529 };
506 530
507 snvs@020cc000 { 531 snvs@020cc000 {
508 reg = <0x020cc000 0x4000>; 532 compatible = "fsl,sec-v4.0-mon", "simple-bus";
509 interrupts = <0 19 0x04 0 20 0x04>; 533 #address-cells = <1>;
534 #size-cells = <1>;
535 ranges = <0 0x020cc000 0x4000>;
536
537 snvs-rtc-lp@34 {
538 compatible = "fsl,sec-v4.0-mon-rtc-lp";
539 reg = <0x34 0x58>;
540 interrupts = <0 19 0x04 0 20 0x04>;
541 };
510 }; 542 };
511 543
512 epit@020d0000 { /* EPIT1 */ 544 epit1: epit@020d0000 { /* EPIT1 */
513 reg = <0x020d0000 0x4000>; 545 reg = <0x020d0000 0x4000>;
514 interrupts = <0 56 0x04>; 546 interrupts = <0 56 0x04>;
515 }; 547 };
516 548
517 epit@020d4000 { /* EPIT2 */ 549 epit2: epit@020d4000 { /* EPIT2 */
518 reg = <0x020d4000 0x4000>; 550 reg = <0x020d4000 0x4000>;
519 interrupts = <0 57 0x04>; 551 interrupts = <0 57 0x04>;
520 }; 552 };
521 553
522 src@020d8000 { 554 src: src@020d8000 {
523 compatible = "fsl,imx6q-src"; 555 compatible = "fsl,imx6q-src";
524 reg = <0x020d8000 0x4000>; 556 reg = <0x020d8000 0x4000>;
525 interrupts = <0 91 0x04 0 96 0x04>; 557 interrupts = <0 91 0x04 0 96 0x04>;
526 }; 558 };
527 559
528 gpc@020dc000 { 560 gpc: gpc@020dc000 {
529 compatible = "fsl,imx6q-gpc"; 561 compatible = "fsl,imx6q-gpc";
530 reg = <0x020dc000 0x4000>; 562 reg = <0x020dc000 0x4000>;
531 interrupts = <0 89 0x04 0 90 0x04>; 563 interrupts = <0 89 0x04 0 90 0x04>;
@@ -536,7 +568,7 @@
536 reg = <0x020e0000 0x38>; 568 reg = <0x020e0000 0x38>;
537 }; 569 };
538 570
539 iomuxc@020e0000 { 571 iomuxc: iomuxc@020e0000 {
540 compatible = "fsl,imx6q-iomuxc"; 572 compatible = "fsl,imx6q-iomuxc";
541 reg = <0x020e0000 0x4000>; 573 reg = <0x020e0000 0x4000>;
542 574
@@ -580,6 +612,7 @@
580 66 0x1b0b0 /* MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2 */ 612 66 0x1b0b0 /* MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2 */
581 70 0x1b0b0 /* MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3 */ 613 70 0x1b0b0 /* MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3 */
582 48 0x1b0b0 /* MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL */ 614 48 0x1b0b0 /* MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL */
615 1033 0x4001b0a8 /* MX6Q_PAD_GPIO_16__ENET_ANATOP_ETHERNET_REF_OUT*/
583 >; 616 >;
584 }; 617 };
585 618
@@ -748,17 +781,17 @@
748 }; 781 };
749 }; 782 };
750 783
751 dcic@020e4000 { /* DCIC1 */ 784 dcic1: dcic@020e4000 {
752 reg = <0x020e4000 0x4000>; 785 reg = <0x020e4000 0x4000>;
753 interrupts = <0 124 0x04>; 786 interrupts = <0 124 0x04>;
754 }; 787 };
755 788
756 dcic@020e8000 { /* DCIC2 */ 789 dcic2: dcic@020e8000 {
757 reg = <0x020e8000 0x4000>; 790 reg = <0x020e8000 0x4000>;
758 interrupts = <0 125 0x04>; 791 interrupts = <0 125 0x04>;
759 }; 792 };
760 793
761 sdma@020ec000 { 794 sdma: sdma@020ec000 {
762 compatible = "fsl,imx6q-sdma", "fsl,imx35-sdma"; 795 compatible = "fsl,imx6q-sdma", "fsl,imx35-sdma";
763 reg = <0x020ec000 0x4000>; 796 reg = <0x020ec000 0x4000>;
764 interrupts = <0 2 0x04>; 797 interrupts = <0 2 0x04>;
@@ -784,7 +817,7 @@
784 reg = <0x0217c000 0x4000>; 817 reg = <0x0217c000 0x4000>;
785 }; 818 };
786 819
787 usb@02184000 { /* USB OTG */ 820 usbotg: usb@02184000 {
788 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 821 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
789 reg = <0x02184000 0x200>; 822 reg = <0x02184000 0x200>;
790 interrupts = <0 43 0x04>; 823 interrupts = <0 43 0x04>;
@@ -794,7 +827,7 @@
794 status = "disabled"; 827 status = "disabled";
795 }; 828 };
796 829
797 usb@02184200 { /* USB1 */ 830 usbh1: usb@02184200 {
798 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 831 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
799 reg = <0x02184200 0x200>; 832 reg = <0x02184200 0x200>;
800 interrupts = <0 40 0x04>; 833 interrupts = <0 40 0x04>;
@@ -804,7 +837,7 @@
804 status = "disabled"; 837 status = "disabled";
805 }; 838 };
806 839
807 usb@02184400 { /* USB2 */ 840 usbh2: usb@02184400 {
808 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 841 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
809 reg = <0x02184400 0x200>; 842 reg = <0x02184400 0x200>;
810 interrupts = <0 41 0x04>; 843 interrupts = <0 41 0x04>;
@@ -813,7 +846,7 @@
813 status = "disabled"; 846 status = "disabled";
814 }; 847 };
815 848
816 usb@02184600 { /* USB3 */ 849 usbh3: usb@02184600 {
817 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 850 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
818 reg = <0x02184600 0x200>; 851 reg = <0x02184600 0x200>;
819 interrupts = <0 42 0x04>; 852 interrupts = <0 42 0x04>;
@@ -822,19 +855,19 @@
822 status = "disabled"; 855 status = "disabled";
823 }; 856 };
824 857
825 usbmisc: usbmisc@02184800 { 858 usbmisc: usbmisc: usbmisc@02184800 {
826 #index-cells = <1>; 859 #index-cells = <1>;
827 compatible = "fsl,imx6q-usbmisc"; 860 compatible = "fsl,imx6q-usbmisc";
828 reg = <0x02184800 0x200>; 861 reg = <0x02184800 0x200>;
829 clocks = <&clks 162>; 862 clocks = <&clks 162>;
830 }; 863 };
831 864
832 ethernet@02188000 { 865 fec: ethernet@02188000 {
833 compatible = "fsl,imx6q-fec"; 866 compatible = "fsl,imx6q-fec";
834 reg = <0x02188000 0x4000>; 867 reg = <0x02188000 0x4000>;
835 interrupts = <0 118 0x04 0 119 0x04>; 868 interrupts = <0 118 0x04 0 119 0x04>;
836 clocks = <&clks 117>, <&clks 117>; 869 clocks = <&clks 117>, <&clks 117>, <&clks 177>;
837 clock-names = "ipg", "ahb"; 870 clock-names = "ipg", "ahb", "ptp";
838 status = "disabled"; 871 status = "disabled";
839 }; 872 };
840 873
@@ -843,66 +876,70 @@
843 interrupts = <0 53 0x04 0 117 0x04 0 126 0x04>; 876 interrupts = <0 53 0x04 0 117 0x04 0 126 0x04>;
844 }; 877 };
845 878
846 usdhc@02190000 { /* uSDHC1 */ 879 usdhc1: usdhc@02190000 {
847 compatible = "fsl,imx6q-usdhc"; 880 compatible = "fsl,imx6q-usdhc";
848 reg = <0x02190000 0x4000>; 881 reg = <0x02190000 0x4000>;
849 interrupts = <0 22 0x04>; 882 interrupts = <0 22 0x04>;
850 clocks = <&clks 163>, <&clks 163>, <&clks 163>; 883 clocks = <&clks 163>, <&clks 163>, <&clks 163>;
851 clock-names = "ipg", "ahb", "per"; 884 clock-names = "ipg", "ahb", "per";
885 bus-width = <4>;
852 status = "disabled"; 886 status = "disabled";
853 }; 887 };
854 888
855 usdhc@02194000 { /* uSDHC2 */ 889 usdhc2: usdhc@02194000 {
856 compatible = "fsl,imx6q-usdhc"; 890 compatible = "fsl,imx6q-usdhc";
857 reg = <0x02194000 0x4000>; 891 reg = <0x02194000 0x4000>;
858 interrupts = <0 23 0x04>; 892 interrupts = <0 23 0x04>;
859 clocks = <&clks 164>, <&clks 164>, <&clks 164>; 893 clocks = <&clks 164>, <&clks 164>, <&clks 164>;
860 clock-names = "ipg", "ahb", "per"; 894 clock-names = "ipg", "ahb", "per";
895 bus-width = <4>;
861 status = "disabled"; 896 status = "disabled";
862 }; 897 };
863 898
864 usdhc@02198000 { /* uSDHC3 */ 899 usdhc3: usdhc@02198000 {
865 compatible = "fsl,imx6q-usdhc"; 900 compatible = "fsl,imx6q-usdhc";
866 reg = <0x02198000 0x4000>; 901 reg = <0x02198000 0x4000>;
867 interrupts = <0 24 0x04>; 902 interrupts = <0 24 0x04>;
868 clocks = <&clks 165>, <&clks 165>, <&clks 165>; 903 clocks = <&clks 165>, <&clks 165>, <&clks 165>;
869 clock-names = "ipg", "ahb", "per"; 904 clock-names = "ipg", "ahb", "per";
905 bus-width = <4>;
870 status = "disabled"; 906 status = "disabled";
871 }; 907 };
872 908
873 usdhc@0219c000 { /* uSDHC4 */ 909 usdhc4: usdhc@0219c000 {
874 compatible = "fsl,imx6q-usdhc"; 910 compatible = "fsl,imx6q-usdhc";
875 reg = <0x0219c000 0x4000>; 911 reg = <0x0219c000 0x4000>;
876 interrupts = <0 25 0x04>; 912 interrupts = <0 25 0x04>;
877 clocks = <&clks 166>, <&clks 166>, <&clks 166>; 913 clocks = <&clks 166>, <&clks 166>, <&clks 166>;
878 clock-names = "ipg", "ahb", "per"; 914 clock-names = "ipg", "ahb", "per";
915 bus-width = <4>;
879 status = "disabled"; 916 status = "disabled";
880 }; 917 };
881 918
882 i2c@021a0000 { /* I2C1 */ 919 i2c1: i2c@021a0000 {
883 #address-cells = <1>; 920 #address-cells = <1>;
884 #size-cells = <0>; 921 #size-cells = <0>;
885 compatible = "fsl,imx6q-i2c", "fsl,imx1-i2c"; 922 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
886 reg = <0x021a0000 0x4000>; 923 reg = <0x021a0000 0x4000>;
887 interrupts = <0 36 0x04>; 924 interrupts = <0 36 0x04>;
888 clocks = <&clks 125>; 925 clocks = <&clks 125>;
889 status = "disabled"; 926 status = "disabled";
890 }; 927 };
891 928
892 i2c@021a4000 { /* I2C2 */ 929 i2c2: i2c@021a4000 {
893 #address-cells = <1>; 930 #address-cells = <1>;
894 #size-cells = <0>; 931 #size-cells = <0>;
895 compatible = "fsl,imx6q-i2c", "fsl,imx1-i2c"; 932 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
896 reg = <0x021a4000 0x4000>; 933 reg = <0x021a4000 0x4000>;
897 interrupts = <0 37 0x04>; 934 interrupts = <0 37 0x04>;
898 clocks = <&clks 126>; 935 clocks = <&clks 126>;
899 status = "disabled"; 936 status = "disabled";
900 }; 937 };
901 938
902 i2c@021a8000 { /* I2C3 */ 939 i2c3: i2c@021a8000 {
903 #address-cells = <1>; 940 #address-cells = <1>;
904 #size-cells = <0>; 941 #size-cells = <0>;
905 compatible = "fsl,imx6q-i2c", "fsl,imx1-i2c"; 942 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
906 reg = <0x021a8000 0x4000>; 943 reg = <0x021a8000 0x4000>;
907 interrupts = <0 38 0x04>; 944 interrupts = <0 38 0x04>;
908 clocks = <&clks 127>; 945 clocks = <&clks 127>;
@@ -913,12 +950,12 @@
913 reg = <0x021ac000 0x4000>; 950 reg = <0x021ac000 0x4000>;
914 }; 951 };
915 952
916 mmdc@021b0000 { /* MMDC0 */ 953 mmdc0: mmdc@021b0000 { /* MMDC0 */
917 compatible = "fsl,imx6q-mmdc"; 954 compatible = "fsl,imx6q-mmdc";
918 reg = <0x021b0000 0x4000>; 955 reg = <0x021b0000 0x4000>;
919 }; 956 };
920 957
921 mmdc@021b4000 { /* MMDC1 */ 958 mmdc1: mmdc@021b4000 { /* MMDC1 */
922 reg = <0x021b4000 0x4000>; 959 reg = <0x021b4000 0x4000>;
923 }; 960 };
924 961
@@ -946,7 +983,7 @@
946 interrupts = <0 109 0x04>; 983 interrupts = <0 109 0x04>;
947 }; 984 };
948 985
949 audmux@021d8000 { 986 audmux: audmux@021d8000 {
950 compatible = "fsl,imx6q-audmux", "fsl,imx31-audmux"; 987 compatible = "fsl,imx6q-audmux", "fsl,imx31-audmux";
951 reg = <0x021d8000 0x4000>; 988 reg = <0x021d8000 0x4000>;
952 status = "disabled"; 989 status = "disabled";
@@ -1001,5 +1038,23 @@
1001 status = "disabled"; 1038 status = "disabled";
1002 }; 1039 };
1003 }; 1040 };
1041
1042 ipu1: ipu@02400000 {
1043 #crtc-cells = <1>;
1044 compatible = "fsl,imx6q-ipu";
1045 reg = <0x02400000 0x400000>;
1046 interrupts = <0 6 0x4 0 5 0x4>;
1047 clocks = <&clks 130>, <&clks 131>, <&clks 132>;
1048 clock-names = "bus", "di0", "di1";
1049 };
1050
1051 ipu2: ipu@02800000 {
1052 #crtc-cells = <1>;
1053 compatible = "fsl,imx6q-ipu";
1054 reg = <0x02800000 0x400000>;
1055 interrupts = <0 8 0x4 0 7 0x4>;
1056 clocks = <&clks 133>, <&clks 134>, <&clks 137>;
1057 clock-names = "bus", "di0", "di1";
1058 };
1004 }; 1059 };
1005}; 1060};
diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts
index 61767757b50..c9c3fa34464 100644
--- a/arch/arm/boot/dts/integratorap.dts
+++ b/arch/arm/boot/dts/integratorap.dts
@@ -18,6 +18,11 @@
18 bootargs = "root=/dev/ram0 console=ttyAM0,38400n8 earlyprintk"; 18 bootargs = "root=/dev/ram0 console=ttyAM0,38400n8 earlyprintk";
19 }; 19 };
20 20
21 syscon {
22 /* AP system controller registers */
23 reg = <0x11000000 0x100>;
24 };
25
21 timer0: timer@13000000 { 26 timer0: timer@13000000 {
22 compatible = "arm,integrator-timer"; 27 compatible = "arm,integrator-timer";
23 }; 28 };
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts
index 2dd5e4e4848..8b119399025 100644
--- a/arch/arm/boot/dts/integratorcp.dts
+++ b/arch/arm/boot/dts/integratorcp.dts
@@ -18,6 +18,11 @@
18 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk"; 18 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk";
19 }; 19 };
20 20
21 cpcon {
22 /* CP controller registers */
23 reg = <0xcb000000 0x100>;
24 };
25
21 timer0: timer@13000000 { 26 timer0: timer@13000000 {
22 compatible = "arm,sp804", "arm,primecell"; 27 compatible = "arm,sp804", "arm,primecell";
23 }; 28 };
diff --git a/arch/arm/boot/dts/kirkwood-6281.dtsi b/arch/arm/boot/dts/kirkwood-6281.dtsi
new file mode 100644
index 00000000000..d6c9d65cbae
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-6281.dtsi
@@ -0,0 +1,44 @@
1/ {
2 ocp@f1000000 {
3 pinctrl: pinctrl@10000 {
4 compatible = "marvell,88f6281-pinctrl";
5 reg = <0x10000 0x20>;
6
7 pmx_nand: pmx-nand {
8 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3",
9 "mpp4", "mpp5", "mpp18",
10 "mpp19";
11 marvell,function = "nand";
12 };
13 pmx_sata0: pmx-sata0 {
14 marvell,pins = "mpp5", "mpp21", "mpp23";
15 marvell,function = "sata0";
16 };
17 pmx_sata1: pmx-sata1 {
18 marvell,pins = "mpp4", "mpp20", "mpp22";
19 marvell,function = "sata1";
20 };
21 pmx_spi: pmx-spi {
22 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3";
23 marvell,function = "spi";
24 };
25 pmx_twsi0: pmx-twsi0 {
26 marvell,pins = "mpp8", "mpp9";
27 marvell,function = "twsi0";
28 };
29 pmx_uart0: pmx-uart0 {
30 marvell,pins = "mpp10", "mpp11";
31 marvell,function = "uart0";
32 };
33 pmx_uart1: pmx-uart1 {
34 marvell,pins = "mpp13", "mpp14";
35 marvell,function = "uart1";
36 };
37 pmx_sdio: pmx-sdio {
38 marvell,pins = "mpp12", "mpp13", "mpp14",
39 "mpp15", "mpp16", "mpp17";
40 marvell,function = "sdio";
41 };
42 };
43 };
44};
diff --git a/arch/arm/boot/dts/kirkwood-6282.dtsi b/arch/arm/boot/dts/kirkwood-6282.dtsi
new file mode 100644
index 00000000000..9ae2004d567
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-6282.dtsi
@@ -0,0 +1,45 @@
1/ {
2 ocp@f1000000 {
3
4 pinctrl: pinctrl@10000 {
5 compatible = "marvell,88f6282-pinctrl";
6 reg = <0x10000 0x20>;
7
8 pmx_sata0: pmx-sata0 {
9 marvell,pins = "mpp5", "mpp21", "mpp23";
10 marvell,function = "sata0";
11 };
12 pmx_sata1: pmx-sata1 {
13 marvell,pins = "mpp4", "mpp20", "mpp22";
14 marvell,function = "sata1";
15 };
16 pmx_spi: pmx-spi {
17 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3";
18 marvell,function = "spi";
19 };
20 pmx_twsi0: pmx-twsi0 {
21 marvell,pins = "mpp8", "mpp9";
22 marvell,function = "twsi0";
23 };
24 pmx_uart0: pmx-uart0 {
25 marvell,pins = "mpp10", "mpp11";
26 marvell,function = "uart0";
27 };
28
29 pmx_uart1: pmx-uart1 {
30 marvell,pins = "mpp13", "mpp14";
31 marvell,function = "uart1";
32 };
33 };
34
35 i2c@11100 {
36 compatible = "marvell,mv64xxx-i2c";
37 reg = <0x11100 0x20>;
38 #address-cells = <1>;
39 #size-cells = <0>;
40 interrupts = <32>;
41 clock-frequency = <100000>;
42 status = "disabled";
43 };
44 };
45};
diff --git a/arch/arm/boot/dts/kirkwood-98dx4122.dtsi b/arch/arm/boot/dts/kirkwood-98dx4122.dtsi
new file mode 100644
index 00000000000..3271e4c8ea0
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-98dx4122.dtsi
@@ -0,0 +1,31 @@
1/ {
2 ocp@f1000000 {
3 pinctrl: pinctrl@10000 {
4 compatible = "marvell,98dx4122-pinctrl";
5 reg = <0x10000 0x20>;
6
7 pmx_nand: pmx-nand {
8 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3",
9 "mpp4", "mpp5", "mpp18",
10 "mpp19";
11 marvell,function = "nand";
12 };
13 pmx_spi: pmx-spi {
14 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3";
15 marvell,function = "spi";
16 };
17 pmx_twsi0: pmx-twsi0 {
18 marvell,pins = "mpp8", "mpp9";
19 marvell,function = "twsi0";
20 };
21 pmx_uart0: pmx-uart0 {
22 marvell,pins = "mpp10", "mpp11";
23 marvell,function = "uart0";
24 };
25 pmx_uart1: pmx-uart1 {
26 marvell,pins = "mpp13", "mpp14";
27 marvell,function = "uart1";
28 };
29 };
30 };
31};
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index 9b32d027282..6875ac00c17 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -1,4 +1,5 @@
1/include/ "kirkwood.dtsi" 1/include/ "kirkwood.dtsi"
2/include/ "kirkwood-6281.dtsi"
2 3
3/ { 4/ {
4 model = "D-Link DNS NASes (kirkwood-based)"; 5 model = "D-Link DNS NASes (kirkwood-based)";
@@ -35,7 +36,116 @@
35 6000 2>; 36 6000 2>;
36 }; 37 };
37 38
39 gpio_poweroff {
40 compatible = "gpio-poweroff";
41 gpios = <&gpio1 4 0>;
42 };
43
38 ocp@f1000000 { 44 ocp@f1000000 {
45 pinctrl: pinctrl@10000 {
46
47 pinctrl-0 = < &pmx_nand &pmx_uart1
48 &pmx_sata0 &pmx_sata1
49 &pmx_led_power
50 &pmx_led_red_right_hdd
51 &pmx_led_red_left_hdd
52 &pmx_led_red_usb_325
53 &pmx_button_power
54 &pmx_led_red_usb_320
55 &pmx_power_off &pmx_power_back_on
56 &pmx_power_sata0 &pmx_power_sata1
57 &pmx_present_sata0 &pmx_present_sata1
58 &pmx_led_white_usb &pmx_fan_tacho
59 &pmx_fan_high_speed &pmx_fan_low_speed
60 &pmx_button_unmount &pmx_button_reset
61 &pmx_temp_alarm >;
62 pinctrl-names = "default";
63
64 pmx_sata0: pmx-sata0 {
65 marvell,pins = "mpp20";
66 marvell,function = "sata1";
67 };
68 pmx_sata1: pmx-sata1 {
69 marvell,pins = "mpp21";
70 marvell,function = "sata0";
71 };
72 pmx_led_power: pmx-led-power {
73 marvell,pins = "mpp26";
74 marvell,function = "gpio";
75 };
76 pmx_led_red_right_hdd: pmx-led-red-right-hdd {
77 marvell,pins = "mpp27";
78 marvell,function = "gpio";
79 };
80 pmx_led_red_left_hdd: pmx-led-red-left-hdd {
81 marvell,pins = "mpp28";
82 marvell,function = "gpio";
83 };
84 pmx_led_red_usb_325: pmx-led-red-usb-325 {
85 marvell,pins = "mpp29";
86 marvell,function = "gpio";
87 };
88 pmx_button_power: pmx-button-power {
89 marvell,pins = "mpp34";
90 marvell,function = "gpio";
91 };
92 pmx_led_red_usb_320: pmx-led-red-usb-320 {
93 marvell,pins = "mpp35";
94 marvell,function = "gpio";
95 };
96 pmx_power_off: pmx-power-off {
97 marvell,pins = "mpp36";
98 marvell,function = "gpio";
99 };
100 pmx_power_back_on: pmx-power-back-on {
101 marvell,pins = "mpp37";
102 marvell,function = "gpio";
103 };
104 pmx_power_sata0: pmx-power-sata0 {
105 marvell,pins = "mpp39";
106 marvell,function = "gpio";
107 };
108 pmx_power_sata1: pmx-power-sata1 {
109 marvell,pins = "mpp40";
110 marvell,function = "gpio";
111 };
112 pmx_present_sata0: pmx-present-sata0 {
113 marvell,pins = "mpp41";
114 marvell,function = "gpio";
115 };
116 pmx_present_sata1: pmx-present-sata1 {
117 marvell,pins = "mpp42";
118 marvell,function = "gpio";
119 };
120 pmx_led_white_usb: pmx-led-white-usb {
121 marvell,pins = "mpp43";
122 marvell,function = "gpio";
123 };
124 pmx_fan_tacho: pmx-fan-tacho {
125 marvell,pins = "mpp44";
126 marvell,function = "gpio";
127 };
128 pmx_fan_high_speed: pmx-fan-high-speed {
129 marvell,pins = "mpp45";
130 marvell,function = "gpio";
131 };
132 pmx_fan_low_speed: pmx-fan-low-speed {
133 marvell,pins = "mpp46";
134 marvell,function = "gpio";
135 };
136 pmx_button_unmount: pmx-button-unmount {
137 marvell,pins = "mpp47";
138 marvell,function = "gpio";
139 };
140 pmx_button_reset: pmx-button-reset {
141 marvell,pins = "mpp48";
142 marvell,function = "gpio";
143 };
144 pmx_temp_alarm: pmx-temp-alarm {
145 marvell,pins = "mpp49";
146 marvell,function = "gpio";
147 };
148 };
39 sata@80000 { 149 sata@80000 {
40 status = "okay"; 150 status = "okay";
41 nr-ports = <2>; 151 nr-ports = <2>;
@@ -43,6 +153,7 @@
43 153
44 nand@3000000 { 154 nand@3000000 {
45 status = "okay"; 155 status = "okay";
156 chip-delay = <35>;
46 157
47 partition@0 { 158 partition@0 {
48 label = "u-boot"; 159 label = "u-boot";
@@ -76,4 +187,33 @@
76 }; 187 };
77 }; 188 };
78 }; 189 };
190
191 regulators {
192 compatible = "simple-bus";
193 #address-cells = <1>;
194 #size-cells = <0>;
195
196 sata0_power: regulator@1 {
197 compatible = "regulator-fixed";
198 reg = <1>;
199 regulator-name = "SATA0 Power";
200 regulator-min-microvolt = <5000000>;
201 regulator-max-microvolt = <5000000>;
202 enable-active-high;
203 regulator-always-on;
204 regulator-boot-on;
205 gpio = <&gpio1 7 0>;
206 };
207 sata1_power: regulator@2 {
208 compatible = "regulator-fixed";
209 reg = <2>;
210 regulator-name = "SATA1 Power";
211 regulator-min-microvolt = <5000000>;
212 regulator-max-microvolt = <5000000>;
213 enable-active-high;
214 regulator-always-on;
215 regulator-boot-on;
216 gpio = <&gpio1 8 0>;
217 };
218 };
79}; 219};
diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 08a582414b8..2e3dd34e21a 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
6 model = "Seagate FreeAgent Dockstar"; 7 model = "Seagate FreeAgent Dockstar";
@@ -16,6 +17,25 @@
16 }; 17 };
17 18
18 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_usb_power_enable
23 &pmx_led_green &pmx_led_orange >;
24 pinctrl-names = "default";
25
26 pmx_usb_power_enable: pmx-usb-power-enable {
27 marvell,pins = "mpp29";
28 marvell,function = "gpio";
29 };
30 pmx_led_green: pmx-led-green {
31 marvell,pins = "mpp46";
32 marvell,function = "gpio";
33 };
34 pmx_led_orange: pmx-led-orange {
35 marvell,pins = "mpp47";
36 marvell,function = "gpio";
37 };
38 };
19 serial@12000 { 39 serial@12000 {
20 clock-frequency = <200000000>; 40 clock-frequency = <200000000>;
21 status = "ok"; 41 status = "ok";
@@ -54,4 +74,21 @@
54 gpios = <&gpio1 15 1>; 74 gpios = <&gpio1 15 1>;
55 }; 75 };
56 }; 76 };
77 regulators {
78 compatible = "simple-bus";
79 #address-cells = <1>;
80 #size-cells = <0>;
81
82 usb_power: regulator@1 {
83 compatible = "regulator-fixed";
84 reg = <1>;
85 regulator-name = "USB Power";
86 regulator-min-microvolt = <5000000>;
87 regulator-max-microvolt = <5000000>;
88 enable-active-high;
89 regulator-always-on;
90 regulator-boot-on;
91 gpio = <&gpio0 29 0>;
92 };
93 };
57}; 94};
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
index 26e281fbf6b..f2d386c95b0 100644
--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
6 model = "Globalscale Technologies Dreamplug"; 7 model = "Globalscale Technologies Dreamplug";
@@ -16,6 +17,26 @@
16 }; 17 };
17 18
18 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_spi
23 &pmx_led_bluetooth &pmx_led_wifi
24 &pmx_led_wifi_ap >;
25 pinctrl-names = "default";
26
27 pmx_led_bluetooth: pmx-led-bluetooth {
28 marvell,pins = "mpp47";
29 marvell,function = "gpio";
30 };
31 pmx_led_wifi: pmx-led-wifi {
32 marvell,pins = "mpp48";
33 marvell,function = "gpio";
34 };
35 pmx_led_wifi_ap: pmx-led-wifi-ap {
36 marvell,pins = "mpp49";
37 marvell,function = "gpio";
38 };
39 };
19 serial@12000 { 40 serial@12000 {
20 clock-frequency = <200000000>; 41 clock-frequency = <200000000>;
21 status = "ok"; 42 status = "ok";
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index 7c8238fbb6f..1b133e0c566 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
6 model = "Seagate GoFlex Net"; 7 model = "Seagate GoFlex Net";
@@ -16,6 +17,61 @@
16 }; 17 };
17 18
18 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_usb_power_enable &pmx_led_orange
23 &pmx_led_left_cap_0 &pmx_led_left_cap_1
24 &pmx_led_left_cap_2 &pmx_led_left_cap_3
25 &pmx_led_right_cap_0 &pmx_led_right_cap_1
26 &pmx_led_right_cap_2 &pmx_led_right_cap_3
27 >;
28 pinctrl-names = "default";
29
30 pmx_usb_power_enable: pmx-usb-power-enable {
31 marvell,pins = "mpp29";
32 marvell,function = "gpio";
33 };
34 pmx_led_right_cap_0: pmx-led_right_cap_0 {
35 marvell,pins = "mpp38";
36 marvell,function = "gpio";
37 };
38 pmx_led_right_cap_1: pmx-led_right_cap_1 {
39 marvell,pins = "mpp39";
40 marvell,function = "gpio";
41 };
42 pmx_led_right_cap_2: pmx-led_right_cap_2 {
43 marvell,pins = "mpp40";
44 marvell,function = "gpio";
45 };
46 pmx_led_right_cap_3: pmx-led_right_cap_3 {
47 marvell,pins = "mpp41";
48 marvell,function = "gpio";
49 };
50 pmx_led_left_cap_0: pmx-led_left_cap_0 {
51 marvell,pins = "mpp42";
52 marvell,function = "gpio";
53 };
54 pmx_led_left_cap_1: pmx-led_left_cap_1 {
55 marvell,pins = "mpp43";
56 marvell,function = "gpio";
57 };
58 pmx_led_left_cap_2: pmx-led_left_cap_2 {
59 marvell,pins = "mpp44";
60 marvell,function = "gpio";
61 };
62 pmx_led_left_cap_3: pmx-led_left_cap_3 {
63 marvell,pins = "mpp45";
64 marvell,function = "gpio";
65 };
66 pmx_led_green: pmx-led_green {
67 marvell,pins = "mpp46";
68 marvell,function = "gpio";
69 };
70 pmx_led_orange: pmx-led_orange {
71 marvell,pins = "mpp47";
72 marvell,function = "gpio";
73 };
74 };
19 serial@12000 { 75 serial@12000 {
20 clock-frequency = <200000000>; 76 clock-frequency = <200000000>;
21 status = "ok"; 77 status = "ok";
@@ -96,4 +152,21 @@
96 gpios = <&gpio1 9 0>; 152 gpios = <&gpio1 9 0>;
97 }; 153 };
98 }; 154 };
155 regulators {
156 compatible = "simple-bus";
157 #address-cells = <1>;
158 #size-cells = <0>;
159
160 usb_power: regulator@1 {
161 compatible = "regulator-fixed";
162 reg = <1>;
163 regulator-name = "USB Power";
164 regulator-min-microvolt = <5000000>;
165 regulator-max-microvolt = <5000000>;
166 enable-active-high;
167 regulator-always-on;
168 regulator-boot-on;
169 gpio = <&gpio0 29 0>;
170 };
171 };
99}; 172};
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
index 66794ed75ff..71902da33d6 100644
--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
6 model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)"; 7 model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)";
@@ -16,6 +17,39 @@
16 }; 17 };
17 18
18 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_nand
23 &pmx_led_os_red &pmx_power_off
24 &pmx_led_os_green &pmx_led_usb_transfer
25 &pmx_button_reset &pmx_button_usb_copy >;
26 pinctrl-names = "default";
27
28 pmx_led_os_red: pmx-led-os-red {
29 marvell,pins = "mpp22";
30 marvell,function = "gpio";
31 };
32 pmx_power_off: pmx-power-off {
33 marvell,pins = "mpp24";
34 marvell,function = "gpio";
35 };
36 pmx_led_os_green: pmx-led-os-green {
37 marvell,pins = "mpp25";
38 marvell,function = "gpio";
39 };
40 pmx_led_usb_transfer: pmx-led-usb-transfer {
41 marvell,pins = "mpp27";
42 marvell,function = "gpio";
43 };
44 pmx_button_reset: pmx-button-reset {
45 marvell,pins = "mpp28";
46 marvell,function = "gpio";
47 };
48 pmx_button_usb_copy: pmx-button-usb-copy {
49 marvell,pins = "mpp29";
50 marvell,function = "gpio";
51 };
52 };
19 serial@12000 { 53 serial@12000 {
20 clock-frequency = <200000000>; 54 clock-frequency = <200000000>;
21 status = "okay"; 55 status = "okay";
@@ -79,4 +113,10 @@
79 gpios = <&gpio0 27 0>; 113 gpios = <&gpio0 27 0>;
80 }; 114 };
81 }; 115 };
116 gpio_poweroff {
117 compatible = "gpio-poweroff";
118 gpios = <&gpio0 24 0>;
119 };
120
121
82}; 122};
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index d97cd9d4753..504f16be8b5 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
6 model = "Iomega Iconnect"; 7 model = "Iomega Iconnect";
@@ -18,6 +19,56 @@
18 }; 19 };
19 20
20 ocp@f1000000 { 21 ocp@f1000000 {
22 pinctrl: pinctrl@10000 {
23
24 pinctrl-0 = < &pmx_gpio_12 &pmx_gpio_35
25 &pmx_gpio_41 &pmx_gpio_42
26 &pmx_gpio_43 &pmx_gpio_44
27 &pmx_gpio_45 &pmx_gpio_46
28 &pmx_gpio_47 &pmx_gpio_48 >;
29 pinctrl-names = "default";
30
31 pmx_gpio_12: pmx-gpio-12 {
32 marvell,pins = "mpp12";
33 marvell,function = "gpio";
34 };
35 pmx_gpio_35: pmx-gpio-35 {
36 marvell,pins = "mpp35";
37 marvell,function = "gpio";
38 };
39 pmx_gpio_41: pmx-gpio-41 {
40 marvell,pins = "mpp41";
41 marvell,function = "gpio";
42 };
43 pmx_gpio_42: pmx-gpio-42 {
44 marvell,pins = "mpp42";
45 marvell,function = "gpio";
46 };
47 pmx_gpio_43: pmx-gpio-43 {
48 marvell,pins = "mpp43";
49 marvell,function = "gpio";
50 };
51 pmx_gpio_44: pmx-gpio-44 {
52 marvell,pins = "mpp44";
53 marvell,function = "gpio";
54 };
55 pmx_gpio_45: pmx-gpio-45 {
56 marvell,pins = "mpp45";
57 marvell,function = "gpio";
58 };
59 pmx_gpio_46: pmx-gpio-46 {
60 marvell,pins = "mpp46";
61 marvell,function = "gpio";
62 };
63 pmx_gpio_47: pmx-gpio-47 {
64 marvell,pins = "mpp47";
65 marvell,function = "gpio";
66 };
67 pmx_gpio_48: pmx-gpio-48 {
68 marvell,pins = "mpp48";
69 marvell,function = "gpio";
70 };
71 };
21 i2c@11000 { 72 i2c@11000 {
22 status = "okay"; 73 status = "okay";
23 74
diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
index 865aeec40a2..6cae4599c4b 100644
--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
6 model = "Iomega StorCenter ix2-200"; 7 model = "Iomega StorCenter ix2-200";
@@ -16,6 +17,94 @@
16 }; 17 };
17 18
18 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_button_reset &pmx_button_power
23 &pmx_led_backup &pmx_led_power
24 &pmx_button_otb &pmx_led_rebuild
25 &pmx_led_health
26 &pmx_led_sata_brt_ctrl_1
27 &pmx_led_sata_brt_ctrl_2
28 &pmx_led_backup_brt_ctrl_1
29 &pmx_led_backup_brt_ctrl_2
30 &pmx_led_power_brt_ctrl_1
31 &pmx_led_power_brt_ctrl_2
32 &pmx_led_health_brt_ctrl_1
33 &pmx_led_health_brt_ctrl_2
34 &pmx_led_rebuild_brt_ctrl_1
35 &pmx_led_rebuild_brt_ctrl_2 >;
36 pinctrl-names = "default";
37
38 pmx_button_reset: pmx-button-reset {
39 marvell,pins = "mpp12";
40 marvell,function = "gpio";
41 };
42 pmx_button_power: pmx-button-power {
43 marvell,pins = "mpp14";
44 marvell,function = "gpio";
45 };
46 pmx_led_backup: pmx-led-backup {
47 marvell,pins = "mpp15";
48 marvell,function = "gpio";
49 };
50 pmx_led_power: pmx-led-power {
51 marvell,pins = "mpp16";
52 marvell,function = "gpio";
53 };
54 pmx_button_otb: pmx-button-otb {
55 marvell,pins = "mpp35";
56 marvell,function = "gpio";
57 };
58 pmx_led_rebuild: pmx-led-rebuild {
59 marvell,pins = "mpp36";
60 marvell,function = "gpio";
61 };
62 pmx_led_health: pmx-led_health {
63 marvell,pins = "mpp37";
64 marvell,function = "gpio";
65 };
66 pmx_led_sata_brt_ctrl_1: pmx-led-sata-brt-ctrl-1 {
67 marvell,pins = "mpp38";
68 marvell,function = "gpio";
69 };
70 pmx_led_sata_brt_ctrl_2: pmx-led-sata-brt-ctrl-2 {
71 marvell,pins = "mpp39";
72 marvell,function = "gpio";
73 };
74 pmx_led_backup_brt_ctrl_1: pmx-led-backup-brt-ctrl-1 {
75 marvell,pins = "mpp40";
76 marvell,function = "gpio";
77 };
78 pmx_led_backup_brt_ctrl_2: pmx-led-backup-brt-ctrl-2 {
79 marvell,pins = "mpp41";
80 marvell,function = "gpio";
81 };
82 pmx_led_power_brt_ctrl_1: pmx-led-power-brt-ctrl-1 {
83 marvell,pins = "mpp42";
84 marvell,function = "gpio";
85 };
86 pmx_led_power_brt_ctrl_2: pmx-led-power-brt-ctrl-2 {
87 marvell,pins = "mpp43";
88 marvell,function = "gpio";
89 };
90 pmx_led_health_brt_ctrl_1: pmx-led-health-brt-ctrl-1 {
91 marvell,pins = "mpp44";
92 marvell,function = "gpio";
93 };
94 pmx_led_health_brt_ctrl_2: pmx-led-health-brt-ctrl-2 {
95 marvell,pins = "mpp45";
96 marvell,function = "gpio";
97 };
98 pmx_led_rebuild_brt_ctrl_1: pmx-led-rebuild-brt-ctrl-1 {
99 marvell,pins = "mpp44";
100 marvell,function = "gpio";
101 };
102 pmx_led_rebuild_brt_ctrl_2: pmx-led-rebuild-brt-ctrl-2 {
103 marvell,pins = "mpp45";
104 marvell,function = "gpio";
105 };
106
107 };
19 i2c@11000 { 108 i2c@11000 {
20 status = "okay"; 109 status = "okay";
21 110
diff --git a/arch/arm/boot/dts/kirkwood-is2.dts b/arch/arm/boot/dts/kirkwood-is2.dts
new file mode 100644
index 00000000000..0bdce0ad727
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-is2.dts
@@ -0,0 +1,30 @@
1/dts-v1/;
2
3/include/ "kirkwood-ns2-common.dtsi"
4
5/ {
6 model = "LaCie Internet Space v2";
7 compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x8000000>;
12 };
13
14 ocp@f1000000 {
15 sata@80000 {
16 status = "okay";
17 nr-ports = <1>;
18 };
19 };
20
21 ns2-leds {
22 compatible = "lacie,ns2-leds";
23
24 blue-sata {
25 label = "ns2:blue:sata";
26 slow-gpio = <&gpio0 29 0>;
27 cmd-gpio = <&gpio0 30 0>;
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
index 75bdb93fed2..8db3123ac80 100644
--- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-98dx4122.dtsi"
4 5
5/ { 6/ {
6 model = "Keymile Kirkwood Reference Design"; 7 model = "Keymile Kirkwood Reference Design";
@@ -16,6 +17,22 @@
16 }; 17 };
17 18
18 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_nand &pmx_i2c_gpio_sda
23 &pmx_i2c_gpio_scl >;
24 pinctrl-names = "default";
25
26 pmx_i2c_gpio_sda: pmx-gpio-sda {
27 marvell,pins = "mpp8";
28 marvell,function = "gpio";
29 };
30 pmx_i2c_gpio_scl: pmx-gpio-scl {
31 marvell,pins = "mpp9";
32 marvell,function = "gpio";
33 };
34 };
35
19 serial@12000 { 36 serial@12000 {
20 clock-frequency = <200000000>; 37 clock-frequency = <200000000>;
21 status = "ok"; 38 status = "ok";
diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
index 8fea375c734..37d45c4f88f 100644
--- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
@@ -1,4 +1,5 @@
1/include/ "kirkwood.dtsi" 1/include/ "kirkwood.dtsi"
2/include/ "kirkwood-6281.dtsi"
2 3
3/ { 4/ {
4 chosen { 5 chosen {
@@ -6,6 +7,71 @@
6 }; 7 };
7 8
8 ocp@f1000000 { 9 ocp@f1000000 {
10 pinctrl: pinctrl@10000 {
11
12 pinctrl-0 = < &pmx_power_hdd &pmx_usb_vbus
13 &pmx_fan_low &pmx_fan_high
14 &pmx_led_function_red &pmx_led_alarm
15 &pmx_led_info &pmx_led_power
16 &pmx_fan_lock &pmx_button_function
17 &pmx_power_switch &pmx_power_auto_switch
18 &pmx_led_function_blue >;
19 pinctrl-names = "default";
20
21 pmx_power_hdd: pmx-power-hdd {
22 marvell,pins = "mpp10";
23 marvell,function = "gpo";
24 };
25 pmx_usb_vbus: pmx-usb-vbus {
26 marvell,pins = "mpp11";
27 marvell,function = "gpio";
28 };
29 pmx_fan_high: pmx-fan-high {
30 marvell,pins = "mpp18";
31 marvell,function = "gpo";
32 };
33 pmx_fan_low: pmx-fan-low {
34 marvell,pins = "mpp19";
35 marvell,function = "gpo";
36 };
37 pmx_led_function_blue: pmx-led-function-blue {
38 marvell,pins = "mpp36";
39 marvell,function = "gpio";
40 };
41 pmx_led_alarm: pmx-led-alarm {
42 marvell,pins = "mpp37";
43 marvell,function = "gpio";
44 };
45 pmx_led_info: pmx-led-info {
46 marvell,pins = "mpp38";
47 marvell,function = "gpio";
48 };
49 pmx_led_power: pmx-led-power {
50 marvell,pins = "mpp39";
51 marvell,function = "gpio";
52 };
53 pmx_fan_lock: pmx-fan-lock {
54 marvell,pins = "mpp40";
55 marvell,function = "gpio";
56 };
57 pmx_button_function: pmx-button-function {
58 marvell,pins = "mpp41";
59 marvell,function = "gpio";
60 };
61 pmx_power_switch: pmx-power-switch {
62 marvell,pins = "mpp42";
63 marvell,function = "gpio";
64 };
65 pmx_power_auto_switch: pmx-power-auto-switch {
66 marvell,pins = "mpp43";
67 marvell,function = "gpio";
68 };
69 pmx_led_function_red: pmx-led-function_red {
70 marvell,pins = "mpp48";
71 marvell,function = "gpio";
72 };
73
74 };
9 sata@80000 { 75 sata@80000 {
10 status = "okay"; 76 status = "okay";
11 nr-ports = <1>; 77 nr-ports = <1>;
@@ -94,4 +160,44 @@
94 gpios = <&gpio1 16 1>; 160 gpios = <&gpio1 16 1>;
95 }; 161 };
96 }; 162 };
163
164 gpio_fan {
165 compatible = "gpio-fan";
166 gpios = <&gpio0 19 1
167 &gpio0 18 1>;
168 gpio-fan,speed-map = <0 3
169 1500 2
170 3250 1
171 5000 0>;
172 alarm-gpios = <&gpio1 8 0>;
173 };
174
175 regulators {
176 compatible = "simple-bus";
177 #address-cells = <1>;
178 #size-cells = <0>;
179
180 usb_power: regulator@1 {
181 compatible = "regulator-fixed";
182 reg = <1>;
183 regulator-name = "USB Power";
184 regulator-min-microvolt = <5000000>;
185 regulator-max-microvolt = <5000000>;
186 enable-active-high;
187 regulator-always-on;
188 regulator-boot-on;
189 gpio = <&gpio0 11 0>;
190 };
191 hdd_power: regulator@2 {
192 compatible = "regulator-fixed";
193 reg = <2>;
194 regulator-name = "HDD Power";
195 regulator-min-microvolt = <5000000>;
196 regulator-max-microvolt = <5000000>;
197 enable-active-high;
198 regulator-always-on;
199 regulator-boot-on;
200 gpio = <&gpio0 10 0>;
201 };
202 };
97}; 203};
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
new file mode 100644
index 00000000000..262c6540376
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -0,0 +1,178 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
5
6/ {
7 model = "MPL CEC4";
8 compatible = "mpl,cec4-10", "mpl,cec4", "marvell,kirkwood-88f6281", "marvell,kirkwood";
9
10 memory {
11 device_type = "memory";
12 reg = <0x00000000 0x20000000>;
13 };
14
15 chosen {
16 bootargs = "console=ttyS0,115200n8 earlyprintk";
17 };
18
19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_nand &pmx_uart0
23 &pmx_led_health &pmx_sdio
24 &pmx_sata0 &pmx_sata1
25 &pmx_led_user1o
26 &pmx_led_user1g &pmx_led_user0o
27 &pmx_led_user0g &pmx_led_misc
28 &pmx_sdio_cd
29 >;
30 pinctrl-names = "default";
31
32 pmx_led_health: pmx-led-health {
33 marvell,pins = "mpp7";
34 marvell,function = "gpo";
35 };
36
37 pmx_sata1: pmx-sata1 {
38 marvell,pins = "mpp34";
39 marvell,function = "sata1";
40 };
41
42 pmx_sata0: pmx-sata0 {
43 marvell,pins = "mpp35";
44 marvell,function = "sata0";
45 };
46
47 pmx_led_user1o: pmx-led-user1o {
48 marvell,pins = "mpp40";
49 marvell,function = "gpio";
50 };
51
52 pmx_led_user1g: pmx-led-user1g {
53 marvell,pins = "mpp41";
54 marvell,function = "gpio";
55 };
56
57 pmx_led_user0o: pmx-led-user0o {
58 marvell,pins = "mpp44";
59 marvell,function = "gpio";
60 };
61
62 pmx_led_user0g: pmx-led-user0g {
63 marvell,pins = "mpp45";
64 marvell,function = "gpio";
65 };
66
67 pmx_led_misc: pmx-led-misc {
68 marvell,pins = "mpp46";
69 marvell,function = "gpio";
70 };
71
72 pmx_sdio_cd: pmx-sdio-cd {
73 marvell,pins = "mpp47";
74 marvell,function = "gpio";
75 };
76 };
77
78 i2c@11000 {
79 status = "okay";
80
81 rtc@51 {
82 compatible = "nxp,pcf8563";
83 reg = <0x51>;
84 };
85
86 eeprom@57 {
87 compatible = "atmel,24c02";
88 reg = <0x57>;
89 };
90
91 };
92
93 serial@12000 {
94 clock-frequency = <200000000>;
95 status = "ok";
96 };
97
98 nand@3000000 {
99 status = "okay";
100
101 partition@0 {
102 label = "uboot";
103 reg = <0x0000000 0x100000>;
104 };
105
106 partition@100000 {
107 label = "env";
108 reg = <0x100000 0x80000>;
109 };
110
111 partition@180000 {
112 label = "fdt";
113 reg = <0x180000 0x80000>;
114 };
115
116 partition@200000 {
117 label = "kernel";
118 reg = <0x200000 0x400000>;
119 };
120
121 partition@600000 {
122 label = "rootfs";
123 reg = <0x600000 0x1fa00000>;
124 };
125 };
126
127 rtc@10300 {
128 status = "disabled";
129 };
130
131 sata@80000 {
132 nr-ports = <2>;
133 status = "okay";
134
135 };
136 };
137
138 gpio-leds {
139 compatible = "gpio-leds";
140
141 health {
142 label = "status:green:health";
143 gpios = <&gpio0 7 1>;
144 };
145
146 user1o {
147 label = "user1:orange";
148 gpios = <&gpio1 8 1>;
149 default-state = "on";
150 };
151
152 user1g {
153 label = "user1:green";
154 gpios = <&gpio1 9 1>;
155 default-state = "on";
156 };
157
158 user0o {
159 label = "user0:orange";
160 gpios = <&gpio1 12 1>;
161 default-state = "on";
162 };
163
164 user0g {
165 label = "user0:green";
166 gpios = <&gpio1 13 1>;
167 default-state = "on";
168 };
169
170 misc {
171 label = "status:orange:misc";
172 gpios = <&gpio1 14 1>;
173 default-state = "on";
174 };
175
176 };
177};
178
diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
new file mode 100644
index 00000000000..9bc6785ad22
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
@@ -0,0 +1,63 @@
1/include/ "kirkwood.dtsi"
2
3/ {
4 chosen {
5 bootargs = "console=ttyS0,115200n8";
6 };
7
8 ocp@f1000000 {
9 serial@12000 {
10 clock-frequency = <166666667>;
11 status = "okay";
12 };
13
14 spi@10600 {
15 status = "okay";
16
17 flash@0 {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "mx25l4005a";
21 reg = <0>;
22 spi-max-frequency = <20000000>;
23 mode = <0>;
24
25 partition@0 {
26 reg = <0x0 0x80000>;
27 label = "u-boot";
28 };
29 };
30 };
31
32 i2c@11000 {
33 status = "okay";
34
35 eeprom@50 {
36 compatible = "at,24c04";
37 pagesize = <16>;
38 reg = <0x50>;
39 };
40 };
41 };
42
43 gpio_keys {
44 compatible = "gpio-keys";
45 #address-cells = <1>;
46 #size-cells = <0>;
47
48 button@1 {
49 label = "Power push button";
50 linux,code = <116>;
51 gpios = <&gpio1 0 0>;
52 };
53 };
54
55 gpio-leds {
56 compatible = "gpio-leds";
57
58 red-fail {
59 label = "ns2:red:fail";
60 gpios = <&gpio0 12 0>;
61 };
62 };
63};
diff --git a/arch/arm/boot/dts/kirkwood-ns2.dts b/arch/arm/boot/dts/kirkwood-ns2.dts
new file mode 100644
index 00000000000..f2d36ecf36d
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ns2.dts
@@ -0,0 +1,30 @@
1/dts-v1/;
2
3/include/ "kirkwood-ns2-common.dtsi"
4
5/ {
6 model = "LaCie Network Space v2";
7 compatible = "lacie,netspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 ocp@f1000000 {
15 sata@80000 {
16 status = "okay";
17 nr-ports = <1>;
18 };
19 };
20
21 ns2-leds {
22 compatible = "lacie,ns2-leds";
23
24 blue-sata {
25 label = "ns2:blue:sata";
26 slow-gpio = <&gpio0 29 0>;
27 cmd-gpio = <&gpio0 30 0>;
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/kirkwood-ns2lite.dts b/arch/arm/boot/dts/kirkwood-ns2lite.dts
new file mode 100644
index 00000000000..b02eb4ea1bb
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ns2lite.dts
@@ -0,0 +1,30 @@
1/dts-v1/;
2
3/include/ "kirkwood-ns2-common.dtsi"
4
5/ {
6 model = "LaCie Network Space Lite v2";
7 compatible = "lacie,netspace_lite_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x8000000>;
12 };
13
14 ocp@f1000000 {
15 sata@80000 {
16 status = "okay";
17 nr-ports = <1>;
18 };
19 };
20
21 gpio-leds {
22 compatible = "gpio-leds";
23
24 blue-sata {
25 label = "ns2:blue:sata";
26 gpios = <&gpio0 30 1>;
27 linux,default-trigger = "default-on";
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/kirkwood-ns2max.dts b/arch/arm/boot/dts/kirkwood-ns2max.dts
new file mode 100644
index 00000000000..bcec4d6cada
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ns2max.dts
@@ -0,0 +1,49 @@
1/dts-v1/;
2
3/include/ "kirkwood-ns2-common.dtsi"
4
5/ {
6 model = "LaCie Network Space Max v2";
7 compatible = "lacie,netspace_max_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 ocp@f1000000 {
15 sata@80000 {
16 status = "okay";
17 nr-ports = <2>;
18 };
19 };
20
21 gpio_fan {
22 compatible = "gpio-fan";
23 gpios = <&gpio0 22 1
24 &gpio0 7 1
25 &gpio1 1 1
26 &gpio0 23 1>;
27 gpio-fan,speed-map =
28 < 0 0
29 1500 15
30 1700 14
31 1800 13
32 2100 12
33 3100 11
34 3300 10
35 4300 9
36 5500 8>;
37 alarm-gpios = <&gpio0 25 1>;
38 };
39
40 ns2-leds {
41 compatible = "lacie,ns2-leds";
42
43 blue-sata {
44 label = "ns2:blue:sata";
45 slow-gpio = <&gpio0 29 0>;
46 cmd-gpio = <&gpio0 30 0>;
47 };
48 };
49};
diff --git a/arch/arm/boot/dts/kirkwood-ns2mini.dts b/arch/arm/boot/dts/kirkwood-ns2mini.dts
new file mode 100644
index 00000000000..b79f5eb2558
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
@@ -0,0 +1,49 @@
1/dts-v1/;
2
3/include/ "kirkwood-ns2-common.dtsi"
4
5/ {
6 model = "LaCie Network Space Mini v2";
7 compatible = "lacie,netspace_mini_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x8000000>;
12 };
13
14 ocp@f1000000 {
15 sata@80000 {
16 status = "okay";
17 nr-ports = <1>;
18 };
19 };
20
21 gpio_fan {
22 compatible = "gpio-fan";
23 gpios = <&gpio0 22 1
24 &gpio0 7 1
25 &gpio1 1 1
26 &gpio0 23 1>;
27 gpio-fan,speed-map =
28 < 0 0
29 3000 15
30 3180 14
31 4140 13
32 4570 12
33 6760 11
34 7140 10
35 7980 9
36 9200 8>;
37 alarm-gpios = <&gpio0 25 1>;
38 };
39
40 ns2-leds {
41 compatible = "lacie,ns2-leds";
42
43 blue-sata {
44 label = "ns2:blue:sata";
45 slow-gpio = <&gpio0 29 0>;
46 cmd-gpio = <&gpio0 30 0>;
47 };
48 };
49};
diff --git a/arch/arm/boot/dts/kirkwood-nsa310.dts b/arch/arm/boot/dts/kirkwood-nsa310.dts
new file mode 100644
index 00000000000..5509f965954
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-nsa310.dts
@@ -0,0 +1,144 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "ZyXEL NSA310";
7 compatible = "zyxel,nsa310", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200";
16 };
17
18 ocp@f1000000 {
19
20 serial@12000 {
21 clock-frequency = <200000000>;
22 status = "ok";
23 };
24
25 sata@80000 {
26 status = "okay";
27 nr-ports = <2>;
28 };
29
30 i2c@11000 {
31 status = "okay";
32 };
33
34 nand@3000000 {
35 status = "okay";
36 chip-delay = <35>;
37
38 partition@0 {
39 label = "uboot";
40 reg = <0x0000000 0x0100000>;
41 read-only;
42 };
43 partition@100000 {
44 label = "uboot_env";
45 reg = <0x0100000 0x0080000>;
46 };
47 partition@180000 {
48 label = "key_store";
49 reg = <0x0180000 0x0080000>;
50 };
51 partition@200000 {
52 label = "info";
53 reg = <0x0200000 0x0080000>;
54 };
55 partition@280000 {
56 label = "etc";
57 reg = <0x0280000 0x0a00000>;
58 };
59 partition@c80000 {
60 label = "kernel_1";
61 reg = <0x0c80000 0x0a00000>;
62 };
63 partition@1680000 {
64 label = "rootfs1";
65 reg = <0x1680000 0x2fc0000>;
66 };
67 partition@4640000 {
68 label = "kernel_2";
69 reg = <0x4640000 0x0a00000>;
70 };
71 partition@5040000 {
72 label = "rootfs2";
73 reg = <0x5040000 0x2fc0000>;
74 };
75 };
76 };
77
78 gpio_keys {
79 compatible = "gpio-keys";
80 #address-cells = <1>;
81 #size-cells = <0>;
82
83 button@1 {
84 label = "Power Button";
85 linux,code = <116>;
86 gpios = <&gpio1 14 0>;
87 };
88 button@2 {
89 label = "Copy Button";
90 linux,code = <133>;
91 gpios = <&gpio1 5 1>;
92 };
93 button@3 {
94 label = "Reset Button";
95 linux,code = <0x198>;
96 gpios = <&gpio1 4 1>;
97 };
98 };
99
100 gpio-leds {
101 compatible = "gpio-leds";
102
103 green-sys {
104 label = "nsa310:green:sys";
105 gpios = <&gpio0 28 0>;
106 };
107 red-sys {
108 label = "nsa310:red:sys";
109 gpios = <&gpio0 29 0>;
110 };
111 green-hdd {
112 label = "nsa310:green:hdd";
113 gpios = <&gpio1 9 0>;
114 };
115 red-hdd {
116 label = "nsa310:red:hdd";
117 gpios = <&gpio1 10 0>;
118 };
119 green-esata {
120 label = "nsa310:green:esata";
121 gpios = <&gpio0 12 0>;
122 };
123 red-esata {
124 label = "nsa310:red:esata";
125 gpios = <&gpio0 13 0>;
126 };
127 green-usb {
128 label = "nsa310:green:usb";
129 gpios = <&gpio0 15 0>;
130 };
131 red-usb {
132 label = "nsa310:red:usb";
133 gpios = <&gpio0 16 0>;
134 };
135 green-copy {
136 label = "nsa310:green:copy";
137 gpios = <&gpio1 7 0>;
138 };
139 red-copy {
140 label = "nsa310:red:copy";
141 gpios = <&gpio1 8 0>;
142 };
143 };
144};
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
new file mode 100644
index 00000000000..49d3d74d4d3
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
@@ -0,0 +1,98 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6282.dtsi"
5
6/ {
7 model = "Plat'Home OpenBlocksA6";
8 compatible = "plathome,openblocks-a6", "marvell,kirkwood-88f6283", "marvell,kirkwood";
9
10 memory {
11 device_type = "memory";
12 reg = <0x00000000 0x20000000>;
13 };
14
15 chosen {
16 bootargs = "console=ttyS0,115200n8 earlyprintk";
17 };
18
19 ocp@f1000000 {
20 serial@12000 {
21 clock-frequency = <200000000>;
22 status = "ok";
23 };
24
25 serial@12100 {
26 clock-frequency = <200000000>;
27 status = "ok";
28 };
29
30 nand@3000000 {
31 chip-delay = <25>;
32 status = "okay";
33
34 partition@0 {
35 label = "uboot";
36 reg = <0x0 0x90000>;
37 };
38
39 partition@90000 {
40 label = "env";
41 reg = <0x90000 0x44000>;
42 };
43
44 partition@d4000 {
45 label = "test";
46 reg = <0xd4000 0x24000>;
47 };
48
49 partition@f4000 {
50 label = "conf";
51 reg = <0xf4000 0x400000>;
52 };
53
54 partition@4f4000 {
55 label = "linux";
56 reg = <0x4f4000 0x1d20000>;
57 };
58
59 partition@2214000 {
60 label = "user";
61 reg = <0x2214000 0x1dec000>;
62 };
63 };
64
65 sata@80000 {
66 nr-ports = <1>;
67 status = "okay";
68 };
69
70 i2c@11100 {
71 status = "okay";
72
73 s35390a: s35390a@30 {
74 compatible = "s35390a";
75 reg = <0x30>;
76 };
77 };
78 };
79
80 gpio-leds {
81 compatible = "gpio-leds";
82
83 led-red {
84 label = "obsa6:red:stat";
85 gpios = <&gpio1 9 1>;
86 };
87
88 led-green {
89 label = "obsa6:green:stat";
90 gpios = <&gpio1 10 1>;
91 };
92
93 led-yellow {
94 label = "obsa6:yellow:stat";
95 gpios = <&gpio1 11 1>;
96 };
97 };
98};
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
new file mode 100644
index 00000000000..c0de5a7f660
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
@@ -0,0 +1,85 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "Univeral Scientific Industrial Co. Topkick-1281P2";
7 compatible = "usi,topkick-1281P2", "usi,topkick", "marvell,kirkwood-88f6282", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 ocp@f1000000 {
19 serial@12000 {
20 clock-frequency = <200000000>;
21 status = "ok";
22 };
23
24 nand@3000000 {
25 status = "okay";
26
27 partition@0 {
28 label = "u-boot";
29 reg = <0x0000000 0x180000>;
30 };
31
32 partition@180000 {
33 label = "u-boot env";
34 reg = <0x0180000 0x20000>;
35 };
36
37 partition@200000 {
38 label = "uImage";
39 reg = <0x0200000 0x600000>;
40 };
41
42 partition@800000 {
43 label = "uInitrd";
44 reg = <0x0800000 0x1000000>;
45 };
46
47 partition@1800000 {
48 label = "rootfs";
49 reg = <0x1800000 0xe800000>;
50 };
51 };
52
53 sata@80000 {
54 status = "okay";
55 nr-ports = <1>;
56 };
57 };
58
59 gpio-leds {
60 compatible = "gpio-leds";
61
62 disk {
63 label = "topkick:yellow:disk";
64 gpios = <&gpio0 21 1>;
65 linux,default-trigger = "ide-disk";
66 };
67 system2 {
68 label = "topkick:red:system";
69 gpios = <&gpio1 5 1>;
70 };
71 system {
72 label = "topkick:blue:system";
73 gpios = <&gpio1 6 1>;
74 default-state = "on";
75 };
76 wifi {
77 label = "topkick:green:wifi";
78 gpios = <&gpio1 7 1>;
79 };
80 wifi2 {
81 label = "topkick:yellow:wifi";
82 gpios = <&gpio1 16 1>;
83 };
84 };
85};
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
index ccbf3275780..8295c833887 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6281.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -1,8 +1,39 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood-ts219.dtsi" 3/include/ "kirkwood-ts219.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
7 ocp@f1000000 {
8 pinctrl: pinctrl@10000 {
9
10 pinctrl-0 = < &pmx_uart0 &pmx_uart1 &pmx_spi
11 &pmx_twsi0 &pmx_sata0 &pmx_sata1
12 &pmx_ram_size &pmx_reset_button
13 &pmx_USB_copy_button &pmx_board_id>;
14 pinctrl-names = "default";
15
16 pmx_ram_size: pmx-ram-size {
17 /* RAM: 0: 256 MB, 1: 512 MB */
18 marvell,pins = "mpp36";
19 marvell,function = "gpio";
20 };
21 pmx_USB_copy_button: pmx-USB-copy-button {
22 marvell,pins = "mpp15";
23 marvell,function = "gpio";
24 };
25 pmx_reset_button: pmx-reset-button {
26 marvell,pins = "mpp16";
27 marvell,function = "gpio";
28 };
29 pmx_board_id: pmx-board-id {
30 /* 0: TS-11x, 1: TS-21x */
31 marvell,pins = "mpp44";
32 marvell,function = "gpio";
33 };
34 };
35 };
36
6 gpio_keys { 37 gpio_keys {
7 compatible = "gpio-keys"; 38 compatible = "gpio-keys";
8 #address-cells = <1>; 39 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
index fbe9932161a..df3f95dfba3 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -1,8 +1,39 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood-ts219.dtsi" 3/include/ "kirkwood-ts219.dtsi"
4/include/ "kirkwood-6282.dtsi"
4 5
5/ { 6/ {
7 ocp@f1000000 {
8 pinctrl: pinctrl@10000 {
9
10 pinctrl-0 = < &pmx_uart0 &pmx_uart1 &pmx_spi
11 &pmx_twsi0 &pmx_sata0 &pmx_sata1
12 &pmx_ram_size &pmx_reset_button
13 &pmx_USB_copy_button &pmx_board_id>;
14 pinctrl-names = "default";
15
16 pmx_ram_size: pmx-ram-size {
17 /* RAM: 0: 256 MB, 1: 512 MB */
18 marvell,pins = "mpp36";
19 marvell,function = "gpio";
20 };
21 pmx_reset_button: pmx-reset-button {
22 marvell,pins = "mpp37";
23 marvell,function = "gpio";
24 };
25 pmx_USB_copy_button: pmx-USB-copy-button {
26 marvell,pins = "mpp43";
27 marvell,function = "gpio";
28 };
29 pmx_board_id: pmx-board-id {
30 /* 0: TS-11x, 1: TS-21x */
31 marvell,pins = "mpp44";
32 marvell,function = "gpio";
33 };
34 };
35 };
36
6 gpio_keys { 37 gpio_keys {
7 compatible = "gpio-keys"; 38 compatible = "gpio-keys";
8 #address-cells = <1>; 39 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 4e5b8154a5b..a990c30f0a2 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -4,6 +4,10 @@
4 compatible = "marvell,kirkwood"; 4 compatible = "marvell,kirkwood";
5 interrupt-parent = <&intc>; 5 interrupt-parent = <&intc>;
6 6
7 aliases {
8 gpio0 = &gpio0;
9 gpio1 = &gpio1;
10 };
7 intc: interrupt-controller { 11 intc: interrupt-controller {
8 compatible = "marvell,orion-intc", "marvell,intc"; 12 compatible = "marvell,orion-intc", "marvell,intc";
9 interrupt-controller; 13 interrupt-controller;
@@ -24,7 +28,8 @@
24 #gpio-cells = <2>; 28 #gpio-cells = <2>;
25 gpio-controller; 29 gpio-controller;
26 reg = <0x10100 0x40>; 30 reg = <0x10100 0x40>;
27 ngpio = <32>; 31 ngpios = <32>;
32 interrupt-controller;
28 interrupts = <35>, <36>, <37>, <38>; 33 interrupts = <35>, <36>, <37>, <38>;
29 }; 34 };
30 35
@@ -33,7 +38,8 @@
33 #gpio-cells = <2>; 38 #gpio-cells = <2>;
34 gpio-controller; 39 gpio-controller;
35 reg = <0x10140 0x40>; 40 reg = <0x10140 0x40>;
36 ngpio = <18>; 41 ngpios = <18>;
42 interrupt-controller;
37 interrupts = <39>, <40>, <41>; 43 interrupts = <39>, <40>, <41>;
38 }; 44 };
39 45
@@ -77,6 +83,13 @@
77 status = "okay"; 83 status = "okay";
78 }; 84 };
79 85
86 ehci@50000 {
87 compatible = "marvell,orion-ehci";
88 reg = <0x50000 0x1000>;
89 interrupts = <19>;
90 status = "okay";
91 };
92
80 sata@80000 { 93 sata@80000 {
81 compatible = "marvell,orion-sata"; 94 compatible = "marvell,orion-sata";
82 reg = <0x80000 0x5000>; 95 reg = <0x80000 0x5000>;
diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
index e5ffe960dbf..1582f484a86 100644
--- a/arch/arm/boot/dts/lpc32xx.dtsi
+++ b/arch/arm/boot/dts/lpc32xx.dtsi
@@ -182,6 +182,13 @@
182 pnx,timeout = <0x64>; 182 pnx,timeout = <0x64>;
183 }; 183 };
184 184
185 mpwm: mpwm@400E8000 {
186 compatible = "nxp,lpc3220-motor-pwm";
187 reg = <0x400E8000 0x78>;
188 status = "disabled";
189 #pwm-cells = <2>;
190 };
191
185 i2cusb: i2c@31020300 { 192 i2cusb: i2c@31020300 {
186 compatible = "nxp,pnx-i2c"; 193 compatible = "nxp,pnx-i2c";
187 reg = <0x31020300 0x100>; 194 reg = <0x31020300 0x100>;
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi
index 581cb081cb0..761c4b69b25 100644
--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -12,6 +12,7 @@
12 12
13/ { 13/ {
14 compatible = "ti,omap2430", "ti,omap2420", "ti,omap2"; 14 compatible = "ti,omap2430", "ti,omap2420", "ti,omap2";
15 interrupt-parent = <&intc>;
15 16
16 aliases { 17 aliases {
17 serial0 = &uart1; 18 serial0 = &uart1;
@@ -65,5 +66,90 @@
65 ti,hwmods = "uart3"; 66 ti,hwmods = "uart3";
66 clock-frequency = <48000000>; 67 clock-frequency = <48000000>;
67 }; 68 };
69
70 timer2: timer@4802a000 {
71 compatible = "ti,omap2-timer";
72 reg = <0x4802a000 0x400>;
73 interrupts = <38>;
74 ti,hwmods = "timer2";
75 };
76
77 timer3: timer@48078000 {
78 compatible = "ti,omap2-timer";
79 reg = <0x48078000 0x400>;
80 interrupts = <39>;
81 ti,hwmods = "timer3";
82 };
83
84 timer4: timer@4807a000 {
85 compatible = "ti,omap2-timer";
86 reg = <0x4807a000 0x400>;
87 interrupts = <40>;
88 ti,hwmods = "timer4";
89 };
90
91 timer5: timer@4807c000 {
92 compatible = "ti,omap2-timer";
93 reg = <0x4807c000 0x400>;
94 interrupts = <41>;
95 ti,hwmods = "timer5";
96 ti,timer-dsp;
97 };
98
99 timer6: timer@4807e000 {
100 compatible = "ti,omap2-timer";
101 reg = <0x4807e000 0x400>;
102 interrupts = <42>;
103 ti,hwmods = "timer6";
104 ti,timer-dsp;
105 };
106
107 timer7: timer@48080000 {
108 compatible = "ti,omap2-timer";
109 reg = <0x48080000 0x400>;
110 interrupts = <43>;
111 ti,hwmods = "timer7";
112 ti,timer-dsp;
113 };
114
115 timer8: timer@48082000 {
116 compatible = "ti,omap2-timer";
117 reg = <0x48082000 0x400>;
118 interrupts = <44>;
119 ti,hwmods = "timer8";
120 ti,timer-dsp;
121 };
122
123 timer9: timer@48084000 {
124 compatible = "ti,omap2-timer";
125 reg = <0x48084000 0x400>;
126 interrupts = <45>;
127 ti,hwmods = "timer9";
128 ti,timer-pwm;
129 };
130
131 timer10: timer@48086000 {
132 compatible = "ti,omap2-timer";
133 reg = <0x48086000 0x400>;
134 interrupts = <46>;
135 ti,hwmods = "timer10";
136 ti,timer-pwm;
137 };
138
139 timer11: timer@48088000 {
140 compatible = "ti,omap2-timer";
141 reg = <0x48088000 0x400>;
142 interrupts = <47>;
143 ti,hwmods = "timer11";
144 ti,timer-pwm;
145 };
146
147 timer12: timer@4808a000 {
148 compatible = "ti,omap2-timer";
149 reg = <0x4808a000 0x400>;
150 interrupts = <48>;
151 ti,hwmods = "timer12";
152 ti,timer-pwm;
153 };
68 }; 154 };
69}; 155};
diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
index bfd76b4a0dd..af656090890 100644
--- a/arch/arm/boot/dts/omap2420.dtsi
+++ b/arch/arm/boot/dts/omap2420.dtsi
@@ -14,6 +14,12 @@
14 compatible = "ti,omap2420", "ti,omap2"; 14 compatible = "ti,omap2420", "ti,omap2";
15 15
16 ocp { 16 ocp {
17 counter32k: counter@48004000 {
18 compatible = "ti,omap-counter32k";
19 reg = <0x48004000 0x20>;
20 ti,hwmods = "counter_32k";
21 };
22
17 omap2420_pmx: pinmux@48000030 { 23 omap2420_pmx: pinmux@48000030 {
18 compatible = "ti,omap2420-padconf", "pinctrl-single"; 24 compatible = "ti,omap2420-padconf", "pinctrl-single";
19 reg = <0x48000030 0x0113>; 25 reg = <0x48000030 0x0113>;
@@ -30,7 +36,6 @@
30 interrupts = <59>, /* TX interrupt */ 36 interrupts = <59>, /* TX interrupt */
31 <60>; /* RX interrupt */ 37 <60>; /* RX interrupt */
32 interrupt-names = "tx", "rx"; 38 interrupt-names = "tx", "rx";
33 interrupt-parent = <&intc>;
34 ti,hwmods = "mcbsp1"; 39 ti,hwmods = "mcbsp1";
35 }; 40 };
36 41
@@ -41,8 +46,15 @@
41 interrupts = <62>, /* TX interrupt */ 46 interrupts = <62>, /* TX interrupt */
42 <63>; /* RX interrupt */ 47 <63>; /* RX interrupt */
43 interrupt-names = "tx", "rx"; 48 interrupt-names = "tx", "rx";
44 interrupt-parent = <&intc>;
45 ti,hwmods = "mcbsp2"; 49 ti,hwmods = "mcbsp2";
46 }; 50 };
51
52 timer1: timer@48028000 {
53 compatible = "ti,omap2-timer";
54 reg = <0x48028000 0x400>;
55 interrupts = <37>;
56 ti,hwmods = "timer1";
57 ti,timer-alwon;
58 };
47 }; 59 };
48}; 60};
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 4565d9750f4..c3924457c9b 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -14,6 +14,12 @@
14 compatible = "ti,omap2430", "ti,omap2"; 14 compatible = "ti,omap2430", "ti,omap2";
15 15
16 ocp { 16 ocp {
17 counter32k: counter@49020000 {
18 compatible = "ti,omap-counter32k";
19 reg = <0x49020000 0x20>;
20 ti,hwmods = "counter_32k";
21 };
22
17 omap2430_pmx: pinmux@49002030 { 23 omap2430_pmx: pinmux@49002030 {
18 compatible = "ti,omap2430-padconf", "pinctrl-single"; 24 compatible = "ti,omap2430-padconf", "pinctrl-single";
19 reg = <0x49002030 0x0154>; 25 reg = <0x49002030 0x0154>;
@@ -32,7 +38,6 @@
32 <60>, /* RX interrupt */ 38 <60>, /* RX interrupt */
33 <61>; /* RX overflow interrupt */ 39 <61>; /* RX overflow interrupt */
34 interrupt-names = "common", "tx", "rx", "rx_overflow"; 40 interrupt-names = "common", "tx", "rx", "rx_overflow";
35 interrupt-parent = <&intc>;
36 ti,buffer-size = <128>; 41 ti,buffer-size = <128>;
37 ti,hwmods = "mcbsp1"; 42 ti,hwmods = "mcbsp1";
38 }; 43 };
@@ -45,7 +50,6 @@
45 <62>, /* TX interrupt */ 50 <62>, /* TX interrupt */
46 <63>; /* RX interrupt */ 51 <63>; /* RX interrupt */
47 interrupt-names = "common", "tx", "rx"; 52 interrupt-names = "common", "tx", "rx";
48 interrupt-parent = <&intc>;
49 ti,buffer-size = <128>; 53 ti,buffer-size = <128>;
50 ti,hwmods = "mcbsp2"; 54 ti,hwmods = "mcbsp2";
51 }; 55 };
@@ -58,7 +62,6 @@
58 <89>, /* TX interrupt */ 62 <89>, /* TX interrupt */
59 <90>; /* RX interrupt */ 63 <90>; /* RX interrupt */
60 interrupt-names = "common", "tx", "rx"; 64 interrupt-names = "common", "tx", "rx";
61 interrupt-parent = <&intc>;
62 ti,buffer-size = <128>; 65 ti,buffer-size = <128>;
63 ti,hwmods = "mcbsp3"; 66 ti,hwmods = "mcbsp3";
64 }; 67 };
@@ -71,7 +74,6 @@
71 <54>, /* TX interrupt */ 74 <54>, /* TX interrupt */
72 <55>; /* RX interrupt */ 75 <55>; /* RX interrupt */
73 interrupt-names = "common", "tx", "rx"; 76 interrupt-names = "common", "tx", "rx";
74 interrupt-parent = <&intc>;
75 ti,buffer-size = <128>; 77 ti,buffer-size = <128>;
76 ti,hwmods = "mcbsp4"; 78 ti,hwmods = "mcbsp4";
77 }; 79 };
@@ -84,9 +86,16 @@
84 <81>, /* TX interrupt */ 86 <81>, /* TX interrupt */
85 <82>; /* RX interrupt */ 87 <82>; /* RX interrupt */
86 interrupt-names = "common", "tx", "rx"; 88 interrupt-names = "common", "tx", "rx";
87 interrupt-parent = <&intc>;
88 ti,buffer-size = <128>; 89 ti,buffer-size = <128>;
89 ti,hwmods = "mcbsp5"; 90 ti,hwmods = "mcbsp5";
90 }; 91 };
92
93 timer1: timer@49018000 {
94 compatible = "ti,omap2-timer";
95 reg = <0x49018000 0x400>;
96 interrupts = <37>;
97 ti,hwmods = "timer1";
98 ti,timer-alwon;
99 };
91 }; 100 };
92}; 101};
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index c38cf76df81..3705a81c1fc 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -55,12 +55,6 @@
55 interrupts = <7>; /* SYS_NIRQ cascaded to intc */ 55 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
56 interrupt-parent = <&intc>; 56 interrupt-parent = <&intc>;
57 57
58 vsim: regulator-vsim {
59 compatible = "ti,twl4030-vsim";
60 regulator-min-microvolt = <1800000>;
61 regulator-max-microvolt = <3000000>;
62 };
63
64 twl_audio: audio { 58 twl_audio: audio {
65 compatible = "ti,twl4030-audio"; 59 compatible = "ti,twl4030-audio";
66 codec { 60 codec {
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
new file mode 100644
index 00000000000..f624dc85d44
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -0,0 +1,67 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10/include/ "omap3.dtsi"
11
12/ {
13 model = "TI OMAP3 BeagleBoard";
14 compatible = "ti,omap3-beagle", "ti,omap3";
15
16 memory {
17 device_type = "memory";
18 reg = <0x80000000 0x10000000>; /* 256 MB */
19 };
20
21 leds {
22 compatible = "gpio-leds";
23 pmu_stat {
24 label = "beagleboard::pmu_stat";
25 gpios = <&twl_gpio 19 0>; /* LEDB */
26 };
27
28 heartbeat {
29 label = "beagleboard::usr0";
30 gpios = <&gpio5 22 0>; /* 150 -> D6 LED */
31 linux,default-trigger = "heartbeat";
32 };
33
34 mmc {
35 label = "beagleboard::usr1";
36 gpios = <&gpio5 21 0>; /* 149 -> D7 LED */
37 linux,default-trigger = "mmc0";
38 };
39 };
40
41};
42
43&i2c1 {
44 clock-frequency = <2600000>;
45
46 twl: twl@48 {
47 reg = <0x48>;
48 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
49 interrupt-parent = <&intc>;
50 };
51};
52
53/include/ "twl4030.dtsi"
54
55&mmc1 {
56 vmmc-supply = <&vmmc1>;
57 vmmc_aux-supply = <&vsim>;
58 bus-width = <8>;
59};
60
61&mmc2 {
62 status = "disabled";
63};
64
65&mmc3 {
66 status = "disabled";
67};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 696e929d030..1acc26148ff 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -12,6 +12,7 @@
12 12
13/ { 13/ {
14 compatible = "ti,omap3430", "ti,omap3"; 14 compatible = "ti,omap3430", "ti,omap3";
15 interrupt-parent = <&intc>;
15 16
16 aliases { 17 aliases {
17 serial0 = &uart1; 18 serial0 = &uart1;
@@ -60,6 +61,12 @@
60 ranges; 61 ranges;
61 ti,hwmods = "l3_main"; 62 ti,hwmods = "l3_main";
62 63
64 counter32k: counter@48320000 {
65 compatible = "ti,omap-counter32k";
66 reg = <0x48320000 0x20>;
67 ti,hwmods = "counter_32k";
68 };
69
63 intc: interrupt-controller@48200000 { 70 intc: interrupt-controller@48200000 {
64 compatible = "ti,omap2-intc"; 71 compatible = "ti,omap2-intc";
65 interrupt-controller; 72 interrupt-controller;
@@ -240,7 +247,6 @@
240 <59>, /* TX interrupt */ 247 <59>, /* TX interrupt */
241 <60>; /* RX interrupt */ 248 <60>; /* RX interrupt */
242 interrupt-names = "common", "tx", "rx"; 249 interrupt-names = "common", "tx", "rx";
243 interrupt-parent = <&intc>;
244 ti,buffer-size = <128>; 250 ti,buffer-size = <128>;
245 ti,hwmods = "mcbsp1"; 251 ti,hwmods = "mcbsp1";
246 }; 252 };
@@ -255,7 +261,6 @@
255 <63>, /* RX interrupt */ 261 <63>, /* RX interrupt */
256 <4>; /* Sidetone */ 262 <4>; /* Sidetone */
257 interrupt-names = "common", "tx", "rx", "sidetone"; 263 interrupt-names = "common", "tx", "rx", "sidetone";
258 interrupt-parent = <&intc>;
259 ti,buffer-size = <1280>; 264 ti,buffer-size = <1280>;
260 ti,hwmods = "mcbsp2", "mcbsp2_sidetone"; 265 ti,hwmods = "mcbsp2", "mcbsp2_sidetone";
261 }; 266 };
@@ -270,7 +275,6 @@
270 <90>, /* RX interrupt */ 275 <90>, /* RX interrupt */
271 <5>; /* Sidetone */ 276 <5>; /* Sidetone */
272 interrupt-names = "common", "tx", "rx", "sidetone"; 277 interrupt-names = "common", "tx", "rx", "sidetone";
273 interrupt-parent = <&intc>;
274 ti,buffer-size = <128>; 278 ti,buffer-size = <128>;
275 ti,hwmods = "mcbsp3", "mcbsp3_sidetone"; 279 ti,hwmods = "mcbsp3", "mcbsp3_sidetone";
276 }; 280 };
@@ -283,7 +287,6 @@
283 <54>, /* TX interrupt */ 287 <54>, /* TX interrupt */
284 <55>; /* RX interrupt */ 288 <55>; /* RX interrupt */
285 interrupt-names = "common", "tx", "rx"; 289 interrupt-names = "common", "tx", "rx";
286 interrupt-parent = <&intc>;
287 ti,buffer-size = <128>; 290 ti,buffer-size = <128>;
288 ti,hwmods = "mcbsp4"; 291 ti,hwmods = "mcbsp4";
289 }; 292 };
@@ -296,9 +299,103 @@
296 <81>, /* TX interrupt */ 299 <81>, /* TX interrupt */
297 <82>; /* RX interrupt */ 300 <82>; /* RX interrupt */
298 interrupt-names = "common", "tx", "rx"; 301 interrupt-names = "common", "tx", "rx";
299 interrupt-parent = <&intc>;
300 ti,buffer-size = <128>; 302 ti,buffer-size = <128>;
301 ti,hwmods = "mcbsp5"; 303 ti,hwmods = "mcbsp5";
302 }; 304 };
305
306 timer1: timer@48318000 {
307 compatible = "ti,omap2-timer";
308 reg = <0x48318000 0x400>;
309 interrupts = <37>;
310 ti,hwmods = "timer1";
311 ti,timer-alwon;
312 };
313
314 timer2: timer@49032000 {
315 compatible = "ti,omap2-timer";
316 reg = <0x49032000 0x400>;
317 interrupts = <38>;
318 ti,hwmods = "timer2";
319 };
320
321 timer3: timer@49034000 {
322 compatible = "ti,omap2-timer";
323 reg = <0x49034000 0x400>;
324 interrupts = <39>;
325 ti,hwmods = "timer3";
326 };
327
328 timer4: timer@49036000 {
329 compatible = "ti,omap2-timer";
330 reg = <0x49036000 0x400>;
331 interrupts = <40>;
332 ti,hwmods = "timer4";
333 };
334
335 timer5: timer@49038000 {
336 compatible = "ti,omap2-timer";
337 reg = <0x49038000 0x400>;
338 interrupts = <41>;
339 ti,hwmods = "timer5";
340 ti,timer-dsp;
341 };
342
343 timer6: timer@4903a000 {
344 compatible = "ti,omap2-timer";
345 reg = <0x4903a000 0x400>;
346 interrupts = <42>;
347 ti,hwmods = "timer6";
348 ti,timer-dsp;
349 };
350
351 timer7: timer@4903c000 {
352 compatible = "ti,omap2-timer";
353 reg = <0x4903c000 0x400>;
354 interrupts = <43>;
355 ti,hwmods = "timer7";
356 ti,timer-dsp;
357 };
358
359 timer8: timer@4903e000 {
360 compatible = "ti,omap2-timer";
361 reg = <0x4903e000 0x400>;
362 interrupts = <44>;
363 ti,hwmods = "timer8";
364 ti,timer-pwm;
365 ti,timer-dsp;
366 };
367
368 timer9: timer@49040000 {
369 compatible = "ti,omap2-timer";
370 reg = <0x49040000 0x400>;
371 interrupts = <45>;
372 ti,hwmods = "timer9";
373 ti,timer-pwm;
374 };
375
376 timer10: timer@48086000 {
377 compatible = "ti,omap2-timer";
378 reg = <0x48086000 0x400>;
379 interrupts = <46>;
380 ti,hwmods = "timer10";
381 ti,timer-pwm;
382 };
383
384 timer11: timer@48088000 {
385 compatible = "ti,omap2-timer";
386 reg = <0x48088000 0x400>;
387 interrupts = <47>;
388 ti,hwmods = "timer11";
389 ti,timer-pwm;
390 };
391
392 timer12: timer@48304000 {
393 compatible = "ti,omap2-timer";
394 reg = <0x48304000 0x400>;
395 interrupts = <95>;
396 ti,hwmods = "timer12";
397 ti,timer-alwon;
398 ti,timer-secure;
399 };
303 }; 400 };
304}; 401};
diff --git a/arch/arm/boot/dts/omap4-panda-a4.dts b/arch/arm/boot/dts/omap4-panda-a4.dts
new file mode 100644
index 00000000000..75466d2abfb
--- /dev/null
+++ b/arch/arm/boot/dts/omap4-panda-a4.dts
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/include/ "omap4-panda.dts"
9
10/* Pandaboard Rev A4+ have external pullups on SCL & SDA */
11&dss_hdmi_pins {
12 pinctrl-single,pins = <
13 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
14 0x5c 0x100 /* hdmi_scl.hdmi_scl INPUT | MODE 0 */
15 0x5e 0x100 /* hdmi_sda.hdmi_sda INPUT | MODE 0 */
16 >;
17};
diff --git a/arch/arm/boot/dts/omap4-pandaES.dts b/arch/arm/boot/dts/omap4-panda-es.dts
index d4ba43a48d9..73bc1a67e44 100644
--- a/arch/arm/boot/dts/omap4-pandaES.dts
+++ b/arch/arm/boot/dts/omap4-panda-es.dts
@@ -22,3 +22,12 @@
22 "AFML", "Line In", 22 "AFML", "Line In",
23 "AFMR", "Line In"; 23 "AFMR", "Line In";
24}; 24};
25
26/* PandaboardES has external pullups on SCL & SDA */
27&dss_hdmi_pins {
28 pinctrl-single,pins = <
29 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
30 0x5c 0x100 /* hdmi_scl.hdmi_scl INPUT | MODE 0 */
31 0x5e 0x100 /* hdmi_sda.hdmi_sda INPUT | MODE 0 */
32 >;
33};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index e8f927cbb37..4122efe31cf 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -65,6 +65,8 @@
65 &twl6040_pins 65 &twl6040_pins
66 &mcpdm_pins 66 &mcpdm_pins
67 &mcbsp1_pins 67 &mcbsp1_pins
68 &dss_hdmi_pins
69 &tpd12s015_pins
68 >; 70 >;
69 71
70 twl6040_pins: pinmux_twl6040_pins { 72 twl6040_pins: pinmux_twl6040_pins {
@@ -92,6 +94,22 @@
92 0xc4 0x100 /* abe_mcbsp1_fsx.abe_mcbsp1_fsx INPUT | MODE0 */ 94 0xc4 0x100 /* abe_mcbsp1_fsx.abe_mcbsp1_fsx INPUT | MODE0 */
93 >; 95 >;
94 }; 96 };
97
98 dss_hdmi_pins: pinmux_dss_hdmi_pins {
99 pinctrl-single,pins = <
100 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
101 0x5c 0x118 /* hdmi_scl.hdmi_scl INPUT PULLUP | MODE 0 */
102 0x5e 0x118 /* hdmi_sda.hdmi_sda INPUT PULLUP | MODE 0 */
103 >;
104 };
105
106 tpd12s015_pins: pinmux_tpd12s015_pins {
107 pinctrl-single,pins = <
108 0x22 0x3 /* gpmc_a17.gpio_41 OUTPUT | MODE3 */
109 0x48 0x3 /* gpmc_nbe1.gpio_60 OUTPUT | MODE3 */
110 0x58 0x10b /* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */
111 >;
112 };
95}; 113};
96 114
97&i2c1 { 115&i2c1 {
@@ -184,3 +202,7 @@
184&dmic { 202&dmic {
185 status = "disabled"; 203 status = "disabled";
186}; 204};
205
206&twl_usb_comparator {
207 usb-supply = <&vusb>;
208};
diff --git a/arch/arm/boot/dts/omap4-sdp-es23plus.dts b/arch/arm/boot/dts/omap4-sdp-es23plus.dts
new file mode 100644
index 00000000000..b4a40ffbce3
--- /dev/null
+++ b/arch/arm/boot/dts/omap4-sdp-es23plus.dts
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/include/ "omap4-sdp.dts"
9
10/* SDP boards with 4430 ES2.3+ or 4460 have external pullups on SCL & SDA */
11&dss_hdmi_pins {
12 pinctrl-single,pins = <
13 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
14 0x5c 0x100 /* hdmi_scl.hdmi_scl INPUT | MODE 0 */
15 0x5e 0x100 /* hdmi_sda.hdmi_sda INPUT | MODE 0 */
16 >;
17};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 5b7e04fbff5..43e5258a937 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -124,6 +124,8 @@
124 &dmic_pins 124 &dmic_pins
125 &mcbsp1_pins 125 &mcbsp1_pins
126 &mcbsp2_pins 126 &mcbsp2_pins
127 &dss_hdmi_pins
128 &tpd12s015_pins
127 >; 129 >;
128 130
129 uart2_pins: pinmux_uart2_pins { 131 uart2_pins: pinmux_uart2_pins {
@@ -194,6 +196,22 @@
194 0xbc 0x100 /* abe_mcbsp2_fsx.abe_mcbsp2_fsx INPUT | MODE0 */ 196 0xbc 0x100 /* abe_mcbsp2_fsx.abe_mcbsp2_fsx INPUT | MODE0 */
195 >; 197 >;
196 }; 198 };
199
200 dss_hdmi_pins: pinmux_dss_hdmi_pins {
201 pinctrl-single,pins = <
202 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */
203 0x5c 0x118 /* hdmi_scl.hdmi_scl INPUT PULLUP | MODE 0 */
204 0x5e 0x118 /* hdmi_sda.hdmi_sda INPUT PULLUP | MODE 0 */
205 >;
206 };
207
208 tpd12s015_pins: pinmux_tpd12s015_pins {
209 pinctrl-single,pins = <
210 0x22 0x3 /* gpmc_a17.gpio_41 OUTPUT | MODE3 */
211 0x48 0x3 /* gpmc_nbe1.gpio_60 OUTPUT | MODE3 */
212 0x58 0x10b /* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */
213 >;
214 };
197}; 215};
198 216
199&i2c1 { 217&i2c1 {
@@ -406,3 +424,7 @@
406&mcbsp3 { 424&mcbsp3 {
407 status = "disabled"; 425 status = "disabled";
408}; 426};
427
428&twl_usb_comparator {
429 usb-supply = <&vusb>;
430};
diff --git a/arch/arm/boot/dts/omap4-var_som.dts b/arch/arm/boot/dts/omap4-var-som.dts
index 6601e6af609..6601e6af609 100644
--- a/arch/arm/boot/dts/omap4-var_som.dts
+++ b/arch/arm/boot/dts/omap4-var-som.dts
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 3883f94fdbd..739bb79e410 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -95,6 +95,12 @@
95 ranges; 95 ranges;
96 ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3"; 96 ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
97 97
98 counter32k: counter@4a304000 {
99 compatible = "ti,omap-counter32k";
100 reg = <0x4a304000 0x20>;
101 ti,hwmods = "counter_32k";
102 };
103
98 omap4_pmx_core: pinmux@4a100040 { 104 omap4_pmx_core: pinmux@4a100040 {
99 compatible = "ti,omap4-padconf", "pinctrl-single"; 105 compatible = "ti,omap4-padconf", "pinctrl-single";
100 reg = <0x4a100040 0x0196>; 106 reg = <0x4a100040 0x0196>;
@@ -340,7 +346,6 @@
340 <0x49032000 0x7f>; /* L3 Interconnect */ 346 <0x49032000 0x7f>; /* L3 Interconnect */
341 reg-names = "mpu", "dma"; 347 reg-names = "mpu", "dma";
342 interrupts = <0 112 0x4>; 348 interrupts = <0 112 0x4>;
343 interrupt-parent = <&gic>;
344 ti,hwmods = "mcpdm"; 349 ti,hwmods = "mcpdm";
345 }; 350 };
346 351
@@ -350,7 +355,6 @@
350 <0x4902e000 0x7f>; /* L3 Interconnect */ 355 <0x4902e000 0x7f>; /* L3 Interconnect */
351 reg-names = "mpu", "dma"; 356 reg-names = "mpu", "dma";
352 interrupts = <0 114 0x4>; 357 interrupts = <0 114 0x4>;
353 interrupt-parent = <&gic>;
354 ti,hwmods = "dmic"; 358 ti,hwmods = "dmic";
355 }; 359 };
356 360
@@ -361,7 +365,6 @@
361 reg-names = "mpu", "dma"; 365 reg-names = "mpu", "dma";
362 interrupts = <0 17 0x4>; 366 interrupts = <0 17 0x4>;
363 interrupt-names = "common"; 367 interrupt-names = "common";
364 interrupt-parent = <&gic>;
365 ti,buffer-size = <128>; 368 ti,buffer-size = <128>;
366 ti,hwmods = "mcbsp1"; 369 ti,hwmods = "mcbsp1";
367 }; 370 };
@@ -373,7 +376,6 @@
373 reg-names = "mpu", "dma"; 376 reg-names = "mpu", "dma";
374 interrupts = <0 22 0x4>; 377 interrupts = <0 22 0x4>;
375 interrupt-names = "common"; 378 interrupt-names = "common";
376 interrupt-parent = <&gic>;
377 ti,buffer-size = <128>; 379 ti,buffer-size = <128>;
378 ti,hwmods = "mcbsp2"; 380 ti,hwmods = "mcbsp2";
379 }; 381 };
@@ -385,7 +387,6 @@
385 reg-names = "mpu", "dma"; 387 reg-names = "mpu", "dma";
386 interrupts = <0 23 0x4>; 388 interrupts = <0 23 0x4>;
387 interrupt-names = "common"; 389 interrupt-names = "common";
388 interrupt-parent = <&gic>;
389 ti,buffer-size = <128>; 390 ti,buffer-size = <128>;
390 ti,hwmods = "mcbsp3"; 391 ti,hwmods = "mcbsp3";
391 }; 392 };
@@ -396,7 +397,6 @@
396 reg-names = "mpu"; 397 reg-names = "mpu";
397 interrupts = <0 16 0x4>; 398 interrupts = <0 16 0x4>;
398 interrupt-names = "common"; 399 interrupt-names = "common";
399 interrupt-parent = <&gic>;
400 ti,buffer-size = <128>; 400 ti,buffer-size = <128>;
401 ti,hwmods = "mcbsp4"; 401 ti,hwmods = "mcbsp4";
402 }; 402 };
@@ -431,12 +431,103 @@
431 hw-caps-temp-alert; 431 hw-caps-temp-alert;
432 }; 432 };
433 433
434 ocp2scp { 434 ocp2scp@4a0ad000 {
435 compatible = "ti,omap-ocp2scp"; 435 compatible = "ti,omap-ocp2scp";
436 reg = <0x4a0ad000 0x1f>;
436 #address-cells = <1>; 437 #address-cells = <1>;
437 #size-cells = <1>; 438 #size-cells = <1>;
438 ranges; 439 ranges;
439 ti,hwmods = "ocp2scp_usb_phy"; 440 ti,hwmods = "ocp2scp_usb_phy";
440 }; 441 };
442
443 timer1: timer@4a318000 {
444 compatible = "ti,omap2-timer";
445 reg = <0x4a318000 0x80>;
446 interrupts = <0 37 0x4>;
447 ti,hwmods = "timer1";
448 ti,timer-alwon;
449 };
450
451 timer2: timer@48032000 {
452 compatible = "ti,omap2-timer";
453 reg = <0x48032000 0x80>;
454 interrupts = <0 38 0x4>;
455 ti,hwmods = "timer2";
456 };
457
458 timer3: timer@48034000 {
459 compatible = "ti,omap2-timer";
460 reg = <0x48034000 0x80>;
461 interrupts = <0 39 0x4>;
462 ti,hwmods = "timer3";
463 };
464
465 timer4: timer@48036000 {
466 compatible = "ti,omap2-timer";
467 reg = <0x48036000 0x80>;
468 interrupts = <0 40 0x4>;
469 ti,hwmods = "timer4";
470 };
471
472 timer5: timer@40138000 {
473 compatible = "ti,omap2-timer";
474 reg = <0x40138000 0x80>,
475 <0x49038000 0x80>;
476 interrupts = <0 41 0x4>;
477 ti,hwmods = "timer5";
478 ti,timer-dsp;
479 };
480
481 timer6: timer@4013a000 {
482 compatible = "ti,omap2-timer";
483 reg = <0x4013a000 0x80>,
484 <0x4903a000 0x80>;
485 interrupts = <0 42 0x4>;
486 ti,hwmods = "timer6";
487 ti,timer-dsp;
488 };
489
490 timer7: timer@4013c000 {
491 compatible = "ti,omap2-timer";
492 reg = <0x4013c000 0x80>,
493 <0x4903c000 0x80>;
494 interrupts = <0 43 0x4>;
495 ti,hwmods = "timer7";
496 ti,timer-dsp;
497 };
498
499 timer8: timer@4013e000 {
500 compatible = "ti,omap2-timer";
501 reg = <0x4013e000 0x80>,
502 <0x4903e000 0x80>;
503 interrupts = <0 44 0x4>;
504 ti,hwmods = "timer8";
505 ti,timer-pwm;
506 ti,timer-dsp;
507 };
508
509 timer9: timer@4803e000 {
510 compatible = "ti,omap2-timer";
511 reg = <0x4803e000 0x80>;
512 interrupts = <0 45 0x4>;
513 ti,hwmods = "timer9";
514 ti,timer-pwm;
515 };
516
517 timer10: timer@48086000 {
518 compatible = "ti,omap2-timer";
519 reg = <0x48086000 0x80>;
520 interrupts = <0 46 0x4>;
521 ti,hwmods = "timer10";
522 ti,timer-pwm;
523 };
524
525 timer11: timer@48088000 {
526 compatible = "ti,omap2-timer";
527 reg = <0x48088000 0x80>;
528 interrupts = <0 47 0x4>;
529 ti,hwmods = "timer11";
530 ti,timer-pwm;
531 };
441 }; 532 };
442}; 533};
diff --git a/arch/arm/boot/dts/omap5-evm.dts b/arch/arm/boot/dts/omap5-evm.dts
index c663eba7316..8722c15bbba 100644
--- a/arch/arm/boot/dts/omap5-evm.dts
+++ b/arch/arm/boot/dts/omap5-evm.dts
@@ -8,6 +8,7 @@
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap5.dtsi" 10/include/ "omap5.dtsi"
11/include/ "samsung_k3pe0e000b.dtsi"
11 12
12/ { 13/ {
13 model = "TI OMAP5 EVM board"; 14 model = "TI OMAP5 EVM board";
@@ -15,7 +16,7 @@
15 16
16 memory { 17 memory {
17 device_type = "memory"; 18 device_type = "memory";
18 reg = <0x80000000 0x40000000>; /* 1 GB */ 19 reg = <0x80000000 0x80000000>; /* 2 GB */
19 }; 20 };
20 21
21 vmmcsd_fixed: fixedregulator-mmcsd { 22 vmmcsd_fixed: fixedregulator-mmcsd {
@@ -140,3 +141,13 @@
140&mcbsp3 { 141&mcbsp3 {
141 status = "disabled"; 142 status = "disabled";
142}; 143};
144
145&emif1 {
146 cs1-used;
147 device-handle = <&samsung_K3PE0E000B>;
148};
149
150&emif2 {
151 cs1-used;
152 device-handle = <&samsung_K3PE0E000B>;
153};
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 42c78beb4fd..790bb2a4b34 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -77,6 +77,12 @@
77 ranges; 77 ranges;
78 ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3"; 78 ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
79 79
80 counter32k: counter@4ae04000 {
81 compatible = "ti,omap-counter32k";
82 reg = <0x4ae04000 0x40>;
83 ti,hwmods = "counter_32k";
84 };
85
80 omap5_pmx_core: pinmux@4a002840 { 86 omap5_pmx_core: pinmux@4a002840 {
81 compatible = "ti,omap4-padconf", "pinctrl-single"; 87 compatible = "ti,omap4-padconf", "pinctrl-single";
82 reg = <0x4a002840 0x01b6>; 88 reg = <0x4a002840 0x01b6>;
@@ -104,6 +110,8 @@
104 110
105 gpio1: gpio@4ae10000 { 111 gpio1: gpio@4ae10000 {
106 compatible = "ti,omap4-gpio"; 112 compatible = "ti,omap4-gpio";
113 reg = <0x4ae10000 0x200>;
114 interrupts = <0 29 0x4>;
107 ti,hwmods = "gpio1"; 115 ti,hwmods = "gpio1";
108 gpio-controller; 116 gpio-controller;
109 #gpio-cells = <2>; 117 #gpio-cells = <2>;
@@ -113,6 +121,8 @@
113 121
114 gpio2: gpio@48055000 { 122 gpio2: gpio@48055000 {
115 compatible = "ti,omap4-gpio"; 123 compatible = "ti,omap4-gpio";
124 reg = <0x48055000 0x200>;
125 interrupts = <0 30 0x4>;
116 ti,hwmods = "gpio2"; 126 ti,hwmods = "gpio2";
117 gpio-controller; 127 gpio-controller;
118 #gpio-cells = <2>; 128 #gpio-cells = <2>;
@@ -122,6 +132,8 @@
122 132
123 gpio3: gpio@48057000 { 133 gpio3: gpio@48057000 {
124 compatible = "ti,omap4-gpio"; 134 compatible = "ti,omap4-gpio";
135 reg = <0x48057000 0x200>;
136 interrupts = <0 31 0x4>;
125 ti,hwmods = "gpio3"; 137 ti,hwmods = "gpio3";
126 gpio-controller; 138 gpio-controller;
127 #gpio-cells = <2>; 139 #gpio-cells = <2>;
@@ -131,6 +143,8 @@
131 143
132 gpio4: gpio@48059000 { 144 gpio4: gpio@48059000 {
133 compatible = "ti,omap4-gpio"; 145 compatible = "ti,omap4-gpio";
146 reg = <0x48059000 0x200>;
147 interrupts = <0 32 0x4>;
134 ti,hwmods = "gpio4"; 148 ti,hwmods = "gpio4";
135 gpio-controller; 149 gpio-controller;
136 #gpio-cells = <2>; 150 #gpio-cells = <2>;
@@ -140,6 +154,8 @@
140 154
141 gpio5: gpio@4805b000 { 155 gpio5: gpio@4805b000 {
142 compatible = "ti,omap4-gpio"; 156 compatible = "ti,omap4-gpio";
157 reg = <0x4805b000 0x200>;
158 interrupts = <0 33 0x4>;
143 ti,hwmods = "gpio5"; 159 ti,hwmods = "gpio5";
144 gpio-controller; 160 gpio-controller;
145 #gpio-cells = <2>; 161 #gpio-cells = <2>;
@@ -149,6 +165,8 @@
149 165
150 gpio6: gpio@4805d000 { 166 gpio6: gpio@4805d000 {
151 compatible = "ti,omap4-gpio"; 167 compatible = "ti,omap4-gpio";
168 reg = <0x4805d000 0x200>;
169 interrupts = <0 34 0x4>;
152 ti,hwmods = "gpio6"; 170 ti,hwmods = "gpio6";
153 gpio-controller; 171 gpio-controller;
154 #gpio-cells = <2>; 172 #gpio-cells = <2>;
@@ -158,6 +176,8 @@
158 176
159 gpio7: gpio@48051000 { 177 gpio7: gpio@48051000 {
160 compatible = "ti,omap4-gpio"; 178 compatible = "ti,omap4-gpio";
179 reg = <0x48051000 0x200>;
180 interrupts = <0 35 0x4>;
161 ti,hwmods = "gpio7"; 181 ti,hwmods = "gpio7";
162 gpio-controller; 182 gpio-controller;
163 #gpio-cells = <2>; 183 #gpio-cells = <2>;
@@ -167,6 +187,8 @@
167 187
168 gpio8: gpio@48053000 { 188 gpio8: gpio@48053000 {
169 compatible = "ti,omap4-gpio"; 189 compatible = "ti,omap4-gpio";
190 reg = <0x48053000 0x200>;
191 interrupts = <0 121 0x4>;
170 ti,hwmods = "gpio8"; 192 ti,hwmods = "gpio8";
171 gpio-controller; 193 gpio-controller;
172 #gpio-cells = <2>; 194 #gpio-cells = <2>;
@@ -176,6 +198,8 @@
176 198
177 i2c1: i2c@48070000 { 199 i2c1: i2c@48070000 {
178 compatible = "ti,omap4-i2c"; 200 compatible = "ti,omap4-i2c";
201 reg = <0x48070000 0x100>;
202 interrupts = <0 56 0x4>;
179 #address-cells = <1>; 203 #address-cells = <1>;
180 #size-cells = <0>; 204 #size-cells = <0>;
181 ti,hwmods = "i2c1"; 205 ti,hwmods = "i2c1";
@@ -183,6 +207,8 @@
183 207
184 i2c2: i2c@48072000 { 208 i2c2: i2c@48072000 {
185 compatible = "ti,omap4-i2c"; 209 compatible = "ti,omap4-i2c";
210 reg = <0x48072000 0x100>;
211 interrupts = <0 57 0x4>;
186 #address-cells = <1>; 212 #address-cells = <1>;
187 #size-cells = <0>; 213 #size-cells = <0>;
188 ti,hwmods = "i2c2"; 214 ti,hwmods = "i2c2";
@@ -190,20 +216,26 @@
190 216
191 i2c3: i2c@48060000 { 217 i2c3: i2c@48060000 {
192 compatible = "ti,omap4-i2c"; 218 compatible = "ti,omap4-i2c";
219 reg = <0x48060000 0x100>;
220 interrupts = <0 61 0x4>;
193 #address-cells = <1>; 221 #address-cells = <1>;
194 #size-cells = <0>; 222 #size-cells = <0>;
195 ti,hwmods = "i2c3"; 223 ti,hwmods = "i2c3";
196 }; 224 };
197 225
198 i2c4: i2c@4807A000 { 226 i2c4: i2c@4807a000 {
199 compatible = "ti,omap4-i2c"; 227 compatible = "ti,omap4-i2c";
228 reg = <0x4807a000 0x100>;
229 interrupts = <0 62 0x4>;
200 #address-cells = <1>; 230 #address-cells = <1>;
201 #size-cells = <0>; 231 #size-cells = <0>;
202 ti,hwmods = "i2c4"; 232 ti,hwmods = "i2c4";
203 }; 233 };
204 234
205 i2c5: i2c@4807C000 { 235 i2c5: i2c@4807c000 {
206 compatible = "ti,omap4-i2c"; 236 compatible = "ti,omap4-i2c";
237 reg = <0x4807c000 0x100>;
238 interrupts = <0 60 0x4>;
207 #address-cells = <1>; 239 #address-cells = <1>;
208 #size-cells = <0>; 240 #size-cells = <0>;
209 ti,hwmods = "i2c5"; 241 ti,hwmods = "i2c5";
@@ -211,42 +243,56 @@
211 243
212 uart1: serial@4806a000 { 244 uart1: serial@4806a000 {
213 compatible = "ti,omap4-uart"; 245 compatible = "ti,omap4-uart";
246 reg = <0x4806a000 0x100>;
247 interrupts = <0 72 0x4>;
214 ti,hwmods = "uart1"; 248 ti,hwmods = "uart1";
215 clock-frequency = <48000000>; 249 clock-frequency = <48000000>;
216 }; 250 };
217 251
218 uart2: serial@4806c000 { 252 uart2: serial@4806c000 {
219 compatible = "ti,omap4-uart"; 253 compatible = "ti,omap4-uart";
254 reg = <0x4806c000 0x100>;
255 interrupts = <0 73 0x4>;
220 ti,hwmods = "uart2"; 256 ti,hwmods = "uart2";
221 clock-frequency = <48000000>; 257 clock-frequency = <48000000>;
222 }; 258 };
223 259
224 uart3: serial@48020000 { 260 uart3: serial@48020000 {
225 compatible = "ti,omap4-uart"; 261 compatible = "ti,omap4-uart";
262 reg = <0x48020000 0x100>;
263 interrupts = <0 74 0x4>;
226 ti,hwmods = "uart3"; 264 ti,hwmods = "uart3";
227 clock-frequency = <48000000>; 265 clock-frequency = <48000000>;
228 }; 266 };
229 267
230 uart4: serial@4806e000 { 268 uart4: serial@4806e000 {
231 compatible = "ti,omap4-uart"; 269 compatible = "ti,omap4-uart";
270 reg = <0x4806e000 0x100>;
271 interrupts = <0 70 0x4>;
232 ti,hwmods = "uart4"; 272 ti,hwmods = "uart4";
233 clock-frequency = <48000000>; 273 clock-frequency = <48000000>;
234 }; 274 };
235 275
236 uart5: serial@48066000 { 276 uart5: serial@48066000 {
237 compatible = "ti,omap5-uart"; 277 compatible = "ti,omap4-uart";
278 reg = <0x48066000 0x100>;
279 interrupts = <0 105 0x4>;
238 ti,hwmods = "uart5"; 280 ti,hwmods = "uart5";
239 clock-frequency = <48000000>; 281 clock-frequency = <48000000>;
240 }; 282 };
241 283
242 uart6: serial@48068000 { 284 uart6: serial@48068000 {
243 compatible = "ti,omap6-uart"; 285 compatible = "ti,omap4-uart";
286 reg = <0x48068000 0x100>;
287 interrupts = <0 106 0x4>;
244 ti,hwmods = "uart6"; 288 ti,hwmods = "uart6";
245 clock-frequency = <48000000>; 289 clock-frequency = <48000000>;
246 }; 290 };
247 291
248 mmc1: mmc@4809c000 { 292 mmc1: mmc@4809c000 {
249 compatible = "ti,omap4-hsmmc"; 293 compatible = "ti,omap4-hsmmc";
294 reg = <0x4809c000 0x400>;
295 interrupts = <0 83 0x4>;
250 ti,hwmods = "mmc1"; 296 ti,hwmods = "mmc1";
251 ti,dual-volt; 297 ti,dual-volt;
252 ti,needs-special-reset; 298 ti,needs-special-reset;
@@ -254,24 +300,32 @@
254 300
255 mmc2: mmc@480b4000 { 301 mmc2: mmc@480b4000 {
256 compatible = "ti,omap4-hsmmc"; 302 compatible = "ti,omap4-hsmmc";
303 reg = <0x480b4000 0x400>;
304 interrupts = <0 86 0x4>;
257 ti,hwmods = "mmc2"; 305 ti,hwmods = "mmc2";
258 ti,needs-special-reset; 306 ti,needs-special-reset;
259 }; 307 };
260 308
261 mmc3: mmc@480ad000 { 309 mmc3: mmc@480ad000 {
262 compatible = "ti,omap4-hsmmc"; 310 compatible = "ti,omap4-hsmmc";
311 reg = <0x480ad000 0x400>;
312 interrupts = <0 94 0x4>;
263 ti,hwmods = "mmc3"; 313 ti,hwmods = "mmc3";
264 ti,needs-special-reset; 314 ti,needs-special-reset;
265 }; 315 };
266 316
267 mmc4: mmc@480d1000 { 317 mmc4: mmc@480d1000 {
268 compatible = "ti,omap4-hsmmc"; 318 compatible = "ti,omap4-hsmmc";
319 reg = <0x480d1000 0x400>;
320 interrupts = <0 96 0x4>;
269 ti,hwmods = "mmc4"; 321 ti,hwmods = "mmc4";
270 ti,needs-special-reset; 322 ti,needs-special-reset;
271 }; 323 };
272 324
273 mmc5: mmc@480d5000 { 325 mmc5: mmc@480d5000 {
274 compatible = "ti,omap4-hsmmc"; 326 compatible = "ti,omap4-hsmmc";
327 reg = <0x480d5000 0x400>;
328 interrupts = <0 59 0x4>;
275 ti,hwmods = "mmc5"; 329 ti,hwmods = "mmc5";
276 ti,needs-special-reset; 330 ti,needs-special-reset;
277 }; 331 };
@@ -287,7 +341,6 @@
287 <0x49032000 0x7f>; /* L3 Interconnect */ 341 <0x49032000 0x7f>; /* L3 Interconnect */
288 reg-names = "mpu", "dma"; 342 reg-names = "mpu", "dma";
289 interrupts = <0 112 0x4>; 343 interrupts = <0 112 0x4>;
290 interrupt-parent = <&gic>;
291 ti,hwmods = "mcpdm"; 344 ti,hwmods = "mcpdm";
292 }; 345 };
293 346
@@ -297,7 +350,6 @@
297 <0x4902e000 0x7f>; /* L3 Interconnect */ 350 <0x4902e000 0x7f>; /* L3 Interconnect */
298 reg-names = "mpu", "dma"; 351 reg-names = "mpu", "dma";
299 interrupts = <0 114 0x4>; 352 interrupts = <0 114 0x4>;
300 interrupt-parent = <&gic>;
301 ti,hwmods = "dmic"; 353 ti,hwmods = "dmic";
302 }; 354 };
303 355
@@ -308,7 +360,6 @@
308 reg-names = "mpu", "dma"; 360 reg-names = "mpu", "dma";
309 interrupts = <0 17 0x4>; 361 interrupts = <0 17 0x4>;
310 interrupt-names = "common"; 362 interrupt-names = "common";
311 interrupt-parent = <&gic>;
312 ti,buffer-size = <128>; 363 ti,buffer-size = <128>;
313 ti,hwmods = "mcbsp1"; 364 ti,hwmods = "mcbsp1";
314 }; 365 };
@@ -320,7 +371,6 @@
320 reg-names = "mpu", "dma"; 371 reg-names = "mpu", "dma";
321 interrupts = <0 22 0x4>; 372 interrupts = <0 22 0x4>;
322 interrupt-names = "common"; 373 interrupt-names = "common";
323 interrupt-parent = <&gic>;
324 ti,buffer-size = <128>; 374 ti,buffer-size = <128>;
325 ti,hwmods = "mcbsp2"; 375 ti,hwmods = "mcbsp2";
326 }; 376 };
@@ -332,9 +382,119 @@
332 reg-names = "mpu", "dma"; 382 reg-names = "mpu", "dma";
333 interrupts = <0 23 0x4>; 383 interrupts = <0 23 0x4>;
334 interrupt-names = "common"; 384 interrupt-names = "common";
335 interrupt-parent = <&gic>;
336 ti,buffer-size = <128>; 385 ti,buffer-size = <128>;
337 ti,hwmods = "mcbsp3"; 386 ti,hwmods = "mcbsp3";
338 }; 387 };
388
389 timer1: timer@4ae18000 {
390 compatible = "ti,omap2-timer";
391 reg = <0x4ae18000 0x80>;
392 interrupts = <0 37 0x4>;
393 ti,hwmods = "timer1";
394 ti,timer-alwon;
395 };
396
397 timer2: timer@48032000 {
398 compatible = "ti,omap2-timer";
399 reg = <0x48032000 0x80>;
400 interrupts = <0 38 0x4>;
401 ti,hwmods = "timer2";
402 };
403
404 timer3: timer@48034000 {
405 compatible = "ti,omap2-timer";
406 reg = <0x48034000 0x80>;
407 interrupts = <0 39 0x4>;
408 ti,hwmods = "timer3";
409 };
410
411 timer4: timer@48036000 {
412 compatible = "ti,omap2-timer";
413 reg = <0x48036000 0x80>;
414 interrupts = <0 40 0x4>;
415 ti,hwmods = "timer4";
416 };
417
418 timer5: timer@40138000 {
419 compatible = "ti,omap2-timer";
420 reg = <0x40138000 0x80>,
421 <0x49038000 0x80>;
422 interrupts = <0 41 0x4>;
423 ti,hwmods = "timer5";
424 ti,timer-dsp;
425 };
426
427 timer6: timer@4013a000 {
428 compatible = "ti,omap2-timer";
429 reg = <0x4013a000 0x80>,
430 <0x4903a000 0x80>;
431 interrupts = <0 42 0x4>;
432 ti,hwmods = "timer6";
433 ti,timer-dsp;
434 ti,timer-pwm;
435 };
436
437 timer7: timer@4013c000 {
438 compatible = "ti,omap2-timer";
439 reg = <0x4013c000 0x80>,
440 <0x4903c000 0x80>;
441 interrupts = <0 43 0x4>;
442 ti,hwmods = "timer7";
443 ti,timer-dsp;
444 };
445
446 timer8: timer@4013e000 {
447 compatible = "ti,omap2-timer";
448 reg = <0x4013e000 0x80>,
449 <0x4903e000 0x80>;
450 interrupts = <0 44 0x4>;
451 ti,hwmods = "timer8";
452 ti,timer-dsp;
453 ti,timer-pwm;
454 };
455
456 timer9: timer@4803e000 {
457 compatible = "ti,omap2-timer";
458 reg = <0x4803e000 0x80>;
459 interrupts = <0 45 0x4>;
460 ti,hwmods = "timer9";
461 };
462
463 timer10: timer@48086000 {
464 compatible = "ti,omap2-timer";
465 reg = <0x48086000 0x80>;
466 interrupts = <0 46 0x4>;
467 ti,hwmods = "timer10";
468 };
469
470 timer11: timer@48088000 {
471 compatible = "ti,omap2-timer";
472 reg = <0x48088000 0x80>;
473 interrupts = <0 47 0x4>;
474 ti,hwmods = "timer11";
475 ti,timer-pwm;
476 };
477
478 emif1: emif@0x4c000000 {
479 compatible = "ti,emif-4d5";
480 ti,hwmods = "emif1";
481 phy-type = <2>; /* DDR PHY type: Intelli PHY */
482 reg = <0x4c000000 0x400>;
483 interrupts = <0 110 0x4>;
484 hw-caps-read-idle-ctrl;
485 hw-caps-ll-interface;
486 hw-caps-temp-alert;
487 };
488
489 emif2: emif@0x4d000000 {
490 compatible = "ti,emif-4d5";
491 ti,hwmods = "emif2";
492 phy-type = <2>; /* DDR PHY type: Intelli PHY */
493 reg = <0x4d000000 0x400>;
494 interrupts = <0 111 0x4>;
495 hw-caps-read-idle-ctrl;
496 hw-caps-ll-interface;
497 hw-caps-temp-alert;
498 };
339 }; 499 };
340}; 500};
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
new file mode 100644
index 00000000000..5a3a58b7e18
--- /dev/null
+++ b/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) 2012 Thomas Petazzoni <thomas.petazzoni@free-electrons.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/include/ "orion5x.dtsi"
11
12/ {
13 model = "LaCie Ethernet Disk mini V2";
14 compatible = "lacie,ethernet-disk-mini-v2", "marvell-orion5x-88f5182", "marvell,orion5x";
15
16 memory {
17 reg = <0x00000000 0x4000000>; /* 64 MB */
18 };
19
20 chosen {
21 bootargs = "console=ttyS0,115200n8 earlyprintk";
22 };
23
24 ocp@f1000000 {
25 serial@12000 {
26 clock-frequency = <166666667>;
27 status = "okay";
28 };
29
30 sata@80000 {
31 status = "okay";
32 nr-ports = <2>;
33 };
34 };
35
36 gpio_keys {
37 compatible = "gpio-keys";
38 #address-cells = <1>;
39 #size-cells = <0>;
40 button@1 {
41 label = "Power-on Switch";
42 linux,code = <116>; /* KEY_POWER */
43 gpios = <&gpio0 18 0>;
44 };
45 };
46
47 gpio_leds {
48 compatible = "gpio-leds";
49
50 led@1 {
51 label = "power:blue";
52 gpios = <&gpio0 16 1>;
53 };
54 };
55};
diff --git a/arch/arm/boot/dts/orion5x.dtsi b/arch/arm/boot/dts/orion5x.dtsi
new file mode 100644
index 00000000000..8aad00f81ed
--- /dev/null
+++ b/arch/arm/boot/dts/orion5x.dtsi
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2012 Thomas Petazzoni <thomas.petazzoni@free-electrons.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/include/ "skeleton.dtsi"
10
11/ {
12 model = "Marvell Orion5x SoC";
13 compatible = "marvell,orion5x";
14 interrupt-parent = <&intc>;
15
16 intc: interrupt-controller {
17 compatible = "marvell,orion-intc", "marvell,intc";
18 interrupt-controller;
19 #interrupt-cells = <1>;
20 reg = <0xf1020204 0x04>;
21 };
22
23 ocp@f1000000 {
24 compatible = "simple-bus";
25 ranges = <0x00000000 0xf1000000 0x4000000
26 0xf2200000 0xf2200000 0x0000800>;
27 #address-cells = <1>;
28 #size-cells = <1>;
29
30 gpio0: gpio@10100 {
31 compatible = "marvell,orion-gpio";
32 #gpio-cells = <2>;
33 gpio-controller;
34 reg = <0x10100 0x40>;
35 ngpio = <32>;
36 interrupts = <6>, <7>, <8>, <9>;
37 };
38
39 serial@12000 {
40 compatible = "ns16550a";
41 reg = <0x12000 0x100>;
42 reg-shift = <2>;
43 interrupts = <3>;
44 /* set clock-frequency in board dts */
45 status = "disabled";
46 };
47
48 serial@12100 {
49 compatible = "ns16550a";
50 reg = <0x12100 0x100>;
51 reg-shift = <2>;
52 interrupts = <4>;
53 /* set clock-frequency in board dts */
54 status = "disabled";
55 };
56
57 spi@10600 {
58 compatible = "marvell,orion-spi";
59 #address-cells = <1>;
60 #size-cells = <0>;
61 cell-index = <0>;
62 reg = <0x10600 0x28>;
63 status = "disabled";
64 };
65
66 wdt@20300 {
67 compatible = "marvell,orion-wdt";
68 reg = <0x20300 0x28>;
69 status = "okay";
70 };
71
72 sata@80000 {
73 compatible = "marvell,orion-sata";
74 reg = <0x80000 0x5000>;
75 interrupts = <29>;
76 status = "disabled";
77 };
78
79 i2c@11000 {
80 compatible = "marvell,mv64xxx-i2c";
81 reg = <0x11000 0x20>;
82 #address-cells = <1>;
83 #size-cells = <0>;
84 interrupts = <5>;
85 clock-frequency = <100000>;
86 status = "disabled";
87 };
88
89 crypto@90000 {
90 compatible = "marvell,orion-crypto";
91 reg = <0x90000 0x10000>,
92 <0xf2200000 0x800>;
93 reg-names = "regs", "sram";
94 interrupts = <22>;
95 status = "okay";
96 };
97 };
98};
diff --git a/arch/arm/boot/dts/pm9g45.dts b/arch/arm/boot/dts/pm9g45.dts
new file mode 100644
index 00000000000..387fedb5898
--- /dev/null
+++ b/arch/arm/boot/dts/pm9g45.dts
@@ -0,0 +1,165 @@
1/*
2 * pm9g45.dts - Device Tree file for Ronetix pm9g45 board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9g45.dtsi"
10
11/ {
12 model = "Ronetix pm9g45";
13 compatible = "ronetix,pm9g45", "atmel,at91sam9g45", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "console=ttyS0,115200";
17 };
18
19 memory {
20 reg = <0x70000000 0x8000000>;
21 };
22
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 ranges;
27
28 main_clock: clock@0 {
29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>;
31 };
32 };
33
34 ahb {
35 apb {
36 dbgu: serial@ffffee00 {
37 status = "okay";
38 };
39
40 pinctrl@fffff200 {
41
42 board {
43 pinctrl_board_nand: nand0-board {
44 atmel,pins =
45 <3 3 0x0 0x1 /* PD3 gpio RDY pin pull_up*/
46 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */
47 };
48 };
49
50 mmc {
51 pinctrl_board_mmc: mmc0-board {
52 atmel,pins =
53 <3 6 0x0 0x5>; /* PD6 gpio CD pin pull_up and deglitch */
54 };
55 };
56 };
57
58 mmc0: mmc@fff80000 {
59 pinctrl-0 = <
60 &pinctrl_board_mmc
61 &pinctrl_mmc0_slot0_clk_cmd_dat0
62 &pinctrl_mmc0_slot0_dat1_3>;
63 status = "okay";
64 slot@0 {
65 reg = <0>;
66 bus-width = <4>;
67 cd-gpios = <&pioD 6 0>;
68 };
69 };
70
71 macb0: ethernet@fffbc000 {
72 phy-mode = "rmii";
73 status = "okay";
74 };
75
76 };
77
78 nand0: nand@40000000 {
79 nand-bus-width = <8>;
80 nand-ecc-mode = "soft";
81 nand-on-flash-bbt;
82 pinctrl-0 = <&pinctrl_board_nand>;
83
84 gpios = <&pioD 3 0
85 &pioC 14 0
86 0
87 >;
88
89 status = "okay";
90
91 at91bootstrap@0 {
92 label = "at91bootstrap";
93 reg = <0x0 0x20000>;
94 };
95
96 barebox@20000 {
97 label = "barebox";
98 reg = <0x20000 0x40000>;
99 };
100
101 bareboxenv@60000 {
102 label = "bareboxenv";
103 reg = <0x60000 0x1A0000>;
104 };
105
106 kernel@200000 {
107 label = "bareboxenv2";
108 reg = <0x200000 0x300000>;
109 };
110
111 kernel@500000 {
112 label = "root";
113 reg = <0x500000 0x400000>;
114 };
115
116 data@900000 {
117 label = "data";
118 reg = <0x900000 0x8340000>;
119 };
120 };
121
122 usb0: ohci@00700000 {
123 status = "okay";
124 num-ports = <2>;
125 };
126
127 usb1: ehci@00800000 {
128 status = "okay";
129 };
130 };
131
132 leds {
133 compatible = "gpio-leds";
134
135 led0 {
136 label = "led0";
137 gpios = <&pioD 0 1>;
138 linux,default-trigger = "nand-disk";
139 };
140
141 led1 {
142 label = "led1";
143 gpios = <&pioD 31 0>;
144 linux,default-trigger = "heartbeat";
145 };
146 };
147
148 gpio_keys {
149 compatible = "gpio-keys";
150 #address-cells = <1>;
151 #size-cells = <0>;
152
153 right {
154 label = "SW4";
155 gpios = <&pioE 7 1>;
156 linux,code = <106>;
157 };
158
159 up {
160 label = "SW3";
161 gpios = <&pioE 8 1>;
162 linux,code = <103>;
163 };
164 };
165};
diff --git a/arch/arm/boot/dts/samsung_k3pe0e000b.dtsi b/arch/arm/boot/dts/samsung_k3pe0e000b.dtsi
new file mode 100644
index 00000000000..9657a5cbc3a
--- /dev/null
+++ b/arch/arm/boot/dts/samsung_k3pe0e000b.dtsi
@@ -0,0 +1,67 @@
1/*
2 * Timings and Geometry for Samsung K3PE0E000B memory part
3 */
4
5/ {
6 samsung_K3PE0E000B: lpddr2 {
7 compatible = "Samsung,K3PE0E000B","jedec,lpddr2-s4";
8 density = <4096>;
9 io-width = <32>;
10
11 tRPab-min-tck = <3>;
12 tRCD-min-tck = <3>;
13 tWR-min-tck = <3>;
14 tRASmin-min-tck = <3>;
15 tRRD-min-tck = <2>;
16 tWTR-min-tck = <2>;
17 tXP-min-tck = <2>;
18 tRTP-min-tck = <2>;
19 tCKE-min-tck = <3>;
20 tCKESR-min-tck = <3>;
21 tFAW-min-tck = <8>;
22
23 timings_samsung_K3PE0E000B_533MHz: lpddr2-timings@0 {
24 compatible = "jedec,lpddr2-timings";
25 min-freq = <10000000>;
26 max-freq = <533333333>;
27 tRPab = <21000>;
28 tRCD = <18000>;
29 tWR = <15000>;
30 tRAS-min = <42000>;
31 tRRD = <10000>;
32 tWTR = <7500>;
33 tXP = <7500>;
34 tRTP = <7500>;
35 tCKESR = <15000>;
36 tDQSCK-max = <5500>;
37 tFAW = <50000>;
38 tZQCS = <90000>;
39 tZQCL = <360000>;
40 tZQinit = <1000000>;
41 tRAS-max-ns = <70000>;
42 tDQSCK-max-derated = <6000>;
43 };
44
45 timings_samsung_K3PE0E000B_266MHz: lpddr2-timings@1 {
46 compatible = "jedec,lpddr2-timings";
47 min-freq = <10000000>;
48 max-freq = <266666666>;
49 tRPab = <21000>;
50 tRCD = <18000>;
51 tWR = <15000>;
52 tRAS-min = <42000>;
53 tRRD = <10000>;
54 tWTR = <7500>;
55 tXP = <7500>;
56 tRTP = <7500>;
57 tCKESR = <15000>;
58 tDQSCK-max = <5500>;
59 tFAW = <50000>;
60 tZQCS = <90000>;
61 tZQCL = <360000>;
62 tZQinit = <1000000>;
63 tRAS-max-ns = <70000>;
64 tDQSCK-max-derated = <6000>;
65 };
66 };
67};
diff --git a/arch/arm/boot/dts/sh7377.dtsi b/arch/arm/boot/dts/sh7372-mackerel.dts
index 767ee0796da..286f0caef01 100644
--- a/arch/arm/boot/dts/sh7377.dtsi
+++ b/arch/arm/boot/dts/sh7372-mackerel.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Device Tree Source for the sh7377 SoC 2 * Device Tree Source for the mackerel board
3 * 3 *
4 * Copyright (C) 2012 Renesas Solutions Corp. 4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * 5 *
@@ -8,14 +8,15 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/dts-v1/;
11/include/ "skeleton.dtsi" 12/include/ "skeleton.dtsi"
12 13
13/ { 14/ {
14 compatible = "renesas,sh7377"; 15 model = "Mackerel (AP4 EVM 2nd)";
16 compatible = "renesas,mackerel";
15 17
16 cpus { 18 memory {
17 cpu@0 { 19 device_type = "memory";
18 compatible = "arm,cortex-a8"; 20 reg = <0x40000000 0x10000000>;
19 };
20 }; 21 };
21}; 22};
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
index 702c0baa600..27f31a5fa49 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/snowball.dts
@@ -14,7 +14,7 @@
14 14
15/ { 15/ {
16 model = "Calao Systems Snowball platform with device tree"; 16 model = "Calao Systems Snowball platform with device tree";
17 compatible = "calaosystems,snowball-a9500"; 17 compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500";
18 18
19 memory { 19 memory {
20 reg = <0x00000000 0x20000000>; 20 reg = <0x00000000 0x20000000>;
@@ -99,6 +99,33 @@
99 status = "okay"; 99 status = "okay";
100 }; 100 };
101 101
102 prcmu@80157000 {
103 thermal@801573c0 {
104 num-trips = <4>;
105
106 trip0-temp = <70000>;
107 trip0-type = "active";
108 trip0-cdev-num = <1>;
109 trip0-cdev-name0 = "thermal-cpufreq-0";
110
111 trip1-temp = <75000>;
112 trip1-type = "active";
113 trip1-cdev-num = <1>;
114 trip1-cdev-name0 = "thermal-cpufreq-0";
115
116 trip2-temp = <80000>;
117 trip2-type = "active";
118 trip2-cdev-num = <1>;
119 trip2-cdev-name0 = "thermal-cpufreq-0";
120
121 trip3-temp = <85000>;
122 trip3-type = "critical";
123 trip3-cdev-num = <0>;
124
125 status = "okay";
126 };
127 };
128
102 external-bus@50000000 { 129 external-bus@50000000 {
103 status = "okay"; 130 status = "okay";
104 131
@@ -120,10 +147,10 @@
120 }; 147 };
121 148
122 // External Micro SD slot 149 // External Micro SD slot
123 sdi@80126000 { 150 sdi0_per1@80126000 {
124 arm,primecell-periphid = <0x10480180>; 151 arm,primecell-periphid = <0x10480180>;
125 max-frequency = <50000000>; 152 max-frequency = <50000000>;
126 bus-width = <8>; 153 bus-width = <4>;
127 mmc-cap-mmc-highspeed; 154 mmc-cap-mmc-highspeed;
128 vmmc-supply = <&ab8500_ldo_aux3_reg>; 155 vmmc-supply = <&ab8500_ldo_aux3_reg>;
129 156
@@ -134,7 +161,7 @@
134 }; 161 };
135 162
136 // On-board eMMC 163 // On-board eMMC
137 sdi@80114000 { 164 sdi4_per2@80114000 {
138 arm,primecell-periphid = <0x10480180>; 165 arm,primecell-periphid = <0x10480180>;
139 max-frequency = <50000000>; 166 max-frequency = <50000000>;
140 bus-width = <8>; 167 bus-width = <8>;
@@ -183,5 +210,141 @@
183 reg = <0x33>; 210 reg = <0x33>;
184 }; 211 };
185 }; 212 };
213
214 cpufreq-cooling {
215 status = "okay";
216 };
217
218 prcmu@80157000 {
219 db8500-prcmu-regulators {
220 db8500_vape_reg: db8500_vape {
221 regulator-name = "db8500-vape";
222 };
223
224 db8500_varm_reg: db8500_varm {
225 regulator-name = "db8500-varm";
226 };
227
228 db8500_vmodem_reg: db8500_vmodem {
229 regulator-name = "db8500-vmodem";
230 };
231
232 db8500_vpll_reg: db8500_vpll {
233 regulator-name = "db8500-vpll";
234 };
235
236 db8500_vsmps1_reg: db8500_vsmps1 {
237 regulator-name = "db8500-vsmps1";
238 };
239
240 db8500_vsmps2_reg: db8500_vsmps2 {
241 regulator-name = "db8500-vsmps2";
242 };
243
244 db8500_vsmps3_reg: db8500_vsmps3 {
245 regulator-name = "db8500-vsmps3";
246 };
247
248 db8500_vrf1_reg: db8500_vrf1 {
249 regulator-name = "db8500-vrf1";
250 };
251
252 db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
253 regulator-name = "db8500-sva-mmdsp";
254 };
255
256 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
257 regulator-name = "db8500-sva-mmdsp-ret";
258 };
259
260 db8500_sva_pipe_reg: db8500_sva_pipe {
261 regulator-name = "db8500_sva_pipe";
262 };
263
264 db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
265 regulator-name = "db8500_sia_mmdsp";
266 };
267
268 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
269 regulator-name = "db8500-sia-mmdsp-ret";
270 };
271
272 db8500_sia_pipe_reg: db8500_sia_pipe {
273 regulator-name = "db8500-sia-pipe";
274 };
275
276 db8500_sga_reg: db8500_sga {
277 regulator-name = "db8500-sga";
278 };
279
280 db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
281 regulator-name = "db8500-b2r2-mcde";
282 };
283
284 db8500_esram12_reg: db8500_esram12 {
285 regulator-name = "db8500-esram12";
286 };
287
288 db8500_esram12_ret_reg: db8500_esram12_ret {
289 regulator-name = "db8500-esram12-ret";
290 };
291
292 db8500_esram34_reg: db8500_esram34 {
293 regulator-name = "db8500-esram34";
294 };
295
296 db8500_esram34_ret_reg: db8500_esram34_ret {
297 regulator-name = "db8500-esram34-ret";
298 };
299 };
300
301 ab8500@5 {
302 ab8500-regulators {
303 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
304 regulator-name = "V-DISPLAY";
305 };
306
307 ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
308 regulator-name = "V-eMMC1";
309 };
310
311 ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
312 regulator-name = "V-MMC-SD";
313 };
314
315 ab8500_ldo_initcore_reg: ab8500_ldo_initcore {
316 regulator-name = "V-INTCORE";
317 };
318
319 ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
320 regulator-name = "V-TVOUT";
321 };
322
323 ab8500_ldo_usb_reg: ab8500_ldo_usb {
324 regulator-name = "dummy";
325 };
326
327 ab8500_ldo_audio_reg: ab8500_ldo_audio {
328 regulator-name = "V-AUD";
329 };
330
331 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
332 regulator-name = "V-AMIC1";
333 };
334
335 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 {
336 regulator-name = "V-AMIC2";
337 };
338
339 ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
340 regulator-name = "V-DMIC";
341 };
342
343 ab8500_ldo_ana_reg: ab8500_ldo_ana {
344 regulator-name = "V-CSI/DSI";
345 };
346 };
347 };
348 };
186 }; 349 };
187}; 350};
diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts
index dd4358bc26e..2e4c5727468 100644
--- a/arch/arm/boot/dts/spear1310-evb.dts
+++ b/arch/arm/boot/dts/spear1310-evb.dts
@@ -181,6 +181,10 @@
181 status = "okay"; 181 status = "okay";
182 }; 182 };
183 183
184 gpio@d8400000 {
185 status = "okay";
186 };
187
184 i2c0: i2c@e0280000 { 188 i2c0: i2c@e0280000 {
185 status = "okay"; 189 status = "okay";
186 }; 190 };
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 419ea7413d2..7cd25eb4f8e 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -70,6 +70,12 @@
70 status = "disabled"; 70 status = "disabled";
71 }; 71 };
72 72
73 pinmux: pinmux@e0700000 {
74 compatible = "st,spear1310-pinmux";
75 reg = <0xe0700000 0x1000>;
76 #gpio-range-cells = <2>;
77 };
78
73 spi1: spi@5d400000 { 79 spi1: spi@5d400000 {
74 compatible = "arm,pl022", "arm,primecell"; 80 compatible = "arm,pl022", "arm,primecell";
75 reg = <0x5d400000 0x1000>; 81 reg = <0x5d400000 0x1000>;
@@ -179,6 +185,27 @@
179 thermal@e07008c4 { 185 thermal@e07008c4 {
180 st,thermal-flags = <0x7000>; 186 st,thermal-flags = <0x7000>;
181 }; 187 };
188
189 gpiopinctrl: gpio@d8400000 {
190 compatible = "st,spear-plgpio";
191 reg = <0xd8400000 0x1000>;
192 interrupts = <0 100 0x4>;
193 #interrupt-cells = <1>;
194 interrupt-controller;
195 gpio-controller;
196 #gpio-cells = <2>;
197 gpio-ranges = <&pinmux 0 246>;
198 status = "disabled";
199
200 st-plgpio,ngpio = <246>;
201 st-plgpio,enb-reg = <0xd0>;
202 st-plgpio,wdata-reg = <0x90>;
203 st-plgpio,dir-reg = <0xb0>;
204 st-plgpio,ie-reg = <0x30>;
205 st-plgpio,rdata-reg = <0x70>;
206 st-plgpio,mis-reg = <0x10>;
207 st-plgpio,eit-reg = <0x50>;
208 };
182 }; 209 };
183 }; 210 };
184}; 211};
diff --git a/arch/arm/boot/dts/spear1340-evb.dts b/arch/arm/boot/dts/spear1340-evb.dts
index c9a54e06fb6..045f7123ffa 100644
--- a/arch/arm/boot/dts/spear1340-evb.dts
+++ b/arch/arm/boot/dts/spear1340-evb.dts
@@ -193,6 +193,10 @@
193 status = "okay"; 193 status = "okay";
194 }; 194 };
195 195
196 gpio@e2800000 {
197 status = "okay";
198 };
199
196 i2c0: i2c@e0280000 { 200 i2c0: i2c@e0280000 {
197 status = "okay"; 201 status = "okay";
198 }; 202 };
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index d71fe2a68f0..6c09eb0a1b2 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -24,6 +24,12 @@
24 status = "disabled"; 24 status = "disabled";
25 }; 25 };
26 26
27 pinmux: pinmux@e0700000 {
28 compatible = "st,spear1340-pinmux";
29 reg = <0xe0700000 0x1000>;
30 #gpio-range-cells = <2>;
31 };
32
27 spi1: spi@5d400000 { 33 spi1: spi@5d400000 {
28 compatible = "arm,pl022", "arm,primecell"; 34 compatible = "arm,pl022", "arm,primecell";
29 reg = <0x5d400000 0x1000>; 35 reg = <0x5d400000 0x1000>;
@@ -51,6 +57,26 @@
51 thermal@e07008c4 { 57 thermal@e07008c4 {
52 st,thermal-flags = <0x2a00>; 58 st,thermal-flags = <0x2a00>;
53 }; 59 };
60
61 gpiopinctrl: gpio@e2800000 {
62 compatible = "st,spear-plgpio";
63 reg = <0xe2800000 0x1000>;
64 interrupts = <0 107 0x4>;
65 #interrupt-cells = <1>;
66 interrupt-controller;
67 gpio-controller;
68 #gpio-cells = <2>;
69 gpio-ranges = <&pinmux 0 252>;
70 status = "disabled";
71
72 st-plgpio,ngpio = <250>;
73 st-plgpio,wdata-reg = <0x40>;
74 st-plgpio,dir-reg = <0x00>;
75 st-plgpio,ie-reg = <0x80>;
76 st-plgpio,rdata-reg = <0x20>;
77 st-plgpio,mis-reg = <0xa0>;
78 st-plgpio,eit-reg = <0x60>;
79 };
54 }; 80 };
55 }; 81 };
56}; 82};
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index 62fc4fb3e5f..930303e48df 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -22,9 +22,10 @@
22 0xb0000000 0xb0000000 0x10000000 22 0xb0000000 0xb0000000 0x10000000
23 0xd0000000 0xd0000000 0x30000000>; 23 0xd0000000 0xd0000000 0x30000000>;
24 24
25 pinmux@b4000000 { 25 pinmux: pinmux@b4000000 {
26 compatible = "st,spear310-pinmux"; 26 compatible = "st,spear310-pinmux";
27 reg = <0xb4000000 0x1000>; 27 reg = <0xb4000000 0x1000>;
28 #gpio-range-cells = <2>;
28 }; 29 };
29 30
30 fsmc: flash@44000000 { 31 fsmc: flash@44000000 {
@@ -75,6 +76,25 @@
75 reg = <0xb2200000 0x1000>; 76 reg = <0xb2200000 0x1000>;
76 status = "disabled"; 77 status = "disabled";
77 }; 78 };
79
80 gpiopinctrl: gpio@b4000000 {
81 compatible = "st,spear-plgpio";
82 reg = <0xb4000000 0x1000>;
83 #interrupt-cells = <1>;
84 interrupt-controller;
85 gpio-controller;
86 #gpio-cells = <2>;
87 gpio-ranges = <&pinmux 0 102>;
88 status = "disabled";
89
90 st-plgpio,ngpio = <102>;
91 st-plgpio,enb-reg = <0x10>;
92 st-plgpio,wdata-reg = <0x20>;
93 st-plgpio,dir-reg = <0x30>;
94 st-plgpio,ie-reg = <0x50>;
95 st-plgpio,rdata-reg = <0x40>;
96 st-plgpio,mis-reg = <0x60>;
97 };
78 }; 98 };
79 }; 99 };
80}; 100};
diff --git a/arch/arm/boot/dts/spear320-evb.dts b/arch/arm/boot/dts/spear320-evb.dts
index 082328bd64a..ad4bfc68ee0 100644
--- a/arch/arm/boot/dts/spear320-evb.dts
+++ b/arch/arm/boot/dts/spear320-evb.dts
@@ -164,6 +164,10 @@
164 status = "okay"; 164 status = "okay";
165 }; 165 };
166 166
167 gpio@b3000000 {
168 status = "okay";
169 };
170
167 i2c0: i2c@d0180000 { 171 i2c0: i2c@d0180000 {
168 status = "okay"; 172 status = "okay";
169 }; 173 };
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index 1f49d69595a..67d7ada7127 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -21,9 +21,10 @@
21 ranges = <0x40000000 0x40000000 0x80000000 21 ranges = <0x40000000 0x40000000 0x80000000
22 0xd0000000 0xd0000000 0x30000000>; 22 0xd0000000 0xd0000000 0x30000000>;
23 23
24 pinmux@b3000000 { 24 pinmux: pinmux@b3000000 {
25 compatible = "st,spear320-pinmux"; 25 compatible = "st,spear320-pinmux";
26 reg = <0xb3000000 0x1000>; 26 reg = <0xb3000000 0x1000>;
27 #gpio-range-cells = <2>;
27 }; 28 };
28 29
29 clcd@90000000 { 30 clcd@90000000 {
@@ -90,6 +91,26 @@
90 reg = <0xa4000000 0x1000>; 91 reg = <0xa4000000 0x1000>;
91 status = "disabled"; 92 status = "disabled";
92 }; 93 };
94
95 gpiopinctrl: gpio@b3000000 {
96 compatible = "st,spear-plgpio";
97 reg = <0xb3000000 0x1000>;
98 #interrupt-cells = <1>;
99 interrupt-controller;
100 gpio-controller;
101 #gpio-cells = <2>;
102 gpio-ranges = <&pinmux 0 102>;
103 status = "disabled";
104
105 st-plgpio,ngpio = <102>;
106 st-plgpio,enb-reg = <0x24>;
107 st-plgpio,wdata-reg = <0x34>;
108 st-plgpio,dir-reg = <0x44>;
109 st-plgpio,ie-reg = <0x64>;
110 st-plgpio,rdata-reg = <0x54>;
111 st-plgpio,mis-reg = <0x84>;
112 st-plgpio,eit-reg = <0x94>;
113 };
93 }; 114 };
94 }; 115 };
95}; 116};
diff --git a/arch/arm/boot/dts/stuib.dtsi b/arch/arm/boot/dts/stuib.dtsi
new file mode 100644
index 00000000000..39446a247e7
--- /dev/null
+++ b/arch/arm/boot/dts/stuib.dtsi
@@ -0,0 +1,78 @@
1/*
2 * Copyright 2012 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/ {
13 soc-u9500 {
14 i2c@80004000 {
15 stmpe1601: stmpe1601@40 {
16 compatible = "st,stmpe1601";
17 reg = <0x40>;
18 interrupts = <26 0x1>;
19 interrupt-parent = <&gpio6>;
20 interrupt-controller;
21
22 wakeup-source;
23 st,autosleep-timeout = <1024>;
24
25 stmpe_keypad {
26 compatible = "st,stmpe-keypad";
27
28 debounce-interval = <64>;
29 st,scan-count = <8>;
30 st,no-autorepeat;
31
32 linux,keymap = <0x205006b
33 0x4010074
34 0x3050072
35 0x1030004
36 0x502006a
37 0x500000a
38 0x5008b
39 0x706001c
40 0x405000b
41 0x6070003
42 0x3040067
43 0x303006c
44 0x60400e7
45 0x602009e
46 0x4020073
47 0x5050002
48 0x4030069
49 0x3020008>;
50 };
51 };
52 };
53
54 i2c@80110000 {
55 bu21013_tp@0x5c {
56 compatible = "rhom,bu21013_tp";
57 reg = <0x5c>;
58 touch-gpio = <&gpio2 20 0x4>;
59 avdd-supply = <&ab8500_ldo_aux1_reg>;
60
61 rhom,touch-max-x = <384>;
62 rhom,touch-max-y = <704>;
63 rhom,flip-y;
64 };
65
66 bu21013_tp@0x5d {
67 compatible = "rhom,bu21013_tp";
68 reg = <0x5d>;
69 touch-gpio = <&gpio2 20 0x4>;
70 avdd-supply = <&ab8500_ldo_aux1_reg>;
71
72 rhom,touch-max-x = <384>;
73 rhom,touch-max-y = <704>;
74 rhom,flip-y;
75 };
76 };
77 };
78};
diff --git a/arch/arm/boot/dts/sun4i-cubieboard.dts b/arch/arm/boot/dts/sun4i-cubieboard.dts
new file mode 100644
index 00000000000..f4ca126ad99
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-cubieboard.dts
@@ -0,0 +1,38 @@
1/*
2 * Copyright 2012 Stefan Roese
3 * Stefan Roese <sr@denx.de>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/dts-v1/;
14/include/ "sun4i.dtsi"
15
16/ {
17 model = "Cubietech Cubieboard";
18 compatible = "cubietech,cubieboard", "allwinner,sun4i";
19
20 aliases {
21 serial0 = &uart0;
22 serial1 = &uart1;
23 };
24
25 chosen {
26 bootargs = "earlyprintk console=ttyS0,115200";
27 };
28
29 soc {
30 uart0: uart@01c28000 {
31 status = "okay";
32 };
33
34 uart1: uart@01c28400 {
35 status = "okay";
36 };
37 };
38};
diff --git a/arch/arm/boot/dts/sun4i.dtsi b/arch/arm/boot/dts/sun4i.dtsi
new file mode 100644
index 00000000000..e61fdd47bd0
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i.dtsi
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2012 Stefan Roese
3 * Stefan Roese <sr@denx.de>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/include/ "sunxi.dtsi"
14
15/ {
16 memory {
17 reg = <0x40000000 0x80000000>;
18 };
19};
diff --git a/arch/arm/boot/dts/sun5i-olinuxino.dts b/arch/arm/boot/dts/sun5i-olinuxino.dts
new file mode 100644
index 00000000000..d6ff889a5d8
--- /dev/null
+++ b/arch/arm/boot/dts/sun5i-olinuxino.dts
@@ -0,0 +1,30 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "sun5i.dtsi"
16
17/ {
18 model = "Olimex A13-Olinuxino";
19 compatible = "olimex,a13-olinuxino", "allwinner,sun5i";
20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
25 soc {
26 uart1: uart@01c28400 {
27 status = "okay";
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
new file mode 100644
index 00000000000..59a2d265a98
--- /dev/null
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -0,0 +1,20 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "sunxi.dtsi"
15
16/ {
17 memory {
18 reg = <0x40000000 0x20000000>;
19 };
20};
diff --git a/arch/arm/boot/dts/sunxi.dtsi b/arch/arm/boot/dts/sunxi.dtsi
new file mode 100644
index 00000000000..8bbc2bfef22
--- /dev/null
+++ b/arch/arm/boot/dts/sunxi.dtsi
@@ -0,0 +1,80 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 interrupt-parent = <&intc>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,cortex-a8";
22 };
23 };
24
25 clocks {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
29 osc: oscillator {
30 #clock-cells = <0>;
31 compatible = "fixed-clock";
32 clock-frequency = <24000000>;
33 };
34 };
35
36 soc {
37 compatible = "simple-bus";
38 #address-cells = <1>;
39 #size-cells = <1>;
40 reg = <0x01c20000 0x300000>;
41 ranges;
42
43 timer@01c20c00 {
44 compatible = "allwinner,sunxi-timer";
45 reg = <0x01c20c00 0x90>;
46 interrupts = <22>;
47 clocks = <&osc>;
48 };
49
50 wdt: watchdog@01c20c90 {
51 compatible = "allwinner,sunxi-wdt";
52 reg = <0x01c20c90 0x10>;
53 };
54
55 intc: interrupt-controller@01c20400 {
56 compatible = "allwinner,sunxi-ic";
57 reg = <0x01c20400 0x400>;
58 interrupt-controller;
59 #interrupt-cells = <1>;
60 };
61
62 uart0: uart@01c28000 {
63 compatible = "ns8250";
64 reg = <0x01c28000 0x400>;
65 interrupts = <1>;
66 reg-shift = <2>;
67 clock-frequency = <24000000>;
68 status = "disabled";
69 };
70
71 uart1: uart@01c28400 {
72 compatible = "ns8250";
73 reg = <0x01c28400 0x400>;
74 interrupts = <2>;
75 reg-shift = <2>;
76 clock-frequency = <24000000>;
77 status = "disabled";
78 };
79 };
80};
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index c3ef1ad26b6..43eb72af894 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -10,6 +10,18 @@
10 reg = <0x00000000 0x40000000>; 10 reg = <0x00000000 0x40000000>;
11 }; 11 };
12 12
13 host1x {
14 hdmi {
15 status = "okay";
16
17 vdd-supply = <&hdmi_vdd_reg>;
18 pll-supply = <&hdmi_pll_reg>;
19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */
22 };
23 };
24
13 pinmux { 25 pinmux {
14 pinctrl-names = "default"; 26 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>; 27 pinctrl-0 = <&state_default>;
@@ -262,9 +274,9 @@
262 }; 274 };
263 }; 275 };
264 276
265 i2c@7000c400 { 277 hdmi_ddc: i2c@7000c400 {
266 status = "okay"; 278 status = "okay";
267 clock-frequency = <400000>; 279 clock-frequency = <100000>;
268 }; 280 };
269 281
270 i2c@7000c500 { 282 i2c@7000c500 {
@@ -297,131 +309,98 @@
297 vinldo9-supply = <&sm2_reg>; 309 vinldo9-supply = <&sm2_reg>;
298 310
299 regulators { 311 regulators {
300 #address-cells = <1>; 312 sys_reg: sys {
301 #size-cells = <0>;
302
303 sys_reg: regulator@0 {
304 reg = <0>;
305 regulator-compatible = "sys";
306 regulator-name = "vdd_sys"; 313 regulator-name = "vdd_sys";
307 regulator-always-on; 314 regulator-always-on;
308 }; 315 };
309 316
310 regulator@1 { 317 sm0 {
311 reg = <1>;
312 regulator-compatible = "sm0";
313 regulator-name = "vdd_sm0,vdd_core"; 318 regulator-name = "vdd_sm0,vdd_core";
314 regulator-min-microvolt = <1200000>; 319 regulator-min-microvolt = <1200000>;
315 regulator-max-microvolt = <1200000>; 320 regulator-max-microvolt = <1200000>;
316 regulator-always-on; 321 regulator-always-on;
317 }; 322 };
318 323
319 regulator@2 { 324 sm1 {
320 reg = <2>;
321 regulator-compatible = "sm1";
322 regulator-name = "vdd_sm1,vdd_cpu"; 325 regulator-name = "vdd_sm1,vdd_cpu";
323 regulator-min-microvolt = <1000000>; 326 regulator-min-microvolt = <1000000>;
324 regulator-max-microvolt = <1000000>; 327 regulator-max-microvolt = <1000000>;
325 regulator-always-on; 328 regulator-always-on;
326 }; 329 };
327 330
328 sm2_reg: regulator@3 { 331 sm2_reg: sm2 {
329 reg = <3>;
330 regulator-compatible = "sm2";
331 regulator-name = "vdd_sm2,vin_ldo*"; 332 regulator-name = "vdd_sm2,vin_ldo*";
332 regulator-min-microvolt = <3700000>; 333 regulator-min-microvolt = <3700000>;
333 regulator-max-microvolt = <3700000>; 334 regulator-max-microvolt = <3700000>;
334 regulator-always-on; 335 regulator-always-on;
335 }; 336 };
336 337
337 regulator@4 { 338 ldo0 {
338 reg = <4>;
339 regulator-compatible = "ldo0";
340 regulator-name = "vdd_ldo0,vddio_pex_clk"; 339 regulator-name = "vdd_ldo0,vddio_pex_clk";
341 regulator-min-microvolt = <3300000>; 340 regulator-min-microvolt = <3300000>;
342 regulator-max-microvolt = <3300000>; 341 regulator-max-microvolt = <3300000>;
343 }; 342 };
344 343
345 regulator@5 { 344 ldo1 {
346 reg = <5>;
347 regulator-compatible = "ldo1";
348 regulator-name = "vdd_ldo1,avdd_pll*"; 345 regulator-name = "vdd_ldo1,avdd_pll*";
349 regulator-min-microvolt = <1100000>; 346 regulator-min-microvolt = <1100000>;
350 regulator-max-microvolt = <1100000>; 347 regulator-max-microvolt = <1100000>;
351 regulator-always-on; 348 regulator-always-on;
352 }; 349 };
353 350
354 regulator@6 { 351 ldo2 {
355 reg = <6>;
356 regulator-compatible = "ldo2";
357 regulator-name = "vdd_ldo2,vdd_rtc"; 352 regulator-name = "vdd_ldo2,vdd_rtc";
358 regulator-min-microvolt = <1200000>; 353 regulator-min-microvolt = <1200000>;
359 regulator-max-microvolt = <1200000>; 354 regulator-max-microvolt = <1200000>;
360 }; 355 };
361 356
362 regulator@7 { 357 ldo3 {
363 reg = <7>;
364 regulator-compatible = "ldo3";
365 regulator-name = "vdd_ldo3,avdd_usb*"; 358 regulator-name = "vdd_ldo3,avdd_usb*";
366 regulator-min-microvolt = <3300000>; 359 regulator-min-microvolt = <3300000>;
367 regulator-max-microvolt = <3300000>; 360 regulator-max-microvolt = <3300000>;
368 regulator-always-on; 361 regulator-always-on;
369 }; 362 };
370 363
371 regulator@8 { 364 ldo4 {
372 reg = <8>;
373 regulator-compatible = "ldo4";
374 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys"; 365 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys";
375 regulator-min-microvolt = <1800000>; 366 regulator-min-microvolt = <1800000>;
376 regulator-max-microvolt = <1800000>; 367 regulator-max-microvolt = <1800000>;
377 regulator-always-on; 368 regulator-always-on;
378 }; 369 };
379 370
380 regulator@9 { 371 ldo5 {
381 reg = <9>;
382 regulator-compatible = "ldo5";
383 regulator-name = "vdd_ldo5,vcore_mmc"; 372 regulator-name = "vdd_ldo5,vcore_mmc";
384 regulator-min-microvolt = <2850000>; 373 regulator-min-microvolt = <2850000>;
385 regulator-max-microvolt = <2850000>; 374 regulator-max-microvolt = <2850000>;
386 regulator-always-on; 375 regulator-always-on;
387 }; 376 };
388 377
389 regulator@10 { 378 ldo6 {
390 reg = <10>;
391 regulator-compatible = "ldo6";
392 regulator-name = "vdd_ldo6,avdd_vdac"; 379 regulator-name = "vdd_ldo6,avdd_vdac";
393 regulator-min-microvolt = <1800000>; 380 regulator-min-microvolt = <1800000>;
394 regulator-max-microvolt = <1800000>; 381 regulator-max-microvolt = <1800000>;
395 }; 382 };
396 383
397 regulator@11 { 384 hdmi_vdd_reg: ldo7 {
398 reg = <11>;
399 regulator-compatible = "ldo7";
400 regulator-name = "vdd_ldo7,avdd_hdmi"; 385 regulator-name = "vdd_ldo7,avdd_hdmi";
401 regulator-min-microvolt = <3300000>; 386 regulator-min-microvolt = <3300000>;
402 regulator-max-microvolt = <3300000>; 387 regulator-max-microvolt = <3300000>;
403 }; 388 };
404 389
405 regulator@12 { 390 hdmi_pll_reg: ldo8 {
406 reg = <12>;
407 regulator-compatible = "ldo8";
408 regulator-name = "vdd_ldo8,avdd_hdmi_pll"; 391 regulator-name = "vdd_ldo8,avdd_hdmi_pll";
409 regulator-min-microvolt = <1800000>; 392 regulator-min-microvolt = <1800000>;
410 regulator-max-microvolt = <1800000>; 393 regulator-max-microvolt = <1800000>;
411 }; 394 };
412 395
413 regulator@13 { 396 ldo9 {
414 reg = <13>;
415 regulator-compatible = "ldo9";
416 regulator-name = "vdd_ldo9,avdd_2v85,vdd_ddr_rx"; 397 regulator-name = "vdd_ldo9,avdd_2v85,vdd_ddr_rx";
417 regulator-min-microvolt = <2850000>; 398 regulator-min-microvolt = <2850000>;
418 regulator-max-microvolt = <2850000>; 399 regulator-max-microvolt = <2850000>;
419 regulator-always-on; 400 regulator-always-on;
420 }; 401 };
421 402
422 regulator@14 { 403 ldo_rtc {
423 reg = <14>;
424 regulator-compatible = "ldo_rtc";
425 regulator-name = "vdd_rtc_out,vdd_cell"; 404 regulator-name = "vdd_rtc_out,vdd_cell";
426 regulator-min-microvolt = <3300000>; 405 regulator-min-microvolt = <3300000>;
427 regulator-max-microvolt = <3300000>; 406 regulator-max-microvolt = <3300000>;
@@ -429,6 +408,11 @@
429 }; 408 };
430 }; 409 };
431 }; 410 };
411
412 temperature-sensor@4c {
413 compatible = "adi,adt7461";
414 reg = <0x4c>;
415 };
432 }; 416 };
433 417
434 pmc { 418 pmc {
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index ddf287f52d4..6a93d1404c7 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -291,37 +291,26 @@
291 vinldo9-supply = <&sm2_reg>; 291 vinldo9-supply = <&sm2_reg>;
292 292
293 regulators { 293 regulators {
294 #address-cells = <1>; 294 sys_reg: sys {
295 #size-cells = <0>;
296
297 sys_reg: regulator@0 {
298 reg = <0>;
299 regulator-compatible = "sys";
300 regulator-name = "vdd_sys"; 295 regulator-name = "vdd_sys";
301 regulator-always-on; 296 regulator-always-on;
302 }; 297 };
303 298
304 regulator@1 { 299 sm0 {
305 reg = <1>;
306 regulator-compatible = "sm0";
307 regulator-name = "+1.2vs_sm0,vdd_core"; 300 regulator-name = "+1.2vs_sm0,vdd_core";
308 regulator-min-microvolt = <1200000>; 301 regulator-min-microvolt = <1200000>;
309 regulator-max-microvolt = <1200000>; 302 regulator-max-microvolt = <1200000>;
310 regulator-always-on; 303 regulator-always-on;
311 }; 304 };
312 305
313 regulator@2 { 306 sm1 {
314 reg = <2>;
315 regulator-compatible = "sm1";
316 regulator-name = "+1.0vs_sm1,vdd_cpu"; 307 regulator-name = "+1.0vs_sm1,vdd_cpu";
317 regulator-min-microvolt = <1000000>; 308 regulator-min-microvolt = <1000000>;
318 regulator-max-microvolt = <1000000>; 309 regulator-max-microvolt = <1000000>;
319 regulator-always-on; 310 regulator-always-on;
320 }; 311 };
321 312
322 sm2_reg: regulator@3 { 313 sm2_reg: sm2 {
323 reg = <3>;
324 regulator-compatible = "sm2";
325 regulator-name = "+3.7vs_sm2,vin_ldo*"; 314 regulator-name = "+3.7vs_sm2,vin_ldo*";
326 regulator-min-microvolt = <3700000>; 315 regulator-min-microvolt = <3700000>;
327 regulator-max-microvolt = <3700000>; 316 regulator-max-microvolt = <3700000>;
@@ -330,53 +319,41 @@
330 319
331 /* LDO0 is not connected to anything */ 320 /* LDO0 is not connected to anything */
332 321
333 regulator@5 { 322 ldo1 {
334 reg = <5>;
335 regulator-compatible = "ldo1";
336 regulator-name = "+1.1vs_ldo1,avdd_pll*"; 323 regulator-name = "+1.1vs_ldo1,avdd_pll*";
337 regulator-min-microvolt = <1100000>; 324 regulator-min-microvolt = <1100000>;
338 regulator-max-microvolt = <1100000>; 325 regulator-max-microvolt = <1100000>;
339 regulator-always-on; 326 regulator-always-on;
340 }; 327 };
341 328
342 regulator@6 { 329 ldo2 {
343 reg = <6>;
344 regulator-compatible = "ldo2";
345 regulator-name = "+1.2vs_ldo2,vdd_rtc"; 330 regulator-name = "+1.2vs_ldo2,vdd_rtc";
346 regulator-min-microvolt = <1200000>; 331 regulator-min-microvolt = <1200000>;
347 regulator-max-microvolt = <1200000>; 332 regulator-max-microvolt = <1200000>;
348 }; 333 };
349 334
350 regulator@7 { 335 ldo3 {
351 reg = <7>;
352 regulator-compatible = "ldo3";
353 regulator-name = "+3.3vs_ldo3,avdd_usb*"; 336 regulator-name = "+3.3vs_ldo3,avdd_usb*";
354 regulator-min-microvolt = <3300000>; 337 regulator-min-microvolt = <3300000>;
355 regulator-max-microvolt = <3300000>; 338 regulator-max-microvolt = <3300000>;
356 regulator-always-on; 339 regulator-always-on;
357 }; 340 };
358 341
359 regulator@8 { 342 ldo4 {
360 reg = <8>;
361 regulator-compatible = "ldo4";
362 regulator-name = "+1.8vs_ldo4,avdd_osc,vddio_sys"; 343 regulator-name = "+1.8vs_ldo4,avdd_osc,vddio_sys";
363 regulator-min-microvolt = <1800000>; 344 regulator-min-microvolt = <1800000>;
364 regulator-max-microvolt = <1800000>; 345 regulator-max-microvolt = <1800000>;
365 regulator-always-on; 346 regulator-always-on;
366 }; 347 };
367 348
368 regulator@9 { 349 ldo5 {
369 reg = <9>;
370 regulator-compatible = "ldo5";
371 regulator-name = "+2.85vs_ldo5,vcore_mmc"; 350 regulator-name = "+2.85vs_ldo5,vcore_mmc";
372 regulator-min-microvolt = <2850000>; 351 regulator-min-microvolt = <2850000>;
373 regulator-max-microvolt = <2850000>; 352 regulator-max-microvolt = <2850000>;
374 regulator-always-on; 353 regulator-always-on;
375 }; 354 };
376 355
377 regulator@10 { 356 ldo6 {
378 reg = <10>;
379 regulator-compatible = "ldo6";
380 /* 357 /*
381 * Research indicates this should be 358 * Research indicates this should be
382 * 1.8v; other boards that use this 359 * 1.8v; other boards that use this
@@ -390,34 +367,26 @@
390 regulator-max-microvolt = <1800000>; 367 regulator-max-microvolt = <1800000>;
391 }; 368 };
392 369
393 regulator@11 { 370 ldo7 {
394 reg = <11>;
395 regulator-compatible = "ldo7";
396 regulator-name = "+3.3vs_ldo7,avdd_hdmi"; 371 regulator-name = "+3.3vs_ldo7,avdd_hdmi";
397 regulator-min-microvolt = <3300000>; 372 regulator-min-microvolt = <3300000>;
398 regulator-max-microvolt = <3300000>; 373 regulator-max-microvolt = <3300000>;
399 }; 374 };
400 375
401 regulator@12 { 376 ldo8 {
402 reg = <12>;
403 regulator-compatible = "ldo8";
404 regulator-name = "+1.8vs_ldo8,avdd_hdmi_pll"; 377 regulator-name = "+1.8vs_ldo8,avdd_hdmi_pll";
405 regulator-min-microvolt = <1800000>; 378 regulator-min-microvolt = <1800000>;
406 regulator-max-microvolt = <1800000>; 379 regulator-max-microvolt = <1800000>;
407 }; 380 };
408 381
409 regulator@13 { 382 ldo9 {
410 reg = <13>;
411 regulator-compatible = "ldo9";
412 regulator-name = "+2.85vs_ldo9,vdd_ddr_rx"; 383 regulator-name = "+2.85vs_ldo9,vdd_ddr_rx";
413 regulator-min-microvolt = <2850000>; 384 regulator-min-microvolt = <2850000>;
414 regulator-max-microvolt = <2850000>; 385 regulator-max-microvolt = <2850000>;
415 regulator-always-on; 386 regulator-always-on;
416 }; 387 };
417 388
418 regulator@14 { 389 ldo_rtc {
419 reg = <14>;
420 regulator-compatible = "ldo_rtc";
421 regulator-name = "+3.3vs_rtc"; 390 regulator-name = "+3.3vs_rtc";
422 regulator-min-microvolt = <3300000>; 391 regulator-min-microvolt = <3300000>;
423 regulator-max-microvolt = <3300000>; 392 regulator-max-microvolt = <3300000>;
diff --git a/arch/arm/boot/dts/tegra20-plutux.dts b/arch/arm/boot/dts/tegra20-plutux.dts
index 331a3ef24d5..289480026fb 100644
--- a/arch/arm/boot/dts/tegra20-plutux.dts
+++ b/arch/arm/boot/dts/tegra20-plutux.dts
@@ -6,6 +6,12 @@
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 {
10 hdmi {
11 status = "okay";
12 };
13 };
14
9 i2c@7000c000 { 15 i2c@7000c000 {
10 wm8903: wm8903@1a { 16 wm8903: wm8903@1a {
11 compatible = "wlf,wm8903"; 17 compatible = "wlf,wm8903";
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index f0ba901676a..420459825b4 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -395,37 +395,26 @@
395 vinldo9-supply = <&sm2_reg>; 395 vinldo9-supply = <&sm2_reg>;
396 396
397 regulators { 397 regulators {
398 #address-cells = <1>; 398 sys_reg: sys {
399 #size-cells = <0>;
400
401 sys_reg: regulator@0 {
402 reg = <0>;
403 regulator-compatible = "sys";
404 regulator-name = "vdd_sys"; 399 regulator-name = "vdd_sys";
405 regulator-always-on; 400 regulator-always-on;
406 }; 401 };
407 402
408 regulator@1 { 403 sm0 {
409 reg = <1>;
410 regulator-compatible = "sm0";
411 regulator-name = "vdd_sm0,vdd_core"; 404 regulator-name = "vdd_sm0,vdd_core";
412 regulator-min-microvolt = <1300000>; 405 regulator-min-microvolt = <1300000>;
413 regulator-max-microvolt = <1300000>; 406 regulator-max-microvolt = <1300000>;
414 regulator-always-on; 407 regulator-always-on;
415 }; 408 };
416 409
417 regulator@2 { 410 sm1 {
418 reg = <2>;
419 regulator-compatible = "sm1";
420 regulator-name = "vdd_sm1,vdd_cpu"; 411 regulator-name = "vdd_sm1,vdd_cpu";
421 regulator-min-microvolt = <1125000>; 412 regulator-min-microvolt = <1125000>;
422 regulator-max-microvolt = <1125000>; 413 regulator-max-microvolt = <1125000>;
423 regulator-always-on; 414 regulator-always-on;
424 }; 415 };
425 416
426 sm2_reg: regulator@3 { 417 sm2_reg: sm2 {
427 reg = <3>;
428 regulator-compatible = "sm2";
429 regulator-name = "vdd_sm2,vin_ldo*"; 418 regulator-name = "vdd_sm2,vin_ldo*";
430 regulator-min-microvolt = <3700000>; 419 regulator-min-microvolt = <3700000>;
431 regulator-max-microvolt = <3700000>; 420 regulator-max-microvolt = <3700000>;
@@ -434,86 +423,66 @@
434 423
435 /* LDO0 is not connected to anything */ 424 /* LDO0 is not connected to anything */
436 425
437 regulator@5 { 426 ldo1 {
438 reg = <5>;
439 regulator-compatible = "ldo1";
440 regulator-name = "vdd_ldo1,avdd_pll*"; 427 regulator-name = "vdd_ldo1,avdd_pll*";
441 regulator-min-microvolt = <1100000>; 428 regulator-min-microvolt = <1100000>;
442 regulator-max-microvolt = <1100000>; 429 regulator-max-microvolt = <1100000>;
443 regulator-always-on; 430 regulator-always-on;
444 }; 431 };
445 432
446 regulator@6 { 433 ldo2 {
447 reg = <6>;
448 regulator-compatible = "ldo2";
449 regulator-name = "vdd_ldo2,vdd_rtc"; 434 regulator-name = "vdd_ldo2,vdd_rtc";
450 regulator-min-microvolt = <1200000>; 435 regulator-min-microvolt = <1200000>;
451 regulator-max-microvolt = <1200000>; 436 regulator-max-microvolt = <1200000>;
452 }; 437 };
453 438
454 regulator@7 { 439 ldo3 {
455 reg = <7>;
456 regulator-compatible = "ldo3";
457 regulator-name = "vdd_ldo3,avdd_usb*"; 440 regulator-name = "vdd_ldo3,avdd_usb*";
458 regulator-min-microvolt = <3300000>; 441 regulator-min-microvolt = <3300000>;
459 regulator-max-microvolt = <3300000>; 442 regulator-max-microvolt = <3300000>;
460 regulator-always-on; 443 regulator-always-on;
461 }; 444 };
462 445
463 regulator@8 { 446 ldo4 {
464 reg = <8>;
465 regulator-compatible = "ldo4";
466 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys"; 447 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys";
467 regulator-min-microvolt = <1800000>; 448 regulator-min-microvolt = <1800000>;
468 regulator-max-microvolt = <1800000>; 449 regulator-max-microvolt = <1800000>;
469 regulator-always-on; 450 regulator-always-on;
470 }; 451 };
471 452
472 regulator@9 { 453 ldo5 {
473 reg = <9>;
474 regulator-compatible = "ldo5";
475 regulator-name = "vdd_ldo5,vcore_mmc"; 454 regulator-name = "vdd_ldo5,vcore_mmc";
476 regulator-min-microvolt = <2850000>; 455 regulator-min-microvolt = <2850000>;
477 regulator-max-microvolt = <2850000>; 456 regulator-max-microvolt = <2850000>;
478 regulator-always-on; 457 regulator-always-on;
479 }; 458 };
480 459
481 regulator@10 { 460 ldo6 {
482 reg = <10>;
483 regulator-compatible = "ldo6";
484 regulator-name = "vdd_ldo6,avdd_vdac,vddio_vi,vddio_cam"; 461 regulator-name = "vdd_ldo6,avdd_vdac,vddio_vi,vddio_cam";
485 regulator-min-microvolt = <1800000>; 462 regulator-min-microvolt = <1800000>;
486 regulator-max-microvolt = <1800000>; 463 regulator-max-microvolt = <1800000>;
487 }; 464 };
488 465
489 regulator@11 { 466 ldo7 {
490 reg = <11>;
491 regulator-compatible = "ldo7";
492 regulator-name = "vdd_ldo7,avdd_hdmi,vdd_fuse"; 467 regulator-name = "vdd_ldo7,avdd_hdmi,vdd_fuse";
493 regulator-min-microvolt = <3300000>; 468 regulator-min-microvolt = <3300000>;
494 regulator-max-microvolt = <3300000>; 469 regulator-max-microvolt = <3300000>;
495 }; 470 };
496 471
497 regulator@12 { 472 ldo8 {
498 reg = <12>;
499 regulator-compatible = "ldo8";
500 regulator-name = "vdd_ldo8,avdd_hdmi_pll"; 473 regulator-name = "vdd_ldo8,avdd_hdmi_pll";
501 regulator-min-microvolt = <1800000>; 474 regulator-min-microvolt = <1800000>;
502 regulator-max-microvolt = <1800000>; 475 regulator-max-microvolt = <1800000>;
503 }; 476 };
504 477
505 regulator@13 { 478 ldo9 {
506 reg = <13>;
507 regulator-compatible = "ldo9";
508 regulator-name = "vdd_ldo9,avdd_2v85,vdd_ddr_rx"; 479 regulator-name = "vdd_ldo9,avdd_2v85,vdd_ddr_rx";
509 regulator-min-microvolt = <2850000>; 480 regulator-min-microvolt = <2850000>;
510 regulator-max-microvolt = <2850000>; 481 regulator-max-microvolt = <2850000>;
511 regulator-always-on; 482 regulator-always-on;
512 }; 483 };
513 484
514 regulator@14 { 485 ldo_rtc {
515 reg = <14>;
516 regulator-compatible = "ldo_rtc";
517 regulator-name = "vdd_rtc_out,vdd_cell"; 486 regulator-name = "vdd_rtc_out,vdd_cell";
518 regulator-min-microvolt = <3300000>; 487 regulator-min-microvolt = <3300000>;
519 regulator-max-microvolt = <3300000>; 488 regulator-max-microvolt = <3300000>;
@@ -523,12 +492,12 @@
523 }; 492 };
524 493
525 temperature-sensor@4c { 494 temperature-sensor@4c {
526 compatible = "nct1008"; 495 compatible = "onnn,nct1008";
527 reg = <0x4c>; 496 reg = <0x4c>;
528 }; 497 };
529 498
530 magnetometer@c { 499 magnetometer@c {
531 compatible = "ak8975"; 500 compatible = "ak,ak8975";
532 reg = <0xc>; 501 reg = <0xc>;
533 interrupt-parent = <&gpio>; 502 interrupt-parent = <&gpio>;
534 interrupts = <109 0x04>; /* gpio PN5 */ 503 interrupts = <109 0x04>; /* gpio PN5 */
@@ -592,6 +561,12 @@
592 status = "okay"; 561 status = "okay";
593 }; 562 };
594 563
564 sdhci@c8000000 {
565 status = "okay";
566 power-gpios = <&gpio 86 0>; /* gpio PK6 */
567 bus-width = <4>;
568 };
569
595 sdhci@c8000400 { 570 sdhci@c8000400 {
596 status = "okay"; 571 status = "okay";
597 cd-gpios = <&gpio 69 0>; /* gpio PI5 */ 572 cd-gpios = <&gpio 69 0>; /* gpio PI5 */
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
index f18cec9f6a7..a239ccdfaa5 100644
--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
@@ -8,6 +8,16 @@
8 reg = <0x00000000 0x20000000>; 8 reg = <0x00000000 0x20000000>;
9 }; 9 };
10 10
11 host1x {
12 hdmi {
13 vdd-supply = <&hdmi_vdd_reg>;
14 pll-supply = <&hdmi_pll_reg>;
15
16 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
17 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */
18 };
19 };
20
11 pinmux { 21 pinmux {
12 pinctrl-names = "default"; 22 pinctrl-names = "default";
13 pinctrl-0 = <&state_default>; 23 pinctrl-0 = <&state_default>;
@@ -62,10 +72,6 @@
62 nvidia,pins = "dap4"; 72 nvidia,pins = "dap4";
63 nvidia,function = "dap4"; 73 nvidia,function = "dap4";
64 }; 74 };
65 ddc {
66 nvidia,pins = "ddc";
67 nvidia,function = "i2c2";
68 };
69 dta { 75 dta {
70 nvidia,pins = "dta", "dtd"; 76 nvidia,pins = "dta", "dtd";
71 nvidia,function = "sdio2"; 77 nvidia,function = "sdio2";
@@ -91,7 +97,7 @@
91 nvidia,function = "pcie"; 97 nvidia,function = "pcie";
92 }; 98 };
93 hdint { 99 hdint {
94 nvidia,pins = "hdint", "pta"; 100 nvidia,pins = "hdint";
95 nvidia,function = "hdmi"; 101 nvidia,function = "hdmi";
96 }; 102 };
97 i2cp { 103 i2cp {
@@ -230,6 +236,39 @@
230 nvidia,pull = <1>; 236 nvidia,pull = <1>;
231 }; 237 };
232 }; 238 };
239
240 state_i2cmux_ddc: pinmux_i2cmux_ddc {
241 ddc {
242 nvidia,pins = "ddc";
243 nvidia,function = "i2c2";
244 };
245 pta {
246 nvidia,pins = "pta";
247 nvidia,function = "rsvd4";
248 };
249 };
250
251 state_i2cmux_pta: pinmux_i2cmux_pta {
252 ddc {
253 nvidia,pins = "ddc";
254 nvidia,function = "rsvd4";
255 };
256 pta {
257 nvidia,pins = "pta";
258 nvidia,function = "i2c2";
259 };
260 };
261
262 state_i2cmux_idle: pinmux_i2cmux_idle {
263 ddc {
264 nvidia,pins = "ddc";
265 nvidia,function = "rsvd4";
266 };
267 pta {
268 nvidia,pins = "pta";
269 nvidia,function = "rsvd4";
270 };
271 };
233 }; 272 };
234 273
235 i2s@70002800 { 274 i2s@70002800 {
@@ -246,6 +285,36 @@
246 status = "okay"; 285 status = "okay";
247 }; 286 };
248 287
288 i2c@7000c400 {
289 clock-frequency = <100000>;
290 status = "okay";
291 };
292
293 i2cmux {
294 compatible = "i2c-mux-pinctrl";
295 #address-cells = <1>;
296 #size-cells = <0>;
297
298 i2c-parent = <&{/i2c@7000c400}>;
299
300 pinctrl-names = "ddc", "pta", "idle";
301 pinctrl-0 = <&state_i2cmux_ddc>;
302 pinctrl-1 = <&state_i2cmux_pta>;
303 pinctrl-2 = <&state_i2cmux_idle>;
304
305 hdmi_ddc: i2c@0 {
306 reg = <0>;
307 #address-cells = <1>;
308 #size-cells = <0>;
309 };
310
311 i2c@1 {
312 reg = <1>;
313 #address-cells = <1>;
314 #size-cells = <0>;
315 };
316 };
317
249 i2c@7000d000 { 318 i2c@7000d000 {
250 clock-frequency = <400000>; 319 clock-frequency = <400000>;
251 status = "okay"; 320 status = "okay";
@@ -271,97 +340,72 @@
271 vinldo9-supply = <&sm2_reg>; 340 vinldo9-supply = <&sm2_reg>;
272 341
273 regulators { 342 regulators {
274 #address-cells = <1>; 343 sys_reg: sys {
275 #size-cells = <0>;
276
277 sys_reg: regulator@0 {
278 reg = <0>;
279 regulator-compatible = "sys";
280 regulator-name = "vdd_sys"; 344 regulator-name = "vdd_sys";
281 regulator-always-on; 345 regulator-always-on;
282 }; 346 };
283 347
284 regulator@1 { 348 sm0 {
285 reg = <1>;
286 regulator-compatible = "sm0";
287 regulator-name = "vdd_sys_sm0,vdd_core"; 349 regulator-name = "vdd_sys_sm0,vdd_core";
288 regulator-min-microvolt = <1200000>; 350 regulator-min-microvolt = <1200000>;
289 regulator-max-microvolt = <1200000>; 351 regulator-max-microvolt = <1200000>;
290 regulator-always-on; 352 regulator-always-on;
291 }; 353 };
292 354
293 regulator@2 { 355 sm1 {
294 reg = <2>;
295 regulator-compatible = "sm1";
296 regulator-name = "vdd_sys_sm1,vdd_cpu"; 356 regulator-name = "vdd_sys_sm1,vdd_cpu";
297 regulator-min-microvolt = <1000000>; 357 regulator-min-microvolt = <1000000>;
298 regulator-max-microvolt = <1000000>; 358 regulator-max-microvolt = <1000000>;
299 regulator-always-on; 359 regulator-always-on;
300 }; 360 };
301 361
302 sm2_reg: regulator@3 { 362 sm2_reg: sm2 {
303 reg = <3>;
304 regulator-compatible = "sm2";
305 regulator-name = "vdd_sys_sm2,vin_ldo*"; 363 regulator-name = "vdd_sys_sm2,vin_ldo*";
306 regulator-min-microvolt = <3700000>; 364 regulator-min-microvolt = <3700000>;
307 regulator-max-microvolt = <3700000>; 365 regulator-max-microvolt = <3700000>;
308 regulator-always-on; 366 regulator-always-on;
309 }; 367 };
310 368
311 regulator@4 { 369 ldo0 {
312 reg = <4>;
313 regulator-compatible = "ldo0";
314 regulator-name = "vdd_ldo0,vddio_pex_clk"; 370 regulator-name = "vdd_ldo0,vddio_pex_clk";
315 regulator-min-microvolt = <3300000>; 371 regulator-min-microvolt = <3300000>;
316 regulator-max-microvolt = <3300000>; 372 regulator-max-microvolt = <3300000>;
317 }; 373 };
318 374
319 regulator@5 { 375 ldo1 {
320 reg = <5>;
321 regulator-compatible = "ldo1";
322 regulator-name = "vdd_ldo1,avdd_pll*"; 376 regulator-name = "vdd_ldo1,avdd_pll*";
323 regulator-min-microvolt = <1100000>; 377 regulator-min-microvolt = <1100000>;
324 regulator-max-microvolt = <1100000>; 378 regulator-max-microvolt = <1100000>;
325 regulator-always-on; 379 regulator-always-on;
326 }; 380 };
327 381
328 regulator@6 { 382 ldo2 {
329 reg = <6>;
330 regulator-compatible = "ldo2";
331 regulator-name = "vdd_ldo2,vdd_rtc"; 383 regulator-name = "vdd_ldo2,vdd_rtc";
332 regulator-min-microvolt = <1200000>; 384 regulator-min-microvolt = <1200000>;
333 regulator-max-microvolt = <1200000>; 385 regulator-max-microvolt = <1200000>;
334 }; 386 };
335 387
336 regulator@7 { 388 ldo3 {
337 reg = <7>;
338 regulator-compatible = "ldo3";
339 regulator-name = "vdd_ldo3,avdd_usb*"; 389 regulator-name = "vdd_ldo3,avdd_usb*";
340 regulator-min-microvolt = <3300000>; 390 regulator-min-microvolt = <3300000>;
341 regulator-max-microvolt = <3300000>; 391 regulator-max-microvolt = <3300000>;
342 regulator-always-on; 392 regulator-always-on;
343 }; 393 };
344 394
345 regulator@8 { 395 ldo4 {
346 reg = <8>;
347 regulator-compatible = "ldo4";
348 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys"; 396 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys";
349 regulator-min-microvolt = <1800000>; 397 regulator-min-microvolt = <1800000>;
350 regulator-max-microvolt = <1800000>; 398 regulator-max-microvolt = <1800000>;
351 regulator-always-on; 399 regulator-always-on;
352 }; 400 };
353 401
354 regulator@9 { 402 ldo5 {
355 reg = <9>;
356 regulator-compatible = "ldo5";
357 regulator-name = "vdd_ldo5,vcore_mmc"; 403 regulator-name = "vdd_ldo5,vcore_mmc";
358 regulator-min-microvolt = <2850000>; 404 regulator-min-microvolt = <2850000>;
359 regulator-max-microvolt = <2850000>; 405 regulator-max-microvolt = <2850000>;
360 }; 406 };
361 407
362 regulator@10 { 408 ldo6 {
363 reg = <10>;
364 regulator-compatible = "ldo6";
365 regulator-name = "vdd_ldo6,avdd_vdac"; 409 regulator-name = "vdd_ldo6,avdd_vdac";
366 /* 410 /*
367 * According to the Tegra 2 Automotive 411 * According to the Tegra 2 Automotive
@@ -373,25 +417,19 @@
373 regulator-max-microvolt = <2850000>; 417 regulator-max-microvolt = <2850000>;
374 }; 418 };
375 419
376 regulator@11 { 420 hdmi_vdd_reg: ldo7 {
377 reg = <11>;
378 regulator-compatible = "ldo7";
379 regulator-name = "vdd_ldo7,avdd_hdmi"; 421 regulator-name = "vdd_ldo7,avdd_hdmi";
380 regulator-min-microvolt = <3300000>; 422 regulator-min-microvolt = <3300000>;
381 regulator-max-microvolt = <3300000>; 423 regulator-max-microvolt = <3300000>;
382 }; 424 };
383 425
384 regulator@12 { 426 hdmi_pll_reg: ldo8 {
385 reg = <12>;
386 regulator-compatible = "ldo8";
387 regulator-name = "vdd_ldo8,avdd_hdmi_pll"; 427 regulator-name = "vdd_ldo8,avdd_hdmi_pll";
388 regulator-min-microvolt = <1800000>; 428 regulator-min-microvolt = <1800000>;
389 regulator-max-microvolt = <1800000>; 429 regulator-max-microvolt = <1800000>;
390 }; 430 };
391 431
392 regulator@13 { 432 ldo9 {
393 reg = <13>;
394 regulator-compatible = "ldo9";
395 regulator-name = "vdd_ldo9,vdd_ddr_rx,avdd_cam"; 433 regulator-name = "vdd_ldo9,vdd_ddr_rx,avdd_cam";
396 /* 434 /*
397 * According to the Tegra 2 Automotive 435 * According to the Tegra 2 Automotive
@@ -404,9 +442,7 @@
404 regulator-always-on; 442 regulator-always-on;
405 }; 443 };
406 444
407 regulator@14 { 445 ldo_rtc {
408 reg = <14>;
409 regulator-compatible = "ldo_rtc";
410 regulator-name = "vdd_rtc_out"; 446 regulator-name = "vdd_rtc_out";
411 regulator-min-microvolt = <3300000>; 447 regulator-min-microvolt = <3300000>;
412 regulator-max-microvolt = <3300000>; 448 regulator-max-microvolt = <3300000>;
@@ -414,6 +450,11 @@
414 }; 450 };
415 }; 451 };
416 }; 452 };
453
454 temperature-sensor@4c {
455 compatible = "onnn,nct1008";
456 reg = <0x4c>;
457 };
417 }; 458 };
418 459
419 pmc { 460 pmc {
diff --git a/arch/arm/boot/dts/tegra20-tec.dts b/arch/arm/boot/dts/tegra20-tec.dts
index 9aff31b0fe4..402b21004be 100644
--- a/arch/arm/boot/dts/tegra20-tec.dts
+++ b/arch/arm/boot/dts/tegra20-tec.dts
@@ -6,10 +6,13 @@
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 i2c@7000c000 { 9 host1x {
10 clock-frequency = <400000>; 10 hdmi {
11 status = "okay"; 11 status = "okay";
12 };
13 };
12 14
15 i2c@7000c000 {
13 wm8903: wm8903@1a { 16 wm8903: wm8903@1a {
14 compatible = "wlf,wm8903"; 17 compatible = "wlf,wm8903";
15 reg = <0x1a>; 18 reg = <0x1a>;
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index 27fb8a67ea4..b70b4cb754c 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -10,6 +10,18 @@
10 reg = <0x00000000 0x40000000>; 10 reg = <0x00000000 0x40000000>;
11 }; 11 };
12 12
13 host1x {
14 hdmi {
15 status = "okay";
16
17 vdd-supply = <&hdmi_vdd_reg>;
18 pll-supply = <&hdmi_pll_reg>;
19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */
22 };
23 };
24
13 pinmux { 25 pinmux {
14 pinctrl-names = "default"; 26 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>; 27 pinctrl-0 = <&state_default>;
@@ -249,14 +261,24 @@
249 clock-frequency = <216000000>; 261 clock-frequency = <216000000>;
250 }; 262 };
251 263
252 i2c@7000c000 { 264 dvi_ddc: i2c@7000c000 {
253 status = "okay"; 265 status = "okay";
254 clock-frequency = <400000>; 266 clock-frequency = <100000>;
255 }; 267 };
256 268
257 i2c@7000c400 { 269 spi@7000c380 {
258 status = "okay"; 270 status = "okay";
259 clock-frequency = <400000>; 271 spi-max-frequency = <48000000>;
272 spi-flash@0 {
273 compatible = "winbond,w25q80bl";
274 reg = <0>;
275 spi-max-frequency = <48000000>;
276 };
277 };
278
279 hdmi_ddc: i2c@7000c400 {
280 status = "okay";
281 clock-frequency = <100000>;
260 }; 282 };
261 283
262 i2c@7000c500 { 284 i2c@7000c500 {
@@ -300,6 +322,30 @@
300 bus-width = <4>; 322 bus-width = <4>;
301 }; 323 };
302 324
325 regulators {
326 compatible = "simple-bus";
327 #address-cells = <1>;
328 #size-cells = <0>;
329
330 hdmi_vdd_reg: regulator@0 {
331 compatible = "regulator-fixed";
332 reg = <0>;
333 regulator-name = "avdd_hdmi";
334 regulator-min-microvolt = <3300000>;
335 regulator-max-microvolt = <3300000>;
336 regulator-always-on;
337 };
338
339 hdmi_pll_reg: regulator@1 {
340 compatible = "regulator-fixed";
341 reg = <1>;
342 regulator-name = "avdd_hdmi_pll";
343 regulator-min-microvolt = <1800000>;
344 regulator-max-microvolt = <1800000>;
345 regulator-always-on;
346 };
347 };
348
303 sound { 349 sound {
304 compatible = "nvidia,tegra-audio-trimslice"; 350 compatible = "nvidia,tegra-audio-trimslice";
305 nvidia,i2s-controller = <&tegra_i2s1>; 351 nvidia,i2s-controller = <&tegra_i2s1>;
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts
index 3e5952fcfbc..adc47547eaa 100644
--- a/arch/arm/boot/dts/tegra20-ventana.dts
+++ b/arch/arm/boot/dts/tegra20-ventana.dts
@@ -64,11 +64,6 @@
64 nvidia,pins = "dap4"; 64 nvidia,pins = "dap4";
65 nvidia,function = "dap4"; 65 nvidia,function = "dap4";
66 }; 66 };
67 ddc {
68 nvidia,pins = "ddc", "owc", "spdi", "spdo",
69 "uac";
70 nvidia,function = "rsvd2";
71 };
72 dta { 67 dta {
73 nvidia,pins = "dta", "dtb", "dtc", "dtd", "dte"; 68 nvidia,pins = "dta", "dtb", "dtc", "dtd", "dte";
74 nvidia,function = "vi"; 69 nvidia,function = "vi";
@@ -98,7 +93,7 @@
98 nvidia,function = "pcie"; 93 nvidia,function = "pcie";
99 }; 94 };
100 hdint { 95 hdint {
101 nvidia,pins = "hdint", "pta"; 96 nvidia,pins = "hdint";
102 nvidia,function = "hdmi"; 97 nvidia,function = "hdmi";
103 }; 98 };
104 i2cp { 99 i2cp {
@@ -129,6 +124,10 @@
129 "lspi", "lvp1", "lvs"; 124 "lspi", "lvp1", "lvs";
130 nvidia,function = "displaya"; 125 nvidia,function = "displaya";
131 }; 126 };
127 owc {
128 nvidia,pins = "owc", "spdi", "spdo", "uac";
129 nvidia,function = "rsvd2";
130 };
132 pmc { 131 pmc {
133 nvidia,pins = "pmc"; 132 nvidia,pins = "pmc";
134 nvidia,function = "pwr_on"; 133 nvidia,function = "pwr_on";
@@ -237,6 +236,49 @@
237 "ld23_22"; 236 "ld23_22";
238 nvidia,pull = <1>; 237 nvidia,pull = <1>;
239 }; 238 };
239 drive_sdio1 {
240 nvidia,pins = "drive_sdio1";
241 nvidia,high-speed-mode = <0>;
242 nvidia,schmitt = <1>;
243 nvidia,low-power-mode = <3>;
244 nvidia,pull-down-strength = <31>;
245 nvidia,pull-up-strength = <31>;
246 nvidia,slew-rate-rising = <3>;
247 nvidia,slew-rate-falling = <3>;
248 };
249 };
250
251 state_i2cmux_ddc: pinmux_i2cmux_ddc {
252 ddc {
253 nvidia,pins = "ddc";
254 nvidia,function = "i2c2";
255 };
256 pta {
257 nvidia,pins = "pta";
258 nvidia,function = "rsvd4";
259 };
260 };
261
262 state_i2cmux_pta: pinmux_i2cmux_pta {
263 ddc {
264 nvidia,pins = "ddc";
265 nvidia,function = "rsvd4";
266 };
267 pta {
268 nvidia,pins = "pta";
269 nvidia,function = "i2c2";
270 };
271 };
272
273 state_i2cmux_idle: pinmux_i2cmux_idle {
274 ddc {
275 nvidia,pins = "ddc";
276 nvidia,function = "rsvd4";
277 };
278 pta {
279 nvidia,pins = "pta";
280 nvidia,function = "rsvd4";
281 };
240 }; 282 };
241 }; 283 };
242 284
@@ -281,6 +323,31 @@
281 clock-frequency = <400000>; 323 clock-frequency = <400000>;
282 }; 324 };
283 325
326 i2cmux {
327 compatible = "i2c-mux-pinctrl";
328 #address-cells = <1>;
329 #size-cells = <0>;
330
331 i2c-parent = <&{/i2c@7000c400}>;
332
333 pinctrl-names = "ddc", "pta", "idle";
334 pinctrl-0 = <&state_i2cmux_ddc>;
335 pinctrl-1 = <&state_i2cmux_pta>;
336 pinctrl-2 = <&state_i2cmux_idle>;
337
338 i2c@0 {
339 reg = <0>;
340 #address-cells = <1>;
341 #size-cells = <0>;
342 };
343
344 i2c@1 {
345 reg = <1>;
346 #address-cells = <1>;
347 #size-cells = <0>;
348 };
349 };
350
284 i2c@7000c500 { 351 i2c@7000c500 {
285 status = "okay"; 352 status = "okay";
286 clock-frequency = <400000>; 353 clock-frequency = <400000>;
@@ -311,37 +378,26 @@
311 vinldo9-supply = <&sm2_reg>; 378 vinldo9-supply = <&sm2_reg>;
312 379
313 regulators { 380 regulators {
314 #address-cells = <1>; 381 sys_reg: sys {
315 #size-cells = <0>;
316
317 sys_reg: regulator@0 {
318 reg = <0>;
319 regulator-compatible = "sys";
320 regulator-name = "vdd_sys"; 382 regulator-name = "vdd_sys";
321 regulator-always-on; 383 regulator-always-on;
322 }; 384 };
323 385
324 regulator@1 { 386 sm0 {
325 reg = <1>;
326 regulator-compatible = "sm0";
327 regulator-name = "vdd_sm0,vdd_core"; 387 regulator-name = "vdd_sm0,vdd_core";
328 regulator-min-microvolt = <1200000>; 388 regulator-min-microvolt = <1200000>;
329 regulator-max-microvolt = <1200000>; 389 regulator-max-microvolt = <1200000>;
330 regulator-always-on; 390 regulator-always-on;
331 }; 391 };
332 392
333 regulator@2 { 393 sm1 {
334 reg = <2>;
335 regulator-compatible = "sm1";
336 regulator-name = "vdd_sm1,vdd_cpu"; 394 regulator-name = "vdd_sm1,vdd_cpu";
337 regulator-min-microvolt = <1000000>; 395 regulator-min-microvolt = <1000000>;
338 regulator-max-microvolt = <1000000>; 396 regulator-max-microvolt = <1000000>;
339 regulator-always-on; 397 regulator-always-on;
340 }; 398 };
341 399
342 sm2_reg: regulator@3 { 400 sm2_reg: sm2 {
343 reg = <3>;
344 regulator-compatible = "sm2";
345 regulator-name = "vdd_sm2,vin_ldo*"; 401 regulator-name = "vdd_sm2,vin_ldo*";
346 regulator-min-microvolt = <3700000>; 402 regulator-min-microvolt = <3700000>;
347 regulator-max-microvolt = <3700000>; 403 regulator-max-microvolt = <3700000>;
@@ -350,86 +406,66 @@
350 406
351 /* LDO0 is not connected to anything */ 407 /* LDO0 is not connected to anything */
352 408
353 regulator@5 { 409 ldo1 {
354 reg = <5>;
355 regulator-compatible = "ldo1";
356 regulator-name = "vdd_ldo1,avdd_pll*"; 410 regulator-name = "vdd_ldo1,avdd_pll*";
357 regulator-min-microvolt = <1100000>; 411 regulator-min-microvolt = <1100000>;
358 regulator-max-microvolt = <1100000>; 412 regulator-max-microvolt = <1100000>;
359 regulator-always-on; 413 regulator-always-on;
360 }; 414 };
361 415
362 regulator@6 { 416 ldo2 {
363 reg = <6>;
364 regulator-compatible = "ldo2";
365 regulator-name = "vdd_ldo2,vdd_rtc"; 417 regulator-name = "vdd_ldo2,vdd_rtc";
366 regulator-min-microvolt = <1200000>; 418 regulator-min-microvolt = <1200000>;
367 regulator-max-microvolt = <1200000>; 419 regulator-max-microvolt = <1200000>;
368 }; 420 };
369 421
370 regulator@7 { 422 ldo3 {
371 reg = <7>;
372 regulator-compatible = "ldo3";
373 regulator-name = "vdd_ldo3,avdd_usb*"; 423 regulator-name = "vdd_ldo3,avdd_usb*";
374 regulator-min-microvolt = <3300000>; 424 regulator-min-microvolt = <3300000>;
375 regulator-max-microvolt = <3300000>; 425 regulator-max-microvolt = <3300000>;
376 regulator-always-on; 426 regulator-always-on;
377 }; 427 };
378 428
379 regulator@8 { 429 ldo4 {
380 reg = <8>;
381 regulator-compatible = "ldo4";
382 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys"; 430 regulator-name = "vdd_ldo4,avdd_osc,vddio_sys";
383 regulator-min-microvolt = <1800000>; 431 regulator-min-microvolt = <1800000>;
384 regulator-max-microvolt = <1800000>; 432 regulator-max-microvolt = <1800000>;
385 regulator-always-on; 433 regulator-always-on;
386 }; 434 };
387 435
388 regulator@9 { 436 ldo5 {
389 reg = <9>;
390 regulator-compatible = "ldo5";
391 regulator-name = "vdd_ldo5,vcore_mmc"; 437 regulator-name = "vdd_ldo5,vcore_mmc";
392 regulator-min-microvolt = <2850000>; 438 regulator-min-microvolt = <2850000>;
393 regulator-max-microvolt = <2850000>; 439 regulator-max-microvolt = <2850000>;
394 regulator-always-on; 440 regulator-always-on;
395 }; 441 };
396 442
397 regulator@10 { 443 ldo6 {
398 reg = <10>;
399 regulator-compatible = "ldo6";
400 regulator-name = "vdd_ldo6,avdd_vdac"; 444 regulator-name = "vdd_ldo6,avdd_vdac";
401 regulator-min-microvolt = <1800000>; 445 regulator-min-microvolt = <1800000>;
402 regulator-max-microvolt = <1800000>; 446 regulator-max-microvolt = <1800000>;
403 }; 447 };
404 448
405 regulator@11 { 449 ldo7 {
406 reg = <11>;
407 regulator-compatible = "ldo7";
408 regulator-name = "vdd_ldo7,avdd_hdmi,vdd_fuse"; 450 regulator-name = "vdd_ldo7,avdd_hdmi,vdd_fuse";
409 regulator-min-microvolt = <3300000>; 451 regulator-min-microvolt = <3300000>;
410 regulator-max-microvolt = <3300000>; 452 regulator-max-microvolt = <3300000>;
411 }; 453 };
412 454
413 regulator@12 { 455 ldo8 {
414 reg = <12>;
415 regulator-compatible = "ldo8";
416 regulator-name = "vdd_ldo8,avdd_hdmi_pll"; 456 regulator-name = "vdd_ldo8,avdd_hdmi_pll";
417 regulator-min-microvolt = <1800000>; 457 regulator-min-microvolt = <1800000>;
418 regulator-max-microvolt = <1800000>; 458 regulator-max-microvolt = <1800000>;
419 }; 459 };
420 460
421 regulator@13 { 461 ldo9 {
422 reg = <13>;
423 regulator-compatible = "ldo9";
424 regulator-name = "vdd_ldo9,avdd_2v85,vdd_ddr_rx"; 462 regulator-name = "vdd_ldo9,avdd_2v85,vdd_ddr_rx";
425 regulator-min-microvolt = <2850000>; 463 regulator-min-microvolt = <2850000>;
426 regulator-max-microvolt = <2850000>; 464 regulator-max-microvolt = <2850000>;
427 regulator-always-on; 465 regulator-always-on;
428 }; 466 };
429 467
430 regulator@14 { 468 ldo_rtc {
431 reg = <14>;
432 regulator-compatible = "ldo_rtc";
433 regulator-name = "vdd_rtc_out,vdd_cell"; 469 regulator-name = "vdd_rtc_out,vdd_cell";
434 regulator-min-microvolt = <3300000>; 470 regulator-min-microvolt = <3300000>;
435 regulator-max-microvolt = <3300000>; 471 regulator-max-microvolt = <3300000>;
@@ -437,6 +473,11 @@
437 }; 473 };
438 }; 474 };
439 }; 475 };
476
477 temperature-sensor@4c {
478 compatible = "onnn,nct1008";
479 reg = <0x4c>;
480 };
440 }; 481 };
441 482
442 pmc { 483 pmc {
@@ -456,6 +497,12 @@
456 status = "okay"; 497 status = "okay";
457 }; 498 };
458 499
500 sdhci@c8000000 {
501 status = "okay";
502 power-gpios = <&gpio 86 0>; /* gpio PK6 */
503 bus-width = <4>;
504 };
505
459 sdhci@c8000400 { 506 sdhci@c8000400 {
460 status = "okay"; 507 status = "okay";
461 cd-gpios = <&gpio 69 0>; /* gpio PI5 */ 508 cd-gpios = <&gpio 69 0>; /* gpio PI5 */
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts
index c636d002d6d..20d576ecd55 100644
--- a/arch/arm/boot/dts/tegra20-whistler.dts
+++ b/arch/arm/boot/dts/tegra20-whistler.dts
@@ -10,6 +10,18 @@
10 reg = <0x00000000 0x20000000>; 10 reg = <0x00000000 0x20000000>;
11 }; 11 };
12 12
13 host1x {
14 hdmi {
15 status = "okay";
16
17 vdd-supply = <&hdmi_vdd_reg>;
18 pll-supply = <&hdmi_pll_reg>;
19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */
22 };
23 };
24
13 pinmux { 25 pinmux {
14 pinctrl-names = "default"; 26 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>; 27 pinctrl-0 = <&state_default>;
@@ -246,6 +258,11 @@
246 clock-frequency = <216000000>; 258 clock-frequency = <216000000>;
247 }; 259 };
248 260
261 hdmi_ddc: i2c@7000c400 {
262 status = "okay";
263 clock-frequency = <100000>;
264 };
265
249 i2c@7000d000 { 266 i2c@7000d000 {
250 status = "okay"; 267 status = "okay";
251 clock-frequency = <100000>; 268 clock-frequency = <100000>;
@@ -295,243 +312,182 @@
295 in20-supply = <&mbatt_reg>; 312 in20-supply = <&mbatt_reg>;
296 313
297 regulators { 314 regulators {
298 #address-cells = <1>; 315 mbatt_reg: mbatt {
299 #size-cells = <0>;
300
301 mbatt_reg: regulator@0 {
302 reg = <0>;
303 regulator-compatible = "mbatt";
304 regulator-name = "vbat_pmu"; 316 regulator-name = "vbat_pmu";
305 regulator-always-on; 317 regulator-always-on;
306 }; 318 };
307 319
308 regulator@1 { 320 sd1 {
309 reg = <1>;
310 regulator-compatible = "sd1";
311 regulator-name = "nvvdd_sv1,vdd_cpu_pmu"; 321 regulator-name = "nvvdd_sv1,vdd_cpu_pmu";
312 regulator-min-microvolt = <1000000>; 322 regulator-min-microvolt = <1000000>;
313 regulator-max-microvolt = <1000000>; 323 regulator-max-microvolt = <1000000>;
314 regulator-always-on; 324 regulator-always-on;
315 }; 325 };
316 326
317 regulator@2 { 327 sd2 {
318 reg = <2>;
319 regulator-compatible = "sd2";
320 regulator-name = "nvvdd_sv2,vdd_core"; 328 regulator-name = "nvvdd_sv2,vdd_core";
321 regulator-min-microvolt = <1200000>; 329 regulator-min-microvolt = <1200000>;
322 regulator-max-microvolt = <1200000>; 330 regulator-max-microvolt = <1200000>;
323 regulator-always-on; 331 regulator-always-on;
324 }; 332 };
325 333
326 nvvdd_sv3_reg: regulator@3 { 334 nvvdd_sv3_reg: sd3 {
327 reg = <3>;
328 regulator-compatible = "sd3";
329 regulator-name = "nvvdd_sv3"; 335 regulator-name = "nvvdd_sv3";
330 regulator-min-microvolt = <1800000>; 336 regulator-min-microvolt = <1800000>;
331 regulator-max-microvolt = <1800000>; 337 regulator-max-microvolt = <1800000>;
332 regulator-always-on; 338 regulator-always-on;
333 }; 339 };
334 340
335 regulator@4 { 341 ldo1 {
336 reg = <4>;
337 regulator-compatible = "ldo1";
338 regulator-name = "nvvdd_ldo1,vddio_rx_ddr,vcore_acc"; 342 regulator-name = "nvvdd_ldo1,vddio_rx_ddr,vcore_acc";
339 regulator-min-microvolt = <3300000>; 343 regulator-min-microvolt = <3300000>;
340 regulator-max-microvolt = <3300000>; 344 regulator-max-microvolt = <3300000>;
341 regulator-always-on; 345 regulator-always-on;
342 }; 346 };
343 347
344 regulator@5 { 348 ldo2 {
345 reg = <5>;
346 regulator-compatible = "ldo2";
347 regulator-name = "nvvdd_ldo2,avdd_pll*"; 349 regulator-name = "nvvdd_ldo2,avdd_pll*";
348 regulator-min-microvolt = <1100000>; 350 regulator-min-microvolt = <1100000>;
349 regulator-max-microvolt = <1100000>; 351 regulator-max-microvolt = <1100000>;
350 regulator-always-on; 352 regulator-always-on;
351 }; 353 };
352 354
353 regulator@6 { 355 ldo3 {
354 reg = <6>;
355 regulator-compatible = "ldo3";
356 regulator-name = "nvvdd_ldo3,vcom_1v8b"; 356 regulator-name = "nvvdd_ldo3,vcom_1v8b";
357 regulator-min-microvolt = <1800000>; 357 regulator-min-microvolt = <1800000>;
358 regulator-max-microvolt = <1800000>; 358 regulator-max-microvolt = <1800000>;
359 regulator-always-on; 359 regulator-always-on;
360 }; 360 };
361 361
362 regulator@7 { 362 ldo4 {
363 reg = <7>;
364 regulator-compatible = "ldo4";
365 regulator-name = "nvvdd_ldo4,avdd_usb*"; 363 regulator-name = "nvvdd_ldo4,avdd_usb*";
366 regulator-min-microvolt = <3300000>; 364 regulator-min-microvolt = <3300000>;
367 regulator-max-microvolt = <3300000>; 365 regulator-max-microvolt = <3300000>;
368 regulator-always-on; 366 regulator-always-on;
369 }; 367 };
370 368
371 regulator@8 { 369 ldo5 {
372 reg = <8>;
373 regulator-compatible = "ldo5";
374 regulator-name = "nvvdd_ldo5,vcore_mmc,avdd_lcd1,vddio_1wire"; 370 regulator-name = "nvvdd_ldo5,vcore_mmc,avdd_lcd1,vddio_1wire";
375 regulator-min-microvolt = <2800000>; 371 regulator-min-microvolt = <2800000>;
376 regulator-max-microvolt = <2800000>; 372 regulator-max-microvolt = <2800000>;
377 regulator-always-on; 373 regulator-always-on;
378 }; 374 };
379 375
380 regulator@9 { 376 hdmi_pll_reg: ldo6 {
381 reg = <9>;
382 regulator-compatible = "ldo6";
383 regulator-name = "nvvdd_ldo6,avdd_hdmi_pll"; 377 regulator-name = "nvvdd_ldo6,avdd_hdmi_pll";
384 regulator-min-microvolt = <1800000>; 378 regulator-min-microvolt = <1800000>;
385 regulator-max-microvolt = <1800000>; 379 regulator-max-microvolt = <1800000>;
386 }; 380 };
387 381
388 regulator@10 { 382 ldo7 {
389 reg = <10>;
390 regulator-compatible = "ldo7";
391 regulator-name = "nvvdd_ldo7,avddio_audio"; 383 regulator-name = "nvvdd_ldo7,avddio_audio";
392 regulator-min-microvolt = <2800000>; 384 regulator-min-microvolt = <2800000>;
393 regulator-max-microvolt = <2800000>; 385 regulator-max-microvolt = <2800000>;
394 regulator-always-on; 386 regulator-always-on;
395 }; 387 };
396 388
397 regulator@11 { 389 ldo8 {
398 reg = <11>;
399 regulator-compatible = "ldo8";
400 regulator-name = "nvvdd_ldo8,vcom_3v0,vcore_cmps"; 390 regulator-name = "nvvdd_ldo8,vcom_3v0,vcore_cmps";
401 regulator-min-microvolt = <3000000>; 391 regulator-min-microvolt = <3000000>;
402 regulator-max-microvolt = <3000000>; 392 regulator-max-microvolt = <3000000>;
403 }; 393 };
404 394
405 regulator@12 { 395 ldo9 {
406 reg = <12>;
407 regulator-compatible = "ldo9";
408 regulator-name = "nvvdd_ldo9,avdd_cam*"; 396 regulator-name = "nvvdd_ldo9,avdd_cam*";
409 regulator-min-microvolt = <2800000>; 397 regulator-min-microvolt = <2800000>;
410 regulator-max-microvolt = <2800000>; 398 regulator-max-microvolt = <2800000>;
411 }; 399 };
412 400
413 regulator@13 { 401 ldo10 {
414 reg = <13>;
415 regulator-compatible = "ldo10";
416 regulator-name = "nvvdd_ldo10,avdd_usb_ic_3v0"; 402 regulator-name = "nvvdd_ldo10,avdd_usb_ic_3v0";
417 regulator-min-microvolt = <3000000>; 403 regulator-min-microvolt = <3000000>;
418 regulator-max-microvolt = <3000000>; 404 regulator-max-microvolt = <3000000>;
419 regulator-always-on; 405 regulator-always-on;
420 }; 406 };
421 407
422 regulator@14 { 408 hdmi_vdd_reg: ldo11 {
423 reg = <14>;
424 regulator-compatible = "ldo11";
425 regulator-name = "nvvdd_ldo11,vddio_pex_clk,vcom_33,avdd_hdmi"; 409 regulator-name = "nvvdd_ldo11,vddio_pex_clk,vcom_33,avdd_hdmi";
426 regulator-min-microvolt = <3300000>; 410 regulator-min-microvolt = <3300000>;
427 regulator-max-microvolt = <3300000>; 411 regulator-max-microvolt = <3300000>;
428 }; 412 };
429 413
430 regulator@15 { 414 ldo12 {
431 reg = <15>;
432 regulator-compatible = "ldo12";
433 regulator-name = "nvvdd_ldo12,vddio_sdio"; 415 regulator-name = "nvvdd_ldo12,vddio_sdio";
434 regulator-min-microvolt = <2800000>; 416 regulator-min-microvolt = <2800000>;
435 regulator-max-microvolt = <2800000>; 417 regulator-max-microvolt = <2800000>;
436 regulator-always-on; 418 regulator-always-on;
437 }; 419 };
438 420
439 regulator@16 { 421 ldo13 {
440 reg = <16>;
441 regulator-compatible = "ldo13";
442 regulator-name = "nvvdd_ldo13,vcore_phtn,vdd_af"; 422 regulator-name = "nvvdd_ldo13,vcore_phtn,vdd_af";
443 regulator-min-microvolt = <2800000>; 423 regulator-min-microvolt = <2800000>;
444 regulator-max-microvolt = <2800000>; 424 regulator-max-microvolt = <2800000>;
445 }; 425 };
446 426
447 regulator@17 { 427 ldo14 {
448 reg = <17>;
449 regulator-compatible = "ldo14";
450 regulator-name = "nvvdd_ldo14,avdd_vdac"; 428 regulator-name = "nvvdd_ldo14,avdd_vdac";
451 regulator-min-microvolt = <2800000>; 429 regulator-min-microvolt = <2800000>;
452 regulator-max-microvolt = <2800000>; 430 regulator-max-microvolt = <2800000>;
453 }; 431 };
454 432
455 regulator@18 { 433 ldo15 {
456 reg = <18>;
457 regulator-compatible = "ldo15";
458 regulator-name = "nvvdd_ldo15,vcore_temp,vddio_hdcp"; 434 regulator-name = "nvvdd_ldo15,vcore_temp,vddio_hdcp";
459 regulator-min-microvolt = <3300000>; 435 regulator-min-microvolt = <3300000>;
460 regulator-max-microvolt = <3300000>; 436 regulator-max-microvolt = <3300000>;
461 }; 437 };
462 438
463 regulator@19 { 439 ldo16 {
464 reg = <19>;
465 regulator-compatible = "ldo16";
466 regulator-name = "nvvdd_ldo16,vdd_dbrtr"; 440 regulator-name = "nvvdd_ldo16,vdd_dbrtr";
467 regulator-min-microvolt = <1300000>; 441 regulator-min-microvolt = <1300000>;
468 regulator-max-microvolt = <1300000>; 442 regulator-max-microvolt = <1300000>;
469 }; 443 };
470 444
471 regulator@20 { 445 ldo17 {
472 reg = <20>;
473 regulator-compatible = "ldo17";
474 regulator-name = "nvvdd_ldo17,vddio_mipi"; 446 regulator-name = "nvvdd_ldo17,vddio_mipi";
475 regulator-min-microvolt = <1200000>; 447 regulator-min-microvolt = <1200000>;
476 regulator-max-microvolt = <1200000>; 448 regulator-max-microvolt = <1200000>;
477 }; 449 };
478 450
479 regulator@21 { 451 ldo18 {
480 reg = <21>;
481 regulator-compatible = "ldo18";
482 regulator-name = "nvvdd_ldo18,vddio_vi,vcore_cam*"; 452 regulator-name = "nvvdd_ldo18,vddio_vi,vcore_cam*";
483 regulator-min-microvolt = <1800000>; 453 regulator-min-microvolt = <1800000>;
484 regulator-max-microvolt = <1800000>; 454 regulator-max-microvolt = <1800000>;
485 }; 455 };
486 456
487 regulator@22 { 457 ldo19 {
488 reg = <22>;
489 regulator-compatible = "ldo19";
490 regulator-name = "nvvdd_ldo19,avdd_lcd2,vddio_lx"; 458 regulator-name = "nvvdd_ldo19,avdd_lcd2,vddio_lx";
491 regulator-min-microvolt = <2800000>; 459 regulator-min-microvolt = <2800000>;
492 regulator-max-microvolt = <2800000>; 460 regulator-max-microvolt = <2800000>;
493 }; 461 };
494 462
495 regulator@23 { 463 ldo20 {
496 reg = <23>;
497 regulator-compatible = "ldo20";
498 regulator-name = "nvvdd_ldo20,vddio_ddr_1v2,vddio_hsic,vcom_1v2"; 464 regulator-name = "nvvdd_ldo20,vddio_ddr_1v2,vddio_hsic,vcom_1v2";
499 regulator-min-microvolt = <1200000>; 465 regulator-min-microvolt = <1200000>;
500 regulator-max-microvolt = <1200000>; 466 regulator-max-microvolt = <1200000>;
501 regulator-always-on; 467 regulator-always-on;
502 }; 468 };
503 469
504 regulator@24 { 470 out5v {
505 reg = <24>;
506 regulator-compatible = "out5v";
507 regulator-name = "usb0_vbus_reg"; 471 regulator-name = "usb0_vbus_reg";
508 }; 472 };
509 473
510 regulator@25 { 474 out33v {
511 reg = <25>;
512 regulator-compatible = "out33v";
513 regulator-name = "pmu_out3v3"; 475 regulator-name = "pmu_out3v3";
514 }; 476 };
515 477
516 regulator@26 { 478 bbat {
517 reg = <26>;
518 regulator-compatible = "bbat";
519 regulator-name = "pmu_bbat"; 479 regulator-name = "pmu_bbat";
520 regulator-min-microvolt = <2400000>; 480 regulator-min-microvolt = <2400000>;
521 regulator-max-microvolt = <2400000>; 481 regulator-max-microvolt = <2400000>;
522 regulator-always-on; 482 regulator-always-on;
523 }; 483 };
524 484
525 regulator@27 { 485 sdby {
526 reg = <27>;
527 regulator-compatible = "sdby";
528 regulator-name = "vdd_aon"; 486 regulator-name = "vdd_aon";
529 regulator-always-on; 487 regulator-always-on;
530 }; 488 };
531 489
532 regulator@28 { 490 vrtc {
533 reg = <28>;
534 regulator-compatible = "vrtc";
535 regulator-name = "vrtc,pmu_vccadc"; 491 regulator-name = "vrtc,pmu_vccadc";
536 regulator-always-on; 492 regulator-always-on;
537 }; 493 };
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index f3a09d0d45b..b8effa1cbda 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -4,6 +4,108 @@
4 compatible = "nvidia,tegra20"; 4 compatible = "nvidia,tegra20";
5 interrupt-parent = <&intc>; 5 interrupt-parent = <&intc>;
6 6
7 host1x {
8 compatible = "nvidia,tegra20-host1x", "simple-bus";
9 reg = <0x50000000 0x00024000>;
10 interrupts = <0 65 0x04 /* mpcore syncpt */
11 0 67 0x04>; /* mpcore general */
12
13 #address-cells = <1>;
14 #size-cells = <1>;
15
16 ranges = <0x54000000 0x54000000 0x04000000>;
17
18 mpe {
19 compatible = "nvidia,tegra20-mpe";
20 reg = <0x54040000 0x00040000>;
21 interrupts = <0 68 0x04>;
22 };
23
24 vi {
25 compatible = "nvidia,tegra20-vi";
26 reg = <0x54080000 0x00040000>;
27 interrupts = <0 69 0x04>;
28 };
29
30 epp {
31 compatible = "nvidia,tegra20-epp";
32 reg = <0x540c0000 0x00040000>;
33 interrupts = <0 70 0x04>;
34 };
35
36 isp {
37 compatible = "nvidia,tegra20-isp";
38 reg = <0x54100000 0x00040000>;
39 interrupts = <0 71 0x04>;
40 };
41
42 gr2d {
43 compatible = "nvidia,tegra20-gr2d";
44 reg = <0x54140000 0x00040000>;
45 interrupts = <0 72 0x04>;
46 };
47
48 gr3d {
49 compatible = "nvidia,tegra20-gr3d";
50 reg = <0x54180000 0x00040000>;
51 };
52
53 dc@54200000 {
54 compatible = "nvidia,tegra20-dc";
55 reg = <0x54200000 0x00040000>;
56 interrupts = <0 73 0x04>;
57
58 rgb {
59 status = "disabled";
60 };
61 };
62
63 dc@54240000 {
64 compatible = "nvidia,tegra20-dc";
65 reg = <0x54240000 0x00040000>;
66 interrupts = <0 74 0x04>;
67
68 rgb {
69 status = "disabled";
70 };
71 };
72
73 hdmi {
74 compatible = "nvidia,tegra20-hdmi";
75 reg = <0x54280000 0x00040000>;
76 interrupts = <0 75 0x04>;
77 status = "disabled";
78 };
79
80 tvo {
81 compatible = "nvidia,tegra20-tvo";
82 reg = <0x542c0000 0x00040000>;
83 interrupts = <0 76 0x04>;
84 status = "disabled";
85 };
86
87 dsi {
88 compatible = "nvidia,tegra20-dsi";
89 reg = <0x54300000 0x00040000>;
90 status = "disabled";
91 };
92 };
93
94 timer@50004600 {
95 compatible = "arm,cortex-a9-twd-timer";
96 reg = <0x50040600 0x20>;
97 interrupts = <1 13 0x304>;
98 };
99
100 cache-controller@50043000 {
101 compatible = "arm,pl310-cache";
102 reg = <0x50043000 0x1000>;
103 arm,data-latency = <5 5 2>;
104 arm,tag-latency = <4 4 2>;
105 cache-unified;
106 cache-level = <2>;
107 };
108
7 intc: interrupt-controller { 109 intc: interrupt-controller {
8 compatible = "arm,cortex-a9-gic"; 110 compatible = "arm,cortex-a9-gic";
9 reg = <0x50041000 0x1000 111 reg = <0x50041000 0x1000
@@ -12,6 +114,15 @@
12 #interrupt-cells = <3>; 114 #interrupt-cells = <3>;
13 }; 115 };
14 116
117 timer@60005000 {
118 compatible = "nvidia,tegra20-timer";
119 reg = <0x60005000 0x60>;
120 interrupts = <0 0 0x04
121 0 1 0x04
122 0 41 0x04
123 0 42 0x04>;
124 };
125
15 apbdma: dma { 126 apbdma: dma {
16 compatible = "nvidia,tegra20-apbdma"; 127 compatible = "nvidia,tegra20-apbdma";
17 reg = <0x6000a000 0x1200>; 128 reg = <0x6000a000 0x1200>;
@@ -129,6 +240,12 @@
129 #pwm-cells = <2>; 240 #pwm-cells = <2>;
130 }; 241 };
131 242
243 rtc {
244 compatible = "nvidia,tegra20-rtc";
245 reg = <0x7000e000 0x100>;
246 interrupts = <0 2 0x04>;
247 };
248
132 i2c@7000c000 { 249 i2c@7000c000 {
133 compatible = "nvidia,tegra20-i2c"; 250 compatible = "nvidia,tegra20-i2c";
134 reg = <0x7000c000 0x100>; 251 reg = <0x7000c000 0x100>;
@@ -138,6 +255,16 @@
138 status = "disabled"; 255 status = "disabled";
139 }; 256 };
140 257
258 spi@7000c380 {
259 compatible = "nvidia,tegra20-sflash";
260 reg = <0x7000c380 0x80>;
261 interrupts = <0 39 0x04>;
262 nvidia,dma-request-selector = <&apbdma 11>;
263 #address-cells = <1>;
264 #size-cells = <0>;
265 status = "disabled";
266 };
267
141 i2c@7000c400 { 268 i2c@7000c400 {
142 compatible = "nvidia,tegra20-i2c"; 269 compatible = "nvidia,tegra20-i2c";
143 reg = <0x7000c400 0x100>; 270 reg = <0x7000c400 0x100>;
@@ -165,6 +292,46 @@
165 status = "disabled"; 292 status = "disabled";
166 }; 293 };
167 294
295 spi@7000d400 {
296 compatible = "nvidia,tegra20-slink";
297 reg = <0x7000d400 0x200>;
298 interrupts = <0 59 0x04>;
299 nvidia,dma-request-selector = <&apbdma 15>;
300 #address-cells = <1>;
301 #size-cells = <0>;
302 status = "disabled";
303 };
304
305 spi@7000d600 {
306 compatible = "nvidia,tegra20-slink";
307 reg = <0x7000d600 0x200>;
308 interrupts = <0 82 0x04>;
309 nvidia,dma-request-selector = <&apbdma 16>;
310 #address-cells = <1>;
311 #size-cells = <0>;
312 status = "disabled";
313 };
314
315 spi@7000d800 {
316 compatible = "nvidia,tegra20-slink";
317 reg = <0x7000d480 0x200>;
318 interrupts = <0 83 0x04>;
319 nvidia,dma-request-selector = <&apbdma 17>;
320 #address-cells = <1>;
321 #size-cells = <0>;
322 status = "disabled";
323 };
324
325 spi@7000da00 {
326 compatible = "nvidia,tegra20-slink";
327 reg = <0x7000da00 0x200>;
328 interrupts = <0 93 0x04>;
329 nvidia,dma-request-selector = <&apbdma 18>;
330 #address-cells = <1>;
331 #size-cells = <0>;
332 status = "disabled";
333 };
334
168 pmc { 335 pmc {
169 compatible = "nvidia,tegra20-pmc"; 336 compatible = "nvidia,tegra20-pmc";
170 reg = <0x7000e400 0x400>; 337 reg = <0x7000e400 0x400>;
diff --git a/arch/arm/boot/dts/tegra30-cardhu-a02.dts b/arch/arm/boot/dts/tegra30-cardhu-a02.dts
index dd4222f00ec..adc88aa50eb 100644
--- a/arch/arm/boot/dts/tegra30-cardhu-a02.dts
+++ b/arch/arm/boot/dts/tegra30-cardhu-a02.dts
@@ -83,5 +83,11 @@
83 gpio = <&gpio 83 0>; /* GPIO PK3 */ 83 gpio = <&gpio 83 0>; /* GPIO PK3 */
84 }; 84 };
85 }; 85 };
86
87 sdhci@78000400 {
88 status = "okay";
89 power-gpios = <&gpio 28 0>; /* gpio PD4 */
90 bus-width = <4>;
91 };
86}; 92};
87 93
diff --git a/arch/arm/boot/dts/tegra30-cardhu-a04.dts b/arch/arm/boot/dts/tegra30-cardhu-a04.dts
index 0828f097ca8..08163e145d5 100644
--- a/arch/arm/boot/dts/tegra30-cardhu-a04.dts
+++ b/arch/arm/boot/dts/tegra30-cardhu-a04.dts
@@ -95,4 +95,10 @@
95 gpio = <&gpio 232 0>; /* GPIO PDD0 */ 95 gpio = <&gpio 232 0>; /* GPIO PDD0 */
96 }; 96 };
97 }; 97 };
98
99 sdhci@78000400 {
100 status = "okay";
101 power-gpios = <&gpio 27 0>; /* gpio PD3 */
102 bus-width = <4>;
103 };
98}; 104};
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index d10c9c5a360..bdb2a660f37 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -52,6 +52,22 @@
52 nvidia,pull = <2>; 52 nvidia,pull = <2>;
53 nvidia,tristate = <0>; 53 nvidia,tristate = <0>;
54 }; 54 };
55 sdmmc3_clk_pa6 {
56 nvidia,pins = "sdmmc3_clk_pa6";
57 nvidia,function = "sdmmc3";
58 nvidia,pull = <0>;
59 nvidia,tristate = <0>;
60 };
61 sdmmc3_cmd_pa7 {
62 nvidia,pins = "sdmmc3_cmd_pa7",
63 "sdmmc3_dat0_pb7",
64 "sdmmc3_dat1_pb6",
65 "sdmmc3_dat2_pb5",
66 "sdmmc3_dat3_pb4";
67 nvidia,function = "sdmmc3";
68 nvidia,pull = <2>;
69 nvidia,tristate = <0>;
70 };
55 sdmmc4_clk_pcc4 { 71 sdmmc4_clk_pcc4 {
56 nvidia,pins = "sdmmc4_clk_pcc4", 72 nvidia,pins = "sdmmc4_clk_pcc4",
57 "sdmmc4_rst_n_pcc3"; 73 "sdmmc4_rst_n_pcc3";
@@ -81,6 +97,15 @@
81 nvidia,pull = <0>; 97 nvidia,pull = <0>;
82 nvidia,tristate = <0>; 98 nvidia,tristate = <0>;
83 }; 99 };
100 sdio3 {
101 nvidia,pins = "drive_sdio3";
102 nvidia,high-speed-mode = <0>;
103 nvidia,schmitt = <0>;
104 nvidia,pull-down-strength = <46>;
105 nvidia,pull-up-strength = <42>;
106 nvidia,slew-rate-rising = <1>;
107 nvidia,slew-rate-falling = <1>;
108 };
84 }; 109 };
85 }; 110 };
86 111
@@ -171,56 +196,41 @@
171 vccio-supply = <&vdd_ac_bat_reg>; 196 vccio-supply = <&vdd_ac_bat_reg>;
172 197
173 regulators { 198 regulators {
174 #address-cells = <1>; 199 vdd1_reg: vdd1 {
175 #size-cells = <0>;
176
177 vdd1_reg: regulator@0 {
178 reg = <0>;
179 regulator-compatible = "vdd1";
180 regulator-name = "vddio_ddr_1v2"; 200 regulator-name = "vddio_ddr_1v2";
181 regulator-min-microvolt = <1200000>; 201 regulator-min-microvolt = <1200000>;
182 regulator-max-microvolt = <1200000>; 202 regulator-max-microvolt = <1200000>;
183 regulator-always-on; 203 regulator-always-on;
184 }; 204 };
185 205
186 vdd2_reg: regulator@1 { 206 vdd2_reg: vdd2 {
187 reg = <1>;
188 regulator-compatible = "vdd2";
189 regulator-name = "vdd_1v5_gen"; 207 regulator-name = "vdd_1v5_gen";
190 regulator-min-microvolt = <1500000>; 208 regulator-min-microvolt = <1500000>;
191 regulator-max-microvolt = <1500000>; 209 regulator-max-microvolt = <1500000>;
192 regulator-always-on; 210 regulator-always-on;
193 }; 211 };
194 212
195 vddctrl_reg: regulator@2 { 213 vddctrl_reg: vddctrl {
196 reg = <2>;
197 regulator-compatible = "vddctrl";
198 regulator-name = "vdd_cpu,vdd_sys"; 214 regulator-name = "vdd_cpu,vdd_sys";
199 regulator-min-microvolt = <1000000>; 215 regulator-min-microvolt = <1000000>;
200 regulator-max-microvolt = <1000000>; 216 regulator-max-microvolt = <1000000>;
201 regulator-always-on; 217 regulator-always-on;
202 }; 218 };
203 219
204 vio_reg: regulator@3 { 220 vio_reg: vio {
205 reg = <3>;
206 regulator-compatible = "vio";
207 regulator-name = "vdd_1v8_gen"; 221 regulator-name = "vdd_1v8_gen";
208 regulator-min-microvolt = <1800000>; 222 regulator-min-microvolt = <1800000>;
209 regulator-max-microvolt = <1800000>; 223 regulator-max-microvolt = <1800000>;
210 regulator-always-on; 224 regulator-always-on;
211 }; 225 };
212 226
213 ldo1_reg: regulator@4 { 227 ldo1_reg: ldo1 {
214 reg = <4>;
215 regulator-compatible = "ldo1";
216 regulator-name = "vdd_pexa,vdd_pexb"; 228 regulator-name = "vdd_pexa,vdd_pexb";
217 regulator-min-microvolt = <1050000>; 229 regulator-min-microvolt = <1050000>;
218 regulator-max-microvolt = <1050000>; 230 regulator-max-microvolt = <1050000>;
219 }; 231 };
220 232
221 ldo2_reg: regulator@5 { 233 ldo2_reg: ldo2 {
222 reg = <5>;
223 regulator-compatible = "ldo2";
224 regulator-name = "vdd_sata,avdd_plle"; 234 regulator-name = "vdd_sata,avdd_plle";
225 regulator-min-microvolt = <1050000>; 235 regulator-min-microvolt = <1050000>;
226 regulator-max-microvolt = <1050000>; 236 regulator-max-microvolt = <1050000>;
@@ -228,44 +238,34 @@
228 238
229 /* LDO3 is not connected to anything */ 239 /* LDO3 is not connected to anything */
230 240
231 ldo4_reg: regulator@7 { 241 ldo4_reg: ldo4 {
232 reg = <7>;
233 regulator-compatible = "ldo4";
234 regulator-name = "vdd_rtc"; 242 regulator-name = "vdd_rtc";
235 regulator-min-microvolt = <1200000>; 243 regulator-min-microvolt = <1200000>;
236 regulator-max-microvolt = <1200000>; 244 regulator-max-microvolt = <1200000>;
237 regulator-always-on; 245 regulator-always-on;
238 }; 246 };
239 247
240 ldo5_reg: regulator@8 { 248 ldo5_reg: ldo5 {
241 reg = <8>;
242 regulator-compatible = "ldo5";
243 regulator-name = "vddio_sdmmc,avdd_vdac"; 249 regulator-name = "vddio_sdmmc,avdd_vdac";
244 regulator-min-microvolt = <3300000>; 250 regulator-min-microvolt = <3300000>;
245 regulator-max-microvolt = <3300000>; 251 regulator-max-microvolt = <3300000>;
246 regulator-always-on; 252 regulator-always-on;
247 }; 253 };
248 254
249 ldo6_reg: regulator@9 { 255 ldo6_reg: ldo6 {
250 reg = <9>;
251 regulator-compatible = "ldo6";
252 regulator-name = "avdd_dsi_csi,pwrdet_mipi"; 256 regulator-name = "avdd_dsi_csi,pwrdet_mipi";
253 regulator-min-microvolt = <1200000>; 257 regulator-min-microvolt = <1200000>;
254 regulator-max-microvolt = <1200000>; 258 regulator-max-microvolt = <1200000>;
255 }; 259 };
256 260
257 ldo7_reg: regulator@10 { 261 ldo7_reg: ldo7 {
258 reg = <10>;
259 regulator-compatible = "ldo7";
260 regulator-name = "vdd_pllm,x,u,a_p_c_s"; 262 regulator-name = "vdd_pllm,x,u,a_p_c_s";
261 regulator-min-microvolt = <1200000>; 263 regulator-min-microvolt = <1200000>;
262 regulator-max-microvolt = <1200000>; 264 regulator-max-microvolt = <1200000>;
263 regulator-always-on; 265 regulator-always-on;
264 }; 266 };
265 267
266 ldo8_reg: regulator@11 { 268 ldo8_reg: ldo8 {
267 reg = <11>;
268 regulator-compatible = "ldo8";
269 regulator-name = "vdd_ddr_hs"; 269 regulator-name = "vdd_ddr_hs";
270 regulator-min-microvolt = <1000000>; 270 regulator-min-microvolt = <1000000>;
271 regulator-max-microvolt = <1000000>; 271 regulator-max-microvolt = <1000000>;
@@ -275,6 +275,16 @@
275 }; 275 };
276 }; 276 };
277 277
278 spi@7000da00 {
279 status = "okay";
280 spi-max-frequency = <25000000>;
281 spi-flash@1 {
282 compatible = "winbond,w25q32";
283 reg = <1>;
284 spi-max-frequency = <20000000>;
285 };
286 };
287
278 ahub { 288 ahub {
279 i2s@70080400 { 289 i2s@70080400 {
280 status = "okay"; 290 status = "okay";
@@ -409,6 +419,8 @@
409 regulator-name = "vdd_com"; 419 regulator-name = "vdd_com";
410 regulator-min-microvolt = <3300000>; 420 regulator-min-microvolt = <3300000>;
411 regulator-max-microvolt = <3300000>; 421 regulator-max-microvolt = <3300000>;
422 regulator-always-on;
423 regulator-boot-on;
412 enable-active-high; 424 enable-active-high;
413 gpio = <&gpio 24 0>; /* gpio PD0 */ 425 gpio = <&gpio 24 0>; /* gpio PD0 */
414 vin-supply = <&sys_3v3_reg>; 426 vin-supply = <&sys_3v3_reg>;
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index df7f2270fc9..529fdb82dfd 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -4,6 +4,108 @@
4 compatible = "nvidia,tegra30"; 4 compatible = "nvidia,tegra30";
5 interrupt-parent = <&intc>; 5 interrupt-parent = <&intc>;
6 6
7 host1x {
8 compatible = "nvidia,tegra30-host1x", "simple-bus";
9 reg = <0x50000000 0x00024000>;
10 interrupts = <0 65 0x04 /* mpcore syncpt */
11 0 67 0x04>; /* mpcore general */
12
13 #address-cells = <1>;
14 #size-cells = <1>;
15
16 ranges = <0x54000000 0x54000000 0x04000000>;
17
18 mpe {
19 compatible = "nvidia,tegra30-mpe";
20 reg = <0x54040000 0x00040000>;
21 interrupts = <0 68 0x04>;
22 };
23
24 vi {
25 compatible = "nvidia,tegra30-vi";
26 reg = <0x54080000 0x00040000>;
27 interrupts = <0 69 0x04>;
28 };
29
30 epp {
31 compatible = "nvidia,tegra30-epp";
32 reg = <0x540c0000 0x00040000>;
33 interrupts = <0 70 0x04>;
34 };
35
36 isp {
37 compatible = "nvidia,tegra30-isp";
38 reg = <0x54100000 0x00040000>;
39 interrupts = <0 71 0x04>;
40 };
41
42 gr2d {
43 compatible = "nvidia,tegra30-gr2d";
44 reg = <0x54140000 0x00040000>;
45 interrupts = <0 72 0x04>;
46 };
47
48 gr3d {
49 compatible = "nvidia,tegra30-gr3d";
50 reg = <0x54180000 0x00040000>;
51 };
52
53 dc@54200000 {
54 compatible = "nvidia,tegra30-dc";
55 reg = <0x54200000 0x00040000>;
56 interrupts = <0 73 0x04>;
57
58 rgb {
59 status = "disabled";
60 };
61 };
62
63 dc@54240000 {
64 compatible = "nvidia,tegra30-dc";
65 reg = <0x54240000 0x00040000>;
66 interrupts = <0 74 0x04>;
67
68 rgb {
69 status = "disabled";
70 };
71 };
72
73 hdmi {
74 compatible = "nvidia,tegra30-hdmi";
75 reg = <0x54280000 0x00040000>;
76 interrupts = <0 75 0x04>;
77 status = "disabled";
78 };
79
80 tvo {
81 compatible = "nvidia,tegra30-tvo";
82 reg = <0x542c0000 0x00040000>;
83 interrupts = <0 76 0x04>;
84 status = "disabled";
85 };
86
87 dsi {
88 compatible = "nvidia,tegra30-dsi";
89 reg = <0x54300000 0x00040000>;
90 status = "disabled";
91 };
92 };
93
94 timer@50004600 {
95 compatible = "arm,cortex-a9-twd-timer";
96 reg = <0x50040600 0x20>;
97 interrupts = <1 13 0xf04>;
98 };
99
100 cache-controller@50043000 {
101 compatible = "arm,pl310-cache";
102 reg = <0x50043000 0x1000>;
103 arm,data-latency = <6 6 2>;
104 arm,tag-latency = <5 5 2>;
105 cache-unified;
106 cache-level = <2>;
107 };
108
7 intc: interrupt-controller { 109 intc: interrupt-controller {
8 compatible = "arm,cortex-a9-gic"; 110 compatible = "arm,cortex-a9-gic";
9 reg = <0x50041000 0x1000 111 reg = <0x50041000 0x1000
@@ -12,6 +114,17 @@
12 #interrupt-cells = <3>; 114 #interrupt-cells = <3>;
13 }; 115 };
14 116
117 timer@60005000 {
118 compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer";
119 reg = <0x60005000 0x400>;
120 interrupts = <0 0 0x04
121 0 1 0x04
122 0 41 0x04
123 0 42 0x04
124 0 121 0x04
125 0 122 0x04>;
126 };
127
15 apbdma: dma { 128 apbdma: dma {
16 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma"; 129 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma";
17 reg = <0x6000a000 0x1400>; 130 reg = <0x6000a000 0x1400>;
@@ -123,6 +236,12 @@
123 #pwm-cells = <2>; 236 #pwm-cells = <2>;
124 }; 237 };
125 238
239 rtc {
240 compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc";
241 reg = <0x7000e000 0x100>;
242 interrupts = <0 2 0x04>;
243 };
244
126 i2c@7000c000 { 245 i2c@7000c000 {
127 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c"; 246 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
128 reg = <0x7000c000 0x100>; 247 reg = <0x7000c000 0x100>;
@@ -168,6 +287,66 @@
168 status = "disabled"; 287 status = "disabled";
169 }; 288 };
170 289
290 spi@7000d400 {
291 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
292 reg = <0x7000d400 0x200>;
293 interrupts = <0 59 0x04>;
294 nvidia,dma-request-selector = <&apbdma 15>;
295 #address-cells = <1>;
296 #size-cells = <0>;
297 status = "disabled";
298 };
299
300 spi@7000d600 {
301 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
302 reg = <0x7000d600 0x200>;
303 interrupts = <0 82 0x04>;
304 nvidia,dma-request-selector = <&apbdma 16>;
305 #address-cells = <1>;
306 #size-cells = <0>;
307 status = "disabled";
308 };
309
310 spi@7000d800 {
311 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
312 reg = <0x7000d480 0x200>;
313 interrupts = <0 83 0x04>;
314 nvidia,dma-request-selector = <&apbdma 17>;
315 #address-cells = <1>;
316 #size-cells = <0>;
317 status = "disabled";
318 };
319
320 spi@7000da00 {
321 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
322 reg = <0x7000da00 0x200>;
323 interrupts = <0 93 0x04>;
324 nvidia,dma-request-selector = <&apbdma 18>;
325 #address-cells = <1>;
326 #size-cells = <0>;
327 status = "disabled";
328 };
329
330 spi@7000dc00 {
331 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
332 reg = <0x7000dc00 0x200>;
333 interrupts = <0 94 0x04>;
334 nvidia,dma-request-selector = <&apbdma 27>;
335 #address-cells = <1>;
336 #size-cells = <0>;
337 status = "disabled";
338 };
339
340 spi@7000de00 {
341 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
342 reg = <0x7000de00 0x200>;
343 interrupts = <0 79 0x04>;
344 nvidia,dma-request-selector = <&apbdma 28>;
345 #address-cells = <1>;
346 #size-cells = <0>;
347 status = "disabled";
348 };
349
171 pmc { 350 pmc {
172 compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc"; 351 compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc";
173 reg = <0x7000e400 0x400>; 352 reg = <0x7000e400 0x400>;
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index ff000172c93..63411b03693 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -37,6 +37,24 @@
37 regulator-max-microvolt = <3150000>; 37 regulator-max-microvolt = <3150000>;
38 }; 38 };
39 39
40 vusb1v5: regulator-vusb1v5 {
41 compatible = "ti,twl4030-vusb1v5";
42 };
43
44 vusb1v8: regulator-vusb1v8 {
45 compatible = "ti,twl4030-vusb1v8";
46 };
47
48 vusb3v1: regulator-vusb3v1 {
49 compatible = "ti,twl4030-vusb3v1";
50 };
51
52 vsim: regulator-vsim {
53 compatible = "ti,twl4030-vsim";
54 regulator-min-microvolt = <1800000>;
55 regulator-max-microvolt = <3000000>;
56 };
57
40 twl_gpio: gpio { 58 twl_gpio: gpio {
41 compatible = "ti,twl4030-gpio"; 59 compatible = "ti,twl4030-gpio";
42 gpio-controller; 60 gpio-controller;
@@ -44,4 +62,13 @@
44 interrupt-controller; 62 interrupt-controller;
45 #interrupt-cells = <1>; 63 #interrupt-cells = <1>;
46 }; 64 };
65
66 twl4030-usb {
67 compatible = "ti,twl4030-usb";
68 interrupts = <10>, <4>;
69 usb1v5-supply = <&vusb1v5>;
70 usb1v8-supply = <&vusb1v8>;
71 usb3v1-supply = <&vusb3v1>;
72 usb_mode = <1>;
73 };
47}; 74};
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
index 123e2c40218..9996cfc5ee8 100644
--- a/arch/arm/boot/dts/twl6030.dtsi
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -86,4 +86,9 @@
86 clk32kg: regulator-clk32kg { 86 clk32kg: regulator-clk32kg {
87 compatible = "ti,twl6030-clk32kg"; 87 compatible = "ti,twl6030-clk32kg";
88 }; 88 };
89
90 twl_usb_comparator: usb-comparator {
91 compatible = "ti,twl6030-usb";
92 interrupts = <4>, <10>;
93 };
89}; 94};
diff --git a/arch/arm/boot/dts/u9540.dts b/arch/arm/boot/dts/u9540.dts
new file mode 100644
index 00000000000..95892ec6c34
--- /dev/null
+++ b/arch/arm/boot/dts/u9540.dts
@@ -0,0 +1,72 @@
1/*
2 * Copyright 2012 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "dbx5x0.dtsi"
14
15/ {
16 model = "ST-Ericsson U9540 platform with Device Tree";
17 compatible = "st-ericsson,u9540";
18
19 memory {
20 reg = <0x00000000 0x20000000>;
21 };
22
23 soc-u9500 {
24 uart@80120000 {
25 status = "okay";
26 };
27
28 uart@80121000 {
29 status = "okay";
30 };
31
32 uart@80007000 {
33 status = "okay";
34 };
35
36 // External Micro SD slot
37 sdi0_per1@80126000 {
38 arm,primecell-periphid = <0x10480180>;
39 max-frequency = <100000000>;
40 bus-width = <4>;
41 mmc-cap-sd-highspeed;
42 mmc-cap-mmc-highspeed;
43 vmmc-supply = <&ab8500_ldo_aux3_reg>;
44
45 cd-gpios = <&gpio7 6 0x4>; // 230
46 cd-inverted;
47
48 status = "okay";
49 };
50
51
52 // WLAN SDIO channel
53 sdi1_per2@80118000 {
54 arm,primecell-periphid = <0x10480180>;
55 max-frequency = <50000000>;
56 bus-width = <4>;
57
58 status = "okay";
59 };
60
61 // On-board eMMC
62 sdi4_per2@80114000 {
63 arm,primecell-periphid = <0x10480180>;
64 max-frequency = <100000000>;
65 bus-width = <8>;
66 mmc-cap-mmc-highspeed;
67 vmmc-supply = <&ab8500_ldo_aux2_reg>;
68
69 status = "okay";
70 };
71 };
72};
diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
index d8a827bd2bf..ac870fb3fa0 100644
--- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
@@ -17,17 +17,16 @@
17 * CHANGES TO vexpress-v2m.dtsi! 17 * CHANGES TO vexpress-v2m.dtsi!
18 */ 18 */
19 19
20/ {
21 aliases {
22 arm,v2m_timer = &v2m_timer01;
23 };
24
25 motherboard { 20 motherboard {
26 compatible = "simple-bus"; 21 model = "V2M-P1";
22 arm,hbi = <0x190>;
23 arm,vexpress,site = <0>;
27 arm,v2m-memory-map = "rs1"; 24 arm,v2m-memory-map = "rs1";
25 compatible = "arm,vexpress,v2m-p1", "simple-bus";
28 #address-cells = <2>; /* SMB chipselect number and offset */ 26 #address-cells = <2>; /* SMB chipselect number and offset */
29 #size-cells = <1>; 27 #size-cells = <1>;
30 #interrupt-cells = <1>; 28 #interrupt-cells = <1>;
29 ranges;
31 30
32 flash@0,00000000 { 31 flash@0,00000000 {
33 compatible = "arm,vexpress-flash", "cfi-flash"; 32 compatible = "arm,vexpress-flash", "cfi-flash";
@@ -72,14 +71,20 @@
72 #size-cells = <1>; 71 #size-cells = <1>;
73 ranges = <0 3 0 0x200000>; 72 ranges = <0 3 0 0x200000>;
74 73
75 sysreg@010000 { 74 v2m_sysreg: sysreg@010000 {
76 compatible = "arm,vexpress-sysreg"; 75 compatible = "arm,vexpress-sysreg";
77 reg = <0x010000 0x1000>; 76 reg = <0x010000 0x1000>;
77 gpio-controller;
78 #gpio-cells = <2>;
78 }; 79 };
79 80
80 sysctl@020000 { 81 v2m_sysctl: sysctl@020000 {
81 compatible = "arm,sp810", "arm,primecell"; 82 compatible = "arm,sp810", "arm,primecell";
82 reg = <0x020000 0x1000>; 83 reg = <0x020000 0x1000>;
84 clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&smbclk>;
85 clock-names = "refclk", "timclk", "apb_pclk";
86 #clock-cells = <1>;
87 clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3";
83 }; 88 };
84 89
85 /* PCI-E I2C bus */ 90 /* PCI-E I2C bus */
@@ -100,66 +105,92 @@
100 compatible = "arm,pl041", "arm,primecell"; 105 compatible = "arm,pl041", "arm,primecell";
101 reg = <0x040000 0x1000>; 106 reg = <0x040000 0x1000>;
102 interrupts = <11>; 107 interrupts = <11>;
108 clocks = <&smbclk>;
109 clock-names = "apb_pclk";
103 }; 110 };
104 111
105 mmci@050000 { 112 mmci@050000 {
106 compatible = "arm,pl180", "arm,primecell"; 113 compatible = "arm,pl180", "arm,primecell";
107 reg = <0x050000 0x1000>; 114 reg = <0x050000 0x1000>;
108 interrupts = <9 10>; 115 interrupts = <9 10>;
116 cd-gpios = <&v2m_sysreg 0 0>;
117 wp-gpios = <&v2m_sysreg 1 0>;
118 max-frequency = <12000000>;
119 vmmc-supply = <&v2m_fixed_3v3>;
120 clocks = <&v2m_clk24mhz>, <&smbclk>;
121 clock-names = "mclk", "apb_pclk";
109 }; 122 };
110 123
111 kmi@060000 { 124 kmi@060000 {
112 compatible = "arm,pl050", "arm,primecell"; 125 compatible = "arm,pl050", "arm,primecell";
113 reg = <0x060000 0x1000>; 126 reg = <0x060000 0x1000>;
114 interrupts = <12>; 127 interrupts = <12>;
128 clocks = <&v2m_clk24mhz>, <&smbclk>;
129 clock-names = "KMIREFCLK", "apb_pclk";
115 }; 130 };
116 131
117 kmi@070000 { 132 kmi@070000 {
118 compatible = "arm,pl050", "arm,primecell"; 133 compatible = "arm,pl050", "arm,primecell";
119 reg = <0x070000 0x1000>; 134 reg = <0x070000 0x1000>;
120 interrupts = <13>; 135 interrupts = <13>;
136 clocks = <&v2m_clk24mhz>, <&smbclk>;
137 clock-names = "KMIREFCLK", "apb_pclk";
121 }; 138 };
122 139
123 v2m_serial0: uart@090000 { 140 v2m_serial0: uart@090000 {
124 compatible = "arm,pl011", "arm,primecell"; 141 compatible = "arm,pl011", "arm,primecell";
125 reg = <0x090000 0x1000>; 142 reg = <0x090000 0x1000>;
126 interrupts = <5>; 143 interrupts = <5>;
144 clocks = <&v2m_oscclk2>, <&smbclk>;
145 clock-names = "uartclk", "apb_pclk";
127 }; 146 };
128 147
129 v2m_serial1: uart@0a0000 { 148 v2m_serial1: uart@0a0000 {
130 compatible = "arm,pl011", "arm,primecell"; 149 compatible = "arm,pl011", "arm,primecell";
131 reg = <0x0a0000 0x1000>; 150 reg = <0x0a0000 0x1000>;
132 interrupts = <6>; 151 interrupts = <6>;
152 clocks = <&v2m_oscclk2>, <&smbclk>;
153 clock-names = "uartclk", "apb_pclk";
133 }; 154 };
134 155
135 v2m_serial2: uart@0b0000 { 156 v2m_serial2: uart@0b0000 {
136 compatible = "arm,pl011", "arm,primecell"; 157 compatible = "arm,pl011", "arm,primecell";
137 reg = <0x0b0000 0x1000>; 158 reg = <0x0b0000 0x1000>;
138 interrupts = <7>; 159 interrupts = <7>;
160 clocks = <&v2m_oscclk2>, <&smbclk>;
161 clock-names = "uartclk", "apb_pclk";
139 }; 162 };
140 163
141 v2m_serial3: uart@0c0000 { 164 v2m_serial3: uart@0c0000 {
142 compatible = "arm,pl011", "arm,primecell"; 165 compatible = "arm,pl011", "arm,primecell";
143 reg = <0x0c0000 0x1000>; 166 reg = <0x0c0000 0x1000>;
144 interrupts = <8>; 167 interrupts = <8>;
168 clocks = <&v2m_oscclk2>, <&smbclk>;
169 clock-names = "uartclk", "apb_pclk";
145 }; 170 };
146 171
147 wdt@0f0000 { 172 wdt@0f0000 {
148 compatible = "arm,sp805", "arm,primecell"; 173 compatible = "arm,sp805", "arm,primecell";
149 reg = <0x0f0000 0x1000>; 174 reg = <0x0f0000 0x1000>;
150 interrupts = <0>; 175 interrupts = <0>;
176 clocks = <&v2m_refclk32khz>, <&smbclk>;
177 clock-names = "wdogclk", "apb_pclk";
151 }; 178 };
152 179
153 v2m_timer01: timer@110000 { 180 v2m_timer01: timer@110000 {
154 compatible = "arm,sp804", "arm,primecell"; 181 compatible = "arm,sp804", "arm,primecell";
155 reg = <0x110000 0x1000>; 182 reg = <0x110000 0x1000>;
156 interrupts = <2>; 183 interrupts = <2>;
184 clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&smbclk>;
185 clock-names = "timclken1", "timclken2", "apb_pclk";
157 }; 186 };
158 187
159 v2m_timer23: timer@120000 { 188 v2m_timer23: timer@120000 {
160 compatible = "arm,sp804", "arm,primecell"; 189 compatible = "arm,sp804", "arm,primecell";
161 reg = <0x120000 0x1000>; 190 reg = <0x120000 0x1000>;
162 interrupts = <3>; 191 interrupts = <3>;
192 clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&smbclk>;
193 clock-names = "timclken1", "timclken2", "apb_pclk";
163 }; 194 };
164 195
165 /* DVI I2C bus */ 196 /* DVI I2C bus */
@@ -185,6 +216,8 @@
185 compatible = "arm,pl031", "arm,primecell"; 216 compatible = "arm,pl031", "arm,primecell";
186 reg = <0x170000 0x1000>; 217 reg = <0x170000 0x1000>;
187 interrupts = <4>; 218 interrupts = <4>;
219 clocks = <&smbclk>;
220 clock-names = "apb_pclk";
188 }; 221 };
189 222
190 compact-flash@1a0000 { 223 compact-flash@1a0000 {
@@ -198,6 +231,8 @@
198 compatible = "arm,pl111", "arm,primecell"; 231 compatible = "arm,pl111", "arm,primecell";
199 reg = <0x1f0000 0x1000>; 232 reg = <0x1f0000 0x1000>;
200 interrupts = <14>; 233 interrupts = <14>;
234 clocks = <&v2m_oscclk1>, <&smbclk>;
235 clock-names = "clcdclk", "apb_pclk";
201 }; 236 };
202 }; 237 };
203 238
@@ -208,5 +243,98 @@
208 regulator-max-microvolt = <3300000>; 243 regulator-max-microvolt = <3300000>;
209 regulator-always-on; 244 regulator-always-on;
210 }; 245 };
246
247 v2m_clk24mhz: clk24mhz {
248 compatible = "fixed-clock";
249 #clock-cells = <0>;
250 clock-frequency = <24000000>;
251 clock-output-names = "v2m:clk24mhz";
252 };
253
254 v2m_refclk1mhz: refclk1mhz {
255 compatible = "fixed-clock";
256 #clock-cells = <0>;
257 clock-frequency = <1000000>;
258 clock-output-names = "v2m:refclk1mhz";
259 };
260
261 v2m_refclk32khz: refclk32khz {
262 compatible = "fixed-clock";
263 #clock-cells = <0>;
264 clock-frequency = <32768>;
265 clock-output-names = "v2m:refclk32khz";
266 };
267
268 mcc {
269 compatible = "arm,vexpress,config-bus";
270 arm,vexpress,config-bridge = <&v2m_sysreg>;
271
272 osc@0 {
273 /* MCC static memory clock */
274 compatible = "arm,vexpress-osc";
275 arm,vexpress-sysreg,func = <1 0>;
276 freq-range = <25000000 60000000>;
277 #clock-cells = <0>;
278 clock-output-names = "v2m:oscclk0";
279 };
280
281 v2m_oscclk1: osc@1 {
282 /* CLCD clock */
283 compatible = "arm,vexpress-osc";
284 arm,vexpress-sysreg,func = <1 1>;
285 freq-range = <23750000 63500000>;
286 #clock-cells = <0>;
287 clock-output-names = "v2m:oscclk1";
288 };
289
290 v2m_oscclk2: osc@2 {
291 /* IO FPGA peripheral clock */
292 compatible = "arm,vexpress-osc";
293 arm,vexpress-sysreg,func = <1 2>;
294 freq-range = <24000000 24000000>;
295 #clock-cells = <0>;
296 clock-output-names = "v2m:oscclk2";
297 };
298
299 volt@0 {
300 /* Logic level voltage */
301 compatible = "arm,vexpress-volt";
302 arm,vexpress-sysreg,func = <2 0>;
303 regulator-name = "VIO";
304 regulator-always-on;
305 label = "VIO";
306 };
307
308 temp@0 {
309 /* MCC internal operating temperature */
310 compatible = "arm,vexpress-temp";
311 arm,vexpress-sysreg,func = <4 0>;
312 label = "MCC";
313 };
314
315 reset@0 {
316 compatible = "arm,vexpress-reset";
317 arm,vexpress-sysreg,func = <5 0>;
318 };
319
320 muxfpga@0 {
321 compatible = "arm,vexpress-muxfpga";
322 arm,vexpress-sysreg,func = <7 0>;
323 };
324
325 shutdown@0 {
326 compatible = "arm,vexpress-shutdown";
327 arm,vexpress-sysreg,func = <8 0>;
328 };
329
330 reboot@0 {
331 compatible = "arm,vexpress-reboot";
332 arm,vexpress-sysreg,func = <9 0>;
333 };
334
335 dvimode@0 {
336 compatible = "arm,vexpress-dvimode";
337 arm,vexpress-sysreg,func = <11 0>;
338 };
339 };
211 }; 340 };
212};
diff --git a/arch/arm/boot/dts/vexpress-v2m.dtsi b/arch/arm/boot/dts/vexpress-v2m.dtsi
index dba53fd026b..f1420368355 100644
--- a/arch/arm/boot/dts/vexpress-v2m.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m.dtsi
@@ -17,16 +17,15 @@
17 * CHANGES TO vexpress-v2m-rs1.dtsi! 17 * CHANGES TO vexpress-v2m-rs1.dtsi!
18 */ 18 */
19 19
20/ {
21 aliases {
22 arm,v2m_timer = &v2m_timer01;
23 };
24
25 motherboard { 20 motherboard {
26 compatible = "simple-bus"; 21 model = "V2M-P1";
22 arm,hbi = <0x190>;
23 arm,vexpress,site = <0>;
24 compatible = "arm,vexpress,v2m-p1", "simple-bus";
27 #address-cells = <2>; /* SMB chipselect number and offset */ 25 #address-cells = <2>; /* SMB chipselect number and offset */
28 #size-cells = <1>; 26 #size-cells = <1>;
29 #interrupt-cells = <1>; 27 #interrupt-cells = <1>;
28 ranges;
30 29
31 flash@0,00000000 { 30 flash@0,00000000 {
32 compatible = "arm,vexpress-flash", "cfi-flash"; 31 compatible = "arm,vexpress-flash", "cfi-flash";
@@ -71,14 +70,20 @@
71 #size-cells = <1>; 70 #size-cells = <1>;
72 ranges = <0 7 0 0x20000>; 71 ranges = <0 7 0 0x20000>;
73 72
74 sysreg@00000 { 73 v2m_sysreg: sysreg@00000 {
75 compatible = "arm,vexpress-sysreg"; 74 compatible = "arm,vexpress-sysreg";
76 reg = <0x00000 0x1000>; 75 reg = <0x00000 0x1000>;
76 gpio-controller;
77 #gpio-cells = <2>;
77 }; 78 };
78 79
79 sysctl@01000 { 80 v2m_sysctl: sysctl@01000 {
80 compatible = "arm,sp810", "arm,primecell"; 81 compatible = "arm,sp810", "arm,primecell";
81 reg = <0x01000 0x1000>; 82 reg = <0x01000 0x1000>;
83 clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&smbclk>;
84 clock-names = "refclk", "timclk", "apb_pclk";
85 #clock-cells = <1>;
86 clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3";
82 }; 87 };
83 88
84 /* PCI-E I2C bus */ 89 /* PCI-E I2C bus */
@@ -99,66 +104,92 @@
99 compatible = "arm,pl041", "arm,primecell"; 104 compatible = "arm,pl041", "arm,primecell";
100 reg = <0x04000 0x1000>; 105 reg = <0x04000 0x1000>;
101 interrupts = <11>; 106 interrupts = <11>;
107 clocks = <&smbclk>;
108 clock-names = "apb_pclk";
102 }; 109 };
103 110
104 mmci@05000 { 111 mmci@05000 {
105 compatible = "arm,pl180", "arm,primecell"; 112 compatible = "arm,pl180", "arm,primecell";
106 reg = <0x05000 0x1000>; 113 reg = <0x05000 0x1000>;
107 interrupts = <9 10>; 114 interrupts = <9 10>;
115 cd-gpios = <&v2m_sysreg 0 0>;
116 wp-gpios = <&v2m_sysreg 1 0>;
117 max-frequency = <12000000>;
118 vmmc-supply = <&v2m_fixed_3v3>;
119 clocks = <&v2m_clk24mhz>, <&smbclk>;
120 clock-names = "mclk", "apb_pclk";
108 }; 121 };
109 122
110 kmi@06000 { 123 kmi@06000 {
111 compatible = "arm,pl050", "arm,primecell"; 124 compatible = "arm,pl050", "arm,primecell";
112 reg = <0x06000 0x1000>; 125 reg = <0x06000 0x1000>;
113 interrupts = <12>; 126 interrupts = <12>;
127 clocks = <&v2m_clk24mhz>, <&smbclk>;
128 clock-names = "KMIREFCLK", "apb_pclk";
114 }; 129 };
115 130
116 kmi@07000 { 131 kmi@07000 {
117 compatible = "arm,pl050", "arm,primecell"; 132 compatible = "arm,pl050", "arm,primecell";
118 reg = <0x07000 0x1000>; 133 reg = <0x07000 0x1000>;
119 interrupts = <13>; 134 interrupts = <13>;
135 clocks = <&v2m_clk24mhz>, <&smbclk>;
136 clock-names = "KMIREFCLK", "apb_pclk";
120 }; 137 };
121 138
122 v2m_serial0: uart@09000 { 139 v2m_serial0: uart@09000 {
123 compatible = "arm,pl011", "arm,primecell"; 140 compatible = "arm,pl011", "arm,primecell";
124 reg = <0x09000 0x1000>; 141 reg = <0x09000 0x1000>;
125 interrupts = <5>; 142 interrupts = <5>;
143 clocks = <&v2m_oscclk2>, <&smbclk>;
144 clock-names = "uartclk", "apb_pclk";
126 }; 145 };
127 146
128 v2m_serial1: uart@0a000 { 147 v2m_serial1: uart@0a000 {
129 compatible = "arm,pl011", "arm,primecell"; 148 compatible = "arm,pl011", "arm,primecell";
130 reg = <0x0a000 0x1000>; 149 reg = <0x0a000 0x1000>;
131 interrupts = <6>; 150 interrupts = <6>;
151 clocks = <&v2m_oscclk2>, <&smbclk>;
152 clock-names = "uartclk", "apb_pclk";
132 }; 153 };
133 154
134 v2m_serial2: uart@0b000 { 155 v2m_serial2: uart@0b000 {
135 compatible = "arm,pl011", "arm,primecell"; 156 compatible = "arm,pl011", "arm,primecell";
136 reg = <0x0b000 0x1000>; 157 reg = <0x0b000 0x1000>;
137 interrupts = <7>; 158 interrupts = <7>;
159 clocks = <&v2m_oscclk2>, <&smbclk>;
160 clock-names = "uartclk", "apb_pclk";
138 }; 161 };
139 162
140 v2m_serial3: uart@0c000 { 163 v2m_serial3: uart@0c000 {
141 compatible = "arm,pl011", "arm,primecell"; 164 compatible = "arm,pl011", "arm,primecell";
142 reg = <0x0c000 0x1000>; 165 reg = <0x0c000 0x1000>;
143 interrupts = <8>; 166 interrupts = <8>;
167 clocks = <&v2m_oscclk2>, <&smbclk>;
168 clock-names = "uartclk", "apb_pclk";
144 }; 169 };
145 170
146 wdt@0f000 { 171 wdt@0f000 {
147 compatible = "arm,sp805", "arm,primecell"; 172 compatible = "arm,sp805", "arm,primecell";
148 reg = <0x0f000 0x1000>; 173 reg = <0x0f000 0x1000>;
149 interrupts = <0>; 174 interrupts = <0>;
175 clocks = <&v2m_refclk32khz>, <&smbclk>;
176 clock-names = "wdogclk", "apb_pclk";
150 }; 177 };
151 178
152 v2m_timer01: timer@11000 { 179 v2m_timer01: timer@11000 {
153 compatible = "arm,sp804", "arm,primecell"; 180 compatible = "arm,sp804", "arm,primecell";
154 reg = <0x11000 0x1000>; 181 reg = <0x11000 0x1000>;
155 interrupts = <2>; 182 interrupts = <2>;
183 clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&smbclk>;
184 clock-names = "timclken1", "timclken2", "apb_pclk";
156 }; 185 };
157 186
158 v2m_timer23: timer@12000 { 187 v2m_timer23: timer@12000 {
159 compatible = "arm,sp804", "arm,primecell"; 188 compatible = "arm,sp804", "arm,primecell";
160 reg = <0x12000 0x1000>; 189 reg = <0x12000 0x1000>;
161 interrupts = <3>; 190 interrupts = <3>;
191 clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&smbclk>;
192 clock-names = "timclken1", "timclken2", "apb_pclk";
162 }; 193 };
163 194
164 /* DVI I2C bus */ 195 /* DVI I2C bus */
@@ -184,6 +215,8 @@
184 compatible = "arm,pl031", "arm,primecell"; 215 compatible = "arm,pl031", "arm,primecell";
185 reg = <0x17000 0x1000>; 216 reg = <0x17000 0x1000>;
186 interrupts = <4>; 217 interrupts = <4>;
218 clocks = <&smbclk>;
219 clock-names = "apb_pclk";
187 }; 220 };
188 221
189 compact-flash@1a000 { 222 compact-flash@1a000 {
@@ -197,6 +230,8 @@
197 compatible = "arm,pl111", "arm,primecell"; 230 compatible = "arm,pl111", "arm,primecell";
198 reg = <0x1f000 0x1000>; 231 reg = <0x1f000 0x1000>;
199 interrupts = <14>; 232 interrupts = <14>;
233 clocks = <&v2m_oscclk1>, <&smbclk>;
234 clock-names = "clcdclk", "apb_pclk";
200 }; 235 };
201 }; 236 };
202 237
@@ -207,5 +242,98 @@
207 regulator-max-microvolt = <3300000>; 242 regulator-max-microvolt = <3300000>;
208 regulator-always-on; 243 regulator-always-on;
209 }; 244 };
245
246 v2m_clk24mhz: clk24mhz {
247 compatible = "fixed-clock";
248 #clock-cells = <0>;
249 clock-frequency = <24000000>;
250 clock-output-names = "v2m:clk24mhz";
251 };
252
253 v2m_refclk1mhz: refclk1mhz {
254 compatible = "fixed-clock";
255 #clock-cells = <0>;
256 clock-frequency = <1000000>;
257 clock-output-names = "v2m:refclk1mhz";
258 };
259
260 v2m_refclk32khz: refclk32khz {
261 compatible = "fixed-clock";
262 #clock-cells = <0>;
263 clock-frequency = <32768>;
264 clock-output-names = "v2m:refclk32khz";
265 };
266
267 mcc {
268 compatible = "arm,vexpress,config-bus";
269 arm,vexpress,config-bridge = <&v2m_sysreg>;
270
271 osc@0 {
272 /* MCC static memory clock */
273 compatible = "arm,vexpress-osc";
274 arm,vexpress-sysreg,func = <1 0>;
275 freq-range = <25000000 60000000>;
276 #clock-cells = <0>;
277 clock-output-names = "v2m:oscclk0";
278 };
279
280 v2m_oscclk1: osc@1 {
281 /* CLCD clock */
282 compatible = "arm,vexpress-osc";
283 arm,vexpress-sysreg,func = <1 1>;
284 freq-range = <23750000 63500000>;
285 #clock-cells = <0>;
286 clock-output-names = "v2m:oscclk1";
287 };
288
289 v2m_oscclk2: osc@2 {
290 /* IO FPGA peripheral clock */
291 compatible = "arm,vexpress-osc";
292 arm,vexpress-sysreg,func = <1 2>;
293 freq-range = <24000000 24000000>;
294 #clock-cells = <0>;
295 clock-output-names = "v2m:oscclk2";
296 };
297
298 volt@0 {
299 /* Logic level voltage */
300 compatible = "arm,vexpress-volt";
301 arm,vexpress-sysreg,func = <2 0>;
302 regulator-name = "VIO";
303 regulator-always-on;
304 label = "VIO";
305 };
306
307 temp@0 {
308 /* MCC internal operating temperature */
309 compatible = "arm,vexpress-temp";
310 arm,vexpress-sysreg,func = <4 0>;
311 label = "MCC";
312 };
313
314 reset@0 {
315 compatible = "arm,vexpress-reset";
316 arm,vexpress-sysreg,func = <5 0>;
317 };
318
319 muxfpga@0 {
320 compatible = "arm,vexpress-muxfpga";
321 arm,vexpress-sysreg,func = <7 0>;
322 };
323
324 shutdown@0 {
325 compatible = "arm,vexpress-shutdown";
326 arm,vexpress-sysreg,func = <8 0>;
327 };
328
329 reboot@0 {
330 compatible = "arm,vexpress-reboot";
331 arm,vexpress-sysreg,func = <9 0>;
332 };
333
334 dvimode@0 {
335 compatible = "arm,vexpress-dvimode";
336 arm,vexpress-sysreg,func = <11 0>;
337 };
338 };
210 }; 339 };
211};
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
index d12b34ca056..a3d37ec2655 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
@@ -12,6 +12,7 @@
12/ { 12/ {
13 model = "V2P-CA15"; 13 model = "V2P-CA15";
14 arm,hbi = <0x237>; 14 arm,hbi = <0x237>;
15 arm,vexpress,site = <0xf>;
15 compatible = "arm,vexpress,v2p-ca15,tc1", "arm,vexpress,v2p-ca15", "arm,vexpress"; 16 compatible = "arm,vexpress,v2p-ca15,tc1", "arm,vexpress,v2p-ca15", "arm,vexpress";
16 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
17 #address-cells = <2>; 18 #address-cells = <2>;
@@ -54,17 +55,24 @@
54 compatible = "arm,hdlcd"; 55 compatible = "arm,hdlcd";
55 reg = <0 0x2b000000 0 0x1000>; 56 reg = <0 0x2b000000 0 0x1000>;
56 interrupts = <0 85 4>; 57 interrupts = <0 85 4>;
58 clocks = <&oscclk5>;
59 clock-names = "pxlclk";
57 }; 60 };
58 61
59 memory-controller@2b0a0000 { 62 memory-controller@2b0a0000 {
60 compatible = "arm,pl341", "arm,primecell"; 63 compatible = "arm,pl341", "arm,primecell";
61 reg = <0 0x2b0a0000 0 0x1000>; 64 reg = <0 0x2b0a0000 0 0x1000>;
65 clocks = <&oscclk7>;
66 clock-names = "apb_pclk";
62 }; 67 };
63 68
64 wdt@2b060000 { 69 wdt@2b060000 {
65 compatible = "arm,sp805", "arm,primecell"; 70 compatible = "arm,sp805", "arm,primecell";
71 status = "disabled";
66 reg = <0 0x2b060000 0 0x1000>; 72 reg = <0 0x2b060000 0 0x1000>;
67 interrupts = <98>; 73 interrupts = <98>;
74 clocks = <&oscclk7>;
75 clock-names = "apb_pclk";
68 }; 76 };
69 77
70 gic: interrupt-controller@2c001000 { 78 gic: interrupt-controller@2c001000 {
@@ -84,6 +92,8 @@
84 reg = <0 0x7ffd0000 0 0x1000>; 92 reg = <0 0x7ffd0000 0 0x1000>;
85 interrupts = <0 86 4>, 93 interrupts = <0 86 4>,
86 <0 87 4>; 94 <0 87 4>;
95 clocks = <&oscclk7>;
96 clock-names = "apb_pclk";
87 }; 97 };
88 98
89 dma@7ffb0000 { 99 dma@7ffb0000 {
@@ -94,6 +104,8 @@
94 <0 89 4>, 104 <0 89 4>,
95 <0 90 4>, 105 <0 90 4>,
96 <0 91 4>; 106 <0 91 4>;
107 clocks = <&oscclk7>;
108 clock-names = "apb_pclk";
97 }; 109 };
98 110
99 timer { 111 timer {
@@ -110,7 +122,109 @@
110 <0 69 4>; 122 <0 69 4>;
111 }; 123 };
112 124
113 motherboard { 125 dcc {
126 compatible = "arm,vexpress,config-bus";
127 arm,vexpress,config-bridge = <&v2m_sysreg>;
128
129 osc@0 {
130 /* CPU PLL reference clock */
131 compatible = "arm,vexpress-osc";
132 arm,vexpress-sysreg,func = <1 0>;
133 freq-range = <50000000 60000000>;
134 #clock-cells = <0>;
135 clock-output-names = "oscclk0";
136 };
137
138 osc@4 {
139 /* Multiplexed AXI master clock */
140 compatible = "arm,vexpress-osc";
141 arm,vexpress-sysreg,func = <1 4>;
142 freq-range = <20000000 40000000>;
143 #clock-cells = <0>;
144 clock-output-names = "oscclk4";
145 };
146
147 oscclk5: osc@5 {
148 /* HDLCD PLL reference clock */
149 compatible = "arm,vexpress-osc";
150 arm,vexpress-sysreg,func = <1 5>;
151 freq-range = <23750000 165000000>;
152 #clock-cells = <0>;
153 clock-output-names = "oscclk5";
154 };
155
156 smbclk: osc@6 {
157 /* SMB clock */
158 compatible = "arm,vexpress-osc";
159 arm,vexpress-sysreg,func = <1 6>;
160 freq-range = <20000000 50000000>;
161 #clock-cells = <0>;
162 clock-output-names = "oscclk6";
163 };
164
165 oscclk7: osc@7 {
166 /* SYS PLL reference clock */
167 compatible = "arm,vexpress-osc";
168 arm,vexpress-sysreg,func = <1 7>;
169 freq-range = <20000000 60000000>;
170 #clock-cells = <0>;
171 clock-output-names = "oscclk7";
172 };
173
174 osc@8 {
175 /* DDR2 PLL reference clock */
176 compatible = "arm,vexpress-osc";
177 arm,vexpress-sysreg,func = <1 8>;
178 freq-range = <40000000 40000000>;
179 #clock-cells = <0>;
180 clock-output-names = "oscclk8";
181 };
182
183 volt@0 {
184 /* CPU core voltage */
185 compatible = "arm,vexpress-volt";
186 arm,vexpress-sysreg,func = <2 0>;
187 regulator-name = "Cores";
188 regulator-min-microvolt = <800000>;
189 regulator-max-microvolt = <1050000>;
190 regulator-always-on;
191 label = "Cores";
192 };
193
194 amp@0 {
195 /* Total current for the two cores */
196 compatible = "arm,vexpress-amp";
197 arm,vexpress-sysreg,func = <3 0>;
198 label = "Cores";
199 };
200
201 temp@0 {
202 /* DCC internal temperature */
203 compatible = "arm,vexpress-temp";
204 arm,vexpress-sysreg,func = <4 0>;
205 label = "DCC";
206 };
207
208 power@0 {
209 /* Total power */
210 compatible = "arm,vexpress-power";
211 arm,vexpress-sysreg,func = <12 0>;
212 label = "Cores";
213 };
214
215 energy@0 {
216 /* Total energy */
217 compatible = "arm,vexpress-energy";
218 arm,vexpress-sysreg,func = <13 0>;
219 label = "Cores";
220 };
221 };
222
223 smb {
224 compatible = "simple-bus";
225
226 #address-cells = <2>;
227 #size-cells = <1>;
114 ranges = <0 0 0 0x08000000 0x04000000>, 228 ranges = <0 0 0 0x08000000 0x04000000>,
115 <1 0 0 0x14000000 0x04000000>, 229 <1 0 0 0x14000000 0x04000000>,
116 <2 0 0 0x18000000 0x04000000>, 230 <2 0 0 0x18000000 0x04000000>,
@@ -118,6 +232,7 @@
118 <4 0 0 0x0c000000 0x04000000>, 232 <4 0 0 0x0c000000 0x04000000>,
119 <5 0 0 0x10000000 0x04000000>; 233 <5 0 0 0x10000000 0x04000000>;
120 234
235 #interrupt-cells = <1>;
121 interrupt-map-mask = <0 0 63>; 236 interrupt-map-mask = <0 0 63>;
122 interrupt-map = <0 0 0 &gic 0 0 4>, 237 interrupt-map = <0 0 0 &gic 0 0 4>,
123 <0 0 1 &gic 0 1 4>, 238 <0 0 1 &gic 0 1 4>,
@@ -162,7 +277,7 @@
162 <0 0 40 &gic 0 40 4>, 277 <0 0 40 &gic 0 40 4>,
163 <0 0 41 &gic 0 41 4>, 278 <0 0 41 &gic 0 41 4>,
164 <0 0 42 &gic 0 42 4>; 279 <0 0 42 &gic 0 42 4>;
280
281 /include/ "vexpress-v2m-rs1.dtsi"
165 }; 282 };
166}; 283};
167
168/include/ "vexpress-v2m-rs1.dtsi"
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index 4890a81c546..1fc405a9ecf 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -12,6 +12,7 @@
12/ { 12/ {
13 model = "V2P-CA15_CA7"; 13 model = "V2P-CA15_CA7";
14 arm,hbi = <0x249>; 14 arm,hbi = <0x249>;
15 arm,vexpress,site = <0xf>;
15 compatible = "arm,vexpress,v2p-ca15_a7", "arm,vexpress"; 16 compatible = "arm,vexpress,v2p-ca15_a7", "arm,vexpress";
16 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
17 #address-cells = <2>; 18 #address-cells = <2>;
@@ -74,17 +75,23 @@
74 compatible = "arm,sp805", "arm,primecell"; 75 compatible = "arm,sp805", "arm,primecell";
75 reg = <0 0x2a490000 0 0x1000>; 76 reg = <0 0x2a490000 0 0x1000>;
76 interrupts = <98>; 77 interrupts = <98>;
78 clocks = <&oscclk6a>, <&oscclk6a>;
79 clock-names = "wdogclk", "apb_pclk";
77 }; 80 };
78 81
79 hdlcd@2b000000 { 82 hdlcd@2b000000 {
80 compatible = "arm,hdlcd"; 83 compatible = "arm,hdlcd";
81 reg = <0 0x2b000000 0 0x1000>; 84 reg = <0 0x2b000000 0 0x1000>;
82 interrupts = <0 85 4>; 85 interrupts = <0 85 4>;
86 clocks = <&oscclk5>;
87 clock-names = "pxlclk";
83 }; 88 };
84 89
85 memory-controller@2b0a0000 { 90 memory-controller@2b0a0000 {
86 compatible = "arm,pl341", "arm,primecell"; 91 compatible = "arm,pl341", "arm,primecell";
87 reg = <0 0x2b0a0000 0 0x1000>; 92 reg = <0 0x2b0a0000 0 0x1000>;
93 clocks = <&oscclk6a>;
94 clock-names = "apb_pclk";
88 }; 95 };
89 96
90 gic: interrupt-controller@2c001000 { 97 gic: interrupt-controller@2c001000 {
@@ -104,6 +111,8 @@
104 reg = <0 0x7ffd0000 0 0x1000>; 111 reg = <0 0x7ffd0000 0 0x1000>;
105 interrupts = <0 86 4>, 112 interrupts = <0 86 4>,
106 <0 87 4>; 113 <0 87 4>;
114 clocks = <&oscclk6a>;
115 clock-names = "apb_pclk";
107 }; 116 };
108 117
109 dma@7ff00000 { 118 dma@7ff00000 {
@@ -114,6 +123,8 @@
114 <0 89 4>, 123 <0 89 4>,
115 <0 90 4>, 124 <0 90 4>,
116 <0 91 4>; 125 <0 91 4>;
126 clocks = <&oscclk6a>;
127 clock-names = "apb_pclk";
117 }; 128 };
118 129
119 timer { 130 timer {
@@ -130,7 +141,175 @@
130 <0 69 4>; 141 <0 69 4>;
131 }; 142 };
132 143
133 motherboard { 144 oscclk6a: oscclk6a {
145 /* Reference 24MHz clock */
146 compatible = "fixed-clock";
147 #clock-cells = <0>;
148 clock-frequency = <24000000>;
149 clock-output-names = "oscclk6a";
150 };
151
152 dcc {
153 compatible = "arm,vexpress,config-bus";
154 arm,vexpress,config-bridge = <&v2m_sysreg>;
155
156 osc@0 {
157 /* A15 PLL 0 reference clock */
158 compatible = "arm,vexpress-osc";
159 arm,vexpress-sysreg,func = <1 0>;
160 freq-range = <17000000 50000000>;
161 #clock-cells = <0>;
162 clock-output-names = "oscclk0";
163 };
164
165 osc@1 {
166 /* A15 PLL 1 reference clock */
167 compatible = "arm,vexpress-osc";
168 arm,vexpress-sysreg,func = <1 1>;
169 freq-range = <17000000 50000000>;
170 #clock-cells = <0>;
171 clock-output-names = "oscclk1";
172 };
173
174 osc@2 {
175 /* A7 PLL 0 reference clock */
176 compatible = "arm,vexpress-osc";
177 arm,vexpress-sysreg,func = <1 2>;
178 freq-range = <17000000 50000000>;
179 #clock-cells = <0>;
180 clock-output-names = "oscclk2";
181 };
182
183 osc@3 {
184 /* A7 PLL 1 reference clock */
185 compatible = "arm,vexpress-osc";
186 arm,vexpress-sysreg,func = <1 3>;
187 freq-range = <17000000 50000000>;
188 #clock-cells = <0>;
189 clock-output-names = "oscclk3";
190 };
191
192 osc@4 {
193 /* External AXI master clock */
194 compatible = "arm,vexpress-osc";
195 arm,vexpress-sysreg,func = <1 4>;
196 freq-range = <20000000 40000000>;
197 #clock-cells = <0>;
198 clock-output-names = "oscclk4";
199 };
200
201 oscclk5: osc@5 {
202 /* HDLCD PLL reference clock */
203 compatible = "arm,vexpress-osc";
204 arm,vexpress-sysreg,func = <1 5>;
205 freq-range = <23750000 165000000>;
206 #clock-cells = <0>;
207 clock-output-names = "oscclk5";
208 };
209
210 smbclk: osc@6 {
211 /* Static memory controller clock */
212 compatible = "arm,vexpress-osc";
213 arm,vexpress-sysreg,func = <1 6>;
214 freq-range = <20000000 40000000>;
215 #clock-cells = <0>;
216 clock-output-names = "oscclk6";
217 };
218
219 osc@7 {
220 /* SYS PLL reference clock */
221 compatible = "arm,vexpress-osc";
222 arm,vexpress-sysreg,func = <1 7>;
223 freq-range = <17000000 50000000>;
224 #clock-cells = <0>;
225 clock-output-names = "oscclk7";
226 };
227
228 osc@8 {
229 /* DDR2 PLL reference clock */
230 compatible = "arm,vexpress-osc";
231 arm,vexpress-sysreg,func = <1 8>;
232 freq-range = <20000000 50000000>;
233 #clock-cells = <0>;
234 clock-output-names = "oscclk8";
235 };
236
237 volt@0 {
238 /* A15 CPU core voltage */
239 compatible = "arm,vexpress-volt";
240 arm,vexpress-sysreg,func = <2 0>;
241 regulator-name = "A15 Vcore";
242 regulator-min-microvolt = <800000>;
243 regulator-max-microvolt = <1050000>;
244 regulator-always-on;
245 label = "A15 Vcore";
246 };
247
248 volt@1 {
249 /* A7 CPU core voltage */
250 compatible = "arm,vexpress-volt";
251 arm,vexpress-sysreg,func = <2 1>;
252 regulator-name = "A7 Vcore";
253 regulator-min-microvolt = <800000>;
254 regulator-max-microvolt = <1050000>;
255 regulator-always-on;
256 label = "A7 Vcore";
257 };
258
259 amp@0 {
260 /* Total current for the two A15 cores */
261 compatible = "arm,vexpress-amp";
262 arm,vexpress-sysreg,func = <3 0>;
263 label = "A15 Icore";
264 };
265
266 amp@1 {
267 /* Total current for the three A7 cores */
268 compatible = "arm,vexpress-amp";
269 arm,vexpress-sysreg,func = <3 1>;
270 label = "A7 Icore";
271 };
272
273 temp@0 {
274 /* DCC internal temperature */
275 compatible = "arm,vexpress-temp";
276 arm,vexpress-sysreg,func = <4 0>;
277 label = "DCC";
278 };
279
280 power@0 {
281 /* Total power for the two A15 cores */
282 compatible = "arm,vexpress-power";
283 arm,vexpress-sysreg,func = <12 0>;
284 label = "A15 Pcore";
285 };
286 power@1 {
287 /* Total power for the three A7 cores */
288 compatible = "arm,vexpress-power";
289 arm,vexpress-sysreg,func = <12 1>;
290 label = "A7 Pcore";
291 };
292
293 energy@0 {
294 /* Total energy for the two A15 cores */
295 compatible = "arm,vexpress-energy";
296 arm,vexpress-sysreg,func = <13 0>;
297 label = "A15 Jcore";
298 };
299
300 energy@2 {
301 /* Total energy for the three A7 cores */
302 compatible = "arm,vexpress-energy";
303 arm,vexpress-sysreg,func = <13 2>;
304 label = "A7 Jcore";
305 };
306 };
307
308 smb {
309 compatible = "simple-bus";
310
311 #address-cells = <2>;
312 #size-cells = <1>;
134 ranges = <0 0 0 0x08000000 0x04000000>, 313 ranges = <0 0 0 0x08000000 0x04000000>,
135 <1 0 0 0x14000000 0x04000000>, 314 <1 0 0 0x14000000 0x04000000>,
136 <2 0 0 0x18000000 0x04000000>, 315 <2 0 0 0x18000000 0x04000000>,
@@ -138,6 +317,7 @@
138 <4 0 0 0x0c000000 0x04000000>, 317 <4 0 0 0x0c000000 0x04000000>,
139 <5 0 0 0x10000000 0x04000000>; 318 <5 0 0 0x10000000 0x04000000>;
140 319
320 #interrupt-cells = <1>;
141 interrupt-map-mask = <0 0 63>; 321 interrupt-map-mask = <0 0 63>;
142 interrupt-map = <0 0 0 &gic 0 0 4>, 322 interrupt-map = <0 0 0 &gic 0 0 4>,
143 <0 0 1 &gic 0 1 4>, 323 <0 0 1 &gic 0 1 4>,
@@ -182,7 +362,7 @@
182 <0 0 40 &gic 0 40 4>, 362 <0 0 40 &gic 0 40 4>,
183 <0 0 41 &gic 0 41 4>, 363 <0 0 41 &gic 0 41 4>,
184 <0 0 42 &gic 0 42 4>; 364 <0 0 42 &gic 0 42 4>;
365
366 /include/ "vexpress-v2m-rs1.dtsi"
185 }; 367 };
186}; 368};
187
188/include/ "vexpress-v2m-rs1.dtsi"
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca5s.dts b/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
index 18917a0f860..6328cbc71d3 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
@@ -12,6 +12,7 @@
12/ { 12/ {
13 model = "V2P-CA5s"; 13 model = "V2P-CA5s";
14 arm,hbi = <0x225>; 14 arm,hbi = <0x225>;
15 arm,vexpress,site = <0xf>;
15 compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress"; 16 compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress";
16 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
17 #address-cells = <1>; 18 #address-cells = <1>;
@@ -56,11 +57,15 @@
56 compatible = "arm,hdlcd"; 57 compatible = "arm,hdlcd";
57 reg = <0x2a110000 0x1000>; 58 reg = <0x2a110000 0x1000>;
58 interrupts = <0 85 4>; 59 interrupts = <0 85 4>;
60 clocks = <&oscclk3>;
61 clock-names = "pxlclk";
59 }; 62 };
60 63
61 memory-controller@2a150000 { 64 memory-controller@2a150000 {
62 compatible = "arm,pl341", "arm,primecell"; 65 compatible = "arm,pl341", "arm,primecell";
63 reg = <0x2a150000 0x1000>; 66 reg = <0x2a150000 0x1000>;
67 clocks = <&oscclk1>;
68 clock-names = "apb_pclk";
64 }; 69 };
65 70
66 memory-controller@2a190000 { 71 memory-controller@2a190000 {
@@ -68,6 +73,8 @@
68 reg = <0x2a190000 0x1000>; 73 reg = <0x2a190000 0x1000>;
69 interrupts = <0 86 4>, 74 interrupts = <0 86 4>,
70 <0 87 4>; 75 <0 87 4>;
76 clocks = <&oscclk1>;
77 clock-names = "apb_pclk";
71 }; 78 };
72 79
73 scu@2c000000 { 80 scu@2c000000 {
@@ -109,7 +116,77 @@
109 <0 69 4>; 116 <0 69 4>;
110 }; 117 };
111 118
112 motherboard { 119 dcc {
120 compatible = "arm,vexpress,config-bus";
121 arm,vexpress,config-bridge = <&v2m_sysreg>;
122
123 osc@0 {
124 /* CPU and internal AXI reference clock */
125 compatible = "arm,vexpress-osc";
126 arm,vexpress-sysreg,func = <1 0>;
127 freq-range = <50000000 100000000>;
128 #clock-cells = <0>;
129 clock-output-names = "oscclk0";
130 };
131
132 oscclk1: osc@1 {
133 /* Multiplexed AXI master clock */
134 compatible = "arm,vexpress-osc";
135 arm,vexpress-sysreg,func = <1 1>;
136 freq-range = <5000000 50000000>;
137 #clock-cells = <0>;
138 clock-output-names = "oscclk1";
139 };
140
141 osc@2 {
142 /* DDR2 */
143 compatible = "arm,vexpress-osc";
144 arm,vexpress-sysreg,func = <1 2>;
145 freq-range = <80000000 120000000>;
146 #clock-cells = <0>;
147 clock-output-names = "oscclk2";
148 };
149
150 oscclk3: osc@3 {
151 /* HDLCD */
152 compatible = "arm,vexpress-osc";
153 arm,vexpress-sysreg,func = <1 3>;
154 freq-range = <23750000 165000000>;
155 #clock-cells = <0>;
156 clock-output-names = "oscclk3";
157 };
158
159 osc@4 {
160 /* Test chip gate configuration */
161 compatible = "arm,vexpress-osc";
162 arm,vexpress-sysreg,func = <1 4>;
163 freq-range = <80000000 80000000>;
164 #clock-cells = <0>;
165 clock-output-names = "oscclk4";
166 };
167
168 smbclk: osc@5 {
169 /* SMB clock */
170 compatible = "arm,vexpress-osc";
171 arm,vexpress-sysreg,func = <1 5>;
172 freq-range = <25000000 60000000>;
173 #clock-cells = <0>;
174 clock-output-names = "oscclk5";
175 };
176
177 temp@0 {
178 /* DCC internal operating temperature */
179 compatible = "arm,vexpress-temp";
180 arm,vexpress-sysreg,func = <4 0>;
181 label = "DCC";
182 };
183 };
184
185 smb {
186 compatible = "simple-bus";
187
188 #address-cells = <2>;
189 #size-cells = <1>;
113 ranges = <0 0 0x08000000 0x04000000>, 190 ranges = <0 0 0x08000000 0x04000000>,
114 <1 0 0x14000000 0x04000000>, 191 <1 0 0x14000000 0x04000000>,
115 <2 0 0x18000000 0x04000000>, 192 <2 0 0x18000000 0x04000000>,
@@ -117,6 +194,7 @@
117 <4 0 0x0c000000 0x04000000>, 194 <4 0 0x0c000000 0x04000000>,
118 <5 0 0x10000000 0x04000000>; 195 <5 0 0x10000000 0x04000000>;
119 196
197 #interrupt-cells = <1>;
120 interrupt-map-mask = <0 0 63>; 198 interrupt-map-mask = <0 0 63>;
121 interrupt-map = <0 0 0 &gic 0 0 4>, 199 interrupt-map = <0 0 0 &gic 0 0 4>,
122 <0 0 1 &gic 0 1 4>, 200 <0 0 1 &gic 0 1 4>,
@@ -161,7 +239,7 @@
161 <0 0 40 &gic 0 40 4>, 239 <0 0 40 &gic 0 40 4>,
162 <0 0 41 &gic 0 41 4>, 240 <0 0 41 &gic 0 41 4>,
163 <0 0 42 &gic 0 42 4>; 241 <0 0 42 &gic 0 42 4>;
242
243 /include/ "vexpress-v2m-rs1.dtsi"
164 }; 244 };
165}; 245};
166
167/include/ "vexpress-v2m-rs1.dtsi"
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca9.dts b/arch/arm/boot/dts/vexpress-v2p-ca9.dts
index 3f0c736d31d..1420bb14d95 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca9.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca9.dts
@@ -12,6 +12,7 @@
12/ { 12/ {
13 model = "V2P-CA9"; 13 model = "V2P-CA9";
14 arm,hbi = <0x191>; 14 arm,hbi = <0x191>;
15 arm,vexpress,site = <0xf>;
15 compatible = "arm,vexpress,v2p-ca9", "arm,vexpress"; 16 compatible = "arm,vexpress,v2p-ca9", "arm,vexpress";
16 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
17 #address-cells = <1>; 18 #address-cells = <1>;
@@ -70,11 +71,15 @@
70 compatible = "arm,pl111", "arm,primecell"; 71 compatible = "arm,pl111", "arm,primecell";
71 reg = <0x10020000 0x1000>; 72 reg = <0x10020000 0x1000>;
72 interrupts = <0 44 4>; 73 interrupts = <0 44 4>;
74 clocks = <&oscclk1>, <&oscclk2>;
75 clock-names = "clcdclk", "apb_pclk";
73 }; 76 };
74 77
75 memory-controller@100e0000 { 78 memory-controller@100e0000 {
76 compatible = "arm,pl341", "arm,primecell"; 79 compatible = "arm,pl341", "arm,primecell";
77 reg = <0x100e0000 0x1000>; 80 reg = <0x100e0000 0x1000>;
81 clocks = <&oscclk2>;
82 clock-names = "apb_pclk";
78 }; 83 };
79 84
80 memory-controller@100e1000 { 85 memory-controller@100e1000 {
@@ -82,6 +87,8 @@
82 reg = <0x100e1000 0x1000>; 87 reg = <0x100e1000 0x1000>;
83 interrupts = <0 45 4>, 88 interrupts = <0 45 4>,
84 <0 46 4>; 89 <0 46 4>;
90 clocks = <&oscclk2>;
91 clock-names = "apb_pclk";
85 }; 92 };
86 93
87 timer@100e4000 { 94 timer@100e4000 {
@@ -89,12 +96,16 @@
89 reg = <0x100e4000 0x1000>; 96 reg = <0x100e4000 0x1000>;
90 interrupts = <0 48 4>, 97 interrupts = <0 48 4>,
91 <0 49 4>; 98 <0 49 4>;
99 clocks = <&oscclk2>, <&oscclk2>;
100 clock-names = "timclk", "apb_pclk";
92 }; 101 };
93 102
94 watchdog@100e5000 { 103 watchdog@100e5000 {
95 compatible = "arm,sp805", "arm,primecell"; 104 compatible = "arm,sp805", "arm,primecell";
96 reg = <0x100e5000 0x1000>; 105 reg = <0x100e5000 0x1000>;
97 interrupts = <0 51 4>; 106 interrupts = <0 51 4>;
107 clocks = <&oscclk2>, <&oscclk2>;
108 clock-names = "wdogclk", "apb_pclk";
98 }; 109 };
99 110
100 scu@1e000000 { 111 scu@1e000000 {
@@ -140,13 +151,132 @@
140 <0 63 4>; 151 <0 63 4>;
141 }; 152 };
142 153
143 motherboard { 154 dcc {
155 compatible = "arm,vexpress,config-bus";
156 arm,vexpress,config-bridge = <&v2m_sysreg>;
157
158 osc@0 {
159 /* ACLK clock to the AXI master port on the test chip */
160 compatible = "arm,vexpress-osc";
161 arm,vexpress-sysreg,func = <1 0>;
162 freq-range = <30000000 50000000>;
163 #clock-cells = <0>;
164 clock-output-names = "extsaxiclk";
165 };
166
167 oscclk1: osc@1 {
168 /* Reference clock for the CLCD */
169 compatible = "arm,vexpress-osc";
170 arm,vexpress-sysreg,func = <1 1>;
171 freq-range = <10000000 80000000>;
172 #clock-cells = <0>;
173 clock-output-names = "clcdclk";
174 };
175
176 smbclk: oscclk2: osc@2 {
177 /* Reference clock for the test chip internal PLLs */
178 compatible = "arm,vexpress-osc";
179 arm,vexpress-sysreg,func = <1 2>;
180 freq-range = <33000000 100000000>;
181 #clock-cells = <0>;
182 clock-output-names = "tcrefclk";
183 };
184
185 volt@0 {
186 /* Test Chip internal logic voltage */
187 compatible = "arm,vexpress-volt";
188 arm,vexpress-sysreg,func = <2 0>;
189 regulator-name = "VD10";
190 regulator-always-on;
191 label = "VD10";
192 };
193
194 volt@1 {
195 /* PL310, L2 cache, RAM cell supply (not PL310 logic) */
196 compatible = "arm,vexpress-volt";
197 arm,vexpress-sysreg,func = <2 1>;
198 regulator-name = "VD10_S2";
199 regulator-always-on;
200 label = "VD10_S2";
201 };
202
203 volt@2 {
204 /* Cortex-A9 system supply, Cores, MPEs, SCU and PL310 logic */
205 compatible = "arm,vexpress-volt";
206 arm,vexpress-sysreg,func = <2 2>;
207 regulator-name = "VD10_S3";
208 regulator-always-on;
209 label = "VD10_S3";
210 };
211
212 volt@3 {
213 /* DDR2 SDRAM and Test Chip DDR2 I/O supply */
214 compatible = "arm,vexpress-volt";
215 arm,vexpress-sysreg,func = <2 3>;
216 regulator-name = "VCC1V8";
217 regulator-always-on;
218 label = "VCC1V8";
219 };
220
221 volt@4 {
222 /* DDR2 SDRAM VTT termination voltage */
223 compatible = "arm,vexpress-volt";
224 arm,vexpress-sysreg,func = <2 4>;
225 regulator-name = "DDR2VTT";
226 regulator-always-on;
227 label = "DDR2VTT";
228 };
229
230 volt@5 {
231 /* Local board supply for miscellaneous logic external to the Test Chip */
232 arm,vexpress-sysreg,func = <2 5>;
233 compatible = "arm,vexpress-volt";
234 regulator-name = "VCC3V3";
235 regulator-always-on;
236 label = "VCC3V3";
237 };
238
239 amp@0 {
240 /* PL310, L2 cache, RAM cell supply (not PL310 logic) */
241 compatible = "arm,vexpress-amp";
242 arm,vexpress-sysreg,func = <3 0>;
243 label = "VD10_S2";
244 };
245
246 amp@1 {
247 /* Cortex-A9 system supply, Cores, MPEs, SCU and PL310 logic */
248 compatible = "arm,vexpress-amp";
249 arm,vexpress-sysreg,func = <3 1>;
250 label = "VD10_S3";
251 };
252
253 power@0 {
254 /* PL310, L2 cache, RAM cell supply (not PL310 logic) */
255 compatible = "arm,vexpress-power";
256 arm,vexpress-sysreg,func = <12 0>;
257 label = "PVD10_S2";
258 };
259
260 power@1 {
261 /* Cortex-A9 system supply, Cores, MPEs, SCU and PL310 logic */
262 compatible = "arm,vexpress-power";
263 arm,vexpress-sysreg,func = <12 1>;
264 label = "PVD10_S3";
265 };
266 };
267
268 smb {
269 compatible = "simple-bus";
270
271 #address-cells = <2>;
272 #size-cells = <1>;
144 ranges = <0 0 0x40000000 0x04000000>, 273 ranges = <0 0 0x40000000 0x04000000>,
145 <1 0 0x44000000 0x04000000>, 274 <1 0 0x44000000 0x04000000>,
146 <2 0 0x48000000 0x04000000>, 275 <2 0 0x48000000 0x04000000>,
147 <3 0 0x4c000000 0x04000000>, 276 <3 0 0x4c000000 0x04000000>,
148 <7 0 0x10000000 0x00020000>; 277 <7 0 0x10000000 0x00020000>;
149 278
279 #interrupt-cells = <1>;
150 interrupt-map-mask = <0 0 63>; 280 interrupt-map-mask = <0 0 63>;
151 interrupt-map = <0 0 0 &gic 0 0 4>, 281 interrupt-map = <0 0 0 &gic 0 0 4>,
152 <0 0 1 &gic 0 1 4>, 282 <0 0 1 &gic 0 1 4>,
@@ -191,7 +321,7 @@
191 <0 0 40 &gic 0 40 4>, 321 <0 0 40 &gic 0 40 4>,
192 <0 0 41 &gic 0 41 4>, 322 <0 0 41 &gic 0 41 4>,
193 <0 0 42 &gic 0 42 4>; 323 <0 0 42 &gic 0 42 4>;
324
325 /include/ "vexpress-v2m.dtsi"
194 }; 326 };
195}; 327};
196
197/include/ "vexpress-v2m.dtsi"
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
new file mode 100644
index 00000000000..401c1262d4e
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -0,0 +1,166 @@
1/*
2 * Copyright (C) 2011 Xilinx
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
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/include/ "skeleton.dtsi"
14
15/ {
16 compatible = "xlnx,zynq-7000";
17
18 amba {
19 compatible = "simple-bus";
20 #address-cells = <1>;
21 #size-cells = <1>;
22 interrupt-parent = <&intc>;
23 ranges;
24
25 intc: interrupt-controller@f8f01000 {
26 compatible = "arm,cortex-a9-gic";
27 #interrupt-cells = <3>;
28 #address-cells = <1>;
29 interrupt-controller;
30 reg = <0xF8F01000 0x1000>,
31 <0xF8F00100 0x100>;
32 };
33
34 L2: cache-controller {
35 compatible = "arm,pl310-cache";
36 reg = <0xF8F02000 0x1000>;
37 arm,data-latency = <2 3 2>;
38 arm,tag-latency = <2 3 2>;
39 cache-unified;
40 cache-level = <2>;
41 };
42
43 uart0: uart@e0000000 {
44 compatible = "xlnx,xuartps";
45 reg = <0xE0000000 0x1000>;
46 interrupts = <0 27 4>;
47 clock = <50000000>;
48 };
49
50 uart1: uart@e0001000 {
51 compatible = "xlnx,xuartps";
52 reg = <0xE0001000 0x1000>;
53 interrupts = <0 50 4>;
54 clock = <50000000>;
55 };
56
57 slcr: slcr@f8000000 {
58 compatible = "xlnx,zynq-slcr";
59 reg = <0xF8000000 0x1000>;
60
61 clocks {
62 #address-cells = <1>;
63 #size-cells = <0>;
64
65 ps_clk: ps_clk {
66 #clock-cells = <0>;
67 compatible = "fixed-clock";
68 /* clock-frequency set in board-specific file */
69 clock-output-names = "ps_clk";
70 };
71 armpll: armpll {
72 #clock-cells = <0>;
73 compatible = "xlnx,zynq-pll";
74 clocks = <&ps_clk>;
75 reg = <0x100 0x110>;
76 clock-output-names = "armpll";
77 };
78 ddrpll: ddrpll {
79 #clock-cells = <0>;
80 compatible = "xlnx,zynq-pll";
81 clocks = <&ps_clk>;
82 reg = <0x104 0x114>;
83 clock-output-names = "ddrpll";
84 };
85 iopll: iopll {
86 #clock-cells = <0>;
87 compatible = "xlnx,zynq-pll";
88 clocks = <&ps_clk>;
89 reg = <0x108 0x118>;
90 clock-output-names = "iopll";
91 };
92 uart_clk: uart_clk {
93 #clock-cells = <1>;
94 compatible = "xlnx,zynq-periph-clock";
95 clocks = <&iopll &armpll &ddrpll>;
96 reg = <0x154>;
97 clock-output-names = "uart0_ref_clk",
98 "uart1_ref_clk";
99 };
100 cpu_clk: cpu_clk {
101 #clock-cells = <1>;
102 compatible = "xlnx,zynq-cpu-clock";
103 clocks = <&iopll &armpll &ddrpll>;
104 reg = <0x120 0x1C4>;
105 clock-output-names = "cpu_6x4x",
106 "cpu_3x2x",
107 "cpu_2x",
108 "cpu_1x";
109 };
110 };
111 };
112
113 ttc0: ttc0@f8001000 {
114 #address-cells = <1>;
115 #size-cells = <0>;
116 compatible = "xlnx,ttc";
117 reg = <0xF8001000 0x1000>;
118 clocks = <&cpu_clk 3>;
119 clock-names = "cpu_1x";
120 clock-ranges;
121
122 ttc0_0: ttc0.0 {
123 status = "disabled";
124 reg = <0>;
125 interrupts = <0 10 4>;
126 };
127 ttc0_1: ttc0.1 {
128 status = "disabled";
129 reg = <1>;
130 interrupts = <0 11 4>;
131 };
132 ttc0_2: ttc0.2 {
133 status = "disabled";
134 reg = <2>;
135 interrupts = <0 12 4>;
136 };
137 };
138
139 ttc1: ttc1@f8002000 {
140 #interrupt-parent = <&intc>;
141 #address-cells = <1>;
142 #size-cells = <0>;
143 compatible = "xlnx,ttc";
144 reg = <0xF8002000 0x1000>;
145 clocks = <&cpu_clk 3>;
146 clock-names = "cpu_1x";
147 clock-ranges;
148
149 ttc1_0: ttc1.0 {
150 status = "disabled";
151 reg = <0>;
152 interrupts = <0 37 4>;
153 };
154 ttc1_1: ttc1.1 {
155 status = "disabled";
156 reg = <1>;
157 interrupts = <0 38 4>;
158 };
159 ttc1_2: ttc1.2 {
160 status = "disabled";
161 reg = <2>;
162 interrupts = <0 39 4>;
163 };
164 };
165 };
166};
diff --git a/arch/arm/boot/dts/zynq-ep107.dts b/arch/arm/boot/dts/zynq-ep107.dts
deleted file mode 100644
index 37ca192fb19..00000000000
--- a/arch/arm/boot/dts/zynq-ep107.dts
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * Copyright (C) 2011 Xilinx
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
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/dts-v1/;
15/ {
16 model = "Xilinx Zynq EP107";
17 compatible = "xlnx,zynq-ep107";
18 #address-cells = <1>;
19 #size-cells = <1>;
20 interrupt-parent = <&intc>;
21
22 memory {
23 device_type = "memory";
24 reg = <0x0 0x10000000>;
25 };
26
27 chosen {
28 bootargs = "console=ttyPS0,9600 root=/dev/ram rw initrd=0x800000,8M earlyprintk";
29 linux,stdout-path = &uart0;
30 };
31
32 amba {
33 compatible = "simple-bus";
34 #address-cells = <1>;
35 #size-cells = <1>;
36 ranges;
37
38 intc: interrupt-controller@f8f01000 {
39 interrupt-controller;
40 compatible = "arm,gic";
41 reg = <0xF8F01000 0x1000>;
42 #interrupt-cells = <2>;
43 };
44
45 uart0: uart@e0000000 {
46 compatible = "xlnx,xuartps";
47 reg = <0xE0000000 0x1000>;
48 interrupts = <59 0>;
49 clock = <50000000>;
50 };
51 };
52};
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
new file mode 100644
index 00000000000..c772942a399
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2011 Xilinx
3 * Copyright (C) 2012 National Instruments Corp.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14/dts-v1/;
15/include/ "zynq-7000.dtsi"
16
17/ {
18 model = "Zynq ZC702 Development Board";
19 compatible = "xlnx,zynq-zc702", "xlnx,zynq-7000";
20
21 memory {
22 device_type = "memory";
23 reg = <0x0 0x40000000>;
24 };
25
26 chosen {
27 bootargs = "console=ttyPS1,115200 earlyprintk";
28 };
29
30};
31
32&ps_clk {
33 clock-frequency = <33333330>;
34};
35
36&ttc0_0 {
37 status = "ok";
38 compatible = "xlnx,ttc-counter-clocksource";
39};
40
41&ttc0_1 {
42 status = "ok";
43 compatible = "xlnx,ttc-counter-clockevent";
44};
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index aa526998418..36ae03a3f5d 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -70,6 +70,14 @@ struct gic_chip_data {
70static DEFINE_RAW_SPINLOCK(irq_controller_lock); 70static DEFINE_RAW_SPINLOCK(irq_controller_lock);
71 71
72/* 72/*
73 * The GIC mapping of CPU interfaces does not necessarily match
74 * the logical CPU numbering. Let's use a mapping as returned
75 * by the GIC itself.
76 */
77#define NR_GIC_CPU_IF 8
78static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
79
80/*
73 * Supported arch specific GIC irq extension. 81 * Supported arch specific GIC irq extension.
74 * Default make them NULL. 82 * Default make them NULL.
75 */ 83 */
@@ -238,11 +246,11 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
238 unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); 246 unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);
239 u32 val, mask, bit; 247 u32 val, mask, bit;
240 248
241 if (cpu >= 8 || cpu >= nr_cpu_ids) 249 if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids)
242 return -EINVAL; 250 return -EINVAL;
243 251
244 mask = 0xff << shift; 252 mask = 0xff << shift;
245 bit = 1 << (cpu_logical_map(cpu) + shift); 253 bit = gic_cpu_map[cpu] << shift;
246 254
247 raw_spin_lock(&irq_controller_lock); 255 raw_spin_lock(&irq_controller_lock);
248 val = readl_relaxed(reg) & ~mask; 256 val = readl_relaxed(reg) & ~mask;
@@ -349,11 +357,6 @@ static void __init gic_dist_init(struct gic_chip_data *gic)
349 u32 cpumask; 357 u32 cpumask;
350 unsigned int gic_irqs = gic->gic_irqs; 358 unsigned int gic_irqs = gic->gic_irqs;
351 void __iomem *base = gic_data_dist_base(gic); 359 void __iomem *base = gic_data_dist_base(gic);
352 u32 cpu = cpu_logical_map(smp_processor_id());
353
354 cpumask = 1 << cpu;
355 cpumask |= cpumask << 8;
356 cpumask |= cpumask << 16;
357 360
358 writel_relaxed(0, base + GIC_DIST_CTRL); 361 writel_relaxed(0, base + GIC_DIST_CTRL);
359 362
@@ -366,6 +369,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic)
366 /* 369 /*
367 * Set all global interrupts to this CPU only. 370 * Set all global interrupts to this CPU only.
368 */ 371 */
372 cpumask = readl_relaxed(base + GIC_DIST_TARGET + 0);
369 for (i = 32; i < gic_irqs; i += 4) 373 for (i = 32; i < gic_irqs; i += 4)
370 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); 374 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
371 375
@@ -389,9 +393,25 @@ static void __cpuinit gic_cpu_init(struct gic_chip_data *gic)
389{ 393{
390 void __iomem *dist_base = gic_data_dist_base(gic); 394 void __iomem *dist_base = gic_data_dist_base(gic);
391 void __iomem *base = gic_data_cpu_base(gic); 395 void __iomem *base = gic_data_cpu_base(gic);
396 unsigned int cpu_mask, cpu = smp_processor_id();
392 int i; 397 int i;
393 398
394 /* 399 /*
400 * Get what the GIC says our CPU mask is.
401 */
402 BUG_ON(cpu >= NR_GIC_CPU_IF);
403 cpu_mask = readl_relaxed(dist_base + GIC_DIST_TARGET + 0);
404 gic_cpu_map[cpu] = cpu_mask;
405
406 /*
407 * Clear our mask from the other map entries in case they're
408 * still undefined.
409 */
410 for (i = 0; i < NR_GIC_CPU_IF; i++)
411 if (i != cpu)
412 gic_cpu_map[i] &= ~cpu_mask;
413
414 /*
395 * Deal with the banked PPI and SGI interrupts - disable all 415 * Deal with the banked PPI and SGI interrupts - disable all
396 * PPI interrupts, ensure all SGI interrupts are enabled. 416 * PPI interrupts, ensure all SGI interrupts are enabled.
397 */ 417 */
@@ -646,7 +666,7 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
646{ 666{
647 irq_hw_number_t hwirq_base; 667 irq_hw_number_t hwirq_base;
648 struct gic_chip_data *gic; 668 struct gic_chip_data *gic;
649 int gic_irqs, irq_base; 669 int gic_irqs, irq_base, i;
650 670
651 BUG_ON(gic_nr >= MAX_GIC_NR); 671 BUG_ON(gic_nr >= MAX_GIC_NR);
652 672
@@ -683,6 +703,13 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
683 } 703 }
684 704
685 /* 705 /*
706 * Initialize the CPU interface map to all CPUs.
707 * It will be refined as each CPU probes its ID.
708 */
709 for (i = 0; i < NR_GIC_CPU_IF; i++)
710 gic_cpu_map[i] = 0xff;
711
712 /*
686 * For primary GICs, skip over SGIs. 713 * For primary GICs, skip over SGIs.
687 * For secondary GICs, skip over PPIs, too. 714 * For secondary GICs, skip over PPIs, too.
688 */ 715 */
@@ -737,7 +764,7 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
737 764
738 /* Convert our logical CPU mask into a physical one. */ 765 /* Convert our logical CPU mask into a physical one. */
739 for_each_cpu(cpu, mask) 766 for_each_cpu(cpu, mask)
740 map |= 1 << cpu_logical_map(cpu); 767 map |= gic_cpu_map[cpu];
741 768
742 /* 769 /*
743 * Ensure that stores to Normal memory are visible to the 770 * Ensure that stores to Normal memory are visible to the
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index df13a3ffff3..9d2d3ba339f 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -162,7 +162,6 @@ static struct clock_event_device sp804_clockevent = {
162 .set_mode = sp804_set_mode, 162 .set_mode = sp804_set_mode,
163 .set_next_event = sp804_set_next_event, 163 .set_next_event = sp804_set_next_event,
164 .rating = 300, 164 .rating = 300,
165 .cpumask = cpu_all_mask,
166}; 165};
167 166
168static struct irqaction sp804_timer_irq = { 167static struct irqaction sp804_timer_irq = {
@@ -185,6 +184,7 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
185 clkevt_reload = DIV_ROUND_CLOSEST(rate, HZ); 184 clkevt_reload = DIV_ROUND_CLOSEST(rate, HZ);
186 evt->name = name; 185 evt->name = name;
187 evt->irq = irq; 186 evt->irq = irq;
187 evt->cpumask = cpu_possible_mask;
188 188
189 setup_irq(irq, &sp804_timer_irq); 189 setup_irq(irq, &sp804_timer_irq);
190 clockevents_config_and_register(evt, rate, 0xf, 0xffffffff); 190 clockevents_config_and_register(evt, rate, 0xf, 0xffffffff);
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index e0d538803cc..e4df17ca90c 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -218,7 +218,7 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
218 v->resume_sources = resume_sources; 218 v->resume_sources = resume_sources;
219 v->irq = irq; 219 v->irq = irq;
220 vic_id++; 220 vic_id++;
221 v->domain = irq_domain_add_legacy(node, fls(valid_sources), irq, 0, 221 v->domain = irq_domain_add_simple(node, fls(valid_sources), irq,
222 &vic_irqdomain_ops, v); 222 &vic_irqdomain_ops, v);
223} 223}
224 224
@@ -350,7 +350,7 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start,
350 vic_register(base, irq_start, vic_sources, 0, node); 350 vic_register(base, irq_start, vic_sources, 0, node);
351} 351}
352 352
353void __init __vic_init(void __iomem *base, unsigned int irq_start, 353void __init __vic_init(void __iomem *base, int irq_start,
354 u32 vic_sources, u32 resume_sources, 354 u32 vic_sources, u32 resume_sources,
355 struct device_node *node) 355 struct device_node *node)
356{ 356{
@@ -407,7 +407,6 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
407int __init vic_of_init(struct device_node *node, struct device_node *parent) 407int __init vic_of_init(struct device_node *node, struct device_node *parent)
408{ 408{
409 void __iomem *regs; 409 void __iomem *regs;
410 int irq_base;
411 410
412 if (WARN(parent, "non-root VICs are not supported")) 411 if (WARN(parent, "non-root VICs are not supported"))
413 return -EINVAL; 412 return -EINVAL;
@@ -416,18 +415,12 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
416 if (WARN_ON(!regs)) 415 if (WARN_ON(!regs))
417 return -EIO; 416 return -EIO;
418 417
419 irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id()); 418 /*
420 if (WARN_ON(irq_base < 0)) 419 * Passing -1 as first IRQ makes the simple domain allocate descriptors
421 goto out_unmap; 420 */
422 421 __vic_init(regs, -1, ~0, ~0, node);
423 __vic_init(regs, irq_base, ~0, ~0, node);
424 422
425 return 0; 423 return 0;
426
427 out_unmap:
428 iounmap(regs);
429
430 return -EIO;
431} 424}
432#endif /* CONFIG OF */ 425#endif /* CONFIG OF */
433 426
diff --git a/arch/arm/configs/afeb9260_defconfig b/arch/arm/configs/afeb9260_defconfig
deleted file mode 100644
index c285a9d777d..00000000000
--- a/arch/arm/configs/afeb9260_defconfig
+++ /dev/null
@@ -1,106 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9260=y
15CONFIG_MACH_AFEB9260=y
16CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
17CONFIG_PREEMPT=y
18CONFIG_AEABI=y
19CONFIG_ZBOOT_ROM_TEXT=0x0
20CONFIG_ZBOOT_ROM_BSS=0x0
21CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
22CONFIG_FPE_NWFPE=y
23CONFIG_NET=y
24CONFIG_PACKET=y
25CONFIG_UNIX=y
26CONFIG_INET=y
27CONFIG_IP_PNP=y
28CONFIG_IP_PNP_BOOTP=y
29# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
30# CONFIG_INET_XFRM_MODE_TUNNEL is not set
31# CONFIG_INET_XFRM_MODE_BEET is not set
32# CONFIG_INET_LRO is not set
33# CONFIG_IPV6 is not set
34CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
35CONFIG_MTD=y
36CONFIG_MTD_PARTITIONS=y
37CONFIG_MTD_CHAR=y
38CONFIG_MTD_BLOCK=y
39CONFIG_MTD_DATAFLASH=y
40CONFIG_MTD_NAND=y
41CONFIG_MTD_NAND_ATMEL=y
42CONFIG_BLK_DEV_RAM=y
43CONFIG_BLK_DEV_RAM_SIZE=8192
44CONFIG_ATMEL_SSC=y
45CONFIG_EEPROM_AT24=y
46CONFIG_SCSI=y
47CONFIG_BLK_DEV_SD=y
48CONFIG_SCSI_MULTI_LUN=y
49CONFIG_NETDEVICES=y
50CONFIG_NET_ETHERNET=y
51CONFIG_MII=y
52CONFIG_MACB=y
53# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set
55# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
56# CONFIG_INPUT_KEYBOARD is not set
57# CONFIG_INPUT_MOUSE is not set
58# CONFIG_SERIO is not set
59CONFIG_SERIAL_ATMEL=y
60CONFIG_SERIAL_ATMEL_CONSOLE=y
61# CONFIG_HW_RANDOM is not set
62CONFIG_I2C=y
63CONFIG_I2C_CHARDEV=y
64CONFIG_I2C_GPIO=y
65CONFIG_SPI=y
66CONFIG_SPI_DEBUG=y
67CONFIG_SPI_ATMEL=y
68CONFIG_SPI_SPIDEV=y
69# CONFIG_HWMON is not set
70CONFIG_WATCHDOG=y
71CONFIG_WATCHDOG_NOWAYOUT=y
72# CONFIG_VGA_CONSOLE is not set
73# CONFIG_USB_HID is not set
74CONFIG_USB=y
75CONFIG_USB_DEVICEFS=y
76CONFIG_USB_MON=y
77CONFIG_USB_OHCI_HCD=y
78CONFIG_USB_STORAGE=y
79CONFIG_USB_GADGET=y
80CONFIG_USB_ZERO=m
81CONFIG_USB_GADGETFS=m
82CONFIG_USB_FILE_STORAGE=m
83CONFIG_USB_G_SERIAL=m
84CONFIG_RTC_CLASS=y
85CONFIG_RTC_DEBUG=y
86CONFIG_RTC_DRV_FM3130=y
87CONFIG_EXT2_FS=y
88CONFIG_EXT3_FS=y
89CONFIG_INOTIFY=y
90CONFIG_VFAT_FS=y
91CONFIG_TMPFS=y
92CONFIG_JFFS2_FS=y
93CONFIG_CRAMFS=y
94CONFIG_NFS_FS=y
95CONFIG_NFS_V3=y
96CONFIG_ROOT_NFS=y
97CONFIG_NLS_CODEPAGE_437=y
98CONFIG_NLS_CODEPAGE_850=y
99CONFIG_NLS_ISO8859_1=y
100CONFIG_DEBUG_KERNEL=y
101CONFIG_DEBUG_INFO=y
102CONFIG_SYSCTL_SYSCALL_CHECK=y
103# CONFIG_FTRACE is not set
104CONFIG_DEBUG_USER=y
105CONFIG_DEBUG_LL=y
106CONFIG_CRC_T10DIF=y
diff --git a/arch/arm/configs/ap4evb_defconfig b/arch/arm/configs/ap4evb_defconfig
index 2eef85e3c9b..66894f736d0 100644
--- a/arch/arm/configs/ap4evb_defconfig
+++ b/arch/arm/configs/ap4evb_defconfig
@@ -46,7 +46,6 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
46# CONFIG_HID_SUPPORT is not set 46# CONFIG_HID_SUPPORT is not set
47# CONFIG_USB_SUPPORT is not set 47# CONFIG_USB_SUPPORT is not set
48# CONFIG_DNOTIFY is not set 48# CONFIG_DNOTIFY is not set
49# CONFIG_INOTIFY_USER is not set
50CONFIG_TMPFS=y 49CONFIG_TMPFS=y
51# CONFIG_MISC_FILESYSTEMS is not set 50# CONFIG_MISC_FILESYSTEMS is not set
52CONFIG_MAGIC_SYSRQ=y 51CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
index f78d259f8d2..2e1a8257720 100644
--- a/arch/arm/configs/armadillo800eva_defconfig
+++ b/arch/arm/configs/armadillo800eva_defconfig
@@ -7,6 +7,7 @@ CONFIG_LOG_BUF_SHIFT=16
7# CONFIG_IPC_NS is not set 7# CONFIG_IPC_NS is not set
8# CONFIG_PID_NS is not set 8# CONFIG_PID_NS is not set
9CONFIG_CC_OPTIMIZE_FOR_SIZE=y 9CONFIG_CC_OPTIMIZE_FOR_SIZE=y
10CONFIG_PERF_EVENTS=y
10CONFIG_SLAB=y 11CONFIG_SLAB=y
11CONFIG_MODULES=y 12CONFIG_MODULES=y
12CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
@@ -20,7 +21,7 @@ CONFIG_MACH_ARMADILLO800EVA=y
20# CONFIG_SH_TIMER_TMU is not set 21# CONFIG_SH_TIMER_TMU is not set
21CONFIG_ARM_THUMB=y 22CONFIG_ARM_THUMB=y
22CONFIG_CPU_BPREDICT_DISABLE=y 23CONFIG_CPU_BPREDICT_DISABLE=y
23# CONFIG_CACHE_L2X0 is not set 24CONFIG_CACHE_L2X0=y
24CONFIG_ARM_ERRATA_430973=y 25CONFIG_ARM_ERRATA_430973=y
25CONFIG_ARM_ERRATA_458693=y 26CONFIG_ARM_ERRATA_458693=y
26CONFIG_ARM_ERRATA_460075=y 27CONFIG_ARM_ERRATA_460075=y
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 67bc571ed0c..b175577d7ab 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -111,6 +111,7 @@ CONFIG_I2C=y
111CONFIG_I2C_GPIO=y 111CONFIG_I2C_GPIO=y
112CONFIG_SPI=y 112CONFIG_SPI=y
113CONFIG_SPI_ATMEL=y 113CONFIG_SPI_ATMEL=y
114CONFIG_PINCTRL_AT91=y
114# CONFIG_HWMON is not set 115# CONFIG_HWMON is not set
115CONFIG_WATCHDOG=y 116CONFIG_WATCHDOG=y
116CONFIG_AT91SAM9X_WATCHDOG=y 117CONFIG_AT91SAM9X_WATCHDOG=y
diff --git a/arch/arm/configs/at91sam9260_defconfig b/arch/arm/configs/at91sam9260_defconfig
index 505b3765f87..0ea5d2c97fc 100644
--- a/arch/arm/configs/at91sam9260_defconfig
+++ b/arch/arm/configs/at91sam9260_defconfig
@@ -75,7 +75,7 @@ CONFIG_USB_STORAGE_DEBUG=y
75CONFIG_USB_GADGET=y 75CONFIG_USB_GADGET=y
76CONFIG_USB_ZERO=m 76CONFIG_USB_ZERO=m
77CONFIG_USB_GADGETFS=m 77CONFIG_USB_GADGETFS=m
78CONFIG_USB_FILE_STORAGE=m 78CONFIG_USB_MASS_STORAGE=m
79CONFIG_USB_G_SERIAL=m 79CONFIG_USB_G_SERIAL=m
80CONFIG_RTC_CLASS=y 80CONFIG_RTC_CLASS=y
81CONFIG_RTC_DRV_AT91SAM9=y 81CONFIG_RTC_DRV_AT91SAM9=y
diff --git a/arch/arm/configs/at91sam9261_defconfig b/arch/arm/configs/at91sam9261_defconfig
index 1e8712ef062..c87beb973b3 100644
--- a/arch/arm/configs/at91sam9261_defconfig
+++ b/arch/arm/configs/at91sam9261_defconfig
@@ -125,7 +125,7 @@ CONFIG_USB_GADGET=y
125CONFIG_USB_ZERO=m 125CONFIG_USB_ZERO=m
126CONFIG_USB_ETH=m 126CONFIG_USB_ETH=m
127CONFIG_USB_GADGETFS=m 127CONFIG_USB_GADGETFS=m
128CONFIG_USB_FILE_STORAGE=m 128CONFIG_USB_MASS_STORAGE=m
129CONFIG_USB_G_SERIAL=m 129CONFIG_USB_G_SERIAL=m
130CONFIG_MMC=y 130CONFIG_MMC=y
131CONFIG_MMC_ATMELMCI=m 131CONFIG_MMC_ATMELMCI=m
diff --git a/arch/arm/configs/at91sam9263_defconfig b/arch/arm/configs/at91sam9263_defconfig
index d2050cada82..c5212f43eee 100644
--- a/arch/arm/configs/at91sam9263_defconfig
+++ b/arch/arm/configs/at91sam9263_defconfig
@@ -133,7 +133,7 @@ CONFIG_USB_GADGET=y
133CONFIG_USB_ZERO=m 133CONFIG_USB_ZERO=m
134CONFIG_USB_ETH=m 134CONFIG_USB_ETH=m
135CONFIG_USB_GADGETFS=m 135CONFIG_USB_GADGETFS=m
136CONFIG_USB_FILE_STORAGE=m 136CONFIG_USB_MASS_STORAGE=m
137CONFIG_USB_G_SERIAL=m 137CONFIG_USB_G_SERIAL=m
138CONFIG_MMC=y 138CONFIG_MMC=y
139CONFIG_SDIO_UART=m 139CONFIG_SDIO_UART=m
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig
index e1b0e80b54a..3b1881033ad 100644
--- a/arch/arm/configs/at91sam9g20_defconfig
+++ b/arch/arm/configs/at91sam9g20_defconfig
@@ -96,7 +96,7 @@ CONFIG_USB_STORAGE=y
96CONFIG_USB_GADGET=y 96CONFIG_USB_GADGET=y
97CONFIG_USB_ZERO=m 97CONFIG_USB_ZERO=m
98CONFIG_USB_GADGETFS=m 98CONFIG_USB_GADGETFS=m
99CONFIG_USB_FILE_STORAGE=m 99CONFIG_USB_MASS_STORAGE=m
100CONFIG_USB_G_SERIAL=m 100CONFIG_USB_G_SERIAL=m
101CONFIG_MMC=y 101CONFIG_MMC=y
102CONFIG_MMC_ATMELMCI=m 102CONFIG_MMC_ATMELMCI=m
diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig
index 7aea70253c6..74e27f0ff6a 100644
--- a/arch/arm/configs/bcm2835_defconfig
+++ b/arch/arm/configs/bcm2835_defconfig
@@ -66,8 +66,6 @@ CONFIG_TTY_PRINTK=y
66# CONFIG_FILE_LOCKING is not set 66# CONFIG_FILE_LOCKING is not set
67# CONFIG_DNOTIFY is not set 67# CONFIG_DNOTIFY is not set
68# CONFIG_INOTIFY_USER is not set 68# CONFIG_INOTIFY_USER is not set
69# CONFIG_PROC_FS is not set
70# CONFIG_SYSFS is not set
71# CONFIG_MISC_FILESYSTEMS is not set 69# CONFIG_MISC_FILESYSTEMS is not set
72CONFIG_PRINTK_TIME=y 70CONFIG_PRINTK_TIME=y
73# CONFIG_ENABLE_WARN_DEPRECATED is not set 71# CONFIG_ENABLE_WARN_DEPRECATED is not set
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
new file mode 100644
index 00000000000..e3bf2d65618
--- /dev/null
+++ b/arch/arm/configs/bcm_defconfig
@@ -0,0 +1,114 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_NO_HZ=y
6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_IKCONFIG=y
10CONFIG_IKCONFIG_PROC=y
11CONFIG_LOG_BUF_SHIFT=19
12CONFIG_CGROUPS=y
13CONFIG_CGROUP_FREEZER=y
14CONFIG_CGROUP_DEVICE=y
15CONFIG_CGROUP_CPUACCT=y
16CONFIG_RESOURCE_COUNTERS=y
17CONFIG_CGROUP_SCHED=y
18CONFIG_BLK_CGROUP=y
19CONFIG_NAMESPACES=y
20CONFIG_BLK_DEV_INITRD=y
21CONFIG_SYSCTL_SYSCALL=y
22CONFIG_EMBEDDED=y
23# CONFIG_COMPAT_BRK is not set
24CONFIG_MODULES=y
25CONFIG_MODULE_UNLOAD=y
26# CONFIG_BLK_DEV_BSG is not set
27CONFIG_PARTITION_ADVANCED=y
28CONFIG_EFI_PARTITION=y
29CONFIG_ARCH_BCM=y
30CONFIG_ARM_THUMBEE=y
31CONFIG_ARM_ERRATA_743622=y
32CONFIG_PREEMPT=y
33CONFIG_AEABI=y
34# CONFIG_OABI_COMPAT is not set
35# CONFIG_COMPACTION is not set
36CONFIG_ZBOOT_ROM_TEXT=0x0
37CONFIG_ZBOOT_ROM_BSS=0x0
38CONFIG_ARM_APPENDED_DTB=y
39CONFIG_CMDLINE="console=ttyS0,115200n8 mem=128M"
40CONFIG_CPU_IDLE=y
41CONFIG_VFP=y
42CONFIG_NEON=y
43# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
44CONFIG_PM_RUNTIME=y
45CONFIG_DEVTMPFS=y
46CONFIG_DEVTMPFS_MOUNT=y
47CONFIG_PROC_DEVICETREE=y
48# CONFIG_BLK_DEV is not set
49CONFIG_SCSI=y
50CONFIG_BLK_DEV_SD=y
51CONFIG_CHR_DEV_SG=y
52CONFIG_SCSI_MULTI_LUN=y
53CONFIG_SCSI_SCAN_ASYNC=y
54CONFIG_INPUT_FF_MEMLESS=y
55CONFIG_INPUT_JOYDEV=y
56CONFIG_INPUT_EVDEV=y
57# CONFIG_KEYBOARD_ATKBD is not set
58# CONFIG_INPUT_MOUSE is not set
59CONFIG_INPUT_TOUCHSCREEN=y
60CONFIG_INPUT_MISC=y
61CONFIG_INPUT_UINPUT=y
62# CONFIG_SERIO is not set
63# CONFIG_LEGACY_PTYS is not set
64CONFIG_SERIAL_8250=y
65CONFIG_SERIAL_8250_CONSOLE=y
66CONFIG_SERIAL_8250_EXTENDED=y
67CONFIG_SERIAL_8250_MANY_PORTS=y
68CONFIG_SERIAL_8250_SHARE_IRQ=y
69CONFIG_SERIAL_8250_RSA=y
70CONFIG_SERIAL_8250_DW=y
71CONFIG_HW_RANDOM=y
72CONFIG_I2C=y
73CONFIG_I2C_CHARDEV=y
74# CONFIG_HWMON is not set
75CONFIG_VIDEO_OUTPUT_CONTROL=y
76CONFIG_FB=y
77CONFIG_BACKLIGHT_LCD_SUPPORT=y
78CONFIG_LCD_CLASS_DEVICE=y
79CONFIG_BACKLIGHT_CLASS_DEVICE=y
80# CONFIG_USB_SUPPORT is not set
81CONFIG_NEW_LEDS=y
82CONFIG_LEDS_CLASS=y
83CONFIG_LEDS_TRIGGERS=y
84CONFIG_LEDS_TRIGGER_TIMER=y
85CONFIG_LEDS_TRIGGER_HEARTBEAT=y
86CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
87CONFIG_EXT4_FS=y
88CONFIG_EXT4_FS_POSIX_ACL=y
89CONFIG_EXT4_FS_SECURITY=y
90CONFIG_AUTOFS4_FS=y
91CONFIG_FUSE_FS=y
92CONFIG_MSDOS_FS=y
93CONFIG_VFAT_FS=y
94CONFIG_TMPFS=y
95CONFIG_TMPFS_POSIX_ACL=y
96CONFIG_CONFIGFS_FS=y
97# CONFIG_MISC_FILESYSTEMS is not set
98CONFIG_NLS_CODEPAGE_437=y
99CONFIG_NLS_ISO8859_1=y
100CONFIG_PRINTK_TIME=y
101CONFIG_MAGIC_SYSRQ=y
102CONFIG_DEBUG_FS=y
103CONFIG_DETECT_HUNG_TASK=y
104CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=110
105CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
106CONFIG_DEBUG_INFO=y
107# CONFIG_FTRACE is not set
108CONFIG_DEBUG_LL=y
109CONFIG_CRC_CCITT=y
110CONFIG_CRC_T10DIF=y
111CONFIG_CRC_ITU_T=y
112CONFIG_CRC7=y
113CONFIG_XZ_DEC=y
114CONFIG_AVERAGE=y
diff --git a/arch/arm/configs/cam60_defconfig b/arch/arm/configs/cam60_defconfig
deleted file mode 100644
index 14579711d8f..00000000000
--- a/arch/arm/configs/cam60_defconfig
+++ /dev/null
@@ -1,173 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_BSD_PROCESS_ACCT_V3=y
7CONFIG_AUDIT=y
8CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y
10CONFIG_BLK_DEV_INITRD=y
11# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
12CONFIG_KALLSYMS_ALL=y
13CONFIG_MODULES=y
14CONFIG_MODULE_UNLOAD=y
15CONFIG_MODVERSIONS=y
16# CONFIG_BLK_DEV_BSG is not set
17CONFIG_ARCH_AT91=y
18CONFIG_ARCH_AT91SAM9260=y
19CONFIG_MACH_CAM60=y
20CONFIG_ZBOOT_ROM_BSS=0x20004000
21CONFIG_CMDLINE="console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
22CONFIG_FPE_NWFPE=y
23CONFIG_BINFMT_AOUT=y
24CONFIG_BINFMT_MISC=y
25CONFIG_PACKET=y
26CONFIG_UNIX=y
27CONFIG_INET=y
28CONFIG_IP_MULTICAST=y
29CONFIG_IP_PNP=y
30CONFIG_IP_PNP_DHCP=y
31# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
32# CONFIG_INET_XFRM_MODE_TUNNEL is not set
33# CONFIG_INET_XFRM_MODE_BEET is not set
34# CONFIG_INET_LRO is not set
35# CONFIG_INET_DIAG is not set
36# CONFIG_IPV6 is not set
37CONFIG_NETWORK_SECMARK=y
38CONFIG_CFG80211=m
39CONFIG_MAC80211=m
40CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
41CONFIG_MTD=y
42CONFIG_MTD_CONCAT=y
43CONFIG_MTD_PARTITIONS=y
44CONFIG_MTD_CMDLINE_PARTS=y
45CONFIG_MTD_CHAR=y
46CONFIG_MTD_BLOCK=y
47CONFIG_MTD_CFI=y
48CONFIG_MTD_COMPLEX_MAPPINGS=y
49CONFIG_MTD_PLATRAM=m
50CONFIG_MTD_DATAFLASH=y
51CONFIG_MTD_NAND=y
52CONFIG_MTD_NAND_ATMEL=y
53CONFIG_BLK_DEV_LOOP=y
54CONFIG_BLK_DEV_RAM=y
55# CONFIG_MISC_DEVICES is not set
56CONFIG_SCSI=y
57CONFIG_SCSI_TGT=y
58CONFIG_BLK_DEV_SD=y
59CONFIG_CHR_DEV_SG=y
60CONFIG_CHR_DEV_SCH=y
61CONFIG_SCSI_MULTI_LUN=y
62CONFIG_SCSI_LOGGING=y
63CONFIG_SCSI_SCAN_ASYNC=y
64CONFIG_SCSI_SPI_ATTRS=m
65CONFIG_SCSI_FC_ATTRS=m
66CONFIG_SCSI_ISCSI_ATTRS=m
67CONFIG_SCSI_SAS_LIBSAS=m
68# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
69# CONFIG_SCSI_LOWLEVEL is not set
70CONFIG_NETDEVICES=y
71CONFIG_MARVELL_PHY=m
72CONFIG_DAVICOM_PHY=m
73CONFIG_QSEMI_PHY=m
74CONFIG_LXT_PHY=m
75CONFIG_CICADA_PHY=m
76CONFIG_VITESSE_PHY=m
77CONFIG_SMSC_PHY=m
78CONFIG_BROADCOM_PHY=m
79CONFIG_NET_ETHERNET=y
80CONFIG_MII=y
81CONFIG_MACB=y
82# CONFIG_NETDEV_1000 is not set
83# CONFIG_NETDEV_10000 is not set
84CONFIG_INPUT_EVDEV=y
85CONFIG_KEYBOARD_LKKBD=m
86CONFIG_KEYBOARD_NEWTON=m
87CONFIG_KEYBOARD_STOWAWAY=m
88CONFIG_KEYBOARD_SUNKBD=m
89CONFIG_KEYBOARD_XTKBD=m
90CONFIG_MOUSE_SERIAL=m
91CONFIG_MOUSE_APPLETOUCH=m
92CONFIG_MOUSE_VSXXXAA=m
93# CONFIG_SERIO_SERPORT is not set
94CONFIG_VT_HW_CONSOLE_BINDING=y
95CONFIG_SERIAL_NONSTANDARD=y
96CONFIG_SERIAL_ATMEL=y
97CONFIG_SERIAL_ATMEL_CONSOLE=y
98# CONFIG_LEGACY_PTYS is not set
99CONFIG_HW_RANDOM=y
100CONFIG_I2C=y
101CONFIG_I2C_CHARDEV=y
102CONFIG_SPI=y
103CONFIG_SPI_ATMEL=y
104# CONFIG_HWMON is not set
105# CONFIG_VGA_CONSOLE is not set
106# CONFIG_HID_SUPPORT is not set
107CONFIG_USB=y
108CONFIG_USB_DEVICEFS=y
109CONFIG_USB_OHCI_HCD=y
110CONFIG_USB_STORAGE=y
111CONFIG_USB_LIBUSUAL=y
112CONFIG_RTC_CLASS=y
113CONFIG_RTC_INTF_DEV_UIE_EMUL=y
114CONFIG_RTC_DRV_TEST=m
115CONFIG_RTC_DRV_AT91SAM9=y
116CONFIG_EXT2_FS=y
117CONFIG_EXT2_FS_XATTR=y
118CONFIG_EXT2_FS_POSIX_ACL=y
119CONFIG_EXT3_FS=y
120CONFIG_INOTIFY=y
121CONFIG_QUOTA=y
122CONFIG_AUTOFS_FS=y
123CONFIG_AUTOFS4_FS=y
124CONFIG_MSDOS_FS=y
125CONFIG_VFAT_FS=y
126CONFIG_TMPFS=y
127CONFIG_CONFIGFS_FS=y
128CONFIG_NFS_FS=y
129CONFIG_NFS_V3=y
130CONFIG_ROOT_NFS=y
131CONFIG_NLS_DEFAULT="cp437"
132CONFIG_NLS_CODEPAGE_437=y
133CONFIG_NLS_ASCII=y
134CONFIG_NLS_ISO8859_1=y
135CONFIG_NLS_UTF8=y
136CONFIG_PRINTK_TIME=y
137# CONFIG_ENABLE_MUST_CHECK is not set
138CONFIG_MAGIC_SYSRQ=y
139CONFIG_UNUSED_SYMBOLS=y
140CONFIG_DEBUG_KERNEL=y
141CONFIG_BLK_DEV_IO_TRACE=y
142CONFIG_DEBUG_LL=y
143CONFIG_CRYPTO=y
144CONFIG_CRYPTO_NULL=m
145CONFIG_CRYPTO_CRYPTD=m
146CONFIG_CRYPTO_TEST=m
147CONFIG_CRYPTO_CBC=m
148CONFIG_CRYPTO_LRW=m
149CONFIG_CRYPTO_PCBC=m
150CONFIG_CRYPTO_HMAC=y
151CONFIG_CRYPTO_XCBC=m
152CONFIG_CRYPTO_MD5=y
153CONFIG_CRYPTO_MICHAEL_MIC=m
154CONFIG_CRYPTO_SHA1=y
155CONFIG_CRYPTO_SHA256=y
156CONFIG_CRYPTO_SHA512=y
157CONFIG_CRYPTO_TGR192=m
158CONFIG_CRYPTO_WP512=m
159CONFIG_CRYPTO_ANUBIS=m
160CONFIG_CRYPTO_BLOWFISH=m
161CONFIG_CRYPTO_CAMELLIA=m
162CONFIG_CRYPTO_CAST5=m
163CONFIG_CRYPTO_CAST6=m
164CONFIG_CRYPTO_DES=y
165CONFIG_CRYPTO_FCRYPT=m
166CONFIG_CRYPTO_KHAZAD=m
167CONFIG_CRYPTO_SERPENT=m
168CONFIG_CRYPTO_TEA=m
169CONFIG_CRYPTO_TWOFISH=m
170CONFIG_CRYPTO_DEFLATE=m
171# CONFIG_CRYPTO_HW is not set
172CONFIG_CRC32=m
173CONFIG_LIBCRC32C=m
diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig
new file mode 100644
index 00000000000..1cd94c36321
--- /dev/null
+++ b/arch/arm/configs/clps711x_defconfig
@@ -0,0 +1,90 @@
1CONFIG_KERNEL_LZMA=y
2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y
5CONFIG_RD_LZMA=y
6CONFIG_EMBEDDED=y
7CONFIG_SLOB=y
8CONFIG_JUMP_LABEL=y
9# CONFIG_LBDAF is not set
10CONFIG_PARTITION_ADVANCED=y
11# CONFIG_IOSCHED_CFQ is not set
12CONFIG_ARCH_CLPS711X=y
13CONFIG_ARCH_AUTCPU12=y
14CONFIG_ARCH_CDB89712=y
15CONFIG_ARCH_CLEP7312=y
16CONFIG_ARCH_EDB7211=y
17CONFIG_ARCH_P720T=y
18CONFIG_ARCH_FORTUNET=y
19CONFIG_AEABI=y
20CONFIG_ZBOOT_ROM_TEXT=0x0
21CONFIG_ZBOOT_ROM_BSS=0x0
22# CONFIG_COREDUMP is not set
23CONFIG_NET=y
24CONFIG_PACKET=y
25CONFIG_UNIX=y
26CONFIG_INET=y
27# CONFIG_IPV6 is not set
28CONFIG_IRDA=y
29CONFIG_IRTTY_SIR=y
30CONFIG_EP7211_DONGLE=y
31# CONFIG_WIRELESS is not set
32CONFIG_MTD=y
33CONFIG_MTD_CMDLINE_PARTS=y
34CONFIG_MTD_CHAR=y
35CONFIG_MTD_BLOCK=y
36CONFIG_MTD_CFI=y
37CONFIG_MTD_JEDECPROBE=y
38CONFIG_MTD_CFI_INTELEXT=y
39CONFIG_MTD_CFI_AMDSTD=y
40CONFIG_MTD_CFI_STAA=y
41CONFIG_MTD_AUTCPU12=y
42CONFIG_MTD_PLATRAM=y
43CONFIG_MTD_NAND=y
44CONFIG_MTD_NAND_GPIO=y
45CONFIG_NETDEVICES=y
46# CONFIG_NET_CADENCE is not set
47# CONFIG_NET_VENDOR_BROADCOM is not set
48# CONFIG_NET_VENDOR_CHELSIO is not set
49CONFIG_CS89x0=y
50CONFIG_CS89x0_PLATFORM=y
51# CONFIG_NET_VENDOR_FARADAY is not set
52# CONFIG_NET_VENDOR_INTEL is not set
53# CONFIG_NET_VENDOR_MARVELL is not set
54# CONFIG_NET_VENDOR_MICREL is not set
55# CONFIG_NET_VENDOR_NATSEMI is not set
56# CONFIG_NET_VENDOR_SEEQ is not set
57# CONFIG_NET_VENDOR_SMSC is not set
58# CONFIG_NET_VENDOR_STMICRO is not set
59# CONFIG_NET_VENDOR_WIZNET is not set
60# CONFIG_WLAN is not set
61# CONFIG_INPUT is not set
62# CONFIG_SERIO is not set
63# CONFIG_VT is not set
64CONFIG_SERIAL_CLPS711X_CONSOLE=y
65# CONFIG_HW_RANDOM is not set
66CONFIG_SPI=y
67CONFIG_GPIO_GENERIC_PLATFORM=y
68# CONFIG_HWMON is not set
69CONFIG_FB=y
70CONFIG_FB_CLPS711X=y
71CONFIG_BACKLIGHT_LCD_SUPPORT=y
72CONFIG_LCD_PLATFORM=y
73# CONFIG_USB_SUPPORT is not set
74CONFIG_NEW_LEDS=y
75CONFIG_LEDS_CLASS=y
76CONFIG_LEDS_GPIO=y
77CONFIG_LEDS_TRIGGERS=y
78CONFIG_LEDS_TRIGGER_HEARTBEAT=y
79# CONFIG_IOMMU_SUPPORT is not set
80CONFIG_EXT2_FS=y
81CONFIG_CRAMFS=y
82CONFIG_MINIX_FS=y
83# CONFIG_NETWORK_FILESYSTEMS is not set
84# CONFIG_FTRACE is not set
85CONFIG_DEBUG_USER=y
86CONFIG_DEBUG_LL=y
87CONFIG_EARLY_PRINTK=y
88# CONFIG_CRYPTO_ANSI_CPRNG is not set
89# CONFIG_CRYPTO_HW is not set
90# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index 4b8a25d9e68..1fd1d1de322 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_defconfig
@@ -218,7 +218,7 @@ CONFIG_USB_GADGET=y
218CONFIG_USB_ZERO=m 218CONFIG_USB_ZERO=m
219CONFIG_USB_ETH=m 219CONFIG_USB_ETH=m
220CONFIG_USB_GADGETFS=m 220CONFIG_USB_GADGETFS=m
221CONFIG_USB_FILE_STORAGE=m 221CONFIG_USB_MASS_STORAGE=m
222CONFIG_USB_G_SERIAL=m 222CONFIG_USB_G_SERIAL=m
223CONFIG_MMC=y 223CONFIG_MMC=y
224CONFIG_MMC_PXA=y 224CONFIG_MMC_PXA=y
diff --git a/arch/arm/configs/cpu9260_defconfig b/arch/arm/configs/cpu9260_defconfig
deleted file mode 100644
index 921480c23b9..00000000000
--- a/arch/arm/configs/cpu9260_defconfig
+++ /dev/null
@@ -1,116 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y
9# CONFIG_BLK_DEV_BSG is not set
10# CONFIG_IOSCHED_CFQ is not set
11CONFIG_ARCH_AT91=y
12CONFIG_ARCH_AT91SAM9260=y
13CONFIG_MACH_CPU9260=y
14# CONFIG_ARM_THUMB is not set
15CONFIG_PREEMPT=y
16CONFIG_AEABI=y
17CONFIG_ZBOOT_ROM_TEXT=0x0
18CONFIG_ZBOOT_ROM_BSS=0x0
19CONFIG_NET=y
20CONFIG_PACKET=y
21CONFIG_UNIX=y
22CONFIG_INET=y
23CONFIG_IP_PNP=y
24# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
25# CONFIG_INET_XFRM_MODE_TUNNEL is not set
26# CONFIG_INET_XFRM_MODE_BEET is not set
27# CONFIG_IPV6 is not set
28CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
29CONFIG_MTD=y
30CONFIG_MTD_PARTITIONS=y
31CONFIG_MTD_CMDLINE_PARTS=y
32CONFIG_MTD_CHAR=y
33CONFIG_MTD_BLOCK=y
34CONFIG_MTD_CFI=y
35CONFIG_MTD_CFI_INTELEXT=y
36CONFIG_MTD_PHYSMAP=y
37CONFIG_MTD_PLATRAM=y
38CONFIG_MTD_NAND=y
39CONFIG_MTD_NAND_ATMEL=y
40CONFIG_BLK_DEV_LOOP=y
41CONFIG_BLK_DEV_NBD=y
42CONFIG_BLK_DEV_RAM=y
43# CONFIG_MISC_DEVICES is not set
44CONFIG_SCSI=y
45CONFIG_BLK_DEV_SD=y
46CONFIG_SCSI_MULTI_LUN=y
47# CONFIG_SCSI_LOWLEVEL is not set
48CONFIG_NETDEVICES=y
49CONFIG_SMSC_PHY=y
50CONFIG_NET_ETHERNET=y
51CONFIG_MII=y
52CONFIG_MACB=y
53# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set
55CONFIG_PPP=y
56CONFIG_PPP_ASYNC=y
57CONFIG_PPP_DEFLATE=y
58CONFIG_PPP_BSDCOMP=y
59# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
60# CONFIG_KEYBOARD_ATKBD is not set
61CONFIG_KEYBOARD_GPIO=y
62# CONFIG_INPUT_MOUSE is not set
63# CONFIG_SERIO is not set
64CONFIG_SERIAL_ATMEL=y
65CONFIG_SERIAL_ATMEL_CONSOLE=y
66CONFIG_LEGACY_PTY_COUNT=32
67# CONFIG_HW_RANDOM is not set
68CONFIG_I2C=y
69CONFIG_I2C_CHARDEV=y
70CONFIG_I2C_GPIO=y
71CONFIG_GPIO_SYSFS=y
72# CONFIG_HWMON is not set
73CONFIG_WATCHDOG=y
74CONFIG_WATCHDOG_NOWAYOUT=y
75CONFIG_AT91SAM9X_WATCHDOG=y
76# CONFIG_VGA_CONSOLE is not set
77# CONFIG_HID_SUPPORT is not set
78CONFIG_USB=y
79# CONFIG_USB_DEVICE_CLASS is not set
80CONFIG_USB_OHCI_HCD=y
81CONFIG_USB_STORAGE=y
82CONFIG_USB_GADGET=y
83CONFIG_USB_ETH=m
84CONFIG_MMC=y
85CONFIG_MMC_ATMELMCI=m
86CONFIG_NEW_LEDS=y
87CONFIG_LEDS_CLASS=y
88CONFIG_LEDS_GPIO=y
89CONFIG_LEDS_TRIGGERS=y
90CONFIG_LEDS_TRIGGER_TIMER=y
91CONFIG_LEDS_TRIGGER_HEARTBEAT=y
92CONFIG_LEDS_TRIGGER_GPIO=y
93CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
94CONFIG_RTC_CLASS=y
95# CONFIG_RTC_HCTOSYS is not set
96CONFIG_RTC_DRV_DS1307=y
97CONFIG_EXT2_FS=y
98CONFIG_EXT3_FS=y
99# CONFIG_EXT3_FS_XATTR is not set
100CONFIG_INOTIFY=y
101CONFIG_AUTOFS4_FS=y
102CONFIG_MSDOS_FS=y
103CONFIG_VFAT_FS=y
104CONFIG_TMPFS=y
105CONFIG_JFFS2_FS=y
106CONFIG_JFFS2_SUMMARY=y
107CONFIG_CRAMFS=y
108CONFIG_MINIX_FS=y
109CONFIG_NFS_FS=y
110CONFIG_NFS_V3=y
111CONFIG_ROOT_NFS=y
112CONFIG_PARTITION_ADVANCED=y
113CONFIG_NLS_CODEPAGE_437=y
114CONFIG_NLS_ISO8859_1=y
115CONFIG_NLS_UTF8=y
116# CONFIG_RCU_CPU_STALL_DETECTOR is not set
diff --git a/arch/arm/configs/cpu9g20_defconfig b/arch/arm/configs/cpu9g20_defconfig
deleted file mode 100644
index ea116cbdffa..00000000000
--- a/arch/arm/configs/cpu9g20_defconfig
+++ /dev/null
@@ -1,116 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y
9# CONFIG_BLK_DEV_BSG is not set
10# CONFIG_IOSCHED_CFQ is not set
11CONFIG_ARCH_AT91=y
12CONFIG_ARCH_AT91SAM9G20=y
13CONFIG_MACH_CPU9G20=y
14# CONFIG_ARM_THUMB is not set
15CONFIG_PREEMPT=y
16CONFIG_AEABI=y
17CONFIG_ZBOOT_ROM_TEXT=0x0
18CONFIG_ZBOOT_ROM_BSS=0x0
19CONFIG_NET=y
20CONFIG_PACKET=y
21CONFIG_UNIX=y
22CONFIG_INET=y
23CONFIG_IP_PNP=y
24# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
25# CONFIG_INET_XFRM_MODE_TUNNEL is not set
26# CONFIG_INET_XFRM_MODE_BEET is not set
27# CONFIG_IPV6 is not set
28CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
29CONFIG_MTD=y
30CONFIG_MTD_PARTITIONS=y
31CONFIG_MTD_CMDLINE_PARTS=y
32CONFIG_MTD_CHAR=y
33CONFIG_MTD_BLOCK=y
34CONFIG_MTD_CFI=y
35CONFIG_MTD_CFI_INTELEXT=y
36CONFIG_MTD_PHYSMAP=y
37CONFIG_MTD_PLATRAM=y
38CONFIG_MTD_NAND=y
39CONFIG_MTD_NAND_ATMEL=y
40CONFIG_BLK_DEV_LOOP=y
41CONFIG_BLK_DEV_NBD=y
42CONFIG_BLK_DEV_RAM=y
43# CONFIG_MISC_DEVICES is not set
44CONFIG_SCSI=y
45CONFIG_BLK_DEV_SD=y
46CONFIG_SCSI_MULTI_LUN=y
47# CONFIG_SCSI_LOWLEVEL is not set
48CONFIG_NETDEVICES=y
49CONFIG_SMSC_PHY=y
50CONFIG_NET_ETHERNET=y
51CONFIG_MII=y
52CONFIG_MACB=y
53# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set
55CONFIG_PPP=y
56CONFIG_PPP_ASYNC=y
57CONFIG_PPP_DEFLATE=y
58CONFIG_PPP_BSDCOMP=y
59# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
60# CONFIG_KEYBOARD_ATKBD is not set
61CONFIG_KEYBOARD_GPIO=y
62# CONFIG_INPUT_MOUSE is not set
63# CONFIG_SERIO is not set
64CONFIG_SERIAL_ATMEL=y
65CONFIG_SERIAL_ATMEL_CONSOLE=y
66CONFIG_LEGACY_PTY_COUNT=32
67# CONFIG_HW_RANDOM is not set
68CONFIG_I2C=y
69CONFIG_I2C_CHARDEV=y
70CONFIG_I2C_GPIO=y
71CONFIG_GPIO_SYSFS=y
72# CONFIG_HWMON is not set
73CONFIG_WATCHDOG=y
74CONFIG_WATCHDOG_NOWAYOUT=y
75CONFIG_AT91SAM9X_WATCHDOG=y
76# CONFIG_VGA_CONSOLE is not set
77# CONFIG_HID_SUPPORT is not set
78CONFIG_USB=y
79# CONFIG_USB_DEVICE_CLASS is not set
80CONFIG_USB_OHCI_HCD=y
81CONFIG_USB_STORAGE=y
82CONFIG_USB_GADGET=y
83CONFIG_USB_ETH=m
84CONFIG_MMC=y
85CONFIG_MMC_ATMELMCI=m
86CONFIG_NEW_LEDS=y
87CONFIG_LEDS_CLASS=y
88CONFIG_LEDS_GPIO=y
89CONFIG_LEDS_TRIGGERS=y
90CONFIG_LEDS_TRIGGER_TIMER=y
91CONFIG_LEDS_TRIGGER_HEARTBEAT=y
92CONFIG_LEDS_TRIGGER_GPIO=y
93CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
94CONFIG_RTC_CLASS=y
95# CONFIG_RTC_HCTOSYS is not set
96CONFIG_RTC_DRV_DS1307=y
97CONFIG_EXT2_FS=y
98CONFIG_EXT3_FS=y
99# CONFIG_EXT3_FS_XATTR is not set
100CONFIG_INOTIFY=y
101CONFIG_AUTOFS4_FS=y
102CONFIG_MSDOS_FS=y
103CONFIG_VFAT_FS=y
104CONFIG_TMPFS=y
105CONFIG_JFFS2_FS=y
106CONFIG_JFFS2_SUMMARY=y
107CONFIG_CRAMFS=y
108CONFIG_MINIX_FS=y
109CONFIG_NFS_FS=y
110CONFIG_NFS_V3=y
111CONFIG_ROOT_NFS=y
112CONFIG_PARTITION_ADVANCED=y
113CONFIG_NLS_CODEPAGE_437=y
114CONFIG_NLS_ISO8859_1=y
115CONFIG_NLS_UTF8=y
116# CONFIG_RCU_CPU_STALL_DETECTOR is not set
diff --git a/arch/arm/configs/da8xx_omapl_defconfig b/arch/arm/configs/da8xx_omapl_defconfig
index 88ccde058ba..f29223954af 100644
--- a/arch/arm/configs/da8xx_omapl_defconfig
+++ b/arch/arm/configs/da8xx_omapl_defconfig
@@ -17,6 +17,7 @@ CONFIG_MODVERSIONS=y
17CONFIG_ARCH_DAVINCI=y 17CONFIG_ARCH_DAVINCI=y
18CONFIG_ARCH_DAVINCI_DA830=y 18CONFIG_ARCH_DAVINCI_DA830=y
19CONFIG_ARCH_DAVINCI_DA850=y 19CONFIG_ARCH_DAVINCI_DA850=y
20CONFIG_MACH_DA8XX_DT=y
20CONFIG_MACH_MITYOMAPL138=y 21CONFIG_MACH_MITYOMAPL138=y
21CONFIG_MACH_OMAPL138_HAWKBOARD=y 22CONFIG_MACH_OMAPL138_HAWKBOARD=y
22CONFIG_DAVINCI_RESET_CLOCKS=y 23CONFIG_DAVINCI_RESET_CLOCKS=y
@@ -26,6 +27,7 @@ CONFIG_PREEMPT=y
26CONFIG_AEABI=y 27CONFIG_AEABI=y
27# CONFIG_OABI_COMPAT is not set 28# CONFIG_OABI_COMPAT is not set
28CONFIG_LEDS=y 29CONFIG_LEDS=y
30CONFIG_USE_OF=y
29CONFIG_ZBOOT_ROM_TEXT=0x0 31CONFIG_ZBOOT_ROM_TEXT=0x0
30CONFIG_ZBOOT_ROM_BSS=0x0 32CONFIG_ZBOOT_ROM_BSS=0x0
31CONFIG_CPU_FREQ=y 33CONFIG_CPU_FREQ=y
@@ -75,6 +77,7 @@ CONFIG_SERIO_LIBPS2=y
75CONFIG_SERIAL_8250=y 77CONFIG_SERIAL_8250=y
76CONFIG_SERIAL_8250_CONSOLE=y 78CONFIG_SERIAL_8250_CONSOLE=y
77CONFIG_SERIAL_8250_NR_UARTS=3 79CONFIG_SERIAL_8250_NR_UARTS=3
80CONFIG_SERIAL_OF_PLATFORM=y
78CONFIG_I2C=y 81CONFIG_I2C=y
79CONFIG_I2C_CHARDEV=y 82CONFIG_I2C_CHARDEV=y
80CONFIG_I2C_DAVINCI=y 83CONFIG_I2C_DAVINCI=y
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 67b5abb6f85..4ea7c95719d 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -144,7 +144,7 @@ CONFIG_USB_GADGET_DEBUG_FS=y
144CONFIG_USB_ZERO=m 144CONFIG_USB_ZERO=m
145CONFIG_USB_ETH=m 145CONFIG_USB_ETH=m
146CONFIG_USB_GADGETFS=m 146CONFIG_USB_GADGETFS=m
147CONFIG_USB_FILE_STORAGE=m 147CONFIG_USB_MASS_STORAGE=m
148CONFIG_USB_G_SERIAL=m 148CONFIG_USB_G_SERIAL=m
149CONFIG_USB_G_PRINTER=m 149CONFIG_USB_G_PRINTER=m
150CONFIG_USB_CDC_COMPOSITE=m 150CONFIG_USB_CDC_COMPOSITE=m
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index 40db34cf277..0b7ee92c571 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -8,11 +8,19 @@ CONFIG_MODULE_UNLOAD=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9CONFIG_ARCH_DOVE=y 9CONFIG_ARCH_DOVE=y
10CONFIG_MACH_DOVE_DB=y 10CONFIG_MACH_DOVE_DB=y
11CONFIG_MACH_CM_A510=y
12CONFIG_MACH_DOVE_DT=y
11CONFIG_NO_HZ=y 13CONFIG_NO_HZ=y
12CONFIG_HIGH_RES_TIMERS=y 14CONFIG_HIGH_RES_TIMERS=y
13CONFIG_AEABI=y 15CONFIG_AEABI=y
14CONFIG_ZBOOT_ROM_TEXT=0x0 16CONFIG_ZBOOT_ROM_TEXT=0x0
15CONFIG_ZBOOT_ROM_BSS=0x0 17CONFIG_ZBOOT_ROM_BSS=0x0
18CONFIG_HIGHMEM=y
19CONFIG_USE_OF=y
20CONFIG_ATAGS=y
21CONFIG_ARM_APPENDED_DTB=y
22CONFIG_ARM_ATAG_DTB_COMPAT=y
23CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
16CONFIG_VFP=y 24CONFIG_VFP=y
17CONFIG_NET=y 25CONFIG_NET=y
18CONFIG_PACKET=y 26CONFIG_PACKET=y
@@ -62,6 +70,9 @@ CONFIG_SERIAL_8250=y
62CONFIG_SERIAL_8250_CONSOLE=y 70CONFIG_SERIAL_8250_CONSOLE=y
63# CONFIG_SERIAL_8250_PCI is not set 71# CONFIG_SERIAL_8250_PCI is not set
64CONFIG_SERIAL_8250_RUNTIME_UARTS=2 72CONFIG_SERIAL_8250_RUNTIME_UARTS=2
73CONFIG_SERIAL_CORE=y
74CONFIG_SERIAL_CORE_CONSOLE=y
75CONFIG_SERIAL_OF_PLATFORM=y
65# CONFIG_HW_RANDOM is not set 76# CONFIG_HW_RANDOM is not set
66CONFIG_I2C=y 77CONFIG_I2C=y
67CONFIG_I2C_CHARDEV=y 78CONFIG_I2C_CHARDEV=y
@@ -74,6 +85,18 @@ CONFIG_USB_DEVICEFS=y
74CONFIG_USB_EHCI_HCD=y 85CONFIG_USB_EHCI_HCD=y
75CONFIG_USB_EHCI_ROOT_HUB_TT=y 86CONFIG_USB_EHCI_ROOT_HUB_TT=y
76CONFIG_USB_STORAGE=y 87CONFIG_USB_STORAGE=y
88CONFIG_MMC=y
89CONFIG_MMC_SDHCI=y
90CONFIG_MMC_SDHCI_IO_ACCESSORS=y
91CONFIG_MMC_SDHCI_PLTFM=y
92CONFIG_MMC_SDHCI_DOVE=y
93CONFIG_NEW_LEDS=y
94CONFIG_LEDS_CLASS=y
95CONFIG_LEDS_GPIO=y
96CONFIG_LEDS_TRIGGERS=y
97CONFIG_LEDS_TRIGGER_TIMER=y
98CONFIG_LEDS_TRIGGER_HEARTBEAT=y
99CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
77CONFIG_RTC_CLASS=y 100CONFIG_RTC_CLASS=y
78CONFIG_RTC_DRV_MV=y 101CONFIG_RTC_DRV_MV=y
79CONFIG_DMADEVICES=y 102CONFIG_DMADEVICES=y
@@ -122,6 +145,7 @@ CONFIG_CRYPTO_TWOFISH=y
122CONFIG_CRYPTO_DEFLATE=y 145CONFIG_CRYPTO_DEFLATE=y
123CONFIG_CRYPTO_LZO=y 146CONFIG_CRYPTO_LZO=y
124# CONFIG_CRYPTO_ANSI_CPRNG is not set 147# CONFIG_CRYPTO_ANSI_CPRNG is not set
148CONFIG_CRYPTO_DEV_MV_CESA=y
125CONFIG_CRC_CCITT=y 149CONFIG_CRC_CCITT=y
126CONFIG_CRC16=y 150CONFIG_CRC16=y
127CONFIG_LIBCRC32C=y 151CONFIG_LIBCRC32C=y
diff --git a/arch/arm/configs/edb7211_defconfig b/arch/arm/configs/edb7211_defconfig
deleted file mode 100644
index d52ded350a1..00000000000
--- a/arch/arm/configs/edb7211_defconfig
+++ /dev/null
@@ -1,27 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y
5CONFIG_EXPERT=y
6# CONFIG_HOTPLUG is not set
7CONFIG_ARCH_CLPS711X=y
8CONFIG_ARCH_EDB7211=y
9CONFIG_ZBOOT_ROM_TEXT=0x0
10CONFIG_ZBOOT_ROM_BSS=0x0
11CONFIG_NET=y
12CONFIG_PACKET=y
13CONFIG_UNIX=y
14CONFIG_INET=y
15# CONFIG_IPV6 is not set
16CONFIG_BLK_DEV_RAM=y
17CONFIG_NETDEVICES=y
18# CONFIG_INPUT is not set
19CONFIG_SERIO_LIBPS2=y
20# CONFIG_VT is not set
21CONFIG_SERIAL_CLPS711X=y
22CONFIG_SERIAL_CLPS711X_CONSOLE=y
23CONFIG_EXT2_FS=y
24CONFIG_MINIX_FS=y
25CONFIG_PARTITION_ADVANCED=y
26# CONFIG_MSDOS_PARTITION is not set
27CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/fortunet_defconfig b/arch/arm/configs/fortunet_defconfig
deleted file mode 100644
index 840fced7529..00000000000
--- a/arch/arm/configs/fortunet_defconfig
+++ /dev/null
@@ -1,28 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y
5CONFIG_EXPERT=y
6# CONFIG_HOTPLUG is not set
7CONFIG_ARCH_CLPS711X=y
8CONFIG_ARCH_FORTUNET=y
9# CONFIG_ARM_THUMB is not set
10CONFIG_ZBOOT_ROM_TEXT=0x0
11CONFIG_ZBOOT_ROM_BSS=0x0
12CONFIG_FPE_FASTFPE=y
13CONFIG_BINFMT_AOUT=y
14CONFIG_NET=y
15CONFIG_UNIX=y
16CONFIG_MTD=y
17CONFIG_MTD_CHAR=y
18CONFIG_MTD_BLOCK=y
19CONFIG_MTD_CFI=y
20CONFIG_MTD_CFI_INTELEXT=y
21CONFIG_BLK_DEV_RAM=y
22# CONFIG_INPUT is not set
23# CONFIG_SERIO is not set
24# CONFIG_VT is not set
25CONFIG_SERIAL_CLPS711X=y
26CONFIG_SERIAL_CLPS711X_CONSOLE=y
27CONFIG_EXT2_FS=y
28CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/g3evm_defconfig b/arch/arm/configs/g3evm_defconfig
deleted file mode 100644
index 4a336ab5a0c..00000000000
--- a/arch/arm/configs/g3evm_defconfig
+++ /dev/null
@@ -1,57 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y
8# CONFIG_BLK_DEV_BSG is not set
9# CONFIG_IOSCHED_DEADLINE is not set
10# CONFIG_IOSCHED_CFQ is not set
11CONFIG_ARCH_SHMOBILE=y
12CONFIG_ARCH_SH7367=y
13CONFIG_MACH_G3EVM=y
14CONFIG_AEABI=y
15# CONFIG_OABI_COMPAT is not set
16CONFIG_ZBOOT_ROM_TEXT=0x0
17CONFIG_ZBOOT_ROM_BSS=0x0
18CONFIG_CMDLINE="console=ttySC1,115200 earlyprintk=sh-sci.1,115200"
19CONFIG_KEXEC=y
20CONFIG_PM=y
21# CONFIG_SUSPEND is not set
22CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
23# CONFIG_FIRMWARE_IN_KERNEL is not set
24CONFIG_MTD=y
25CONFIG_MTD_CONCAT=y
26CONFIG_MTD_PARTITIONS=y
27CONFIG_MTD_CHAR=y
28CONFIG_MTD_BLOCK=y
29CONFIG_MTD_CFI=y
30CONFIG_MTD_CFI_INTELEXT=y
31CONFIG_MTD_PHYSMAP=y
32CONFIG_MTD_NAND=y
33# CONFIG_BLK_DEV is not set
34# CONFIG_MISC_DEVICES is not set
35# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
36# CONFIG_INPUT_KEYBOARD is not set
37# CONFIG_INPUT_MOUSE is not set
38# CONFIG_SERIO is not set
39CONFIG_SERIAL_SH_SCI=y
40CONFIG_SERIAL_SH_SCI_NR_UARTS=8
41CONFIG_SERIAL_SH_SCI_CONSOLE=y
42# CONFIG_LEGACY_PTYS is not set
43# CONFIG_HW_RANDOM is not set
44# CONFIG_HWMON is not set
45# CONFIG_VGA_CONSOLE is not set
46# CONFIG_HID_SUPPORT is not set
47# CONFIG_USB_SUPPORT is not set
48# CONFIG_DNOTIFY is not set
49# CONFIG_INOTIFY_USER is not set
50CONFIG_TMPFS=y
51# CONFIG_MISC_FILESYSTEMS is not set
52CONFIG_MAGIC_SYSRQ=y
53CONFIG_DEBUG_KERNEL=y
54# CONFIG_DETECT_SOFTLOCKUP is not set
55# CONFIG_RCU_CPU_STALL_DETECTOR is not set
56# CONFIG_FTRACE is not set
57# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/g4evm_defconfig b/arch/arm/configs/g4evm_defconfig
deleted file mode 100644
index 21c6d0307bc..00000000000
--- a/arch/arm/configs/g4evm_defconfig
+++ /dev/null
@@ -1,57 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y
8# CONFIG_BLK_DEV_BSG is not set
9# CONFIG_IOSCHED_DEADLINE is not set
10# CONFIG_IOSCHED_CFQ is not set
11CONFIG_ARCH_SHMOBILE=y
12CONFIG_ARCH_SH7377=y
13CONFIG_MACH_G4EVM=y
14CONFIG_AEABI=y
15# CONFIG_OABI_COMPAT is not set
16CONFIG_ZBOOT_ROM_TEXT=0x0
17CONFIG_ZBOOT_ROM_BSS=0x0
18CONFIG_CMDLINE="console=ttySC4,115200 earlyprintk=sh-sci.4,115200"
19CONFIG_KEXEC=y
20CONFIG_PM=y
21# CONFIG_SUSPEND is not set
22CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
23# CONFIG_FIRMWARE_IN_KERNEL is not set
24CONFIG_MTD=y
25CONFIG_MTD_CONCAT=y
26CONFIG_MTD_PARTITIONS=y
27CONFIG_MTD_CHAR=y
28CONFIG_MTD_BLOCK=y
29CONFIG_MTD_CFI=y
30CONFIG_MTD_CFI_INTELEXT=y
31CONFIG_MTD_PHYSMAP=y
32CONFIG_MTD_NAND=y
33# CONFIG_BLK_DEV is not set
34# CONFIG_MISC_DEVICES is not set
35# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
36# CONFIG_INPUT_KEYBOARD is not set
37# CONFIG_INPUT_MOUSE is not set
38# CONFIG_SERIO is not set
39CONFIG_SERIAL_SH_SCI=y
40CONFIG_SERIAL_SH_SCI_NR_UARTS=8
41CONFIG_SERIAL_SH_SCI_CONSOLE=y
42# CONFIG_LEGACY_PTYS is not set
43# CONFIG_HW_RANDOM is not set
44# CONFIG_HWMON is not set
45# CONFIG_VGA_CONSOLE is not set
46# CONFIG_HID_SUPPORT is not set
47# CONFIG_USB_SUPPORT is not set
48# CONFIG_DNOTIFY is not set
49# CONFIG_INOTIFY_USER is not set
50CONFIG_TMPFS=y
51# CONFIG_MISC_FILESYSTEMS is not set
52CONFIG_MAGIC_SYSRQ=y
53CONFIG_DEBUG_KERNEL=y
54# CONFIG_DETECT_SOFTLOCKUP is not set
55# CONFIG_RCU_CPU_STALL_DETECTOR is not set
56# CONFIG_FTRACE is not set
57# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/h7202_defconfig b/arch/arm/configs/h7202_defconfig
index 69405a76242..e16d3f372e2 100644
--- a/arch/arm/configs/h7202_defconfig
+++ b/arch/arm/configs/h7202_defconfig
@@ -34,8 +34,7 @@ CONFIG_FB_MODE_HELPERS=y
34CONFIG_USB_GADGET=m 34CONFIG_USB_GADGET=m
35CONFIG_USB_ZERO=m 35CONFIG_USB_ZERO=m
36CONFIG_USB_GADGETFS=m 36CONFIG_USB_GADGETFS=m
37CONFIG_USB_FILE_STORAGE=m 37CONFIG_USB_MASS_STORAGE=m
38CONFIG_USB_FILE_STORAGE_TEST=y
39CONFIG_USB_G_SERIAL=m 38CONFIG_USB_G_SERIAL=m
40CONFIG_EXT2_FS=y 39CONFIG_EXT2_FS=y
41CONFIG_TMPFS=y 40CONFIG_TMPFS=y
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index 78ed575feb1..ebbfb27e0e7 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -18,7 +18,9 @@ CONFIG_MODULE_UNLOAD=y
18# CONFIG_IOSCHED_DEADLINE is not set 18# CONFIG_IOSCHED_DEADLINE is not set
19# CONFIG_IOSCHED_CFQ is not set 19# CONFIG_IOSCHED_CFQ is not set
20CONFIG_ARCH_MXC=y 20CONFIG_ARCH_MXC=y
21CONFIG_ARCH_IMX_V4_V5=y 21CONFIG_ARCH_MULTI_V4T=y
22CONFIG_ARCH_MULTI_V5=y
23# CONFIG_ARCH_MULTI_V7 is not set
22CONFIG_ARCH_MX1ADS=y 24CONFIG_ARCH_MX1ADS=y
23CONFIG_MACH_SCB9328=y 25CONFIG_MACH_SCB9328=y
24CONFIG_MACH_APF9328=y 26CONFIG_MACH_APF9328=y
@@ -121,6 +123,7 @@ CONFIG_REGULATOR_MC13892=y
121CONFIG_MEDIA_SUPPORT=y 123CONFIG_MEDIA_SUPPORT=y
122CONFIG_VIDEO_DEV=y 124CONFIG_VIDEO_DEV=y
123CONFIG_V4L_PLATFORM_DRIVERS=y 125CONFIG_V4L_PLATFORM_DRIVERS=y
126CONFIG_MEDIA_CAMERA_SUPPORT=y
124CONFIG_SOC_CAMERA=y 127CONFIG_SOC_CAMERA=y
125CONFIG_SOC_CAMERA_OV2640=y 128CONFIG_SOC_CAMERA_OV2640=y
126CONFIG_VIDEO_MX2=y 129CONFIG_VIDEO_MX2=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 394ded624e3..69667133321 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -17,6 +17,8 @@ CONFIG_MODVERSIONS=y
17CONFIG_MODULE_SRCVERSION_ALL=y 17CONFIG_MODULE_SRCVERSION_ALL=y
18# CONFIG_BLK_DEV_BSG is not set 18# CONFIG_BLK_DEV_BSG is not set
19CONFIG_ARCH_MXC=y 19CONFIG_ARCH_MXC=y
20CONFIG_ARCH_MULTI_V6=y
21CONFIG_ARCH_MULTI_V7=y
20CONFIG_MACH_MX31LILLY=y 22CONFIG_MACH_MX31LILLY=y
21CONFIG_MACH_MX31LITE=y 23CONFIG_MACH_MX31LITE=y
22CONFIG_MACH_PCM037=y 24CONFIG_MACH_PCM037=y
@@ -143,15 +145,18 @@ CONFIG_GPIO_MC9S08DZ60=y
143# CONFIG_HWMON is not set 145# CONFIG_HWMON is not set
144CONFIG_WATCHDOG=y 146CONFIG_WATCHDOG=y
145CONFIG_IMX2_WDT=y 147CONFIG_IMX2_WDT=y
148CONFIG_MFD_DA9052_I2C=y
146CONFIG_MFD_MC13XXX_SPI=y 149CONFIG_MFD_MC13XXX_SPI=y
147CONFIG_MFD_MC13XXX_I2C=y 150CONFIG_MFD_MC13XXX_I2C=y
148CONFIG_REGULATOR=y 151CONFIG_REGULATOR=y
149CONFIG_REGULATOR_FIXED_VOLTAGE=y 152CONFIG_REGULATOR_FIXED_VOLTAGE=y
153CONFIG_REGULATOR_DA9052=y
150CONFIG_REGULATOR_MC13783=y 154CONFIG_REGULATOR_MC13783=y
151CONFIG_REGULATOR_MC13892=y 155CONFIG_REGULATOR_MC13892=y
152CONFIG_MEDIA_SUPPORT=y 156CONFIG_MEDIA_SUPPORT=y
153CONFIG_VIDEO_DEV=y 157CONFIG_VIDEO_DEV=y
154CONFIG_V4L_PLATFORM_DRIVERS=y 158CONFIG_V4L_PLATFORM_DRIVERS=y
159CONFIG_MEDIA_CAMERA_SUPPORT=y
155CONFIG_SOC_CAMERA=y 160CONFIG_SOC_CAMERA=y
156CONFIG_SOC_CAMERA_OV2640=y 161CONFIG_SOC_CAMERA_OV2640=y
157CONFIG_VIDEO_MX3=y 162CONFIG_VIDEO_MX3=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 74eee0c78f2..93f3794ba5c 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -27,6 +27,14 @@ CONFIG_MACH_GOFLEXNET_DT=y
27CONFIG_MACH_LSXL_DT=y 27CONFIG_MACH_LSXL_DT=y
28CONFIG_MACH_IOMEGA_IX2_200_DT=y 28CONFIG_MACH_IOMEGA_IX2_200_DT=y
29CONFIG_MACH_KM_KIRKWOOD_DT=y 29CONFIG_MACH_KM_KIRKWOOD_DT=y
30CONFIG_MACH_INETSPACE_V2_DT=y
31CONFIG_MACH_MPLCEC4_DT=y
32CONFIG_MACH_NETSPACE_V2_DT=y
33CONFIG_MACH_NETSPACE_MAX_V2_DT=y
34CONFIG_MACH_NETSPACE_LITE_V2_DT=y
35CONFIG_MACH_NETSPACE_MINI_V2_DT=y
36CONFIG_MACH_OPENBLOCKS_A6_DT=y
37CONFIG_MACH_TOPKICK_DT=y
30CONFIG_MACH_TS219=y 38CONFIG_MACH_TS219=y
31CONFIG_MACH_TS41X=y 39CONFIG_MACH_TS41X=y
32CONFIG_MACH_DOCKSTAR=y 40CONFIG_MACH_DOCKSTAR=y
@@ -40,6 +48,7 @@ CONFIG_MACH_D2NET_V2=y
40CONFIG_MACH_NET2BIG_V2=y 48CONFIG_MACH_NET2BIG_V2=y
41CONFIG_MACH_NET5BIG_V2=y 49CONFIG_MACH_NET5BIG_V2=y
42CONFIG_MACH_T5325=y 50CONFIG_MACH_T5325=y
51CONFIG_MACH_NSA310_DT=y
43# CONFIG_CPU_FEROCEON_OLD_ID is not set 52# CONFIG_CPU_FEROCEON_OLD_ID is not set
44CONFIG_PREEMPT=y 53CONFIG_PREEMPT=y
45CONFIG_AEABI=y 54CONFIG_AEABI=y
diff --git a/arch/arm/configs/kota2_defconfig b/arch/arm/configs/kota2_defconfig
index b7735d6347a..fa83db1ef0e 100644
--- a/arch/arm/configs/kota2_defconfig
+++ b/arch/arm/configs/kota2_defconfig
@@ -112,7 +112,6 @@ CONFIG_LEDS_GPIO=y
112CONFIG_LEDS_RENESAS_TPU=y 112CONFIG_LEDS_RENESAS_TPU=y
113CONFIG_LEDS_TRIGGERS=y 113CONFIG_LEDS_TRIGGERS=y
114# CONFIG_DNOTIFY is not set 114# CONFIG_DNOTIFY is not set
115# CONFIG_INOTIFY_USER is not set
116CONFIG_TMPFS=y 115CONFIG_TMPFS=y
117# CONFIG_MISC_FILESYSTEMS is not set 116# CONFIG_MISC_FILESYSTEMS is not set
118CONFIG_MAGIC_SYSRQ=y 117CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
index c88b57886e7..afbae287436 100644
--- a/arch/arm/configs/kzm9g_defconfig
+++ b/arch/arm/configs/kzm9g_defconfig
@@ -74,6 +74,8 @@ CONFIG_KEYBOARD_GPIO=y
74# CONFIG_INPUT_MOUSE is not set 74# CONFIG_INPUT_MOUSE is not set
75CONFIG_INPUT_TOUCHSCREEN=y 75CONFIG_INPUT_TOUCHSCREEN=y
76CONFIG_TOUCHSCREEN_ST1232=y 76CONFIG_TOUCHSCREEN_ST1232=y
77CONFIG_INPUT_MISC=y
78CONFIG_INPUT_ADXL34X=y
77# CONFIG_LEGACY_PTYS is not set 79# CONFIG_LEGACY_PTYS is not set
78CONFIG_SERIAL_SH_SCI=y 80CONFIG_SERIAL_SH_SCI=y
79CONFIG_SERIAL_SH_SCI_NR_UARTS=9 81CONFIG_SERIAL_SH_SCI_NR_UARTS=9
@@ -119,8 +121,9 @@ CONFIG_DMADEVICES=y
119CONFIG_SH_DMAE=y 121CONFIG_SH_DMAE=y
120CONFIG_ASYNC_TX_DMA=y 122CONFIG_ASYNC_TX_DMA=y
121CONFIG_STAGING=y 123CONFIG_STAGING=y
124CONFIG_SENSORS_AK8975=y
125CONFIG_IIO=y
122# CONFIG_DNOTIFY is not set 126# CONFIG_DNOTIFY is not set
123CONFIG_INOTIFY_USER=y
124CONFIG_VFAT_FS=y 127CONFIG_VFAT_FS=y
125CONFIG_TMPFS=y 128CONFIG_TMPFS=y
126# CONFIG_MISC_FILESYSTEMS is not set 129# CONFIG_MISC_FILESYSTEMS is not set
diff --git a/arch/arm/configs/mackerel_defconfig b/arch/arm/configs/mackerel_defconfig
index 306a2e2d362..2098ce15554 100644
--- a/arch/arm/configs/mackerel_defconfig
+++ b/arch/arm/configs/mackerel_defconfig
@@ -70,17 +70,31 @@ CONFIG_SERIAL_SH_SCI_NR_UARTS=8
70CONFIG_SERIAL_SH_SCI_CONSOLE=y 70CONFIG_SERIAL_SH_SCI_CONSOLE=y
71# CONFIG_LEGACY_PTYS is not set 71# CONFIG_LEGACY_PTYS is not set
72# CONFIG_HW_RANDOM is not set 72# CONFIG_HW_RANDOM is not set
73CONFIG_I2C=y
74CONFIG_I2C_SH_MOBILE=y
73# CONFIG_HWMON is not set 75# CONFIG_HWMON is not set
74# CONFIG_MFD_SUPPORT is not set 76# CONFIG_MFD_SUPPORT is not set
75CONFIG_FB=y 77CONFIG_FB=y
76CONFIG_FB_MODE_HELPERS=y 78CONFIG_FB_MODE_HELPERS=y
77CONFIG_FB_SH_MOBILE_LCDC=y 79CONFIG_FB_SH_MOBILE_LCDC=y
80CONFIG_FB_SH_MOBILE_HDMI=y
78CONFIG_FRAMEBUFFER_CONSOLE=y 81CONFIG_FRAMEBUFFER_CONSOLE=y
79CONFIG_LOGO=y 82CONFIG_LOGO=y
80# CONFIG_LOGO_LINUX_MONO is not set 83# CONFIG_LOGO_LINUX_MONO is not set
81# CONFIG_LOGO_LINUX_CLUT224 is not set 84# CONFIG_LOGO_LINUX_CLUT224 is not set
82# CONFIG_HID_SUPPORT is not set 85# CONFIG_SND_SUPPORT_OLD_API is not set
83# CONFIG_USB_SUPPORT is not set 86# CONFIG_SND_VERBOSE_PROCFS is not set
87# CONFIG_SND_DRIVERS is not set
88# CONFIG_SND_ARM is not set
89CONFIG_SND_SOC_SH4_FSI=y
90CONFIG_USB=y
91CONFIG_USB_RENESAS_USBHS_HCD=y
92CONFIG_USB_RENESAS_USBHS=y
93CONFIG_USB_STORAGE=y
94CONFIG_USB_GADGET=y
95CONFIG_USB_RENESAS_USBHS_UDC=y
96CONFIG_DMADEVICES=y
97CONFIG_SH_DMAE=y
84CONFIG_EXT2_FS=y 98CONFIG_EXT2_FS=y
85CONFIG_EXT2_FS_XATTR=y 99CONFIG_EXT2_FS_XATTR=y
86CONFIG_EXT2_FS_POSIX_ACL=y 100CONFIG_EXT2_FS_POSIX_ACL=y
@@ -91,7 +105,6 @@ CONFIG_EXT3_FS=y
91CONFIG_EXT3_FS_POSIX_ACL=y 105CONFIG_EXT3_FS_POSIX_ACL=y
92CONFIG_EXT3_FS_SECURITY=y 106CONFIG_EXT3_FS_SECURITY=y
93# CONFIG_DNOTIFY is not set 107# CONFIG_DNOTIFY is not set
94# CONFIG_INOTIFY_USER is not set
95CONFIG_MSDOS_FS=y 108CONFIG_MSDOS_FS=y
96CONFIG_VFAT_FS=y 109CONFIG_VFAT_FS=y
97CONFIG_TMPFS=y 110CONFIG_TMPFS=y
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig
index a691ef4c600..557dd291288 100644
--- a/arch/arm/configs/magician_defconfig
+++ b/arch/arm/configs/magician_defconfig
@@ -136,7 +136,7 @@ CONFIG_USB_PXA27X=y
136CONFIG_USB_ETH=m 136CONFIG_USB_ETH=m
137# CONFIG_USB_ETH_RNDIS is not set 137# CONFIG_USB_ETH_RNDIS is not set
138CONFIG_USB_GADGETFS=m 138CONFIG_USB_GADGETFS=m
139CONFIG_USB_FILE_STORAGE=m 139CONFIG_USB_MASS_STORAGE=m
140CONFIG_USB_G_SERIAL=m 140CONFIG_USB_G_SERIAL=m
141CONFIG_USB_CDC_COMPOSITE=m 141CONFIG_USB_CDC_COMPOSITE=m
142CONFIG_USB_GPIO_VBUS=y 142CONFIG_USB_GPIO_VBUS=y
diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
index 53382b6c8bb..728a43c446f 100644
--- a/arch/arm/configs/marzen_defconfig
+++ b/arch/arm/configs/marzen_defconfig
@@ -47,6 +47,8 @@ CONFIG_DEVTMPFS_MOUNT=y
47# CONFIG_STANDALONE is not set 47# CONFIG_STANDALONE is not set
48# CONFIG_PREVENT_FIRMWARE_BUILD is not set 48# CONFIG_PREVENT_FIRMWARE_BUILD is not set
49# CONFIG_FW_LOADER is not set 49# CONFIG_FW_LOADER is not set
50CONFIG_SCSI=y
51CONFIG_BLK_DEV_SD=y
50CONFIG_NETDEVICES=y 52CONFIG_NETDEVICES=y
51# CONFIG_NET_VENDOR_BROADCOM is not set 53# CONFIG_NET_VENDOR_BROADCOM is not set
52# CONFIG_NET_VENDOR_FARADAY is not set 54# CONFIG_NET_VENDOR_FARADAY is not set
@@ -59,9 +61,8 @@ CONFIG_SMSC911X=y
59# CONFIG_NET_VENDOR_STMICRO is not set 61# CONFIG_NET_VENDOR_STMICRO is not set
60# CONFIG_WLAN is not set 62# CONFIG_WLAN is not set
61# CONFIG_INPUT_MOUSEDEV is not set 63# CONFIG_INPUT_MOUSEDEV is not set
62# CONFIG_INPUT_KEYBOARD is not set 64CONFIG_INPUT_EVDEV=y
63# CONFIG_INPUT_MOUSE is not set 65# CONFIG_INPUT_MOUSE is not set
64# CONFIG_SERIO is not set
65# CONFIG_VT is not set 66# CONFIG_VT is not set
66# CONFIG_LEGACY_PTYS is not set 67# CONFIG_LEGACY_PTYS is not set
67# CONFIG_DEVKMEM is not set 68# CONFIG_DEVKMEM is not set
@@ -69,14 +70,25 @@ CONFIG_SERIAL_SH_SCI=y
69CONFIG_SERIAL_SH_SCI_NR_UARTS=6 70CONFIG_SERIAL_SH_SCI_NR_UARTS=6
70CONFIG_SERIAL_SH_SCI_CONSOLE=y 71CONFIG_SERIAL_SH_SCI_CONSOLE=y
71# CONFIG_HW_RANDOM is not set 72# CONFIG_HW_RANDOM is not set
73CONFIG_I2C=y
74CONFIG_I2C_RCAR=y
75CONFIG_SPI=y
76CONFIG_SPI_SH_HSPI=y
72CONFIG_GPIO_SYSFS=y 77CONFIG_GPIO_SYSFS=y
73# CONFIG_HWMON is not set 78# CONFIG_HWMON is not set
74CONFIG_THERMAL=y 79CONFIG_THERMAL=y
75CONFIG_RCAR_THERMAL=y 80CONFIG_RCAR_THERMAL=y
76CONFIG_SSB=y 81CONFIG_SSB=y
77# CONFIG_USB_SUPPORT is not set 82CONFIG_USB=y
83CONFIG_USB_RCAR_PHY=y
78CONFIG_MMC=y 84CONFIG_MMC=y
79CONFIG_MMC_SDHI=y 85CONFIG_MMC_SDHI=y
86CONFIG_USB=y
87CONFIG_USB_EHCI_HCD=y
88CONFIG_USB_OHCI_HCD=y
89CONFIG_USB_OHCI_HCD_PLATFORM=y
90CONFIG_USB_EHCI_HCD_PLATFORM=y
91CONFIG_USB_STORAGE=y
80CONFIG_UIO=y 92CONFIG_UIO=y
81CONFIG_UIO_PDRV_GENIRQ=y 93CONFIG_UIO_PDRV_GENIRQ=y
82# CONFIG_IOMMU_SUPPORT is not set 94# CONFIG_IOMMU_SUPPORT is not set
diff --git a/arch/arm/configs/mini2440_defconfig b/arch/arm/configs/mini2440_defconfig
index 00630e6af45..a07948a87ca 100644
--- a/arch/arm/configs/mini2440_defconfig
+++ b/arch/arm/configs/mini2440_defconfig
@@ -240,7 +240,7 @@ CONFIG_USB_GADGET_S3C2410=y
240CONFIG_USB_ZERO=m 240CONFIG_USB_ZERO=m
241CONFIG_USB_ETH=m 241CONFIG_USB_ETH=m
242CONFIG_USB_GADGETFS=m 242CONFIG_USB_GADGETFS=m
243CONFIG_USB_FILE_STORAGE=m 243CONFIG_USB_MASS_STORAGE=m
244CONFIG_USB_G_SERIAL=m 244CONFIG_USB_G_SERIAL=m
245CONFIG_USB_CDC_COMPOSITE=m 245CONFIG_USB_CDC_COMPOSITE=m
246CONFIG_MMC=y 246CONFIG_MMC=y
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 048aaca6081..7bf535104e2 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -61,6 +61,8 @@ CONFIG_MTD_NAND_GPMI_NAND=y
61CONFIG_NETDEVICES=y 61CONFIG_NETDEVICES=y
62CONFIG_NET_ETHERNET=y 62CONFIG_NET_ETHERNET=y
63CONFIG_ENC28J60=y 63CONFIG_ENC28J60=y
64CONFIG_USB_USBNET=y
65CONFIG_USB_NET_SMSC95XX=y
64# CONFIG_NETDEV_1000 is not set 66# CONFIG_NETDEV_1000 is not set
65# CONFIG_NETDEV_10000 is not set 67# CONFIG_NETDEV_10000 is not set
66# CONFIG_WLAN is not set 68# CONFIG_WLAN is not set
@@ -158,6 +160,10 @@ CONFIG_NFS_V3=y
158CONFIG_NFS_V3_ACL=y 160CONFIG_NFS_V3_ACL=y
159CONFIG_NFS_V4=y 161CONFIG_NFS_V4=y
160CONFIG_ROOT_NFS=y 162CONFIG_ROOT_NFS=y
163CONFIG_NLS_CODEPAGE_437=y
164CONFIG_NLS_CODEPAGE_850=y
165CONFIG_NLS_ISO8859_1=y
166CONFIG_NLS_ISO8859_15=y
161CONFIG_PRINTK_TIME=y 167CONFIG_PRINTK_TIME=y
162CONFIG_FRAME_WARN=2048 168CONFIG_FRAME_WARN=2048
163CONFIG_MAGIC_SYSRQ=y 169CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index dde2a1af7b3..42eab9a2a0f 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -214,8 +214,7 @@ CONFIG_USB_TEST=y
214CONFIG_USB_GADGET=y 214CONFIG_USB_GADGET=y
215CONFIG_USB_ETH=m 215CONFIG_USB_ETH=m
216# CONFIG_USB_ETH_RNDIS is not set 216# CONFIG_USB_ETH_RNDIS is not set
217CONFIG_USB_FILE_STORAGE=m 217CONFIG_USB_MASS_STORAGE=m
218CONFIG_USB_FILE_STORAGE_TEST=y
219CONFIG_MMC=y 218CONFIG_MMC=y
220CONFIG_MMC_SDHCI=y 219CONFIG_MMC_SDHCI=y
221CONFIG_MMC_SDHCI_PLTFM=y 220CONFIG_MMC_SDHCI_PLTFM=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 62303043db9..a1dc5c071e7 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -240,3 +240,6 @@ CONFIG_CRC_ITU_T=y
240CONFIG_CRC7=y 240CONFIG_CRC7=y
241CONFIG_LIBCRC32C=y 241CONFIG_LIBCRC32C=y
242CONFIG_SOC_OMAP5=y 242CONFIG_SOC_OMAP5=y
243CONFIG_TI_DAVINCI_MDIO=y
244CONFIG_TI_DAVINCI_CPDMA=y
245CONFIG_TI_CPSW=y
diff --git a/arch/arm/configs/orion5x_defconfig b/arch/arm/configs/orion5x_defconfig
index cd5e6ba9a54..952430d9e2d 100644
--- a/arch/arm/configs/orion5x_defconfig
+++ b/arch/arm/configs/orion5x_defconfig
@@ -1,7 +1,8 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y
3CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5CONFIG_EXPERT=y 6CONFIG_EXPERT=y
6# CONFIG_SLUB_DEBUG is not set 7# CONFIG_SLUB_DEBUG is not set
7CONFIG_PROFILING=y 8CONFIG_PROFILING=y
@@ -10,6 +11,8 @@ CONFIG_KPROBES=y
10CONFIG_MODULES=y 11CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 12CONFIG_MODULE_UNLOAD=y
12# CONFIG_BLK_DEV_BSG is not set 13# CONFIG_BLK_DEV_BSG is not set
14CONFIG_PARTITION_ADVANCED=y
15CONFIG_BSD_DISKLABEL=y
13CONFIG_ARCH_ORION5X=y 16CONFIG_ARCH_ORION5X=y
14CONFIG_MACH_DB88F5281=y 17CONFIG_MACH_DB88F5281=y
15CONFIG_MACH_RD88F5182=y 18CONFIG_MACH_RD88F5182=y
@@ -24,7 +27,7 @@ CONFIG_MACH_TS409=y
24CONFIG_MACH_WRT350N_V2=y 27CONFIG_MACH_WRT350N_V2=y
25CONFIG_MACH_TS78XX=y 28CONFIG_MACH_TS78XX=y
26CONFIG_MACH_MV2120=y 29CONFIG_MACH_MV2120=y
27CONFIG_MACH_EDMINI_V2=y 30CONFIG_MACH_EDMINI_V2_DT=y
28CONFIG_MACH_D2NET=y 31CONFIG_MACH_D2NET=y
29CONFIG_MACH_BIGDISK=y 32CONFIG_MACH_BIGDISK=y
30CONFIG_MACH_NET2BIG=y 33CONFIG_MACH_NET2BIG=y
@@ -33,17 +36,13 @@ CONFIG_MACH_WNR854T=y
33CONFIG_MACH_RD88F5181L_GE=y 36CONFIG_MACH_RD88F5181L_GE=y
34CONFIG_MACH_RD88F5181L_FXO=y 37CONFIG_MACH_RD88F5181L_FXO=y
35CONFIG_MACH_RD88F6183AP_GE=y 38CONFIG_MACH_RD88F6183AP_GE=y
36CONFIG_NO_HZ=y
37CONFIG_HIGH_RES_TIMERS=y
38CONFIG_PREEMPT=y 39CONFIG_PREEMPT=y
39CONFIG_AEABI=y 40CONFIG_AEABI=y
40CONFIG_LEDS=y
41CONFIG_LEDS_CPU=y
42CONFIG_ZBOOT_ROM_TEXT=0x0 41CONFIG_ZBOOT_ROM_TEXT=0x0
43CONFIG_ZBOOT_ROM_BSS=0x0 42CONFIG_ZBOOT_ROM_BSS=0x0
43CONFIG_ARM_APPENDED_DTB=y
44CONFIG_FPE_NWFPE=y 44CONFIG_FPE_NWFPE=y
45CONFIG_VFP=y 45CONFIG_VFP=y
46# CONFIG_SUSPEND is not set
47CONFIG_NET=y 46CONFIG_NET=y
48CONFIG_PACKET=y 47CONFIG_PACKET=y
49CONFIG_UNIX=y 48CONFIG_UNIX=y
@@ -54,13 +53,10 @@ CONFIG_IP_PNP_DHCP=y
54CONFIG_IP_PNP_BOOTP=y 53CONFIG_IP_PNP_BOOTP=y
55# CONFIG_IPV6 is not set 54# CONFIG_IPV6 is not set
56CONFIG_NET_DSA=y 55CONFIG_NET_DSA=y
57CONFIG_NET_DSA_MV88E6131=y
58CONFIG_NET_DSA_MV88E6123_61_65=y
59CONFIG_NET_PKTGEN=m 56CONFIG_NET_PKTGEN=m
60CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 57CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
61# CONFIG_FIRMWARE_IN_KERNEL is not set 58# CONFIG_FIRMWARE_IN_KERNEL is not set
62CONFIG_MTD=y 59CONFIG_MTD=y
63CONFIG_MTD_PARTITIONS=y
64CONFIG_MTD_CMDLINE_PARTS=y 60CONFIG_MTD_CMDLINE_PARTS=y
65CONFIG_MTD_CHAR=y 61CONFIG_MTD_CHAR=y
66CONFIG_MTD_BLOCK=y 62CONFIG_MTD_BLOCK=y
@@ -82,12 +78,11 @@ CONFIG_CHR_DEV_SG=m
82CONFIG_ATA=y 78CONFIG_ATA=y
83CONFIG_SATA_MV=y 79CONFIG_SATA_MV=y
84CONFIG_NETDEVICES=y 80CONFIG_NETDEVICES=y
85CONFIG_MARVELL_PHY=y
86CONFIG_NET_ETHERNET=y
87CONFIG_MII=y 81CONFIG_MII=y
88CONFIG_NET_PCI=y 82CONFIG_NET_DSA_MV88E6131=y
83CONFIG_NET_DSA_MV88E6123_61_65=y
89CONFIG_MV643XX_ETH=y 84CONFIG_MV643XX_ETH=y
90# CONFIG_NETDEV_10000 is not set 85CONFIG_MARVELL_PHY=y
91# CONFIG_INPUT_MOUSEDEV is not set 86# CONFIG_INPUT_MOUSEDEV is not set
92CONFIG_INPUT_EVDEV=y 87CONFIG_INPUT_EVDEV=y
93# CONFIG_KEYBOARD_ATKBD is not set 88# CONFIG_KEYBOARD_ATKBD is not set
@@ -95,11 +90,12 @@ CONFIG_KEYBOARD_GPIO=y
95# CONFIG_INPUT_MOUSE is not set 90# CONFIG_INPUT_MOUSE is not set
96# CONFIG_SERIO is not set 91# CONFIG_SERIO is not set
97# CONFIG_VT is not set 92# CONFIG_VT is not set
93CONFIG_LEGACY_PTY_COUNT=16
98CONFIG_SERIAL_8250=y 94CONFIG_SERIAL_8250=y
99CONFIG_SERIAL_8250_CONSOLE=y 95CONFIG_SERIAL_8250_CONSOLE=y
100# CONFIG_SERIAL_8250_PCI is not set 96# CONFIG_SERIAL_8250_PCI is not set
101CONFIG_SERIAL_8250_RUNTIME_UARTS=2 97CONFIG_SERIAL_8250_RUNTIME_UARTS=2
102CONFIG_LEGACY_PTY_COUNT=16 98CONFIG_SERIAL_OF_PLATFORM=y
103CONFIG_HW_RANDOM_TIMERIOMEM=m 99CONFIG_HW_RANDOM_TIMERIOMEM=m
104CONFIG_I2C=y 100CONFIG_I2C=y
105# CONFIG_I2C_COMPAT is not set 101# CONFIG_I2C_COMPAT is not set
@@ -109,10 +105,8 @@ CONFIG_GPIO_SYSFS=y
109CONFIG_SENSORS_LM75=y 105CONFIG_SENSORS_LM75=y
110# CONFIG_VGA_ARB is not set 106# CONFIG_VGA_ARB is not set
111CONFIG_USB=y 107CONFIG_USB=y
112CONFIG_USB_DEVICEFS=y
113CONFIG_USB_EHCI_HCD=y 108CONFIG_USB_EHCI_HCD=y
114CONFIG_USB_EHCI_ROOT_HUB_TT=y 109CONFIG_USB_EHCI_ROOT_HUB_TT=y
115CONFIG_USB_EHCI_TT_NEWSCHED=y
116CONFIG_USB_PRINTER=y 110CONFIG_USB_PRINTER=y
117CONFIG_USB_STORAGE=y 111CONFIG_USB_STORAGE=y
118CONFIG_USB_STORAGE_DATAFAB=y 112CONFIG_USB_STORAGE_DATAFAB=y
@@ -140,7 +134,6 @@ CONFIG_EXT2_FS=y
140CONFIG_EXT3_FS=y 134CONFIG_EXT3_FS=y
141# CONFIG_EXT3_FS_XATTR is not set 135# CONFIG_EXT3_FS_XATTR is not set
142CONFIG_EXT4_FS=m 136CONFIG_EXT4_FS=m
143CONFIG_INOTIFY=y
144CONFIG_ISO9660_FS=m 137CONFIG_ISO9660_FS=m
145CONFIG_JOLIET=y 138CONFIG_JOLIET=y
146CONFIG_UDF_FS=m 139CONFIG_UDF_FS=m
@@ -150,25 +143,18 @@ CONFIG_TMPFS=y
150CONFIG_JFFS2_FS=y 143CONFIG_JFFS2_FS=y
151CONFIG_CRAMFS=y 144CONFIG_CRAMFS=y
152CONFIG_NFS_FS=y 145CONFIG_NFS_FS=y
153CONFIG_NFS_V3=y
154CONFIG_ROOT_NFS=y 146CONFIG_ROOT_NFS=y
155CONFIG_PARTITION_ADVANCED=y
156CONFIG_BSD_DISKLABEL=y
157CONFIG_NLS_CODEPAGE_437=y 147CONFIG_NLS_CODEPAGE_437=y
158CONFIG_NLS_CODEPAGE_850=y 148CONFIG_NLS_CODEPAGE_850=y
159CONFIG_NLS_ISO8859_1=y 149CONFIG_NLS_ISO8859_1=y
160CONFIG_NLS_ISO8859_2=y 150CONFIG_NLS_ISO8859_2=y
161CONFIG_MAGIC_SYSRQ=y 151CONFIG_MAGIC_SYSRQ=y
162CONFIG_DEBUG_FS=y 152CONFIG_DEBUG_FS=y
163CONFIG_DEBUG_KERNEL=y
164# CONFIG_DEBUG_BUGVERBOSE is not set 153# CONFIG_DEBUG_BUGVERBOSE is not set
165CONFIG_DEBUG_INFO=y 154CONFIG_DEBUG_INFO=y
166# CONFIG_RCU_CPU_STALL_DETECTOR is not set
167CONFIG_LATENCYTOP=y 155CONFIG_LATENCYTOP=y
168CONFIG_SYSCTL_SYSCALL_CHECK=y
169# CONFIG_FTRACE is not set 156# CONFIG_FTRACE is not set
170CONFIG_DEBUG_USER=y 157CONFIG_DEBUG_USER=y
171CONFIG_DEBUG_ERRORS=y
172CONFIG_DEBUG_LL=y 158CONFIG_DEBUG_LL=y
173CONFIG_CRYPTO_CBC=m 159CONFIG_CRYPTO_CBC=m
174CONFIG_CRYPTO_ECB=m 160CONFIG_CRYPTO_ECB=m
diff --git a/arch/arm/configs/prima2_defconfig b/arch/arm/configs/prima2_defconfig
index 807d4e2acb1..6a936c7c078 100644
--- a/arch/arm/configs/prima2_defconfig
+++ b/arch/arm/configs/prima2_defconfig
@@ -37,7 +37,6 @@ CONFIG_SPI_SIRF=y
37CONFIG_SPI_SPIDEV=y 37CONFIG_SPI_SPIDEV=y
38# CONFIG_HWMON is not set 38# CONFIG_HWMON is not set
39CONFIG_USB_GADGET=y 39CONFIG_USB_GADGET=y
40CONFIG_USB_FILE_STORAGE=m
41CONFIG_USB_MASS_STORAGE=m 40CONFIG_USB_MASS_STORAGE=m
42CONFIG_MMC=y 41CONFIG_MMC=y
43CONFIG_MMC_SDHCI=y 42CONFIG_MMC_SDHCI=y
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig
deleted file mode 100644
index 42d5db1876a..00000000000
--- a/arch/arm/configs/qil-a9260_defconfig
+++ /dev/null
@@ -1,114 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9260=y
15CONFIG_MACH_QIL_A9260=y
16CONFIG_AT91_SLOW_CLOCK=y
17CONFIG_AT91_EARLY_USART0=y
18# CONFIG_ARM_THUMB is not set
19CONFIG_AEABI=y
20CONFIG_ZBOOT_ROM_TEXT=0x0
21CONFIG_ZBOOT_ROM_BSS=0x0
22CONFIG_CMDLINE="mem=64M console=ttyS1,115200"
23CONFIG_FPE_NWFPE=y
24CONFIG_PM=y
25CONFIG_NET=y
26CONFIG_PACKET=y
27CONFIG_UNIX=y
28CONFIG_INET=y
29CONFIG_IP_MULTICAST=y
30CONFIG_IP_ADVANCED_ROUTER=y
31CONFIG_IP_ROUTE_VERBOSE=y
32CONFIG_IP_PNP=y
33CONFIG_IP_PNP_BOOTP=y
34CONFIG_IP_PNP_RARP=y
35CONFIG_IP_MROUTE=y
36CONFIG_IP_PIMSM_V1=y
37CONFIG_IP_PIMSM_V2=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
44CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
45CONFIG_MTD=y
46CONFIG_MTD_PARTITIONS=y
47CONFIG_MTD_CMDLINE_PARTS=y
48CONFIG_MTD_CHAR=y
49CONFIG_MTD_BLOCK=y
50CONFIG_MTD_DATAFLASH=y
51CONFIG_MTD_NAND=y
52CONFIG_MTD_NAND_ATMEL=y
53CONFIG_BLK_DEV_LOOP=y
54# CONFIG_MISC_DEVICES is not set
55CONFIG_SCSI=y
56CONFIG_BLK_DEV_SD=y
57CONFIG_SCSI_MULTI_LUN=y
58CONFIG_NETDEVICES=y
59CONFIG_NET_ETHERNET=y
60CONFIG_MII=y
61CONFIG_MACB=y
62# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
63CONFIG_INPUT_EVDEV=y
64CONFIG_INPUT_EVBUG=y
65# CONFIG_KEYBOARD_ATKBD is not set
66CONFIG_KEYBOARD_GPIO=y
67# CONFIG_INPUT_MOUSE is not set
68# CONFIG_SERIO is not set
69CONFIG_SERIAL_ATMEL=y
70CONFIG_SERIAL_ATMEL_CONSOLE=y
71CONFIG_HW_RANDOM=y
72CONFIG_I2C=y
73CONFIG_I2C_CHARDEV=y
74CONFIG_SPI=y
75CONFIG_SPI_ATMEL=y
76# CONFIG_HWMON is not set
77CONFIG_WATCHDOG=y
78CONFIG_WATCHDOG_NOWAYOUT=y
79# CONFIG_VGA_CONSOLE is not set
80# CONFIG_USB_HID is not set
81CONFIG_USB=y
82CONFIG_USB_DEVICEFS=y
83CONFIG_USB_MON=y
84CONFIG_USB_OHCI_HCD=y
85CONFIG_USB_STORAGE=y
86CONFIG_USB_GADGET=y
87CONFIG_USB_ETH=m
88CONFIG_MMC=y
89CONFIG_MMC_ATMELMCI=m
90CONFIG_NEW_LEDS=y
91CONFIG_LEDS_CLASS=y
92CONFIG_LEDS_GPIO=y
93CONFIG_LEDS_TRIGGERS=y
94CONFIG_LEDS_TRIGGER_HEARTBEAT=y
95CONFIG_RTC_CLASS=y
96CONFIG_RTC_DRV_M41T94=y
97CONFIG_EXT2_FS=y
98CONFIG_INOTIFY=y
99CONFIG_FUSE_FS=m
100CONFIG_VFAT_FS=y
101CONFIG_TMPFS=y
102CONFIG_JFFS2_FS=y
103CONFIG_NFS_FS=y
104CONFIG_NFS_V3=y
105CONFIG_NFS_V3_ACL=y
106CONFIG_NFS_V4=y
107CONFIG_ROOT_NFS=y
108CONFIG_NLS_CODEPAGE_437=y
109CONFIG_NLS_CODEPAGE_850=y
110CONFIG_NLS_ISO8859_1=y
111CONFIG_DEBUG_KERNEL=y
112CONFIG_DEBUG_USER=y
113CONFIG_DEBUG_LL=y
114# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/configs/sam9_l9260_defconfig b/arch/arm/configs/sam9_l9260_defconfig
deleted file mode 100644
index b4384af1bea..00000000000
--- a/arch/arm/configs/sam9_l9260_defconfig
+++ /dev/null
@@ -1,148 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_BSD_PROCESS_ACCT_V3=y
7CONFIG_AUDIT=y
8CONFIG_LOG_BUF_SHIFT=15
9CONFIG_BLK_DEV_INITRD=y
10CONFIG_SLAB=y
11# CONFIG_BLK_DEV_BSG is not set
12CONFIG_ARCH_AT91=y
13CONFIG_ARCH_AT91SAM9260=y
14CONFIG_MACH_SAM9_L9260=y
15CONFIG_MTD_AT91_DATAFLASH_CARD=y
16CONFIG_PREEMPT=y
17CONFIG_LEDS=y
18CONFIG_LEDS_CPU=y
19CONFIG_ZBOOT_ROM_TEXT=0x0
20CONFIG_ZBOOT_ROM_BSS=0x0
21CONFIG_CMDLINE="console=ttyS0,115200 mem=64M initrd=0x21100000,4194304 root=/dev/ram0 rw"
22CONFIG_FPE_NWFPE=y
23CONFIG_NET=y
24CONFIG_PACKET=y
25CONFIG_UNIX=y
26CONFIG_XFRM_USER=y
27CONFIG_NET_KEY=y
28CONFIG_INET=y
29# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
30# CONFIG_INET_XFRM_MODE_TUNNEL is not set
31# CONFIG_INET_XFRM_MODE_BEET is not set
32# CONFIG_IPV6 is not set
33CONFIG_MTD=y
34CONFIG_MTD_PARTITIONS=y
35CONFIG_MTD_CHAR=y
36CONFIG_MTD_BLOCK=y
37CONFIG_MTD_BLOCK2MTD=y
38CONFIG_MTD_NAND=y
39CONFIG_MTD_NAND_ATMEL=y
40CONFIG_MTD_NAND_PLATFORM=y
41CONFIG_MTD_UBI=y
42CONFIG_MTD_UBI_BEB_LIMIT=25
43CONFIG_MTD_UBI_GLUEBI=y
44CONFIG_BLK_DEV_LOOP=y
45CONFIG_BLK_DEV_RAM=y
46CONFIG_BLK_DEV_RAM_SIZE=8192
47# CONFIG_MISC_DEVICES is not set
48CONFIG_RAID_ATTRS=y
49CONFIG_SCSI=y
50CONFIG_BLK_DEV_SD=y
51CONFIG_CHR_DEV_SG=y
52CONFIG_SCSI_MULTI_LUN=y
53CONFIG_SCSI_CONSTANTS=y
54CONFIG_SCSI_LOGGING=y
55# CONFIG_SCSI_LOWLEVEL is not set
56CONFIG_NETDEVICES=y
57CONFIG_NET_ETHERNET=y
58CONFIG_MII=y
59CONFIG_MACB=y
60# CONFIG_NETDEV_1000 is not set
61# CONFIG_NETDEV_10000 is not set
62# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
63# CONFIG_INPUT_KEYBOARD is not set
64# CONFIG_INPUT_MOUSE is not set
65# CONFIG_SERIO is not set
66CONFIG_SERIAL_ATMEL=y
67CONFIG_SERIAL_ATMEL_CONSOLE=y
68CONFIG_LEGACY_PTY_COUNT=16
69# CONFIG_HW_RANDOM is not set
70# CONFIG_HWMON is not set
71# CONFIG_VGA_CONSOLE is not set
72# CONFIG_HID_SUPPORT is not set
73CONFIG_USB=y
74CONFIG_USB_DEVICEFS=y
75CONFIG_USB_OHCI_HCD=y
76CONFIG_USB_STORAGE=y
77CONFIG_USB_LIBUSUAL=y
78CONFIG_USB_GADGET=y
79CONFIG_MMC=y
80CONFIG_MMC_DEBUG=y
81CONFIG_NEW_LEDS=y
82CONFIG_LEDS_CLASS=y
83CONFIG_LEDS_GPIO=y
84CONFIG_LEDS_TRIGGERS=y
85CONFIG_LEDS_TRIGGER_TIMER=y
86CONFIG_LEDS_TRIGGER_HEARTBEAT=y
87CONFIG_RTC_CLASS=y
88CONFIG_RTC_DRV_DS1553=y
89CONFIG_RTC_DRV_DS1742=y
90CONFIG_RTC_DRV_M48T86=y
91CONFIG_RTC_DRV_V3020=y
92CONFIG_EXT2_FS=y
93CONFIG_EXT2_FS_XATTR=y
94CONFIG_EXT2_FS_POSIX_ACL=y
95CONFIG_EXT2_FS_SECURITY=y
96CONFIG_EXT3_FS=y
97CONFIG_EXT3_FS_POSIX_ACL=y
98CONFIG_EXT3_FS_SECURITY=y
99CONFIG_INOTIFY=y
100CONFIG_MSDOS_FS=y
101CONFIG_VFAT_FS=y
102CONFIG_TMPFS=y
103CONFIG_JFFS2_FS=y
104CONFIG_NFS_FS=y
105CONFIG_NFS_V3=y
106CONFIG_NLS_CODEPAGE_437=y
107CONFIG_NLS_CODEPAGE_737=y
108CONFIG_NLS_CODEPAGE_775=y
109CONFIG_NLS_CODEPAGE_850=y
110CONFIG_NLS_CODEPAGE_852=y
111CONFIG_NLS_CODEPAGE_855=y
112CONFIG_NLS_CODEPAGE_857=y
113CONFIG_NLS_CODEPAGE_860=y
114CONFIG_NLS_CODEPAGE_861=y
115CONFIG_NLS_CODEPAGE_862=y
116CONFIG_NLS_CODEPAGE_863=y
117CONFIG_NLS_CODEPAGE_864=y
118CONFIG_NLS_CODEPAGE_865=y
119CONFIG_NLS_CODEPAGE_866=y
120CONFIG_NLS_CODEPAGE_869=y
121CONFIG_NLS_CODEPAGE_936=y
122CONFIG_NLS_CODEPAGE_950=y
123CONFIG_NLS_CODEPAGE_932=y
124CONFIG_NLS_CODEPAGE_949=y
125CONFIG_NLS_CODEPAGE_874=y
126CONFIG_NLS_ISO8859_8=y
127CONFIG_NLS_CODEPAGE_1250=y
128CONFIG_NLS_CODEPAGE_1251=y
129CONFIG_NLS_ASCII=y
130CONFIG_NLS_ISO8859_1=y
131CONFIG_NLS_ISO8859_2=y
132CONFIG_NLS_ISO8859_3=y
133CONFIG_NLS_ISO8859_4=y
134CONFIG_NLS_ISO8859_5=y
135CONFIG_NLS_ISO8859_6=y
136CONFIG_NLS_ISO8859_7=y
137CONFIG_NLS_ISO8859_9=y
138CONFIG_NLS_ISO8859_13=y
139CONFIG_NLS_ISO8859_14=y
140CONFIG_NLS_ISO8859_15=y
141CONFIG_NLS_KOI8_R=y
142CONFIG_NLS_KOI8_U=y
143CONFIG_NLS_UTF8=y
144CONFIG_MAGIC_SYSRQ=y
145CONFIG_UNUSED_SYMBOLS=y
146CONFIG_DEBUG_FS=y
147CONFIG_DEBUG_KERNEL=y
148CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index df77931a432..2e0419d1b96 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_defconfig
@@ -214,7 +214,7 @@ CONFIG_USB_GADGET_DUMMY_HCD=y
214CONFIG_USB_ZERO=m 214CONFIG_USB_ZERO=m
215CONFIG_USB_ETH=m 215CONFIG_USB_ETH=m
216CONFIG_USB_GADGETFS=m 216CONFIG_USB_GADGETFS=m
217CONFIG_USB_FILE_STORAGE=m 217CONFIG_USB_MASS_STORAGE=m
218CONFIG_USB_G_SERIAL=m 218CONFIG_USB_G_SERIAL=m
219CONFIG_MMC=y 219CONFIG_MMC=y
220CONFIG_MMC_PXA=y 220CONFIG_MMC_PXA=y
diff --git a/arch/arm/configs/stamp9g20_defconfig b/arch/arm/configs/stamp9g20_defconfig
deleted file mode 100644
index 52f1488591c..00000000000
--- a/arch/arm/configs/stamp9g20_defconfig
+++ /dev/null
@@ -1,128 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_TREE_PREEMPT_RCU=y
6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y
8CONFIG_SLAB=y
9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y
11# CONFIG_LBDAF is not set
12# CONFIG_BLK_DEV_BSG is not set
13# CONFIG_IOSCHED_DEADLINE is not set
14CONFIG_ARCH_AT91=y
15CONFIG_ARCH_AT91SAM9G20=y
16CONFIG_MACH_PORTUXG20=y
17CONFIG_MACH_STAMP9G20=y
18CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
19CONFIG_AT91_SLOW_CLOCK=y
20CONFIG_NO_HZ=y
21CONFIG_HIGH_RES_TIMERS=y
22CONFIG_PREEMPT=y
23CONFIG_AEABI=y
24# CONFIG_OABI_COMPAT is not set
25CONFIG_ZBOOT_ROM_TEXT=0x0
26CONFIG_ZBOOT_ROM_BSS=0x0
27CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
28CONFIG_KEXEC=y
29CONFIG_CPU_IDLE=y
30CONFIG_PM=y
31CONFIG_NET=y
32CONFIG_PACKET=y
33CONFIG_UNIX=y
34CONFIG_INET=y
35# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
36# CONFIG_INET_XFRM_MODE_TUNNEL is not set
37# CONFIG_INET_XFRM_MODE_BEET is not set
38# CONFIG_INET_LRO is not set
39# CONFIG_IPV6 is not set
40# CONFIG_WIRELESS is not set
41CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
42CONFIG_MTD=y
43CONFIG_MTD_CONCAT=y
44CONFIG_MTD_PARTITIONS=y
45CONFIG_MTD_CMDLINE_PARTS=y
46CONFIG_MTD_CHAR=y
47CONFIG_MTD_BLOCK=y
48CONFIG_MTD_DATAFLASH=y
49CONFIG_MTD_NAND=y
50CONFIG_MTD_NAND_ATMEL=y
51CONFIG_BLK_DEV_LOOP=y
52CONFIG_BLK_DEV_RAM=y
53CONFIG_BLK_DEV_RAM_SIZE=8192
54# CONFIG_MISC_DEVICES is not set
55CONFIG_SCSI=y
56CONFIG_BLK_DEV_SD=y
57CONFIG_SCSI_MULTI_LUN=y
58# CONFIG_SCSI_LOWLEVEL is not set
59CONFIG_NETDEVICES=y
60CONFIG_NET_ETHERNET=y
61CONFIG_MACB=y
62# CONFIG_NETDEV_1000 is not set
63# CONFIG_NETDEV_10000 is not set
64# CONFIG_WLAN is not set
65# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
66CONFIG_INPUT_MOUSEDEV_SCREEN_X=320
67CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240
68# CONFIG_INPUT_KEYBOARD is not set
69# CONFIG_INPUT_MOUSE is not set
70# CONFIG_SERIO is not set
71CONFIG_SERIAL_ATMEL=y
72CONFIG_SERIAL_ATMEL_CONSOLE=y
73# CONFIG_LEGACY_PTYS is not set
74# CONFIG_HW_RANDOM is not set
75CONFIG_I2C=y
76CONFIG_I2C_CHARDEV=y
77CONFIG_I2C_GPIO=y
78CONFIG_SPI=y
79CONFIG_SPI_ATMEL=y
80CONFIG_SPI_SPIDEV=y
81CONFIG_GPIO_SYSFS=y
82CONFIG_W1=y
83CONFIG_W1_MASTER_GPIO=y
84CONFIG_W1_SLAVE_THERM=y
85CONFIG_W1_SLAVE_DS2431=y
86# CONFIG_HWMON is not set
87CONFIG_WATCHDOG=y
88CONFIG_AT91SAM9X_WATCHDOG=y
89# CONFIG_VGA_CONSOLE is not set
90# CONFIG_HID_SUPPORT is not set
91CONFIG_USB=y
92CONFIG_USB_DEVICEFS=y
93# CONFIG_USB_DEVICE_CLASS is not set
94CONFIG_USB_MON=y
95CONFIG_USB_OHCI_HCD=y
96CONFIG_USB_STORAGE=y
97CONFIG_USB_GADGET=m
98CONFIG_USB_ZERO=m
99CONFIG_USB_ETH=m
100CONFIG_USB_FILE_STORAGE=m
101CONFIG_USB_G_SERIAL=m
102CONFIG_MMC=y
103CONFIG_MMC_ATMELMCI=y
104CONFIG_NEW_LEDS=y
105CONFIG_LEDS_CLASS=y
106CONFIG_LEDS_GPIO=y
107CONFIG_LEDS_TRIGGERS=y
108CONFIG_LEDS_TRIGGER_TIMER=y
109CONFIG_LEDS_TRIGGER_HEARTBEAT=y
110CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
111CONFIG_RTC_CLASS=y
112CONFIG_RTC_DRV_AT91SAM9=y
113CONFIG_EXT2_FS=y
114CONFIG_EXT3_FS=y
115CONFIG_INOTIFY=y
116CONFIG_VFAT_FS=y
117CONFIG_TMPFS=y
118CONFIG_JFFS2_FS=y
119CONFIG_JFFS2_SUMMARY=y
120CONFIG_NFS_FS=y
121CONFIG_NFS_V3=y
122CONFIG_NLS_CODEPAGE_437=y
123CONFIG_NLS_CODEPAGE_850=y
124CONFIG_NLS_ISO8859_1=y
125CONFIG_NLS_ISO8859_15=y
126CONFIG_NLS_UTF8=y
127# CONFIG_RCU_CPU_STALL_DETECTOR is not set
128# CONFIG_ARM_UNWIND is not set
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index e2184f6c20b..a7827fd0616 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -80,6 +80,10 @@ CONFIG_RFKILL_GPIO=y
80CONFIG_DEVTMPFS=y 80CONFIG_DEVTMPFS=y
81CONFIG_DEVTMPFS_MOUNT=y 81CONFIG_DEVTMPFS_MOUNT=y
82# CONFIG_FIRMWARE_IN_KERNEL is not set 82# CONFIG_FIRMWARE_IN_KERNEL is not set
83CONFIG_CMA=y
84CONFIG_MTD=y
85CONFIG_MTD_CHAR=y
86CONFIG_MTD_M25P80=y
83CONFIG_PROC_DEVICETREE=y 87CONFIG_PROC_DEVICETREE=y
84CONFIG_BLK_DEV_LOOP=y 88CONFIG_BLK_DEV_LOOP=y
85CONFIG_AD525X_DPOT=y 89CONFIG_AD525X_DPOT=y
@@ -98,12 +102,12 @@ CONFIG_USB_PEGASUS=y
98CONFIG_USB_USBNET=y 102CONFIG_USB_USBNET=y
99CONFIG_USB_NET_SMSC75XX=y 103CONFIG_USB_NET_SMSC75XX=y
100CONFIG_USB_NET_SMSC95XX=y 104CONFIG_USB_NET_SMSC95XX=y
105CONFIG_BRCMFMAC=m
101CONFIG_RT2X00=y 106CONFIG_RT2X00=y
102CONFIG_RT2800USB=m 107CONFIG_RT2800USB=m
103CONFIG_INPUT_EVDEV=y 108CONFIG_INPUT_EVDEV=y
104CONFIG_INPUT_MISC=y 109CONFIG_INPUT_MISC=y
105CONFIG_INPUT_MPU3050=y 110CONFIG_INPUT_MPU3050=y
106# CONFIG_VT is not set
107# CONFIG_LEGACY_PTYS is not set 111# CONFIG_LEGACY_PTYS is not set
108# CONFIG_DEVKMEM is not set 112# CONFIG_DEVKMEM is not set
109CONFIG_SERIAL_8250=y 113CONFIG_SERIAL_8250=y
@@ -116,7 +120,8 @@ CONFIG_I2C_MUX=y
116CONFIG_I2C_MUX_PINCTRL=y 120CONFIG_I2C_MUX_PINCTRL=y
117CONFIG_I2C_TEGRA=y 121CONFIG_I2C_TEGRA=y
118CONFIG_SPI=y 122CONFIG_SPI=y
119CONFIG_SPI_TEGRA=y 123CONFIG_SPI_TEGRA20_SFLASH=y
124CONFIG_SPI_TEGRA20_SLINK=y
120CONFIG_GPIO_PCA953X_IRQ=y 125CONFIG_GPIO_PCA953X_IRQ=y
121CONFIG_GPIO_TPS6586X=y 126CONFIG_GPIO_TPS6586X=y
122CONFIG_GPIO_TPS65910=y 127CONFIG_GPIO_TPS65910=y
@@ -138,6 +143,15 @@ CONFIG_MEDIA_SUPPORT=y
138CONFIG_MEDIA_CAMERA_SUPPORT=y 143CONFIG_MEDIA_CAMERA_SUPPORT=y
139CONFIG_MEDIA_USB_SUPPORT=y 144CONFIG_MEDIA_USB_SUPPORT=y
140CONFIG_USB_VIDEO_CLASS=m 145CONFIG_USB_VIDEO_CLASS=m
146CONFIG_DRM=y
147CONFIG_DRM_TEGRA=y
148CONFIG_BACKLIGHT_LCD_SUPPORT=y
149# CONFIG_LCD_CLASS_DEVICE is not set
150CONFIG_BACKLIGHT_CLASS_DEVICE=y
151# CONFIG_BACKLIGHT_GENERIC is not set
152CONFIG_BACKLIGHT_PWM=y
153CONFIG_FRAMEBUFFER_CONSOLE=y
154CONFIG_LOGO=y
141CONFIG_SOUND=y 155CONFIG_SOUND=y
142CONFIG_SND=y 156CONFIG_SND=y
143# CONFIG_SND_SUPPORT_OLD_API is not set 157# CONFIG_SND_SUPPORT_OLD_API is not set
@@ -205,6 +219,9 @@ CONFIG_EXT4_FS=y
205CONFIG_VFAT_FS=y 219CONFIG_VFAT_FS=y
206CONFIG_TMPFS=y 220CONFIG_TMPFS=y
207CONFIG_TMPFS_POSIX_ACL=y 221CONFIG_TMPFS_POSIX_ACL=y
222CONFIG_SQUASHFS=y
223CONFIG_SQUASHFS_LZO=y
224CONFIG_SQUASHFS_XZ=y
208CONFIG_NFS_FS=y 225CONFIG_NFS_FS=y
209CONFIG_ROOT_NFS=y 226CONFIG_ROOT_NFS=y
210CONFIG_NLS_CODEPAGE_437=y 227CONFIG_NLS_CODEPAGE_437=y
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index da6845493ca..231dca60473 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -69,6 +69,8 @@ CONFIG_GPIO_TC3589X=y
69CONFIG_POWER_SUPPLY=y 69CONFIG_POWER_SUPPLY=y
70CONFIG_AB8500_BM=y 70CONFIG_AB8500_BM=y
71CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y 71CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y
72CONFIG_THERMAL=y
73CONFIG_CPU_THERMAL=y
72CONFIG_MFD_STMPE=y 74CONFIG_MFD_STMPE=y
73CONFIG_MFD_TC3589X=y 75CONFIG_MFD_TC3589X=y
74CONFIG_AB5500_CORE=y 76CONFIG_AB5500_CORE=y
@@ -76,6 +78,7 @@ CONFIG_AB8500_CORE=y
76CONFIG_REGULATOR=y 78CONFIG_REGULATOR=y
77CONFIG_REGULATOR_AB8500=y 79CONFIG_REGULATOR_AB8500=y
78CONFIG_REGULATOR_FIXED_VOLTAGE=y 80CONFIG_REGULATOR_FIXED_VOLTAGE=y
81CONFIG_REGULATOR_GPIO=y
79# CONFIG_HID_SUPPORT is not set 82# CONFIG_HID_SUPPORT is not set
80CONFIG_USB_GADGET=y 83CONFIG_USB_GADGET=y
81CONFIG_AB8500_USB=y 84CONFIG_AB8500_USB=y
diff --git a/arch/arm/configs/usb-a9260_defconfig b/arch/arm/configs/usb-a9260_defconfig
deleted file mode 100644
index a1501e1e1a9..00000000000
--- a/arch/arm/configs/usb-a9260_defconfig
+++ /dev/null
@@ -1,105 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9260=y
15CONFIG_MACH_USB_A9260=y
16CONFIG_AT91_SLOW_CLOCK=y
17# CONFIG_ARM_THUMB is not set
18CONFIG_AEABI=y
19CONFIG_ZBOOT_ROM_TEXT=0x0
20CONFIG_ZBOOT_ROM_BSS=0x0
21CONFIG_CMDLINE="mem=64M console=ttyS0,115200"
22CONFIG_FPE_NWFPE=y
23CONFIG_PM=y
24CONFIG_NET=y
25CONFIG_PACKET=y
26CONFIG_UNIX=y
27CONFIG_INET=y
28CONFIG_IP_MULTICAST=y
29CONFIG_IP_ADVANCED_ROUTER=y
30CONFIG_IP_ROUTE_VERBOSE=y
31CONFIG_IP_PNP=y
32CONFIG_IP_PNP_BOOTP=y
33CONFIG_IP_PNP_RARP=y
34CONFIG_IP_MROUTE=y
35CONFIG_IP_PIMSM_V1=y
36CONFIG_IP_PIMSM_V2=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
43CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
44CONFIG_MTD=y
45CONFIG_MTD_PARTITIONS=y
46CONFIG_MTD_CMDLINE_PARTS=y
47CONFIG_MTD_CHAR=y
48CONFIG_MTD_BLOCK=y
49CONFIG_MTD_DATAFLASH=y
50CONFIG_MTD_NAND=y
51CONFIG_MTD_NAND_ATMEL=y
52CONFIG_BLK_DEV_LOOP=y
53# CONFIG_MISC_DEVICES is not set
54CONFIG_SCSI=y
55CONFIG_BLK_DEV_SD=y
56CONFIG_SCSI_MULTI_LUN=y
57CONFIG_NETDEVICES=y
58CONFIG_NET_ETHERNET=y
59CONFIG_MII=y
60CONFIG_MACB=y
61# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
62CONFIG_INPUT_EVDEV=y
63CONFIG_INPUT_EVBUG=y
64# CONFIG_KEYBOARD_ATKBD is not set
65CONFIG_KEYBOARD_GPIO=y
66# CONFIG_INPUT_MOUSE is not set
67# CONFIG_SERIO is not set
68CONFIG_SERIAL_ATMEL=y
69CONFIG_SERIAL_ATMEL_CONSOLE=y
70CONFIG_HW_RANDOM=y
71CONFIG_SPI=y
72CONFIG_SPI_ATMEL=y
73# CONFIG_HWMON is not set
74# CONFIG_VGA_CONSOLE is not set
75# CONFIG_USB_HID is not set
76CONFIG_USB=y
77CONFIG_USB_DEVICEFS=y
78CONFIG_USB_MON=y
79CONFIG_USB_OHCI_HCD=y
80CONFIG_USB_STORAGE=y
81CONFIG_USB_GADGET=y
82CONFIG_USB_ETH=m
83CONFIG_NEW_LEDS=y
84CONFIG_LEDS_CLASS=y
85CONFIG_LEDS_GPIO=y
86CONFIG_LEDS_TRIGGERS=y
87CONFIG_LEDS_TRIGGER_HEARTBEAT=y
88CONFIG_EXT2_FS=y
89CONFIG_INOTIFY=y
90CONFIG_FUSE_FS=m
91CONFIG_VFAT_FS=y
92CONFIG_TMPFS=y
93CONFIG_JFFS2_FS=y
94CONFIG_NFS_FS=y
95CONFIG_NFS_V3=y
96CONFIG_NFS_V3_ACL=y
97CONFIG_NFS_V4=y
98CONFIG_ROOT_NFS=y
99CONFIG_NLS_CODEPAGE_437=y
100CONFIG_NLS_CODEPAGE_850=y
101CONFIG_NLS_ISO8859_1=y
102CONFIG_DEBUG_KERNEL=y
103CONFIG_DEBUG_USER=y
104CONFIG_DEBUG_LL=y
105# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/configs/viper_defconfig b/arch/arm/configs/viper_defconfig
index 1d01ddd3312..d36e0d3c86e 100644
--- a/arch/arm/configs/viper_defconfig
+++ b/arch/arm/configs/viper_defconfig
@@ -139,7 +139,7 @@ CONFIG_USB_SERIAL_MCT_U232=m
139CONFIG_USB_GADGET=m 139CONFIG_USB_GADGET=m
140CONFIG_USB_ETH=m 140CONFIG_USB_ETH=m
141CONFIG_USB_GADGETFS=m 141CONFIG_USB_GADGETFS=m
142CONFIG_USB_FILE_STORAGE=m 142CONFIG_USB_MASS_STORAGE=m
143CONFIG_USB_G_SERIAL=m 143CONFIG_USB_G_SERIAL=m
144CONFIG_USB_G_PRINTER=m 144CONFIG_USB_G_PRINTER=m
145CONFIG_RTC_CLASS=y 145CONFIG_RTC_CLASS=y
diff --git a/arch/arm/configs/zeus_defconfig b/arch/arm/configs/zeus_defconfig
index 547a3c1e59d..731d4f98531 100644
--- a/arch/arm/configs/zeus_defconfig
+++ b/arch/arm/configs/zeus_defconfig
@@ -143,7 +143,7 @@ CONFIG_USB_GADGET=m
143CONFIG_USB_PXA27X=y 143CONFIG_USB_PXA27X=y
144CONFIG_USB_ETH=m 144CONFIG_USB_ETH=m
145CONFIG_USB_GADGETFS=m 145CONFIG_USB_GADGETFS=m
146CONFIG_USB_FILE_STORAGE=m 146CONFIG_USB_MASS_STORAGE=m
147CONFIG_USB_G_SERIAL=m 147CONFIG_USB_G_SERIAL=m
148CONFIG_USB_G_PRINTER=m 148CONFIG_USB_G_PRINTER=m
149CONFIG_MMC=y 149CONFIG_MMC=y
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index f70ae175a3d..d3db39860b9 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -16,7 +16,6 @@ generic-y += local64.h
16generic-y += msgbuf.h 16generic-y += msgbuf.h
17generic-y += param.h 17generic-y += param.h
18generic-y += parport.h 18generic-y += parport.h
19generic-y += percpu.h
20generic-y += poll.h 19generic-y += poll.h
21generic-y += resource.h 20generic-y += resource.h
22generic-y += sections.h 21generic-y += sections.h
@@ -31,5 +30,6 @@ generic-y += sockios.h
31generic-y += termbits.h 30generic-y += termbits.h
32generic-y += termios.h 31generic-y += termios.h
33generic-y += timex.h 32generic-y += timex.h
33generic-y += trace_clock.h
34generic-y += types.h 34generic-y += types.h
35generic-y += unaligned.h 35generic-y += unaligned.h
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 2ef95813fce..eb87200aa4b 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -250,6 +250,7 @@
250 * Beware, it also clobers LR. 250 * Beware, it also clobers LR.
251 */ 251 */
252.macro safe_svcmode_maskall reg:req 252.macro safe_svcmode_maskall reg:req
253#if __LINUX_ARM_ARCH__ >= 6
253 mrs \reg , cpsr 254 mrs \reg , cpsr
254 mov lr , \reg 255 mov lr , \reg
255 and lr , lr , #MODE_MASK 256 and lr , lr , #MODE_MASK
@@ -266,6 +267,13 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
266 __ERET 267 __ERET
2671: msr cpsr_c, \reg 2681: msr cpsr_c, \reg
2682: 2692:
270#else
271/*
272 * workaround for possibly broken pre-v6 hardware
273 * (akita, Sharp Zaurus C-1000, PXA270-based)
274 */
275 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, \reg
276#endif
269.endm 277.endm
270 278
271/* 279/*
diff --git a/arch/arm/include/asm/cpu.h b/arch/arm/include/asm/cpu.h
index d797223b39d..2744f060255 100644
--- a/arch/arm/include/asm/cpu.h
+++ b/arch/arm/include/asm/cpu.h
@@ -15,6 +15,7 @@
15 15
16struct cpuinfo_arm { 16struct cpuinfo_arm {
17 struct cpu cpu; 17 struct cpu cpu;
18 u32 cpuid;
18#ifdef CONFIG_SMP 19#ifdef CONFIG_SMP
19 unsigned int loops_per_jiffy; 20 unsigned int loops_per_jiffy;
20#endif 21#endif
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index cb47d28cbe1..a59dcb5ab5f 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -25,6 +25,19 @@
25#define CPUID_EXT_ISAR4 "c2, 4" 25#define CPUID_EXT_ISAR4 "c2, 4"
26#define CPUID_EXT_ISAR5 "c2, 5" 26#define CPUID_EXT_ISAR5 "c2, 5"
27 27
28#define MPIDR_SMP_BITMASK (0x3 << 30)
29#define MPIDR_SMP_VALUE (0x2 << 30)
30
31#define MPIDR_MT_BITMASK (0x1 << 24)
32
33#define MPIDR_HWID_BITMASK 0xFFFFFF
34
35#define MPIDR_LEVEL_BITS 8
36#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1)
37
38#define MPIDR_AFFINITY_LEVEL(mpidr, level) \
39 ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK)
40
28extern unsigned int processor_id; 41extern unsigned int processor_id;
29 42
30#ifdef CONFIG_CPU_CP15 43#ifdef CONFIG_CPU_CP15
diff --git a/arch/arm/include/asm/cti.h b/arch/arm/include/asm/cti.h
index a0ada3ea435..f2e5cad3f30 100644
--- a/arch/arm/include/asm/cti.h
+++ b/arch/arm/include/asm/cti.h
@@ -146,15 +146,7 @@ static inline void cti_irq_ack(struct cti *cti)
146 */ 146 */
147static inline void cti_unlock(struct cti *cti) 147static inline void cti_unlock(struct cti *cti)
148{ 148{
149 void __iomem *base = cti->base; 149 __raw_writel(LOCKCODE, cti->base + LOCKACCESS);
150 unsigned long val;
151
152 val = __raw_readl(base + LOCKSTATUS);
153
154 if (val & 1) {
155 val = LOCKCODE;
156 __raw_writel(val, base + LOCKACCESS);
157 }
158} 150}
159 151
160/** 152/**
@@ -166,14 +158,6 @@ static inline void cti_unlock(struct cti *cti)
166 */ 158 */
167static inline void cti_lock(struct cti *cti) 159static inline void cti_lock(struct cti *cti)
168{ 160{
169 void __iomem *base = cti->base; 161 __raw_writel(~LOCKCODE, cti->base + LOCKACCESS);
170 unsigned long val;
171
172 val = __raw_readl(base + LOCKSTATUS);
173
174 if (!(val & 1)) {
175 val = ~LOCKCODE;
176 __raw_writel(val, base + LOCKACCESS);
177 }
178} 162}
179#endif 163#endif
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 23004847bb0..8ea02ac3ec1 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -211,13 +211,6 @@ static inline void dma_free_writecombine(struct device *dev, size_t size,
211extern void __init init_dma_coherent_pool_size(unsigned long size); 211extern void __init init_dma_coherent_pool_size(unsigned long size);
212 212
213/* 213/*
214 * This can be called during boot to increase the size of the consistent
215 * DMA region above it's default value of 2MB. It must be called before the
216 * memory allocator is initialised, i.e. before any core_initcall.
217 */
218static inline void init_consistent_dma_size(unsigned long size) { }
219
220/*
221 * For SA-1111, IXP425, and ADI systems the dma-mapping functions are "magic" 214 * For SA-1111, IXP425, and ADI systems the dma-mapping functions are "magic"
222 * and utilize bounce buffers as needed to work around limited DMA windows. 215 * and utilize bounce buffers as needed to work around limited DMA windows.
223 * 216 *
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index c4c87bc1223..3b2c40b5bfa 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -102,6 +102,10 @@
102 102
103#define L2X0_ADDR_FILTER_EN 1 103#define L2X0_ADDR_FILTER_EN 1
104 104
105#define L2X0_CTRL_EN 1
106
107#define L2X0_WAY_SIZE_SHIFT 3
108
105#ifndef __ASSEMBLY__ 109#ifndef __ASSEMBLY__
106extern void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask); 110extern void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask);
107#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF) 111#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF)
@@ -126,6 +130,7 @@ struct l2x0_regs {
126 unsigned long filter_end; 130 unsigned long filter_end;
127 unsigned long prefetch_ctrl; 131 unsigned long prefetch_ctrl;
128 unsigned long pwr_ctrl; 132 unsigned long pwr_ctrl;
133 unsigned long ctrl;
129}; 134};
130 135
131extern struct l2x0_regs l2x0_saved_regs; 136extern struct l2x0_regs l2x0_saved_regs;
diff --git a/arch/arm/include/asm/hardware/sp810.h b/arch/arm/include/asm/hardware/sp810.h
index 6b9b077d86b..6636430dd0e 100644
--- a/arch/arm/include/asm/hardware/sp810.h
+++ b/arch/arm/include/asm/hardware/sp810.h
@@ -50,11 +50,7 @@
50#define SCPCELLID2 0xFF8 50#define SCPCELLID2 0xFF8
51#define SCPCELLID3 0xFFC 51#define SCPCELLID3 0xFFC
52 52
53#define SCCTRL_TIMEREN0SEL_REFCLK (0 << 15) 53#define SCCTRL_TIMERENnSEL_SHIFT(n) (15 + ((n) * 2))
54#define SCCTRL_TIMEREN0SEL_TIMCLK (1 << 15)
55
56#define SCCTRL_TIMEREN1SEL_REFCLK (0 << 17)
57#define SCCTRL_TIMEREN1SEL_TIMCLK (1 << 17)
58 54
59static inline void sysctl_soft_reset(void __iomem *base) 55static inline void sysctl_soft_reset(void __iomem *base)
60{ 56{
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h
index e14af1a1a32..2bebad36fc8 100644
--- a/arch/arm/include/asm/hardware/vic.h
+++ b/arch/arm/include/asm/hardware/vic.h
@@ -47,7 +47,7 @@
47struct device_node; 47struct device_node;
48struct pt_regs; 48struct pt_regs;
49 49
50void __vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, 50void __vic_init(void __iomem *base, int irq_start, u32 vic_sources,
51 u32 resume_sources, struct device_node *node); 51 u32 resume_sources, struct device_node *node);
52void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); 52void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
53int vic_of_init(struct device_node *node, struct device_node *parent); 53int vic_of_init(struct device_node *node, struct device_node *parent);
diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
index c190bc992f0..01169dd723f 100644
--- a/arch/arm/include/asm/hw_breakpoint.h
+++ b/arch/arm/include/asm/hw_breakpoint.h
@@ -98,12 +98,12 @@ static inline void decode_ctrl_reg(u32 reg,
98#define ARM_BASE_WCR 112 98#define ARM_BASE_WCR 112
99 99
100/* Accessor macros for the debug registers. */ 100/* Accessor macros for the debug registers. */
101#define ARM_DBG_READ(M, OP2, VAL) do {\ 101#define ARM_DBG_READ(N, M, OP2, VAL) do {\
102 asm volatile("mrc p14, 0, %0, c0," #M ", " #OP2 : "=r" (VAL));\ 102 asm volatile("mrc p14, 0, %0, " #N "," #M ", " #OP2 : "=r" (VAL));\
103} while (0) 103} while (0)
104 104
105#define ARM_DBG_WRITE(M, OP2, VAL) do {\ 105#define ARM_DBG_WRITE(N, M, OP2, VAL) do {\
106 asm volatile("mcr p14, 0, %0, c0," #M ", " #OP2 : : "r" (VAL));\ 106 asm volatile("mcr p14, 0, %0, " #N "," #M ", " #OP2 : : "r" (VAL));\
107} while (0) 107} while (0)
108 108
109struct notifier_block; 109struct notifier_block;
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 42f042ee4ad..652b56086de 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -374,7 +374,7 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
374 374
375#ifdef CONFIG_MMU 375#ifdef CONFIG_MMU
376#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 376#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
377extern int valid_phys_addr_range(unsigned long addr, size_t size); 377extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
378extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 378extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
379extern int devmem_is_allowed(unsigned long pfn); 379extern int devmem_is_allowed(unsigned long pfn);
380#endif 380#endif
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index 195ac2f9d3d..2fe141fcc8d 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -40,6 +40,13 @@ extern void iotable_init(struct map_desc *, int);
40extern void vm_reserve_area_early(unsigned long addr, unsigned long size, 40extern void vm_reserve_area_early(unsigned long addr, unsigned long size,
41 void *caller); 41 void *caller);
42 42
43#ifdef CONFIG_DEBUG_LL
44extern void debug_ll_addr(unsigned long *paddr, unsigned long *vaddr);
45extern void debug_ll_io_init(void);
46#else
47static inline void debug_ll_io_init(void) {}
48#endif
49
43struct mem_type; 50struct mem_type;
44extern const struct mem_type *get_mem_type(unsigned int type); 51extern const struct mem_type *get_mem_type(unsigned int type);
45/* 52/*
diff --git a/arch/arm/include/asm/mach/serial_at91.h b/arch/arm/include/asm/mach/serial_at91.h
deleted file mode 100644
index ea6d063923b..00000000000
--- a/arch/arm/include/asm/mach/serial_at91.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/include/asm/mach/serial_at91.h
3 *
4 * Based on serial_sa1100.h by Nicolas Pitre
5 *
6 * Copyright (C) 2002 ATMEL Rousset
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12
13/*
14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot.
16 */
17struct atmel_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23 int (*open)(struct uart_port *);
24 void (*close)(struct uart_port *);
25};
26
27#if defined(CONFIG_SERIAL_ATMEL)
28void atmel_register_uart_fns(struct atmel_port_fns *fns);
29#else
30#define atmel_register_uart_fns(fns) do { } while (0)
31#endif
32
33
diff --git a/arch/arm/include/asm/mach/serial_sa1100.h b/arch/arm/include/asm/mach/serial_sa1100.h
deleted file mode 100644
index d09064bf95a..00000000000
--- a/arch/arm/include/asm/mach/serial_sa1100.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * arch/arm/include/asm/mach/serial_sa1100.h
3 *
4 * Author: Nicolas Pitre
5 *
6 * Moved and changed lots, Russell King
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12struct uart_info;
13
14/*
15 * This is a temporary structure for registering these
16 * functions; it is intended to be discarded after boot.
17 */
18struct sa1100_port_fns {
19 void (*set_mctrl)(struct uart_port *, u_int);
20 u_int (*get_mctrl)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23};
24
25#ifdef CONFIG_SERIAL_SA1100
26void sa1100_register_uart_fns(struct sa1100_port_fns *fns);
27void sa1100_register_uart(int idx, int port);
28#else
29#define sa1100_register_uart_fns(fns) do { } while (0)
30#define sa1100_register_uart(idx,port) do { } while (0)
31#endif
diff --git a/arch/arm/include/asm/mach/udc_pxa2xx.h b/arch/arm/include/asm/mach/udc_pxa2xx.h
deleted file mode 100644
index ea297ac70bc..00000000000
--- a/arch/arm/include/asm/mach/udc_pxa2xx.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/include/asm/mach/udc_pxa2xx.h
3 *
4 * This supports machine-specific differences in how the PXA2xx
5 * USB Device Controller (UDC) is wired.
6 *
7 * It is set in linux/arch/arm/mach-pxa/<machine>.c or in
8 * linux/arch/mach-ixp4xx/<machine>.c and used in
9 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
10 */
11
12struct pxa2xx_udc_mach_info {
13 int (*udc_is_connected)(void); /* do we see host? */
14 void (*udc_command)(int cmd);
15#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17
18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here. Note that sometimes the signals go through inverters...
22 */
23 bool gpio_pullup_inverted;
24 int gpio_pullup; /* high == pullup activated */
25};
26
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 14965658a92..9f77e7804f3 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -5,18 +5,15 @@
5 5
6typedef struct { 6typedef struct {
7#ifdef CONFIG_CPU_HAS_ASID 7#ifdef CONFIG_CPU_HAS_ASID
8 unsigned int id; 8 u64 id;
9 raw_spinlock_t id_lock;
10#endif 9#endif
11 unsigned int kvm_seq; 10 unsigned int vmalloc_seq;
12} mm_context_t; 11} mm_context_t;
13 12
14#ifdef CONFIG_CPU_HAS_ASID 13#ifdef CONFIG_CPU_HAS_ASID
15#define ASID(mm) ((mm)->context.id & 255) 14#define ASID_BITS 8
16 15#define ASID_MASK ((~0ULL) << ASID_BITS)
17/* init_mm.context.id_lock should be initialized. */ 16#define ASID(mm) ((mm)->context.id & ~ASID_MASK)
18#define INIT_MM_CONTEXT(name) \
19 .context.id_lock = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
20#else 17#else
21#define ASID(mm) (0) 18#define ASID(mm) (0)
22#endif 19#endif
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 0306bc642c0..e1f644bc7cc 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -20,88 +20,12 @@
20#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
21#include <asm-generic/mm_hooks.h> 21#include <asm-generic/mm_hooks.h>
22 22
23void __check_kvm_seq(struct mm_struct *mm); 23void __check_vmalloc_seq(struct mm_struct *mm);
24 24
25#ifdef CONFIG_CPU_HAS_ASID 25#ifdef CONFIG_CPU_HAS_ASID
26 26
27/* 27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
28 * On ARMv6, we have the following structure in the Context ID: 28#define init_new_context(tsk,mm) ({ mm->context.id = 0; })
29 *
30 * 31 7 0
31 * +-------------------------+-----------+
32 * | process ID | ASID |
33 * +-------------------------+-----------+
34 * | context ID |
35 * +-------------------------------------+
36 *
37 * The ASID is used to tag entries in the CPU caches and TLBs.
38 * The context ID is used by debuggers and trace logic, and
39 * should be unique within all running processes.
40 */
41#define ASID_BITS 8
42#define ASID_MASK ((~0) << ASID_BITS)
43#define ASID_FIRST_VERSION (1 << ASID_BITS)
44
45extern unsigned int cpu_last_asid;
46
47void __init_new_context(struct task_struct *tsk, struct mm_struct *mm);
48void __new_context(struct mm_struct *mm);
49void cpu_set_reserved_ttbr0(void);
50
51static inline void switch_new_context(struct mm_struct *mm)
52{
53 unsigned long flags;
54
55 __new_context(mm);
56
57 local_irq_save(flags);
58 cpu_switch_mm(mm->pgd, mm);
59 local_irq_restore(flags);
60}
61
62static inline void check_and_switch_context(struct mm_struct *mm,
63 struct task_struct *tsk)
64{
65 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
66 __check_kvm_seq(mm);
67
68 /*
69 * Required during context switch to avoid speculative page table
70 * walking with the wrong TTBR.
71 */
72 cpu_set_reserved_ttbr0();
73
74 if (!((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
75 /*
76 * The ASID is from the current generation, just switch to the
77 * new pgd. This condition is only true for calls from
78 * context_switch() and interrupts are already disabled.
79 */
80 cpu_switch_mm(mm->pgd, mm);
81 else if (irqs_disabled())
82 /*
83 * Defer the new ASID allocation until after the context
84 * switch critical region since __new_context() cannot be
85 * called with interrupts disabled (it sends IPIs).
86 */
87 set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM);
88 else
89 /*
90 * That is a direct call to switch_mm() or activate_mm() with
91 * interrupts enabled and a new context.
92 */
93 switch_new_context(mm);
94}
95
96#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0)
97
98#define finish_arch_post_lock_switch \
99 finish_arch_post_lock_switch
100static inline void finish_arch_post_lock_switch(void)
101{
102 if (test_and_clear_thread_flag(TIF_SWITCH_MM))
103 switch_new_context(current->mm);
104}
105 29
106#else /* !CONFIG_CPU_HAS_ASID */ 30#else /* !CONFIG_CPU_HAS_ASID */
107 31
@@ -110,8 +34,8 @@ static inline void finish_arch_post_lock_switch(void)
110static inline void check_and_switch_context(struct mm_struct *mm, 34static inline void check_and_switch_context(struct mm_struct *mm,
111 struct task_struct *tsk) 35 struct task_struct *tsk)
112{ 36{
113 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) 37 if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))
114 __check_kvm_seq(mm); 38 __check_vmalloc_seq(mm);
115 39
116 if (irqs_disabled()) 40 if (irqs_disabled())
117 /* 41 /*
@@ -143,6 +67,7 @@ static inline void finish_arch_post_lock_switch(void)
143#endif /* CONFIG_CPU_HAS_ASID */ 67#endif /* CONFIG_CPU_HAS_ASID */
144 68
145#define destroy_context(mm) do { } while(0) 69#define destroy_context(mm) do { } while(0)
70#define activate_mm(prev,next) switch_mm(prev, next, NULL)
146 71
147/* 72/*
148 * This is called when "tsk" is about to enter lazy TLB mode. 73 * This is called when "tsk" is about to enter lazy TLB mode.
@@ -186,6 +111,5 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
186} 111}
187 112
188#define deactivate_mm(tsk,mm) do { } while (0) 113#define deactivate_mm(tsk,mm) do { } while (0)
189#define activate_mm(prev,next) switch_mm(prev, next, NULL)
190 114
191#endif 115#endif
diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h
new file mode 100644
index 00000000000..968c0a14e0a
--- /dev/null
+++ b/arch/arm/include/asm/percpu.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright 2012 Calxeda, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef _ASM_ARM_PERCPU_H_
17#define _ASM_ARM_PERCPU_H_
18
19/*
20 * Same as asm-generic/percpu.h, except that we store the per cpu offset
21 * in the TPIDRPRW. TPIDRPRW only exists on V6K and V7
22 */
23#if defined(CONFIG_SMP) && !defined(CONFIG_CPU_V6)
24static inline void set_my_cpu_offset(unsigned long off)
25{
26 /* Set TPIDRPRW */
27 asm volatile("mcr p15, 0, %0, c13, c0, 4" : : "r" (off) : "memory");
28}
29
30static inline unsigned long __my_cpu_offset(void)
31{
32 unsigned long off;
33 /* Read TPIDRPRW */
34 asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : : "memory");
35 return off;
36}
37#define __my_cpu_offset __my_cpu_offset()
38#else
39#define set_my_cpu_offset(x) do {} while(0)
40
41#endif /* CONFIG_SMP */
42
43#include <asm-generic/percpu.h>
44
45#endif /* _ASM_ARM_PERCPU_H_ */
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h
index 625cd621a43..755877527cf 100644
--- a/arch/arm/include/asm/perf_event.h
+++ b/arch/arm/include/asm/perf_event.h
@@ -21,4 +21,11 @@
21#define C(_x) PERF_COUNT_HW_CACHE_##_x 21#define C(_x) PERF_COUNT_HW_CACHE_##_x
22#define CACHE_OP_UNSUPPORTED 0xFFFF 22#define CACHE_OP_UNSUPPORTED 0xFFFF
23 23
24#ifdef CONFIG_HW_PERF_EVENTS
25struct pt_regs;
26extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
27extern unsigned long perf_misc_flags(struct pt_regs *regs);
28#define perf_misc_flags(regs) perf_misc_flags(regs)
29#endif
30
24#endif /* __ARM_PERF_EVENT_H__ */ 31#endif /* __ARM_PERF_EVENT_H__ */
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 2317a71c8f8..f97ee02386e 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -115,6 +115,7 @@
115 * The PTE table pointer refers to the hardware entries; the "Linux" 115 * The PTE table pointer refers to the hardware entries; the "Linux"
116 * entries are stored 1024 bytes below. 116 * entries are stored 1024 bytes below.
117 */ 117 */
118#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */
118#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0) 119#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
119#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) 120#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
120#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ 121#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
@@ -123,6 +124,7 @@
123#define L_PTE_USER (_AT(pteval_t, 1) << 8) 124#define L_PTE_USER (_AT(pteval_t, 1) << 8)
124#define L_PTE_XN (_AT(pteval_t, 1) << 9) 125#define L_PTE_XN (_AT(pteval_t, 1) << 9)
125#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */ 126#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
127#define L_PTE_NONE (_AT(pteval_t, 1) << 11)
126 128
127/* 129/*
128 * These are the memory types, defined to be compatible with 130 * These are the memory types, defined to be compatible with
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index b24903549d1..a3f37929940 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -67,7 +67,8 @@
67 * These bits overlap with the hardware bits but the naming is preserved for 67 * These bits overlap with the hardware bits but the naming is preserved for
68 * consistency with the classic page table format. 68 * consistency with the classic page table format.
69 */ 69 */
70#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Valid */ 70#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */
71#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Present */
71#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ 72#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
72#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ 73#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */
73#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */ 74#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */
@@ -76,6 +77,7 @@
76#define L_PTE_XN (_AT(pteval_t, 1) << 54) /* XN */ 77#define L_PTE_XN (_AT(pteval_t, 1) << 54) /* XN */
77#define L_PTE_DIRTY (_AT(pteval_t, 1) << 55) /* unused */ 78#define L_PTE_DIRTY (_AT(pteval_t, 1) << 55) /* unused */
78#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */ 79#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */
80#define L_PTE_NONE (_AT(pteval_t, 1) << 57) /* PROT_NONE */
79 81
80/* 82/*
81 * To be used in assembly code with the upper page attributes. 83 * To be used in assembly code with the upper page attributes.
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 08c12312a1f..9c82f988c0e 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -73,7 +73,7 @@ extern pgprot_t pgprot_kernel;
73 73
74#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) 74#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
75 75
76#define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY) 76#define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY | L_PTE_NONE)
77#define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN) 77#define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN)
78#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER) 78#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER)
79#define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) 79#define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
@@ -83,7 +83,7 @@ extern pgprot_t pgprot_kernel;
83#define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN) 83#define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN)
84#define PAGE_KERNEL_EXEC pgprot_kernel 84#define PAGE_KERNEL_EXEC pgprot_kernel
85 85
86#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN) 86#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE)
87#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN) 87#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
88#define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER) 88#define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER)
89#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) 89#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
@@ -203,9 +203,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
203#define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) 203#define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN))
204#define pte_special(pte) (0) 204#define pte_special(pte) (0)
205 205
206#define pte_present_user(pte) \ 206#define pte_present_user(pte) (pte_present(pte) && (pte_val(pte) & L_PTE_USER))
207 ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \
208 (L_PTE_PRESENT | L_PTE_USER))
209 207
210#if __LINUX_ARM_ARCH__ < 6 208#if __LINUX_ARM_ARCH__ < 6
211static inline void __sync_icache_dcache(pte_t pteval) 209static inline void __sync_icache_dcache(pte_t pteval)
@@ -242,7 +240,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
242 240
243static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 241static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
244{ 242{
245 const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER; 243 const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | L_PTE_NONE;
246 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 244 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
247 return pte; 245 return pte;
248} 246}
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index a26170dce02..f24edad26c7 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -67,19 +67,19 @@ struct arm_pmu {
67 cpumask_t active_irqs; 67 cpumask_t active_irqs;
68 char *name; 68 char *name;
69 irqreturn_t (*handle_irq)(int irq_num, void *dev); 69 irqreturn_t (*handle_irq)(int irq_num, void *dev);
70 void (*enable)(struct hw_perf_event *evt, int idx); 70 void (*enable)(struct perf_event *event);
71 void (*disable)(struct hw_perf_event *evt, int idx); 71 void (*disable)(struct perf_event *event);
72 int (*get_event_idx)(struct pmu_hw_events *hw_events, 72 int (*get_event_idx)(struct pmu_hw_events *hw_events,
73 struct hw_perf_event *hwc); 73 struct perf_event *event);
74 int (*set_event_filter)(struct hw_perf_event *evt, 74 int (*set_event_filter)(struct hw_perf_event *evt,
75 struct perf_event_attr *attr); 75 struct perf_event_attr *attr);
76 u32 (*read_counter)(int idx); 76 u32 (*read_counter)(struct perf_event *event);
77 void (*write_counter)(int idx, u32 val); 77 void (*write_counter)(struct perf_event *event, u32 val);
78 void (*start)(void); 78 void (*start)(struct arm_pmu *);
79 void (*stop)(void); 79 void (*stop)(struct arm_pmu *);
80 void (*reset)(void *); 80 void (*reset)(void *);
81 int (*request_irq)(irq_handler_t handler); 81 int (*request_irq)(struct arm_pmu *, irq_handler_t handler);
82 void (*free_irq)(void); 82 void (*free_irq)(struct arm_pmu *);
83 int (*map_event)(struct perf_event *event); 83 int (*map_event)(struct perf_event *event);
84 int num_events; 84 int num_events;
85 atomic_t active_events; 85 atomic_t active_events;
@@ -93,15 +93,11 @@ struct arm_pmu {
93 93
94extern const struct dev_pm_ops armpmu_dev_pm_ops; 94extern const struct dev_pm_ops armpmu_dev_pm_ops;
95 95
96int armpmu_register(struct arm_pmu *armpmu, char *name, int type); 96int armpmu_register(struct arm_pmu *armpmu, int type);
97 97
98u64 armpmu_event_update(struct perf_event *event, 98u64 armpmu_event_update(struct perf_event *event);
99 struct hw_perf_event *hwc,
100 int idx);
101 99
102int armpmu_event_set_period(struct perf_event *event, 100int armpmu_event_set_period(struct perf_event *event);
103 struct hw_perf_event *hwc,
104 int idx);
105 101
106int armpmu_map_event(struct perf_event *event, 102int armpmu_map_event(struct perf_event *event,
107 const unsigned (*event_map)[PERF_COUNT_HW_MAX], 103 const unsigned (*event_map)[PERF_COUNT_HW_MAX],
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h
index aeae9c609df..a219227c3e4 100644
--- a/arch/arm/include/asm/prom.h
+++ b/arch/arm/include/asm/prom.h
@@ -11,10 +11,13 @@
11#ifndef __ASMARM_PROM_H 11#ifndef __ASMARM_PROM_H
12#define __ASMARM_PROM_H 12#define __ASMARM_PROM_H
13 13
14#define HAVE_ARCH_DEVTREE_FIXUPS
15
14#ifdef CONFIG_OF 16#ifdef CONFIG_OF
15 17
16extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 18extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
17extern void arm_dt_memblock_reserve(void); 19extern void arm_dt_memblock_reserve(void);
20extern void __init arm_dt_init_cpu_maps(void);
18 21
19#else /* CONFIG_OF */ 22#else /* CONFIG_OF */
20 23
@@ -24,6 +27,7 @@ static inline struct machine_desc *setup_machine_fdt(unsigned int dt_phys)
24} 27}
25 28
26static inline void arm_dt_memblock_reserve(void) { } 29static inline void arm_dt_memblock_reserve(void) { }
30static inline void arm_dt_init_cpu_maps(void) { }
27 31
28#endif /* CONFIG_OF */ 32#endif /* CONFIG_OF */
29#endif /* ASMARM_PROM_H */ 33#endif /* ASMARM_PROM_H */
diff --git a/arch/arm/include/asm/signal.h b/arch/arm/include/asm/signal.h
index 5a7963dbd3f..9a0ea6ab988 100644
--- a/arch/arm/include/asm/signal.h
+++ b/arch/arm/include/asm/signal.h
@@ -35,5 +35,4 @@ struct k_sigaction {
35}; 35};
36 36
37#include <asm/sigcontext.h> 37#include <asm/sigcontext.h>
38#define ptrace_signal_deliver(regs, cookie) do { } while (0)
39#endif 38#endif
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 2e3be16c676..d3a22bebe6c 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -79,6 +79,7 @@ extern void cpu_die(void);
79 79
80extern void arch_send_call_function_single_ipi(int cpu); 80extern void arch_send_call_function_single_ipi(int cpu);
81extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 81extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
82extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
82 83
83struct smp_operations { 84struct smp_operations {
84#ifdef CONFIG_SMP 85#ifdef CONFIG_SMP
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index 558d6c80aca..aaa61b6f50f 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -5,6 +5,9 @@
5#ifndef __ASMARM_SMP_PLAT_H 5#ifndef __ASMARM_SMP_PLAT_H
6#define __ASMARM_SMP_PLAT_H 6#define __ASMARM_SMP_PLAT_H
7 7
8#include <linux/cpumask.h>
9#include <linux/err.h>
10
8#include <asm/cputype.h> 11#include <asm/cputype.h>
9 12
10/* 13/*
@@ -48,5 +51,19 @@ static inline int cache_ops_need_broadcast(void)
48 */ 51 */
49extern int __cpu_logical_map[]; 52extern int __cpu_logical_map[];
50#define cpu_logical_map(cpu) __cpu_logical_map[cpu] 53#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
54/*
55 * Retrieve logical cpu index corresponding to a given MPIDR[23:0]
56 * - mpidr: MPIDR[23:0] to be used for the look-up
57 *
58 * Returns the cpu logical index or -EINVAL on look-up error
59 */
60static inline int get_logical_index(u32 mpidr)
61{
62 int cpu;
63 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
64 if (cpu_logical_map(cpu) == mpidr)
65 return cpu;
66 return -EINVAL;
67}
51 68
52#endif 69#endif
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index 9fdded6b108..f1d96d4e809 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -7,6 +7,8 @@
7#ifndef _ASM_ARM_SYSCALL_H 7#ifndef _ASM_ARM_SYSCALL_H
8#define _ASM_ARM_SYSCALL_H 8#define _ASM_ARM_SYSCALL_H
9 9
10#include <linux/audit.h> /* for AUDIT_ARCH_* */
11#include <linux/elf.h> /* for ELF_EM */
10#include <linux/err.h> 12#include <linux/err.h>
11#include <linux/sched.h> 13#include <linux/sched.h>
12 14
@@ -95,4 +97,11 @@ static inline void syscall_set_arguments(struct task_struct *task,
95 memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0])); 97 memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
96} 98}
97 99
100static inline int syscall_get_arch(struct task_struct *task,
101 struct pt_regs *regs)
102{
103 /* ARM tasks don't change audit architectures on the fly. */
104 return AUDIT_ARCH_ARM;
105}
106
98#endif /* _ASM_ARM_SYSCALL_H */ 107#endif /* _ASM_ARM_SYSCALL_H */
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index 8477b4c1d39..cddda1f41f0 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -151,10 +151,10 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
151#define TIF_SYSCALL_TRACE 8 151#define TIF_SYSCALL_TRACE 8
152#define TIF_SYSCALL_AUDIT 9 152#define TIF_SYSCALL_AUDIT 9
153#define TIF_SYSCALL_TRACEPOINT 10 153#define TIF_SYSCALL_TRACEPOINT 10
154#define TIF_SECCOMP 11 /* seccomp syscall filtering active */
154#define TIF_USING_IWMMXT 17 155#define TIF_USING_IWMMXT 17
155#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 156#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
156#define TIF_RESTORE_SIGMASK 20 157#define TIF_RESTORE_SIGMASK 20
157#define TIF_SECCOMP 21
158#define TIF_SWITCH_MM 22 /* deferred switch_mm */ 158#define TIF_SWITCH_MM 22 /* deferred switch_mm */
159 159
160#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 160#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
@@ -163,11 +163,12 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
163#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 163#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
164#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 164#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
165#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 165#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
166#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
167#define _TIF_SECCOMP (1 << TIF_SECCOMP) 166#define _TIF_SECCOMP (1 << TIF_SECCOMP)
167#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
168 168
169/* Checks for any syscall work in entry-common.S */ 169/* Checks for any syscall work in entry-common.S */
170#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT) 170#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
171 _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP)
171 172
172/* 173/*
173 * Change these and you break ASM code in entry-common.S 174 * Change these and you break ASM code in entry-common.S
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 8f60b6e6bd4..7cd13cc6262 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -42,6 +42,9 @@
42#define __ARCH_WANT_SYS_SOCKETCALL 42#define __ARCH_WANT_SYS_SOCKETCALL
43#endif 43#endif
44#define __ARCH_WANT_SYS_EXECVE 44#define __ARCH_WANT_SYS_EXECVE
45#define __ARCH_WANT_SYS_FORK
46#define __ARCH_WANT_SYS_VFORK
47#define __ARCH_WANT_SYS_CLONE
45 48
46/* 49/*
47 * "Conditional" syscalls 50 * "Conditional" syscalls
diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
index 5000397134b..1151188bcd8 100644
--- a/arch/arm/include/asm/xen/interface.h
+++ b/arch/arm/include/asm/xen/interface.h
@@ -49,6 +49,7 @@ DEFINE_GUEST_HANDLE(void);
49DEFINE_GUEST_HANDLE(uint64_t); 49DEFINE_GUEST_HANDLE(uint64_t);
50DEFINE_GUEST_HANDLE(uint32_t); 50DEFINE_GUEST_HANDLE(uint32_t);
51DEFINE_GUEST_HANDLE(xen_pfn_t); 51DEFINE_GUEST_HANDLE(xen_pfn_t);
52DEFINE_GUEST_HANDLE(xen_ulong_t);
52 53
53/* Maximum number of virtual CPUs in multi-processor guests. */ 54/* Maximum number of virtual CPUs in multi-processor guests. */
54#define MAX_VIRT_CPUS 1 55#define MAX_VIRT_CPUS 1
diff --git a/arch/arm/include/debug/imx.S b/arch/arm/include/debug/imx.S
new file mode 100644
index 00000000000..0c4e17d4d35
--- /dev/null
+++ b/arch/arm/include/debug/imx.S
@@ -0,0 +1,74 @@
1/* arch/arm/mach-imx/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#define IMX6Q_UART1_BASE_ADDR 0x02020000
14#define IMX6Q_UART2_BASE_ADDR 0x021e8000
15#define IMX6Q_UART3_BASE_ADDR 0x021ec000
16#define IMX6Q_UART4_BASE_ADDR 0x021f0000
17#define IMX6Q_UART5_BASE_ADDR 0x021f4000
18
19/*
20 * IMX6Q_UART_BASE_ADDR is put in the middle to force the expansion
21 * of IMX6Q_UART##n##_BASE_ADDR.
22 */
23#define IMX6Q_UART_BASE_ADDR(n) IMX6Q_UART##n##_BASE_ADDR
24#define IMX6Q_UART_BASE(n) IMX6Q_UART_BASE_ADDR(n)
25#define IMX6Q_DEBUG_UART_BASE IMX6Q_UART_BASE(CONFIG_DEBUG_IMX6Q_UART_PORT)
26
27#ifdef CONFIG_DEBUG_IMX1_UART
28#define UART_PADDR 0x00206000
29#elif defined (CONFIG_DEBUG_IMX25_UART)
30#define UART_PADDR 0x43f90000
31#elif defined (CONFIG_DEBUG_IMX21_IMX27_UART)
32#define UART_PADDR 0x1000a000
33#elif defined (CONFIG_DEBUG_IMX31_IMX35_UART)
34#define UART_PADDR 0x43f90000
35#elif defined (CONFIG_DEBUG_IMX51_UART)
36#define UART_PADDR 0x73fbc000
37#elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
38#define UART_PADDR 0x53fbc000
39#elif defined (CONFIG_DEBUG_IMX6Q_UART)
40#define UART_PADDR IMX6Q_DEBUG_UART_BASE
41#endif
42
43/*
44 * FIXME: This is a copy of IMX_IO_P2V in hardware.h, and needs to
45 * stay sync with that. It's hard to maintain, and should be fixed
46 * globally for multi-platform build to use a fixed virtual address
47 * for low-level debug uart port across platforms.
48 */
49#define IMX_IO_P2V(x) ( \
50 (((x) & 0x80000000) >> 7) | \
51 (0xf4000000 + \
52 (((x) & 0x50000000) >> 6) + \
53 (((x) & 0x0b000000) >> 4) + \
54 (((x) & 0x000fffff))))
55
56#define UART_VADDR IMX_IO_P2V(UART_PADDR)
57
58 .macro addruart, rp, rv, tmp
59 ldr \rp, =UART_PADDR @ physical
60 ldr \rv, =UART_VADDR @ virtual
61 .endm
62
63 .macro senduart,rd,rx
64 str \rd, [\rx, #0x40] @ TXDATA
65 .endm
66
67 .macro waituart,rd,rx
68 .endm
69
70 .macro busyuart,rd,rx
711002: ldr \rd, [\rx, #0x98] @ SR2
72 tst \rd, #1 << 3 @ TXDC
73 beq 1002b @ wait until transmit done
74 .endm
diff --git a/arch/arm/include/debug/sunxi.S b/arch/arm/include/debug/sunxi.S
new file mode 100644
index 00000000000..04eb56d5db2
--- /dev/null
+++ b/arch/arm/include/debug/sunxi.S
@@ -0,0 +1,27 @@
1/*
2 * Early serial output macro for Allwinner A1X SoCs
3 *
4 * Copyright (C) 2012 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#if defined(CONFIG_DEBUG_SUNXI_UART0)
14#define SUNXI_UART_DEBUG_PHYS_BASE 0x01c28000
15#define SUNXI_UART_DEBUG_VIRT_BASE 0xf1c28000
16#elif defined(CONFIG_DEBUG_SUNXI_UART1)
17#define SUNXI_UART_DEBUG_PHYS_BASE 0x01c28400
18#define SUNXI_UART_DEBUG_VIRT_BASE 0xf1c28400
19#endif
20
21 .macro addruart, rp, rv, tmp
22 ldr \rp, =SUNXI_UART_DEBUG_PHYS_BASE
23 ldr \rv, =SUNXI_UART_DEBUG_VIRT_BASE
24 .endm
25
26#define UART_SHIFT 2
27#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/include/debug/tegra.S b/arch/arm/include/debug/tegra.S
new file mode 100644
index 00000000000..883d7c22fd9
--- /dev/null
+++ b/arch/arm/include/debug/tegra.S
@@ -0,0 +1,223 @@
1/*
2 * Copyright (C) 2010,2011 Google, Inc.
3 * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved.
4 *
5 * Author:
6 * Colin Cross <ccross@google.com>
7 * Erik Gilling <konkers@google.com>
8 * Doug Anderson <dianders@chromium.org>
9 * Stephen Warren <swarren@nvidia.com>
10 *
11 * Portions based on mach-omap2's debug-macro.S
12 * Copyright (C) 1994-1999 Russell King
13 *
14 * This software is licensed under the terms of the GNU General Public
15 * License version 2, as published by the Free Software Foundation, and
16 * may be copied, distributed, and modified under those terms.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 */
24
25#include <linux/serial_reg.h>
26
27#define UART_SHIFT 2
28
29/* Physical addresses */
30#define TEGRA_CLK_RESET_BASE 0x60006000
31#define TEGRA_APB_MISC_BASE 0x70000000
32#define TEGRA_UARTA_BASE 0x70006000
33#define TEGRA_UARTB_BASE 0x70006040
34#define TEGRA_UARTC_BASE 0x70006200
35#define TEGRA_UARTD_BASE 0x70006300
36#define TEGRA_UARTE_BASE 0x70006400
37#define TEGRA_PMC_BASE 0x7000e400
38
39#define TEGRA_CLK_RST_DEVICES_L (TEGRA_CLK_RESET_BASE + 0x04)
40#define TEGRA_CLK_RST_DEVICES_H (TEGRA_CLK_RESET_BASE + 0x08)
41#define TEGRA_CLK_RST_DEVICES_U (TEGRA_CLK_RESET_BASE + 0x0c)
42#define TEGRA_CLK_OUT_ENB_L (TEGRA_CLK_RESET_BASE + 0x10)
43#define TEGRA_CLK_OUT_ENB_H (TEGRA_CLK_RESET_BASE + 0x14)
44#define TEGRA_CLK_OUT_ENB_U (TEGRA_CLK_RESET_BASE + 0x18)
45#define TEGRA_PMC_SCRATCH20 (TEGRA_PMC_BASE + 0xa0)
46#define TEGRA_APB_MISC_GP_HIDREV (TEGRA_APB_MISC_BASE + 0x804)
47
48/*
49 * Must be 1MB-aligned since a 1MB mapping is used early on.
50 * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[].
51 */
52#define UART_VIRTUAL_BASE 0xfe100000
53
54#define checkuart(rp, rv, lhu, bit, uart) \
55 /* Load address of CLK_RST register */ \
56 movw rp, #TEGRA_CLK_RST_DEVICES_##lhu & 0xffff ; \
57 movt rp, #TEGRA_CLK_RST_DEVICES_##lhu >> 16 ; \
58 /* Load value from CLK_RST register */ \
59 ldr rp, [rp, #0] ; \
60 /* Test UART's reset bit */ \
61 tst rp, #(1 << bit) ; \
62 /* If set, can't use UART; jump to save no UART */ \
63 bne 90f ; \
64 /* Load address of CLK_OUT_ENB register */ \
65 movw rp, #TEGRA_CLK_OUT_ENB_##lhu & 0xffff ; \
66 movt rp, #TEGRA_CLK_OUT_ENB_##lhu >> 16 ; \
67 /* Load value from CLK_OUT_ENB register */ \
68 ldr rp, [rp, #0] ; \
69 /* Test UART's clock enable bit */ \
70 tst rp, #(1 << bit) ; \
71 /* If clear, can't use UART; jump to save no UART */ \
72 beq 90f ; \
73 /* Passed all tests, load address of UART registers */ \
74 movw rp, #TEGRA_UART##uart##_BASE & 0xffff ; \
75 movt rp, #TEGRA_UART##uart##_BASE >> 16 ; \
76 /* Jump to save UART address */ \
77 b 91f
78
79 .macro addruart, rp, rv, tmp
80 adr \rp, 99f @ actual addr of 99f
81 ldr \rv, [\rp] @ linked addr is stored there
82 sub \rv, \rv, \rp @ offset between the two
83 ldr \rp, [\rp, #4] @ linked tegra_uart_config
84 sub \tmp, \rp, \rv @ actual tegra_uart_config
85 ldr \rp, [\tmp] @ Load tegra_uart_config
86 cmp \rp, #1 @ needs initialization?
87 bne 100f @ no; go load the addresses
88 mov \rv, #0 @ yes; record init is done
89 str \rv, [\tmp]
90
91#ifdef CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA
92 /* Check ODMDATA */
9310: movw \rp, #TEGRA_PMC_SCRATCH20 & 0xffff
94 movt \rp, #TEGRA_PMC_SCRATCH20 >> 16
95 ldr \rp, [\rp, #0] @ Load PMC_SCRATCH20
96 ubfx \rv, \rp, #18, #2 @ 19:18 are console type
97 cmp \rv, #2 @ 2 and 3 mean DCC, UART
98 beq 11f @ some boards swap the meaning
99 cmp \rv, #3 @ so accept either
100 bne 90f
10111: ubfx \rv, \rp, #15, #3 @ 17:15 are UART ID
102 cmp \rv, #0 @ UART 0?
103 beq 20f
104 cmp \rv, #1 @ UART 1?
105 beq 21f
106 cmp \rv, #2 @ UART 2?
107 beq 22f
108 cmp \rv, #3 @ UART 3?
109 beq 23f
110 cmp \rv, #4 @ UART 4?
111 beq 24f
112 b 90f @ invalid
113#endif
114
115#if defined(CONFIG_TEGRA_DEBUG_UARTA) || \
116 defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
117 /* Check UART A validity */
11820: checkuart(\rp, \rv, L, 6, A)
119#endif
120
121#if defined(CONFIG_TEGRA_DEBUG_UARTB) || \
122 defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
123 /* Check UART B validity */
12421: checkuart(\rp, \rv, L, 7, B)
125#endif
126
127#if defined(CONFIG_TEGRA_DEBUG_UARTC) || \
128 defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
129 /* Check UART C validity */
13022: checkuart(\rp, \rv, H, 23, C)
131#endif
132
133#if defined(CONFIG_TEGRA_DEBUG_UARTD) || \
134 defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
135 /* Check UART D validity */
13623: checkuart(\rp, \rv, U, 1, D)
137#endif
138
139#if defined(CONFIG_TEGRA_DEBUG_UARTE) || \
140 defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
141 /* Check UART E validity */
14224:
143 checkuart(\rp, \rv, U, 2, E)
144#endif
145
146 /* No valid UART found */
14790: mov \rp, #0
148 /* fall through */
149
150 /* Record whichever UART we chose */
15191: str \rp, [\tmp, #4] @ Store in tegra_uart_phys
152 cmp \rp, #0 @ Valid UART address?
153 bne 92f @ Yes, go process it
154 str \rp, [\tmp, #8] @ Store 0 in tegra_uart_virt
155 b 100f @ Done
15692: and \rv, \rp, #0xffffff @ offset within 1MB section
157 add \rv, \rv, #UART_VIRTUAL_BASE
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
182
183 .align
18499: .word .
185 .word tegra_uart_config
186 .ltorg
187
188 /* Load previously selected UART address */
189100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys
190 ldr \rv, [\tmp, #8] @ Load tegra_uart_virt
191 .endm
192
193/*
194 * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra
195 * check to make sure that the UART address is actually valid.
196 */
197
198 .macro senduart, rd, rx
199 cmp \rx, #0
200 strneb \rd, [\rx, #UART_TX << UART_SHIFT]
2011001:
202 .endm
203
204 .macro busyuart, rd, rx
205 cmp \rx, #0
206 beq 1002f
2071001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
208 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
209 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
210 bne 1001b
2111002:
212 .endm
213
214 .macro waituart, rd, rx
215#ifdef FLOW_CONTROL
216 cmp \rx, #0
217 beq 1002f
2181001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT]
219 tst \rd, #UART_MSR_CTS
220 beq 1001b
2211002:
222#endif
223 .endm
diff --git a/arch/arm/include/debug/vexpress.S b/arch/arm/include/debug/vexpress.S
index 9f509f55d07..dc8e882a625 100644
--- a/arch/arm/include/debug/vexpress.S
+++ b/arch/arm/include/debug/vexpress.S
@@ -21,14 +21,17 @@
21#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT) 21#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT)
22 22
23 .macro addruart,rp,rv,tmp 23 .macro addruart,rp,rv,tmp
24 .arch armv7-a
24 25
25 @ Make an educated guess regarding the memory map: 26 @ Make an educated guess regarding the memory map:
26 @ - the original A9 core tile, which has MPCore peripherals 27 @ - the original A9 core tile (based on ARM Cortex-A9 r0p1)
27 @ located at 0x1e000000, should use UART at 0x10009000 28 @ should use UART at 0x10009000
28 @ - all other (RS1 complaint) tiles use UART mapped 29 @ - all other (RS1 complaint) tiles use UART mapped
29 @ at 0x1c090000 30 @ at 0x1c090000
30 mrc p15, 4, \tmp, c15, c0, 0 31 mrc p15, 0, \rp, c0, c0, 0
31 cmp \tmp, #0x1e000000 32 movw \rv, #0xc091
33 movt \rv, #0x410f
34 cmp \rp, \rv
32 35
33 @ Original memory map 36 @ Original memory map
34 moveq \rp, #DEBUG_LL_UART_OFFSET 37 moveq \rp, #DEBUG_LL_UART_OFFSET
diff --git a/arch/arm/mach-zynq/include/mach/debug-macro.S b/arch/arm/include/debug/zynq.S
index 3ab0be1f619..f9aa9740a73 100644
--- a/arch/arm/mach-zynq/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/zynq.S
@@ -1,5 +1,4 @@
1/* arch/arm/mach-zynq/include/mach/debug-macro.S 1/*
2 *
3 * Debugging macro include header 2 * Debugging macro include header
4 * 3 *
5 * Copyright (C) 2011 Xilinx 4 * Copyright (C) 2011 Xilinx
@@ -13,9 +12,25 @@
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 13 * GNU General Public License for more details.
15 */ 14 */
15#define UART_CR_OFFSET 0x00 /* Control Register [8:0] */
16#define UART_SR_OFFSET 0x2C /* Channel Status [11:0] */
17#define UART_FIFO_OFFSET 0x30 /* FIFO [15:0] or [7:0] */
18
19#define UART_SR_TXFULL 0x00000010 /* TX FIFO full */
20#define UART_SR_TXEMPTY 0x00000008 /* TX FIFO empty */
21
22#define UART0_PHYS 0xE0000000
23#define UART1_PHYS 0xE0001000
24#define UART_SIZE SZ_4K
25#define UART_VIRT 0xF0001000
26
27#if IS_ENABLED(CONFIG_DEBUG_ZYNQ_UART1)
28# define LL_UART_PADDR UART1_PHYS
29#else
30# define LL_UART_PADDR UART0_PHYS
31#endif
16 32
17#include <mach/zynq_soc.h> 33#define LL_UART_VADDR UART_VIRT
18#include <mach/uart.h>
19 34
20 .macro addruart, rp, rv, tmp 35 .macro addruart, rp, rv, tmp
21 ldr \rp, =LL_UART_PADDR @ physical 36 ldr \rp, =LL_UART_PADDR @ physical
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 831cd38c8d9..5935b6a02e6 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -11,7 +11,7 @@
11 */ 11 */
12/* 0 */ CALL(sys_restart_syscall) 12/* 0 */ CALL(sys_restart_syscall)
13 CALL(sys_exit) 13 CALL(sys_exit)
14 CALL(sys_fork_wrapper) 14 CALL(sys_fork)
15 CALL(sys_read) 15 CALL(sys_read)
16 CALL(sys_write) 16 CALL(sys_write)
17/* 5 */ CALL(sys_open) 17/* 5 */ CALL(sys_open)
@@ -129,7 +129,7 @@
129 CALL(OBSOLETE(ABI(sys_ipc, sys_oabi_ipc))) 129 CALL(OBSOLETE(ABI(sys_ipc, sys_oabi_ipc)))
130 CALL(sys_fsync) 130 CALL(sys_fsync)
131 CALL(sys_sigreturn_wrapper) 131 CALL(sys_sigreturn_wrapper)
132/* 120 */ CALL(sys_clone_wrapper) 132/* 120 */ CALL(sys_clone)
133 CALL(sys_setdomainname) 133 CALL(sys_setdomainname)
134 CALL(sys_newuname) 134 CALL(sys_newuname)
135 CALL(sys_ni_syscall) /* modify_ldt */ 135 CALL(sys_ni_syscall) /* modify_ldt */
@@ -199,7 +199,7 @@
199 CALL(sys_sendfile) 199 CALL(sys_sendfile)
200 CALL(sys_ni_syscall) /* getpmsg */ 200 CALL(sys_ni_syscall) /* getpmsg */
201 CALL(sys_ni_syscall) /* putpmsg */ 201 CALL(sys_ni_syscall) /* putpmsg */
202/* 190 */ CALL(sys_vfork_wrapper) 202/* 190 */ CALL(sys_vfork)
203 CALL(sys_getrlimit) 203 CALL(sys_getrlimit)
204 CALL(sys_mmap2) 204 CALL(sys_mmap2)
205 CALL(ABI(sys_truncate64, sys_oabi_truncate64)) 205 CALL(ABI(sys_truncate64, sys_oabi_truncate64))
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index 66f711b2e0e..6809200c31f 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -100,6 +100,13 @@ ENTRY(printch)
100 b 1b 100 b 1b
101ENDPROC(printch) 101ENDPROC(printch)
102 102
103ENTRY(debug_ll_addr)
104 addruart r2, r3, ip
105 str r2, [r0]
106 str r3, [r1]
107 mov pc, lr
108ENDPROC(debug_ll_addr)
109
103#else 110#else
104 111
105ENTRY(printascii) 112ENTRY(printascii)
@@ -119,4 +126,11 @@ ENTRY(printch)
119 mov pc, lr 126 mov pc, lr
120ENDPROC(printch) 127ENDPROC(printch)
121 128
129ENTRY(debug_ll_addr)
130 mov r2, #0
131 str r2, [r0]
132 str r2, [r1]
133 mov pc, lr
134ENDPROC(debug_ll_addr)
135
122#endif 136#endif
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index bee7f9d47f0..70f1bdeb241 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -19,8 +19,10 @@
19#include <linux/of_irq.h> 19#include <linux/of_irq.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21 21
22#include <asm/cputype.h>
22#include <asm/setup.h> 23#include <asm/setup.h>
23#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/smp_plat.h>
24#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
25#include <asm/mach-types.h> 27#include <asm/mach-types.h>
26 28
@@ -61,6 +63,108 @@ void __init arm_dt_memblock_reserve(void)
61 } 63 }
62} 64}
63 65
66/*
67 * arm_dt_init_cpu_maps - Function retrieves cpu nodes from the device tree
68 * and builds the cpu logical map array containing MPIDR values related to
69 * logical cpus
70 *
71 * Updates the cpu possible mask with the number of parsed cpu nodes
72 */
73void __init arm_dt_init_cpu_maps(void)
74{
75 /*
76 * Temp logical map is initialized with UINT_MAX values that are
77 * considered invalid logical map entries since the logical map must
78 * contain a list of MPIDR[23:0] values where MPIDR[31:24] must
79 * read as 0.
80 */
81 struct device_node *cpu, *cpus;
82 u32 i, j, cpuidx = 1;
83 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
84
85 u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = UINT_MAX };
86 bool bootcpu_valid = false;
87 cpus = of_find_node_by_path("/cpus");
88
89 if (!cpus)
90 return;
91
92 for_each_child_of_node(cpus, cpu) {
93 u32 hwid;
94
95 pr_debug(" * %s...\n", cpu->full_name);
96 /*
97 * A device tree containing CPU nodes with missing "reg"
98 * properties is considered invalid to build the
99 * cpu_logical_map.
100 */
101 if (of_property_read_u32(cpu, "reg", &hwid)) {
102 pr_debug(" * %s missing reg property\n",
103 cpu->full_name);
104 return;
105 }
106
107 /*
108 * 8 MSBs must be set to 0 in the DT since the reg property
109 * defines the MPIDR[23:0].
110 */
111 if (hwid & ~MPIDR_HWID_BITMASK)
112 return;
113
114 /*
115 * Duplicate MPIDRs are a recipe for disaster.
116 * Scan all initialized entries and check for
117 * duplicates. If any is found just bail out.
118 * temp values were initialized to UINT_MAX
119 * to avoid matching valid MPIDR[23:0] values.
120 */
121 for (j = 0; j < cpuidx; j++)
122 if (WARN(tmp_map[j] == hwid, "Duplicate /cpu reg "
123 "properties in the DT\n"))
124 return;
125
126 /*
127 * Build a stashed array of MPIDR values. Numbering scheme
128 * requires that if detected the boot CPU must be assigned
129 * logical id 0. Other CPUs get sequential indexes starting
130 * from 1. If a CPU node with a reg property matching the
131 * boot CPU MPIDR is detected, this is recorded so that the
132 * logical map built from DT is validated and can be used
133 * to override the map created in smp_setup_processor_id().
134 */
135 if (hwid == mpidr) {
136 i = 0;
137 bootcpu_valid = true;
138 } else {
139 i = cpuidx++;
140 }
141
142 if (WARN(cpuidx > nr_cpu_ids, "DT /cpu %u nodes greater than "
143 "max cores %u, capping them\n",
144 cpuidx, nr_cpu_ids)) {
145 cpuidx = nr_cpu_ids;
146 break;
147 }
148
149 tmp_map[i] = hwid;
150 }
151
152 if (WARN(!bootcpu_valid, "DT missing boot CPU MPIDR[23:0], "
153 "fall back to default cpu_logical_map\n"))
154 return;
155
156 /*
157 * Since the boot CPU node contains proper data, and all nodes have
158 * a reg property, the DT CPU list can be considered valid and the
159 * logical map created in smp_setup_processor_id() can be overridden
160 */
161 for (i = 0; i < cpuidx; i++) {
162 set_cpu_possible(i, true);
163 cpu_logical_map(i) = tmp_map[i];
164 pr_debug("cpu logical map 0x%x\n", cpu_logical_map(i));
165 }
166}
167
64/** 168/**
65 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 169 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
66 * @dt_phys: physical address of dt blob 170 * @dt_phys: physical address of dt blob
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 34711757ba5..a6c301e90a3 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -417,16 +417,6 @@ local_restart:
417 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing 417 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
418 stmdb sp!, {r4, r5} @ push fifth and sixth args 418 stmdb sp!, {r4, r5} @ push fifth and sixth args
419 419
420#ifdef CONFIG_SECCOMP
421 tst r10, #_TIF_SECCOMP
422 beq 1f
423 mov r0, scno
424 bl __secure_computing
425 add r0, sp, #S_R0 + S_OFF @ pointer to regs
426 ldmia r0, {r0 - r3} @ have to reload r0 - r3
4271:
428#endif
429
430 tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? 420 tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls?
431 bne __sys_trace 421 bne __sys_trace
432 422
@@ -458,11 +448,13 @@ __sys_trace:
458 ldmccia r1, {r0 - r6} @ have to reload r0 - r6 448 ldmccia r1, {r0 - r6} @ have to reload r0 - r6
459 stmccia sp, {r4, r5} @ and update the stack args 449 stmccia sp, {r4, r5} @ and update the stack args
460 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine 450 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
461 b 2b 451 cmp scno, #-1 @ skip the syscall?
452 bne 2b
453 add sp, sp, #S_OFF @ restore stack
454 b ret_slow_syscall
462 455
463__sys_trace_return: 456__sys_trace_return:
464 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 457 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
465 mov r1, scno
466 mov r0, sp 458 mov r0, sp
467 bl syscall_trace_exit 459 bl syscall_trace_exit
468 b ret_slow_syscall 460 b ret_slow_syscall
@@ -510,22 +502,6 @@ sys_syscall:
510 b sys_ni_syscall 502 b sys_ni_syscall
511ENDPROC(sys_syscall) 503ENDPROC(sys_syscall)
512 504
513sys_fork_wrapper:
514 add r0, sp, #S_OFF
515 b sys_fork
516ENDPROC(sys_fork_wrapper)
517
518sys_vfork_wrapper:
519 add r0, sp, #S_OFF
520 b sys_vfork
521ENDPROC(sys_vfork_wrapper)
522
523sys_clone_wrapper:
524 add ip, sp, #S_OFF
525 str ip, [sp, #4]
526 b sys_clone
527ENDPROC(sys_clone_wrapper)
528
529sys_sigreturn_wrapper: 505sys_sigreturn_wrapper:
530 add r0, sp, #S_OFF 506 add r0, sp, #S_OFF
531 mov why, #0 @ prevent syscall restart handling 507 mov why, #0 @ prevent syscall restart handling
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 278cfc144f4..2c228a07e58 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -68,7 +68,7 @@ __after_proc_init:
68 * CP15 system control register value returned in r0 from 68 * CP15 system control register value returned in r0 from
69 * the CPU init function. 69 * the CPU init function.
70 */ 70 */
71#ifdef CONFIG_ALIGNMENT_TRAP 71#if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
72 orr r0, r0, #CR_A 72 orr r0, r0, #CR_A
73#else 73#else
74 bic r0, r0, #CR_A 74 bic r0, r0, #CR_A
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 281bf330124..5ff2e77782b 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -52,14 +52,14 @@ static u8 debug_arch;
52/* Maximum supported watchpoint length. */ 52/* Maximum supported watchpoint length. */
53static u8 max_watchpoint_len; 53static u8 max_watchpoint_len;
54 54
55#define READ_WB_REG_CASE(OP2, M, VAL) \ 55#define READ_WB_REG_CASE(OP2, M, VAL) \
56 case ((OP2 << 4) + M): \ 56 case ((OP2 << 4) + M): \
57 ARM_DBG_READ(c ## M, OP2, VAL); \ 57 ARM_DBG_READ(c0, c ## M, OP2, VAL); \
58 break 58 break
59 59
60#define WRITE_WB_REG_CASE(OP2, M, VAL) \ 60#define WRITE_WB_REG_CASE(OP2, M, VAL) \
61 case ((OP2 << 4) + M): \ 61 case ((OP2 << 4) + M): \
62 ARM_DBG_WRITE(c ## M, OP2, VAL);\ 62 ARM_DBG_WRITE(c0, c ## M, OP2, VAL); \
63 break 63 break
64 64
65#define GEN_READ_WB_REG_CASES(OP2, VAL) \ 65#define GEN_READ_WB_REG_CASES(OP2, VAL) \
@@ -136,12 +136,12 @@ static u8 get_debug_arch(void)
136 136
137 /* Do we implement the extended CPUID interface? */ 137 /* Do we implement the extended CPUID interface? */
138 if (((read_cpuid_id() >> 16) & 0xf) != 0xf) { 138 if (((read_cpuid_id() >> 16) & 0xf) != 0xf) {
139 pr_warning("CPUID feature registers not supported. " 139 pr_warn_once("CPUID feature registers not supported. "
140 "Assuming v6 debug is present.\n"); 140 "Assuming v6 debug is present.\n");
141 return ARM_DEBUG_ARCH_V6; 141 return ARM_DEBUG_ARCH_V6;
142 } 142 }
143 143
144 ARM_DBG_READ(c0, 0, didr); 144 ARM_DBG_READ(c0, c0, 0, didr);
145 return (didr >> 16) & 0xf; 145 return (didr >> 16) & 0xf;
146} 146}
147 147
@@ -169,7 +169,7 @@ static int debug_exception_updates_fsr(void)
169static int get_num_wrp_resources(void) 169static int get_num_wrp_resources(void)
170{ 170{
171 u32 didr; 171 u32 didr;
172 ARM_DBG_READ(c0, 0, didr); 172 ARM_DBG_READ(c0, c0, 0, didr);
173 return ((didr >> 28) & 0xf) + 1; 173 return ((didr >> 28) & 0xf) + 1;
174} 174}
175 175
@@ -177,7 +177,7 @@ static int get_num_wrp_resources(void)
177static int get_num_brp_resources(void) 177static int get_num_brp_resources(void)
178{ 178{
179 u32 didr; 179 u32 didr;
180 ARM_DBG_READ(c0, 0, didr); 180 ARM_DBG_READ(c0, c0, 0, didr);
181 return ((didr >> 24) & 0xf) + 1; 181 return ((didr >> 24) & 0xf) + 1;
182} 182}
183 183
@@ -228,19 +228,17 @@ static int get_num_brps(void)
228 * be put into halting debug mode at any time by an external debugger 228 * be put into halting debug mode at any time by an external debugger
229 * but there is nothing we can do to prevent that. 229 * but there is nothing we can do to prevent that.
230 */ 230 */
231static int enable_monitor_mode(void) 231static int monitor_mode_enabled(void)
232{ 232{
233 u32 dscr; 233 u32 dscr;
234 int ret = 0; 234 ARM_DBG_READ(c0, c1, 0, dscr);
235 235 return !!(dscr & ARM_DSCR_MDBGEN);
236 ARM_DBG_READ(c1, 0, dscr); 236}
237 237
238 /* Ensure that halting mode is disabled. */ 238static int enable_monitor_mode(void)
239 if (WARN_ONCE(dscr & ARM_DSCR_HDBGEN, 239{
240 "halting debug mode enabled. Unable to access hardware resources.\n")) { 240 u32 dscr;
241 ret = -EPERM; 241 ARM_DBG_READ(c0, c1, 0, dscr);
242 goto out;
243 }
244 242
245 /* If monitor mode is already enabled, just return. */ 243 /* If monitor mode is already enabled, just return. */
246 if (dscr & ARM_DSCR_MDBGEN) 244 if (dscr & ARM_DSCR_MDBGEN)
@@ -250,24 +248,27 @@ static int enable_monitor_mode(void)
250 switch (get_debug_arch()) { 248 switch (get_debug_arch()) {
251 case ARM_DEBUG_ARCH_V6: 249 case ARM_DEBUG_ARCH_V6:
252 case ARM_DEBUG_ARCH_V6_1: 250 case ARM_DEBUG_ARCH_V6_1:
253 ARM_DBG_WRITE(c1, 0, (dscr | ARM_DSCR_MDBGEN)); 251 ARM_DBG_WRITE(c0, c1, 0, (dscr | ARM_DSCR_MDBGEN));
254 break; 252 break;
255 case ARM_DEBUG_ARCH_V7_ECP14: 253 case ARM_DEBUG_ARCH_V7_ECP14:
256 case ARM_DEBUG_ARCH_V7_1: 254 case ARM_DEBUG_ARCH_V7_1:
257 ARM_DBG_WRITE(c2, 2, (dscr | ARM_DSCR_MDBGEN)); 255 ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
256 isb();
258 break; 257 break;
259 default: 258 default:
260 ret = -ENODEV; 259 return -ENODEV;
261 goto out;
262 } 260 }
263 261
264 /* Check that the write made it through. */ 262 /* Check that the write made it through. */
265 ARM_DBG_READ(c1, 0, dscr); 263 ARM_DBG_READ(c0, c1, 0, dscr);
266 if (!(dscr & ARM_DSCR_MDBGEN)) 264 if (!(dscr & ARM_DSCR_MDBGEN)) {
267 ret = -EPERM; 265 pr_warn_once("Failed to enable monitor mode on CPU %d.\n",
266 smp_processor_id());
267 return -EPERM;
268 }
268 269
269out: 270out:
270 return ret; 271 return 0;
271} 272}
272 273
273int hw_breakpoint_slots(int type) 274int hw_breakpoint_slots(int type)
@@ -328,14 +329,9 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
328{ 329{
329 struct arch_hw_breakpoint *info = counter_arch_bp(bp); 330 struct arch_hw_breakpoint *info = counter_arch_bp(bp);
330 struct perf_event **slot, **slots; 331 struct perf_event **slot, **slots;
331 int i, max_slots, ctrl_base, val_base, ret = 0; 332 int i, max_slots, ctrl_base, val_base;
332 u32 addr, ctrl; 333 u32 addr, ctrl;
333 334
334 /* Ensure that we are in monitor mode and halting mode is disabled. */
335 ret = enable_monitor_mode();
336 if (ret)
337 goto out;
338
339 addr = info->address; 335 addr = info->address;
340 ctrl = encode_ctrl_reg(info->ctrl) | 0x1; 336 ctrl = encode_ctrl_reg(info->ctrl) | 0x1;
341 337
@@ -362,9 +358,9 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
362 } 358 }
363 } 359 }
364 360
365 if (WARN_ONCE(i == max_slots, "Can't find any breakpoint slot\n")) { 361 if (i == max_slots) {
366 ret = -EBUSY; 362 pr_warning("Can't find any breakpoint slot\n");
367 goto out; 363 return -EBUSY;
368 } 364 }
369 365
370 /* Override the breakpoint data with the step data. */ 366 /* Override the breakpoint data with the step data. */
@@ -383,9 +379,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
383 379
384 /* Setup the control register. */ 380 /* Setup the control register. */
385 write_wb_reg(ctrl_base + i, ctrl); 381 write_wb_reg(ctrl_base + i, ctrl);
386 382 return 0;
387out:
388 return ret;
389} 383}
390 384
391void arch_uninstall_hw_breakpoint(struct perf_event *bp) 385void arch_uninstall_hw_breakpoint(struct perf_event *bp)
@@ -416,8 +410,10 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
416 } 410 }
417 } 411 }
418 412
419 if (WARN_ONCE(i == max_slots, "Can't find any breakpoint slot\n")) 413 if (i == max_slots) {
414 pr_warning("Can't find any breakpoint slot\n");
420 return; 415 return;
416 }
421 417
422 /* Ensure that we disable the mismatch breakpoint. */ 418 /* Ensure that we disable the mismatch breakpoint. */
423 if (info->ctrl.type != ARM_BREAKPOINT_EXECUTE && 419 if (info->ctrl.type != ARM_BREAKPOINT_EXECUTE &&
@@ -596,6 +592,10 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
596 int ret = 0; 592 int ret = 0;
597 u32 offset, alignment_mask = 0x3; 593 u32 offset, alignment_mask = 0x3;
598 594
595 /* Ensure that we are in monitor debug mode. */
596 if (!monitor_mode_enabled())
597 return -ENODEV;
598
599 /* Build the arch_hw_breakpoint. */ 599 /* Build the arch_hw_breakpoint. */
600 ret = arch_build_bp_info(bp); 600 ret = arch_build_bp_info(bp);
601 if (ret) 601 if (ret)
@@ -858,7 +858,7 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
858 local_irq_enable(); 858 local_irq_enable();
859 859
860 /* We only handle watchpoints and hardware breakpoints. */ 860 /* We only handle watchpoints and hardware breakpoints. */
861 ARM_DBG_READ(c1, 0, dscr); 861 ARM_DBG_READ(c0, c1, 0, dscr);
862 862
863 /* Perform perf callbacks. */ 863 /* Perform perf callbacks. */
864 switch (ARM_DSCR_MOE(dscr)) { 864 switch (ARM_DSCR_MOE(dscr)) {
@@ -906,7 +906,7 @@ static struct undef_hook debug_reg_hook = {
906static void reset_ctrl_regs(void *unused) 906static void reset_ctrl_regs(void *unused)
907{ 907{
908 int i, raw_num_brps, err = 0, cpu = smp_processor_id(); 908 int i, raw_num_brps, err = 0, cpu = smp_processor_id();
909 u32 dbg_power; 909 u32 val;
910 910
911 /* 911 /*
912 * v7 debug contains save and restore registers so that debug state 912 * v7 debug contains save and restore registers so that debug state
@@ -919,23 +919,30 @@ static void reset_ctrl_regs(void *unused)
919 switch (debug_arch) { 919 switch (debug_arch) {
920 case ARM_DEBUG_ARCH_V6: 920 case ARM_DEBUG_ARCH_V6:
921 case ARM_DEBUG_ARCH_V6_1: 921 case ARM_DEBUG_ARCH_V6_1:
922 /* ARMv6 cores just need to reset the registers. */ 922 /* ARMv6 cores clear the registers out of reset. */
923 goto reset_regs; 923 goto out_mdbgen;
924 case ARM_DEBUG_ARCH_V7_ECP14: 924 case ARM_DEBUG_ARCH_V7_ECP14:
925 /* 925 /*
926 * Ensure sticky power-down is clear (i.e. debug logic is 926 * Ensure sticky power-down is clear (i.e. debug logic is
927 * powered up). 927 * powered up).
928 */ 928 */
929 asm volatile("mrc p14, 0, %0, c1, c5, 4" : "=r" (dbg_power)); 929 ARM_DBG_READ(c1, c5, 4, val);
930 if ((dbg_power & 0x1) == 0) 930 if ((val & 0x1) == 0)
931 err = -EPERM; 931 err = -EPERM;
932
933 /*
934 * Check whether we implement OS save and restore.
935 */
936 ARM_DBG_READ(c1, c1, 4, val);
937 if ((val & 0x9) == 0)
938 goto clear_vcr;
932 break; 939 break;
933 case ARM_DEBUG_ARCH_V7_1: 940 case ARM_DEBUG_ARCH_V7_1:
934 /* 941 /*
935 * Ensure the OS double lock is clear. 942 * Ensure the OS double lock is clear.
936 */ 943 */
937 asm volatile("mrc p14, 0, %0, c1, c3, 4" : "=r" (dbg_power)); 944 ARM_DBG_READ(c1, c3, 4, val);
938 if ((dbg_power & 0x1) == 1) 945 if ((val & 0x1) == 1)
939 err = -EPERM; 946 err = -EPERM;
940 break; 947 break;
941 } 948 }
@@ -947,24 +954,29 @@ static void reset_ctrl_regs(void *unused)
947 } 954 }
948 955
949 /* 956 /*
950 * Unconditionally clear the lock by writing a value 957 * Unconditionally clear the OS lock by writing a value
951 * other than 0xC5ACCE55 to the access register. 958 * other than 0xC5ACCE55 to the access register.
952 */ 959 */
953 asm volatile("mcr p14, 0, %0, c1, c0, 4" : : "r" (0)); 960 ARM_DBG_WRITE(c1, c0, 4, 0);
954 isb(); 961 isb();
955 962
956 /* 963 /*
957 * Clear any configured vector-catch events before 964 * Clear any configured vector-catch events before
958 * enabling monitor mode. 965 * enabling monitor mode.
959 */ 966 */
960 asm volatile("mcr p14, 0, %0, c0, c7, 0" : : "r" (0)); 967clear_vcr:
968 ARM_DBG_WRITE(c0, c7, 0, 0);
961 isb(); 969 isb();
962 970
963reset_regs: 971 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
964 if (enable_monitor_mode()) 972 pr_warning("CPU %d failed to disable vector catch\n", cpu);
965 return; 973 return;
974 }
966 975
967 /* We must also reset any reserved registers. */ 976 /*
977 * The control/value register pairs are UNKNOWN out of reset so
978 * clear them to avoid spurious debug events.
979 */
968 raw_num_brps = get_num_brp_resources(); 980 raw_num_brps = get_num_brp_resources();
969 for (i = 0; i < raw_num_brps; ++i) { 981 for (i = 0; i < raw_num_brps; ++i) {
970 write_wb_reg(ARM_BASE_BCR + i, 0UL); 982 write_wb_reg(ARM_BASE_BCR + i, 0UL);
@@ -975,6 +987,19 @@ reset_regs:
975 write_wb_reg(ARM_BASE_WCR + i, 0UL); 987 write_wb_reg(ARM_BASE_WCR + i, 0UL);
976 write_wb_reg(ARM_BASE_WVR + i, 0UL); 988 write_wb_reg(ARM_BASE_WVR + i, 0UL);
977 } 989 }
990
991 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
992 pr_warning("CPU %d failed to clear debug register pairs\n", cpu);
993 return;
994 }
995
996 /*
997 * Have a crack at enabling monitor mode. We don't actually need
998 * it yet, but reporting an error early is useful if it fails.
999 */
1000out_mdbgen:
1001 if (enable_monitor_mode())
1002 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu));
978} 1003}
979 1004
980static int __cpuinit dbg_reset_notify(struct notifier_block *self, 1005static int __cpuinit dbg_reset_notify(struct notifier_block *self,
@@ -992,8 +1017,6 @@ static struct notifier_block __cpuinitdata dbg_reset_nb = {
992 1017
993static int __init arch_hw_breakpoint_init(void) 1018static int __init arch_hw_breakpoint_init(void)
994{ 1019{
995 u32 dscr;
996
997 debug_arch = get_debug_arch(); 1020 debug_arch = get_debug_arch();
998 1021
999 if (!debug_arch_supported()) { 1022 if (!debug_arch_supported()) {
@@ -1028,17 +1051,10 @@ static int __init arch_hw_breakpoint_init(void)
1028 core_num_brps, core_has_mismatch_brps() ? "(+1 reserved) " : 1051 core_num_brps, core_has_mismatch_brps() ? "(+1 reserved) " :
1029 "", core_num_wrps); 1052 "", core_num_wrps);
1030 1053
1031 ARM_DBG_READ(c1, 0, dscr); 1054 /* Work out the maximum supported watchpoint length. */
1032 if (dscr & ARM_DSCR_HDBGEN) { 1055 max_watchpoint_len = get_max_wp_len();
1033 max_watchpoint_len = 4; 1056 pr_info("maximum watchpoint size is %u bytes.\n",
1034 pr_warning("halting debug mode enabled. Assuming maximum watchpoint size of %u bytes.\n", 1057 max_watchpoint_len);
1035 max_watchpoint_len);
1036 } else {
1037 /* Work out the maximum supported watchpoint length. */
1038 max_watchpoint_len = get_max_wp_len();
1039 pr_info("maximum watchpoint size is %u bytes.\n",
1040 max_watchpoint_len);
1041 }
1042 1058
1043 /* Register debug fault handler. */ 1059 /* Register debug fault handler. */
1044 hook_fault_code(FAULT_CODE_DEBUG, hw_breakpoint_pending, SIGTRAP, 1060 hook_fault_code(FAULT_CODE_DEBUG, hw_breakpoint_pending, SIGTRAP,
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 1862d8f2fd4..0cd63d080c7 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -1598,7 +1598,7 @@ static int __init run_all_tests(void)
1598{ 1598{
1599 int ret = 0; 1599 int ret = 0;
1600 1600
1601 pr_info("Begining kprobe tests...\n"); 1601 pr_info("Beginning kprobe tests...\n");
1602 1602
1603#ifndef CONFIG_THUMB2_KERNEL 1603#ifndef CONFIG_THUMB2_KERNEL
1604 1604
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 53c0304b734..f9e8657dd24 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -86,12 +86,10 @@ armpmu_map_event(struct perf_event *event,
86 return -ENOENT; 86 return -ENOENT;
87} 87}
88 88
89int 89int armpmu_event_set_period(struct perf_event *event)
90armpmu_event_set_period(struct perf_event *event,
91 struct hw_perf_event *hwc,
92 int idx)
93{ 90{
94 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 91 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
92 struct hw_perf_event *hwc = &event->hw;
95 s64 left = local64_read(&hwc->period_left); 93 s64 left = local64_read(&hwc->period_left);
96 s64 period = hwc->sample_period; 94 s64 period = hwc->sample_period;
97 int ret = 0; 95 int ret = 0;
@@ -119,24 +117,22 @@ armpmu_event_set_period(struct perf_event *event,
119 117
120 local64_set(&hwc->prev_count, (u64)-left); 118 local64_set(&hwc->prev_count, (u64)-left);
121 119
122 armpmu->write_counter(idx, (u64)(-left) & 0xffffffff); 120 armpmu->write_counter(event, (u64)(-left) & 0xffffffff);
123 121
124 perf_event_update_userpage(event); 122 perf_event_update_userpage(event);
125 123
126 return ret; 124 return ret;
127} 125}
128 126
129u64 127u64 armpmu_event_update(struct perf_event *event)
130armpmu_event_update(struct perf_event *event,
131 struct hw_perf_event *hwc,
132 int idx)
133{ 128{
134 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 129 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
130 struct hw_perf_event *hwc = &event->hw;
135 u64 delta, prev_raw_count, new_raw_count; 131 u64 delta, prev_raw_count, new_raw_count;
136 132
137again: 133again:
138 prev_raw_count = local64_read(&hwc->prev_count); 134 prev_raw_count = local64_read(&hwc->prev_count);
139 new_raw_count = armpmu->read_counter(idx); 135 new_raw_count = armpmu->read_counter(event);
140 136
141 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, 137 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
142 new_raw_count) != prev_raw_count) 138 new_raw_count) != prev_raw_count)
@@ -159,7 +155,7 @@ armpmu_read(struct perf_event *event)
159 if (hwc->idx < 0) 155 if (hwc->idx < 0)
160 return; 156 return;
161 157
162 armpmu_event_update(event, hwc, hwc->idx); 158 armpmu_event_update(event);
163} 159}
164 160
165static void 161static void
@@ -173,14 +169,13 @@ armpmu_stop(struct perf_event *event, int flags)
173 * PERF_EF_UPDATE, see comments in armpmu_start(). 169 * PERF_EF_UPDATE, see comments in armpmu_start().
174 */ 170 */
175 if (!(hwc->state & PERF_HES_STOPPED)) { 171 if (!(hwc->state & PERF_HES_STOPPED)) {
176 armpmu->disable(hwc, hwc->idx); 172 armpmu->disable(event);
177 armpmu_event_update(event, hwc, hwc->idx); 173 armpmu_event_update(event);
178 hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE; 174 hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
179 } 175 }
180} 176}
181 177
182static void 178static void armpmu_start(struct perf_event *event, int flags)
183armpmu_start(struct perf_event *event, int flags)
184{ 179{
185 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 180 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
186 struct hw_perf_event *hwc = &event->hw; 181 struct hw_perf_event *hwc = &event->hw;
@@ -200,8 +195,8 @@ armpmu_start(struct perf_event *event, int flags)
200 * get an interrupt too soon or *way* too late if the overflow has 195 * get an interrupt too soon or *way* too late if the overflow has
201 * happened since disabling. 196 * happened since disabling.
202 */ 197 */
203 armpmu_event_set_period(event, hwc, hwc->idx); 198 armpmu_event_set_period(event);
204 armpmu->enable(hwc, hwc->idx); 199 armpmu->enable(event);
205} 200}
206 201
207static void 202static void
@@ -233,7 +228,7 @@ armpmu_add(struct perf_event *event, int flags)
233 perf_pmu_disable(event->pmu); 228 perf_pmu_disable(event->pmu);
234 229
235 /* If we don't have a space for the counter then finish early. */ 230 /* If we don't have a space for the counter then finish early. */
236 idx = armpmu->get_event_idx(hw_events, hwc); 231 idx = armpmu->get_event_idx(hw_events, event);
237 if (idx < 0) { 232 if (idx < 0) {
238 err = idx; 233 err = idx;
239 goto out; 234 goto out;
@@ -244,7 +239,7 @@ armpmu_add(struct perf_event *event, int flags)
244 * sure it is disabled. 239 * sure it is disabled.
245 */ 240 */
246 event->hw.idx = idx; 241 event->hw.idx = idx;
247 armpmu->disable(hwc, idx); 242 armpmu->disable(event);
248 hw_events->events[idx] = event; 243 hw_events->events[idx] = event;
249 244
250 hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE; 245 hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
@@ -264,13 +259,12 @@ validate_event(struct pmu_hw_events *hw_events,
264 struct perf_event *event) 259 struct perf_event *event)
265{ 260{
266 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 261 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
267 struct hw_perf_event fake_event = event->hw;
268 struct pmu *leader_pmu = event->group_leader->pmu; 262 struct pmu *leader_pmu = event->group_leader->pmu;
269 263
270 if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF) 264 if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF)
271 return 1; 265 return 1;
272 266
273 return armpmu->get_event_idx(hw_events, &fake_event) >= 0; 267 return armpmu->get_event_idx(hw_events, event) >= 0;
274} 268}
275 269
276static int 270static int
@@ -316,7 +310,7 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev)
316static void 310static void
317armpmu_release_hardware(struct arm_pmu *armpmu) 311armpmu_release_hardware(struct arm_pmu *armpmu)
318{ 312{
319 armpmu->free_irq(); 313 armpmu->free_irq(armpmu);
320 pm_runtime_put_sync(&armpmu->plat_device->dev); 314 pm_runtime_put_sync(&armpmu->plat_device->dev);
321} 315}
322 316
@@ -330,7 +324,7 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)
330 return -ENODEV; 324 return -ENODEV;
331 325
332 pm_runtime_get_sync(&pmu_device->dev); 326 pm_runtime_get_sync(&pmu_device->dev);
333 err = armpmu->request_irq(armpmu_dispatch_irq); 327 err = armpmu->request_irq(armpmu, armpmu_dispatch_irq);
334 if (err) { 328 if (err) {
335 armpmu_release_hardware(armpmu); 329 armpmu_release_hardware(armpmu);
336 return err; 330 return err;
@@ -465,13 +459,13 @@ static void armpmu_enable(struct pmu *pmu)
465 int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events); 459 int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events);
466 460
467 if (enabled) 461 if (enabled)
468 armpmu->start(); 462 armpmu->start(armpmu);
469} 463}
470 464
471static void armpmu_disable(struct pmu *pmu) 465static void armpmu_disable(struct pmu *pmu)
472{ 466{
473 struct arm_pmu *armpmu = to_arm_pmu(pmu); 467 struct arm_pmu *armpmu = to_arm_pmu(pmu);
474 armpmu->stop(); 468 armpmu->stop(armpmu);
475} 469}
476 470
477#ifdef CONFIG_PM_RUNTIME 471#ifdef CONFIG_PM_RUNTIME
@@ -517,12 +511,13 @@ static void __init armpmu_init(struct arm_pmu *armpmu)
517 }; 511 };
518} 512}
519 513
520int armpmu_register(struct arm_pmu *armpmu, char *name, int type) 514int armpmu_register(struct arm_pmu *armpmu, int type)
521{ 515{
522 armpmu_init(armpmu); 516 armpmu_init(armpmu);
517 pm_runtime_enable(&armpmu->plat_device->dev);
523 pr_info("enabled with %s PMU driver, %d counters available\n", 518 pr_info("enabled with %s PMU driver, %d counters available\n",
524 armpmu->name, armpmu->num_events); 519 armpmu->name, armpmu->num_events);
525 return perf_pmu_register(&armpmu->pmu, name, type); 520 return perf_pmu_register(&armpmu->pmu, armpmu->name, type);
526} 521}
527 522
528/* 523/*
@@ -576,6 +571,10 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
576{ 571{
577 struct frame_tail __user *tail; 572 struct frame_tail __user *tail;
578 573
574 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
575 /* We don't support guest os callchain now */
576 return;
577 }
579 578
580 tail = (struct frame_tail __user *)regs->ARM_fp - 1; 579 tail = (struct frame_tail __user *)regs->ARM_fp - 1;
581 580
@@ -603,9 +602,41 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
603{ 602{
604 struct stackframe fr; 603 struct stackframe fr;
605 604
605 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
606 /* We don't support guest os callchain now */
607 return;
608 }
609
606 fr.fp = regs->ARM_fp; 610 fr.fp = regs->ARM_fp;
607 fr.sp = regs->ARM_sp; 611 fr.sp = regs->ARM_sp;
608 fr.lr = regs->ARM_lr; 612 fr.lr = regs->ARM_lr;
609 fr.pc = regs->ARM_pc; 613 fr.pc = regs->ARM_pc;
610 walk_stackframe(&fr, callchain_trace, entry); 614 walk_stackframe(&fr, callchain_trace, entry);
611} 615}
616
617unsigned long perf_instruction_pointer(struct pt_regs *regs)
618{
619 if (perf_guest_cbs && perf_guest_cbs->is_in_guest())
620 return perf_guest_cbs->get_guest_ip();
621
622 return instruction_pointer(regs);
623}
624
625unsigned long perf_misc_flags(struct pt_regs *regs)
626{
627 int misc = 0;
628
629 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
630 if (perf_guest_cbs->is_user_mode())
631 misc |= PERF_RECORD_MISC_GUEST_USER;
632 else
633 misc |= PERF_RECORD_MISC_GUEST_KERNEL;
634 } else {
635 if (user_mode(regs))
636 misc |= PERF_RECORD_MISC_USER;
637 else
638 misc |= PERF_RECORD_MISC_KERNEL;
639 }
640
641 return misc;
642}
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index 8d7d8d4de9d..9a4f6307a01 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -23,6 +23,7 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/slab.h>
26#include <linux/spinlock.h> 27#include <linux/spinlock.h>
27 28
28#include <asm/cputype.h> 29#include <asm/cputype.h>
@@ -45,7 +46,7 @@ const char *perf_pmu_name(void)
45 if (!cpu_pmu) 46 if (!cpu_pmu)
46 return NULL; 47 return NULL;
47 48
48 return cpu_pmu->pmu.name; 49 return cpu_pmu->name;
49} 50}
50EXPORT_SYMBOL_GPL(perf_pmu_name); 51EXPORT_SYMBOL_GPL(perf_pmu_name);
51 52
@@ -70,7 +71,7 @@ static struct pmu_hw_events *cpu_pmu_get_cpu_events(void)
70 return &__get_cpu_var(cpu_hw_events); 71 return &__get_cpu_var(cpu_hw_events);
71} 72}
72 73
73static void cpu_pmu_free_irq(void) 74static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
74{ 75{
75 int i, irq, irqs; 76 int i, irq, irqs;
76 struct platform_device *pmu_device = cpu_pmu->plat_device; 77 struct platform_device *pmu_device = cpu_pmu->plat_device;
@@ -86,7 +87,7 @@ static void cpu_pmu_free_irq(void)
86 } 87 }
87} 88}
88 89
89static int cpu_pmu_request_irq(irq_handler_t handler) 90static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
90{ 91{
91 int i, err, irq, irqs; 92 int i, err, irq, irqs;
92 struct platform_device *pmu_device = cpu_pmu->plat_device; 93 struct platform_device *pmu_device = cpu_pmu->plat_device;
@@ -147,7 +148,7 @@ static void __devinit cpu_pmu_init(struct arm_pmu *cpu_pmu)
147 148
148 /* Ensure the PMU has sane values out of reset. */ 149 /* Ensure the PMU has sane values out of reset. */
149 if (cpu_pmu && cpu_pmu->reset) 150 if (cpu_pmu && cpu_pmu->reset)
150 on_each_cpu(cpu_pmu->reset, NULL, 1); 151 on_each_cpu(cpu_pmu->reset, cpu_pmu, 1);
151} 152}
152 153
153/* 154/*
@@ -163,7 +164,9 @@ static int __cpuinit cpu_pmu_notify(struct notifier_block *b,
163 return NOTIFY_DONE; 164 return NOTIFY_DONE;
164 165
165 if (cpu_pmu && cpu_pmu->reset) 166 if (cpu_pmu && cpu_pmu->reset)
166 cpu_pmu->reset(NULL); 167 cpu_pmu->reset(cpu_pmu);
168 else
169 return NOTIFY_DONE;
167 170
168 return NOTIFY_OK; 171 return NOTIFY_OK;
169} 172}
@@ -195,13 +198,13 @@ static struct platform_device_id __devinitdata cpu_pmu_plat_device_ids[] = {
195/* 198/*
196 * CPU PMU identification and probing. 199 * CPU PMU identification and probing.
197 */ 200 */
198static struct arm_pmu *__devinit probe_current_pmu(void) 201static int __devinit probe_current_pmu(struct arm_pmu *pmu)
199{ 202{
200 struct arm_pmu *pmu = NULL;
201 int cpu = get_cpu(); 203 int cpu = get_cpu();
202 unsigned long cpuid = read_cpuid_id(); 204 unsigned long cpuid = read_cpuid_id();
203 unsigned long implementor = (cpuid & 0xFF000000) >> 24; 205 unsigned long implementor = (cpuid & 0xFF000000) >> 24;
204 unsigned long part_number = (cpuid & 0xFFF0); 206 unsigned long part_number = (cpuid & 0xFFF0);
207 int ret = -ENODEV;
205 208
206 pr_info("probing PMU on CPU %d\n", cpu); 209 pr_info("probing PMU on CPU %d\n", cpu);
207 210
@@ -211,25 +214,25 @@ static struct arm_pmu *__devinit probe_current_pmu(void)
211 case 0xB360: /* ARM1136 */ 214 case 0xB360: /* ARM1136 */
212 case 0xB560: /* ARM1156 */ 215 case 0xB560: /* ARM1156 */
213 case 0xB760: /* ARM1176 */ 216 case 0xB760: /* ARM1176 */
214 pmu = armv6pmu_init(); 217 ret = armv6pmu_init(pmu);
215 break; 218 break;
216 case 0xB020: /* ARM11mpcore */ 219 case 0xB020: /* ARM11mpcore */
217 pmu = armv6mpcore_pmu_init(); 220 ret = armv6mpcore_pmu_init(pmu);
218 break; 221 break;
219 case 0xC080: /* Cortex-A8 */ 222 case 0xC080: /* Cortex-A8 */
220 pmu = armv7_a8_pmu_init(); 223 ret = armv7_a8_pmu_init(pmu);
221 break; 224 break;
222 case 0xC090: /* Cortex-A9 */ 225 case 0xC090: /* Cortex-A9 */
223 pmu = armv7_a9_pmu_init(); 226 ret = armv7_a9_pmu_init(pmu);
224 break; 227 break;
225 case 0xC050: /* Cortex-A5 */ 228 case 0xC050: /* Cortex-A5 */
226 pmu = armv7_a5_pmu_init(); 229 ret = armv7_a5_pmu_init(pmu);
227 break; 230 break;
228 case 0xC0F0: /* Cortex-A15 */ 231 case 0xC0F0: /* Cortex-A15 */
229 pmu = armv7_a15_pmu_init(); 232 ret = armv7_a15_pmu_init(pmu);
230 break; 233 break;
231 case 0xC070: /* Cortex-A7 */ 234 case 0xC070: /* Cortex-A7 */
232 pmu = armv7_a7_pmu_init(); 235 ret = armv7_a7_pmu_init(pmu);
233 break; 236 break;
234 } 237 }
235 /* Intel CPUs [xscale]. */ 238 /* Intel CPUs [xscale]. */
@@ -237,43 +240,54 @@ static struct arm_pmu *__devinit probe_current_pmu(void)
237 part_number = (cpuid >> 13) & 0x7; 240 part_number = (cpuid >> 13) & 0x7;
238 switch (part_number) { 241 switch (part_number) {
239 case 1: 242 case 1:
240 pmu = xscale1pmu_init(); 243 ret = xscale1pmu_init(pmu);
241 break; 244 break;
242 case 2: 245 case 2:
243 pmu = xscale2pmu_init(); 246 ret = xscale2pmu_init(pmu);
244 break; 247 break;
245 } 248 }
246 } 249 }
247 250
248 put_cpu(); 251 put_cpu();
249 return pmu; 252 return ret;
250} 253}
251 254
252static int __devinit cpu_pmu_device_probe(struct platform_device *pdev) 255static int __devinit cpu_pmu_device_probe(struct platform_device *pdev)
253{ 256{
254 const struct of_device_id *of_id; 257 const struct of_device_id *of_id;
255 struct arm_pmu *(*init_fn)(void); 258 int (*init_fn)(struct arm_pmu *);
256 struct device_node *node = pdev->dev.of_node; 259 struct device_node *node = pdev->dev.of_node;
260 struct arm_pmu *pmu;
261 int ret = -ENODEV;
257 262
258 if (cpu_pmu) { 263 if (cpu_pmu) {
259 pr_info("attempt to register multiple PMU devices!"); 264 pr_info("attempt to register multiple PMU devices!");
260 return -ENOSPC; 265 return -ENOSPC;
261 } 266 }
262 267
268 pmu = kzalloc(sizeof(struct arm_pmu), GFP_KERNEL);
269 if (!pmu) {
270 pr_info("failed to allocate PMU device!");
271 return -ENOMEM;
272 }
273
263 if (node && (of_id = of_match_node(cpu_pmu_of_device_ids, pdev->dev.of_node))) { 274 if (node && (of_id = of_match_node(cpu_pmu_of_device_ids, pdev->dev.of_node))) {
264 init_fn = of_id->data; 275 init_fn = of_id->data;
265 cpu_pmu = init_fn(); 276 ret = init_fn(pmu);
266 } else { 277 } else {
267 cpu_pmu = probe_current_pmu(); 278 ret = probe_current_pmu(pmu);
268 } 279 }
269 280
270 if (!cpu_pmu) 281 if (ret) {
271 return -ENODEV; 282 pr_info("failed to register PMU devices!");
283 kfree(pmu);
284 return ret;
285 }
272 286
287 cpu_pmu = pmu;
273 cpu_pmu->plat_device = pdev; 288 cpu_pmu->plat_device = pdev;
274 cpu_pmu_init(cpu_pmu); 289 cpu_pmu_init(cpu_pmu);
275 register_cpu_notifier(&cpu_pmu_hotplug_notifier); 290 armpmu_register(cpu_pmu, PERF_TYPE_RAW);
276 armpmu_register(cpu_pmu, cpu_pmu->name, PERF_TYPE_RAW);
277 291
278 return 0; 292 return 0;
279} 293}
@@ -290,6 +304,16 @@ static struct platform_driver cpu_pmu_driver = {
290 304
291static int __init register_pmu_driver(void) 305static int __init register_pmu_driver(void)
292{ 306{
293 return platform_driver_register(&cpu_pmu_driver); 307 int err;
308
309 err = register_cpu_notifier(&cpu_pmu_hotplug_notifier);
310 if (err)
311 return err;
312
313 err = platform_driver_register(&cpu_pmu_driver);
314 if (err)
315 unregister_cpu_notifier(&cpu_pmu_hotplug_notifier);
316
317 return err;
294} 318}
295device_initcall(register_pmu_driver); 319device_initcall(register_pmu_driver);
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c
index 6ccc0797174..f3e22ff8b6a 100644
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -401,9 +401,10 @@ armv6_pmcr_counter_has_overflowed(unsigned long pmcr,
401 return ret; 401 return ret;
402} 402}
403 403
404static inline u32 404static inline u32 armv6pmu_read_counter(struct perf_event *event)
405armv6pmu_read_counter(int counter)
406{ 405{
406 struct hw_perf_event *hwc = &event->hw;
407 int counter = hwc->idx;
407 unsigned long value = 0; 408 unsigned long value = 0;
408 409
409 if (ARMV6_CYCLE_COUNTER == counter) 410 if (ARMV6_CYCLE_COUNTER == counter)
@@ -418,10 +419,11 @@ armv6pmu_read_counter(int counter)
418 return value; 419 return value;
419} 420}
420 421
421static inline void 422static inline void armv6pmu_write_counter(struct perf_event *event, u32 value)
422armv6pmu_write_counter(int counter,
423 u32 value)
424{ 423{
424 struct hw_perf_event *hwc = &event->hw;
425 int counter = hwc->idx;
426
425 if (ARMV6_CYCLE_COUNTER == counter) 427 if (ARMV6_CYCLE_COUNTER == counter)
426 asm volatile("mcr p15, 0, %0, c15, c12, 1" : : "r"(value)); 428 asm volatile("mcr p15, 0, %0, c15, c12, 1" : : "r"(value));
427 else if (ARMV6_COUNTER0 == counter) 429 else if (ARMV6_COUNTER0 == counter)
@@ -432,12 +434,13 @@ armv6pmu_write_counter(int counter,
432 WARN_ONCE(1, "invalid counter number (%d)\n", counter); 434 WARN_ONCE(1, "invalid counter number (%d)\n", counter);
433} 435}
434 436
435static void 437static void armv6pmu_enable_event(struct perf_event *event)
436armv6pmu_enable_event(struct hw_perf_event *hwc,
437 int idx)
438{ 438{
439 unsigned long val, mask, evt, flags; 439 unsigned long val, mask, evt, flags;
440 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
441 struct hw_perf_event *hwc = &event->hw;
440 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 442 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
443 int idx = hwc->idx;
441 444
442 if (ARMV6_CYCLE_COUNTER == idx) { 445 if (ARMV6_CYCLE_COUNTER == idx) {
443 mask = 0; 446 mask = 0;
@@ -473,7 +476,8 @@ armv6pmu_handle_irq(int irq_num,
473{ 476{
474 unsigned long pmcr = armv6_pmcr_read(); 477 unsigned long pmcr = armv6_pmcr_read();
475 struct perf_sample_data data; 478 struct perf_sample_data data;
476 struct pmu_hw_events *cpuc; 479 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
480 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
477 struct pt_regs *regs; 481 struct pt_regs *regs;
478 int idx; 482 int idx;
479 483
@@ -489,7 +493,6 @@ armv6pmu_handle_irq(int irq_num,
489 */ 493 */
490 armv6_pmcr_write(pmcr); 494 armv6_pmcr_write(pmcr);
491 495
492 cpuc = &__get_cpu_var(cpu_hw_events);
493 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 496 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
494 struct perf_event *event = cpuc->events[idx]; 497 struct perf_event *event = cpuc->events[idx];
495 struct hw_perf_event *hwc; 498 struct hw_perf_event *hwc;
@@ -506,13 +509,13 @@ armv6pmu_handle_irq(int irq_num,
506 continue; 509 continue;
507 510
508 hwc = &event->hw; 511 hwc = &event->hw;
509 armpmu_event_update(event, hwc, idx); 512 armpmu_event_update(event);
510 perf_sample_data_init(&data, 0, hwc->last_period); 513 perf_sample_data_init(&data, 0, hwc->last_period);
511 if (!armpmu_event_set_period(event, hwc, idx)) 514 if (!armpmu_event_set_period(event))
512 continue; 515 continue;
513 516
514 if (perf_event_overflow(event, &data, regs)) 517 if (perf_event_overflow(event, &data, regs))
515 cpu_pmu->disable(hwc, idx); 518 cpu_pmu->disable(event);
516 } 519 }
517 520
518 /* 521 /*
@@ -527,8 +530,7 @@ armv6pmu_handle_irq(int irq_num,
527 return IRQ_HANDLED; 530 return IRQ_HANDLED;
528} 531}
529 532
530static void 533static void armv6pmu_start(struct arm_pmu *cpu_pmu)
531armv6pmu_start(void)
532{ 534{
533 unsigned long flags, val; 535 unsigned long flags, val;
534 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 536 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -540,8 +542,7 @@ armv6pmu_start(void)
540 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 542 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
541} 543}
542 544
543static void 545static void armv6pmu_stop(struct arm_pmu *cpu_pmu)
544armv6pmu_stop(void)
545{ 546{
546 unsigned long flags, val; 547 unsigned long flags, val;
547 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 548 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -555,10 +556,11 @@ armv6pmu_stop(void)
555 556
556static int 557static int
557armv6pmu_get_event_idx(struct pmu_hw_events *cpuc, 558armv6pmu_get_event_idx(struct pmu_hw_events *cpuc,
558 struct hw_perf_event *event) 559 struct perf_event *event)
559{ 560{
561 struct hw_perf_event *hwc = &event->hw;
560 /* Always place a cycle counter into the cycle counter. */ 562 /* Always place a cycle counter into the cycle counter. */
561 if (ARMV6_PERFCTR_CPU_CYCLES == event->config_base) { 563 if (ARMV6_PERFCTR_CPU_CYCLES == hwc->config_base) {
562 if (test_and_set_bit(ARMV6_CYCLE_COUNTER, cpuc->used_mask)) 564 if (test_and_set_bit(ARMV6_CYCLE_COUNTER, cpuc->used_mask))
563 return -EAGAIN; 565 return -EAGAIN;
564 566
@@ -579,12 +581,13 @@ armv6pmu_get_event_idx(struct pmu_hw_events *cpuc,
579 } 581 }
580} 582}
581 583
582static void 584static void armv6pmu_disable_event(struct perf_event *event)
583armv6pmu_disable_event(struct hw_perf_event *hwc,
584 int idx)
585{ 585{
586 unsigned long val, mask, evt, flags; 586 unsigned long val, mask, evt, flags;
587 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
588 struct hw_perf_event *hwc = &event->hw;
587 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 589 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
590 int idx = hwc->idx;
588 591
589 if (ARMV6_CYCLE_COUNTER == idx) { 592 if (ARMV6_CYCLE_COUNTER == idx) {
590 mask = ARMV6_PMCR_CCOUNT_IEN; 593 mask = ARMV6_PMCR_CCOUNT_IEN;
@@ -613,12 +616,13 @@ armv6pmu_disable_event(struct hw_perf_event *hwc,
613 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 616 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
614} 617}
615 618
616static void 619static void armv6mpcore_pmu_disable_event(struct perf_event *event)
617armv6mpcore_pmu_disable_event(struct hw_perf_event *hwc,
618 int idx)
619{ 620{
620 unsigned long val, mask, flags, evt = 0; 621 unsigned long val, mask, flags, evt = 0;
622 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
623 struct hw_perf_event *hwc = &event->hw;
621 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 624 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
625 int idx = hwc->idx;
622 626
623 if (ARMV6_CYCLE_COUNTER == idx) { 627 if (ARMV6_CYCLE_COUNTER == idx) {
624 mask = ARMV6_PMCR_CCOUNT_IEN; 628 mask = ARMV6_PMCR_CCOUNT_IEN;
@@ -649,24 +653,22 @@ static int armv6_map_event(struct perf_event *event)
649 &armv6_perf_cache_map, 0xFF); 653 &armv6_perf_cache_map, 0xFF);
650} 654}
651 655
652static struct arm_pmu armv6pmu = { 656static int __devinit armv6pmu_init(struct arm_pmu *cpu_pmu)
653 .name = "v6",
654 .handle_irq = armv6pmu_handle_irq,
655 .enable = armv6pmu_enable_event,
656 .disable = armv6pmu_disable_event,
657 .read_counter = armv6pmu_read_counter,
658 .write_counter = armv6pmu_write_counter,
659 .get_event_idx = armv6pmu_get_event_idx,
660 .start = armv6pmu_start,
661 .stop = armv6pmu_stop,
662 .map_event = armv6_map_event,
663 .num_events = 3,
664 .max_period = (1LLU << 32) - 1,
665};
666
667static struct arm_pmu *__devinit armv6pmu_init(void)
668{ 657{
669 return &armv6pmu; 658 cpu_pmu->name = "v6";
659 cpu_pmu->handle_irq = armv6pmu_handle_irq;
660 cpu_pmu->enable = armv6pmu_enable_event;
661 cpu_pmu->disable = armv6pmu_disable_event;
662 cpu_pmu->read_counter = armv6pmu_read_counter;
663 cpu_pmu->write_counter = armv6pmu_write_counter;
664 cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
665 cpu_pmu->start = armv6pmu_start;
666 cpu_pmu->stop = armv6pmu_stop;
667 cpu_pmu->map_event = armv6_map_event;
668 cpu_pmu->num_events = 3;
669 cpu_pmu->max_period = (1LLU << 32) - 1;
670
671 return 0;
670} 672}
671 673
672/* 674/*
@@ -683,33 +685,31 @@ static int armv6mpcore_map_event(struct perf_event *event)
683 &armv6mpcore_perf_cache_map, 0xFF); 685 &armv6mpcore_perf_cache_map, 0xFF);
684} 686}
685 687
686static struct arm_pmu armv6mpcore_pmu = { 688static int __devinit armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
687 .name = "v6mpcore",
688 .handle_irq = armv6pmu_handle_irq,
689 .enable = armv6pmu_enable_event,
690 .disable = armv6mpcore_pmu_disable_event,
691 .read_counter = armv6pmu_read_counter,
692 .write_counter = armv6pmu_write_counter,
693 .get_event_idx = armv6pmu_get_event_idx,
694 .start = armv6pmu_start,
695 .stop = armv6pmu_stop,
696 .map_event = armv6mpcore_map_event,
697 .num_events = 3,
698 .max_period = (1LLU << 32) - 1,
699};
700
701static struct arm_pmu *__devinit armv6mpcore_pmu_init(void)
702{ 689{
703 return &armv6mpcore_pmu; 690 cpu_pmu->name = "v6mpcore";
691 cpu_pmu->handle_irq = armv6pmu_handle_irq;
692 cpu_pmu->enable = armv6pmu_enable_event;
693 cpu_pmu->disable = armv6mpcore_pmu_disable_event;
694 cpu_pmu->read_counter = armv6pmu_read_counter;
695 cpu_pmu->write_counter = armv6pmu_write_counter;
696 cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
697 cpu_pmu->start = armv6pmu_start;
698 cpu_pmu->stop = armv6pmu_stop;
699 cpu_pmu->map_event = armv6mpcore_map_event;
700 cpu_pmu->num_events = 3;
701 cpu_pmu->max_period = (1LLU << 32) - 1;
702
703 return 0;
704} 704}
705#else 705#else
706static struct arm_pmu *__devinit armv6pmu_init(void) 706static int armv6pmu_init(struct arm_pmu *cpu_pmu)
707{ 707{
708 return NULL; 708 return -ENODEV;
709} 709}
710 710
711static struct arm_pmu *__devinit armv6mpcore_pmu_init(void) 711static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
712{ 712{
713 return NULL; 713 return -ENODEV;
714} 714}
715#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */ 715#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index bd4b090ebcf..7d0cce85d17 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -18,8 +18,6 @@
18 18
19#ifdef CONFIG_CPU_V7 19#ifdef CONFIG_CPU_V7
20 20
21static struct arm_pmu armv7pmu;
22
23/* 21/*
24 * Common ARMv7 event types 22 * Common ARMv7 event types
25 * 23 *
@@ -738,7 +736,8 @@ static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
738 */ 736 */
739#define ARMV7_IDX_CYCLE_COUNTER 0 737#define ARMV7_IDX_CYCLE_COUNTER 0
740#define ARMV7_IDX_COUNTER0 1 738#define ARMV7_IDX_COUNTER0 1
741#define ARMV7_IDX_COUNTER_LAST (ARMV7_IDX_CYCLE_COUNTER + cpu_pmu->num_events - 1) 739#define ARMV7_IDX_COUNTER_LAST(cpu_pmu) \
740 (ARMV7_IDX_CYCLE_COUNTER + cpu_pmu->num_events - 1)
742 741
743#define ARMV7_MAX_COUNTERS 32 742#define ARMV7_MAX_COUNTERS 32
744#define ARMV7_COUNTER_MASK (ARMV7_MAX_COUNTERS - 1) 743#define ARMV7_COUNTER_MASK (ARMV7_MAX_COUNTERS - 1)
@@ -804,49 +803,34 @@ static inline int armv7_pmnc_has_overflowed(u32 pmnc)
804 return pmnc & ARMV7_OVERFLOWED_MASK; 803 return pmnc & ARMV7_OVERFLOWED_MASK;
805} 804}
806 805
807static inline int armv7_pmnc_counter_valid(int idx) 806static inline int armv7_pmnc_counter_valid(struct arm_pmu *cpu_pmu, int idx)
808{ 807{
809 return idx >= ARMV7_IDX_CYCLE_COUNTER && idx <= ARMV7_IDX_COUNTER_LAST; 808 return idx >= ARMV7_IDX_CYCLE_COUNTER &&
809 idx <= ARMV7_IDX_COUNTER_LAST(cpu_pmu);
810} 810}
811 811
812static inline int armv7_pmnc_counter_has_overflowed(u32 pmnc, int idx) 812static inline int armv7_pmnc_counter_has_overflowed(u32 pmnc, int idx)
813{ 813{
814 int ret = 0; 814 return pmnc & BIT(ARMV7_IDX_TO_COUNTER(idx));
815 u32 counter;
816
817 if (!armv7_pmnc_counter_valid(idx)) {
818 pr_err("CPU%u checking wrong counter %d overflow status\n",
819 smp_processor_id(), idx);
820 } else {
821 counter = ARMV7_IDX_TO_COUNTER(idx);
822 ret = pmnc & BIT(counter);
823 }
824
825 return ret;
826} 815}
827 816
828static inline int armv7_pmnc_select_counter(int idx) 817static inline int armv7_pmnc_select_counter(int idx)
829{ 818{
830 u32 counter; 819 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
831
832 if (!armv7_pmnc_counter_valid(idx)) {
833 pr_err("CPU%u selecting wrong PMNC counter %d\n",
834 smp_processor_id(), idx);
835 return -EINVAL;
836 }
837
838 counter = ARMV7_IDX_TO_COUNTER(idx);
839 asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter)); 820 asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter));
840 isb(); 821 isb();
841 822
842 return idx; 823 return idx;
843} 824}
844 825
845static inline u32 armv7pmu_read_counter(int idx) 826static inline u32 armv7pmu_read_counter(struct perf_event *event)
846{ 827{
828 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
829 struct hw_perf_event *hwc = &event->hw;
830 int idx = hwc->idx;
847 u32 value = 0; 831 u32 value = 0;
848 832
849 if (!armv7_pmnc_counter_valid(idx)) 833 if (!armv7_pmnc_counter_valid(cpu_pmu, idx))
850 pr_err("CPU%u reading wrong counter %d\n", 834 pr_err("CPU%u reading wrong counter %d\n",
851 smp_processor_id(), idx); 835 smp_processor_id(), idx);
852 else if (idx == ARMV7_IDX_CYCLE_COUNTER) 836 else if (idx == ARMV7_IDX_CYCLE_COUNTER)
@@ -857,9 +841,13 @@ static inline u32 armv7pmu_read_counter(int idx)
857 return value; 841 return value;
858} 842}
859 843
860static inline void armv7pmu_write_counter(int idx, u32 value) 844static inline void armv7pmu_write_counter(struct perf_event *event, u32 value)
861{ 845{
862 if (!armv7_pmnc_counter_valid(idx)) 846 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
847 struct hw_perf_event *hwc = &event->hw;
848 int idx = hwc->idx;
849
850 if (!armv7_pmnc_counter_valid(cpu_pmu, idx))
863 pr_err("CPU%u writing wrong counter %d\n", 851 pr_err("CPU%u writing wrong counter %d\n",
864 smp_processor_id(), idx); 852 smp_processor_id(), idx);
865 else if (idx == ARMV7_IDX_CYCLE_COUNTER) 853 else if (idx == ARMV7_IDX_CYCLE_COUNTER)
@@ -878,60 +866,28 @@ static inline void armv7_pmnc_write_evtsel(int idx, u32 val)
878 866
879static inline int armv7_pmnc_enable_counter(int idx) 867static inline int armv7_pmnc_enable_counter(int idx)
880{ 868{
881 u32 counter; 869 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
882
883 if (!armv7_pmnc_counter_valid(idx)) {
884 pr_err("CPU%u enabling wrong PMNC counter %d\n",
885 smp_processor_id(), idx);
886 return -EINVAL;
887 }
888
889 counter = ARMV7_IDX_TO_COUNTER(idx);
890 asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (BIT(counter))); 870 asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (BIT(counter)));
891 return idx; 871 return idx;
892} 872}
893 873
894static inline int armv7_pmnc_disable_counter(int idx) 874static inline int armv7_pmnc_disable_counter(int idx)
895{ 875{
896 u32 counter; 876 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
897
898 if (!armv7_pmnc_counter_valid(idx)) {
899 pr_err("CPU%u disabling wrong PMNC counter %d\n",
900 smp_processor_id(), idx);
901 return -EINVAL;
902 }
903
904 counter = ARMV7_IDX_TO_COUNTER(idx);
905 asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (BIT(counter))); 877 asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (BIT(counter)));
906 return idx; 878 return idx;
907} 879}
908 880
909static inline int armv7_pmnc_enable_intens(int idx) 881static inline int armv7_pmnc_enable_intens(int idx)
910{ 882{
911 u32 counter; 883 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
912
913 if (!armv7_pmnc_counter_valid(idx)) {
914 pr_err("CPU%u enabling wrong PMNC counter IRQ enable %d\n",
915 smp_processor_id(), idx);
916 return -EINVAL;
917 }
918
919 counter = ARMV7_IDX_TO_COUNTER(idx);
920 asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (BIT(counter))); 884 asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (BIT(counter)));
921 return idx; 885 return idx;
922} 886}
923 887
924static inline int armv7_pmnc_disable_intens(int idx) 888static inline int armv7_pmnc_disable_intens(int idx)
925{ 889{
926 u32 counter; 890 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
927
928 if (!armv7_pmnc_counter_valid(idx)) {
929 pr_err("CPU%u disabling wrong PMNC counter IRQ enable %d\n",
930 smp_processor_id(), idx);
931 return -EINVAL;
932 }
933
934 counter = ARMV7_IDX_TO_COUNTER(idx);
935 asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (BIT(counter))); 891 asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (BIT(counter)));
936 isb(); 892 isb();
937 /* Clear the overflow flag in case an interrupt is pending. */ 893 /* Clear the overflow flag in case an interrupt is pending. */
@@ -956,7 +912,7 @@ static inline u32 armv7_pmnc_getreset_flags(void)
956} 912}
957 913
958#ifdef DEBUG 914#ifdef DEBUG
959static void armv7_pmnc_dump_regs(void) 915static void armv7_pmnc_dump_regs(struct arm_pmu *cpu_pmu)
960{ 916{
961 u32 val; 917 u32 val;
962 unsigned int cnt; 918 unsigned int cnt;
@@ -981,7 +937,8 @@ static void armv7_pmnc_dump_regs(void)
981 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val)); 937 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val));
982 printk(KERN_INFO "CCNT =0x%08x\n", val); 938 printk(KERN_INFO "CCNT =0x%08x\n", val);
983 939
984 for (cnt = ARMV7_IDX_COUNTER0; cnt <= ARMV7_IDX_COUNTER_LAST; cnt++) { 940 for (cnt = ARMV7_IDX_COUNTER0;
941 cnt <= ARMV7_IDX_COUNTER_LAST(cpu_pmu); cnt++) {
985 armv7_pmnc_select_counter(cnt); 942 armv7_pmnc_select_counter(cnt);
986 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val)); 943 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val));
987 printk(KERN_INFO "CNT[%d] count =0x%08x\n", 944 printk(KERN_INFO "CNT[%d] count =0x%08x\n",
@@ -993,10 +950,19 @@ static void armv7_pmnc_dump_regs(void)
993} 950}
994#endif 951#endif
995 952
996static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx) 953static void armv7pmu_enable_event(struct perf_event *event)
997{ 954{
998 unsigned long flags; 955 unsigned long flags;
956 struct hw_perf_event *hwc = &event->hw;
957 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
999 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 958 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
959 int idx = hwc->idx;
960
961 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
962 pr_err("CPU%u enabling wrong PMNC counter IRQ enable %d\n",
963 smp_processor_id(), idx);
964 return;
965 }
1000 966
1001 /* 967 /*
1002 * Enable counter and interrupt, and set the counter to count 968 * Enable counter and interrupt, and set the counter to count
@@ -1014,7 +980,7 @@ static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
1014 * We only need to set the event for the cycle counter if we 980 * We only need to set the event for the cycle counter if we
1015 * have the ability to perform event filtering. 981 * have the ability to perform event filtering.
1016 */ 982 */
1017 if (armv7pmu.set_event_filter || idx != ARMV7_IDX_CYCLE_COUNTER) 983 if (cpu_pmu->set_event_filter || idx != ARMV7_IDX_CYCLE_COUNTER)
1018 armv7_pmnc_write_evtsel(idx, hwc->config_base); 984 armv7_pmnc_write_evtsel(idx, hwc->config_base);
1019 985
1020 /* 986 /*
@@ -1030,10 +996,19 @@ static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
1030 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 996 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
1031} 997}
1032 998
1033static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx) 999static void armv7pmu_disable_event(struct perf_event *event)
1034{ 1000{
1035 unsigned long flags; 1001 unsigned long flags;
1002 struct hw_perf_event *hwc = &event->hw;
1003 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1036 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1004 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
1005 int idx = hwc->idx;
1006
1007 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
1008 pr_err("CPU%u disabling wrong PMNC counter IRQ enable %d\n",
1009 smp_processor_id(), idx);
1010 return;
1011 }
1037 1012
1038 /* 1013 /*
1039 * Disable counter and interrupt 1014 * Disable counter and interrupt
@@ -1057,7 +1032,8 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1057{ 1032{
1058 u32 pmnc; 1033 u32 pmnc;
1059 struct perf_sample_data data; 1034 struct perf_sample_data data;
1060 struct pmu_hw_events *cpuc; 1035 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
1036 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
1061 struct pt_regs *regs; 1037 struct pt_regs *regs;
1062 int idx; 1038 int idx;
1063 1039
@@ -1077,7 +1053,6 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1077 */ 1053 */
1078 regs = get_irq_regs(); 1054 regs = get_irq_regs();
1079 1055
1080 cpuc = &__get_cpu_var(cpu_hw_events);
1081 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 1056 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
1082 struct perf_event *event = cpuc->events[idx]; 1057 struct perf_event *event = cpuc->events[idx];
1083 struct hw_perf_event *hwc; 1058 struct hw_perf_event *hwc;
@@ -1094,13 +1069,13 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1094 continue; 1069 continue;
1095 1070
1096 hwc = &event->hw; 1071 hwc = &event->hw;
1097 armpmu_event_update(event, hwc, idx); 1072 armpmu_event_update(event);
1098 perf_sample_data_init(&data, 0, hwc->last_period); 1073 perf_sample_data_init(&data, 0, hwc->last_period);
1099 if (!armpmu_event_set_period(event, hwc, idx)) 1074 if (!armpmu_event_set_period(event))
1100 continue; 1075 continue;
1101 1076
1102 if (perf_event_overflow(event, &data, regs)) 1077 if (perf_event_overflow(event, &data, regs))
1103 cpu_pmu->disable(hwc, idx); 1078 cpu_pmu->disable(event);
1104 } 1079 }
1105 1080
1106 /* 1081 /*
@@ -1115,7 +1090,7 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1115 return IRQ_HANDLED; 1090 return IRQ_HANDLED;
1116} 1091}
1117 1092
1118static void armv7pmu_start(void) 1093static void armv7pmu_start(struct arm_pmu *cpu_pmu)
1119{ 1094{
1120 unsigned long flags; 1095 unsigned long flags;
1121 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1096 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -1126,7 +1101,7 @@ static void armv7pmu_start(void)
1126 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 1101 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
1127} 1102}
1128 1103
1129static void armv7pmu_stop(void) 1104static void armv7pmu_stop(struct arm_pmu *cpu_pmu)
1130{ 1105{
1131 unsigned long flags; 1106 unsigned long flags;
1132 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1107 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -1138,10 +1113,12 @@ static void armv7pmu_stop(void)
1138} 1113}
1139 1114
1140static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc, 1115static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc,
1141 struct hw_perf_event *event) 1116 struct perf_event *event)
1142{ 1117{
1143 int idx; 1118 int idx;
1144 unsigned long evtype = event->config_base & ARMV7_EVTYPE_EVENT; 1119 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1120 struct hw_perf_event *hwc = &event->hw;
1121 unsigned long evtype = hwc->config_base & ARMV7_EVTYPE_EVENT;
1145 1122
1146 /* Always place a cycle counter into the cycle counter. */ 1123 /* Always place a cycle counter into the cycle counter. */
1147 if (evtype == ARMV7_PERFCTR_CPU_CYCLES) { 1124 if (evtype == ARMV7_PERFCTR_CPU_CYCLES) {
@@ -1192,11 +1169,14 @@ static int armv7pmu_set_event_filter(struct hw_perf_event *event,
1192 1169
1193static void armv7pmu_reset(void *info) 1170static void armv7pmu_reset(void *info)
1194{ 1171{
1172 struct arm_pmu *cpu_pmu = (struct arm_pmu *)info;
1195 u32 idx, nb_cnt = cpu_pmu->num_events; 1173 u32 idx, nb_cnt = cpu_pmu->num_events;
1196 1174
1197 /* The counter and interrupt enable registers are unknown at reset. */ 1175 /* The counter and interrupt enable registers are unknown at reset. */
1198 for (idx = ARMV7_IDX_CYCLE_COUNTER; idx < nb_cnt; ++idx) 1176 for (idx = ARMV7_IDX_CYCLE_COUNTER; idx < nb_cnt; ++idx) {
1199 armv7pmu_disable_event(NULL, idx); 1177 armv7_pmnc_disable_counter(idx);
1178 armv7_pmnc_disable_intens(idx);
1179 }
1200 1180
1201 /* Initialize & Reset PMNC: C and P bits */ 1181 /* Initialize & Reset PMNC: C and P bits */
1202 armv7_pmnc_write(ARMV7_PMNC_P | ARMV7_PMNC_C); 1182 armv7_pmnc_write(ARMV7_PMNC_P | ARMV7_PMNC_C);
@@ -1232,17 +1212,18 @@ static int armv7_a7_map_event(struct perf_event *event)
1232 &armv7_a7_perf_cache_map, 0xFF); 1212 &armv7_a7_perf_cache_map, 0xFF);
1233} 1213}
1234 1214
1235static struct arm_pmu armv7pmu = { 1215static void armv7pmu_init(struct arm_pmu *cpu_pmu)
1236 .handle_irq = armv7pmu_handle_irq, 1216{
1237 .enable = armv7pmu_enable_event, 1217 cpu_pmu->handle_irq = armv7pmu_handle_irq;
1238 .disable = armv7pmu_disable_event, 1218 cpu_pmu->enable = armv7pmu_enable_event;
1239 .read_counter = armv7pmu_read_counter, 1219 cpu_pmu->disable = armv7pmu_disable_event;
1240 .write_counter = armv7pmu_write_counter, 1220 cpu_pmu->read_counter = armv7pmu_read_counter;
1241 .get_event_idx = armv7pmu_get_event_idx, 1221 cpu_pmu->write_counter = armv7pmu_write_counter;
1242 .start = armv7pmu_start, 1222 cpu_pmu->get_event_idx = armv7pmu_get_event_idx;
1243 .stop = armv7pmu_stop, 1223 cpu_pmu->start = armv7pmu_start;
1244 .reset = armv7pmu_reset, 1224 cpu_pmu->stop = armv7pmu_stop;
1245 .max_period = (1LLU << 32) - 1, 1225 cpu_pmu->reset = armv7pmu_reset;
1226 cpu_pmu->max_period = (1LLU << 32) - 1;
1246}; 1227};
1247 1228
1248static u32 __devinit armv7_read_num_pmnc_events(void) 1229static u32 __devinit armv7_read_num_pmnc_events(void)
@@ -1256,70 +1237,75 @@ static u32 __devinit armv7_read_num_pmnc_events(void)
1256 return nb_cnt + 1; 1237 return nb_cnt + 1;
1257} 1238}
1258 1239
1259static struct arm_pmu *__devinit armv7_a8_pmu_init(void) 1240static int __devinit armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1260{ 1241{
1261 armv7pmu.name = "ARMv7 Cortex-A8"; 1242 armv7pmu_init(cpu_pmu);
1262 armv7pmu.map_event = armv7_a8_map_event; 1243 cpu_pmu->name = "ARMv7 Cortex-A8";
1263 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1244 cpu_pmu->map_event = armv7_a8_map_event;
1264 return &armv7pmu; 1245 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1246 return 0;
1265} 1247}
1266 1248
1267static struct arm_pmu *__devinit armv7_a9_pmu_init(void) 1249static int __devinit armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1268{ 1250{
1269 armv7pmu.name = "ARMv7 Cortex-A9"; 1251 armv7pmu_init(cpu_pmu);
1270 armv7pmu.map_event = armv7_a9_map_event; 1252 cpu_pmu->name = "ARMv7 Cortex-A9";
1271 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1253 cpu_pmu->map_event = armv7_a9_map_event;
1272 return &armv7pmu; 1254 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1255 return 0;
1273} 1256}
1274 1257
1275static struct arm_pmu *__devinit armv7_a5_pmu_init(void) 1258static int __devinit armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1276{ 1259{
1277 armv7pmu.name = "ARMv7 Cortex-A5"; 1260 armv7pmu_init(cpu_pmu);
1278 armv7pmu.map_event = armv7_a5_map_event; 1261 cpu_pmu->name = "ARMv7 Cortex-A5";
1279 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1262 cpu_pmu->map_event = armv7_a5_map_event;
1280 return &armv7pmu; 1263 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1264 return 0;
1281} 1265}
1282 1266
1283static struct arm_pmu *__devinit armv7_a15_pmu_init(void) 1267static int __devinit armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1284{ 1268{
1285 armv7pmu.name = "ARMv7 Cortex-A15"; 1269 armv7pmu_init(cpu_pmu);
1286 armv7pmu.map_event = armv7_a15_map_event; 1270 cpu_pmu->name = "ARMv7 Cortex-A15";
1287 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1271 cpu_pmu->map_event = armv7_a15_map_event;
1288 armv7pmu.set_event_filter = armv7pmu_set_event_filter; 1272 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1289 return &armv7pmu; 1273 cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
1274 return 0;
1290} 1275}
1291 1276
1292static struct arm_pmu *__devinit armv7_a7_pmu_init(void) 1277static int __devinit armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
1293{ 1278{
1294 armv7pmu.name = "ARMv7 Cortex-A7"; 1279 armv7pmu_init(cpu_pmu);
1295 armv7pmu.map_event = armv7_a7_map_event; 1280 cpu_pmu->name = "ARMv7 Cortex-A7";
1296 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1281 cpu_pmu->map_event = armv7_a7_map_event;
1297 armv7pmu.set_event_filter = armv7pmu_set_event_filter; 1282 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1298 return &armv7pmu; 1283 cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
1284 return 0;
1299} 1285}
1300#else 1286#else
1301static struct arm_pmu *__devinit armv7_a8_pmu_init(void) 1287static inline int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1302{ 1288{
1303 return NULL; 1289 return -ENODEV;
1304} 1290}
1305 1291
1306static struct arm_pmu *__devinit armv7_a9_pmu_init(void) 1292static inline int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1307{ 1293{
1308 return NULL; 1294 return -ENODEV;
1309} 1295}
1310 1296
1311static struct arm_pmu *__devinit armv7_a5_pmu_init(void) 1297static inline int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1312{ 1298{
1313 return NULL; 1299 return -ENODEV;
1314} 1300}
1315 1301
1316static struct arm_pmu *__devinit armv7_a15_pmu_init(void) 1302static inline int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1317{ 1303{
1318 return NULL; 1304 return -ENODEV;
1319} 1305}
1320 1306
1321static struct arm_pmu *__devinit armv7_a7_pmu_init(void) 1307static inline int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
1322{ 1308{
1323 return NULL; 1309 return -ENODEV;
1324} 1310}
1325#endif /* CONFIG_CPU_V7 */ 1311#endif /* CONFIG_CPU_V7 */
diff --git a/arch/arm/kernel/perf_event_xscale.c b/arch/arm/kernel/perf_event_xscale.c
index 426e19f380a..0c8265e53d5 100644
--- a/arch/arm/kernel/perf_event_xscale.c
+++ b/arch/arm/kernel/perf_event_xscale.c
@@ -224,7 +224,8 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
224{ 224{
225 unsigned long pmnc; 225 unsigned long pmnc;
226 struct perf_sample_data data; 226 struct perf_sample_data data;
227 struct pmu_hw_events *cpuc; 227 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
228 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
228 struct pt_regs *regs; 229 struct pt_regs *regs;
229 int idx; 230 int idx;
230 231
@@ -248,7 +249,6 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
248 249
249 regs = get_irq_regs(); 250 regs = get_irq_regs();
250 251
251 cpuc = &__get_cpu_var(cpu_hw_events);
252 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 252 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
253 struct perf_event *event = cpuc->events[idx]; 253 struct perf_event *event = cpuc->events[idx];
254 struct hw_perf_event *hwc; 254 struct hw_perf_event *hwc;
@@ -260,13 +260,13 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
260 continue; 260 continue;
261 261
262 hwc = &event->hw; 262 hwc = &event->hw;
263 armpmu_event_update(event, hwc, idx); 263 armpmu_event_update(event);
264 perf_sample_data_init(&data, 0, hwc->last_period); 264 perf_sample_data_init(&data, 0, hwc->last_period);
265 if (!armpmu_event_set_period(event, hwc, idx)) 265 if (!armpmu_event_set_period(event))
266 continue; 266 continue;
267 267
268 if (perf_event_overflow(event, &data, regs)) 268 if (perf_event_overflow(event, &data, regs))
269 cpu_pmu->disable(hwc, idx); 269 cpu_pmu->disable(event);
270 } 270 }
271 271
272 irq_work_run(); 272 irq_work_run();
@@ -280,11 +280,13 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
280 return IRQ_HANDLED; 280 return IRQ_HANDLED;
281} 281}
282 282
283static void 283static void xscale1pmu_enable_event(struct perf_event *event)
284xscale1pmu_enable_event(struct hw_perf_event *hwc, int idx)
285{ 284{
286 unsigned long val, mask, evt, flags; 285 unsigned long val, mask, evt, flags;
286 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
287 struct hw_perf_event *hwc = &event->hw;
287 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 288 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
289 int idx = hwc->idx;
288 290
289 switch (idx) { 291 switch (idx) {
290 case XSCALE_CYCLE_COUNTER: 292 case XSCALE_CYCLE_COUNTER:
@@ -314,11 +316,13 @@ xscale1pmu_enable_event(struct hw_perf_event *hwc, int idx)
314 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 316 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
315} 317}
316 318
317static void 319static void xscale1pmu_disable_event(struct perf_event *event)
318xscale1pmu_disable_event(struct hw_perf_event *hwc, int idx)
319{ 320{
320 unsigned long val, mask, evt, flags; 321 unsigned long val, mask, evt, flags;
322 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
323 struct hw_perf_event *hwc = &event->hw;
321 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 324 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
325 int idx = hwc->idx;
322 326
323 switch (idx) { 327 switch (idx) {
324 case XSCALE_CYCLE_COUNTER: 328 case XSCALE_CYCLE_COUNTER:
@@ -348,9 +352,10 @@ xscale1pmu_disable_event(struct hw_perf_event *hwc, int idx)
348 352
349static int 353static int
350xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc, 354xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc,
351 struct hw_perf_event *event) 355 struct perf_event *event)
352{ 356{
353 if (XSCALE_PERFCTR_CCNT == event->config_base) { 357 struct hw_perf_event *hwc = &event->hw;
358 if (XSCALE_PERFCTR_CCNT == hwc->config_base) {
354 if (test_and_set_bit(XSCALE_CYCLE_COUNTER, cpuc->used_mask)) 359 if (test_and_set_bit(XSCALE_CYCLE_COUNTER, cpuc->used_mask))
355 return -EAGAIN; 360 return -EAGAIN;
356 361
@@ -366,8 +371,7 @@ xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc,
366 } 371 }
367} 372}
368 373
369static void 374static void xscale1pmu_start(struct arm_pmu *cpu_pmu)
370xscale1pmu_start(void)
371{ 375{
372 unsigned long flags, val; 376 unsigned long flags, val;
373 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 377 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -379,8 +383,7 @@ xscale1pmu_start(void)
379 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 383 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
380} 384}
381 385
382static void 386static void xscale1pmu_stop(struct arm_pmu *cpu_pmu)
383xscale1pmu_stop(void)
384{ 387{
385 unsigned long flags, val; 388 unsigned long flags, val;
386 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 389 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -392,9 +395,10 @@ xscale1pmu_stop(void)
392 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 395 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
393} 396}
394 397
395static inline u32 398static inline u32 xscale1pmu_read_counter(struct perf_event *event)
396xscale1pmu_read_counter(int counter)
397{ 399{
400 struct hw_perf_event *hwc = &event->hw;
401 int counter = hwc->idx;
398 u32 val = 0; 402 u32 val = 0;
399 403
400 switch (counter) { 404 switch (counter) {
@@ -412,9 +416,11 @@ xscale1pmu_read_counter(int counter)
412 return val; 416 return val;
413} 417}
414 418
415static inline void 419static inline void xscale1pmu_write_counter(struct perf_event *event, u32 val)
416xscale1pmu_write_counter(int counter, u32 val)
417{ 420{
421 struct hw_perf_event *hwc = &event->hw;
422 int counter = hwc->idx;
423
418 switch (counter) { 424 switch (counter) {
419 case XSCALE_CYCLE_COUNTER: 425 case XSCALE_CYCLE_COUNTER:
420 asm volatile("mcr p14, 0, %0, c1, c0, 0" : : "r" (val)); 426 asm volatile("mcr p14, 0, %0, c1, c0, 0" : : "r" (val));
@@ -434,24 +440,22 @@ static int xscale_map_event(struct perf_event *event)
434 &xscale_perf_cache_map, 0xFF); 440 &xscale_perf_cache_map, 0xFF);
435} 441}
436 442
437static struct arm_pmu xscale1pmu = { 443static int __devinit xscale1pmu_init(struct arm_pmu *cpu_pmu)
438 .name = "xscale1",
439 .handle_irq = xscale1pmu_handle_irq,
440 .enable = xscale1pmu_enable_event,
441 .disable = xscale1pmu_disable_event,
442 .read_counter = xscale1pmu_read_counter,
443 .write_counter = xscale1pmu_write_counter,
444 .get_event_idx = xscale1pmu_get_event_idx,
445 .start = xscale1pmu_start,
446 .stop = xscale1pmu_stop,
447 .map_event = xscale_map_event,
448 .num_events = 3,
449 .max_period = (1LLU << 32) - 1,
450};
451
452static struct arm_pmu *__devinit xscale1pmu_init(void)
453{ 444{
454 return &xscale1pmu; 445 cpu_pmu->name = "xscale1";
446 cpu_pmu->handle_irq = xscale1pmu_handle_irq;
447 cpu_pmu->enable = xscale1pmu_enable_event;
448 cpu_pmu->disable = xscale1pmu_disable_event;
449 cpu_pmu->read_counter = xscale1pmu_read_counter;
450 cpu_pmu->write_counter = xscale1pmu_write_counter;
451 cpu_pmu->get_event_idx = xscale1pmu_get_event_idx;
452 cpu_pmu->start = xscale1pmu_start;
453 cpu_pmu->stop = xscale1pmu_stop;
454 cpu_pmu->map_event = xscale_map_event;
455 cpu_pmu->num_events = 3;
456 cpu_pmu->max_period = (1LLU << 32) - 1;
457
458 return 0;
455} 459}
456 460
457#define XSCALE2_OVERFLOWED_MASK 0x01f 461#define XSCALE2_OVERFLOWED_MASK 0x01f
@@ -567,7 +571,8 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
567{ 571{
568 unsigned long pmnc, of_flags; 572 unsigned long pmnc, of_flags;
569 struct perf_sample_data data; 573 struct perf_sample_data data;
570 struct pmu_hw_events *cpuc; 574 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
575 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
571 struct pt_regs *regs; 576 struct pt_regs *regs;
572 int idx; 577 int idx;
573 578
@@ -585,7 +590,6 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
585 590
586 regs = get_irq_regs(); 591 regs = get_irq_regs();
587 592
588 cpuc = &__get_cpu_var(cpu_hw_events);
589 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 593 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
590 struct perf_event *event = cpuc->events[idx]; 594 struct perf_event *event = cpuc->events[idx];
591 struct hw_perf_event *hwc; 595 struct hw_perf_event *hwc;
@@ -597,13 +601,13 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
597 continue; 601 continue;
598 602
599 hwc = &event->hw; 603 hwc = &event->hw;
600 armpmu_event_update(event, hwc, idx); 604 armpmu_event_update(event);
601 perf_sample_data_init(&data, 0, hwc->last_period); 605 perf_sample_data_init(&data, 0, hwc->last_period);
602 if (!armpmu_event_set_period(event, hwc, idx)) 606 if (!armpmu_event_set_period(event))
603 continue; 607 continue;
604 608
605 if (perf_event_overflow(event, &data, regs)) 609 if (perf_event_overflow(event, &data, regs))
606 cpu_pmu->disable(hwc, idx); 610 cpu_pmu->disable(event);
607 } 611 }
608 612
609 irq_work_run(); 613 irq_work_run();
@@ -617,11 +621,13 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
617 return IRQ_HANDLED; 621 return IRQ_HANDLED;
618} 622}
619 623
620static void 624static void xscale2pmu_enable_event(struct perf_event *event)
621xscale2pmu_enable_event(struct hw_perf_event *hwc, int idx)
622{ 625{
623 unsigned long flags, ien, evtsel; 626 unsigned long flags, ien, evtsel;
627 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
628 struct hw_perf_event *hwc = &event->hw;
624 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 629 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
630 int idx = hwc->idx;
625 631
626 ien = xscale2pmu_read_int_enable(); 632 ien = xscale2pmu_read_int_enable();
627 evtsel = xscale2pmu_read_event_select(); 633 evtsel = xscale2pmu_read_event_select();
@@ -661,11 +667,13 @@ xscale2pmu_enable_event(struct hw_perf_event *hwc, int idx)
661 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 667 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
662} 668}
663 669
664static void 670static void xscale2pmu_disable_event(struct perf_event *event)
665xscale2pmu_disable_event(struct hw_perf_event *hwc, int idx)
666{ 671{
667 unsigned long flags, ien, evtsel, of_flags; 672 unsigned long flags, ien, evtsel, of_flags;
673 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
674 struct hw_perf_event *hwc = &event->hw;
668 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 675 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
676 int idx = hwc->idx;
669 677
670 ien = xscale2pmu_read_int_enable(); 678 ien = xscale2pmu_read_int_enable();
671 evtsel = xscale2pmu_read_event_select(); 679 evtsel = xscale2pmu_read_event_select();
@@ -713,7 +721,7 @@ xscale2pmu_disable_event(struct hw_perf_event *hwc, int idx)
713 721
714static int 722static int
715xscale2pmu_get_event_idx(struct pmu_hw_events *cpuc, 723xscale2pmu_get_event_idx(struct pmu_hw_events *cpuc,
716 struct hw_perf_event *event) 724 struct perf_event *event)
717{ 725{
718 int idx = xscale1pmu_get_event_idx(cpuc, event); 726 int idx = xscale1pmu_get_event_idx(cpuc, event);
719 if (idx >= 0) 727 if (idx >= 0)
@@ -727,8 +735,7 @@ out:
727 return idx; 735 return idx;
728} 736}
729 737
730static void 738static void xscale2pmu_start(struct arm_pmu *cpu_pmu)
731xscale2pmu_start(void)
732{ 739{
733 unsigned long flags, val; 740 unsigned long flags, val;
734 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 741 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -740,8 +747,7 @@ xscale2pmu_start(void)
740 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 747 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
741} 748}
742 749
743static void 750static void xscale2pmu_stop(struct arm_pmu *cpu_pmu)
744xscale2pmu_stop(void)
745{ 751{
746 unsigned long flags, val; 752 unsigned long flags, val;
747 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 753 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -753,9 +759,10 @@ xscale2pmu_stop(void)
753 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 759 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
754} 760}
755 761
756static inline u32 762static inline u32 xscale2pmu_read_counter(struct perf_event *event)
757xscale2pmu_read_counter(int counter)
758{ 763{
764 struct hw_perf_event *hwc = &event->hw;
765 int counter = hwc->idx;
759 u32 val = 0; 766 u32 val = 0;
760 767
761 switch (counter) { 768 switch (counter) {
@@ -779,9 +786,11 @@ xscale2pmu_read_counter(int counter)
779 return val; 786 return val;
780} 787}
781 788
782static inline void 789static inline void xscale2pmu_write_counter(struct perf_event *event, u32 val)
783xscale2pmu_write_counter(int counter, u32 val)
784{ 790{
791 struct hw_perf_event *hwc = &event->hw;
792 int counter = hwc->idx;
793
785 switch (counter) { 794 switch (counter) {
786 case XSCALE_CYCLE_COUNTER: 795 case XSCALE_CYCLE_COUNTER:
787 asm volatile("mcr p14, 0, %0, c1, c1, 0" : : "r" (val)); 796 asm volatile("mcr p14, 0, %0, c1, c1, 0" : : "r" (val));
@@ -801,33 +810,31 @@ xscale2pmu_write_counter(int counter, u32 val)
801 } 810 }
802} 811}
803 812
804static struct arm_pmu xscale2pmu = { 813static int __devinit xscale2pmu_init(struct arm_pmu *cpu_pmu)
805 .name = "xscale2",
806 .handle_irq = xscale2pmu_handle_irq,
807 .enable = xscale2pmu_enable_event,
808 .disable = xscale2pmu_disable_event,
809 .read_counter = xscale2pmu_read_counter,
810 .write_counter = xscale2pmu_write_counter,
811 .get_event_idx = xscale2pmu_get_event_idx,
812 .start = xscale2pmu_start,
813 .stop = xscale2pmu_stop,
814 .map_event = xscale_map_event,
815 .num_events = 5,
816 .max_period = (1LLU << 32) - 1,
817};
818
819static struct arm_pmu *__devinit xscale2pmu_init(void)
820{ 814{
821 return &xscale2pmu; 815 cpu_pmu->name = "xscale2";
816 cpu_pmu->handle_irq = xscale2pmu_handle_irq;
817 cpu_pmu->enable = xscale2pmu_enable_event;
818 cpu_pmu->disable = xscale2pmu_disable_event;
819 cpu_pmu->read_counter = xscale2pmu_read_counter;
820 cpu_pmu->write_counter = xscale2pmu_write_counter;
821 cpu_pmu->get_event_idx = xscale2pmu_get_event_idx;
822 cpu_pmu->start = xscale2pmu_start;
823 cpu_pmu->stop = xscale2pmu_stop;
824 cpu_pmu->map_event = xscale_map_event;
825 cpu_pmu->num_events = 5;
826 cpu_pmu->max_period = (1LLU << 32) - 1;
827
828 return 0;
822} 829}
823#else 830#else
824static struct arm_pmu *__devinit xscale1pmu_init(void) 831static inline int xscale1pmu_init(struct arm_pmu *cpu_pmu)
825{ 832{
826 return NULL; 833 return -ENODEV;
827} 834}
828 835
829static struct arm_pmu *__devinit xscale2pmu_init(void) 836static inline int xscale2pmu_init(struct arm_pmu *cpu_pmu)
830{ 837{
831 return NULL; 838 return -ENODEV;
832} 839}
833#endif /* CONFIG_CPU_XSCALE */ 840#endif /* CONFIG_CPU_XSCALE */
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 90084a6de35..c6dec5fc20a 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -34,6 +34,7 @@
34#include <linux/leds.h> 34#include <linux/leds.h>
35 35
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#include <asm/idmap.h>
37#include <asm/processor.h> 38#include <asm/processor.h>
38#include <asm/thread_notify.h> 39#include <asm/thread_notify.h>
39#include <asm/stacktrace.h> 40#include <asm/stacktrace.h>
@@ -56,8 +57,6 @@ static const char *isa_modes[] = {
56 "ARM" , "Thumb" , "Jazelle", "ThumbEE" 57 "ARM" , "Thumb" , "Jazelle", "ThumbEE"
57}; 58};
58 59
59extern void setup_mm_for_reboot(void);
60
61static volatile int hlt_counter; 60static volatile int hlt_counter;
62 61
63void disable_hlt(void) 62void disable_hlt(void)
@@ -70,6 +69,7 @@ EXPORT_SYMBOL(disable_hlt);
70void enable_hlt(void) 69void enable_hlt(void)
71{ 70{
72 hlt_counter--; 71 hlt_counter--;
72 BUG_ON(hlt_counter < 0);
73} 73}
74 74
75EXPORT_SYMBOL(enable_hlt); 75EXPORT_SYMBOL(enable_hlt);
@@ -376,17 +376,18 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
376 376
377int 377int
378copy_thread(unsigned long clone_flags, unsigned long stack_start, 378copy_thread(unsigned long clone_flags, unsigned long stack_start,
379 unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) 379 unsigned long stk_sz, struct task_struct *p)
380{ 380{
381 struct thread_info *thread = task_thread_info(p); 381 struct thread_info *thread = task_thread_info(p);
382 struct pt_regs *childregs = task_pt_regs(p); 382 struct pt_regs *childregs = task_pt_regs(p);
383 383
384 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save)); 384 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
385 385
386 if (likely(regs)) { 386 if (likely(!(p->flags & PF_KTHREAD))) {
387 *childregs = *regs; 387 *childregs = *current_pt_regs();
388 childregs->ARM_r0 = 0; 388 childregs->ARM_r0 = 0;
389 childregs->ARM_sp = stack_start; 389 if (stack_start)
390 childregs->ARM_sp = stack_start;
390 } else { 391 } else {
391 memset(childregs, 0, sizeof(struct pt_regs)); 392 memset(childregs, 0, sizeof(struct pt_regs));
392 thread->cpu_context.r4 = stk_sz; 393 thread->cpu_context.r4 = stk_sz;
@@ -399,7 +400,7 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
399 clear_ptrace_hw_breakpoint(p); 400 clear_ptrace_hw_breakpoint(p);
400 401
401 if (clone_flags & CLONE_SETTLS) 402 if (clone_flags & CLONE_SETTLS)
402 thread->tp_value = regs->ARM_r3; 403 thread->tp_value = childregs->ARM_r3;
403 404
404 thread_notify(THREAD_NOTIFY_COPY, thread); 405 thread_notify(THREAD_NOTIFY_COPY, thread);
405 406
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 739db3a1b2d..03deeffd9f6 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -916,16 +916,11 @@ enum ptrace_syscall_dir {
916 PTRACE_SYSCALL_EXIT, 916 PTRACE_SYSCALL_EXIT,
917}; 917};
918 918
919static int ptrace_syscall_trace(struct pt_regs *regs, int scno, 919static int tracehook_report_syscall(struct pt_regs *regs,
920 enum ptrace_syscall_dir dir) 920 enum ptrace_syscall_dir dir)
921{ 921{
922 unsigned long ip; 922 unsigned long ip;
923 923
924 current_thread_info()->syscall = scno;
925
926 if (!test_thread_flag(TIF_SYSCALL_TRACE))
927 return scno;
928
929 /* 924 /*
930 * IP is used to denote syscall entry/exit: 925 * IP is used to denote syscall entry/exit:
931 * IP = 0 -> entry, =1 -> exit 926 * IP = 0 -> entry, =1 -> exit
@@ -944,19 +939,41 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
944 939
945asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) 940asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
946{ 941{
947 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER); 942 current_thread_info()->syscall = scno;
943
944 /* Do the secure computing check first; failures should be fast. */
945 if (secure_computing(scno) == -1)
946 return -1;
947
948 if (test_thread_flag(TIF_SYSCALL_TRACE))
949 scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
950
948 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 951 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
949 trace_sys_enter(regs, scno); 952 trace_sys_enter(regs, scno);
953
950 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, 954 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
951 regs->ARM_r2, regs->ARM_r3); 955 regs->ARM_r2, regs->ARM_r3);
956
952 return scno; 957 return scno;
953} 958}
954 959
955asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno) 960asmlinkage void syscall_trace_exit(struct pt_regs *regs)
956{ 961{
957 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT); 962 /*
958 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 963 * Audit the syscall before anything else, as a debugger may
959 trace_sys_exit(regs, scno); 964 * come in and change the current registers.
965 */
960 audit_syscall_exit(regs); 966 audit_syscall_exit(regs);
961 return scno; 967
968 /*
969 * Note that we haven't updated the ->syscall field for the
970 * current thread. This isn't a problem because it will have
971 * been set on syscall entry and there hasn't been an opportunity
972 * for a PTRACE_SET_SYSCALL since then.
973 */
974 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
975 trace_sys_exit(regs, regs_return_value(regs));
976
977 if (test_thread_flag(TIF_SYSCALL_TRACE))
978 tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT);
962} 979}
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index da1d1aa20ad..9a89bf4aefe 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -383,6 +383,12 @@ void cpu_init(void)
383 BUG(); 383 BUG();
384 } 384 }
385 385
386 /*
387 * This only works on resume and secondary cores. For booting on the
388 * boot cpu, smp_prepare_boot_cpu is called after percpu area setup.
389 */
390 set_my_cpu_offset(per_cpu_offset(cpu));
391
386 cpu_proc_init(); 392 cpu_proc_init();
387 393
388 /* 394 /*
@@ -426,13 +432,14 @@ int __cpu_logical_map[NR_CPUS];
426void __init smp_setup_processor_id(void) 432void __init smp_setup_processor_id(void)
427{ 433{
428 int i; 434 int i;
429 u32 cpu = is_smp() ? read_cpuid_mpidr() & 0xff : 0; 435 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
436 u32 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
430 437
431 cpu_logical_map(0) = cpu; 438 cpu_logical_map(0) = cpu;
432 for (i = 1; i < NR_CPUS; ++i) 439 for (i = 1; i < nr_cpu_ids; ++i)
433 cpu_logical_map(i) = i == cpu ? 0 : i; 440 cpu_logical_map(i) = i == cpu ? 0 : i;
434 441
435 printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu); 442 printk(KERN_INFO "Booting Linux on physical CPU 0x%x\n", mpidr);
436} 443}
437 444
438static void __init setup_processor(void) 445static void __init setup_processor(void)
@@ -758,6 +765,7 @@ void __init setup_arch(char **cmdline_p)
758 765
759 unflatten_device_tree(); 766 unflatten_device_tree();
760 767
768 arm_dt_init_cpu_maps();
761#ifdef CONFIG_SMP 769#ifdef CONFIG_SMP
762 if (is_smp()) { 770 if (is_smp()) {
763 smp_set_ops(mdesc->smp); 771 smp_set_ops(mdesc->smp);
@@ -841,12 +849,9 @@ static const char *hwcap_str[] = {
841 849
842static int c_show(struct seq_file *m, void *v) 850static int c_show(struct seq_file *m, void *v)
843{ 851{
844 int i; 852 int i, j;
853 u32 cpuid;
845 854
846 seq_printf(m, "Processor\t: %s rev %d (%s)\n",
847 cpu_name, read_cpuid_id() & 15, elf_platform);
848
849#if defined(CONFIG_SMP)
850 for_each_online_cpu(i) { 855 for_each_online_cpu(i) {
851 /* 856 /*
852 * glibc reads /proc/cpuinfo to determine the number of 857 * glibc reads /proc/cpuinfo to determine the number of
@@ -854,45 +859,48 @@ static int c_show(struct seq_file *m, void *v)
854 * "processor". Give glibc what it expects. 859 * "processor". Give glibc what it expects.
855 */ 860 */
856 seq_printf(m, "processor\t: %d\n", i); 861 seq_printf(m, "processor\t: %d\n", i);
857 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n\n", 862 cpuid = is_smp() ? per_cpu(cpu_data, i).cpuid : read_cpuid_id();
863 seq_printf(m, "model name\t: %s rev %d (%s)\n",
864 cpu_name, cpuid & 15, elf_platform);
865
866#if defined(CONFIG_SMP)
867 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
858 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ), 868 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ),
859 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100); 869 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
860 } 870#else
861#else /* CONFIG_SMP */ 871 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
862 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", 872 loops_per_jiffy / (500000/HZ),
863 loops_per_jiffy / (500000/HZ), 873 (loops_per_jiffy / (5000/HZ)) % 100);
864 (loops_per_jiffy / (5000/HZ)) % 100);
865#endif 874#endif
875 /* dump out the processor features */
876 seq_puts(m, "Features\t: ");
866 877
867 /* dump out the processor features */ 878 for (j = 0; hwcap_str[j]; j++)
868 seq_puts(m, "Features\t: "); 879 if (elf_hwcap & (1 << j))
869 880 seq_printf(m, "%s ", hwcap_str[j]);
870 for (i = 0; hwcap_str[i]; i++)
871 if (elf_hwcap & (1 << i))
872 seq_printf(m, "%s ", hwcap_str[i]);
873 881
874 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24); 882 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", cpuid >> 24);
875 seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]); 883 seq_printf(m, "CPU architecture: %s\n",
884 proc_arch[cpu_architecture()]);
876 885
877 if ((read_cpuid_id() & 0x0008f000) == 0x00000000) { 886 if ((cpuid & 0x0008f000) == 0x00000000) {
878 /* pre-ARM7 */ 887 /* pre-ARM7 */
879 seq_printf(m, "CPU part\t: %07x\n", read_cpuid_id() >> 4); 888 seq_printf(m, "CPU part\t: %07x\n", cpuid >> 4);
880 } else {
881 if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
882 /* ARM7 */
883 seq_printf(m, "CPU variant\t: 0x%02x\n",
884 (read_cpuid_id() >> 16) & 127);
885 } else { 889 } else {
886 /* post-ARM7 */ 890 if ((cpuid & 0x0008f000) == 0x00007000) {
887 seq_printf(m, "CPU variant\t: 0x%x\n", 891 /* ARM7 */
888 (read_cpuid_id() >> 20) & 15); 892 seq_printf(m, "CPU variant\t: 0x%02x\n",
893 (cpuid >> 16) & 127);
894 } else {
895 /* post-ARM7 */
896 seq_printf(m, "CPU variant\t: 0x%x\n",
897 (cpuid >> 20) & 15);
898 }
899 seq_printf(m, "CPU part\t: 0x%03x\n",
900 (cpuid >> 4) & 0xfff);
889 } 901 }
890 seq_printf(m, "CPU part\t: 0x%03x\n", 902 seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
891 (read_cpuid_id() >> 4) & 0xfff);
892 } 903 }
893 seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
894
895 seq_puts(m, "\n");
896 904
897 seq_printf(m, "Hardware\t: %s\n", machine_name); 905 seq_printf(m, "Hardware\t: %s\n", machine_name);
898 seq_printf(m, "Revision\t: %04x\n", system_rev); 906 seq_printf(m, "Revision\t: %04x\n", system_rev);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index fbc8b2623d8..84f4cbf652e 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -281,6 +281,7 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
281 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid); 281 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid);
282 282
283 cpu_info->loops_per_jiffy = loops_per_jiffy; 283 cpu_info->loops_per_jiffy = loops_per_jiffy;
284 cpu_info->cpuid = read_cpuid_id();
284 285
285 store_cpu_topology(cpuid); 286 store_cpu_topology(cpuid);
286} 287}
@@ -313,9 +314,10 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
313 current->active_mm = mm; 314 current->active_mm = mm;
314 cpumask_set_cpu(cpu, mm_cpumask(mm)); 315 cpumask_set_cpu(cpu, mm_cpumask(mm));
315 316
317 cpu_init();
318
316 printk("CPU%u: Booted secondary processor\n", cpu); 319 printk("CPU%u: Booted secondary processor\n", cpu);
317 320
318 cpu_init();
319 preempt_disable(); 321 preempt_disable();
320 trace_hardirqs_off(); 322 trace_hardirqs_off();
321 323
@@ -371,6 +373,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
371 373
372void __init smp_prepare_boot_cpu(void) 374void __init smp_prepare_boot_cpu(void)
373{ 375{
376 set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
374} 377}
375 378
376void __init smp_prepare_cpus(unsigned int max_cpus) 379void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -421,6 +424,11 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
421 smp_cross_call(mask, IPI_CALL_FUNC); 424 smp_cross_call(mask, IPI_CALL_FUNC);
422} 425}
423 426
427void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
428{
429 smp_cross_call(mask, IPI_WAKEUP);
430}
431
424void arch_send_call_function_single_ipi(int cpu) 432void arch_send_call_function_single_ipi(int cpu)
425{ 433{
426 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); 434 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
@@ -443,7 +451,7 @@ void show_ipi_list(struct seq_file *p, int prec)
443 for (i = 0; i < NR_IPI; i++) { 451 for (i = 0; i < NR_IPI; i++) {
444 seq_printf(p, "%*s%u: ", prec - 1, "IPI", i); 452 seq_printf(p, "%*s%u: ", prec - 1, "IPI", i);
445 453
446 for_each_present_cpu(cpu) 454 for_each_online_cpu(cpu)
447 seq_printf(p, "%10u ", 455 seq_printf(p, "%10u ",
448 __get_irq_stat(cpu, ipi_irqs[i])); 456 __get_irq_stat(cpu, ipi_irqs[i]));
449 457
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index b22d700fea2..49f335d301b 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -31,6 +31,8 @@ static void __iomem *twd_base;
31 31
32static struct clk *twd_clk; 32static struct clk *twd_clk;
33static unsigned long twd_timer_rate; 33static unsigned long twd_timer_rate;
34static bool common_setup_called;
35static DEFINE_PER_CPU(bool, percpu_setup_called);
34 36
35static struct clock_event_device __percpu **twd_evt; 37static struct clock_event_device __percpu **twd_evt;
36static int twd_ppi; 38static int twd_ppi;
@@ -248,17 +250,9 @@ static struct clk *twd_get_clock(void)
248 return clk; 250 return clk;
249 } 251 }
250 252
251 err = clk_prepare(clk); 253 err = clk_prepare_enable(clk);
252 if (err) { 254 if (err) {
253 pr_err("smp_twd: clock failed to prepare: %d\n", err); 255 pr_err("smp_twd: clock failed to prepare+enable: %d\n", err);
254 clk_put(clk);
255 return ERR_PTR(err);
256 }
257
258 err = clk_enable(clk);
259 if (err) {
260 pr_err("smp_twd: clock failed to enable: %d\n", err);
261 clk_unprepare(clk);
262 clk_put(clk); 256 clk_put(clk);
263 return ERR_PTR(err); 257 return ERR_PTR(err);
264 } 258 }
@@ -272,15 +266,45 @@ static struct clk *twd_get_clock(void)
272static int __cpuinit twd_timer_setup(struct clock_event_device *clk) 266static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
273{ 267{
274 struct clock_event_device **this_cpu_clk; 268 struct clock_event_device **this_cpu_clk;
269 int cpu = smp_processor_id();
270
271 /*
272 * If the basic setup for this CPU has been done before don't
273 * bother with the below.
274 */
275 if (per_cpu(percpu_setup_called, cpu)) {
276 __raw_writel(0, twd_base + TWD_TIMER_CONTROL);
277 clockevents_register_device(*__this_cpu_ptr(twd_evt));
278 enable_percpu_irq(clk->irq, 0);
279 return 0;
280 }
281 per_cpu(percpu_setup_called, cpu) = true;
275 282
276 if (!twd_clk) 283 /*
284 * This stuff only need to be done once for the entire TWD cluster
285 * during the runtime of the system.
286 */
287 if (!common_setup_called) {
277 twd_clk = twd_get_clock(); 288 twd_clk = twd_get_clock();
278 289
279 if (!IS_ERR_OR_NULL(twd_clk)) 290 /*
280 twd_timer_rate = clk_get_rate(twd_clk); 291 * We use IS_ERR_OR_NULL() here, because if the clock stubs
281 else 292 * are active we will get a valid clk reference which is
282 twd_calibrate_rate(); 293 * however NULL and will return the rate 0. In that case we
294 * need to calibrate the rate instead.
295 */
296 if (!IS_ERR_OR_NULL(twd_clk))
297 twd_timer_rate = clk_get_rate(twd_clk);
298 else
299 twd_calibrate_rate();
300
301 common_setup_called = true;
302 }
283 303
304 /*
305 * The following is done once per CPU the first time .setup() is
306 * called.
307 */
284 __raw_writel(0, twd_base + TWD_TIMER_CONTROL); 308 __raw_writel(0, twd_base + TWD_TIMER_CONTROL);
285 309
286 clk->name = "local_timer"; 310 clk->name = "local_timer";
@@ -366,10 +390,8 @@ void __init twd_local_timer_of_register(void)
366 int err; 390 int err;
367 391
368 np = of_find_matching_node(NULL, twd_of_match); 392 np = of_find_matching_node(NULL, twd_of_match);
369 if (!np) { 393 if (!np)
370 err = -ENODEV; 394 return;
371 goto out;
372 }
373 395
374 twd_ppi = irq_of_parse_and_map(np, 0); 396 twd_ppi = irq_of_parse_and_map(np, 0);
375 if (!twd_ppi) { 397 if (!twd_ppi) {
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index c2a898aa57a..3151f5623d0 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -28,37 +28,6 @@
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30 30
31/* Fork a new task - this creates a new program thread.
32 * This is called indirectly via a small wrapper
33 */
34asmlinkage int sys_fork(struct pt_regs *regs)
35{
36#ifdef CONFIG_MMU
37 return do_fork(SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
38#else
39 /* can not support in nommu mode */
40 return(-EINVAL);
41#endif
42}
43
44/* Clone a task - this clones the calling program thread.
45 * This is called indirectly via a small wrapper
46 */
47asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
48 int __user *parent_tidptr, int tls_val,
49 int __user *child_tidptr, struct pt_regs *regs)
50{
51 if (!newsp)
52 newsp = regs->ARM_sp;
53
54 return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr);
55}
56
57asmlinkage int sys_vfork(struct pt_regs *regs)
58{
59 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
60}
61
62/* 31/*
63 * Since loff_t is a 64 bit type we avoid a lot of ABI hassle 32 * Since loff_t is a 64 bit type we avoid a lot of ABI hassle
64 * with a different argument ordering. 33 * with a different argument ordering.
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 26c12c6440f..79282ebcd93 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -196,32 +196,7 @@ static inline void parse_dt_topology(void) {}
196static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {} 196static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {}
197#endif 197#endif
198 198
199 199 /*
200/*
201 * cpu topology management
202 */
203
204#define MPIDR_SMP_BITMASK (0x3 << 30)
205#define MPIDR_SMP_VALUE (0x2 << 30)
206
207#define MPIDR_MT_BITMASK (0x1 << 24)
208
209/*
210 * These masks reflect the current use of the affinity levels.
211 * The affinity level can be up to 16 bits according to ARM ARM
212 */
213#define MPIDR_HWID_BITMASK 0xFFFFFF
214
215#define MPIDR_LEVEL0_MASK 0x3
216#define MPIDR_LEVEL0_SHIFT 0
217
218#define MPIDR_LEVEL1_MASK 0xF
219#define MPIDR_LEVEL1_SHIFT 8
220
221#define MPIDR_LEVEL2_MASK 0xFF
222#define MPIDR_LEVEL2_SHIFT 16
223
224/*
225 * cpu topology table 200 * cpu topology table
226 */ 201 */
227struct cputopo_arm cpu_topology[NR_CPUS]; 202struct cputopo_arm cpu_topology[NR_CPUS];
@@ -282,19 +257,14 @@ void store_cpu_topology(unsigned int cpuid)
282 257
283 if (mpidr & MPIDR_MT_BITMASK) { 258 if (mpidr & MPIDR_MT_BITMASK) {
284 /* core performance interdependency */ 259 /* core performance interdependency */
285 cpuid_topo->thread_id = (mpidr >> MPIDR_LEVEL0_SHIFT) 260 cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
286 & MPIDR_LEVEL0_MASK; 261 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
287 cpuid_topo->core_id = (mpidr >> MPIDR_LEVEL1_SHIFT) 262 cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL(mpidr, 2);
288 & MPIDR_LEVEL1_MASK;
289 cpuid_topo->socket_id = (mpidr >> MPIDR_LEVEL2_SHIFT)
290 & MPIDR_LEVEL2_MASK;
291 } else { 263 } else {
292 /* largely independent cores */ 264 /* largely independent cores */
293 cpuid_topo->thread_id = -1; 265 cpuid_topo->thread_id = -1;
294 cpuid_topo->core_id = (mpidr >> MPIDR_LEVEL0_SHIFT) 266 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
295 & MPIDR_LEVEL0_MASK; 267 cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
296 cpuid_topo->socket_id = (mpidr >> MPIDR_LEVEL1_SHIFT)
297 & MPIDR_LEVEL1_MASK;
298 } 268 }
299 } else { 269 } else {
300 /* 270 /*
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 36ff15bbfdd..b9f38e388b4 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -114,6 +114,15 @@ SECTIONS
114 114
115 RO_DATA(PAGE_SIZE) 115 RO_DATA(PAGE_SIZE)
116 116
117 . = ALIGN(4);
118 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
119 __start___ex_table = .;
120#ifdef CONFIG_MMU
121 *(__ex_table)
122#endif
123 __stop___ex_table = .;
124 }
125
117#ifdef CONFIG_ARM_UNWIND 126#ifdef CONFIG_ARM_UNWIND
118 /* 127 /*
119 * Stack unwinding tables 128 * Stack unwinding tables
@@ -220,16 +229,6 @@ SECTIONS
220 READ_MOSTLY_DATA(L1_CACHE_BYTES) 229 READ_MOSTLY_DATA(L1_CACHE_BYTES)
221 230
222 /* 231 /*
223 * The exception fixup table (might need resorting at runtime)
224 */
225 . = ALIGN(4);
226 __start___ex_table = .;
227#ifdef CONFIG_MMU
228 *(__ex_table)
229#endif
230 __stop___ex_table = .;
231
232 /*
233 * and the usual data section 232 * and the usual data section
234 */ 233 */
235 DATA_DATA 234 DATA_DATA
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 043624219b5..958358c91af 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -39,7 +39,6 @@ config SOC_AT91RM9200
39config SOC_AT91SAM9260 39config SOC_AT91SAM9260
40 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" 40 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
41 select HAVE_AT91_DBGU0 41 select HAVE_AT91_DBGU0
42 select HAVE_NET_MACB
43 select SOC_AT91SAM9 42 select SOC_AT91SAM9
44 help 43 help
45 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE 44 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
@@ -57,7 +56,6 @@ config SOC_AT91SAM9263
57 bool "AT91SAM9263" 56 bool "AT91SAM9263"
58 select HAVE_AT91_DBGU1 57 select HAVE_AT91_DBGU1
59 select HAVE_FB_ATMEL 58 select HAVE_FB_ATMEL
60 select HAVE_NET_MACB
61 select SOC_AT91SAM9 59 select SOC_AT91SAM9
62 60
63config SOC_AT91SAM9RL 61config SOC_AT91SAM9RL
@@ -70,7 +68,6 @@ config SOC_AT91SAM9G45
70 bool "AT91SAM9G45 or AT91SAM9M10 families" 68 bool "AT91SAM9G45 or AT91SAM9M10 families"
71 select HAVE_AT91_DBGU1 69 select HAVE_AT91_DBGU1
72 select HAVE_FB_ATMEL 70 select HAVE_FB_ATMEL
73 select HAVE_NET_MACB
74 select SOC_AT91SAM9 71 select SOC_AT91SAM9
75 help 72 help
76 Select this if you are using one of Atmel's AT91SAM9G45 family SoC. 73 Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
@@ -80,7 +77,6 @@ config SOC_AT91SAM9X5
80 bool "AT91SAM9x5 family" 77 bool "AT91SAM9x5 family"
81 select HAVE_AT91_DBGU0 78 select HAVE_AT91_DBGU0
82 select HAVE_FB_ATMEL 79 select HAVE_FB_ATMEL
83 select HAVE_NET_MACB
84 select SOC_AT91SAM9 80 select SOC_AT91SAM9
85 help 81 help
86 Select this if you are using one of Atmel's AT91SAM9x5 family SoC. 82 Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
@@ -494,8 +490,17 @@ endif
494 490
495comment "Generic Board Type" 491comment "Generic Board Type"
496 492
493config MACH_AT91RM9200_DT
494 bool "Atmel AT91RM9200 Evaluation Kits with device-tree support"
495 depends on SOC_AT91RM9200
496 select USE_OF
497 help
498 Select this if you want to experiment device-tree with
499 an Atmel RM9200 Evaluation Kit.
500
497config MACH_AT91SAM_DT 501config MACH_AT91SAM_DT
498 bool "Atmel AT91SAM Evaluation Kits with device-tree support" 502 bool "Atmel AT91SAM Evaluation Kits with device-tree support"
503 depends on SOC_AT91SAM9
499 select USE_OF 504 select USE_OF
500 help 505 help
501 Select this if you want to experiment device-tree with 506 Select this if you want to experiment device-tree with
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 3bb7a51efc9..b38a1dcb79b 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -88,6 +88,7 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
88obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o 88obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
89 89
90# AT91SAM board with device-tree 90# AT91SAM board with device-tree
91obj-$(CONFIG_MACH_AT91RM9200_DT) += board-rm9200-dt.o
91obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o 92obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o
92 93
93# AT91X40 board-specific support 94# AT91X40 board-specific support
diff --git a/arch/arm/mach-at91/include/mach/at91_aic.h b/arch/arm/mach-at91/at91_aic.h
index eaea66197fa..eaea66197fa 100644
--- a/arch/arm/mach-at91/include/mach/at91_aic.h
+++ b/arch/arm/mach-at91/at91_aic.h
diff --git a/arch/arm/mach-at91/include/mach/at91_rstc.h b/arch/arm/mach-at91/at91_rstc.h
index 875fa336800..875fa336800 100644
--- a/arch/arm/mach-at91/include/mach/at91_rstc.h
+++ b/arch/arm/mach-at91/at91_rstc.h
diff --git a/arch/arm/mach-at91/include/mach/at91_shdwc.h b/arch/arm/mach-at91/at91_shdwc.h
index 60478ea8bd4..60478ea8bd4 100644
--- a/arch/arm/mach-at91/include/mach/at91_shdwc.h
+++ b/arch/arm/mach-at91/at91_shdwc.h
diff --git a/arch/arm/mach-at91/include/mach/at91_tc.h b/arch/arm/mach-at91/at91_tc.h
index 46a317fd716..46a317fd716 100644
--- a/arch/arm/mach-at91/include/mach/at91_tc.h
+++ b/arch/arm/mach-at91/at91_tc.h
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 5269825194a..7aeb473ee53 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -17,11 +17,11 @@
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/system_misc.h> 18#include <asm/system_misc.h>
19#include <mach/at91rm9200.h> 19#include <mach/at91rm9200.h>
20#include <mach/at91_aic.h>
21#include <mach/at91_pmc.h> 20#include <mach/at91_pmc.h>
22#include <mach/at91_st.h> 21#include <mach/at91_st.h>
23#include <mach/cpu.h> 22#include <mach/cpu.h>
24 23
24#include "at91_aic.h"
25#include "soc.h" 25#include "soc.h"
26#include "generic.h" 26#include "generic.h"
27#include "clock.h" 27#include "clock.h"
@@ -184,9 +184,12 @@ static struct clk_lookup periph_clocks_lookups[] = {
184 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk), 184 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
185 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk), 185 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
186 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk), 186 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
187 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 187 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
188 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 188 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
189 CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), 189 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
190 CLKDEV_CON_DEV_ID("pclk", "fffd0000.ssc", &ssc0_clk),
191 CLKDEV_CON_DEV_ID("pclk", "fffd4000.ssc", &ssc1_clk),
192 CLKDEV_CON_DEV_ID("pclk", "fffd8000.ssc", &ssc2_clk),
190 CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200.0", &twi_clk), 193 CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200.0", &twi_clk),
191 /* fake hclk clock */ 194 /* fake hclk clock */
192 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), 195 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
@@ -194,6 +197,24 @@ static struct clk_lookup periph_clocks_lookups[] = {
194 CLKDEV_CON_ID("pioB", &pioB_clk), 197 CLKDEV_CON_ID("pioB", &pioB_clk),
195 CLKDEV_CON_ID("pioC", &pioC_clk), 198 CLKDEV_CON_ID("pioC", &pioC_clk),
196 CLKDEV_CON_ID("pioD", &pioD_clk), 199 CLKDEV_CON_ID("pioD", &pioD_clk),
200 /* usart lookup table for DT entries */
201 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
202 CLKDEV_CON_DEV_ID("usart", "fffc0000.serial", &usart0_clk),
203 CLKDEV_CON_DEV_ID("usart", "fffc4000.serial", &usart1_clk),
204 CLKDEV_CON_DEV_ID("usart", "fffc8000.serial", &usart2_clk),
205 CLKDEV_CON_DEV_ID("usart", "fffcc000.serial", &usart3_clk),
206 /* tc lookup table for DT entries */
207 CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
208 CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
209 CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
210 CLKDEV_CON_DEV_ID("t0_clk", "fffa4000.timer", &tc3_clk),
211 CLKDEV_CON_DEV_ID("t1_clk", "fffa4000.timer", &tc4_clk),
212 CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk),
213 CLKDEV_CON_DEV_ID("hclk", "300000.ohci", &ohci_clk),
214 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
215 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
216 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
217 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioD_clk),
197}; 218};
198 219
199static struct clk_lookup usart_clocks_lookups[] = { 220static struct clk_lookup usart_clocks_lookups[] = {
@@ -361,10 +382,10 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
361 0 /* Advanced Interrupt Controller (IRQ6) */ 382 0 /* Advanced Interrupt Controller (IRQ6) */
362}; 383};
363 384
364struct at91_init_soc __initdata at91rm9200_soc = { 385AT91_SOC_START(rm9200)
365 .map_io = at91rm9200_map_io, 386 .map_io = at91rm9200_map_io,
366 .default_irq_priority = at91rm9200_default_irq_priority, 387 .default_irq_priority = at91rm9200_default_irq_priority,
367 .ioremap_registers = at91rm9200_ioremap_registers, 388 .ioremap_registers = at91rm9200_ioremap_registers,
368 .register_clocks = at91rm9200_register_clocks, 389 .register_clocks = at91rm9200_register_clocks,
369 .init = at91rm9200_initialize, 390 .init = at91rm9200_initialize,
370}; 391AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 3cee0e6ea7c..3ebc9792560 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -18,11 +18,11 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
20 20
21#include <mach/board.h>
22#include <mach/at91rm9200.h> 21#include <mach/at91rm9200.h>
23#include <mach/at91rm9200_mc.h> 22#include <mach/at91rm9200_mc.h>
24#include <mach/at91_ramc.h> 23#include <mach/at91_ramc.h>
25 24
25#include "board.h"
26#include "generic.h" 26#include "generic.h"
27 27
28 28
@@ -752,7 +752,7 @@ static struct resource ssc0_resources[] = {
752}; 752};
753 753
754static struct platform_device at91rm9200_ssc0_device = { 754static struct platform_device at91rm9200_ssc0_device = {
755 .name = "ssc", 755 .name = "at91rm9200_ssc",
756 .id = 0, 756 .id = 0,
757 .dev = { 757 .dev = {
758 .dma_mask = &ssc0_dmamask, 758 .dma_mask = &ssc0_dmamask,
@@ -794,7 +794,7 @@ static struct resource ssc1_resources[] = {
794}; 794};
795 795
796static struct platform_device at91rm9200_ssc1_device = { 796static struct platform_device at91rm9200_ssc1_device = {
797 .name = "ssc", 797 .name = "at91rm9200_ssc",
798 .id = 1, 798 .id = 1,
799 .dev = { 799 .dev = {
800 .dma_mask = &ssc1_dmamask, 800 .dma_mask = &ssc1_dmamask,
@@ -836,7 +836,7 @@ static struct resource ssc2_resources[] = {
836}; 836};
837 837
838static struct platform_device at91rm9200_ssc2_device = { 838static struct platform_device at91rm9200_ssc2_device = {
839 .name = "ssc", 839 .name = "at91rm9200_ssc",
840 .id = 2, 840 .id = 2,
841 .dev = { 841 .dev = {
842 .dma_mask = &ssc2_dmamask, 842 .dma_mask = &ssc2_dmamask,
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index aaa443b48c9..cafe98836c8 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -24,6 +24,9 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/clockchips.h> 25#include <linux/clockchips.h>
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/of.h>
28#include <linux/of_address.h>
29#include <linux/of_irq.h>
27 30
28#include <asm/mach/time.h> 31#include <asm/mach/time.h>
29 32
@@ -91,7 +94,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
91static struct irqaction at91rm9200_timer_irq = { 94static struct irqaction at91rm9200_timer_irq = {
92 .name = "at91_tick", 95 .name = "at91_tick",
93 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 96 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
94 .handler = at91rm9200_timer_interrupt 97 .handler = at91rm9200_timer_interrupt,
98 .irq = NR_IRQS_LEGACY + AT91_ID_SYS,
95}; 99};
96 100
97static cycle_t read_clk32k(struct clocksource *cs) 101static cycle_t read_clk32k(struct clocksource *cs)
@@ -179,8 +183,60 @@ static struct clock_event_device clkevt = {
179void __iomem *at91_st_base; 183void __iomem *at91_st_base;
180EXPORT_SYMBOL_GPL(at91_st_base); 184EXPORT_SYMBOL_GPL(at91_st_base);
181 185
186#ifdef CONFIG_OF
187static struct of_device_id at91rm9200_st_timer_ids[] = {
188 { .compatible = "atmel,at91rm9200-st" },
189 { /* sentinel */ }
190};
191
192static int __init of_at91rm9200_st_init(void)
193{
194 struct device_node *np;
195 int ret;
196
197 np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
198 if (!np)
199 goto err;
200
201 at91_st_base = of_iomap(np, 0);
202 if (!at91_st_base)
203 goto node_err;
204
205 /* Get the interrupts property */
206 ret = irq_of_parse_and_map(np, 0);
207 if (!ret)
208 goto ioremap_err;
209 at91rm9200_timer_irq.irq = ret;
210
211 of_node_put(np);
212
213 return 0;
214
215ioremap_err:
216 iounmap(at91_st_base);
217node_err:
218 of_node_put(np);
219err:
220 return -EINVAL;
221}
222#else
223static int __init of_at91rm9200_st_init(void)
224{
225 return -EINVAL;
226}
227#endif
228
182void __init at91rm9200_ioremap_st(u32 addr) 229void __init at91rm9200_ioremap_st(u32 addr)
183{ 230{
231#ifdef CONFIG_OF
232 struct device_node *np;
233
234 np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
235 if (np) {
236 of_node_put(np);
237 return;
238 }
239#endif
184 at91_st_base = ioremap(addr, 256); 240 at91_st_base = ioremap(addr, 256);
185 if (!at91_st_base) 241 if (!at91_st_base)
186 panic("Impossible to ioremap ST\n"); 242 panic("Impossible to ioremap ST\n");
@@ -191,13 +247,16 @@ void __init at91rm9200_ioremap_st(u32 addr)
191 */ 247 */
192void __init at91rm9200_timer_init(void) 248void __init at91rm9200_timer_init(void)
193{ 249{
250 /* For device tree enabled device: initialize here */
251 of_at91rm9200_st_init();
252
194 /* Disable all timer interrupts, and clear any pending ones */ 253 /* Disable all timer interrupts, and clear any pending ones */
195 at91_st_write(AT91_ST_IDR, 254 at91_st_write(AT91_ST_IDR,
196 AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); 255 AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
197 at91_st_read(AT91_ST_SR); 256 at91_st_read(AT91_ST_SR);
198 257
199 /* Make IRQs happen for the system timer */ 258 /* Make IRQs happen for the system timer */
200 setup_irq(NR_IRQS_LEGACY + AT91_ID_SYS, &at91rm9200_timer_irq); 259 setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq);
201 260
202 /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used 261 /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
203 * directly for the clocksource and all clockevents, after adjusting 262 * directly for the clocksource and all clockevents, after adjusting
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index f8202615f4a..b67cd537411 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -20,10 +20,10 @@
20#include <mach/cpu.h> 20#include <mach/cpu.h>
21#include <mach/at91_dbgu.h> 21#include <mach/at91_dbgu.h>
22#include <mach/at91sam9260.h> 22#include <mach/at91sam9260.h>
23#include <mach/at91_aic.h>
24#include <mach/at91_pmc.h> 23#include <mach/at91_pmc.h>
25#include <mach/at91_rstc.h>
26 24
25#include "at91_aic.h"
26#include "at91_rstc.h"
27#include "soc.h" 27#include "soc.h"
28#include "generic.h" 28#include "generic.h"
29#include "clock.h" 29#include "clock.h"
@@ -210,7 +210,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
210 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk), 210 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
211 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk), 211 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
212 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk), 212 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
213 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), 213 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc_clk),
214 CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc_clk),
214 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk), 215 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk),
215 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi_clk), 216 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi_clk),
216 /* more usart lookup table for DT entries */ 217 /* more usart lookup table for DT entries */
@@ -230,11 +231,15 @@ static struct clk_lookup periph_clocks_lookups[] = {
230 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk), 231 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk),
231 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk), 232 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
232 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk), 233 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk),
234 CLKDEV_CON_DEV_ID("mci_clk", "fffa8000.mmc", &mmc_clk),
233 /* fake hclk clock */ 235 /* fake hclk clock */
234 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), 236 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
235 CLKDEV_CON_ID("pioA", &pioA_clk), 237 CLKDEV_CON_ID("pioA", &pioA_clk),
236 CLKDEV_CON_ID("pioB", &pioB_clk), 238 CLKDEV_CON_ID("pioB", &pioB_clk),
237 CLKDEV_CON_ID("pioC", &pioC_clk), 239 CLKDEV_CON_ID("pioC", &pioC_clk),
240 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
241 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
242 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
238}; 243};
239 244
240static struct clk_lookup usart_clocks_lookups[] = { 245static struct clk_lookup usart_clocks_lookups[] = {
@@ -390,10 +395,10 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
390 0, /* Advanced Interrupt Controller */ 395 0, /* Advanced Interrupt Controller */
391}; 396};
392 397
393struct at91_init_soc __initdata at91sam9260_soc = { 398AT91_SOC_START(sam9260)
394 .map_io = at91sam9260_map_io, 399 .map_io = at91sam9260_map_io,
395 .default_irq_priority = at91sam9260_default_irq_priority, 400 .default_irq_priority = at91sam9260_default_irq_priority,
396 .ioremap_registers = at91sam9260_ioremap_registers, 401 .ioremap_registers = at91sam9260_ioremap_registers,
397 .register_clocks = at91sam9260_register_clocks, 402 .register_clocks = at91sam9260_register_clocks,
398 .init = at91sam9260_initialize, 403 .init = at91sam9260_initialize,
399}; 404AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 414bd855fb0..eda8d1679d4 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -19,7 +19,6 @@
19 19
20#include <linux/platform_data/at91_adc.h> 20#include <linux/platform_data/at91_adc.h>
21 21
22#include <mach/board.h>
23#include <mach/cpu.h> 22#include <mach/cpu.h>
24#include <mach/at91sam9260.h> 23#include <mach/at91sam9260.h>
25#include <mach/at91sam9260_matrix.h> 24#include <mach/at91sam9260_matrix.h>
@@ -27,6 +26,7 @@
27#include <mach/at91sam9_smc.h> 26#include <mach/at91sam9_smc.h>
28#include <mach/at91_adc.h> 27#include <mach/at91_adc.h>
29 28
29#include "board.h"
30#include "generic.h" 30#include "generic.h"
31 31
32 32
@@ -742,7 +742,7 @@ static struct resource ssc_resources[] = {
742}; 742};
743 743
744static struct platform_device at91sam9260_ssc_device = { 744static struct platform_device at91sam9260_ssc_device = {
745 .name = "ssc", 745 .name = "at91rm9200_ssc",
746 .id = 0, 746 .id = 0,
747 .dev = { 747 .dev = {
748 .dma_mask = &ssc_dmamask, 748 .dma_mask = &ssc_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 04295c04b3e..2998a08afc2 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -19,10 +19,10 @@
19#include <asm/system_misc.h> 19#include <asm/system_misc.h>
20#include <mach/cpu.h> 20#include <mach/cpu.h>
21#include <mach/at91sam9261.h> 21#include <mach/at91sam9261.h>
22#include <mach/at91_aic.h>
23#include <mach/at91_pmc.h> 22#include <mach/at91_pmc.h>
24#include <mach/at91_rstc.h>
25 23
24#include "at91_aic.h"
25#include "at91_rstc.h"
26#include "soc.h" 26#include "soc.h"
27#include "generic.h" 27#include "generic.h"
28#include "clock.h" 28#include "clock.h"
@@ -174,9 +174,12 @@ static struct clk_lookup periph_clocks_lookups[] = {
174 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), 174 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
175 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), 175 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
176 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), 176 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
177 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 177 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
178 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 178 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
179 CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), 179 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
180 CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc0_clk),
181 CLKDEV_CON_DEV_ID("pclk", "fffc0000.ssc", &ssc1_clk),
182 CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc2_clk),
180 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0), 183 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
181 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9261.0", &twi_clk), 184 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9261.0", &twi_clk),
182 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi_clk), 185 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi_clk),
@@ -334,10 +337,10 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
334 0, /* Advanced Interrupt Controller */ 337 0, /* Advanced Interrupt Controller */
335}; 338};
336 339
337struct at91_init_soc __initdata at91sam9261_soc = { 340AT91_SOC_START(sam9261)
338 .map_io = at91sam9261_map_io, 341 .map_io = at91sam9261_map_io,
339 .default_irq_priority = at91sam9261_default_irq_priority, 342 .default_irq_priority = at91sam9261_default_irq_priority,
340 .ioremap_registers = at91sam9261_ioremap_registers, 343 .ioremap_registers = at91sam9261_ioremap_registers,
341 .register_clocks = at91sam9261_register_clocks, 344 .register_clocks = at91sam9261_register_clocks,
342 .init = at91sam9261_initialize, 345 .init = at91sam9261_initialize,
343}; 346AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index cd604aad8e9..92e0f861084 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -21,12 +21,12 @@
21#include <linux/fb.h> 21#include <linux/fb.h>
22#include <video/atmel_lcdc.h> 22#include <video/atmel_lcdc.h>
23 23
24#include <mach/board.h>
25#include <mach/at91sam9261.h> 24#include <mach/at91sam9261.h>
26#include <mach/at91sam9261_matrix.h> 25#include <mach/at91sam9261_matrix.h>
27#include <mach/at91_matrix.h> 26#include <mach/at91_matrix.h>
28#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
29 28
29#include "board.h"
30#include "generic.h" 30#include "generic.h"
31 31
32 32
@@ -706,7 +706,7 @@ static struct resource ssc0_resources[] = {
706}; 706};
707 707
708static struct platform_device at91sam9261_ssc0_device = { 708static struct platform_device at91sam9261_ssc0_device = {
709 .name = "ssc", 709 .name = "at91rm9200_ssc",
710 .id = 0, 710 .id = 0,
711 .dev = { 711 .dev = {
712 .dma_mask = &ssc0_dmamask, 712 .dma_mask = &ssc0_dmamask,
@@ -748,7 +748,7 @@ static struct resource ssc1_resources[] = {
748}; 748};
749 749
750static struct platform_device at91sam9261_ssc1_device = { 750static struct platform_device at91sam9261_ssc1_device = {
751 .name = "ssc", 751 .name = "at91rm9200_ssc",
752 .id = 1, 752 .id = 1,
753 .dev = { 753 .dev = {
754 .dma_mask = &ssc1_dmamask, 754 .dma_mask = &ssc1_dmamask,
@@ -790,7 +790,7 @@ static struct resource ssc2_resources[] = {
790}; 790};
791 791
792static struct platform_device at91sam9261_ssc2_device = { 792static struct platform_device at91sam9261_ssc2_device = {
793 .name = "ssc", 793 .name = "at91rm9200_ssc",
794 .id = 2, 794 .id = 2,
795 .dev = { 795 .dev = {
796 .dma_mask = &ssc2_dmamask, 796 .dma_mask = &ssc2_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index d6f9c23927c..b9fc60d1b33 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -18,10 +18,10 @@
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/system_misc.h> 19#include <asm/system_misc.h>
20#include <mach/at91sam9263.h> 20#include <mach/at91sam9263.h>
21#include <mach/at91_aic.h>
22#include <mach/at91_pmc.h> 21#include <mach/at91_pmc.h>
23#include <mach/at91_rstc.h>
24 22
23#include "at91_aic.h"
24#include "at91_rstc.h"
25#include "soc.h" 25#include "soc.h"
26#include "generic.h" 26#include "generic.h"
27#include "clock.h" 27#include "clock.h"
@@ -186,8 +186,10 @@ static struct clk *periph_clocks[] __initdata = {
186static struct clk_lookup periph_clocks_lookups[] = { 186static struct clk_lookup periph_clocks_lookups[] = {
187 /* One additional fake clock for macb_hclk */ 187 /* One additional fake clock for macb_hclk */
188 CLKDEV_CON_ID("hclk", &macb_clk), 188 CLKDEV_CON_ID("hclk", &macb_clk),
189 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 189 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
190 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 190 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
191 CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk),
192 CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk),
191 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), 193 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
192 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), 194 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
193 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), 195 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
@@ -211,7 +213,14 @@ static struct clk_lookup periph_clocks_lookups[] = {
211 CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk), 213 CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
212 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk), 214 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
213 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk), 215 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
216 CLKDEV_CON_DEV_ID("mci_clk", "fff80000.mmc", &mmc0_clk),
217 CLKDEV_CON_DEV_ID("mci_clk", "fff84000.mmc", &mmc1_clk),
214 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk), 218 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk),
219 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
220 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
221 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioCDE_clk),
222 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCDE_clk),
223 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCDE_clk),
215}; 224};
216 225
217static struct clk_lookup usart_clocks_lookups[] = { 226static struct clk_lookup usart_clocks_lookups[] = {
@@ -365,10 +374,10 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
365 0, /* Advanced Interrupt Controller (IRQ1) */ 374 0, /* Advanced Interrupt Controller (IRQ1) */
366}; 375};
367 376
368struct at91_init_soc __initdata at91sam9263_soc = { 377AT91_SOC_START(sam9263)
369 .map_io = at91sam9263_map_io, 378 .map_io = at91sam9263_map_io,
370 .default_irq_priority = at91sam9263_default_irq_priority, 379 .default_irq_priority = at91sam9263_default_irq_priority,
371 .ioremap_registers = at91sam9263_ioremap_registers, 380 .ioremap_registers = at91sam9263_ioremap_registers,
372 .register_clocks = at91sam9263_register_clocks, 381 .register_clocks = at91sam9263_register_clocks,
373 .init = at91sam9263_initialize, 382 .init = at91sam9263_initialize,
374}; 383AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 9c61e59a210..ed666f5cb01 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -20,12 +20,12 @@
20#include <linux/fb.h> 20#include <linux/fb.h>
21#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
22 22
23#include <mach/board.h>
24#include <mach/at91sam9263.h> 23#include <mach/at91sam9263.h>
25#include <mach/at91sam9263_matrix.h> 24#include <mach/at91sam9263_matrix.h>
26#include <mach/at91_matrix.h> 25#include <mach/at91_matrix.h>
27#include <mach/at91sam9_smc.h> 26#include <mach/at91sam9_smc.h>
28 27
28#include "board.h"
29#include "generic.h" 29#include "generic.h"
30 30
31 31
@@ -1199,7 +1199,7 @@ static struct resource ssc0_resources[] = {
1199}; 1199};
1200 1200
1201static struct platform_device at91sam9263_ssc0_device = { 1201static struct platform_device at91sam9263_ssc0_device = {
1202 .name = "ssc", 1202 .name = "at91rm9200_ssc",
1203 .id = 0, 1203 .id = 0,
1204 .dev = { 1204 .dev = {
1205 .dma_mask = &ssc0_dmamask, 1205 .dma_mask = &ssc0_dmamask,
@@ -1241,7 +1241,7 @@ static struct resource ssc1_resources[] = {
1241}; 1241};
1242 1242
1243static struct platform_device at91sam9263_ssc1_device = { 1243static struct platform_device at91sam9263_ssc1_device = {
1244 .name = "ssc", 1244 .name = "at91rm9200_ssc",
1245 .id = 1, 1245 .id = 1,
1246 .dev = { 1246 .dev = {
1247 .dma_mask = &ssc1_dmamask, 1247 .dma_mask = &ssc1_dmamask,
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index ffc0957d762..358412f1f5f 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -20,8 +20,18 @@
20 20
21#include <asm/mach/time.h> 21#include <asm/mach/time.h>
22 22
23#include <mach/at91_pit.h> 23#define AT91_PIT_MR 0x00 /* Mode Register */
24 24#define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */
25#define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */
26#define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */
27
28#define AT91_PIT_SR 0x04 /* Status Register */
29#define AT91_PIT_PITS (1 << 0) /* Timer Status */
30
31#define AT91_PIT_PIVR 0x08 /* Periodic Interval Value Register */
32#define AT91_PIT_PIIR 0x0c /* Periodic Interval Image Register */
33#define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */
34#define AT91_PIT_CPIV (0xfffff) /* Inverval Value */
25 35
26#define PIT_CPIV(x) ((x) & AT91_PIT_CPIV) 36#define PIT_CPIV(x) ((x) & AT91_PIT_CPIV)
27#define PIT_PICNT(x) (((x) & AT91_PIT_PICNT) >> 20) 37#define PIT_PICNT(x) (((x) & AT91_PIT_PICNT) >> 20)
diff --git a/arch/arm/mach-at91/at91sam9_alt_reset.S b/arch/arm/mach-at91/at91sam9_alt_reset.S
index 7af2e108b8a..f039538d3bd 100644
--- a/arch/arm/mach-at91/at91sam9_alt_reset.S
+++ b/arch/arm/mach-at91/at91sam9_alt_reset.S
@@ -16,7 +16,7 @@
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <mach/at91_ramc.h> 18#include <mach/at91_ramc.h>
19#include <mach/at91_rstc.h> 19#include "at91_rstc.h"
20 20
21 .arm 21 .arm
22 22
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 84af1b506d9..d3addee43d8 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -18,10 +18,10 @@
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/system_misc.h> 19#include <asm/system_misc.h>
20#include <mach/at91sam9g45.h> 20#include <mach/at91sam9g45.h>
21#include <mach/at91_aic.h>
22#include <mach/at91_pmc.h> 21#include <mach/at91_pmc.h>
23#include <mach/cpu.h> 22#include <mach/cpu.h>
24 23
24#include "at91_aic.h"
25#include "soc.h" 25#include "soc.h"
26#include "generic.h" 26#include "generic.h"
27#include "clock.h" 27#include "clock.h"
@@ -239,8 +239,10 @@ static struct clk_lookup periph_clocks_lookups[] = {
239 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), 239 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
240 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi0_clk), 240 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi0_clk),
241 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.1", &twi1_clk), 241 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.1", &twi1_clk),
242 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 242 CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.0", &ssc0_clk),
243 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 243 CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.1", &ssc1_clk),
244 CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc0_clk),
245 CLKDEV_CON_DEV_ID("pclk", "fffa0000.ssc", &ssc1_clk),
244 CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk), 246 CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
245 CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk), 247 CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk),
246 CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk), 248 CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk),
@@ -256,10 +258,18 @@ static struct clk_lookup periph_clocks_lookups[] = {
256 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk), 258 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
257 CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk), 259 CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
258 CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk), 260 CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
261 CLKDEV_CON_DEV_ID("mci_clk", "fff80000.mmc", &mmc0_clk),
262 CLKDEV_CON_DEV_ID("mci_clk", "fffd0000.mmc", &mmc1_clk),
259 CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk), 263 CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
260 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk), 264 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
261 /* fake hclk clock */ 265 /* fake hclk clock */
262 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), 266 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
267 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
268 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
269 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk),
270 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioDE_clk),
271 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioDE_clk),
272
263 CLKDEV_CON_ID("pioA", &pioA_clk), 273 CLKDEV_CON_ID("pioA", &pioA_clk),
264 CLKDEV_CON_ID("pioB", &pioB_clk), 274 CLKDEV_CON_ID("pioB", &pioB_clk),
265 CLKDEV_CON_ID("pioC", &pioC_clk), 275 CLKDEV_CON_ID("pioC", &pioC_clk),
@@ -343,7 +353,6 @@ static struct at91_gpio_bank at91sam9g45_gpio[] __initdata = {
343static void __init at91sam9g45_map_io(void) 353static void __init at91sam9g45_map_io(void)
344{ 354{
345 at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE); 355 at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE);
346 init_consistent_dma_size(SZ_4M);
347} 356}
348 357
349static void __init at91sam9g45_ioremap_registers(void) 358static void __init at91sam9g45_ioremap_registers(void)
@@ -409,10 +418,10 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
409 0, /* Advanced Interrupt Controller (IRQ0) */ 418 0, /* Advanced Interrupt Controller (IRQ0) */
410}; 419};
411 420
412struct at91_init_soc __initdata at91sam9g45_soc = { 421AT91_SOC_START(sam9g45)
413 .map_io = at91sam9g45_map_io, 422 .map_io = at91sam9g45_map_io,
414 .default_irq_priority = at91sam9g45_default_irq_priority, 423 .default_irq_priority = at91sam9g45_default_irq_priority,
415 .ioremap_registers = at91sam9g45_ioremap_registers, 424 .ioremap_registers = at91sam9g45_ioremap_registers,
416 .register_clocks = at91sam9g45_register_clocks, 425 .register_clocks = at91sam9g45_register_clocks,
417 .init = at91sam9g45_initialize, 426 .init = at91sam9g45_initialize,
418}; 427AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index fcd233cb33d..827c9f2a70f 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -26,7 +26,6 @@
26#include <video/atmel_lcdc.h> 26#include <video/atmel_lcdc.h>
27 27
28#include <mach/at91_adc.h> 28#include <mach/at91_adc.h>
29#include <mach/board.h>
30#include <mach/at91sam9g45.h> 29#include <mach/at91sam9g45.h>
31#include <mach/at91sam9g45_matrix.h> 30#include <mach/at91sam9g45_matrix.h>
32#include <mach/at91_matrix.h> 31#include <mach/at91_matrix.h>
@@ -36,6 +35,7 @@
36 35
37#include <media/atmel-isi.h> 36#include <media/atmel-isi.h>
38 37
38#include "board.h"
39#include "generic.h" 39#include "generic.h"
40#include "clock.h" 40#include "clock.h"
41 41
@@ -1459,7 +1459,7 @@ static struct resource ssc0_resources[] = {
1459}; 1459};
1460 1460
1461static struct platform_device at91sam9g45_ssc0_device = { 1461static struct platform_device at91sam9g45_ssc0_device = {
1462 .name = "ssc", 1462 .name = "at91sam9g45_ssc",
1463 .id = 0, 1463 .id = 0,
1464 .dev = { 1464 .dev = {
1465 .dma_mask = &ssc0_dmamask, 1465 .dma_mask = &ssc0_dmamask,
@@ -1501,7 +1501,7 @@ static struct resource ssc1_resources[] = {
1501}; 1501};
1502 1502
1503static struct platform_device at91sam9g45_ssc1_device = { 1503static struct platform_device at91sam9g45_ssc1_device = {
1504 .name = "ssc", 1504 .name = "at91sam9g45_ssc",
1505 .id = 1, 1505 .id = 1,
1506 .dev = { 1506 .dev = {
1507 .dma_mask = &ssc1_dmamask, 1507 .dma_mask = &ssc1_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9g45_reset.S b/arch/arm/mach-at91/at91sam9g45_reset.S
index 9d457182c86..721a1a34dd1 100644
--- a/arch/arm/mach-at91/at91sam9g45_reset.S
+++ b/arch/arm/mach-at91/at91sam9g45_reset.S
@@ -13,8 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/at91_ramc.h> 15#include <mach/at91_ramc.h>
16#include <mach/at91_rstc.h> 16#include "at91_rstc.h"
17
18 .arm 17 .arm
19 18
20 .globl at91sam9g45_restart 19 .globl at91sam9g45_restart
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 732d3d3f4ec..5dfc8fd8710 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -15,8 +15,8 @@
15#include <mach/at91sam9n12.h> 15#include <mach/at91sam9n12.h>
16#include <mach/at91_pmc.h> 16#include <mach/at91_pmc.h>
17#include <mach/cpu.h> 17#include <mach/cpu.h>
18#include <mach/board.h>
19 18
19#include "board.h"
20#include "soc.h" 20#include "soc.h"
21#include "generic.h" 21#include "generic.h"
22#include "clock.h" 22#include "clock.h"
@@ -168,13 +168,14 @@ static struct clk_lookup periph_clocks_lookups[] = {
168 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk), 168 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
169 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk), 169 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
170 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk), 170 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
171 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc_clk),
171 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk), 172 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
172 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk), 173 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
173 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk), 174 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
174 CLKDEV_CON_ID("pioA", &pioAB_clk), 175 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
175 CLKDEV_CON_ID("pioB", &pioAB_clk), 176 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
176 CLKDEV_CON_ID("pioC", &pioCD_clk), 177 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
177 CLKDEV_CON_ID("pioD", &pioCD_clk), 178 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCD_clk),
178 /* additional fake clock for macb_hclk */ 179 /* additional fake clock for macb_hclk */
179 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &uhp_clk), 180 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &uhp_clk),
180 CLKDEV_CON_DEV_ID("ohci_clk", "500000.ohci", &uhp_clk), 181 CLKDEV_CON_DEV_ID("ohci_clk", "500000.ohci", &uhp_clk),
@@ -223,13 +224,10 @@ static void __init at91sam9n12_map_io(void)
223void __init at91sam9n12_initialize(void) 224void __init at91sam9n12_initialize(void)
224{ 225{
225 at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0); 226 at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0);
226
227 /* Register GPIO subsystem (using DT) */
228 at91_gpio_init(NULL, 0);
229} 227}
230 228
231struct at91_init_soc __initdata at91sam9n12_soc = { 229AT91_SOC_START(sam9n12)
232 .map_io = at91sam9n12_map_io, 230 .map_io = at91sam9n12_map_io,
233 .register_clocks = at91sam9n12_register_clocks, 231 .register_clocks = at91sam9n12_register_clocks,
234 .init = at91sam9n12_initialize, 232 .init = at91sam9n12_initialize,
235}; 233AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 72e90841222..eb98704db2d 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -19,10 +19,10 @@
19#include <mach/cpu.h> 19#include <mach/cpu.h>
20#include <mach/at91_dbgu.h> 20#include <mach/at91_dbgu.h>
21#include <mach/at91sam9rl.h> 21#include <mach/at91sam9rl.h>
22#include <mach/at91_aic.h>
23#include <mach/at91_pmc.h> 22#include <mach/at91_pmc.h>
24#include <mach/at91_rstc.h>
25 23
24#include "at91_aic.h"
25#include "at91_rstc.h"
26#include "soc.h" 26#include "soc.h"
27#include "generic.h" 27#include "generic.h"
28#include "clock.h" 28#include "clock.h"
@@ -184,8 +184,10 @@ static struct clk_lookup periph_clocks_lookups[] = {
184 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), 184 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
185 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), 185 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
186 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), 186 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
187 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 187 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
188 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 188 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
189 CLKDEV_CON_DEV_ID("pclk", "fffc0000.ssc", &ssc0_clk),
190 CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc1_clk),
189 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk), 191 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk),
190 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk), 192 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk),
191 CLKDEV_CON_ID("pioA", &pioA_clk), 193 CLKDEV_CON_ID("pioA", &pioA_clk),
@@ -338,10 +340,10 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
338 0, /* Advanced Interrupt Controller */ 340 0, /* Advanced Interrupt Controller */
339}; 341};
340 342
341struct at91_init_soc __initdata at91sam9rl_soc = { 343AT91_SOC_START(sam9rl)
342 .map_io = at91sam9rl_map_io, 344 .map_io = at91sam9rl_map_io,
343 .default_irq_priority = at91sam9rl_default_irq_priority, 345 .default_irq_priority = at91sam9rl_default_irq_priority,
344 .ioremap_registers = at91sam9rl_ioremap_registers, 346 .ioremap_registers = at91sam9rl_ioremap_registers,
345 .register_clocks = at91sam9rl_register_clocks, 347 .register_clocks = at91sam9rl_register_clocks,
346 .init = at91sam9rl_initialize, 348 .init = at91sam9rl_initialize,
347}; 349AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 5047bdc92ad..ddf223ff35c 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -17,13 +17,13 @@
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <video/atmel_lcdc.h> 18#include <video/atmel_lcdc.h>
19 19
20#include <mach/board.h>
21#include <mach/at91sam9rl.h> 20#include <mach/at91sam9rl.h>
22#include <mach/at91sam9rl_matrix.h> 21#include <mach/at91sam9rl_matrix.h>
23#include <mach/at91_matrix.h> 22#include <mach/at91_matrix.h>
24#include <mach/at91sam9_smc.h> 23#include <mach/at91sam9_smc.h>
25#include <linux/platform_data/dma-atmel.h> 24#include <linux/platform_data/dma-atmel.h>
26 25
26#include "board.h"
27#include "generic.h" 27#include "generic.h"
28 28
29 29
@@ -832,7 +832,7 @@ static struct resource ssc0_resources[] = {
832}; 832};
833 833
834static struct platform_device at91sam9rl_ssc0_device = { 834static struct platform_device at91sam9rl_ssc0_device = {
835 .name = "ssc", 835 .name = "at91rm9200_ssc",
836 .id = 0, 836 .id = 0,
837 .dev = { 837 .dev = {
838 .dma_mask = &ssc0_dmamask, 838 .dma_mask = &ssc0_dmamask,
@@ -874,7 +874,7 @@ static struct resource ssc1_resources[] = {
874}; 874};
875 875
876static struct platform_device at91sam9rl_ssc1_device = { 876static struct platform_device at91sam9rl_ssc1_device = {
877 .name = "ssc", 877 .name = "at91rm9200_ssc",
878 .id = 1, 878 .id = 1,
879 .dev = { 879 .dev = {
880 .dma_mask = &ssc1_dmamask, 880 .dma_mask = &ssc1_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index e5035380dcb..44a9a62dcc1 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -15,8 +15,8 @@
15#include <mach/at91sam9x5.h> 15#include <mach/at91sam9x5.h>
16#include <mach/at91_pmc.h> 16#include <mach/at91_pmc.h>
17#include <mach/cpu.h> 17#include <mach/cpu.h>
18#include <mach/board.h>
19 18
19#include "board.h"
20#include "soc.h" 20#include "soc.h"
21#include "generic.h" 21#include "generic.h"
22#include "clock.h" 22#include "clock.h"
@@ -229,15 +229,18 @@ static struct clk_lookup periph_clocks_lookups[] = {
229 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk), 229 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
230 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk), 230 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
231 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk), 231 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
232 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc0_clk),
233 CLKDEV_CON_DEV_ID("mci_clk", "f000c000.mmc", &mmc1_clk),
232 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk), 234 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
233 CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk), 235 CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
236 CLKDEV_CON_DEV_ID("pclk", "f0010000.ssc", &ssc_clk),
234 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk), 237 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
235 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk), 238 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
236 CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk), 239 CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
237 CLKDEV_CON_ID("pioA", &pioAB_clk), 240 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
238 CLKDEV_CON_ID("pioB", &pioAB_clk), 241 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
239 CLKDEV_CON_ID("pioC", &pioCD_clk), 242 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
240 CLKDEV_CON_ID("pioD", &pioCD_clk), 243 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCD_clk),
241 /* additional fake clock for macb_hclk */ 244 /* additional fake clock for macb_hclk */
242 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk), 245 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk),
243 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk), 246 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk),
@@ -313,18 +316,11 @@ static void __init at91sam9x5_map_io(void)
313 at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); 316 at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE);
314} 317}
315 318
316void __init at91sam9x5_initialize(void)
317{
318 /* Register GPIO subsystem (using DT) */
319 at91_gpio_init(NULL, 0);
320}
321
322/* -------------------------------------------------------------------- 319/* --------------------------------------------------------------------
323 * Interrupt initialization 320 * Interrupt initialization
324 * -------------------------------------------------------------------- */ 321 * -------------------------------------------------------------------- */
325 322
326struct at91_init_soc __initdata at91sam9x5_soc = { 323AT91_SOC_START(sam9x5)
327 .map_io = at91sam9x5_map_io, 324 .map_io = at91sam9x5_map_io,
328 .register_clocks = at91sam9x5_register_clocks, 325 .register_clocks = at91sam9x5_register_clocks,
329 .init = at91sam9x5_initialize, 326AT91_SOC_END
330};
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
index bb7f54474b9..19ca7939690 100644
--- a/arch/arm/mach-at91/at91x40.c
+++ b/arch/arm/mach-at91/at91x40.c
@@ -18,9 +18,10 @@
18#include <asm/system_misc.h> 18#include <asm/system_misc.h>
19#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
20#include <mach/at91x40.h> 20#include <mach/at91x40.h>
21#include <mach/at91_aic.h>
22#include <mach/at91_st.h> 21#include <mach/at91_st.h>
23#include <mach/timex.h> 22#include <mach/timex.h>
23
24#include "at91_aic.h"
24#include "generic.h" 25#include "generic.h"
25 26
26/* 27/*
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
index ee06d7bcdf7..0e57e440c06 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -26,7 +26,8 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29#include <mach/at91_tc.h> 29
30#include "at91_tc.h"
30 31
31#define at91_tc_read(field) \ 32#define at91_tc_read(field) \
32 __raw_readl(AT91_IO_P2V(AT91_TC) + field) 33 __raw_readl(AT91_IO_P2V(AT91_TC) + field)
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 22d8856094f..b99b5752cc1 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -34,10 +34,10 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <mach/board.h>
38#include <mach/cpu.h> 37#include <mach/cpu.h>
39#include <mach/at91_aic.h>
40 38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42 42
43 43
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index 93a832f7023..854b9797428 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -43,9 +43,8 @@
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
45 45
46#include <mach/board.h> 46#include "at91_aic.h"
47#include <mach/at91_aic.h> 47#include "board.h"
48
49#include "generic.h" 48#include "generic.h"
50 49
51 50
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index 477e708497b..28a18ce6d91 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -38,10 +38,10 @@
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40 40
41#include <mach/board.h>
42#include <mach/at91_aic.h>
43#include <mach/at91sam9_smc.h> 41#include <mach/at91sam9_smc.h>
44 42
43#include "at91_aic.h"
44#include "board.h"
45#include "sam9_smc.h" 45#include "sam9_smc.h"
46#include "generic.h" 46#include "generic.h"
47 47
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 71d8f362a1d..c17bb533a94 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -35,9 +35,9 @@
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/board.h>
39#include <mach/at91_aic.h>
40 38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42 42
43 43
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index e71c473316e..847432441ec 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -40,12 +40,12 @@
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <mach/hardware.h> 42#include <mach/hardware.h>
43#include <mach/board.h>
44#include <mach/at91_aic.h>
45#include <mach/at91sam9_smc.h> 43#include <mach/at91sam9_smc.h>
46#include <mach/at91sam9260_matrix.h> 44#include <mach/at91sam9260_matrix.h>
47#include <mach/at91_matrix.h> 45#include <mach/at91_matrix.h>
48 46
47#include "at91_aic.h"
48#include "board.h"
49#include "sam9_smc.h" 49#include "sam9_smc.h"
50#include "generic.h" 50#include "generic.h"
51 51
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 2cbd1a2b6c3..2a7af786874 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -36,12 +36,12 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
38 38
39#include <mach/board.h>
40#include <mach/at91_aic.h>
41#include <mach/at91rm9200_mc.h> 39#include <mach/at91rm9200_mc.h>
42#include <mach/at91_ramc.h> 40#include <mach/at91_ramc.h>
43#include <mach/cpu.h> 41#include <mach/cpu.h>
44 42
43#include "at91_aic.h"
44#include "board.h"
45#include "generic.h" 45#include "generic.h"
46 46
47static struct gpio_led cpuat91_leds[] = { 47static struct gpio_led cpuat91_leds[] = {
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 3e37437a7a6..48a531e05be 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -38,9 +38,9 @@
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <mach/hardware.h> 40#include <mach/hardware.h>
41#include <mach/board.h>
42#include <mach/at91_aic.h>
43 41
42#include "at91_aic.h"
43#include "board.h"
44#include "generic.h" 44#include "generic.h"
45 45
46 46
@@ -53,6 +53,8 @@ static void __init csb337_init_early(void)
53static struct macb_platform_data __initdata csb337_eth_data = { 53static struct macb_platform_data __initdata csb337_eth_data = {
54 .phy_irq_pin = AT91_PIN_PC2, 54 .phy_irq_pin = AT91_PIN_PC2,
55 .is_rmii = 0, 55 .is_rmii = 0,
56 /* The CSB337 bootloader stores the MAC the wrong-way around */
57 .rev_eth_addr = 1,
56}; 58};
57 59
58static struct at91_usbh_data __initdata csb337_usbh_data = { 60static struct at91_usbh_data __initdata csb337_usbh_data = {
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 872871ab116..ec0f3abd504 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -35,9 +35,9 @@
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/board.h>
39#include <mach/at91_aic.h>
40 38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42 42
43 43
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
index e8f45c4e0ea..881170ce61d 100644
--- a/arch/arm/mach-at91/board-dt.c
+++ b/arch/arm/mach-at91/board-dt.c
@@ -15,23 +15,20 @@
15#include <linux/of_irq.h> 15#include <linux/of_irq.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17 17
18#include <mach/board.h>
19#include <mach/at91_aic.h>
20
21#include <asm/setup.h> 18#include <asm/setup.h>
22#include <asm/irq.h> 19#include <asm/irq.h>
23#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 21#include <asm/mach/map.h>
25#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
26 23
24#include "at91_aic.h"
25#include "board.h"
27#include "generic.h" 26#include "generic.h"
28 27
29 28
30static const struct of_device_id irq_of_match[] __initconst = { 29static const struct of_device_id irq_of_match[] __initconst = {
31 30
32 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init }, 31 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
33 { .compatible = "atmel,at91rm9200-gpio", .data = at91_gpio_of_irq_setup },
34 { .compatible = "atmel,at91sam9x5-gpio", .data = at91_gpio_of_irq_setup },
35 { /*sentinel*/ } 32 { /*sentinel*/ }
36}; 33};
37 34
diff --git a/arch/arm/mach-at91/board-eb01.c b/arch/arm/mach-at91/board-eb01.c
index 01f66e99ece..b489388a6f8 100644
--- a/arch/arm/mach-at91/board-eb01.c
+++ b/arch/arm/mach-at91/board-eb01.c
@@ -27,8 +27,9 @@
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <mach/board.h> 30
31#include <mach/at91_aic.h> 31#include "at91_aic.h"
32#include "board.h"
32#include "generic.h" 33#include "generic.h"
33 34
34static void __init at91eb01_init_irq(void) 35static void __init at91eb01_init_irq(void)
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 0cfac16ee9d..9f5e71c95f0 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -35,9 +35,8 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
37 37
38#include <mach/board.h> 38#include "at91_aic.h"
39#include <mach/at91_aic.h> 39#include "board.h"
40
41#include "generic.h" 40#include "generic.h"
42 41
43 42
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index 3d931ffac4b..ef69e0ebe94 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -37,10 +37,10 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <mach/board.h>
41#include <mach/cpu.h> 40#include <mach/cpu.h>
42#include <mach/at91_aic.h>
43 41
42#include "at91_aic.h"
43#include "board.h"
44#include "generic.h" 44#include "generic.h"
45 45
46 46
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index d93658a2b12..50f3d3795c0 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -24,12 +24,12 @@
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <mach/board.h>
28#include <mach/at91_aic.h>
29#include <mach/at91rm9200_mc.h> 27#include <mach/at91rm9200_mc.h>
30#include <mach/at91_ramc.h> 28#include <mach/at91_ramc.h>
31#include <mach/cpu.h> 29#include <mach/cpu.h>
32 30
31#include "at91_aic.h"
32#include "board.h"
33#include "generic.h" 33#include "generic.h"
34 34
35static void __init eco920_init_early(void) 35static void __init eco920_init_early(void)
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index fa98abacb1b..5d44eba0f20 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -33,9 +33,9 @@
33#include <asm/mach/irq.h> 33#include <asm/mach/irq.h>
34 34
35#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <mach/board.h>
37#include <mach/at91_aic.h>
38 36
37#include "at91_aic.h"
38#include "board.h"
39#include "generic.h" 39#include "generic.h"
40 40
41static void __init flexibity_init_early(void) 41static void __init flexibity_init_early(void)
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index 6e47071d820..191d37c16ba 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -41,10 +41,10 @@
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
43 43
44#include <mach/board.h>
45#include <mach/at91_aic.h>
46#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
47 45
46#include "at91_aic.h"
47#include "board.h"
48#include "sam9_smc.h" 48#include "sam9_smc.h"
49#include "generic.h" 49#include "generic.h"
50 50
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index a9d5e78118c..23a2fa17ab2 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -30,14 +30,14 @@
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32 32
33#include <mach/board.h>
34#include <mach/at91_aic.h>
35#include <mach/at91sam9_smc.h> 33#include <mach/at91sam9_smc.h>
36#include <mach/gsia18s.h>
37#include <mach/stamp9g20.h>
38 34
35#include "at91_aic.h"
36#include "board.h"
39#include "sam9_smc.h" 37#include "sam9_smc.h"
40#include "generic.h" 38#include "generic.h"
39#include "gsia18s.h"
40#include "stamp9g20.h"
41 41
42static void __init gsia18s_init_early(void) 42static void __init gsia18s_init_early(void)
43{ 43{
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index 86050da3ba5..9a43d1e1a03 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -34,10 +34,10 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <mach/board.h>
38#include <mach/at91_aic.h>
39#include <mach/cpu.h> 37#include <mach/cpu.h>
40 38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h" 41#include "generic.h"
42 42
43 43
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index abe9fed7a3e..f168bec2369 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -35,12 +35,12 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
37 37
38#include <mach/board.h>
39#include <mach/cpu.h> 38#include <mach/cpu.h>
40#include <mach/at91_aic.h>
41#include <mach/at91rm9200_mc.h> 39#include <mach/at91rm9200_mc.h>
42#include <mach/at91_ramc.h> 40#include <mach/at91_ramc.h>
43 41
42#include "at91_aic.h"
43#include "board.h"
44#include "generic.h" 44#include "generic.h"
45 45
46 46
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 6960778af4c..bc7a1c4a1f6 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -44,10 +44,10 @@
44#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
45 45
46#include <mach/hardware.h> 46#include <mach/hardware.h>
47#include <mach/board.h>
48#include <mach/at91_aic.h>
49#include <mach/at91sam9_smc.h> 47#include <mach/at91sam9_smc.h>
50 48
49#include "at91_aic.h"
50#include "board.h"
51#include "sam9_smc.h" 51#include "sam9_smc.h"
52#include "generic.h" 52#include "generic.h"
53 53
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index 9ca3e32c54c..0299554495d 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -29,13 +29,13 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31 31
32#include <mach/board.h>
33#include <mach/at91_aic.h>
34#include <mach/at91sam9_smc.h> 32#include <mach/at91sam9_smc.h>
35#include <mach/stamp9g20.h>
36 33
34#include "at91_aic.h"
35#include "board.h"
37#include "sam9_smc.h" 36#include "sam9_smc.h"
38#include "generic.h" 37#include "generic.h"
38#include "stamp9g20.h"
39 39
40 40
41static void __init pcontrol_g20_init_early(void) 41static void __init pcontrol_g20_init_early(void)
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index f83e1de699e..4938f1cd5e1 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -37,11 +37,11 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <mach/board.h>
41#include <mach/at91_aic.h>
42#include <mach/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
43#include <mach/at91_ramc.h> 41#include <mach/at91_ramc.h>
44 42
43#include "at91_aic.h"
44#include "board.h"
45#include "generic.h" 45#include "generic.h"
46 46
47 47
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 799f214edeb..33b1628467e 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -40,11 +40,11 @@
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <mach/hardware.h> 42#include <mach/hardware.h>
43#include <mach/board.h>
44#include <mach/at91_aic.h>
45#include <mach/at91sam9_smc.h> 43#include <mach/at91sam9_smc.h>
46#include <mach/at91_shdwc.h>
47 44
45#include "at91_aic.h"
46#include "at91_shdwc.h"
47#include "board.h"
48#include "sam9_smc.h" 48#include "sam9_smc.h"
49#include "generic.h" 49#include "generic.h"
50 50
diff --git a/arch/arm/mach-at91/board-rm9200-dt.c b/arch/arm/mach-at91/board-rm9200-dt.c
new file mode 100644
index 00000000000..5f9ce3da3fd
--- /dev/null
+++ b/arch/arm/mach-at91/board-rm9200-dt.c
@@ -0,0 +1,57 @@
1/*
2 * Setup code for AT91RM9200 Evaluation Kits with Device Tree support
3 *
4 * Copyright (C) 2011 Atmel,
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
6 * 2012 Joachim Eastwood <manabian@gmail.com>
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/gpio.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18
19#include <asm/setup.h>
20#include <asm/irq.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/map.h>
23#include <asm/mach/irq.h>
24
25#include "at91_aic.h"
26#include "generic.h"
27
28
29static const struct of_device_id irq_of_match[] __initconst = {
30 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
31 { /*sentinel*/ }
32};
33
34static void __init at91rm9200_dt_init_irq(void)
35{
36 of_irq_init(irq_of_match);
37}
38
39static void __init at91rm9200_dt_device_init(void)
40{
41 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
42}
43
44static const char *at91rm9200_dt_board_compat[] __initdata = {
45 "atmel,at91rm9200",
46 NULL
47};
48
49DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
50 .timer = &at91rm9200_timer,
51 .map_io = at91_map_io,
52 .handle_irq = at91_aic_handle_irq,
53 .init_early = at91rm9200_dt_initialize,
54 .init_irq = at91rm9200_dt_init_irq,
55 .init_machine = at91rm9200_dt_device_init,
56 .dt_compat = at91rm9200_dt_board_compat,
57MACHINE_END
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 66338e7ebfb..9e5061bef0d 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -39,11 +39,11 @@
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40 40
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/board.h>
43#include <mach/at91_aic.h>
44#include <mach/at91rm9200_mc.h> 42#include <mach/at91rm9200_mc.h>
45#include <mach/at91_ramc.h> 43#include <mach/at91_ramc.h>
46 44
45#include "at91_aic.h"
46#include "board.h"
47#include "generic.h" 47#include "generic.h"
48 48
49 49
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 5d1b5729dc6..58277dbc718 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -39,11 +39,11 @@
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40 40
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/board.h>
43#include <mach/at91_aic.h>
44#include <mach/at91rm9200_mc.h> 42#include <mach/at91rm9200_mc.h>
45#include <mach/at91_ramc.h> 43#include <mach/at91_ramc.h>
46 44
45#include "at91_aic.h"
46#include "board.h"
47#include "generic.h" 47#include "generic.h"
48 48
49 49
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
index a0ecf04e9ae..2e8b8339a20 100644
--- a/arch/arm/mach-at91/board-rsi-ews.c
+++ b/arch/arm/mach-at91/board-rsi-ews.c
@@ -25,11 +25,11 @@
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/board.h>
29#include <mach/at91_aic.h>
30 28
31#include <linux/gpio.h> 29#include <linux/gpio.h>
32 30
31#include "at91_aic.h"
32#include "board.h"
33#include "generic.h" 33#include "generic.h"
34 34
35static void __init rsi_ews_init_early(void) 35static void __init rsi_ews_init_early(void)
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index c5f01acce3c..b75fbf6003a 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -37,10 +37,10 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <mach/board.h>
41#include <mach/at91_aic.h>
42#include <mach/at91sam9_smc.h> 40#include <mach/at91sam9_smc.h>
43 41
42#include "at91_aic.h"
43#include "board.h"
44#include "sam9_smc.h" 44#include "sam9_smc.h"
45#include "generic.h" 45#include "generic.h"
46 46
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 8cd6e679fbe..f0135cd1d85 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -41,12 +41,12 @@
41#include <asm/mach/irq.h> 41#include <asm/mach/irq.h>
42 42
43#include <mach/hardware.h> 43#include <mach/hardware.h>
44#include <mach/board.h>
45#include <mach/at91_aic.h>
46#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
47#include <mach/at91_shdwc.h>
48#include <mach/system_rev.h> 45#include <mach/system_rev.h>
49 46
47#include "at91_aic.h"
48#include "at91_shdwc.h"
49#include "board.h"
50#include "sam9_smc.h" 50#include "sam9_smc.h"
51#include "generic.h" 51#include "generic.h"
52 52
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index a9167dd45f9..13ebaa8e410 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -45,12 +45,12 @@
45#include <asm/mach/irq.h> 45#include <asm/mach/irq.h>
46 46
47#include <mach/hardware.h> 47#include <mach/hardware.h>
48#include <mach/board.h>
49#include <mach/at91_aic.h>
50#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
51#include <mach/at91_shdwc.h>
52#include <mach/system_rev.h> 49#include <mach/system_rev.h>
53 50
51#include "at91_aic.h"
52#include "at91_shdwc.h"
53#include "board.h"
54#include "sam9_smc.h" 54#include "sam9_smc.h"
55#include "generic.h" 55#include "generic.h"
56 56
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index b87dbe2be0d..89b9608742a 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -44,12 +44,12 @@
44#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
45 45
46#include <mach/hardware.h> 46#include <mach/hardware.h>
47#include <mach/board.h>
48#include <mach/at91_aic.h>
49#include <mach/at91sam9_smc.h> 47#include <mach/at91sam9_smc.h>
50#include <mach/at91_shdwc.h>
51#include <mach/system_rev.h> 48#include <mach/system_rev.h>
52 49
50#include "at91_aic.h"
51#include "at91_shdwc.h"
52#include "board.h"
53#include "sam9_smc.h" 53#include "sam9_smc.h"
54#include "generic.h" 54#include "generic.h"
55 55
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 3ab2b86a376..1b7dd9f688d 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -43,11 +43,11 @@
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
45 45
46#include <mach/board.h>
47#include <mach/at91_aic.h>
48#include <mach/at91sam9_smc.h> 46#include <mach/at91sam9_smc.h>
49#include <mach/system_rev.h> 47#include <mach/system_rev.h>
50 48
49#include "at91_aic.h"
50#include "board.h"
51#include "sam9_smc.h" 51#include "sam9_smc.h"
52#include "generic.h" 52#include "generic.h"
53 53
@@ -353,6 +353,16 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
353 }, 353 },
354}; 354};
355 355
356static struct platform_device sam9g20ek_audio_device = {
357 .name = "at91sam9g20ek-audio",
358 .id = -1,
359};
360
361static void __init ek_add_device_audio(void)
362{
363 platform_device_register(&sam9g20ek_audio_device);
364}
365
356 366
357static void __init ek_board_init(void) 367static void __init ek_board_init(void)
358{ 368{
@@ -394,6 +404,7 @@ static void __init ek_board_init(void)
394 at91_set_B_periph(AT91_PIN_PC1, 0); 404 at91_set_B_periph(AT91_PIN_PC1, 0);
395 /* SSC (for WM8731) */ 405 /* SSC (for WM8731) */
396 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX); 406 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
407 ek_add_device_audio();
397} 408}
398 409
399MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK") 410MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 3d48ec15468..e4cc375e3a3 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -42,12 +42,12 @@
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
44 44
45#include <mach/board.h>
46#include <mach/at91_aic.h>
47#include <mach/at91sam9_smc.h> 45#include <mach/at91sam9_smc.h>
48#include <mach/at91_shdwc.h>
49#include <mach/system_rev.h> 46#include <mach/system_rev.h>
50 47
48#include "at91_aic.h"
49#include "at91_shdwc.h"
50#include "board.h"
51#include "sam9_smc.h" 51#include "sam9_smc.h"
52#include "generic.h" 52#include "generic.h"
53 53
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index fb89ea92e3f..377a1097afa 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -30,11 +30,12 @@
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/board.h>
34#include <mach/at91_aic.h>
35#include <mach/at91sam9_smc.h> 33#include <mach/at91sam9_smc.h>
36#include <mach/at91_shdwc.h>
37 34
35
36#include "at91_aic.h"
37#include "at91_shdwc.h"
38#include "board.h"
38#include "sam9_smc.h" 39#include "sam9_smc.h"
39#include "generic.h" 40#include "generic.h"
40 41
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index a4e031a039f..98771500ddb 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -32,10 +32,10 @@
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/board.h>
36#include <mach/at91_aic.h>
37#include <mach/at91sam9_smc.h> 35#include <mach/at91sam9_smc.h>
38 36
37#include "at91_aic.h"
38#include "board.h"
39#include "sam9_smc.h" 39#include "sam9_smc.h"
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index c3fb31d5116..48a962b61fa 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -25,10 +25,10 @@
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27 27
28#include <mach/board.h>
29#include <mach/at91_aic.h>
30#include <mach/at91sam9_smc.h> 28#include <mach/at91sam9_smc.h>
31 29
30#include "at91_aic.h"
31#include "board.h"
32#include "sam9_smc.h" 32#include "sam9_smc.h"
33#include "generic.h" 33#include "generic.h"
34 34
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
index 6ea069b5733..c1060f96e58 100644
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -41,11 +41,11 @@
41#include <asm/mach/irq.h> 41#include <asm/mach/irq.h>
42 42
43#include <mach/hardware.h> 43#include <mach/hardware.h>
44#include <mach/board.h>
45#include <mach/at91_aic.h>
46#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
47#include <mach/at91_shdwc.h>
48 45
46#include "at91_aic.h"
47#include "at91_shdwc.h"
48#include "board.h"
49#include "sam9_smc.h" 49#include "sam9_smc.h"
50#include "generic.h" 50#include "generic.h"
51 51
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index f162fdfd66e..8673aebcb85 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -43,12 +43,12 @@
43#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
44 44
45#include <mach/hardware.h> 45#include <mach/hardware.h>
46#include <mach/board.h>
47#include <mach/at91_aic.h>
48#include <mach/at91rm9200_mc.h> 46#include <mach/at91rm9200_mc.h>
49#include <mach/at91_ramc.h> 47#include <mach/at91_ramc.h>
50#include <mach/cpu.h> 48#include <mach/cpu.h>
51 49
50#include "at91_aic.h"
51#include "board.h"
52#include "generic.h" 52#include "generic.h"
53 53
54 54
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/board.h
index c55a4364ffb..4a234fb2ab3 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -31,71 +31,24 @@
31#ifndef __ASM_ARCH_BOARD_H 31#ifndef __ASM_ARCH_BOARD_H
32#define __ASM_ARCH_BOARD_H 32#define __ASM_ARCH_BOARD_H
33 33
34#include <linux/mtd/partitions.h>
35#include <linux/device.h>
36#include <linux/i2c.h>
37#include <linux/leds.h>
38#include <linux/spi/spi.h>
39#include <linux/usb/atmel_usba_udc.h>
40#include <linux/atmel-mci.h>
41#include <sound/atmel-ac97c.h>
42#include <linux/serial.h>
43#include <linux/platform_data/macb.h>
44#include <linux/platform_data/atmel.h> 34#include <linux/platform_data/atmel.h>
45 35
46 /* USB Device */ 36 /* USB Device */
47struct at91_udc_data {
48 int vbus_pin; /* high == host powering us */
49 u8 vbus_active_low; /* vbus polarity */
50 u8 vbus_polled; /* Use polling, not interrupt */
51 int pullup_pin; /* active == D+ pulled up */
52 u8 pullup_active_low; /* true == pullup_pin is active low */
53};
54extern void __init at91_add_device_udc(struct at91_udc_data *data); 37extern void __init at91_add_device_udc(struct at91_udc_data *data);
55 38
56 /* USB High Speed Device */ 39 /* USB High Speed Device */
57extern void __init at91_add_device_usba(struct usba_platform_data *data); 40extern void __init at91_add_device_usba(struct usba_platform_data *data);
58 41
59 /* Compact Flash */ 42 /* Compact Flash */
60struct at91_cf_data {
61 int irq_pin; /* I/O IRQ */
62 int det_pin; /* Card detect */
63 int vcc_pin; /* power switching */
64 int rst_pin; /* card reset */
65 u8 chipselect; /* EBI Chip Select number */
66 u8 flags;
67#define AT91_CF_TRUE_IDE 0x01
68#define AT91_IDE_SWAP_A0_A2 0x02
69};
70extern void __init at91_add_device_cf(struct at91_cf_data *data); 43extern void __init at91_add_device_cf(struct at91_cf_data *data);
71 44
72 /* MMC / SD */ 45 /* MMC / SD */
73 /* at91_mci platform config */
74struct at91_mmc_data {
75 int det_pin; /* card detect IRQ */
76 unsigned slot_b:1; /* uses Slot B */
77 unsigned wire4:1; /* (SD) supports DAT0..DAT3 */
78 int wp_pin; /* (SD) writeprotect detect */
79 int vcc_pin; /* power switching (high == on) */
80};
81extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data);
82
83 /* atmel-mci platform config */ 46 /* atmel-mci platform config */
84extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data); 47extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
85 48
86extern void __init at91_add_device_eth(struct macb_platform_data *data); 49extern void __init at91_add_device_eth(struct macb_platform_data *data);
87 50
88 /* USB Host */ 51 /* USB Host */
89#define AT91_MAX_USBH_PORTS 3
90struct at91_usbh_data {
91 int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
92 int overcurrent_pin[AT91_MAX_USBH_PORTS];
93 u8 ports; /* number of ports on root hub */
94 u8 overcurrent_supported;
95 u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
96 u8 overcurrent_status[AT91_MAX_USBH_PORTS];
97 u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
98};
99extern void __init at91_add_device_usbh(struct at91_usbh_data *data); 52extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
100extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data); 53extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
101extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data); 54extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data);
@@ -124,13 +77,6 @@ extern void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pin
124 77
125extern struct platform_device *atmel_default_console_device; 78extern struct platform_device *atmel_default_console_device;
126 79
127struct atmel_uart_data {
128 int num; /* port num */
129 short use_dma_tx; /* use transmit DMA? */
130 short use_dma_rx; /* use receive DMA? */
131 void __iomem *regs; /* virt. base address, if any */
132 struct serial_rs485 rs485; /* rs485 settings */
133};
134extern void __init at91_add_device_serial(void); 80extern void __init at91_add_device_serial(void);
135 81
136/* 82/*
@@ -173,24 +119,13 @@ extern void __init at91_add_device_isi(struct isi_platform_data *data,
173 bool use_pck_as_mck); 119 bool use_pck_as_mck);
174 120
175 /* Touchscreen Controller */ 121 /* Touchscreen Controller */
176struct at91_tsadcc_data {
177 unsigned int adc_clock;
178 u8 pendet_debounce;
179 u8 ts_sample_hold_time;
180};
181extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data); 122extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
182 123
183/* CAN */ 124/* CAN */
184struct at91_can_data {
185 void (*transceiver_switch)(int on);
186};
187extern void __init at91_add_device_can(struct at91_can_data *data); 125extern void __init at91_add_device_can(struct at91_can_data *data);
188 126
189 /* LEDs */ 127 /* LEDs */
190extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); 128extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
191extern void __init at91_pwm_leds(struct gpio_led *leds, int nr); 129extern void __init at91_pwm_leds(struct gpio_led *leds, int nr);
192 130
193/* FIXME: this needs a better location, but gets stuff building again */
194extern int at91_suspend_entering_slow_clock(void);
195
196#endif 131#endif
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index b62f560e6c7..fc593d615e7 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base,
20extern void __init at91rm9200_set_type(int type); 20extern void __init at91rm9200_set_type(int type);
21extern void __init at91_initialize(unsigned long main_clock); 21extern void __init at91_initialize(unsigned long main_clock);
22extern void __init at91x40_initialize(unsigned long main_clock); 22extern void __init at91x40_initialize(unsigned long main_clock);
23extern void __init at91rm9200_dt_initialize(void);
23extern void __init at91_dt_initialize(void); 24extern void __init at91_dt_initialize(void);
24 25
25 /* Interrupts */ 26 /* Interrupts */
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index be42cf0e74b..c5d7e1e9d75 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -23,8 +23,6 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/irqdomain.h> 24#include <linux/irqdomain.h>
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/of_irq.h>
27#include <linux/of_gpio.h>
28 26
29#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
30 28
@@ -33,6 +31,8 @@
33 31
34#include "generic.h" 32#include "generic.h"
35 33
34#define MAX_NB_GPIO_PER_BANK 32
35
36struct at91_gpio_chip { 36struct at91_gpio_chip {
37 struct gpio_chip chip; 37 struct gpio_chip chip;
38 struct at91_gpio_chip *next; /* Bank sharing same clock */ 38 struct at91_gpio_chip *next; /* Bank sharing same clock */
@@ -46,6 +46,7 @@ struct at91_gpio_chip {
46 46
47#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) 47#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip)
48 48
49static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset);
49static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip); 50static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip);
50static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val); 51static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val);
51static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset); 52static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset);
@@ -55,26 +56,27 @@ static int at91_gpiolib_direction_input(struct gpio_chip *chip,
55 unsigned offset); 56 unsigned offset);
56static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset); 57static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset);
57 58
58#define AT91_GPIO_CHIP(name, nr_gpio) \ 59#define AT91_GPIO_CHIP(name) \
59 { \ 60 { \
60 .chip = { \ 61 .chip = { \
61 .label = name, \ 62 .label = name, \
63 .request = at91_gpiolib_request, \
62 .direction_input = at91_gpiolib_direction_input, \ 64 .direction_input = at91_gpiolib_direction_input, \
63 .direction_output = at91_gpiolib_direction_output, \ 65 .direction_output = at91_gpiolib_direction_output, \
64 .get = at91_gpiolib_get, \ 66 .get = at91_gpiolib_get, \
65 .set = at91_gpiolib_set, \ 67 .set = at91_gpiolib_set, \
66 .dbg_show = at91_gpiolib_dbg_show, \ 68 .dbg_show = at91_gpiolib_dbg_show, \
67 .to_irq = at91_gpiolib_to_irq, \ 69 .to_irq = at91_gpiolib_to_irq, \
68 .ngpio = nr_gpio, \ 70 .ngpio = MAX_NB_GPIO_PER_BANK, \
69 }, \ 71 }, \
70 } 72 }
71 73
72static struct at91_gpio_chip gpio_chip[] = { 74static struct at91_gpio_chip gpio_chip[] = {
73 AT91_GPIO_CHIP("pioA", 32), 75 AT91_GPIO_CHIP("pioA"),
74 AT91_GPIO_CHIP("pioB", 32), 76 AT91_GPIO_CHIP("pioB"),
75 AT91_GPIO_CHIP("pioC", 32), 77 AT91_GPIO_CHIP("pioC"),
76 AT91_GPIO_CHIP("pioD", 32), 78 AT91_GPIO_CHIP("pioD"),
77 AT91_GPIO_CHIP("pioE", 32), 79 AT91_GPIO_CHIP("pioE"),
78}; 80};
79 81
80static int gpio_banks; 82static int gpio_banks;
@@ -89,7 +91,7 @@ static unsigned long at91_gpio_caps;
89 91
90static inline void __iomem *pin_to_controller(unsigned pin) 92static inline void __iomem *pin_to_controller(unsigned pin)
91{ 93{
92 pin /= 32; 94 pin /= MAX_NB_GPIO_PER_BANK;
93 if (likely(pin < gpio_banks)) 95 if (likely(pin < gpio_banks))
94 return gpio_chip[pin].regbase; 96 return gpio_chip[pin].regbase;
95 97
@@ -98,7 +100,7 @@ static inline void __iomem *pin_to_controller(unsigned pin)
98 100
99static inline unsigned pin_to_mask(unsigned pin) 101static inline unsigned pin_to_mask(unsigned pin)
100{ 102{
101 return 1 << (pin % 32); 103 return 1 << (pin % MAX_NB_GPIO_PER_BANK);
102} 104}
103 105
104 106
@@ -713,80 +715,6 @@ postcore_initcall(at91_gpio_debugfs_init);
713 */ 715 */
714static struct lock_class_key gpio_lock_class; 716static struct lock_class_key gpio_lock_class;
715 717
716#if defined(CONFIG_OF)
717static int at91_gpio_irq_map(struct irq_domain *h, unsigned int virq,
718 irq_hw_number_t hw)
719{
720 struct at91_gpio_chip *at91_gpio = h->host_data;
721
722 irq_set_lockdep_class(virq, &gpio_lock_class);
723
724 /*
725 * Can use the "simple" and not "edge" handler since it's
726 * shorter, and the AIC handles interrupts sanely.
727 */
728 irq_set_chip_and_handler(virq, &gpio_irqchip,
729 handle_simple_irq);
730 set_irq_flags(virq, IRQF_VALID);
731 irq_set_chip_data(virq, at91_gpio);
732
733 return 0;
734}
735
736static struct irq_domain_ops at91_gpio_ops = {
737 .map = at91_gpio_irq_map,
738 .xlate = irq_domain_xlate_twocell,
739};
740
741int __init at91_gpio_of_irq_setup(struct device_node *node,
742 struct device_node *parent)
743{
744 struct at91_gpio_chip *prev = NULL;
745 int alias_idx = of_alias_get_id(node, "gpio");
746 struct at91_gpio_chip *at91_gpio = &gpio_chip[alias_idx];
747
748 /* Setup proper .irq_set_type function */
749 if (has_pio3())
750 gpio_irqchip.irq_set_type = alt_gpio_irq_type;
751 else
752 gpio_irqchip.irq_set_type = gpio_irq_type;
753
754 /* Disable irqs of this PIO controller */
755 __raw_writel(~0, at91_gpio->regbase + PIO_IDR);
756
757 /* Setup irq domain */
758 at91_gpio->domain = irq_domain_add_linear(node, at91_gpio->chip.ngpio,
759 &at91_gpio_ops, at91_gpio);
760 if (!at91_gpio->domain)
761 panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n",
762 at91_gpio->pioc_idx);
763
764 /* Setup chained handler */
765 if (at91_gpio->pioc_idx)
766 prev = &gpio_chip[at91_gpio->pioc_idx - 1];
767
768 /* The toplevel handler handles one bank of GPIOs, except
769 * on some SoC it can handles up to three...
770 * We only set up the handler for the first of the list.
771 */
772 if (prev && prev->next == at91_gpio)
773 return 0;
774
775 at91_gpio->pioc_virq = irq_create_mapping(irq_find_host(parent),
776 at91_gpio->pioc_hwirq);
777 irq_set_chip_data(at91_gpio->pioc_virq, at91_gpio);
778 irq_set_chained_handler(at91_gpio->pioc_virq, gpio_irq_handler);
779
780 return 0;
781}
782#else
783int __init at91_gpio_of_irq_setup(struct device_node *node,
784 struct device_node *parent)
785{
786 return -EINVAL;
787}
788#endif
789
790/* 718/*
791 * irqdomain initialization: pile up irqdomains on top of AIC range 719 * irqdomain initialization: pile up irqdomains on top of AIC range
792 */ 720 */
@@ -862,6 +790,16 @@ void __init at91_gpio_irq_setup(void)
862} 790}
863 791
864/* gpiolib support */ 792/* gpiolib support */
793static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset)
794{
795 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
796 void __iomem *pio = at91_gpio->regbase;
797 unsigned mask = 1 << offset;
798
799 __raw_writel(mask, pio + PIO_PER);
800 return 0;
801}
802
865static int at91_gpiolib_direction_input(struct gpio_chip *chip, 803static int at91_gpiolib_direction_input(struct gpio_chip *chip,
866 unsigned offset) 804 unsigned offset)
867{ 805{
@@ -975,81 +913,11 @@ err:
975 return -EINVAL; 913 return -EINVAL;
976} 914}
977 915
978#ifdef CONFIG_OF_GPIO
979static void __init of_at91_gpio_init_one(struct device_node *np)
980{
981 int alias_idx;
982 struct at91_gpio_chip *at91_gpio;
983
984 if (!np)
985 return;
986
987 alias_idx = of_alias_get_id(np, "gpio");
988 if (alias_idx >= MAX_GPIO_BANKS) {
989 pr_err("at91_gpio, failed alias idx(%d) > MAX_GPIO_BANKS(%d), ignoring.\n",
990 alias_idx, MAX_GPIO_BANKS);
991 return;
992 }
993
994 at91_gpio = &gpio_chip[alias_idx];
995 at91_gpio->chip.base = alias_idx * at91_gpio->chip.ngpio;
996
997 at91_gpio->regbase = of_iomap(np, 0);
998 if (!at91_gpio->regbase) {
999 pr_err("at91_gpio.%d, failed to map registers, ignoring.\n",
1000 alias_idx);
1001 return;
1002 }
1003
1004 /* Get the interrupts property */
1005 if (of_property_read_u32(np, "interrupts", &at91_gpio->pioc_hwirq)) {
1006 pr_err("at91_gpio.%d, failed to get interrupts property, ignoring.\n",
1007 alias_idx);
1008 goto ioremap_err;
1009 }
1010
1011 /* Get capabilities from compatibility property */
1012 if (of_device_is_compatible(np, "atmel,at91sam9x5-gpio"))
1013 at91_gpio_caps |= AT91_GPIO_CAP_PIO3;
1014
1015 /* Setup clock */
1016 if (at91_gpio_setup_clk(alias_idx))
1017 goto ioremap_err;
1018
1019 at91_gpio->chip.of_node = np;
1020 gpio_banks = max(gpio_banks, alias_idx + 1);
1021 at91_gpio->pioc_idx = alias_idx;
1022 return;
1023
1024ioremap_err:
1025 iounmap(at91_gpio->regbase);
1026}
1027
1028static int __init of_at91_gpio_init(void)
1029{
1030 struct device_node *np = NULL;
1031
1032 /*
1033 * This isn't ideal, but it gets things hooked up until this
1034 * driver is converted into a platform_device
1035 */
1036 for_each_compatible_node(np, NULL, "atmel,at91rm9200-gpio")
1037 of_at91_gpio_init_one(np);
1038
1039 return gpio_banks > 0 ? 0 : -EINVAL;
1040}
1041#else
1042static int __init of_at91_gpio_init(void)
1043{
1044 return -EINVAL;
1045}
1046#endif
1047
1048static void __init at91_gpio_init_one(int idx, u32 regbase, int pioc_hwirq) 916static void __init at91_gpio_init_one(int idx, u32 regbase, int pioc_hwirq)
1049{ 917{
1050 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx]; 918 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx];
1051 919
1052 at91_gpio->chip.base = idx * at91_gpio->chip.ngpio; 920 at91_gpio->chip.base = idx * MAX_NB_GPIO_PER_BANK;
1053 at91_gpio->pioc_hwirq = pioc_hwirq; 921 at91_gpio->pioc_hwirq = pioc_hwirq;
1054 at91_gpio->pioc_idx = idx; 922 at91_gpio->pioc_idx = idx;
1055 923
@@ -1079,11 +947,11 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
1079 947
1080 BUG_ON(nr_banks > MAX_GPIO_BANKS); 948 BUG_ON(nr_banks > MAX_GPIO_BANKS);
1081 949
1082 if (of_at91_gpio_init() < 0) { 950 if (of_have_populated_dt())
1083 /* No GPIO controller found in device tree */ 951 return;
1084 for (i = 0; i < nr_banks; i++) 952
1085 at91_gpio_init_one(i, data[i].regbase, data[i].id); 953 for (i = 0; i < nr_banks; i++)
1086 } 954 at91_gpio_init_one(i, data[i].regbase, data[i].id);
1087 955
1088 for (i = 0; i < gpio_banks; i++) { 956 for (i = 0; i < gpio_banks; i++) {
1089 at91_gpio = &gpio_chip[i]; 957 at91_gpio = &gpio_chip[i];
diff --git a/arch/arm/mach-at91/include/mach/gsia18s.h b/arch/arm/mach-at91/gsia18s.h
index 307c194926f..307c194926f 100644
--- a/arch/arm/mach-at91/include/mach/gsia18s.h
+++ b/arch/arm/mach-at91/gsia18s.h
diff --git a/arch/arm/mach-at91/include/mach/at91_pit.h b/arch/arm/mach-at91/include/mach/at91_pit.h
deleted file mode 100644
index d1f80ad7f4d..00000000000
--- a/arch/arm/mach-at91/include/mach/at91_pit.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_pit.h
3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
7 * Periodic Interval Timer (PIT) - System peripherals regsters.
8 * Based on AT91SAM9261 datasheet revision D.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_PIT_H
17#define AT91_PIT_H
18
19#define AT91_PIT_MR 0x00 /* Mode Register */
20#define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */
21#define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */
22#define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */
23
24#define AT91_PIT_SR 0x04 /* Status Register */
25#define AT91_PIT_PITS (1 << 0) /* Timer Status */
26
27#define AT91_PIT_PIVR 0x08 /* Periodic Interval Value Register */
28#define AT91_PIT_PIIR 0x0c /* Periodic Interval Image Register */
29#define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */
30#define AT91_PIT_CPIV (0xfffff) /* Inverval Value */
31
32#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_rtc.h b/arch/arm/mach-at91/include/mach/at91_rtc.h
deleted file mode 100644
index da1945e5f71..00000000000
--- a/arch/arm/mach-at91/include/mach/at91_rtc.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_rtc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Real Time Clock (RTC) - System peripheral 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_RTC_H
17#define AT91_RTC_H
18
19#define AT91_RTC_CR 0x00 /* Control Register */
20#define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */
21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
28#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
29#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
30#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
31
32#define AT91_RTC_MR 0x04 /* Mode Register */
33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
34
35#define AT91_RTC_TIMR 0x08 /* Time Register */
36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
40
41#define AT91_RTC_CALR 0x0c /* Calendar Register */
42#define AT91_RTC_CENT (0x7f << 0) /* Current Century */
43#define AT91_RTC_YEAR (0xff << 8) /* Current Year */
44#define AT91_RTC_MONTH (0x1f << 16) /* Current Month */
45#define AT91_RTC_DAY (7 << 21) /* Current Day */
46#define AT91_RTC_DATE (0x3f << 24) /* Current Date */
47
48#define AT91_RTC_TIMALR 0x10 /* Time Alarm Register */
49#define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */
50#define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */
51#define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */
52
53#define AT91_RTC_CALALR 0x14 /* Calendar Alarm Register */
54#define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */
55#define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */
56
57#define AT91_RTC_SR 0x18 /* Status Register */
58#define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */
59#define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */
60#define AT91_RTC_SECEV (1 << 2) /* Second Event */
61#define AT91_RTC_TIMEV (1 << 3) /* Time Event */
62#define AT91_RTC_CALEV (1 << 4) /* Calendar Event */
63
64#define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */
65#define AT91_RTC_IER 0x20 /* Interrupt Enable Register */
66#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */
67#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */
68
69#define AT91_RTC_VER 0x2c /* Valid Entry Register */
70#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
71#define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */
72#define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */
73#define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */
74
75#endif
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200_emac.h b/arch/arm/mach-at91/include/mach/at91rm9200_emac.h
deleted file mode 100644
index b8260cd8041..00000000000
--- a/arch/arm/mach-at91/include/mach/at91rm9200_emac.h
+++ /dev/null
@@ -1,138 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91rm9200_emac.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Ethernet MAC registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_EMAC_H
17#define AT91RM9200_EMAC_H
18
19#define AT91_EMAC_CTL 0x00 /* Control Register */
20#define AT91_EMAC_LB (1 << 0) /* Loopback */
21#define AT91_EMAC_LBL (1 << 1) /* Loopback Local */
22#define AT91_EMAC_RE (1 << 2) /* Receive Enable */
23#define AT91_EMAC_TE (1 << 3) /* Transmit Enable */
24#define AT91_EMAC_MPE (1 << 4) /* Management Port Enable */
25#define AT91_EMAC_CSR (1 << 5) /* Clear Statistics Registers */
26#define AT91_EMAC_INCSTAT (1 << 6) /* Increment Statistics Registers */
27#define AT91_EMAC_WES (1 << 7) /* Write Enable for Statistics Registers */
28#define AT91_EMAC_BP (1 << 8) /* Back Pressure */
29
30#define AT91_EMAC_CFG 0x04 /* Configuration Register */
31#define AT91_EMAC_SPD (1 << 0) /* Speed */
32#define AT91_EMAC_FD (1 << 1) /* Full Duplex */
33#define AT91_EMAC_BR (1 << 2) /* Bit Rate */
34#define AT91_EMAC_CAF (1 << 4) /* Copy All Frames */
35#define AT91_EMAC_NBC (1 << 5) /* No Broadcast */
36#define AT91_EMAC_MTI (1 << 6) /* Multicast Hash Enable */
37#define AT91_EMAC_UNI (1 << 7) /* Unicast Hash Enable */
38#define AT91_EMAC_BIG (1 << 8) /* Receive 1522 Bytes */
39#define AT91_EMAC_EAE (1 << 9) /* External Address Match Enable */
40#define AT91_EMAC_CLK (3 << 10) /* MDC Clock Divisor */
41#define AT91_EMAC_CLK_DIV8 (0 << 10)
42#define AT91_EMAC_CLK_DIV16 (1 << 10)
43#define AT91_EMAC_CLK_DIV32 (2 << 10)
44#define AT91_EMAC_CLK_DIV64 (3 << 10)
45#define AT91_EMAC_RTY (1 << 12) /* Retry Test */
46#define AT91_EMAC_RMII (1 << 13) /* Reduce MII (RMII) */
47
48#define AT91_EMAC_SR 0x08 /* Status Register */
49#define AT91_EMAC_SR_LINK (1 << 0) /* Link */
50#define AT91_EMAC_SR_MDIO (1 << 1) /* MDIO pin */
51#define AT91_EMAC_SR_IDLE (1 << 2) /* PHY idle */
52
53#define AT91_EMAC_TAR 0x0c /* Transmit Address Register */
54
55#define AT91_EMAC_TCR 0x10 /* Transmit Control Register */
56#define AT91_EMAC_LEN (0x7ff << 0) /* Transmit Frame Length */
57#define AT91_EMAC_NCRC (1 << 15) /* No CRC */
58
59#define AT91_EMAC_TSR 0x14 /* Transmit Status Register */
60#define AT91_EMAC_TSR_OVR (1 << 0) /* Transmit Buffer Overrun */
61#define AT91_EMAC_TSR_COL (1 << 1) /* Collision Occurred */
62#define AT91_EMAC_TSR_RLE (1 << 2) /* Retry Limit Exceeded */
63#define AT91_EMAC_TSR_IDLE (1 << 3) /* Transmitter Idle */
64#define AT91_EMAC_TSR_BNQ (1 << 4) /* Transmit Buffer not Queued */
65#define AT91_EMAC_TSR_COMP (1 << 5) /* Transmit Complete */
66#define AT91_EMAC_TSR_UND (1 << 6) /* Transmit Underrun */
67
68#define AT91_EMAC_RBQP 0x18 /* Receive Buffer Queue Pointer */
69
70#define AT91_EMAC_RSR 0x20 /* Receive Status Register */
71#define AT91_EMAC_RSR_BNA (1 << 0) /* Buffer Not Available */
72#define AT91_EMAC_RSR_REC (1 << 1) /* Frame Received */
73#define AT91_EMAC_RSR_OVR (1 << 2) /* RX Overrun */
74
75#define AT91_EMAC_ISR 0x24 /* Interrupt Status Register */
76#define AT91_EMAC_DONE (1 << 0) /* Management Done */
77#define AT91_EMAC_RCOM (1 << 1) /* Receive Complete */
78#define AT91_EMAC_RBNA (1 << 2) /* Receive Buffer Not Available */
79#define AT91_EMAC_TOVR (1 << 3) /* Transmit Buffer Overrun */
80#define AT91_EMAC_TUND (1 << 4) /* Transmit Buffer Underrun */
81#define AT91_EMAC_RTRY (1 << 5) /* Retry Limit */
82#define AT91_EMAC_TBRE (1 << 6) /* Transmit Buffer Register Empty */
83#define AT91_EMAC_TCOM (1 << 7) /* Transmit Complete */
84#define AT91_EMAC_TIDLE (1 << 8) /* Transmit Idle */
85#define AT91_EMAC_LINK (1 << 9) /* Link */
86#define AT91_EMAC_ROVR (1 << 10) /* RX Overrun */
87#define AT91_EMAC_ABT (1 << 11) /* Abort */
88
89#define AT91_EMAC_IER 0x28 /* Interrupt Enable Register */
90#define AT91_EMAC_IDR 0x2c /* Interrupt Disable Register */
91#define AT91_EMAC_IMR 0x30 /* Interrupt Mask Register */
92
93#define AT91_EMAC_MAN 0x34 /* PHY Maintenance Register */
94#define AT91_EMAC_DATA (0xffff << 0) /* MDIO Data */
95#define AT91_EMAC_REGA (0x1f << 18) /* MDIO Register */
96#define AT91_EMAC_PHYA (0x1f << 23) /* MDIO PHY Address */
97#define AT91_EMAC_RW (3 << 28) /* Read/Write operation */
98#define AT91_EMAC_RW_W (1 << 28)
99#define AT91_EMAC_RW_R (2 << 28)
100#define AT91_EMAC_MAN_802_3 0x40020000 /* IEEE 802.3 value */
101
102/*
103 * Statistics Registers.
104 */
105#define AT91_EMAC_FRA 0x40 /* Frames Transmitted OK */
106#define AT91_EMAC_SCOL 0x44 /* Single Collision Frame */
107#define AT91_EMAC_MCOL 0x48 /* Multiple Collision Frame */
108#define AT91_EMAC_OK 0x4c /* Frames Received OK */
109#define AT91_EMAC_SEQE 0x50 /* Frame Check Sequence Error */
110#define AT91_EMAC_ALE 0x54 /* Alignmemt Error */
111#define AT91_EMAC_DTE 0x58 /* Deffered Transmission Frame */
112#define AT91_EMAC_LCOL 0x5c /* Late Collision */
113#define AT91_EMAC_ECOL 0x60 /* Excessive Collision */
114#define AT91_EMAC_TUE 0x64 /* Transmit Underrun Error */
115#define AT91_EMAC_CSE 0x68 /* Carrier Sense Error */
116#define AT91_EMAC_DRFC 0x6c /* Discard RX Frame */
117#define AT91_EMAC_ROV 0x70 /* Receive Overrun */
118#define AT91_EMAC_CDE 0x74 /* Code Error */
119#define AT91_EMAC_ELR 0x78 /* Excessive Length Error */
120#define AT91_EMAC_RJB 0x7c /* Receive Jabber */
121#define AT91_EMAC_USF 0x80 /* Undersize Frame */
122#define AT91_EMAC_SQEE 0x84 /* SQE Test Error */
123
124/*
125 * Address Registers.
126 */
127#define AT91_EMAC_HSL 0x90 /* Hash Address Low [31:0] */
128#define AT91_EMAC_HSH 0x94 /* Hash Address High [63:32] */
129#define AT91_EMAC_SA1L 0x98 /* Specific Address 1 Low, bytes 0-3 */
130#define AT91_EMAC_SA1H 0x9c /* Specific Address 1 High, bytes 4-5 */
131#define AT91_EMAC_SA2L 0xa0 /* Specific Address 2 Low, bytes 0-3 */
132#define AT91_EMAC_SA2H 0xa4 /* Specific Address 2 High, bytes 4-5 */
133#define AT91_EMAC_SA3L 0xa8 /* Specific Address 3 Low, bytes 0-3 */
134#define AT91_EMAC_SA3H 0xac /* Specific Address 3 High, bytes 4-5 */
135#define AT91_EMAC_SA4L 0xb0 /* Specific Address 4 Low, bytes 0-3 */
136#define AT91_EMAC_SA4H 0xb4 /* Specific Address 4 High, bytes 4-5 */
137
138#endif
diff --git a/arch/arm/mach-at91/include/mach/atmel-mci.h b/arch/arm/mach-at91/include/mach/atmel-mci.h
index cd580a12e90..3069e413557 100644
--- a/arch/arm/mach-at91/include/mach/atmel-mci.h
+++ b/arch/arm/mach-at91/include/mach/atmel-mci.h
@@ -14,11 +14,4 @@ struct mci_dma_data {
14#define slave_data_ptr(s) (&(s)->sdata) 14#define slave_data_ptr(s) (&(s)->sdata)
15#define find_slave_dev(s) ((s)->sdata.dma_dev) 15#define find_slave_dev(s) ((s)->sdata.dma_dev)
16 16
17#define setup_dma_addr(s, t, r) do { \
18 if (s) { \
19 (s)->sdata.tx_reg = (t); \
20 (s)->sdata.rx_reg = (r); \
21 } \
22} while (0)
23
24#endif /* __MACH_ATMEL_MCI_H */ 17#endif /* __MACH_ATMEL_MCI_H */
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index 711a7892d33..a832e070761 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -90,9 +90,6 @@
90#define AT91_SRAM_MAX SZ_1M 90#define AT91_SRAM_MAX SZ_1M
91#define AT91_VIRT_BASE (AT91_IO_VIRT_BASE - AT91_SRAM_MAX) 91#define AT91_VIRT_BASE (AT91_IO_VIRT_BASE - AT91_SRAM_MAX)
92 92
93/* Serial ports */
94#define ATMEL_MAX_UART 7 /* 6 USART3's and one DBGU port (SAM9260) */
95
96/* External Memory Map */ 93/* External Memory Map */
97#define AT91_CHIPSELECT_0 0x10000000 94#define AT91_CHIPSELECT_0 0x10000000
98#define AT91_CHIPSELECT_1 0x20000000 95#define AT91_CHIPSELECT_1 0x20000000
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
index febc2ee901a..8e210262aee 100644
--- a/arch/arm/mach-at91/irq.c
+++ b/arch/arm/mach-at91/irq.c
@@ -42,7 +42,7 @@
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44 44
45#include <mach/at91_aic.h> 45#include "at91_aic.h"
46 46
47void __iomem *at91_aic_base; 47void __iomem *at91_aic_base;
48static struct irq_domain *at91_aic_domain; 48static struct irq_domain *at91_aic_domain;
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 1b1e62b5f41..3e22978b554 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -15,7 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <mach/board.h> 18#include "board.h"
19 19
20 20
21/* ------------------------------------------------------------------------- */ 21/* ------------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 5315f05896e..adb6db888a1 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -25,10 +25,10 @@
25#include <asm/mach/time.h> 25#include <asm/mach/time.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27 27
28#include <mach/at91_aic.h>
29#include <mach/at91_pmc.h> 28#include <mach/at91_pmc.h>
30#include <mach/cpu.h> 29#include <mach/cpu.h>
31 30
31#include "at91_aic.h"
32#include "generic.h" 32#include "generic.h"
33#include "pm.h" 33#include "pm.h"
34 34
@@ -36,8 +36,8 @@
36 * Show the reason for the previous system reset. 36 * Show the reason for the previous system reset.
37 */ 37 */
38 38
39#include <mach/at91_rstc.h> 39#include "at91_rstc.h"
40#include <mach/at91_shdwc.h> 40#include "at91_shdwc.h"
41 41
42static void __init show_reset_status(void) 42static void __init show_reset_status(void)
43{ 43{
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 0b32c81730a..9ee866ce047 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -10,6 +10,7 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
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 14
14#include <asm/system_misc.h> 15#include <asm/system_misc.h>
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
@@ -18,8 +19,8 @@
18#include <mach/cpu.h> 19#include <mach/cpu.h>
19#include <mach/at91_dbgu.h> 20#include <mach/at91_dbgu.h>
20#include <mach/at91_pmc.h> 21#include <mach/at91_pmc.h>
21#include <mach/at91_shdwc.h>
22 22
23#include "at91_shdwc.h"
23#include "soc.h" 24#include "soc.h"
24#include "generic.h" 25#include "generic.h"
25 26
@@ -338,6 +339,7 @@ static void at91_dt_rstc(void)
338} 339}
339 340
340static struct of_device_id ramc_ids[] = { 341static struct of_device_id ramc_ids[] = {
342 { .compatible = "atmel,at91rm9200-sdramc" },
341 { .compatible = "atmel,at91sam9260-sdramc" }, 343 { .compatible = "atmel,at91sam9260-sdramc" },
342 { .compatible = "atmel,at91sam9g45-ddramc" }, 344 { .compatible = "atmel,at91sam9g45-ddramc" },
343 { /*sentinel*/ } 345 { /*sentinel*/ }
@@ -436,6 +438,19 @@ end:
436 of_node_put(np); 438 of_node_put(np);
437} 439}
438 440
441void __init at91rm9200_dt_initialize(void)
442{
443 at91_dt_ramc();
444
445 /* Init clock subsystem */
446 at91_dt_clock_init();
447
448 /* Register the processor-specific clocks */
449 at91_boot_soc.register_clocks();
450
451 at91_boot_soc.init();
452}
453
439void __init at91_dt_initialize(void) 454void __init at91_dt_initialize(void)
440{ 455{
441 at91_dt_rstc(); 456 at91_dt_rstc();
@@ -448,7 +463,8 @@ void __init at91_dt_initialize(void)
448 /* Register the processor-specific clocks */ 463 /* Register the processor-specific clocks */
449 at91_boot_soc.register_clocks(); 464 at91_boot_soc.register_clocks();
450 465
451 at91_boot_soc.init(); 466 if (at91_boot_soc.init)
467 at91_boot_soc.init();
452} 468}
453#endif 469#endif
454 470
@@ -463,4 +479,6 @@ void __init at91_initialize(unsigned long main_clock)
463 at91_boot_soc.register_clocks(); 479 at91_boot_soc.register_clocks();
464 480
465 at91_boot_soc.init(); 481 at91_boot_soc.init();
482
483 pinctrl_provide_dummies();
466} 484}
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index a9cfeb15371..9c6d3d4f9a2 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -5,6 +5,7 @@
5 */ 5 */
6 6
7struct at91_init_soc { 7struct at91_init_soc {
8 int builtin;
8 unsigned int *default_irq_priority; 9 unsigned int *default_irq_priority;
9 void (*map_io)(void); 10 void (*map_io)(void);
10 void (*ioremap_registers)(void); 11 void (*ioremap_registers)(void);
@@ -22,9 +23,18 @@ extern struct at91_init_soc at91sam9rl_soc;
22extern struct at91_init_soc at91sam9x5_soc; 23extern struct at91_init_soc at91sam9x5_soc;
23extern struct at91_init_soc at91sam9n12_soc; 24extern struct at91_init_soc at91sam9n12_soc;
24 25
26#define AT91_SOC_START(_name) \
27struct at91_init_soc __initdata at91##_name##_soc \
28 __used \
29 = { \
30 .builtin = 1, \
31
32#define AT91_SOC_END \
33};
34
25static inline int at91_soc_is_enabled(void) 35static inline int at91_soc_is_enabled(void)
26{ 36{
27 return at91_boot_soc.init != NULL; 37 return at91_boot_soc.builtin;
28} 38}
29 39
30#if !defined(CONFIG_SOC_AT91RM9200) 40#if !defined(CONFIG_SOC_AT91RM9200)
diff --git a/arch/arm/mach-at91/include/mach/stamp9g20.h b/arch/arm/mach-at91/stamp9g20.h
index f62c0abca4b..f62c0abca4b 100644
--- a/arch/arm/mach-at91/include/mach/stamp9g20.h
+++ b/arch/arm/mach-at91/stamp9g20.h
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
new file mode 100644
index 00000000000..48705c10a0f
--- /dev/null
+++ b/arch/arm/mach-bcm/Kconfig
@@ -0,0 +1,19 @@
1config ARCH_BCM
2 bool "Broadcom SoC" if ARCH_MULTI_V7
3 depends on MMU
4 select ARCH_REQUIRE_GPIOLIB
5 select ARM_ERRATA_754322
6 select ARM_ERRATA_764369 if SMP
7 select ARM_GIC
8 select CPU_V7
9 select GENERIC_CLOCKEVENTS
10 select GENERIC_GPIO
11 select GENERIC_TIME
12 select GPIO_BCM
13 select SPARSE_IRQ
14 select TICK_ONESHOT
15 help
16 This enables support for system based on Broadcom SoCs.
17 It currently supports the 'BCM281XX' family, which includes
18 BCM11130, BCM11140, BCM11351, BCM28145 and
19 BCM28155 variants.
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
new file mode 100644
index 00000000000..bbf412261e5
--- /dev/null
+++ b/arch/arm/mach-bcm/Makefile
@@ -0,0 +1,13 @@
1#
2# Copyright (C) 2012 Broadcom Corporation
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License as
6# published by the Free Software Foundation version 2.
7#
8# This program is distributed "as is" WITHOUT ANY WARRANTY of any
9# kind, whether express or implied; without even the implied warranty
10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12
13obj-$(CONFIG_ARCH_BCM) := board_bcm.o
diff --git a/arch/arm/mach-bcm/board_bcm.c b/arch/arm/mach-bcm/board_bcm.c
new file mode 100644
index 00000000000..3a62f1b1cab
--- /dev/null
+++ b/arch/arm/mach-bcm/board_bcm.c
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2012 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/of_irq.h>
15#include <linux/of_platform.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/platform_device.h>
19
20#include <asm/mach/arch.h>
21#include <asm/hardware/gic.h>
22
23#include <asm/mach/time.h>
24
25static const struct of_device_id irq_match[] = {
26 {.compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
27 {}
28};
29
30static void timer_init(void)
31{
32}
33
34static struct sys_timer timer = {
35 .init = timer_init,
36};
37
38static void __init init_irq(void)
39{
40 of_irq_init(irq_match);
41}
42
43static void __init board_init(void)
44{
45 of_platform_populate(NULL, of_default_bus_match_table, NULL,
46 &platform_bus);
47}
48
49static const char * const bcm11351_dt_compat[] = { "bcm,bcm11351", NULL, };
50
51DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
52 .init_irq = init_irq,
53 .timer = &timer,
54 .init_machine = board_init,
55 .dt_compat = bcm11351_dt_compat,
56 .handle_irq = gic_handle_irq,
57MACHINE_END
diff --git a/arch/arm/mach-bcm2835/Makefile.boot b/arch/arm/mach-bcm2835/Makefile.boot
index 2d30e17f5b6..b3271754e9f 100644
--- a/arch/arm/mach-bcm2835/Makefile.boot
+++ b/arch/arm/mach-bcm2835/Makefile.boot
@@ -1,3 +1 @@
1 zreladdr-y := 0x00008000 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index f6fea493357..f0d739f4b7a 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -12,8 +12,10 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 */ 13 */
14 14
15#include <linux/delay.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/irqchip/bcm2835.h> 17#include <linux/irqchip/bcm2835.h>
18#include <linux/of_address.h>
17#include <linux/of_platform.h> 19#include <linux/of_platform.h>
18#include <linux/bcm2835_timer.h> 20#include <linux/bcm2835_timer.h>
19#include <linux/clk/bcm2835.h> 21#include <linux/clk/bcm2835.h>
@@ -23,6 +25,48 @@
23 25
24#include <mach/bcm2835_soc.h> 26#include <mach/bcm2835_soc.h>
25 27
28#define PM_RSTC 0x1c
29#define PM_WDOG 0x24
30
31#define PM_PASSWORD 0x5a000000
32#define PM_RSTC_WRCFG_MASK 0x00000030
33#define PM_RSTC_WRCFG_FULL_RESET 0x00000020
34
35static void __iomem *wdt_regs;
36
37/*
38 * The machine restart method can be called from an atomic context so we won't
39 * be able to ioremap the regs then.
40 */
41static void bcm2835_setup_restart(void)
42{
43 struct device_node *np = of_find_compatible_node(NULL, NULL,
44 "brcm,bcm2835-pm-wdt");
45 if (WARN(!np, "unable to setup watchdog restart"))
46 return;
47
48 wdt_regs = of_iomap(np, 0);
49 WARN(!wdt_regs, "failed to remap watchdog regs");
50}
51
52static void bcm2835_restart(char mode, const char *cmd)
53{
54 u32 val;
55
56 if (!wdt_regs)
57 return;
58
59 /* use a timeout of 10 ticks (~150us) */
60 writel_relaxed(10 | PM_PASSWORD, wdt_regs + PM_WDOG);
61 val = readl_relaxed(wdt_regs + PM_RSTC);
62 val &= ~PM_RSTC_WRCFG_MASK;
63 val |= PM_PASSWORD | PM_RSTC_WRCFG_FULL_RESET;
64 writel_relaxed(val, wdt_regs + PM_RSTC);
65
66 /* No sleeping, possibly atomic. */
67 mdelay(1);
68}
69
26static struct map_desc io_map __initdata = { 70static struct map_desc io_map __initdata = {
27 .virtual = BCM2835_PERIPH_VIRT, 71 .virtual = BCM2835_PERIPH_VIRT,
28 .pfn = __phys_to_pfn(BCM2835_PERIPH_PHYS), 72 .pfn = __phys_to_pfn(BCM2835_PERIPH_PHYS),
@@ -30,15 +74,16 @@ static struct map_desc io_map __initdata = {
30 .type = MT_DEVICE 74 .type = MT_DEVICE
31}; 75};
32 76
33void __init bcm2835_map_io(void) 77static void __init bcm2835_map_io(void)
34{ 78{
35 iotable_init(&io_map, 1); 79 iotable_init(&io_map, 1);
36} 80}
37 81
38void __init bcm2835_init(void) 82static void __init bcm2835_init(void)
39{ 83{
40 int ret; 84 int ret;
41 85
86 bcm2835_setup_restart();
42 bcm2835_init_clocks(); 87 bcm2835_init_clocks();
43 88
44 ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, 89 ret = of_platform_populate(NULL, of_default_bus_match_table, NULL,
@@ -60,5 +105,6 @@ DT_MACHINE_START(BCM2835, "BCM2835")
60 .handle_irq = bcm2835_handle_irq, 105 .handle_irq = bcm2835_handle_irq,
61 .init_machine = bcm2835_init, 106 .init_machine = bcm2835_init,
62 .timer = &bcm2835_timer, 107 .timer = &bcm2835_timer,
108 .restart = bcm2835_restart,
63 .dt_compat = bcm2835_compat 109 .dt_compat = bcm2835_compat
64MACHINE_END 110MACHINE_END
diff --git a/arch/arm/mach-bcm2835/include/mach/gpio.h b/arch/arm/mach-bcm2835/include/mach/gpio.h
new file mode 100644
index 00000000000..40a8c178f10
--- /dev/null
+++ b/arch/arm/mach-bcm2835/include/mach/gpio.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index 263242da2cb..2d00165e85e 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -10,7 +10,6 @@ config ARCH_AUTCPU12
10 10
11config ARCH_CDB89712 11config ARCH_CDB89712
12 bool "CDB89712" 12 bool "CDB89712"
13 select ISA
14 help 13 help
15 This is an evaluation board from Cirrus for the CS89712 processor. 14 This is an evaluation board from Cirrus for the CS89712 processor.
16 The board includes 2 serial ports, Ethernet, IRDA, and expansion 15 The board includes 2 serial ports, Ethernet, IRDA, and expansion
@@ -25,7 +24,6 @@ config ARCH_EDB7211
25 bool "EDB7211" 24 bool "EDB7211"
26 select ARCH_SELECT_MEMORY_MODEL 25 select ARCH_SELECT_MEMORY_MODEL
27 select ARCH_SPARSEMEM_ENABLE 26 select ARCH_SPARSEMEM_ENABLE
28 select ISA
29 help 27 help
30 Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211 28 Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211
31 evaluation board. 29 evaluation board.
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile
index 6da6940b365..992995af666 100644
--- a/arch/arm/mach-clps711x/Makefile
+++ b/arch/arm/mach-clps711x/Makefile
@@ -9,9 +9,9 @@ obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11 11
12obj-$(CONFIG_ARCH_AUTCPU12) += autcpu12.o 12obj-$(CONFIG_ARCH_AUTCPU12) += board-autcpu12.o
13obj-$(CONFIG_ARCH_CDB89712) += cdb89712.o 13obj-$(CONFIG_ARCH_CDB89712) += board-cdb89712.o
14obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o 14obj-$(CONFIG_ARCH_CLEP7312) += board-clep7312.o
15obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o 15obj-$(CONFIG_ARCH_EDB7211) += board-edb7211.o
16obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o 16obj-$(CONFIG_ARCH_FORTUNET) += board-fortunet.o
17obj-$(CONFIG_ARCH_P720T) += p720t.o 17obj-$(CONFIG_ARCH_P720T) += board-p720t.o
diff --git a/arch/arm/mach-clps711x/Makefile.boot b/arch/arm/mach-clps711x/Makefile.boot
index 9398e859b5a..eba77d35a61 100644
--- a/arch/arm/mach-clps711x/Makefile.boot
+++ b/arch/arm/mach-clps711x/Makefile.boot
@@ -1,5 +1,4 @@
1# The standard locations for stuff on CLPS711x type processors 1# The standard locations for stuff on CLPS711x type processors
2 zreladdr-y += 0xc0028000
3params_phys-y := 0xc0000100 2params_phys-y := 0xc0000100
4# Should probably have some agreement on these... 3# Should probably have some agreement on these...
5initrd_phys-$(CONFIG_ARCH_P720T) := 0xc0400000 4initrd_phys-$(CONFIG_ARCH_P720T) := 0xc0400000
diff --git a/arch/arm/mach-clps711x/autcpu12.c b/arch/arm/mach-clps711x/autcpu12.c
deleted file mode 100644
index 32871918bb6..00000000000
--- a/arch/arm/mach-clps711x/autcpu12.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/autcpu12.c
3 *
4 * (c) 2001 Thomas Gleixner, autronix automation <gleixner@autronix.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <linux/mm.h>
25#include <linux/io.h>
26#include <linux/ioport.h>
27#include <linux/platform_device.h>
28
29#include <mach/hardware.h>
30#include <asm/sizes.h>
31#include <asm/setup.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/pgtable.h>
35#include <asm/page.h>
36
37#include <asm/mach/map.h>
38#include <mach/autcpu12.h>
39
40#include "common.h"
41
42/*
43 * The on-chip registers are given a size of 1MB so that a section can
44 * be used to map them; this saves a page table. This is the place to
45 * add mappings for ROM, expansion memory, PCMCIA, etc. (if static
46 * mappings are chosen for those areas).
47 *
48*/
49
50static struct map_desc autcpu12_io_desc[] __initdata = {
51 /* memory-mapped extra io and CS8900A Ethernet chip */
52 /* ethernet chip */
53 {
54 .virtual = AUTCPU12_VIRT_CS8900A,
55 .pfn = __phys_to_pfn(AUTCPU12_PHYS_CS8900A),
56 .length = SZ_1M,
57 .type = MT_DEVICE
58 }
59};
60
61void __init autcpu12_map_io(void)
62{
63 clps711x_map_io();
64 iotable_init(autcpu12_io_desc, ARRAY_SIZE(autcpu12_io_desc));
65}
66
67static struct resource autcpu12_nvram_resource[] __initdata = {
68 DEFINE_RES_MEM_NAMED(AUTCPU12_PHYS_NVRAM, SZ_128K, "SRAM"),
69};
70
71static struct platform_device autcpu12_nvram_pdev __initdata = {
72 .name = "autcpu12_nvram",
73 .id = -1,
74 .resource = autcpu12_nvram_resource,
75 .num_resources = ARRAY_SIZE(autcpu12_nvram_resource),
76};
77
78static void __init autcpu12_init(void)
79{
80 platform_device_register(&autcpu12_nvram_pdev);
81}
82
83MACHINE_START(AUTCPU12, "autronix autcpu12")
84 /* Maintainer: Thomas Gleixner */
85 .atag_offset = 0x20000,
86 .init_machine = autcpu12_init,
87 .map_io = autcpu12_map_io,
88 .init_irq = clps711x_init_irq,
89 .timer = &clps711x_timer,
90 .restart = clps711x_restart,
91MACHINE_END
92
diff --git a/arch/arm/mach-clps711x/board-autcpu12.c b/arch/arm/mach-clps711x/board-autcpu12.c
new file mode 100644
index 00000000000..3fbf43f7258
--- /dev/null
+++ b/arch/arm/mach-clps711x/board-autcpu12.c
@@ -0,0 +1,179 @@
1/*
2 * linux/arch/arm/mach-clps711x/autcpu12.c
3 *
4 * (c) 2001 Thomas Gleixner, autronix automation <gleixner@autronix.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <linux/mm.h>
25#include <linux/io.h>
26#include <linux/gpio.h>
27#include <linux/ioport.h>
28#include <linux/interrupt.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mtd/nand-gpio.h>
31#include <linux/platform_device.h>
32#include <linux/basic_mmio_gpio.h>
33
34#include <mach/hardware.h>
35#include <asm/sizes.h>
36#include <asm/setup.h>
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/pgtable.h>
40#include <asm/page.h>
41
42#include <asm/mach/map.h>
43#include <mach/autcpu12.h>
44
45#include "common.h"
46
47#define AUTCPU12_CS8900_BASE (CS2_PHYS_BASE + 0x300)
48#define AUTCPU12_CS8900_IRQ (IRQ_EINT3)
49
50#define AUTCPU12_SMC_BASE (CS1_PHYS_BASE + 0x06000000)
51#define AUTCPU12_SMC_SEL_BASE (AUTCPU12_SMC_BASE + 0x10)
52
53#define AUTCPU12_MMGPIO_BASE (CLPS711X_NR_GPIO)
54#define AUTCPU12_SMC_NCE (AUTCPU12_MMGPIO_BASE + 0) /* Bit 0 */
55#define AUTCPU12_SMC_RDY CLPS711X_GPIO(1, 2)
56#define AUTCPU12_SMC_ALE CLPS711X_GPIO(1, 3)
57#define AUTCPU12_SMC_CLE CLPS711X_GPIO(1, 3)
58
59static struct resource autcpu12_cs8900_resource[] __initdata = {
60 DEFINE_RES_MEM(AUTCPU12_CS8900_BASE, SZ_1K),
61 DEFINE_RES_IRQ(AUTCPU12_CS8900_IRQ),
62};
63
64static struct resource autcpu12_nvram_resource[] __initdata = {
65 DEFINE_RES_MEM_NAMED(AUTCPU12_PHYS_NVRAM, SZ_128K, "SRAM"),
66};
67
68static struct platform_device autcpu12_nvram_pdev __initdata = {
69 .name = "autcpu12_nvram",
70 .id = -1,
71 .resource = autcpu12_nvram_resource,
72 .num_resources = ARRAY_SIZE(autcpu12_nvram_resource),
73};
74
75static struct resource autcpu12_nand_resource[] __initdata = {
76 DEFINE_RES_MEM(AUTCPU12_SMC_BASE, SZ_16),
77};
78
79static struct mtd_partition autcpu12_nand_parts[] __initdata = {
80 {
81 .name = "Flash partition 1",
82 .offset = 0,
83 .size = SZ_8M,
84 },
85 {
86 .name = "Flash partition 2",
87 .offset = MTDPART_OFS_APPEND,
88 .size = MTDPART_SIZ_FULL,
89 },
90};
91
92static void __init autcpu12_adjust_parts(struct gpio_nand_platdata *pdata,
93 size_t sz)
94{
95 switch (sz) {
96 case SZ_16M:
97 case SZ_32M:
98 break;
99 case SZ_64M:
100 case SZ_128M:
101 pdata->parts[0].size = SZ_16M;
102 break;
103 default:
104 pr_warn("Unsupported SmartMedia device size %u\n", sz);
105 break;
106 }
107}
108
109static struct gpio_nand_platdata autcpu12_nand_pdata __initdata = {
110 .gpio_rdy = AUTCPU12_SMC_RDY,
111 .gpio_nce = AUTCPU12_SMC_NCE,
112 .gpio_ale = AUTCPU12_SMC_ALE,
113 .gpio_cle = AUTCPU12_SMC_CLE,
114 .gpio_nwp = -1,
115 .chip_delay = 20,
116 .parts = autcpu12_nand_parts,
117 .num_parts = ARRAY_SIZE(autcpu12_nand_parts),
118 .adjust_parts = autcpu12_adjust_parts,
119};
120
121static struct platform_device autcpu12_nand_pdev __initdata = {
122 .name = "gpio-nand",
123 .id = -1,
124 .resource = autcpu12_nand_resource,
125 .num_resources = ARRAY_SIZE(autcpu12_nand_resource),
126 .dev = {
127 .platform_data = &autcpu12_nand_pdata,
128 },
129};
130
131static struct resource autcpu12_mmgpio_resource[] __initdata = {
132 DEFINE_RES_MEM_NAMED(AUTCPU12_SMC_SEL_BASE, SZ_1, "dat"),
133};
134
135static struct bgpio_pdata autcpu12_mmgpio_pdata __initdata = {
136 .base = AUTCPU12_MMGPIO_BASE,
137 .ngpio = 8,
138};
139
140static struct platform_device autcpu12_mmgpio_pdev __initdata = {
141 .name = "basic-mmio-gpio",
142 .id = -1,
143 .resource = autcpu12_mmgpio_resource,
144 .num_resources = ARRAY_SIZE(autcpu12_mmgpio_resource),
145 .dev = {
146 .platform_data = &autcpu12_mmgpio_pdata,
147 },
148};
149
150static void __init autcpu12_init(void)
151{
152 platform_device_register_simple("video-clps711x", 0, NULL, 0);
153 platform_device_register_simple("cs89x0", 0, autcpu12_cs8900_resource,
154 ARRAY_SIZE(autcpu12_cs8900_resource));
155 platform_device_register(&autcpu12_mmgpio_pdev);
156 platform_device_register(&autcpu12_nvram_pdev);
157}
158
159static void __init autcpu12_init_late(void)
160{
161 if (IS_ENABLED(MTD_NAND_GPIO) && IS_ENABLED(GPIO_GENERIC_PLATFORM)) {
162 /* We are need both drivers to handle NAND */
163 platform_device_register(&autcpu12_nand_pdev);
164 }
165}
166
167MACHINE_START(AUTCPU12, "autronix autcpu12")
168 /* Maintainer: Thomas Gleixner */
169 .atag_offset = 0x20000,
170 .nr_irqs = CLPS711X_NR_IRQS,
171 .map_io = clps711x_map_io,
172 .init_irq = clps711x_init_irq,
173 .timer = &clps711x_timer,
174 .init_machine = autcpu12_init,
175 .init_late = autcpu12_init_late,
176 .handle_irq = clps711x_handle_irq,
177 .restart = clps711x_restart,
178MACHINE_END
179
diff --git a/arch/arm/mach-clps711x/board-cdb89712.c b/arch/arm/mach-clps711x/board-cdb89712.c
new file mode 100644
index 00000000000..60900ddf97c
--- /dev/null
+++ b/arch/arm/mach-clps711x/board-cdb89712.c
@@ -0,0 +1,147 @@
1/*
2 * linux/arch/arm/mach-clps711x/cdb89712.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <linux/mm.h>
25#include <linux/io.h>
26#include <linux/interrupt.h>
27#include <linux/platform_device.h>
28
29#include <linux/mtd/physmap.h>
30#include <linux/mtd/plat-ram.h>
31#include <linux/mtd/partitions.h>
32
33#include <mach/hardware.h>
34#include <asm/pgtable.h>
35#include <asm/page.h>
36#include <asm/setup.h>
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40
41#include "common.h"
42
43#define CDB89712_CS8900_BASE (CS2_PHYS_BASE + 0x300)
44#define CDB89712_CS8900_IRQ (IRQ_EINT3)
45
46static struct resource cdb89712_cs8900_resource[] __initdata = {
47 DEFINE_RES_MEM(CDB89712_CS8900_BASE, SZ_1K),
48 DEFINE_RES_IRQ(CDB89712_CS8900_IRQ),
49};
50
51static struct mtd_partition cdb89712_flash_partitions[] __initdata = {
52 {
53 .name = "Flash",
54 .offset = 0,
55 .size = MTDPART_SIZ_FULL,
56 },
57};
58
59static struct physmap_flash_data cdb89712_flash_pdata __initdata = {
60 .width = 4,
61 .probe_type = "map_rom",
62 .parts = cdb89712_flash_partitions,
63 .nr_parts = ARRAY_SIZE(cdb89712_flash_partitions),
64};
65
66static struct resource cdb89712_flash_resources[] __initdata = {
67 DEFINE_RES_MEM(CS0_PHYS_BASE, SZ_8M),
68};
69
70static struct platform_device cdb89712_flash_pdev __initdata = {
71 .name = "physmap-flash",
72 .id = 0,
73 .resource = cdb89712_flash_resources,
74 .num_resources = ARRAY_SIZE(cdb89712_flash_resources),
75 .dev = {
76 .platform_data = &cdb89712_flash_pdata,
77 },
78};
79
80static struct mtd_partition cdb89712_bootrom_partitions[] __initdata = {
81 {
82 .name = "BootROM",
83 .offset = 0,
84 .size = MTDPART_SIZ_FULL,
85 },
86};
87
88static struct physmap_flash_data cdb89712_bootrom_pdata __initdata = {
89 .width = 4,
90 .probe_type = "map_rom",
91 .parts = cdb89712_bootrom_partitions,
92 .nr_parts = ARRAY_SIZE(cdb89712_bootrom_partitions),
93};
94
95static struct resource cdb89712_bootrom_resources[] __initdata = {
96 DEFINE_RES_NAMED(CS7_PHYS_BASE, SZ_128, "BOOTROM", IORESOURCE_MEM |
97 IORESOURCE_CACHEABLE | IORESOURCE_READONLY),
98};
99
100static struct platform_device cdb89712_bootrom_pdev __initdata = {
101 .name = "physmap-flash",
102 .id = 1,
103 .resource = cdb89712_bootrom_resources,
104 .num_resources = ARRAY_SIZE(cdb89712_bootrom_resources),
105 .dev = {
106 .platform_data = &cdb89712_bootrom_pdata,
107 },
108};
109
110static struct platdata_mtd_ram cdb89712_sram_pdata __initdata = {
111 .bankwidth = 4,
112};
113
114static struct resource cdb89712_sram_resources[] __initdata = {
115 DEFINE_RES_MEM(CLPS711X_SRAM_BASE, CLPS711X_SRAM_SIZE),
116};
117
118static struct platform_device cdb89712_sram_pdev __initdata = {
119 .name = "mtd-ram",
120 .id = 0,
121 .resource = cdb89712_sram_resources,
122 .num_resources = ARRAY_SIZE(cdb89712_sram_resources),
123 .dev = {
124 .platform_data = &cdb89712_sram_pdata,
125 },
126};
127
128static void __init cdb89712_init(void)
129{
130 platform_device_register(&cdb89712_flash_pdev);
131 platform_device_register(&cdb89712_bootrom_pdev);
132 platform_device_register(&cdb89712_sram_pdev);
133 platform_device_register_simple("cs89x0", 0, cdb89712_cs8900_resource,
134 ARRAY_SIZE(cdb89712_cs8900_resource));
135}
136
137MACHINE_START(CDB89712, "Cirrus-CDB89712")
138 /* Maintainer: Ray Lehtiniemi */
139 .atag_offset = 0x100,
140 .nr_irqs = CLPS711X_NR_IRQS,
141 .map_io = clps711x_map_io,
142 .init_irq = clps711x_init_irq,
143 .timer = &clps711x_timer,
144 .init_machine = cdb89712_init,
145 .handle_irq = clps711x_handle_irq,
146 .restart = clps711x_restart,
147MACHINE_END
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/board-clep7312.c
index dbc7842639d..0b32a487183 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/board-clep7312.c
@@ -33,14 +33,14 @@ fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
33 mi->bank[0].size = 0x01000000; 33 mi->bank[0].size = 0x01000000;
34} 34}
35 35
36
37MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") 36MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
38 /* Maintainer: Nobody */ 37 /* Maintainer: Nobody */
39 .atag_offset = 0x0100, 38 .atag_offset = 0x0100,
39 .nr_irqs = CLPS711X_NR_IRQS,
40 .fixup = fixup_clep7312, 40 .fixup = fixup_clep7312,
41 .map_io = clps711x_map_io, 41 .map_io = clps711x_map_io,
42 .init_irq = clps711x_init_irq, 42 .init_irq = clps711x_init_irq,
43 .timer = &clps711x_timer, 43 .timer = &clps711x_timer,
44 .handle_irq = clps711x_handle_irq,
44 .restart = clps711x_restart, 45 .restart = clps711x_restart,
45MACHINE_END 46MACHINE_END
46
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
new file mode 100644
index 00000000000..71aa5cf2c0d
--- /dev/null
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -0,0 +1,180 @@
1/*
2 * Copyright (C) 2000, 2001 Blue Mug, Inc. 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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#include <linux/init.h>
11#include <linux/gpio.h>
12#include <linux/delay.h>
13#include <linux/memblock.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/backlight.h>
17#include <linux/platform_device.h>
18
19#include <linux/mtd/physmap.h>
20#include <linux/mtd/partitions.h>
21
22#include <asm/setup.h>
23#include <asm/mach/map.h>
24#include <asm/mach/arch.h>
25#include <asm/mach-types.h>
26
27#include <video/platform_lcd.h>
28
29#include <mach/hardware.h>
30
31#include "common.h"
32
33#define VIDEORAM_SIZE SZ_128K
34
35#define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1)
36#define EDB7211_LCDEN CLPS711X_GPIO(3, 2)
37#define EDB7211_LCDBL CLPS711X_GPIO(3, 3)
38
39#define EDB7211_FLASH0_BASE (CS0_PHYS_BASE)
40#define EDB7211_FLASH1_BASE (CS1_PHYS_BASE)
41#define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
42#define EDB7211_CS8900_IRQ (IRQ_EINT3)
43
44static struct resource edb7211_cs8900_resource[] __initdata = {
45 DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K),
46 DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
47};
48
49static struct mtd_partition edb7211_flash_partitions[] __initdata = {
50 {
51 .name = "Flash",
52 .offset = 0,
53 .size = MTDPART_SIZ_FULL,
54 },
55};
56
57static struct physmap_flash_data edb7211_flash_pdata __initdata = {
58 .width = 4,
59 .parts = edb7211_flash_partitions,
60 .nr_parts = ARRAY_SIZE(edb7211_flash_partitions),
61};
62
63static struct resource edb7211_flash_resources[] __initdata = {
64 DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M),
65 DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M),
66};
67
68static struct platform_device edb7211_flash_pdev __initdata = {
69 .name = "physmap-flash",
70 .id = 0,
71 .resource = edb7211_flash_resources,
72 .num_resources = ARRAY_SIZE(edb7211_flash_resources),
73 .dev = {
74 .platform_data = &edb7211_flash_pdata,
75 },
76};
77
78static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
79{
80 if (power) {
81 gpio_set_value(EDB7211_LCDEN, 1);
82 udelay(100);
83 gpio_set_value(EDB7211_LCD_DC_DC_EN, 1);
84 } else {
85 gpio_set_value(EDB7211_LCD_DC_DC_EN, 0);
86 udelay(100);
87 gpio_set_value(EDB7211_LCDEN, 0);
88 }
89}
90
91static struct plat_lcd_data edb7211_lcd_power_pdata = {
92 .set_power = edb7211_lcd_power_set,
93};
94
95static void edb7211_lcd_backlight_set_intensity(int intensity)
96{
97 gpio_set_value(EDB7211_LCDBL, intensity);
98}
99
100static struct generic_bl_info edb7211_lcd_backlight_pdata = {
101 .name = "lcd-backlight.0",
102 .default_intensity = 0x01,
103 .max_intensity = 0x01,
104 .set_bl_intensity = edb7211_lcd_backlight_set_intensity,
105};
106
107static struct gpio edb7211_gpios[] __initconst = {
108 { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
109 { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
110 { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" },
111};
112
113static struct map_desc edb7211_io_desc[] __initdata = {
114 { /* Memory-mapped extra keyboard row */
115 .virtual = IO_ADDRESS(EP7211_PHYS_EXTKBD),
116 .pfn = __phys_to_pfn(EP7211_PHYS_EXTKBD),
117 .length = SZ_1M,
118 .type = MT_DEVICE,
119 },
120};
121
122void __init edb7211_map_io(void)
123{
124 clps711x_map_io();
125 iotable_init(edb7211_io_desc, ARRAY_SIZE(edb7211_io_desc));
126}
127
128/* Reserve screen memory region at the start of main system memory. */
129static void __init edb7211_reserve(void)
130{
131 memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE);
132}
133
134static void __init
135fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
136{
137 /*
138 * Bank start addresses are not present in the information
139 * passed in from the boot loader. We could potentially
140 * detect them, but instead we hard-code them.
141 *
142 * Banks sizes _are_ present in the param block, but we're
143 * not using that information yet.
144 */
145 mi->bank[0].start = 0xc0000000;
146 mi->bank[0].size = SZ_8M;
147 mi->bank[1].start = 0xc1000000;
148 mi->bank[1].size = SZ_8M;
149 mi->nr_banks = 2;
150}
151
152static void __init edb7211_init(void)
153{
154 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
155
156 platform_device_register(&edb7211_flash_pdev);
157 platform_device_register_data(&platform_bus, "platform-lcd", 0,
158 &edb7211_lcd_power_pdata,
159 sizeof(edb7211_lcd_power_pdata));
160 platform_device_register_data(&platform_bus, "generic-bl", 0,
161 &edb7211_lcd_backlight_pdata,
162 sizeof(edb7211_lcd_backlight_pdata));
163 platform_device_register_simple("video-clps711x", 0, NULL, 0);
164 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
165 ARRAY_SIZE(edb7211_cs8900_resource));
166}
167
168MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
169 /* Maintainer: Jon McClintock */
170 .atag_offset = VIDEORAM_SIZE + 0x100,
171 .nr_irqs = CLPS711X_NR_IRQS,
172 .fixup = fixup_edb7211,
173 .reserve = edb7211_reserve,
174 .map_io = edb7211_map_io,
175 .init_irq = clps711x_init_irq,
176 .timer = &clps711x_timer,
177 .init_machine = edb7211_init,
178 .handle_irq = clps711x_handle_irq,
179 .restart = clps711x_restart,
180MACHINE_END
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/board-fortunet.c
index 3a3f0b702cb..7d012558036 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/board-fortunet.c
@@ -74,9 +74,11 @@ fortunet_fixup(struct tag *tags, char **cmdline, struct meminfo *mi)
74 74
75MACHINE_START(FORTUNET, "ARM-FortuNet") 75MACHINE_START(FORTUNET, "ARM-FortuNet")
76 /* Maintainer: FortuNet Inc. */ 76 /* Maintainer: FortuNet Inc. */
77 .nr_irqs = CLPS711X_NR_IRQS,
77 .fixup = fortunet_fixup, 78 .fixup = fortunet_fixup,
78 .map_io = clps711x_map_io, 79 .map_io = clps711x_map_io,
79 .init_irq = clps711x_init_irq, 80 .init_irq = clps711x_init_irq,
80 .timer = &clps711x_timer, 81 .timer = &clps711x_timer,
82 .handle_irq = clps711x_handle_irq,
81 .restart = clps711x_restart, 83 .restart = clps711x_restart,
82MACHINE_END 84MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c
new file mode 100644
index 00000000000..1518fc83bab
--- /dev/null
+++ b/arch/arm/mach-clps711x/board-p720t.c
@@ -0,0 +1,232 @@
1/*
2 * linux/arch/arm/mach-clps711x/p720t.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <linux/mm.h>
25#include <linux/io.h>
26#include <linux/slab.h>
27#include <linux/leds.h>
28#include <linux/sizes.h>
29#include <linux/backlight.h>
30#include <linux/platform_device.h>
31#include <linux/mtd/partitions.h>
32#include <linux/mtd/nand-gpio.h>
33
34#include <mach/hardware.h>
35#include <asm/pgtable.h>
36#include <asm/page.h>
37#include <asm/setup.h>
38#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <mach/syspld.h>
42
43#include <video/platform_lcd.h>
44
45#include "common.h"
46
47#define P720T_USERLED CLPS711X_GPIO(3, 0)
48#define P720T_NAND_CLE CLPS711X_GPIO(4, 0)
49#define P720T_NAND_ALE CLPS711X_GPIO(4, 1)
50#define P720T_NAND_NCE CLPS711X_GPIO(4, 2)
51
52#define P720T_NAND_BASE (CLPS711X_SDRAM1_BASE)
53
54static struct resource p720t_nand_resource[] __initdata = {
55 DEFINE_RES_MEM(P720T_NAND_BASE, SZ_4),
56};
57
58static struct mtd_partition p720t_nand_parts[] __initdata = {
59 {
60 .name = "Flash partition 1",
61 .offset = 0,
62 .size = SZ_2M,
63 },
64 {
65 .name = "Flash partition 2",
66 .offset = MTDPART_OFS_APPEND,
67 .size = MTDPART_SIZ_FULL,
68 },
69};
70
71static struct gpio_nand_platdata p720t_nand_pdata __initdata = {
72 .gpio_rdy = -1,
73 .gpio_nce = P720T_NAND_NCE,
74 .gpio_ale = P720T_NAND_ALE,
75 .gpio_cle = P720T_NAND_CLE,
76 .gpio_nwp = -1,
77 .chip_delay = 15,
78 .parts = p720t_nand_parts,
79 .num_parts = ARRAY_SIZE(p720t_nand_parts),
80};
81
82static struct platform_device p720t_nand_pdev __initdata = {
83 .name = "gpio-nand",
84 .id = -1,
85 .resource = p720t_nand_resource,
86 .num_resources = ARRAY_SIZE(p720t_nand_resource),
87 .dev = {
88 .platform_data = &p720t_nand_pdata,
89 },
90};
91
92static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
93{
94 if (power) {
95 PLD_LCDEN = PLD_LCDEN_EN;
96 PLD_PWR |= PLD_S4_ON | PLD_S2_ON | PLD_S1_ON;
97 } else {
98 PLD_PWR &= ~(PLD_S4_ON | PLD_S2_ON | PLD_S1_ON);
99 PLD_LCDEN = 0;
100 }
101}
102
103static struct plat_lcd_data p720t_lcd_power_pdata = {
104 .set_power = p720t_lcd_power_set,
105};
106
107static void p720t_lcd_backlight_set_intensity(int intensity)
108{
109 if (intensity)
110 PLD_PWR |= PLD_S3_ON;
111 else
112 PLD_PWR = 0;
113}
114
115static struct generic_bl_info p720t_lcd_backlight_pdata = {
116 .name = "lcd-backlight.0",
117 .default_intensity = 0x01,
118 .max_intensity = 0x01,
119 .set_bl_intensity = p720t_lcd_backlight_set_intensity,
120};
121
122/*
123 * Map the P720T system PLD. It occupies two address spaces:
124 * 0x10000000 and 0x10400000. We map both regions as one.
125 */
126static struct map_desc p720t_io_desc[] __initdata = {
127 {
128 .virtual = SYSPLD_VIRT_BASE,
129 .pfn = __phys_to_pfn(SYSPLD_PHYS_BASE),
130 .length = SZ_8M,
131 .type = MT_DEVICE,
132 },
133};
134
135static void __init
136fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
137{
138 /*
139 * Our bootloader doesn't setup any tags (yet).
140 */
141 if (tag->hdr.tag != ATAG_CORE) {
142 tag->hdr.tag = ATAG_CORE;
143 tag->hdr.size = tag_size(tag_core);
144 tag->u.core.flags = 0;
145 tag->u.core.pagesize = PAGE_SIZE;
146 tag->u.core.rootdev = 0x0100;
147
148 tag = tag_next(tag);
149 tag->hdr.tag = ATAG_MEM;
150 tag->hdr.size = tag_size(tag_mem32);
151 tag->u.mem.size = 4096;
152 tag->u.mem.start = PHYS_OFFSET;
153
154 tag = tag_next(tag);
155 tag->hdr.tag = ATAG_NONE;
156 tag->hdr.size = 0;
157 }
158}
159
160static void __init p720t_map_io(void)
161{
162 clps711x_map_io();
163 iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc));
164}
165
166static void __init p720t_init_early(void)
167{
168 /*
169 * Power down as much as possible in case we don't
170 * have the drivers loaded.
171 */
172 PLD_LCDEN = 0;
173 PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
174
175 PLD_KBD = 0;
176 PLD_IO = 0;
177 PLD_IRDA = 0;
178 PLD_CODEC = 0;
179 PLD_TCH = 0;
180 PLD_SPI = 0;
181 if (!IS_ENABLED(CONFIG_DEBUG_LL)) {
182 PLD_COM2 = 0;
183 PLD_COM1 = 0;
184 }
185}
186
187static struct gpio_led p720t_gpio_leds[] = {
188 {
189 .name = "User LED",
190 .default_trigger = "heartbeat",
191 .gpio = P720T_USERLED,
192 },
193};
194
195static struct gpio_led_platform_data p720t_gpio_led_pdata __initdata = {
196 .leds = p720t_gpio_leds,
197 .num_leds = ARRAY_SIZE(p720t_gpio_leds),
198};
199
200static void __init p720t_init(void)
201{
202 platform_device_register(&p720t_nand_pdev);
203 platform_device_register_data(&platform_bus, "platform-lcd", 0,
204 &p720t_lcd_power_pdata,
205 sizeof(p720t_lcd_power_pdata));
206 platform_device_register_data(&platform_bus, "generic-bl", 0,
207 &p720t_lcd_backlight_pdata,
208 sizeof(p720t_lcd_backlight_pdata));
209 platform_device_register_simple("video-clps711x", 0, NULL, 0);
210}
211
212static void __init p720t_init_late(void)
213{
214 platform_device_register_data(&platform_bus, "leds-gpio", 0,
215 &p720t_gpio_led_pdata,
216 sizeof(p720t_gpio_led_pdata));
217}
218
219MACHINE_START(P720T, "ARM-Prospector720T")
220 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
221 .atag_offset = 0x100,
222 .nr_irqs = CLPS711X_NR_IRQS,
223 .fixup = fixup_p720t,
224 .map_io = p720t_map_io,
225 .init_early = p720t_init_early,
226 .init_irq = clps711x_init_irq,
227 .timer = &clps711x_timer,
228 .init_machine = p720t_init,
229 .init_late = p720t_init_late,
230 .handle_irq = clps711x_handle_irq,
231 .restart = clps711x_restart,
232MACHINE_END
diff --git a/arch/arm/mach-clps711x/cdb89712.c b/arch/arm/mach-clps711x/cdb89712.c
deleted file mode 100644
index c314f49d6ef..00000000000
--- a/arch/arm/mach-clps711x/cdb89712.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/cdb89712.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <linux/mm.h>
25#include <linux/io.h>
26
27#include <mach/hardware.h>
28#include <asm/pgtable.h>
29#include <asm/page.h>
30#include <asm/setup.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34
35#include "common.h"
36
37/*
38 * Map the CS89712 Ethernet port. That should be moved to the
39 * ethernet driver, perhaps.
40 */
41static struct map_desc cdb89712_io_desc[] __initdata = {
42 {
43 .virtual = ETHER_BASE,
44 .pfn =__phys_to_pfn(ETHER_START),
45 .length = ETHER_SIZE,
46 .type = MT_DEVICE
47 }
48};
49
50static void __init cdb89712_map_io(void)
51{
52 clps711x_map_io();
53 iotable_init(cdb89712_io_desc, ARRAY_SIZE(cdb89712_io_desc));
54}
55
56MACHINE_START(CDB89712, "Cirrus-CDB89712")
57 /* Maintainer: Ray Lehtiniemi */
58 .atag_offset = 0x100,
59 .map_io = cdb89712_map_io,
60 .init_irq = clps711x_init_irq,
61 .timer = &clps711x_timer,
62 .restart = clps711x_restart,
63MACHINE_END
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 509243d89a3..e046439573e 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -21,13 +21,16 @@
21 */ 21 */
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/sizes.h>
24#include <linux/interrupt.h> 25#include <linux/interrupt.h>
25#include <linux/irq.h> 26#include <linux/irq.h>
26#include <linux/clk.h> 27#include <linux/clk.h>
27#include <linux/clkdev.h> 28#include <linux/clkdev.h>
29#include <linux/clockchips.h>
28#include <linux/clk-provider.h> 30#include <linux/clk-provider.h>
29 31
30#include <asm/sizes.h> 32#include <asm/exception.h>
33#include <asm/mach/irq.h>
31#include <asm/mach/map.h> 34#include <asm/mach/map.h>
32#include <asm/mach/time.h> 35#include <asm/mach/time.h>
33#include <asm/system_misc.h> 36#include <asm/system_misc.h>
@@ -36,7 +39,6 @@
36 39
37static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh, 40static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh,
38 *clk_tint, *clk_spi; 41 *clk_tint, *clk_spi;
39static unsigned long latch;
40 42
41/* 43/*
42 * This maps the generic CLPS711x registers 44 * This maps the generic CLPS711x registers
@@ -45,7 +47,7 @@ static struct map_desc clps711x_io_desc[] __initdata = {
45 { 47 {
46 .virtual = (unsigned long)CLPS711X_VIRT_BASE, 48 .virtual = (unsigned long)CLPS711X_VIRT_BASE,
47 .pfn = __phys_to_pfn(CLPS711X_PHYS_BASE), 49 .pfn = __phys_to_pfn(CLPS711X_PHYS_BASE),
48 .length = SZ_1M, 50 .length = SZ_64K,
49 .type = MT_DEVICE 51 .type = MT_DEVICE
50 } 52 }
51}; 53};
@@ -64,7 +66,7 @@ static void int1_mask(struct irq_data *d)
64 clps_writel(intmr1, INTMR1); 66 clps_writel(intmr1, INTMR1);
65} 67}
66 68
67static void int1_ack(struct irq_data *d) 69static void int1_eoi(struct irq_data *d)
68{ 70{
69 switch (d->irq) { 71 switch (d->irq) {
70 case IRQ_CSINT: clps_writel(0, COEOI); break; 72 case IRQ_CSINT: clps_writel(0, COEOI); break;
@@ -86,7 +88,8 @@ static void int1_unmask(struct irq_data *d)
86} 88}
87 89
88static struct irq_chip int1_chip = { 90static struct irq_chip int1_chip = {
89 .irq_ack = int1_ack, 91 .name = "Interrupt Vector 1",
92 .irq_eoi = int1_eoi,
90 .irq_mask = int1_mask, 93 .irq_mask = int1_mask,
91 .irq_unmask = int1_unmask, 94 .irq_unmask = int1_unmask,
92}; 95};
@@ -100,7 +103,7 @@ static void int2_mask(struct irq_data *d)
100 clps_writel(intmr2, INTMR2); 103 clps_writel(intmr2, INTMR2);
101} 104}
102 105
103static void int2_ack(struct irq_data *d) 106static void int2_eoi(struct irq_data *d)
104{ 107{
105 switch (d->irq) { 108 switch (d->irq) {
106 case IRQ_KBDINT: clps_writel(0, KBDEOI); break; 109 case IRQ_KBDINT: clps_writel(0, KBDEOI); break;
@@ -117,73 +120,160 @@ static void int2_unmask(struct irq_data *d)
117} 120}
118 121
119static struct irq_chip int2_chip = { 122static struct irq_chip int2_chip = {
120 .irq_ack = int2_ack, 123 .name = "Interrupt Vector 2",
124 .irq_eoi = int2_eoi,
121 .irq_mask = int2_mask, 125 .irq_mask = int2_mask,
122 .irq_unmask = int2_unmask, 126 .irq_unmask = int2_unmask,
123}; 127};
124 128
129static void int3_mask(struct irq_data *d)
130{
131 u32 intmr3;
132
133 intmr3 = clps_readl(INTMR3);
134 intmr3 &= ~(1 << (d->irq - 32));
135 clps_writel(intmr3, INTMR3);
136}
137
138static void int3_unmask(struct irq_data *d)
139{
140 u32 intmr3;
141
142 intmr3 = clps_readl(INTMR3);
143 intmr3 |= 1 << (d->irq - 32);
144 clps_writel(intmr3, INTMR3);
145}
146
147static struct irq_chip int3_chip = {
148 .name = "Interrupt Vector 3",
149 .irq_mask = int3_mask,
150 .irq_unmask = int3_unmask,
151};
152
153static struct {
154 int nr;
155 struct irq_chip *chip;
156 irq_flow_handler_t handle;
157} clps711x_irqdescs[] __initdata = {
158 { IRQ_CSINT, &int1_chip, handle_fasteoi_irq, },
159 { IRQ_EINT1, &int1_chip, handle_level_irq, },
160 { IRQ_EINT2, &int1_chip, handle_level_irq, },
161 { IRQ_EINT3, &int1_chip, handle_level_irq, },
162 { IRQ_TC1OI, &int1_chip, handle_fasteoi_irq, },
163 { IRQ_TC2OI, &int1_chip, handle_fasteoi_irq, },
164 { IRQ_RTCMI, &int1_chip, handle_fasteoi_irq, },
165 { IRQ_TINT, &int1_chip, handle_fasteoi_irq, },
166 { IRQ_UTXINT1, &int1_chip, handle_level_irq, },
167 { IRQ_URXINT1, &int1_chip, handle_level_irq, },
168 { IRQ_UMSINT, &int1_chip, handle_fasteoi_irq, },
169 { IRQ_SSEOTI, &int1_chip, handle_level_irq, },
170 { IRQ_KBDINT, &int2_chip, handle_fasteoi_irq, },
171 { IRQ_SS2RX, &int2_chip, handle_level_irq, },
172 { IRQ_SS2TX, &int2_chip, handle_level_irq, },
173 { IRQ_UTXINT2, &int2_chip, handle_level_irq, },
174 { IRQ_URXINT2, &int2_chip, handle_level_irq, },
175};
176
125void __init clps711x_init_irq(void) 177void __init clps711x_init_irq(void)
126{ 178{
127 unsigned int i; 179 unsigned int i;
128 180
129 for (i = 0; i < NR_IRQS; i++) { 181 /* Disable interrupts */
130 if (INT1_IRQS & (1 << i)) {
131 irq_set_chip_and_handler(i, &int1_chip,
132 handle_level_irq);
133 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
134 }
135 if (INT2_IRQS & (1 << i)) {
136 irq_set_chip_and_handler(i, &int2_chip,
137 handle_level_irq);
138 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
139 }
140 }
141
142 /*
143 * Disable interrupts
144 */
145 clps_writel(0, INTMR1); 182 clps_writel(0, INTMR1);
146 clps_writel(0, INTMR2); 183 clps_writel(0, INTMR2);
184 clps_writel(0, INTMR3);
147 185
148 /* 186 /* Clear down any pending interrupts */
149 * Clear down any pending interrupts 187 clps_writel(0, BLEOI);
150 */ 188 clps_writel(0, MCEOI);
151 clps_writel(0, COEOI); 189 clps_writel(0, COEOI);
152 clps_writel(0, TC1EOI); 190 clps_writel(0, TC1EOI);
153 clps_writel(0, TC2EOI); 191 clps_writel(0, TC2EOI);
154 clps_writel(0, RTCEOI); 192 clps_writel(0, RTCEOI);
155 clps_writel(0, TEOI); 193 clps_writel(0, TEOI);
156 clps_writel(0, UMSEOI); 194 clps_writel(0, UMSEOI);
157 clps_writel(0, SYNCIO);
158 clps_writel(0, KBDEOI); 195 clps_writel(0, KBDEOI);
196 clps_writel(0, SRXEOF);
197 clps_writel(0xffffffff, DAISR);
198
199 for (i = 0; i < ARRAY_SIZE(clps711x_irqdescs); i++) {
200 irq_set_chip_and_handler(clps711x_irqdescs[i].nr,
201 clps711x_irqdescs[i].chip,
202 clps711x_irqdescs[i].handle);
203 set_irq_flags(clps711x_irqdescs[i].nr,
204 IRQF_VALID | IRQF_PROBE);
205 }
206
207 if (IS_ENABLED(CONFIG_FIQ)) {
208 init_FIQ(0);
209 irq_set_chip_and_handler(IRQ_DAIINT, &int3_chip,
210 handle_bad_irq);
211 set_irq_flags(IRQ_DAIINT,
212 IRQF_VALID | IRQF_PROBE | IRQF_NOAUTOEN);
213 }
159} 214}
160 215
161/* 216inline u32 fls16(u32 x)
162 * gettimeoffset() returns time since last timer tick, in usecs.
163 *
164 * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
165 * 'tick' is usecs per jiffy.
166 */
167static unsigned long clps711x_gettimeoffset(void)
168{ 217{
169 unsigned long hwticks; 218 u32 r = 15;
170 hwticks = latch - (clps_readl(TC2D) & 0xffff); 219
171 return (hwticks * (tick_nsec / 1000)) / latch; 220 if (!(x & 0xff00)) {
221 x <<= 8;
222 r -= 8;
223 }
224 if (!(x & 0xf000)) {
225 x <<= 4;
226 r -= 4;
227 }
228 if (!(x & 0xc000)) {
229 x <<= 2;
230 r -= 2;
231 }
232 if (!(x & 0x8000))
233 r--;
234
235 return r;
172} 236}
173 237
174/* 238asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs)
175 * IRQ handler for the timer
176 */
177static irqreturn_t p720t_timer_interrupt(int irq, void *dev_id)
178{ 239{
179 timer_tick(); 240 u32 irqstat;
241 void __iomem *base = CLPS711X_VIRT_BASE;
242
243 irqstat = readl_relaxed(base + INTSR1) & readl_relaxed(base + INTMR1);
244 if (irqstat) {
245 handle_IRQ(fls16(irqstat), regs);
246 return;
247 }
248
249 irqstat = readl_relaxed(base + INTSR2) & readl_relaxed(base + INTMR2);
250 if (likely(irqstat))
251 handle_IRQ(fls16(irqstat) + 16, regs);
252}
253
254static void clps711x_clockevent_set_mode(enum clock_event_mode mode,
255 struct clock_event_device *evt)
256{
257}
258
259static struct clock_event_device clockevent_clps711x = {
260 .name = "CLPS711x Clockevents",
261 .rating = 300,
262 .features = CLOCK_EVT_FEAT_PERIODIC,
263 .set_mode = clps711x_clockevent_set_mode,
264};
265
266static irqreturn_t clps711x_timer_interrupt(int irq, void *dev_id)
267{
268 clockevent_clps711x.event_handler(&clockevent_clps711x);
269
180 return IRQ_HANDLED; 270 return IRQ_HANDLED;
181} 271}
182 272
183static struct irqaction clps711x_timer_irq = { 273static struct irqaction clps711x_timer_irq = {
184 .name = "CLPS711x Timer Tick", 274 .name = "CLPS711x Timer Tick",
185 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 275 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
186 .handler = p720t_timer_interrupt, 276 .handler = clps711x_timer_interrupt,
187}; 277};
188 278
189static void add_fixed_clk(struct clk *clk, const char *name, int rate) 279static void add_fixed_clk(struct clk *clk, const char *name, int rate)
@@ -244,20 +334,19 @@ static void __init clps711x_timer_init(void)
244 334
245 pr_info("CPU frequency set at %i Hz.\n", cpu); 335 pr_info("CPU frequency set at %i Hz.\n", cpu);
246 336
247 latch = (timh + HZ / 2) / HZ; 337 clps_writew(DIV_ROUND_CLOSEST(timh, HZ), TC2D);
248 338
249 tmp = clps_readl(SYSCON1); 339 tmp = clps_readl(SYSCON1);
250 tmp |= SYSCON1_TC2S | SYSCON1_TC2M; 340 tmp |= SYSCON1_TC2S | SYSCON1_TC2M;
251 clps_writel(tmp, SYSCON1); 341 clps_writel(tmp, SYSCON1);
252 342
253 clps_writel(latch - 1, TC2D); 343 clockevents_config_and_register(&clockevent_clps711x, timh, 1, 0xffff);
254 344
255 setup_irq(IRQ_TC2OI, &clps711x_timer_irq); 345 setup_irq(IRQ_TC2OI, &clps711x_timer_irq);
256} 346}
257 347
258struct sys_timer clps711x_timer = { 348struct sys_timer clps711x_timer = {
259 .init = clps711x_timer_init, 349 .init = clps711x_timer_init,
260 .offset = clps711x_gettimeoffset,
261}; 350};
262 351
263void clps711x_restart(char mode, const char *cmd) 352void clps711x_restart(char mode, const char *cmd)
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index fc0f0650dcb..b7c0c75c90c 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -4,9 +4,14 @@
4 * Common bits. 4 * Common bits.
5 */ 5 */
6 6
7#define CLPS711X_NR_IRQS (33)
8#define CLPS711X_NR_GPIO (4 * 8 + 3)
9#define CLPS711X_GPIO(prt, bit) ((prt) * 8 + (bit))
10
7struct sys_timer; 11struct sys_timer;
8 12
9extern void clps711x_map_io(void); 13extern void clps711x_map_io(void);
10extern void clps711x_init_irq(void); 14extern void clps711x_init_irq(void);
11extern struct sys_timer clps711x_timer; 15extern void clps711x_handle_irq(struct pt_regs *regs);
12extern void clps711x_restart(char mode, const char *cmd); 16extern void clps711x_restart(char mode, const char *cmd);
17extern struct sys_timer clps711x_timer;
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c
deleted file mode 100644
index 5fad0b4f40a..00000000000
--- a/arch/arm/mach-clps711x/edb7211-arch.c
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/arch-edb7211.c
3 *
4 * Copyright (C) 2000, 2001 Blue Mug, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/memblock.h>
22#include <linux/types.h>
23#include <linux/string.h>
24
25#include <asm/setup.h>
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28
29#include "common.h"
30
31extern void edb7211_map_io(void);
32
33/* Reserve screen memory region at the start of main system memory. */
34static void __init edb7211_reserve(void)
35{
36 memblock_reserve(PHYS_OFFSET, 0x00020000);
37}
38
39static void __init
40fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
41{
42 /*
43 * Bank start addresses are not present in the information
44 * passed in from the boot loader. We could potentially
45 * detect them, but instead we hard-code them.
46 *
47 * Banks sizes _are_ present in the param block, but we're
48 * not using that information yet.
49 */
50 mi->bank[0].start = 0xc0000000;
51 mi->bank[0].size = 8*1024*1024;
52 mi->bank[1].start = 0xc1000000;
53 mi->bank[1].size = 8*1024*1024;
54 mi->nr_banks = 2;
55}
56
57MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
58 /* Maintainer: Jon McClintock */
59 .atag_offset = 0x20100, /* 0xc0000000 - 0xc001ffff can be video RAM */
60 .fixup = fixup_edb7211,
61 .map_io = edb7211_map_io,
62 .reserve = edb7211_reserve,
63 .init_irq = clps711x_init_irq,
64 .timer = &clps711x_timer,
65 .restart = clps711x_restart,
66MACHINE_END
diff --git a/arch/arm/mach-clps711x/edb7211-mm.c b/arch/arm/mach-clps711x/edb7211-mm.c
deleted file mode 100644
index 4372f06c992..00000000000
--- a/arch/arm/mach-clps711x/edb7211-mm.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/mm.c
3 *
4 * Extra MM routines for the EDB7211 board
5 *
6 * Copyright (C) 2000, 2001 Blue Mug, Inc. All Rights Reserved.
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#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/bug.h>
25
26#include <mach/hardware.h>
27#include <asm/page.h>
28#include <asm/sizes.h>
29
30#include <asm/mach/map.h>
31
32extern void clps711x_map_io(void);
33
34/*
35 * The on-chip registers are given a size of 1MB so that a section can
36 * be used to map them; this saves a page table. This is the place to
37 * add mappings for ROM, expansion memory, PCMCIA, etc. (if static
38 * mappings are chosen for those areas).
39 *
40 * Here is a physical memory map (to be fleshed out later):
41 *
42 * Physical Address Size Description
43 * ----------------- ----- ---------------------------------
44 * c0000000-c001ffff 128KB reserved for video RAM [1]
45 * c0020000-c0023fff 16KB parameters (see Documentation/arm/Setup)
46 * c0024000-c0027fff 16KB swapper_pg_dir (task 0 page directory)
47 * c0028000-... kernel image (TEXTADDR)
48 *
49 * [1] Unused pages should be given back to the VM; they are not yet.
50 * The parameter block should also be released (not sure if this
51 * happens).
52 */
53static struct map_desc edb7211_io_desc[] __initdata = {
54 { /* memory-mapped extra keyboard row */
55 .virtual = EP7211_VIRT_EXTKBD,
56 .pfn = __phys_to_pfn(EP7211_PHYS_EXTKBD),
57 .length = SZ_1M,
58 .type = MT_DEVICE,
59 }, { /* and CS8900A Ethernet chip */
60 .virtual = EP7211_VIRT_CS8900A,
61 .pfn = __phys_to_pfn(EP7211_PHYS_CS8900A),
62 .length = SZ_1M,
63 .type = MT_DEVICE,
64 }, { /* flash banks */
65 .virtual = EP7211_VIRT_FLASH1,
66 .pfn = __phys_to_pfn(EP7211_PHYS_FLASH1),
67 .length = SZ_8M,
68 .type = MT_DEVICE,
69 }, {
70 .virtual = EP7211_VIRT_FLASH2,
71 .pfn = __phys_to_pfn(EP7211_PHYS_FLASH2),
72 .length = SZ_8M,
73 .type = MT_DEVICE,
74 }
75};
76
77void __init edb7211_map_io(void)
78{
79 clps711x_map_io();
80 iotable_init(edb7211_io_desc, ARRAY_SIZE(edb7211_io_desc));
81}
82
diff --git a/arch/arm/mach-clps711x/include/mach/autcpu12.h b/arch/arm/mach-clps711x/include/mach/autcpu12.h
index 1588a365f61..0452f5f3f03 100644
--- a/arch/arm/mach-clps711x/include/mach/autcpu12.h
+++ b/arch/arm/mach-clps711x/include/mach/autcpu12.h
@@ -21,24 +21,15 @@
21#define __ASM_ARCH_AUTCPU12_H 21#define __ASM_ARCH_AUTCPU12_H
22 22
23/* 23/*
24 * The CS8900A ethernet chip has its I/O registers wired to chip select 2
25 * (nCS2). This is the mapping for it.
26 */
27#define AUTCPU12_PHYS_CS8900A CS2_PHYS_BASE /* physical */
28#define AUTCPU12_VIRT_CS8900A (0xfe000000) /* virtual */
29
30/*
31 * The flash bank is wired to chip select 0 24 * The flash bank is wired to chip select 0
32 */ 25 */
33#define AUTCPU12_PHYS_FLASH CS0_PHYS_BASE /* physical */ 26#define AUTCPU12_PHYS_FLASH CS0_PHYS_BASE /* physical */
34 27
35/* offset for device specific information structure */ 28/* offset for device specific information structure */
36#define AUTCPU12_LCDINFO_OFFS (0x00010000) 29#define AUTCPU12_LCDINFO_OFFS (0x00010000)
37/* 30
38* Videomemory is the internal SRAM (CS 6) 31/* Videomemory in the internal SRAM (CS 6) */
39*/
40#define AUTCPU12_PHYS_VIDEO CS6_PHYS_BASE 32#define AUTCPU12_PHYS_VIDEO CS6_PHYS_BASE
41#define AUTCPU12_VIRT_VIDEO (0xfd000000)
42 33
43/* 34/*
44* All special IO's are tied to CS1 35* All special IO's are tied to CS1
@@ -49,8 +40,6 @@
49 40
50#define AUTCPU12_PHYS_CSAUX1 CS1_PHYS_BASE +0x04000000 /* physical */ 41#define AUTCPU12_PHYS_CSAUX1 CS1_PHYS_BASE +0x04000000 /* physical */
51 42
52#define AUTCPU12_PHYS_SMC CS1_PHYS_BASE +0x06000000 /* physical */
53
54#define AUTCPU12_PHYS_CAN CS1_PHYS_BASE +0x08000000 /* physical */ 43#define AUTCPU12_PHYS_CAN CS1_PHYS_BASE +0x08000000 /* physical */
55 44
56#define AUTCPU12_PHYS_TOUCH CS1_PHYS_BASE +0x0A000000 /* physical */ 45#define AUTCPU12_PHYS_TOUCH CS1_PHYS_BASE +0x0A000000 /* physical */
@@ -59,14 +48,6 @@
59 48
60#define AUTCPU12_PHYS_LPT CS1_PHYS_BASE +0x0E000000 /* physical */ 49#define AUTCPU12_PHYS_LPT CS1_PHYS_BASE +0x0E000000 /* physical */
61 50
62/*
63* defines for smartmedia card access
64*/
65#define AUTCPU12_SMC_RDY (1<<2)
66#define AUTCPU12_SMC_ALE (1<<3)
67#define AUTCPU12_SMC_CLE (1<<4)
68#define AUTCPU12_SMC_PORT_OFFSET PBDR
69#define AUTCPU12_SMC_SELECT_OFFSET 0x10
70/* 51/*
71* defines for lcd contrast 52* defines for lcd contrast
72*/ 53*/
diff --git a/arch/arm/mach-clps711x/include/mach/clps711x.h b/arch/arm/mach-clps711x/include/mach/clps711x.h
index c82e21ca49c..01d1b955971 100644
--- a/arch/arm/mach-clps711x/include/mach/clps711x.h
+++ b/arch/arm/mach-clps711x/include/mach/clps711x.h
@@ -257,6 +257,9 @@
257#define MEMCFG_BUS_WIDTH_16 (0) 257#define MEMCFG_BUS_WIDTH_16 (0)
258#define MEMCFG_BUS_WIDTH_8 (3) 258#define MEMCFG_BUS_WIDTH_8 (3)
259 259
260#define MEMCFG_SQAEN (1 << 6)
261#define MEMCFG_CLKENB (1 << 7)
262
260#define MEMCFG_WAITSTATE_8_3 (0 << 2) 263#define MEMCFG_WAITSTATE_8_3 (0 << 2)
261#define MEMCFG_WAITSTATE_7_3 (1 << 2) 264#define MEMCFG_WAITSTATE_7_3 (1 << 2)
262#define MEMCFG_WAITSTATE_6_3 (2 << 2) 265#define MEMCFG_WAITSTATE_6_3 (2 << 2)
@@ -274,4 +277,28 @@
274#define MEMCFG_WAITSTATE_2_0 (14 << 2) 277#define MEMCFG_WAITSTATE_2_0 (14 << 2)
275#define MEMCFG_WAITSTATE_1_0 (15 << 2) 278#define MEMCFG_WAITSTATE_1_0 (15 << 2)
276 279
280/* INTSR1 Interrupts */
281#define IRQ_CSINT (4)
282#define IRQ_EINT1 (5)
283#define IRQ_EINT2 (6)
284#define IRQ_EINT3 (7)
285#define IRQ_TC1OI (8)
286#define IRQ_TC2OI (9)
287#define IRQ_RTCMI (10)
288#define IRQ_TINT (11)
289#define IRQ_UTXINT1 (12)
290#define IRQ_URXINT1 (13)
291#define IRQ_UMSINT (14)
292#define IRQ_SSEOTI (15)
293
294/* INTSR2 Interrupts */
295#define IRQ_KBDINT (16 + 0)
296#define IRQ_SS2RX (16 + 1)
297#define IRQ_SS2TX (16 + 2)
298#define IRQ_UTXINT2 (16 + 12)
299#define IRQ_URXINT2 (16 + 13)
300
301/* INTSR3 Interrupts */
302#define IRQ_DAIINT (32 + 0)
303
277#endif /* __MACH_CLPS711X_H */ 304#endif /* __MACH_CLPS711X_H */
diff --git a/arch/arm/mach-clps711x/include/mach/entry-macro.S b/arch/arm/mach-clps711x/include/mach/entry-macro.S
deleted file mode 100644
index 56e5c2c2350..00000000000
--- a/arch/arm/mach-clps711x/include/mach/entry-macro.S
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for CLPS711X-based platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <mach/hardware.h>
11
12 .macro get_irqnr_preamble, base, tmp
13 .endm
14
15#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
16#error INTSR stride != INTMR stride
17#endif
18
19 .macro get_irqnr_and_base, irqnr, stat, base, mask
20 mov \base, #CLPS711X_VIRT_BASE
21 ldr \stat, [\base, #INTSR1]
22 ldr \mask, [\base, #INTMR1]
23 mov \irqnr, #4
24 mov \mask, \mask, lsl #16
25 and \stat, \stat, \mask, lsr #16
26 movs \stat, \stat, lsr #4
27 bne 1001f
28
29 add \base, \base, #INTSR2 - INTSR1
30 ldr \stat, [\base, #INTSR1]
31 ldr \mask, [\base, #INTMR1]
32 mov \irqnr, #16
33 mov \mask, \mask, lsl #16
34 and \stat, \stat, \mask, lsr #16
35
361001: tst \stat, #255
37 addeq \irqnr, \irqnr, #8
38 moveq \stat, \stat, lsr #8
39 tst \stat, #15
40 addeq \irqnr, \irqnr, #4
41 moveq \stat, \stat, lsr #4
42 tst \stat, #3
43 addeq \irqnr, \irqnr, #2
44 moveq \stat, \stat, lsr #2
45 tst \stat, #1
46 addeq \irqnr, \irqnr, #1
47 moveq \stat, \stat, lsr #1
48 tst \stat, #1 @ bit 0 should be set
49 .endm
50
51
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h
index 8497775d6ee..2f23dd5d73e 100644
--- a/arch/arm/mach-clps711x/include/mach/hardware.h
+++ b/arch/arm/mach-clps711x/include/mach/hardware.h
@@ -24,7 +24,10 @@
24 24
25#include <mach/clps711x.h> 25#include <mach/clps711x.h>
26 26
27#define CLPS711X_VIRT_BASE IOMEM(0xff000000) 27#define IO_ADDRESS(x) (0xdc000000 + (((x) & 0x03ffffff) | \
28 (((x) >> 2) & 0x3c000000)))
29
30#define CLPS711X_VIRT_BASE IOMEM(IO_ADDRESS(CLPS711X_PHYS_BASE))
28 31
29#ifndef __ASSEMBLY__ 32#ifndef __ASSEMBLY__
30#define clps_readb(off) readb(CLPS711X_VIRT_BASE + (off)) 33#define clps_readb(off) readb(CLPS711X_VIRT_BASE + (off))
@@ -61,67 +64,17 @@
61#define CS7_PHYS_BASE (0x00000000) 64#define CS7_PHYS_BASE (0x00000000)
62#endif 65#endif
63 66
64#define SYSPLD_VIRT_BASE 0xfe000000 67#define CLPS711X_SRAM_BASE CS6_PHYS_BASE
65#define SYSPLD_BASE SYSPLD_VIRT_BASE 68#define CLPS711X_SRAM_SIZE (48 * 1024)
66
67#if defined (CONFIG_ARCH_CDB89712)
68
69#define ETHER_START 0x20000000
70#define ETHER_SIZE 0x1000
71#define ETHER_BASE 0xfe000000
72
73#endif
74 69
70#define CLPS711X_SDRAM0_BASE (0xc0000000)
71#define CLPS711X_SDRAM1_BASE (0xd0000000)
75 72
76#if defined (CONFIG_ARCH_EDB7211) 73#if defined (CONFIG_ARCH_EDB7211)
77 74
78/* 75/* The extra 8 lines of the keyboard matrix are wired to chip select 3 */
79 * The extra 8 lines of the keyboard matrix are wired to chip select 3 (nCS3) 76#define EP7211_PHYS_EXTKBD CS3_PHYS_BASE
80 * and repeat across it. This is the mapping for it.
81 *
82 * In jumpered boot mode, nCS3 is mapped to 0x4000000, not 0x3000000. This
83 * was cause for much consternation and headscratching. This should probably
84 * be made a compile/run time kernel option.
85 */
86#define EP7211_PHYS_EXTKBD CS3_PHYS_BASE /* physical */
87
88#define EP7211_VIRT_EXTKBD (0xfd000000) /* virtual */
89
90
91/*
92 * The CS8900A ethernet chip has its I/O registers wired to chip select 2
93 * (nCS2). This is the mapping for it.
94 *
95 * In jumpered boot mode, nCS2 is mapped to 0x5000000, not 0x2000000. This
96 * was cause for much consternation and headscratching. This should probably
97 * be made a compile/run time kernel option.
98 */
99#define EP7211_PHYS_CS8900A CS2_PHYS_BASE /* physical */
100
101#define EP7211_VIRT_CS8900A (0xfc000000) /* virtual */
102
103
104/*
105 * The two flash banks are wired to chip selects 0 and 1. This is the mapping
106 * for them.
107 *
108 * nCS0 and nCS1 are at 0x70000000 and 0x60000000, respectively, when running
109 * in jumpered boot mode.
110 */
111#define EP7211_PHYS_FLASH1 CS0_PHYS_BASE /* physical */
112#define EP7211_PHYS_FLASH2 CS1_PHYS_BASE /* physical */
113
114#define EP7211_VIRT_FLASH1 (0xfa000000) /* virtual */
115#define EP7211_VIRT_FLASH2 (0xfb000000) /* virtual */
116 77
117#endif /* CONFIG_ARCH_EDB7211 */ 78#endif /* CONFIG_ARCH_EDB7211 */
118 79
119/*
120 * Relevant bits in port D, which controls power to the various parts of
121 * the LCD on the EDB7211.
122 */
123#define EDB_PD1_LCD_DC_DC_EN (1<<1)
124#define EDB_PD2_LCDEN (1<<2)
125#define EDB_PD3_LCDBL (1<<3)
126
127#endif 80#endif
diff --git a/arch/arm/mach-clps711x/include/mach/irqs.h b/arch/arm/mach-clps711x/include/mach/irqs.h
deleted file mode 100644
index 14d215f8ca8..00000000000
--- a/arch/arm/mach-clps711x/include/mach/irqs.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/irqs.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/*
22 * Interrupts from INTSR1
23 */
24#define IRQ_CSINT 4
25#define IRQ_EINT1 5
26#define IRQ_EINT2 6
27#define IRQ_EINT3 7
28#define IRQ_TC1OI 8
29#define IRQ_TC2OI 9
30#define IRQ_RTCMI 10
31#define IRQ_TINT 11
32#define IRQ_UTXINT1 12
33#define IRQ_URXINT1 13
34#define IRQ_UMSINT 14
35#define IRQ_SSEOTI 15
36
37#define INT1_IRQS (0x0000fff0)
38
39/*
40 * Interrupts from INTSR2
41 */
42#define IRQ_KBDINT (16+0) /* bit 0 */
43#define IRQ_SS2RX (16+1) /* bit 1 */
44#define IRQ_SS2TX (16+2) /* bit 2 */
45#define IRQ_UTXINT2 (16+12) /* bit 12 */
46#define IRQ_URXINT2 (16+13) /* bit 13 */
47
48#define INT2_IRQS (0x30070000)
49
50#define NR_IRQS 30
diff --git a/arch/arm/mach-clps711x/include/mach/syspld.h b/arch/arm/mach-clps711x/include/mach/syspld.h
index f7f4c120189..9a433155bf5 100644
--- a/arch/arm/mach-clps711x/include/mach/syspld.h
+++ b/arch/arm/mach-clps711x/include/mach/syspld.h
@@ -23,14 +23,9 @@
23#define __ASM_ARCH_SYSPLD_H 23#define __ASM_ARCH_SYSPLD_H
24 24
25#define SYSPLD_PHYS_BASE (0x10000000) 25#define SYSPLD_PHYS_BASE (0x10000000)
26#define SYSPLD_VIRT_BASE IO_ADDRESS(SYSPLD_PHYS_BASE)
26 27
27#ifndef __ASSEMBLY__ 28#define SYSPLD_REG(type, off) (*(volatile type *)(SYSPLD_VIRT_BASE + (off)))
28#include <asm/types.h>
29
30#define SYSPLD_REG(type,off) (*(volatile type *)(SYSPLD_BASE + off))
31#else
32#define SYSPLD_REG(type,off) (off)
33#endif
34 29
35#define PLD_INT SYSPLD_REG(u32, 0x000000) 30#define PLD_INT SYSPLD_REG(u32, 0x000000)
36#define PLD_INT_PENIRQ (1 << 5) 31#define PLD_INT_PENIRQ (1 << 5)
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
deleted file mode 100644
index b752b586fc2..00000000000
--- a/arch/arm/mach-clps711x/p720t.c
+++ /dev/null
@@ -1,181 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/p720t.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <linux/mm.h>
25#include <linux/io.h>
26#include <linux/slab.h>
27#include <linux/leds.h>
28
29#include <mach/hardware.h>
30#include <asm/pgtable.h>
31#include <asm/page.h>
32#include <asm/setup.h>
33#include <asm/sizes.h>
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <mach/syspld.h>
38
39#include <asm/hardware/clps7111.h>
40
41#include "common.h"
42
43/*
44 * Map the P720T system PLD. It occupies two address spaces:
45 * SYSPLD_PHYS_BASE and SYSPLD_PHYS_BASE + 0x00400000
46 * We map both here.
47 */
48static struct map_desc p720t_io_desc[] __initdata = {
49 {
50 .virtual = SYSPLD_VIRT_BASE,
51 .pfn = __phys_to_pfn(SYSPLD_PHYS_BASE),
52 .length = SZ_1M,
53 .type = MT_DEVICE
54 }, {
55 .virtual = 0xfe400000,
56 .pfn = __phys_to_pfn(0x10400000),
57 .length = SZ_1M,
58 .type = MT_DEVICE
59 }
60};
61
62static void __init
63fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
64{
65 /*
66 * Our bootloader doesn't setup any tags (yet).
67 */
68 if (tag->hdr.tag != ATAG_CORE) {
69 tag->hdr.tag = ATAG_CORE;
70 tag->hdr.size = tag_size(tag_core);
71 tag->u.core.flags = 0;
72 tag->u.core.pagesize = PAGE_SIZE;
73 tag->u.core.rootdev = 0x0100;
74
75 tag = tag_next(tag);
76 tag->hdr.tag = ATAG_MEM;
77 tag->hdr.size = tag_size(tag_mem32);
78 tag->u.mem.size = 4096;
79 tag->u.mem.start = PHYS_OFFSET;
80
81 tag = tag_next(tag);
82 tag->hdr.tag = ATAG_NONE;
83 tag->hdr.size = 0;
84 }
85}
86
87static void __init p720t_map_io(void)
88{
89 clps711x_map_io();
90 iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc));
91}
92
93static void __init p720t_init_early(void)
94{
95 /*
96 * Power down as much as possible in case we don't
97 * have the drivers loaded.
98 */
99 PLD_LCDEN = 0;
100 PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
101
102 PLD_KBD = 0;
103 PLD_IO = 0;
104 PLD_IRDA = 0;
105 PLD_CODEC = 0;
106 PLD_TCH = 0;
107 PLD_SPI = 0;
108 if (!IS_ENABLED(CONFIG_DEBUG_LL)) {
109 PLD_COM2 = 0;
110 PLD_COM1 = 0;
111 }
112}
113
114/*
115 * LED controled by CPLD
116 */
117#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
118static void p720t_led_set(struct led_classdev *cdev,
119 enum led_brightness b)
120{
121 u8 reg = clps_readb(PDDR);
122
123 if (b != LED_OFF)
124 reg |= 0x1;
125 else
126 reg &= ~0x1;
127
128 clps_writeb(reg, PDDR);
129}
130
131static enum led_brightness p720t_led_get(struct led_classdev *cdev)
132{
133 u8 reg = clps_readb(PDDR);
134
135 return (reg & 0x1) ? LED_FULL : LED_OFF;
136}
137
138static int __init p720t_leds_init(void)
139{
140
141 struct led_classdev *cdev;
142 int ret;
143
144 if (!machine_is_p720t())
145 return -ENODEV;
146
147 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
148 if (!cdev)
149 return -ENOMEM;
150
151 cdev->name = "p720t:0";
152 cdev->brightness_set = p720t_led_set;
153 cdev->brightness_get = p720t_led_get;
154 cdev->default_trigger = "heartbeat";
155
156 ret = led_classdev_register(NULL, cdev);
157 if (ret < 0) {
158 kfree(cdev);
159 return ret;
160 }
161
162 return 0;
163}
164
165/*
166 * Since we may have triggers on any subsystem, defer registration
167 * until after subsystem_init.
168 */
169fs_initcall(p720t_leds_init);
170#endif
171
172MACHINE_START(P720T, "ARM-Prospector720T")
173 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
174 .atag_offset = 0x100,
175 .fixup = fixup_p720t,
176 .init_early = p720t_init_early,
177 .map_io = p720t_map_io,
178 .init_irq = clps711x_init_irq,
179 .timer = &clps711x_timer,
180 .restart = clps711x_restart,
181MACHINE_END
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index 29b13f249aa..9ebfcc46feb 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -3,7 +3,6 @@ menu "CNS3XXX platform type"
3 3
4config MACH_CNS3420VB 4config MACH_CNS3420VB
5 bool "Support for CNS3420 Validation Board" 5 bool "Support for CNS3420 Validation Board"
6 select MIGHT_HAVE_PCI
7 help 6 help
8 Include support for the Cavium Networks CNS3420 MPCore Platform 7 Include support for the Cavium Networks CNS3420 MPCore Platform
9 Baseboard. 8 Baseboard.
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 2c5fb4c7e50..ae305397003 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -24,6 +24,8 @@
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/usb/ehci_pdriver.h>
28#include <linux/usb/ohci_pdriver.h>
27#include <asm/setup.h> 29#include <asm/setup.h>
28#include <asm/mach-types.h> 30#include <asm/mach-types.h>
29#include <asm/hardware/gic.h> 31#include <asm/hardware/gic.h>
@@ -32,6 +34,7 @@
32#include <asm/mach/time.h> 34#include <asm/mach/time.h>
33#include <mach/cns3xxx.h> 35#include <mach/cns3xxx.h>
34#include <mach/irqs.h> 36#include <mach/irqs.h>
37#include <mach/pm.h>
35#include "core.h" 38#include "core.h"
36#include "devices.h" 39#include "devices.h"
37 40
@@ -125,13 +128,52 @@ static struct resource cns3xxx_usb_ehci_resources[] = {
125 128
126static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32); 129static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32);
127 130
131static int csn3xxx_usb_power_on(struct platform_device *pdev)
132{
133 /*
134 * EHCI and OHCI share the same clock and power,
135 * resetting twice would cause the 1st controller been reset.
136 * Therefore only do power up at the first up device, and
137 * power down at the last down device.
138 *
139 * Set USB AHB INCR length to 16
140 */
141 if (atomic_inc_return(&usb_pwr_ref) == 1) {
142 cns3xxx_pwr_power_up(1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB);
143 cns3xxx_pwr_clk_en(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
144 cns3xxx_pwr_soft_rst(1 << PM_SOFT_RST_REG_OFFST_USB_HOST);
145 __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 << 24)),
146 MISC_CHIP_CONFIG_REG);
147 }
148
149 return 0;
150}
151
152static void csn3xxx_usb_power_off(struct platform_device *pdev)
153{
154 /*
155 * EHCI and OHCI share the same clock and power,
156 * resetting twice would cause the 1st controller been reset.
157 * Therefore only do power up at the first up device, and
158 * power down at the last down device.
159 */
160 if (atomic_dec_return(&usb_pwr_ref) == 0)
161 cns3xxx_pwr_clk_dis(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
162}
163
164static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
165 .power_on = csn3xxx_usb_power_on,
166 .power_off = csn3xxx_usb_power_off,
167};
168
128static struct platform_device cns3xxx_usb_ehci_device = { 169static struct platform_device cns3xxx_usb_ehci_device = {
129 .name = "cns3xxx-ehci", 170 .name = "ehci-platform",
130 .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources), 171 .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources),
131 .resource = cns3xxx_usb_ehci_resources, 172 .resource = cns3xxx_usb_ehci_resources,
132 .dev = { 173 .dev = {
133 .dma_mask = &cns3xxx_usb_ehci_dma_mask, 174 .dma_mask = &cns3xxx_usb_ehci_dma_mask,
134 .coherent_dma_mask = DMA_BIT_MASK(32), 175 .coherent_dma_mask = DMA_BIT_MASK(32),
176 .platform_data = &cns3xxx_usb_ehci_pdata,
135 }, 177 },
136}; 178};
137 179
@@ -149,13 +191,20 @@ static struct resource cns3xxx_usb_ohci_resources[] = {
149 191
150static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32); 192static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32);
151 193
194static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = {
195 .num_ports = 1,
196 .power_on = csn3xxx_usb_power_on,
197 .power_off = csn3xxx_usb_power_off,
198};
199
152static struct platform_device cns3xxx_usb_ohci_device = { 200static struct platform_device cns3xxx_usb_ohci_device = {
153 .name = "cns3xxx-ohci", 201 .name = "ohci-platform",
154 .num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources), 202 .num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources),
155 .resource = cns3xxx_usb_ohci_resources, 203 .resource = cns3xxx_usb_ohci_resources,
156 .dev = { 204 .dev = {
157 .dma_mask = &cns3xxx_usb_ohci_dma_mask, 205 .dma_mask = &cns3xxx_usb_ohci_dma_mask,
158 .coherent_dma_mask = DMA_BIT_MASK(32), 206 .coherent_dma_mask = DMA_BIT_MASK(32),
207 .platform_data = &cns3xxx_usb_ohci_pdata,
159 }, 208 },
160}; 209};
161 210
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index f8eecb95941..0153950f606 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -58,6 +58,14 @@ config ARCH_DAVINCI_TNETV107X
58 58
59comment "DaVinci Board Type" 59comment "DaVinci Board Type"
60 60
61config MACH_DA8XX_DT
62 bool "Support DA8XX platforms using device tree"
63 default y
64 depends on ARCH_DAVINCI_DA8XX
65 help
66 Say y here to include support for TI DaVinci DA850 based using
67 Flattened Device Tree. More information at Documentation/devicetree
68
61config MACH_DAVINCI_EVM 69config MACH_DAVINCI_EVM
62 bool "TI DM644x EVM" 70 bool "TI DM644x EVM"
63 default ARCH_DAVINCI_DM644x 71 default ARCH_DAVINCI_DM644x
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 2227effcb0e..fb5c1aa98a6 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_AINTC) += irq.o
22obj-$(CONFIG_CP_INTC) += cp_intc.o 22obj-$(CONFIG_CP_INTC) += cp_intc.o
23 23
24# Board specific 24# Board specific
25obj-$(CONFIG_MACH_DA8XX_DT) += da8xx-dt.o
25obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o 26obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o
26obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o 27obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o
27obj-$(CONFIG_MACH_NEUROS_OSD2) += board-neuros-osd2.o 28obj-$(CONFIG_MACH_NEUROS_OSD2) += board-neuros-osd2.o
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 32ee3f89596..7211772edd9 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -11,39 +11,40 @@
11 * is licensed "as is" without any warranty of any kind, whether express 11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied. 12 * or implied.
13 */ 13 */
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/console.h> 14#include <linux/console.h>
15#include <linux/delay.h>
16#include <linux/gpio.h>
17#include <linux/gpio_keys.h>
18#include <linux/init.h>
19#include <linux/kernel.h>
17#include <linux/i2c.h> 20#include <linux/i2c.h>
18#include <linux/i2c/at24.h> 21#include <linux/i2c/at24.h>
19#include <linux/i2c/pca953x.h> 22#include <linux/i2c/pca953x.h>
20#include <linux/input.h> 23#include <linux/input.h>
24#include <linux/input/tps6507x-ts.h>
21#include <linux/mfd/tps6507x.h> 25#include <linux/mfd/tps6507x.h>
22#include <linux/gpio.h>
23#include <linux/gpio_keys.h>
24#include <linux/platform_device.h>
25#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
26#include <linux/mtd/nand.h> 27#include <linux/mtd/nand.h>
27#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h> 29#include <linux/mtd/physmap.h>
30#include <linux/platform_device.h>
31#include <linux/platform_data/mtd-davinci.h>
32#include <linux/platform_data/mtd-davinci-aemif.h>
33#include <linux/platform_data/spi-davinci.h>
34#include <linux/platform_data/uio_pruss.h>
29#include <linux/regulator/machine.h> 35#include <linux/regulator/machine.h>
30#include <linux/regulator/tps6507x.h> 36#include <linux/regulator/tps6507x.h>
31#include <linux/input/tps6507x-ts.h>
32#include <linux/spi/spi.h> 37#include <linux/spi/spi.h>
33#include <linux/spi/flash.h> 38#include <linux/spi/flash.h>
34#include <linux/delay.h>
35#include <linux/wl12xx.h> 39#include <linux/wl12xx.h>
36 40
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/system_info.h>
40
41#include <mach/cp_intc.h> 41#include <mach/cp_intc.h>
42#include <mach/da8xx.h> 42#include <mach/da8xx.h>
43#include <linux/platform_data/mtd-davinci.h>
44#include <mach/mux.h> 43#include <mach/mux.h>
45#include <linux/platform_data/mtd-davinci-aemif.h> 44
46#include <linux/platform_data/spi-davinci.h> 45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
47#include <asm/system_info.h>
47 48
48#include <media/tvp514x.h> 49#include <media/tvp514x.h>
49#include <media/adv7343.h> 50#include <media/adv7343.h>
@@ -762,16 +763,19 @@ static u8 da850_iis_serializer_direction[] = {
762}; 763};
763 764
764static struct snd_platform_data da850_evm_snd_data = { 765static struct snd_platform_data da850_evm_snd_data = {
765 .tx_dma_offset = 0x2000, 766 .tx_dma_offset = 0x2000,
766 .rx_dma_offset = 0x2000, 767 .rx_dma_offset = 0x2000,
767 .op_mode = DAVINCI_MCASP_IIS_MODE, 768 .op_mode = DAVINCI_MCASP_IIS_MODE,
768 .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), 769 .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
769 .tdm_slots = 2, 770 .tdm_slots = 2,
770 .serial_dir = da850_iis_serializer_direction, 771 .serial_dir = da850_iis_serializer_direction,
771 .asp_chan_q = EVENTQ_0, 772 .asp_chan_q = EVENTQ_0,
772 .version = MCASP_VERSION_2, 773 .ram_chan_q = EVENTQ_1,
773 .txnumevt = 1, 774 .version = MCASP_VERSION_2,
774 .rxnumevt = 1, 775 .txnumevt = 1,
776 .rxnumevt = 1,
777 .sram_size_playback = SZ_8K,
778 .sram_size_capture = SZ_8K,
775}; 779};
776 780
777static const short da850_evm_mcasp_pins[] __initconst = { 781static const short da850_evm_mcasp_pins[] __initconst = {
@@ -1509,6 +1513,7 @@ static __init void da850_evm_init(void)
1509 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n", 1513 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
1510 ret); 1514 ret);
1511 1515
1516 da850_evm_snd_data.sram_pool = sram_get_gen_pool();
1512 da8xx_register_mcasp(0, &da850_evm_snd_data); 1517 da8xx_register_mcasp(0, &da850_evm_snd_data);
1513 1518
1514 ret = davinci_cfg_reg_list(da850_lcdcntl_pins); 1519 ret = davinci_cfg_reg_list(da850_lcdcntl_pins);
@@ -1516,6 +1521,11 @@ static __init void da850_evm_init(void)
1516 pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n", 1521 pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
1517 ret); 1522 ret);
1518 1523
1524 ret = da8xx_register_uio_pruss();
1525 if (ret)
1526 pr_warn("da850_evm_init: pruss initialization failed: %d\n",
1527 ret);
1528
1519 /* Handle board specific muxing for LCD here */ 1529 /* Handle board specific muxing for LCD here */
1520 ret = davinci_cfg_reg_list(da850_evm_lcdc_pins); 1530 ret = davinci_cfg_reg_list(da850_evm_lcdc_pins);
1521 if (ret) 1531 if (ret)
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 88ebea89abd..cdf8d0746e7 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -324,7 +324,7 @@ static __init void dm355_evm_init(void)
324 if (IS_ERR(aemif)) 324 if (IS_ERR(aemif))
325 WARN("%s: unable to get AEMIF clock\n", __func__); 325 WARN("%s: unable to get AEMIF clock\n", __func__);
326 else 326 else
327 clk_enable(aemif); 327 clk_prepare_enable(aemif);
328 328
329 platform_add_devices(davinci_evm_devices, 329 platform_add_devices(davinci_evm_devices,
330 ARRAY_SIZE(davinci_evm_devices)); 330 ARRAY_SIZE(davinci_evm_devices));
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 2f88103c645..d41954507fc 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -246,7 +246,7 @@ static __init void dm355_leopard_init(void)
246 if (IS_ERR(aemif)) 246 if (IS_ERR(aemif))
247 WARN("%s: unable to get AEMIF clock\n", __func__); 247 WARN("%s: unable to get AEMIF clock\n", __func__);
248 else 248 else
249 clk_enable(aemif); 249 clk_prepare_enable(aemif);
250 250
251 platform_add_devices(davinci_leopard_devices, 251 platform_add_devices(davinci_leopard_devices,
252 ARRAY_SIZE(davinci_leopard_devices)); 252 ARRAY_SIZE(davinci_leopard_devices));
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 1b4a8adcfdc..5d49c75388c 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -478,7 +478,7 @@ static void __init evm_init_cpld(void)
478 aemif_clk = clk_get(NULL, "aemif"); 478 aemif_clk = clk_get(NULL, "aemif");
479 if (IS_ERR(aemif_clk)) 479 if (IS_ERR(aemif_clk))
480 return; 480 return;
481 clk_enable(aemif_clk); 481 clk_prepare_enable(aemif_clk);
482 482
483 if (request_mem_region(DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE, 483 if (request_mem_region(DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE,
484 "cpld") == NULL) 484 "cpld") == NULL)
@@ -489,7 +489,7 @@ static void __init evm_init_cpld(void)
489 SECTION_SIZE); 489 SECTION_SIZE);
490fail: 490fail:
491 pr_err("ERROR: can't map CPLD\n"); 491 pr_err("ERROR: can't map CPLD\n");
492 clk_disable(aemif_clk); 492 clk_disable_unprepare(aemif_clk);
493 return; 493 return;
494 } 494 }
495 495
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index f22572cee49..f5e018de7fa 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -519,13 +519,11 @@ static int dm6444evm_msp430_get_pins(void)
519 char buf[4]; 519 char buf[4];
520 struct i2c_msg msg[2] = { 520 struct i2c_msg msg[2] = {
521 { 521 {
522 .addr = dm6446evm_msp->addr,
523 .flags = 0, 522 .flags = 0,
524 .len = 2, 523 .len = 2,
525 .buf = (void __force *)txbuf, 524 .buf = (void __force *)txbuf,
526 }, 525 },
527 { 526 {
528 .addr = dm6446evm_msp->addr,
529 .flags = I2C_M_RD, 527 .flags = I2C_M_RD,
530 .len = 4, 528 .len = 4,
531 .buf = buf, 529 .buf = buf,
@@ -536,6 +534,9 @@ static int dm6444evm_msp430_get_pins(void)
536 if (!dm6446evm_msp) 534 if (!dm6446evm_msp)
537 return -ENXIO; 535 return -ENXIO;
538 536
537 msg[0].addr = dm6446evm_msp->addr;
538 msg[1].addr = dm6446evm_msp->addr;
539
539 /* Command 4 == get input state, returns port 2 and port3 data 540 /* Command 4 == get input state, returns port 2 and port3 data
540 * S Addr W [A] len=2 [A] cmd=4 [A] 541 * S Addr W [A] len=2 [A] cmd=4 [A]
541 * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P 542 * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P
@@ -776,7 +777,7 @@ static __init void davinci_evm_init(void)
776 struct davinci_soc_info *soc_info = &davinci_soc_info; 777 struct davinci_soc_info *soc_info = &davinci_soc_info;
777 778
778 aemif_clk = clk_get(NULL, "aemif"); 779 aemif_clk = clk_get(NULL, "aemif");
779 clk_enable(aemif_clk); 780 clk_prepare_enable(aemif_clk);
780 781
781 if (HAS_ATA) { 782 if (HAS_ATA) {
782 if (HAS_NAND || HAS_NOR) 783 if (HAS_NAND || HAS_NOR)
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 1dbf85beed1..9211e8800c7 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -194,7 +194,7 @@ static int evm_led_setup(struct i2c_client *client, int gpio,
194 while (ngpio--) { 194 while (ngpio--) {
195 leds->gpio = gpio++; 195 leds->gpio = gpio++;
196 leds++; 196 leds++;
197 }; 197 }
198 198
199 evm_led_dev = platform_device_alloc("leds-gpio", 0); 199 evm_led_dev = platform_device_alloc("leds-gpio", 0);
200 platform_device_add_data(evm_led_dev, &evm_led_data, 200 platform_device_add_data(evm_led_dev, &evm_led_data,
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 144bf31d68d..3e3e3afebf8 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -188,7 +188,7 @@ static __init void davinci_ntosd2_init(void)
188 struct davinci_soc_info *soc_info = &davinci_soc_info; 188 struct davinci_soc_info *soc_info = &davinci_soc_info;
189 189
190 aemif_clk = clk_get(NULL, "aemif"); 190 aemif_clk = clk_get(NULL, "aemif");
191 clk_enable(aemif_clk); 191 clk_prepare_enable(aemif_clk);
192 192
193 if (HAS_ATA) { 193 if (HAS_ATA) {
194 if (HAS_NAND) 194 if (HAS_NAND)
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index 64b0f65a863..a794f6d9d44 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -87,8 +87,6 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
87 iotable_init(davinci_soc_info.io_desc, 87 iotable_init(davinci_soc_info.io_desc,
88 davinci_soc_info.io_desc_num); 88 davinci_soc_info.io_desc_num);
89 89
90 init_consistent_dma_size(14 << 20);
91
92 /* 90 /*
93 * Normally devicemaps_init() would flush caches and tlb after 91 * Normally devicemaps_init() would flush caches and tlb after
94 * mdesc->map_io(), but we must also do it here because of the CPU 92 * mdesc->map_io(), but we must also do it here because of the CPU
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index b90c172d554..68c5fe01857 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -212,6 +212,12 @@ static struct clk tptc2_clk = {
212 .flags = ALWAYS_ENABLED, 212 .flags = ALWAYS_ENABLED,
213}; 213};
214 214
215static struct clk pruss_clk = {
216 .name = "pruss",
217 .parent = &pll0_sysclk2,
218 .lpsc = DA8XX_LPSC0_PRUSS,
219};
220
215static struct clk uart0_clk = { 221static struct clk uart0_clk = {
216 .name = "uart0", 222 .name = "uart0",
217 .parent = &pll0_sysclk2, 223 .parent = &pll0_sysclk2,
@@ -385,6 +391,7 @@ static struct clk_lookup da850_clks[] = {
385 CLK(NULL, "tptc1", &tptc1_clk), 391 CLK(NULL, "tptc1", &tptc1_clk),
386 CLK(NULL, "tpcc1", &tpcc1_clk), 392 CLK(NULL, "tpcc1", &tpcc1_clk),
387 CLK(NULL, "tptc2", &tptc2_clk), 393 CLK(NULL, "tptc2", &tptc2_clk),
394 CLK("pruss_uio", "pruss", &pruss_clk),
388 CLK(NULL, "uart0", &uart0_clk), 395 CLK(NULL, "uart0", &uart0_clk),
389 CLK(NULL, "uart1", &uart1_clk), 396 CLK(NULL, "uart1", &uart1_clk),
390 CLK(NULL, "uart2", &uart2_clk), 397 CLK(NULL, "uart2", &uart2_clk),
@@ -781,12 +788,6 @@ static struct map_desc da850_io_desc[] = {
781 .length = DA8XX_CP_INTC_SIZE, 788 .length = DA8XX_CP_INTC_SIZE,
782 .type = MT_DEVICE 789 .type = MT_DEVICE
783 }, 790 },
784 {
785 .virtual = SRAM_VIRT,
786 .pfn = __phys_to_pfn(DA8XX_ARM_RAM_BASE),
787 .length = SZ_8K,
788 .type = MT_DEVICE
789 },
790}; 791};
791 792
792static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE }; 793static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
@@ -1239,8 +1240,8 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
1239 .gpio_irq = IRQ_DA8XX_GPIO0, 1240 .gpio_irq = IRQ_DA8XX_GPIO0,
1240 .serial_dev = &da8xx_serial_device, 1241 .serial_dev = &da8xx_serial_device,
1241 .emac_pdata = &da8xx_emac_pdata, 1242 .emac_pdata = &da8xx_emac_pdata,
1242 .sram_dma = DA8XX_ARM_RAM_BASE, 1243 .sram_dma = DA8XX_SHARED_RAM_BASE,
1243 .sram_len = SZ_8K, 1244 .sram_len = SZ_128K,
1244}; 1245};
1245 1246
1246void __init da850_init(void) 1247void __init da850_init(void)
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
new file mode 100644
index 00000000000..37c27af18fa
--- /dev/null
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -0,0 +1,66 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * Modified from mach-omap/omap2/board-generic.c
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/io.h>
11#include <linux/of_irq.h>
12#include <linux/of_platform.h>
13#include <linux/irqdomain.h>
14
15#include <asm/mach/arch.h>
16
17#include <mach/common.h>
18#include <mach/cp_intc.h>
19#include <mach/da8xx.h>
20
21#define DA8XX_NUM_UARTS 3
22
23void __init da8xx_uart_clk_enable(void)
24{
25 int i;
26 for (i = 0; i < DA8XX_NUM_UARTS; i++)
27 davinci_serial_setup_clk(i, NULL);
28}
29
30static struct of_device_id da8xx_irq_match[] __initdata = {
31 { .compatible = "ti,cp-intc", .data = cp_intc_of_init, },
32 { }
33};
34
35static void __init da8xx_init_irq(void)
36{
37 of_irq_init(da8xx_irq_match);
38}
39
40#ifdef CONFIG_ARCH_DAVINCI_DA850
41
42static void __init da850_init_machine(void)
43{
44 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
45
46 da8xx_uart_clk_enable();
47}
48
49static const char *da850_boards_compat[] __initdata = {
50 "enbw,cmc",
51 "ti,da850-evm",
52 "ti,da850",
53 NULL,
54};
55
56DT_MACHINE_START(DA850_DT, "Generic DA850/OMAP-L138/AM18x")
57 .map_io = da850_init,
58 .init_irq = da8xx_init_irq,
59 .timer = &davinci_timer,
60 .init_machine = da850_init_machine,
61 .dt_compat = da850_boards_compat,
62 .init_late = davinci_init_late,
63 .restart = da8xx_restart,
64MACHINE_END
65
66#endif
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index bd2f72b414b..46c9a0c09ae 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -22,6 +22,7 @@
22#include <mach/time.h> 22#include <mach/time.h>
23#include <mach/da8xx.h> 23#include <mach/da8xx.h>
24#include <mach/cpuidle.h> 24#include <mach/cpuidle.h>
25#include <mach/sram.h>
25 26
26#include "clock.h" 27#include "clock.h"
27#include "asp.h" 28#include "asp.h"
@@ -32,6 +33,7 @@
32#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ 33#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
33#define DA8XX_I2C0_BASE 0x01c22000 34#define DA8XX_I2C0_BASE 0x01c22000
34#define DA8XX_RTC_BASE 0x01c23000 35#define DA8XX_RTC_BASE 0x01c23000
36#define DA8XX_PRUSS_MEM_BASE 0x01c30000
35#define DA8XX_MMCSD0_BASE 0x01c40000 37#define DA8XX_MMCSD0_BASE 0x01c40000
36#define DA8XX_SPI0_BASE 0x01c41000 38#define DA8XX_SPI0_BASE 0x01c41000
37#define DA830_SPI1_BASE 0x01e12000 39#define DA830_SPI1_BASE 0x01e12000
@@ -518,6 +520,75 @@ void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
518 } 520 }
519} 521}
520 522
523static struct resource da8xx_pruss_resources[] = {
524 {
525 .start = DA8XX_PRUSS_MEM_BASE,
526 .end = DA8XX_PRUSS_MEM_BASE + 0xFFFF,
527 .flags = IORESOURCE_MEM,
528 },
529 {
530 .start = IRQ_DA8XX_EVTOUT0,
531 .end = IRQ_DA8XX_EVTOUT0,
532 .flags = IORESOURCE_IRQ,
533 },
534 {
535 .start = IRQ_DA8XX_EVTOUT1,
536 .end = IRQ_DA8XX_EVTOUT1,
537 .flags = IORESOURCE_IRQ,
538 },
539 {
540 .start = IRQ_DA8XX_EVTOUT2,
541 .end = IRQ_DA8XX_EVTOUT2,
542 .flags = IORESOURCE_IRQ,
543 },
544 {
545 .start = IRQ_DA8XX_EVTOUT3,
546 .end = IRQ_DA8XX_EVTOUT3,
547 .flags = IORESOURCE_IRQ,
548 },
549 {
550 .start = IRQ_DA8XX_EVTOUT4,
551 .end = IRQ_DA8XX_EVTOUT4,
552 .flags = IORESOURCE_IRQ,
553 },
554 {
555 .start = IRQ_DA8XX_EVTOUT5,
556 .end = IRQ_DA8XX_EVTOUT5,
557 .flags = IORESOURCE_IRQ,
558 },
559 {
560 .start = IRQ_DA8XX_EVTOUT6,
561 .end = IRQ_DA8XX_EVTOUT6,
562 .flags = IORESOURCE_IRQ,
563 },
564 {
565 .start = IRQ_DA8XX_EVTOUT7,
566 .end = IRQ_DA8XX_EVTOUT7,
567 .flags = IORESOURCE_IRQ,
568 },
569};
570
571static struct uio_pruss_pdata da8xx_uio_pruss_pdata = {
572 .pintc_base = 0x4000,
573};
574
575static struct platform_device da8xx_uio_pruss_dev = {
576 .name = "pruss_uio",
577 .id = -1,
578 .num_resources = ARRAY_SIZE(da8xx_pruss_resources),
579 .resource = da8xx_pruss_resources,
580 .dev = {
581 .coherent_dma_mask = DMA_BIT_MASK(32),
582 .platform_data = &da8xx_uio_pruss_pdata,
583 }
584};
585
586int __init da8xx_register_uio_pruss(void)
587{
588 da8xx_uio_pruss_pdata.sram_pool = sram_get_gen_pool();
589 return platform_device_register(&da8xx_uio_pruss_dev);
590}
591
521static const struct display_panel disp_panel = { 592static const struct display_panel disp_panel = {
522 QVGA, 593 QVGA,
523 16, 594 16,
@@ -900,7 +971,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
900 if (IS_ERR(da850_sata_clk)) 971 if (IS_ERR(da850_sata_clk))
901 return PTR_ERR(da850_sata_clk); 972 return PTR_ERR(da850_sata_clk);
902 973
903 ret = clk_enable(da850_sata_clk); 974 ret = clk_prepare_enable(da850_sata_clk);
904 if (ret) 975 if (ret)
905 goto err0; 976 goto err0;
906 977
@@ -931,7 +1002,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
931 return 0; 1002 return 0;
932 1003
933err1: 1004err1:
934 clk_disable(da850_sata_clk); 1005 clk_disable_unprepare(da850_sata_clk);
935err0: 1006err0:
936 clk_put(da850_sata_clk); 1007 clk_put(da850_sata_clk);
937 return ret; 1008 return ret;
@@ -939,7 +1010,7 @@ err0:
939 1010
940static void da850_sata_exit(struct device *dev) 1011static void da850_sata_exit(struct device *dev)
941{ 1012{
942 clk_disable(da850_sata_clk); 1013 clk_disable_unprepare(da850_sata_clk);
943 clk_put(da850_sata_clk); 1014 clk_put(da850_sata_clk);
944} 1015}
945 1016
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
index 29b17f7d3a5..773ab07a71a 100644
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ b/arch/arm/mach-davinci/devices-tnetv107x.c
@@ -374,7 +374,7 @@ void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
374 * complete sample conversion in time. 374 * complete sample conversion in time.
375 */ 375 */
376 tsc_clk = clk_get(NULL, "sys_tsc_clk"); 376 tsc_clk = clk_get(NULL, "sys_tsc_clk");
377 if (tsc_clk) { 377 if (!IS_ERR(tsc_clk)) {
378 error = clk_set_rate(tsc_clk, 5000000); 378 error = clk_set_rate(tsc_clk, 5000000);
379 WARN_ON(error < 0); 379 WARN_ON(error < 0);
380 clk_put(tsc_clk); 380 clk_put(tsc_clk);
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a255434908d..b49c3b77d55 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -758,12 +758,6 @@ static struct map_desc dm355_io_desc[] = {
758 .length = IO_SIZE, 758 .length = IO_SIZE,
759 .type = MT_DEVICE 759 .type = MT_DEVICE
760 }, 760 },
761 {
762 .virtual = SRAM_VIRT,
763 .pfn = __phys_to_pfn(0x00010000),
764 .length = SZ_32K,
765 .type = MT_MEMORY_NONCACHED,
766 },
767}; 761};
768 762
769/* Contents of JTAG ID register used to identify exact cpu type */ 763/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index b680c832e0b..6c3980540be 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -985,12 +985,6 @@ static struct map_desc dm365_io_desc[] = {
985 .length = IO_SIZE, 985 .length = IO_SIZE,
986 .type = MT_DEVICE 986 .type = MT_DEVICE
987 }, 987 },
988 {
989 .virtual = SRAM_VIRT,
990 .pfn = __phys_to_pfn(0x00010000),
991 .length = SZ_32K,
992 .type = MT_MEMORY_NONCACHED,
993 },
994}; 988};
995 989
996static struct resource dm365_ks_resources[] = { 990static struct resource dm365_ks_resources[] = {
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 14e9947bad6..11c79a3362e 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -785,12 +785,6 @@ static struct map_desc dm644x_io_desc[] = {
785 .length = IO_SIZE, 785 .length = IO_SIZE,
786 .type = MT_DEVICE 786 .type = MT_DEVICE
787 }, 787 },
788 {
789 .virtual = SRAM_VIRT,
790 .pfn = __phys_to_pfn(0x00008000),
791 .length = SZ_16K,
792 .type = MT_MEMORY_NONCACHED,
793 },
794}; 788};
795 789
796/* Contents of JTAG ID register used to identify exact cpu type */ 790/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 97c0f8e555b..ac7b431c4c8 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -756,12 +756,6 @@ static struct map_desc dm646x_io_desc[] = {
756 .length = IO_SIZE, 756 .length = IO_SIZE,
757 .type = MT_DEVICE 757 .type = MT_DEVICE
758 }, 758 },
759 {
760 .virtual = SRAM_VIRT,
761 .pfn = __phys_to_pfn(0x00010000),
762 .length = SZ_32K,
763 .type = MT_MEMORY_NONCACHED,
764 },
765}; 759};
766 760
767/* Contents of JTAG ID register used to identify exact cpu type */ 761/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index bdc4aa8e672..046c7238a3d 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -104,8 +104,6 @@ int davinci_pm_init(void);
104static inline int davinci_pm_init(void) { return 0; } 104static inline int davinci_pm_init(void) { return 0; }
105#endif 105#endif
106 106
107/* standard place to map on-chip SRAMs; they *may* support DMA */
108#define SRAM_VIRT 0xfffe0000
109#define SRAM_SIZE SZ_128K 107#define SRAM_SIZE SZ_128K
110 108
111#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */ 109#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index aaccdc4528f..700d311c685 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -26,6 +26,7 @@
26#include <linux/platform_data/mmc-davinci.h> 26#include <linux/platform_data/mmc-davinci.h>
27#include <linux/platform_data/usb-davinci.h> 27#include <linux/platform_data/usb-davinci.h>
28#include <linux/platform_data/spi-davinci.h> 28#include <linux/platform_data/spi-davinci.h>
29#include <linux/platform_data/uio_pruss.h>
29 30
30#include <media/davinci/vpif_types.h> 31#include <media/davinci/vpif_types.h>
31 32
@@ -72,6 +73,7 @@ extern unsigned int da850_max_speed;
72#define DA8XX_AEMIF_CS2_BASE 0x60000000 73#define DA8XX_AEMIF_CS2_BASE 0x60000000
73#define DA8XX_AEMIF_CS3_BASE 0x62000000 74#define DA8XX_AEMIF_CS3_BASE 0x62000000
74#define DA8XX_AEMIF_CTL_BASE 0x68000000 75#define DA8XX_AEMIF_CTL_BASE 0x68000000
76#define DA8XX_SHARED_RAM_BASE 0x80000000
75#define DA8XX_ARM_RAM_BASE 0xffff0000 77#define DA8XX_ARM_RAM_BASE 0xffff0000
76 78
77void __init da830_init(void); 79void __init da830_init(void);
@@ -86,6 +88,7 @@ int da8xx_register_watchdog(void);
86int da8xx_register_usb20(unsigned mA, unsigned potpgt); 88int da8xx_register_usb20(unsigned mA, unsigned potpgt);
87int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); 89int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
88int da8xx_register_emac(void); 90int da8xx_register_emac(void);
91int da8xx_register_uio_pruss(void);
89int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); 92int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
90int da8xx_register_mmcsd0(struct davinci_mmc_config *config); 93int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
91int da850_register_mmcsd1(struct davinci_mmc_config *config); 94int da850_register_mmcsd1(struct davinci_mmc_config *config);
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index 46b3cd11c3c..62ad300440f 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -38,11 +38,12 @@
38 38
39#ifndef __ASSEMBLY__ 39#ifndef __ASSEMBLY__
40struct davinci_uart_config { 40struct davinci_uart_config {
41 /* Bit field of UARTs present; bit 0 --> UART1 */ 41 /* Bit field of UARTs present; bit 0 --> UART0 */
42 unsigned int enabled_uarts; 42 unsigned int enabled_uarts;
43}; 43};
44 44
45extern int davinci_serial_init(struct davinci_uart_config *); 45extern int davinci_serial_init(struct davinci_uart_config *);
46extern int davinci_serial_setup_clk(unsigned instance, unsigned int *rate);
46#endif 47#endif
47 48
48#endif /* __ASM_ARCH_SERIAL_H */ 49#endif /* __ASM_ARCH_SERIAL_H */
diff --git a/arch/arm/mach-davinci/include/mach/sram.h b/arch/arm/mach-davinci/include/mach/sram.h
index 111f7cc71e0..4e5db56218b 100644
--- a/arch/arm/mach-davinci/include/mach/sram.h
+++ b/arch/arm/mach-davinci/include/mach/sram.h
@@ -24,4 +24,7 @@
24extern void *sram_alloc(size_t len, dma_addr_t *dma); 24extern void *sram_alloc(size_t len, dma_addr_t *dma);
25extern void sram_free(void *addr, size_t len); 25extern void sram_free(void *addr, size_t len);
26 26
27/* Get the struct gen_pool * for use in platform data */
28extern struct gen_pool *sram_get_gen_pool(void);
29
27#endif /* __MACH_SRAM_H */ 30#endif /* __MACH_SRAM_H */
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index 18cfd497715..3a0ff905a69 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -32,6 +32,9 @@ u32 *uart;
32/* PORT_16C550A, in polled non-fifo mode */ 32/* PORT_16C550A, in polled non-fifo mode */
33static void putc(char c) 33static void putc(char c)
34{ 34{
35 if (!uart)
36 return;
37
35 while (!(uart[UART_LSR] & UART_LSR_THRE)) 38 while (!(uart[UART_LSR] & UART_LSR_THRE))
36 barrier(); 39 barrier();
37 uart[UART_TX] = c; 40 uart[UART_TX] = c;
@@ -39,6 +42,9 @@ static void putc(char c)
39 42
40static inline void flush(void) 43static inline void flush(void)
41{ 44{
45 if (!uart)
46 return;
47
42 while (!(uart[UART_LSR] & UART_LSR_THRE)) 48 while (!(uart[UART_LSR] & UART_LSR_THRE))
43 barrier(); 49 barrier();
44} 50}
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index 1875740fe27..f2625814c3c 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -70,11 +70,33 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p)
70 UART_DM646X_SCR_TX_WATERMARK); 70 UART_DM646X_SCR_TX_WATERMARK);
71} 71}
72 72
73int __init davinci_serial_init(struct davinci_uart_config *info) 73/* Enable UART clock and obtain its rate */
74int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
74{ 75{
75 int i;
76 char name[16]; 76 char name[16];
77 struct clk *uart_clk; 77 struct clk *clk;
78 struct davinci_soc_info *soc_info = &davinci_soc_info;
79 struct device *dev = &soc_info->serial_dev->dev;
80
81 sprintf(name, "uart%d", instance);
82 clk = clk_get(dev, name);
83 if (IS_ERR(clk)) {
84 pr_err("%s:%d: failed to get UART%d clock\n",
85 __func__, __LINE__, instance);
86 return PTR_ERR(clk);
87 }
88
89 clk_prepare_enable(clk);
90
91 if (rate)
92 *rate = clk_get_rate(clk);
93
94 return 0;
95}
96
97int __init davinci_serial_init(struct davinci_uart_config *info)
98{
99 int i, ret;
78 struct davinci_soc_info *soc_info = &davinci_soc_info; 100 struct davinci_soc_info *soc_info = &davinci_soc_info;
79 struct device *dev = &soc_info->serial_dev->dev; 101 struct device *dev = &soc_info->serial_dev->dev;
80 struct plat_serial8250_port *p = dev->platform_data; 102 struct plat_serial8250_port *p = dev->platform_data;
@@ -87,16 +109,9 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
87 if (!(info->enabled_uarts & (1 << i))) 109 if (!(info->enabled_uarts & (1 << i)))
88 continue; 110 continue;
89 111
90 sprintf(name, "uart%d", i); 112 ret = davinci_serial_setup_clk(i, &p->uartclk);
91 uart_clk = clk_get(dev, name); 113 if (ret)
92 if (IS_ERR(uart_clk)) {
93 printk(KERN_ERR "%s:%d: failed to get UART%d clock\n",
94 __func__, __LINE__, i);
95 continue; 114 continue;
96 }
97
98 clk_enable(uart_clk);
99 p->uartclk = clk_get_rate(uart_clk);
100 115
101 if (!p->membase && p->mapbase) { 116 if (!p->membase && p->mapbase) {
102 p->membase = ioremap(p->mapbase, SZ_4K); 117 p->membase = ioremap(p->mapbase, SZ_4K);
diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index db0f7787faf..c5f7ee5cc80 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/io.h>
13#include <linux/genalloc.h> 14#include <linux/genalloc.h>
14 15
15#include <mach/common.h> 16#include <mach/common.h>
@@ -17,6 +18,11 @@
17 18
18static struct gen_pool *sram_pool; 19static struct gen_pool *sram_pool;
19 20
21struct gen_pool *sram_get_gen_pool(void)
22{
23 return sram_pool;
24}
25
20void *sram_alloc(size_t len, dma_addr_t *dma) 26void *sram_alloc(size_t len, dma_addr_t *dma)
21{ 27{
22 unsigned long vaddr; 28 unsigned long vaddr;
@@ -32,7 +38,7 @@ void *sram_alloc(size_t len, dma_addr_t *dma)
32 return NULL; 38 return NULL;
33 39
34 if (dma) 40 if (dma)
35 *dma = dma_base + (vaddr - SRAM_VIRT); 41 *dma = gen_pool_virt_to_phys(sram_pool, vaddr);
36 return (void *)vaddr; 42 return (void *)vaddr;
37 43
38} 44}
@@ -53,8 +59,10 @@ EXPORT_SYMBOL(sram_free);
53 */ 59 */
54static int __init sram_init(void) 60static int __init sram_init(void)
55{ 61{
62 phys_addr_t phys = davinci_soc_info.sram_dma;
56 unsigned len = davinci_soc_info.sram_len; 63 unsigned len = davinci_soc_info.sram_len;
57 int status = 0; 64 int status = 0;
65 void *addr;
58 66
59 if (len) { 67 if (len) {
60 len = min_t(unsigned, len, SRAM_SIZE); 68 len = min_t(unsigned, len, SRAM_SIZE);
@@ -62,8 +70,17 @@ static int __init sram_init(void)
62 if (!sram_pool) 70 if (!sram_pool)
63 status = -ENOMEM; 71 status = -ENOMEM;
64 } 72 }
65 if (sram_pool) 73
66 status = gen_pool_add(sram_pool, SRAM_VIRT, len, -1); 74 if (sram_pool) {
75 addr = ioremap(phys, len);
76 if (!addr)
77 return -ENOMEM;
78 status = gen_pool_add_virt(sram_pool, (unsigned)addr,
79 phys, len, -1);
80 if (status < 0)
81 iounmap(addr);
82 }
83
67 WARN_ON(status < 0); 84 WARN_ON(status < 0);
68 return status; 85 return status;
69} 86}
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 75da315b658..9847938785c 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -379,7 +379,7 @@ static void __init davinci_timer_init(void)
379 379
380 timer_clk = clk_get(NULL, "timer0"); 380 timer_clk = clk_get(NULL, "timer0");
381 BUG_ON(IS_ERR(timer_clk)); 381 BUG_ON(IS_ERR(timer_clk));
382 clk_enable(timer_clk); 382 clk_prepare_enable(timer_clk);
383 383
384 /* init timer hw */ 384 /* init timer hw */
385 timer_init(); 385 timer_init();
@@ -429,7 +429,7 @@ void davinci_watchdog_reset(struct platform_device *pdev)
429 wd_clk = clk_get(&pdev->dev, NULL); 429 wd_clk = clk_get(&pdev->dev, NULL);
430 if (WARN_ON(IS_ERR(wd_clk))) 430 if (WARN_ON(IS_ERR(wd_clk)))
431 return; 431 return;
432 clk_enable(wd_clk); 432 clk_prepare_enable(wd_clk);
433 433
434 /* disable, internal clock source */ 434 /* disable, internal clock source */
435 __raw_writel(0, base + TCR); 435 __raw_writel(0, base + TCR);
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index f77b95336e2..34509ffba22 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -42,14 +42,8 @@ static struct musb_hdrc_config musb_config = {
42}; 42};
43 43
44static struct musb_hdrc_platform_data usb_data = { 44static struct musb_hdrc_platform_data usb_data = {
45#if defined(CONFIG_USB_MUSB_OTG)
46 /* OTG requires a Mini-AB connector */ 45 /* OTG requires a Mini-AB connector */
47 .mode = MUSB_OTG, 46 .mode = MUSB_OTG,
48#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
49 .mode = MUSB_PERIPHERAL,
50#elif defined(CONFIG_USB_MUSB_HOST)
51 .mode = MUSB_HOST,
52#endif
53 .clock = "usb", 47 .clock = "usb",
54 .config = &musb_config, 48 .config = &musb_config,
55}; 49};
diff --git a/arch/arm/mach-dove/include/mach/pm.h b/arch/arm/mach-dove/include/mach/pm.h
index 7bcd0dfce4b..b47f7503868 100644
--- a/arch/arm/mach-dove/include/mach/pm.h
+++ b/arch/arm/mach-dove/include/mach/pm.h
@@ -63,7 +63,7 @@ static inline int pmu_to_irq(int pin)
63 63
64static inline int irq_to_pmu(int irq) 64static inline int irq_to_pmu(int irq)
65{ 65{
66 if (IRQ_DOVE_PMU_START < irq && irq < NR_IRQS) 66 if (IRQ_DOVE_PMU_START <= irq && irq < NR_IRQS)
67 return irq - IRQ_DOVE_PMU_START; 67 return irq - IRQ_DOVE_PMU_START;
68 68
69 return -EINVAL; 69 return -EINVAL;
diff --git a/arch/arm/mach-dove/irq.c b/arch/arm/mach-dove/irq.c
index 087711524e8..bc4344aa100 100644
--- a/arch/arm/mach-dove/irq.c
+++ b/arch/arm/mach-dove/irq.c
@@ -46,8 +46,20 @@ static void pmu_irq_ack(struct irq_data *d)
46 int pin = irq_to_pmu(d->irq); 46 int pin = irq_to_pmu(d->irq);
47 u32 u; 47 u32 u;
48 48
49 /*
50 * The PMU mask register is not RW0C: it is RW. This means that
51 * the bits take whatever value is written to them; if you write
52 * a '1', you will set the interrupt.
53 *
54 * Unfortunately this means there is NO race free way to clear
55 * these interrupts.
56 *
57 * So, let's structure the code so that the window is as small as
58 * possible.
59 */
49 u = ~(1 << (pin & 31)); 60 u = ~(1 << (pin & 31));
50 writel(u, PMU_INTERRUPT_CAUSE); 61 u &= readl_relaxed(PMU_INTERRUPT_CAUSE);
62 writel_relaxed(u, PMU_INTERRUPT_CAUSE);
51} 63}
52 64
53static struct irq_chip pmu_irq_chip = { 65static struct irq_chip pmu_irq_chip = {
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index da55107033d..91d5b6f1d5a 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -63,10 +63,20 @@ config SOC_EXYNOS5250
63 depends on ARCH_EXYNOS5 63 depends on ARCH_EXYNOS5
64 select S5P_PM if PM 64 select S5P_PM if PM
65 select S5P_SLEEP if PM 65 select S5P_SLEEP if PM
66 select S5P_DEV_MFC
66 select SAMSUNG_DMADEV 67 select SAMSUNG_DMADEV
67 help 68 help
68 Enable EXYNOS5250 SoC support 69 Enable EXYNOS5250 SoC support
69 70
71config SOC_EXYNOS5440
72 bool "SAMSUNG EXYNOS5440"
73 default y
74 depends on ARCH_EXYNOS5
75 select ARM_ARCH_TIMER
76 select AUTO_ZRELADDR
77 help
78 Enable EXYNOS5440 SoC support
79
70config EXYNOS4_MCT 80config EXYNOS4_MCT
71 bool 81 bool
72 default y 82 default y
@@ -98,11 +108,6 @@ config EXYNOS_DEV_SYSMMU
98 help 108 help
99 Common setup code for SYSTEM MMU in EXYNOS platforms 109 Common setup code for SYSTEM MMU in EXYNOS platforms
100 110
101config EXYNOS4_DEV_DWMCI
102 bool
103 help
104 Compile in platform device definitions for DWMCI
105
106config EXYNOS4_DEV_USB_OHCI 111config EXYNOS4_DEV_USB_OHCI
107 bool 112 bool
108 help 113 help
@@ -417,9 +422,9 @@ config MACH_EXYNOS4_DT
417 422
418config MACH_EXYNOS5_DT 423config MACH_EXYNOS5_DT
419 bool "SAMSUNG EXYNOS5 Machine using device tree" 424 bool "SAMSUNG EXYNOS5 Machine using device tree"
425 default y
420 depends on ARCH_EXYNOS5 426 depends on ARCH_EXYNOS5
421 select ARM_AMBA 427 select ARM_AMBA
422 select SOC_EXYNOS5250
423 select USE_OF 428 select USE_OF
424 help 429 help
425 Machine support for Samsung EXYNOS5 machine with device tree enabled. 430 Machine support for Samsung EXYNOS5 machine with device tree enabled.
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 9b58024f7d4..b189881657e 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -14,9 +14,9 @@ obj- :=
14 14
15obj-$(CONFIG_ARCH_EXYNOS) += common.o 15obj-$(CONFIG_ARCH_EXYNOS) += common.o
16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o 16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o
17obj-$(CONFIG_ARCH_EXYNOS5) += clock-exynos5.o
18obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o 17obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o
19obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o 18obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o
19obj-$(CONFIG_SOC_EXYNOS5250) += clock-exynos5.o
20 20
21obj-$(CONFIG_PM) += pm.o 21obj-$(CONFIG_PM) += pm.o
22obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o 22obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
@@ -50,10 +50,8 @@ obj-$(CONFIG_MACH_EXYNOS5_DT) += mach-exynos5-dt.o
50obj-y += dev-uart.o 50obj-y += dev-uart.o
51obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o 51obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o
52obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o 52obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o
53obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o
54obj-$(CONFIG_EXYNOS_DEV_DMA) += dma.o 53obj-$(CONFIG_EXYNOS_DEV_DMA) += dma.o
55obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o 54obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o
56obj-$(CONFIG_EXYNOS_DEV_DRM) += dev-drm.o
57obj-$(CONFIG_EXYNOS_DEV_SYSMMU) += dev-sysmmu.o 55obj-$(CONFIG_EXYNOS_DEV_SYSMMU) += dev-sysmmu.o
58 56
59obj-$(CONFIG_ARCH_EXYNOS) += setup-i2c0.o 57obj-$(CONFIG_ARCH_EXYNOS) += setup-i2c0.o
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
index 6a45c9a9abe..efead60b943 100644
--- a/arch/arm/mach-exynos/clock-exynos4.c
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -576,6 +576,10 @@ static struct clk exynos4_init_clocks_off[] = {
576 .enable = exynos4_clk_ip_peril_ctrl, 576 .enable = exynos4_clk_ip_peril_ctrl,
577 .ctrlbit = (1 << 15), 577 .ctrlbit = (1 << 15),
578 }, { 578 }, {
579 .name = "tmu_apbif",
580 .enable = exynos4_clk_ip_perir_ctrl,
581 .ctrlbit = (1 << 17),
582 }, {
579 .name = "keypad", 583 .name = "keypad",
580 .enable = exynos4_clk_ip_perir_ctrl, 584 .enable = exynos4_clk_ip_perir_ctrl,
581 .ctrlbit = (1 << 16), 585 .ctrlbit = (1 << 16),
@@ -613,11 +617,6 @@ static struct clk exynos4_init_clocks_off[] = {
613 .ctrlbit = (1 << 18), 617 .ctrlbit = (1 << 18),
614 }, { 618 }, {
615 .name = "iis", 619 .name = "iis",
616 .devname = "samsung-i2s.0",
617 .enable = exynos4_clk_ip_peril_ctrl,
618 .ctrlbit = (1 << 19),
619 }, {
620 .name = "iis",
621 .devname = "samsung-i2s.1", 620 .devname = "samsung-i2s.1",
622 .enable = exynos4_clk_ip_peril_ctrl, 621 .enable = exynos4_clk_ip_peril_ctrl,
623 .ctrlbit = (1 << 20), 622 .ctrlbit = (1 << 20),
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c
index c44ca1ee1b8..7652f5d78a5 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -196,6 +196,11 @@ static int exynos5_clk_ip_isp1_ctrl(struct clk *clk, int enable)
196 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP1, clk, enable); 196 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP1, clk, enable);
197} 197}
198 198
199static int exynos5_clk_hdmiphy_ctrl(struct clk *clk, int enable)
200{
201 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
202}
203
199/* Core list of CMU_CPU side */ 204/* Core list of CMU_CPU side */
200 205
201static struct clksrc_clk exynos5_clk_mout_apll = { 206static struct clksrc_clk exynos5_clk_mout_apll = {
@@ -292,7 +297,7 @@ static struct clksrc_sources exynos5_clk_src_mpll = {
292 .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_list), 297 .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_list),
293}; 298};
294 299
295struct clksrc_clk exynos5_clk_mout_mpll = { 300static struct clksrc_clk exynos5_clk_mout_mpll = {
296 .clk = { 301 .clk = {
297 .name = "mout_mpll", 302 .name = "mout_mpll",
298 }, 303 },
@@ -467,12 +472,12 @@ static struct clksrc_clk exynos5_clk_pclk_acp = {
467 472
468/* Core list of CMU_TOP side */ 473/* Core list of CMU_TOP side */
469 474
470struct clk *exynos5_clkset_aclk_top_list[] = { 475static struct clk *exynos5_clkset_aclk_top_list[] = {
471 [0] = &exynos5_clk_mout_mpll_user.clk, 476 [0] = &exynos5_clk_mout_mpll_user.clk,
472 [1] = &exynos5_clk_mout_bpll_user.clk, 477 [1] = &exynos5_clk_mout_bpll_user.clk,
473}; 478};
474 479
475struct clksrc_sources exynos5_clkset_aclk = { 480static struct clksrc_sources exynos5_clkset_aclk = {
476 .sources = exynos5_clkset_aclk_top_list, 481 .sources = exynos5_clkset_aclk_top_list,
477 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_top_list), 482 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_top_list),
478}; 483};
@@ -486,12 +491,12 @@ static struct clksrc_clk exynos5_clk_aclk_400 = {
486 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 }, 491 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 },
487}; 492};
488 493
489struct clk *exynos5_clkset_aclk_333_166_list[] = { 494static struct clk *exynos5_clkset_aclk_333_166_list[] = {
490 [0] = &exynos5_clk_mout_cpll.clk, 495 [0] = &exynos5_clk_mout_cpll.clk,
491 [1] = &exynos5_clk_mout_mpll_user.clk, 496 [1] = &exynos5_clk_mout_mpll_user.clk,
492}; 497};
493 498
494struct clksrc_sources exynos5_clkset_aclk_333_166 = { 499static struct clksrc_sources exynos5_clkset_aclk_333_166 = {
495 .sources = exynos5_clkset_aclk_333_166_list, 500 .sources = exynos5_clkset_aclk_333_166_list,
496 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_333_166_list), 501 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_333_166_list),
497}; 502};
@@ -616,6 +621,11 @@ static struct clk exynos5_init_clocks_off[] = {
616 .enable = exynos5_clk_ip_peric_ctrl, 621 .enable = exynos5_clk_ip_peric_ctrl,
617 .ctrlbit = (1 << 24), 622 .ctrlbit = (1 << 24),
618 }, { 623 }, {
624 .name = "tmu_apbif",
625 .parent = &exynos5_clk_aclk_66.clk,
626 .enable = exynos5_clk_ip_peris_ctrl,
627 .ctrlbit = (1 << 21),
628 }, {
619 .name = "rtc", 629 .name = "rtc",
620 .parent = &exynos5_clk_aclk_66.clk, 630 .parent = &exynos5_clk_aclk_66.clk,
621 .enable = exynos5_clk_ip_peris_ctrl, 631 .enable = exynos5_clk_ip_peris_ctrl,
@@ -664,17 +674,22 @@ static struct clk exynos5_init_clocks_off[] = {
664 .ctrlbit = (1 << 25), 674 .ctrlbit = (1 << 25),
665 }, { 675 }, {
666 .name = "mfc", 676 .name = "mfc",
667 .devname = "s5p-mfc", 677 .devname = "s5p-mfc-v6",
668 .enable = exynos5_clk_ip_mfc_ctrl, 678 .enable = exynos5_clk_ip_mfc_ctrl,
669 .ctrlbit = (1 << 0), 679 .ctrlbit = (1 << 0),
670 }, { 680 }, {
671 .name = "hdmi", 681 .name = "hdmi",
672 .devname = "exynos4-hdmi", 682 .devname = "exynos5-hdmi",
673 .enable = exynos5_clk_ip_disp1_ctrl, 683 .enable = exynos5_clk_ip_disp1_ctrl,
674 .ctrlbit = (1 << 6), 684 .ctrlbit = (1 << 6),
675 }, { 685 }, {
686 .name = "hdmiphy",
687 .devname = "exynos5-hdmi",
688 .enable = exynos5_clk_hdmiphy_ctrl,
689 .ctrlbit = (1 << 0),
690 }, {
676 .name = "mixer", 691 .name = "mixer",
677 .devname = "s5p-mixer", 692 .devname = "exynos5-mixer",
678 .enable = exynos5_clk_ip_disp1_ctrl, 693 .enable = exynos5_clk_ip_disp1_ctrl,
679 .ctrlbit = (1 << 5), 694 .ctrlbit = (1 << 5),
680 }, { 695 }, {
@@ -966,7 +981,7 @@ static struct clk exynos5_clk_fimd1 = {
966 .ctrlbit = (1 << 0), 981 .ctrlbit = (1 << 0),
967}; 982};
968 983
969struct clk *exynos5_clkset_group_list[] = { 984static struct clk *exynos5_clkset_group_list[] = {
970 [0] = &clk_ext_xtal_mux, 985 [0] = &clk_ext_xtal_mux,
971 [1] = NULL, 986 [1] = NULL,
972 [2] = &exynos5_clk_sclk_hdmi24m, 987 [2] = &exynos5_clk_sclk_hdmi24m,
@@ -979,7 +994,7 @@ struct clk *exynos5_clkset_group_list[] = {
979 [9] = &exynos5_clk_mout_cpll.clk, 994 [9] = &exynos5_clk_mout_cpll.clk,
980}; 995};
981 996
982struct clksrc_sources exynos5_clkset_group = { 997static struct clksrc_sources exynos5_clkset_group = {
983 .sources = exynos5_clkset_group_list, 998 .sources = exynos5_clkset_group_list,
984 .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list), 999 .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
985}; 1000};
@@ -1195,7 +1210,7 @@ static struct clksrc_clk exynos5_clk_sclk_spi2 = {
1195 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 }, 1210 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 },
1196}; 1211};
1197 1212
1198struct clksrc_clk exynos5_clk_sclk_fimd1 = { 1213static struct clksrc_clk exynos5_clk_sclk_fimd1 = {
1199 .clk = { 1214 .clk = {
1200 .name = "sclk_fimd", 1215 .name = "sclk_fimd",
1201 .devname = "exynos5-fb.1", 1216 .devname = "exynos5-fb.1",
@@ -1476,7 +1491,7 @@ static void exynos5_clock_resume(void)
1476#define exynos5_clock_resume NULL 1491#define exynos5_clock_resume NULL
1477#endif 1492#endif
1478 1493
1479struct syscore_ops exynos5_clock_syscore_ops = { 1494static struct syscore_ops exynos5_clock_syscore_ops = {
1480 .suspend = exynos5_clock_suspend, 1495 .suspend = exynos5_clock_suspend,
1481 .resume = exynos5_clock_resume, 1496 .resume = exynos5_clock_resume,
1482}; 1497};
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 1947be8e5f5..ddd4b72c6f9 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -18,6 +18,7 @@
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/serial_core.h> 19#include <linux/serial_core.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_fdt.h>
21#include <linux/of_irq.h> 22#include <linux/of_irq.h>
22#include <linux/export.h> 23#include <linux/export.h>
23#include <linux/irqdomain.h> 24#include <linux/irqdomain.h>
@@ -58,12 +59,14 @@ static const char name_exynos4210[] = "EXYNOS4210";
58static const char name_exynos4212[] = "EXYNOS4212"; 59static const char name_exynos4212[] = "EXYNOS4212";
59static const char name_exynos4412[] = "EXYNOS4412"; 60static const char name_exynos4412[] = "EXYNOS4412";
60static const char name_exynos5250[] = "EXYNOS5250"; 61static const char name_exynos5250[] = "EXYNOS5250";
62static const char name_exynos5440[] = "EXYNOS5440";
61 63
62static void exynos4_map_io(void); 64static void exynos4_map_io(void);
63static void exynos5_map_io(void); 65static void exynos5_map_io(void);
66static void exynos5440_map_io(void);
64static void exynos4_init_clocks(int xtal); 67static void exynos4_init_clocks(int xtal);
65static void exynos5_init_clocks(int xtal); 68static void exynos5_init_clocks(int xtal);
66static void exynos_init_uarts(struct s3c2410_uartcfg *cfg, int no); 69static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no);
67static int exynos_init(void); 70static int exynos_init(void);
68 71
69static struct cpu_table cpu_ids[] __initdata = { 72static struct cpu_table cpu_ids[] __initdata = {
@@ -72,7 +75,7 @@ static struct cpu_table cpu_ids[] __initdata = {
72 .idmask = EXYNOS4_CPU_MASK, 75 .idmask = EXYNOS4_CPU_MASK,
73 .map_io = exynos4_map_io, 76 .map_io = exynos4_map_io,
74 .init_clocks = exynos4_init_clocks, 77 .init_clocks = exynos4_init_clocks,
75 .init_uarts = exynos_init_uarts, 78 .init_uarts = exynos4_init_uarts,
76 .init = exynos_init, 79 .init = exynos_init,
77 .name = name_exynos4210, 80 .name = name_exynos4210,
78 }, { 81 }, {
@@ -80,7 +83,7 @@ static struct cpu_table cpu_ids[] __initdata = {
80 .idmask = EXYNOS4_CPU_MASK, 83 .idmask = EXYNOS4_CPU_MASK,
81 .map_io = exynos4_map_io, 84 .map_io = exynos4_map_io,
82 .init_clocks = exynos4_init_clocks, 85 .init_clocks = exynos4_init_clocks,
83 .init_uarts = exynos_init_uarts, 86 .init_uarts = exynos4_init_uarts,
84 .init = exynos_init, 87 .init = exynos_init,
85 .name = name_exynos4212, 88 .name = name_exynos4212,
86 }, { 89 }, {
@@ -88,7 +91,7 @@ static struct cpu_table cpu_ids[] __initdata = {
88 .idmask = EXYNOS4_CPU_MASK, 91 .idmask = EXYNOS4_CPU_MASK,
89 .map_io = exynos4_map_io, 92 .map_io = exynos4_map_io,
90 .init_clocks = exynos4_init_clocks, 93 .init_clocks = exynos4_init_clocks,
91 .init_uarts = exynos_init_uarts, 94 .init_uarts = exynos4_init_uarts,
92 .init = exynos_init, 95 .init = exynos_init,
93 .name = name_exynos4412, 96 .name = name_exynos4412,
94 }, { 97 }, {
@@ -96,9 +99,14 @@ static struct cpu_table cpu_ids[] __initdata = {
96 .idmask = EXYNOS5_SOC_MASK, 99 .idmask = EXYNOS5_SOC_MASK,
97 .map_io = exynos5_map_io, 100 .map_io = exynos5_map_io,
98 .init_clocks = exynos5_init_clocks, 101 .init_clocks = exynos5_init_clocks,
99 .init_uarts = exynos_init_uarts,
100 .init = exynos_init, 102 .init = exynos_init,
101 .name = name_exynos5250, 103 .name = name_exynos5250,
104 }, {
105 .idcode = EXYNOS5440_SOC_ID,
106 .idmask = EXYNOS5_SOC_MASK,
107 .map_io = exynos5440_map_io,
108 .init = exynos_init,
109 .name = name_exynos5440,
102 }, 110 },
103}; 111};
104 112
@@ -113,6 +121,17 @@ static struct map_desc exynos_iodesc[] __initdata = {
113 }, 121 },
114}; 122};
115 123
124#ifdef CONFIG_ARCH_EXYNOS5
125static struct map_desc exynos5440_iodesc[] __initdata = {
126 {
127 .virtual = (unsigned long)S5P_VA_CHIPID,
128 .pfn = __phys_to_pfn(EXYNOS5440_PA_CHIPID),
129 .length = SZ_4K,
130 .type = MT_DEVICE,
131 },
132};
133#endif
134
116static struct map_desc exynos4_iodesc[] __initdata = { 135static struct map_desc exynos4_iodesc[] __initdata = {
117 { 136 {
118 .virtual = (unsigned long)S3C_VA_SYS, 137 .virtual = (unsigned long)S3C_VA_SYS,
@@ -257,24 +276,18 @@ static struct map_desc exynos5_iodesc[] __initdata = {
257 .length = SZ_64K, 276 .length = SZ_64K,
258 .type = MT_DEVICE, 277 .type = MT_DEVICE,
259 }, { 278 }, {
260 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
261 .pfn = __phys_to_pfn(EXYNOS5_PA_COMBINER),
262 .length = SZ_4K,
263 .type = MT_DEVICE,
264 }, {
265 .virtual = (unsigned long)S3C_VA_UART, 279 .virtual = (unsigned long)S3C_VA_UART,
266 .pfn = __phys_to_pfn(EXYNOS5_PA_UART), 280 .pfn = __phys_to_pfn(EXYNOS5_PA_UART),
267 .length = SZ_512K, 281 .length = SZ_512K,
268 .type = MT_DEVICE, 282 .type = MT_DEVICE,
269 }, { 283 },
270 .virtual = (unsigned long)S5P_VA_GIC_CPU, 284};
271 .pfn = __phys_to_pfn(EXYNOS5_PA_GIC_CPU), 285
272 .length = SZ_8K, 286static struct map_desc exynos5440_iodesc0[] __initdata = {
273 .type = MT_DEVICE, 287 {
274 }, { 288 .virtual = (unsigned long)S3C_VA_UART,
275 .virtual = (unsigned long)S5P_VA_GIC_DIST, 289 .pfn = __phys_to_pfn(EXYNOS5440_PA_UART0),
276 .pfn = __phys_to_pfn(EXYNOS5_PA_GIC_DIST), 290 .length = SZ_512K,
277 .length = SZ_4K,
278 .type = MT_DEVICE, 291 .type = MT_DEVICE,
279 }, 292 },
280}; 293};
@@ -286,11 +299,29 @@ void exynos4_restart(char mode, const char *cmd)
286 299
287void exynos5_restart(char mode, const char *cmd) 300void exynos5_restart(char mode, const char *cmd)
288{ 301{
289 __raw_writel(0x1, EXYNOS_SWRESET); 302 u32 val;
303 void __iomem *addr;
304
305 if (of_machine_is_compatible("samsung,exynos5250")) {
306 val = 0x1;
307 addr = EXYNOS_SWRESET;
308 } else if (of_machine_is_compatible("samsung,exynos5440")) {
309 val = (0x10 << 20) | (0x1 << 16);
310 addr = EXYNOS5440_SWRESET;
311 } else {
312 pr_err("%s: cannot support non-DT\n", __func__);
313 return;
314 }
315
316 __raw_writel(val, addr);
290} 317}
291 318
292void __init exynos_init_late(void) 319void __init exynos_init_late(void)
293{ 320{
321 if (of_machine_is_compatible("samsung,exynos5440"))
322 /* to be supported later */
323 return;
324
294 exynos_pm_late_initcall(); 325 exynos_pm_late_initcall();
295} 326}
296 327
@@ -302,8 +333,20 @@ void __init exynos_init_late(void)
302 333
303void __init exynos_init_io(struct map_desc *mach_desc, int size) 334void __init exynos_init_io(struct map_desc *mach_desc, int size)
304{ 335{
336 struct map_desc *iodesc = exynos_iodesc;
337 int iodesc_sz = ARRAY_SIZE(exynos_iodesc);
338#if defined(CONFIG_OF) && defined(CONFIG_ARCH_EXYNOS5)
339 unsigned long root = of_get_flat_dt_root();
340
305 /* initialize the io descriptors we need for initialization */ 341 /* initialize the io descriptors we need for initialization */
306 iotable_init(exynos_iodesc, ARRAY_SIZE(exynos_iodesc)); 342 if (of_flat_dt_is_compatible(root, "samsung,exynos5440")) {
343 iodesc = exynos5440_iodesc;
344 iodesc_sz = ARRAY_SIZE(exynos5440_iodesc);
345 }
346#endif
347
348 iotable_init(iodesc, iodesc_sz);
349
307 if (mach_desc) 350 if (mach_desc)
308 iotable_init(mach_desc, size); 351 iotable_init(mach_desc, size);
309 352
@@ -354,23 +397,6 @@ static void __init exynos4_map_io(void)
354static void __init exynos5_map_io(void) 397static void __init exynos5_map_io(void)
355{ 398{
356 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); 399 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
357
358 s3c_device_i2c0.resource[0].start = EXYNOS5_PA_IIC(0);
359 s3c_device_i2c0.resource[0].end = EXYNOS5_PA_IIC(0) + SZ_4K - 1;
360 s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC;
361 s3c_device_i2c0.resource[1].end = EXYNOS5_IRQ_IIC;
362
363 s3c_sdhci_setname(0, "exynos4-sdhci");
364 s3c_sdhci_setname(1, "exynos4-sdhci");
365 s3c_sdhci_setname(2, "exynos4-sdhci");
366 s3c_sdhci_setname(3, "exynos4-sdhci");
367
368 /* The I2C bus controllers are directly compatible with s3c2440 */
369 s3c_i2c0_setname("s3c2440-i2c");
370 s3c_i2c1_setname("s3c2440-i2c");
371 s3c_i2c2_setname("s3c2440-i2c");
372
373 s3c64xx_spi_setname("exynos4210-spi");
374} 400}
375 401
376static void __init exynos4_init_clocks(int xtal) 402static void __init exynos4_init_clocks(int xtal)
@@ -389,6 +415,11 @@ static void __init exynos4_init_clocks(int xtal)
389 exynos4_setup_clocks(); 415 exynos4_setup_clocks();
390} 416}
391 417
418static void __init exynos5440_map_io(void)
419{
420 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0));
421}
422
392static void __init exynos5_init_clocks(int xtal) 423static void __init exynos5_init_clocks(int xtal)
393{ 424{
394 printk(KERN_DEBUG "%s: initializing clocks\n", __func__); 425 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
@@ -589,7 +620,8 @@ static void __init combiner_init(void __iomem *combiner_base,
589} 620}
590 621
591#ifdef CONFIG_OF 622#ifdef CONFIG_OF
592int __init combiner_of_init(struct device_node *np, struct device_node *parent) 623static int __init combiner_of_init(struct device_node *np,
624 struct device_node *parent)
593{ 625{
594 void __iomem *combiner_base; 626 void __iomem *combiner_base;
595 627
@@ -604,8 +636,9 @@ int __init combiner_of_init(struct device_node *np, struct device_node *parent)
604 return 0; 636 return 0;
605} 637}
606 638
607static const struct of_device_id exynos4_dt_irq_match[] = { 639static const struct of_device_id exynos_dt_irq_match[] = {
608 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, }, 640 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
641 { .compatible = "arm,cortex-a15-gic", .data = gic_of_init, },
609 { .compatible = "samsung,exynos4210-combiner", 642 { .compatible = "samsung,exynos4210-combiner",
610 .data = combiner_of_init, }, 643 .data = combiner_of_init, },
611 {}, 644 {},
@@ -622,7 +655,7 @@ void __init exynos4_init_irq(void)
622 gic_init_bases(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU, gic_bank_offset, NULL); 655 gic_init_bases(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU, gic_bank_offset, NULL);
623#ifdef CONFIG_OF 656#ifdef CONFIG_OF
624 else 657 else
625 of_irq_init(exynos4_dt_irq_match); 658 of_irq_init(exynos_dt_irq_match);
626#endif 659#endif
627 660
628 if (!of_have_populated_dt()) 661 if (!of_have_populated_dt())
@@ -639,7 +672,7 @@ void __init exynos4_init_irq(void)
639void __init exynos5_init_irq(void) 672void __init exynos5_init_irq(void)
640{ 673{
641#ifdef CONFIG_OF 674#ifdef CONFIG_OF
642 of_irq_init(exynos4_dt_irq_match); 675 of_irq_init(exynos_dt_irq_match);
643#endif 676#endif
644 /* 677 /*
645 * The parameters of s5p_init_irq() are for VIC init. 678 * The parameters of s5p_init_irq() are for VIC init.
@@ -647,6 +680,8 @@ void __init exynos5_init_irq(void)
647 * uses GIC instead of VIC. 680 * uses GIC instead of VIC.
648 */ 681 */
649 s5p_init_irq(NULL, 0); 682 s5p_init_irq(NULL, 0);
683
684 gic_arch_extn.irq_set_wake = s3c_irq_wake;
650} 685}
651 686
652struct bus_type exynos_subsys = { 687struct bus_type exynos_subsys = {
@@ -669,7 +704,7 @@ static int __init exynos4_l2x0_cache_init(void)
669{ 704{
670 int ret; 705 int ret;
671 706
672 if (soc_is_exynos5250()) 707 if (soc_is_exynos5250() || soc_is_exynos5440())
673 return 0; 708 return 0;
674 709
675 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK); 710 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
@@ -727,7 +762,7 @@ static int __init exynos_init(void)
727 762
728/* uart registration process */ 763/* uart registration process */
729 764
730static void __init exynos_init_uarts(struct s3c2410_uartcfg *cfg, int no) 765static void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no)
731{ 766{
732 struct s3c2410_uartcfg *tcfg = cfg; 767 struct s3c2410_uartcfg *tcfg = cfg;
733 u32 ucnt; 768 u32 ucnt;
@@ -735,10 +770,7 @@ static void __init exynos_init_uarts(struct s3c2410_uartcfg *cfg, int no)
735 for (ucnt = 0; ucnt < no; ucnt++, tcfg++) 770 for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
736 tcfg->has_fracval = 1; 771 tcfg->has_fracval = 1;
737 772
738 if (soc_is_exynos5250()) 773 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
739 s3c24xx_init_uartdevs("exynos4210-uart", exynos5_uart_resources, cfg, no);
740 else
741 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
742} 774}
743 775
744static void __iomem *exynos_eint_base; 776static void __iomem *exynos_eint_base;
@@ -970,14 +1002,7 @@ static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
970 struct irq_chip *chip = irq_get_chip(irq); 1002 struct irq_chip *chip = irq_get_chip(irq);
971 1003
972 chained_irq_enter(chip, desc); 1004 chained_irq_enter(chip, desc);
973 chip->irq_mask(&desc->irq_data);
974
975 if (chip->irq_ack)
976 chip->irq_ack(&desc->irq_data);
977
978 generic_handle_irq(*irq_data); 1005 generic_handle_irq(*irq_data);
979
980 chip->irq_unmask(&desc->irq_data);
981 chained_irq_exit(chip, desc); 1006 chained_irq_exit(chip, desc);
982} 1007}
983 1008
@@ -997,11 +1022,14 @@ static int __init exynos_init_irq_eint(void)
997 * platforms switch over to using the pinctrl driver, the wakeup 1022 * platforms switch over to using the pinctrl driver, the wakeup
998 * interrupt support code here can be completely removed. 1023 * interrupt support code here can be completely removed.
999 */ 1024 */
1025 static const struct of_device_id exynos_pinctrl_ids[] = {
1026 { .compatible = "samsung,pinctrl-exynos4210", },
1027 { .compatible = "samsung,pinctrl-exynos4x12", },
1028 };
1000 struct device_node *pctrl_np, *wkup_np; 1029 struct device_node *pctrl_np, *wkup_np;
1001 const char *pctrl_compat = "samsung,pinctrl-exynos4210";
1002 const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; 1030 const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
1003 1031
1004 for_each_compatible_node(pctrl_np, NULL, pctrl_compat) { 1032 for_each_matching_node(pctrl_np, exynos_pinctrl_ids) {
1005 if (of_device_is_available(pctrl_np)) { 1033 if (of_device_is_available(pctrl_np)) {
1006 wkup_np = of_find_compatible_node(pctrl_np, NULL, 1034 wkup_np = of_find_compatible_node(pctrl_np, NULL,
1007 wkup_compat); 1035 wkup_compat);
@@ -1010,6 +1038,8 @@ static int __init exynos_init_irq_eint(void)
1010 } 1038 }
1011 } 1039 }
1012#endif 1040#endif
1041 if (soc_is_exynos5440())
1042 return 0;
1013 1043
1014 if (soc_is_exynos5250()) 1044 if (soc_is_exynos5250())
1015 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K); 1045 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index cff0595d0d3..8e4ec21ef2c 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -116,7 +116,8 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
116 cpu_suspend(0, idle_finisher); 116 cpu_suspend(0, idle_finisher);
117 117
118#ifdef CONFIG_SMP 118#ifdef CONFIG_SMP
119 scu_enable(S5P_VA_SCU); 119 if (!soc_is_exynos5250())
120 scu_enable(S5P_VA_SCU);
120#endif 121#endif
121 cpu_pm_exit(); 122 cpu_pm_exit();
122 123
diff --git a/arch/arm/mach-exynos/dev-audio.c b/arch/arm/mach-exynos/dev-audio.c
index ae321c7cb15..a1cb42c3959 100644
--- a/arch/arm/mach-exynos/dev-audio.c
+++ b/arch/arm/mach-exynos/dev-audio.c
@@ -14,9 +14,9 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/platform_data/asoc-s3c.h>
17 18
18#include <plat/gpio-cfg.h> 19#include <plat/gpio-cfg.h>
19#include <linux/platform_data/asoc-s3c.h>
20 20
21#include <mach/map.h> 21#include <mach/map.h>
22#include <mach/dma.h> 22#include <mach/dma.h>
diff --git a/arch/arm/mach-exynos/dev-drm.c b/arch/arm/mach-exynos/dev-drm.c
deleted file mode 100644
index 17c9c6ecc2e..00000000000
--- a/arch/arm/mach-exynos/dev-drm.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos/dev-drm.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * EXYNOS - core DRM device
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/dma-mapping.h>
17#include <linux/platform_device.h>
18
19#include <plat/devs.h>
20
21static u64 exynos_drm_dma_mask = DMA_BIT_MASK(32);
22
23struct platform_device exynos_device_drm = {
24 .name = "exynos-drm",
25 .dev = {
26 .dma_mask = &exynos_drm_dma_mask,
27 .coherent_dma_mask = DMA_BIT_MASK(32),
28 }
29};
diff --git a/arch/arm/mach-exynos/dev-dwmci.c b/arch/arm/mach-exynos/dev-dwmci.c
deleted file mode 100644
index 79035018fb7..00000000000
--- a/arch/arm/mach-exynos/dev-dwmci.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/dev-dwmci.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Platform device for Synopsys DesignWare Mobile Storage IP
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/dma-mapping.h>
17#include <linux/platform_device.h>
18#include <linux/interrupt.h>
19#include <linux/ioport.h>
20#include <linux/mmc/dw_mmc.h>
21
22#include <plat/devs.h>
23
24#include <mach/map.h>
25
26static int exynos4_dwmci_get_bus_wd(u32 slot_id)
27{
28 return 4;
29}
30
31static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data)
32{
33 return 0;
34}
35
36static struct resource exynos4_dwmci_resource[] = {
37 [0] = DEFINE_RES_MEM(EXYNOS4_PA_DWMCI, SZ_4K),
38 [1] = DEFINE_RES_IRQ(EXYNOS4_IRQ_DWMCI),
39};
40
41static struct dw_mci_board exynos4_dwci_pdata = {
42 .num_slots = 1,
43 .quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
44 .bus_hz = 80 * 1000 * 1000,
45 .detect_delay_ms = 200,
46 .init = exynos4_dwmci_init,
47 .get_bus_wd = exynos4_dwmci_get_bus_wd,
48};
49
50static u64 exynos4_dwmci_dmamask = DMA_BIT_MASK(32);
51
52struct platform_device exynos4_device_dwmci = {
53 .name = "dw_mmc",
54 .id = -1,
55 .num_resources = ARRAY_SIZE(exynos4_dwmci_resource),
56 .resource = exynos4_dwmci_resource,
57 .dev = {
58 .dma_mask = &exynos4_dwmci_dmamask,
59 .coherent_dma_mask = DMA_BIT_MASK(32),
60 .platform_data = &exynos4_dwci_pdata,
61 },
62};
63
64void __init exynos4_dwmci_set_platdata(struct dw_mci_board *pd)
65{
66 struct dw_mci_board *npd;
67
68 npd = s3c_set_platdata(pd, sizeof(struct dw_mci_board),
69 &exynos4_device_dwmci);
70
71 if (!npd->init)
72 npd->init = exynos4_dwmci_init;
73 if (!npd->get_bus_wd)
74 npd->get_bus_wd = exynos4_dwmci_get_bus_wd;
75}
diff --git a/arch/arm/mach-exynos/dev-ohci.c b/arch/arm/mach-exynos/dev-ohci.c
index 14ed7951a2c..4244d02dafb 100644
--- a/arch/arm/mach-exynos/dev-ohci.c
+++ b/arch/arm/mach-exynos/dev-ohci.c
@@ -12,10 +12,10 @@
12 12
13#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/platform_data/usb-exynos.h>
15 16
16#include <mach/irqs.h> 17#include <mach/irqs.h>
17#include <mach/map.h> 18#include <mach/map.h>
18#include <linux/platform_data/usb-exynos.h>
19 19
20#include <plat/devs.h> 20#include <plat/devs.h>
21#include <plat/usb-phy.h> 21#include <plat/usb-phy.h>
diff --git a/arch/arm/mach-exynos/dev-uart.c b/arch/arm/mach-exynos/dev-uart.c
index 2e85c022fd1..7c42f4b7c8b 100644
--- a/arch/arm/mach-exynos/dev-uart.c
+++ b/arch/arm/mach-exynos/dev-uart.c
@@ -52,27 +52,3 @@ struct s3c24xx_uart_resources exynos4_uart_resources[] __initdata = {
52 .nr_resources = ARRAY_SIZE(exynos4_uart3_resource), 52 .nr_resources = ARRAY_SIZE(exynos4_uart3_resource),
53 }, 53 },
54}; 54};
55
56EXYNOS_UART_RESOURCE(5, 0)
57EXYNOS_UART_RESOURCE(5, 1)
58EXYNOS_UART_RESOURCE(5, 2)
59EXYNOS_UART_RESOURCE(5, 3)
60
61struct s3c24xx_uart_resources exynos5_uart_resources[] __initdata = {
62 [0] = {
63 .resources = exynos5_uart0_resource,
64 .nr_resources = ARRAY_SIZE(exynos5_uart0_resource),
65 },
66 [1] = {
67 .resources = exynos5_uart1_resource,
68 .nr_resources = ARRAY_SIZE(exynos5_uart0_resource),
69 },
70 [2] = {
71 .resources = exynos5_uart2_resource,
72 .nr_resources = ARRAY_SIZE(exynos5_uart2_resource),
73 },
74 [3] = {
75 .resources = exynos5_uart3_resource,
76 .nr_resources = ARRAY_SIZE(exynos5_uart3_resource),
77 },
78};
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index f4d7dd20cda..c3f825b2794 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -20,10 +20,11 @@
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21 21
22#include <mach/regs-pmu.h> 22#include <mach/regs-pmu.h>
23#include <plat/cpu.h>
23 24
24#include "common.h" 25#include "common.h"
25 26
26static inline void cpu_enter_lowpower(void) 27static inline void cpu_enter_lowpower_a9(void)
27{ 28{
28 unsigned int v; 29 unsigned int v;
29 30
@@ -45,6 +46,35 @@ static inline void cpu_enter_lowpower(void)
45 : "cc"); 46 : "cc");
46} 47}
47 48
49static inline void cpu_enter_lowpower_a15(void)
50{
51 unsigned int v;
52
53 asm volatile(
54 " mrc p15, 0, %0, c1, c0, 0\n"
55 " bic %0, %0, %1\n"
56 " mcr p15, 0, %0, c1, c0, 0\n"
57 : "=&r" (v)
58 : "Ir" (CR_C)
59 : "cc");
60
61 flush_cache_louis();
62
63 asm volatile(
64 /*
65 * Turn off coherency
66 */
67 " mrc p15, 0, %0, c1, c0, 1\n"
68 " bic %0, %0, %1\n"
69 " mcr p15, 0, %0, c1, c0, 1\n"
70 : "=&r" (v)
71 : "Ir" (0x40)
72 : "cc");
73
74 isb();
75 dsb();
76}
77
48static inline void cpu_leave_lowpower(void) 78static inline void cpu_leave_lowpower(void)
49{ 79{
50 unsigned int v; 80 unsigned int v;
@@ -103,11 +133,20 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
103void __ref exynos_cpu_die(unsigned int cpu) 133void __ref exynos_cpu_die(unsigned int cpu)
104{ 134{
105 int spurious = 0; 135 int spurious = 0;
136 int primary_part = 0;
106 137
107 /* 138 /*
108 * we're ready for shutdown now, so do it 139 * we're ready for shutdown now, so do it.
140 * Exynos4 is A9 based while Exynos5 is A15; check the CPU part
141 * number by reading the Main ID register and then perform the
142 * appropriate sequence for entering low power.
109 */ 143 */
110 cpu_enter_lowpower(); 144 asm("mrc p15, 0, %0, c0, c0, 0" : "=r"(primary_part) : : "cc");
145 if ((primary_part & 0xfff0) == 0xc0f0)
146 cpu_enter_lowpower_a15();
147 else
148 cpu_enter_lowpower_a9();
149
111 platform_do_lowpower(cpu, &spurious); 150 platform_do_lowpower(cpu, &spurious);
112 151
113 /* 152 /*
diff --git a/arch/arm/mach-exynos/include/mach/dwmci.h b/arch/arm/mach-exynos/include/mach/dwmci.h
deleted file mode 100644
index 7ce657459cc..00000000000
--- a/arch/arm/mach-exynos/include/mach/dwmci.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* linux/arch/arm/mach-exynos4/include/mach/dwmci.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Synopsys DesignWare Mobile Storage for EXYNOS4210
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_ARM_ARCH_DWMCI_H
14#define __ASM_ARM_ARCH_DWMCI_H __FILE__
15
16#include <linux/mmc/dw_mmc.h>
17
18extern void exynos4_dwmci_set_platdata(struct dw_mci_board *pd);
19
20#endif /* __ASM_ARM_ARCH_DWMCI_H */
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index 35bced6f909..1f4dc35cd4b 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -136,6 +136,9 @@
136#define EXYNOS4_IRQ_TSI IRQ_SPI(115) 136#define EXYNOS4_IRQ_TSI IRQ_SPI(115)
137#define EXYNOS4_IRQ_SATA IRQ_SPI(116) 137#define EXYNOS4_IRQ_SATA IRQ_SPI(116)
138 138
139#define EXYNOS4_IRQ_TMU_TRIG0 COMBINER_IRQ(2, 4)
140#define EXYNOS4_IRQ_TMU_TRIG1 COMBINER_IRQ(3, 4)
141
139#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0) 142#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)
140#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1) 143#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)
141#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2) 144#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)
@@ -259,11 +262,6 @@
259#define EXYNOS5_IRQ_IEM_IEC IRQ_SPI(48) 262#define EXYNOS5_IRQ_IEM_IEC IRQ_SPI(48)
260#define EXYNOS5_IRQ_IEM_APC IRQ_SPI(49) 263#define EXYNOS5_IRQ_IEM_APC IRQ_SPI(49)
261#define EXYNOS5_IRQ_GPIO_C2C IRQ_SPI(50) 264#define EXYNOS5_IRQ_GPIO_C2C IRQ_SPI(50)
262#define EXYNOS5_IRQ_UART0 IRQ_SPI(51)
263#define EXYNOS5_IRQ_UART1 IRQ_SPI(52)
264#define EXYNOS5_IRQ_UART2 IRQ_SPI(53)
265#define EXYNOS5_IRQ_UART3 IRQ_SPI(54)
266#define EXYNOS5_IRQ_UART4 IRQ_SPI(55)
267#define EXYNOS5_IRQ_IIC IRQ_SPI(56) 265#define EXYNOS5_IRQ_IIC IRQ_SPI(56)
268#define EXYNOS5_IRQ_IIC1 IRQ_SPI(57) 266#define EXYNOS5_IRQ_IIC1 IRQ_SPI(57)
269#define EXYNOS5_IRQ_IIC2 IRQ_SPI(58) 267#define EXYNOS5_IRQ_IIC2 IRQ_SPI(58)
@@ -333,6 +331,11 @@
333#define EXYNOS5_IRQ_FIMC_LITE1 IRQ_SPI(126) 331#define EXYNOS5_IRQ_FIMC_LITE1 IRQ_SPI(126)
334#define EXYNOS5_IRQ_RP_TIMER IRQ_SPI(127) 332#define EXYNOS5_IRQ_RP_TIMER IRQ_SPI(127)
335 333
334/* EXYNOS5440 */
335
336#define EXYNOS5440_IRQ_UART0 IRQ_SPI(2)
337#define EXYNOS5440_IRQ_UART1 IRQ_SPI(3)
338
336#define EXYNOS5_IRQ_PMU COMBINER_IRQ(1, 2) 339#define EXYNOS5_IRQ_PMU COMBINER_IRQ(1, 2)
337 340
338#define EXYNOS5_IRQ_SYSMMU_GSC0_0 COMBINER_IRQ(2, 0) 341#define EXYNOS5_IRQ_SYSMMU_GSC0_0 COMBINER_IRQ(2, 0)
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index ed4da4544cd..1df6abbf53b 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -53,6 +53,7 @@
53#define EXYNOS4_PA_ONENAND_DMA 0x0C600000 53#define EXYNOS4_PA_ONENAND_DMA 0x0C600000
54 54
55#define EXYNOS_PA_CHIPID 0x10000000 55#define EXYNOS_PA_CHIPID 0x10000000
56#define EXYNOS5440_PA_CHIPID 0x00160000
56 57
57#define EXYNOS4_PA_SYSCON 0x10010000 58#define EXYNOS4_PA_SYSCON 0x10010000
58#define EXYNOS5_PA_SYSCON 0x10050100 59#define EXYNOS5_PA_SYSCON 0x10050100
@@ -88,6 +89,8 @@
88#define EXYNOS4_PA_TWD 0x10500600 89#define EXYNOS4_PA_TWD 0x10500600
89#define EXYNOS4_PA_L2CC 0x10502000 90#define EXYNOS4_PA_L2CC 0x10502000
90 91
92#define EXYNOS4_PA_TMU 0x100C0000
93
91#define EXYNOS4_PA_MDMA0 0x10810000 94#define EXYNOS4_PA_MDMA0 0x10810000
92#define EXYNOS4_PA_MDMA1 0x12850000 95#define EXYNOS4_PA_MDMA1 0x12850000
93#define EXYNOS4_PA_S_MDMA1 0x12840000 96#define EXYNOS4_PA_S_MDMA1 0x12840000
@@ -280,7 +283,10 @@
280#define EXYNOS5_PA_UART1 0x12C10000 283#define EXYNOS5_PA_UART1 0x12C10000
281#define EXYNOS5_PA_UART2 0x12C20000 284#define EXYNOS5_PA_UART2 0x12C20000
282#define EXYNOS5_PA_UART3 0x12C30000 285#define EXYNOS5_PA_UART3 0x12C30000
283#define EXYNOS5_SZ_UART SZ_256 286
287#define EXYNOS5440_PA_UART0 0x000B0000
288#define EXYNOS5440_PA_UART1 0x000C0000
289#define EXYNOS5440_SZ_UART SZ_256
284 290
285#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) 291#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
286 292
diff --git a/arch/arm/mach-exynos/include/mach/regs-mem.h b/arch/arm/mach-exynos/include/mach/regs-mem.h
deleted file mode 100644
index 0368b5a2725..00000000000
--- a/arch/arm/mach-exynos/include/mach/regs-mem.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* linux/arch/arm/mach-exynos4/include/mach/regs-mem.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - SROMC and DMC 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_MEM_H
14#define __ASM_ARCH_REGS_MEM_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_DMC0_MEMCON_OFFSET 0x04
19
20#define S5P_DMC0_MEMTYPE_SHIFT 8
21#define S5P_DMC0_MEMTYPE_MASK 0xF
22
23#endif /* __ASM_ARCH_REGS_MEM_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index d4e392b811a..84428e72cf5 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -31,6 +31,7 @@
31 31
32#define S5P_SWRESET S5P_PMUREG(0x0400) 32#define S5P_SWRESET S5P_PMUREG(0x0400)
33#define EXYNOS_SWRESET S5P_PMUREG(0x0400) 33#define EXYNOS_SWRESET S5P_PMUREG(0x0400)
34#define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4)
34 35
35#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) 36#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600)
36#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) 37#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604)
@@ -230,8 +231,6 @@
230 231
231/* For EXYNOS5 */ 232/* For EXYNOS5 */
232 233
233#define EXYNOS5_USB_CFG S5P_PMUREG(0x0230)
234
235#define EXYNOS5_AUTO_WDTRESET_DISABLE S5P_PMUREG(0x0408) 234#define EXYNOS5_AUTO_WDTRESET_DISABLE S5P_PMUREG(0x0408)
236#define EXYNOS5_MASK_WDTRESET_REQUEST S5P_PMUREG(0x040C) 235#define EXYNOS5_MASK_WDTRESET_REQUEST S5P_PMUREG(0x040C)
237 236
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c
index 3f37a5e8a1f..b938f9fc1dd 100644
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ b/arch/arm/mach-exynos/mach-armlex4210.c
@@ -147,7 +147,6 @@ static struct platform_device *armlex4210_devices[] __initdata = {
147 &s3c_device_hsmmc3, 147 &s3c_device_hsmmc3,
148 &s3c_device_rtc, 148 &s3c_device_rtc,
149 &s3c_device_wdt, 149 &s3c_device_wdt,
150 &samsung_asoc_dma,
151 &armlex4210_smsc911x, 150 &armlex4210_smsc911x,
152 &exynos4_device_ahci, 151 &exynos4_device_ahci,
153}; 152};
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index eadf4b59e7d..92757ff817a 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -77,6 +77,9 @@ static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = {
77 "exynos4210-spi.2", NULL), 77 "exynos4210-spi.2", NULL),
78 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL), 78 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL),
79 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL), 79 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL),
80 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_MDMA1, "dma-pl330.2", NULL),
81 OF_DEV_AUXDATA("samsung,exynos4210-tmu", EXYNOS4_PA_TMU,
82 "exynos-tmu", NULL),
80 {}, 83 {},
81}; 84};
82 85
@@ -94,6 +97,8 @@ static void __init exynos4_dt_machine_init(void)
94 97
95static char const *exynos4_dt_compat[] __initdata = { 98static char const *exynos4_dt_compat[] __initdata = {
96 "samsung,exynos4210", 99 "samsung,exynos4210",
100 "samsung,exynos4212",
101 "samsung,exynos4412",
97 NULL 102 NULL
98}; 103};
99 104
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index db1cd8eacf2..929de766d49 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -10,7 +10,10 @@
10*/ 10*/
11 11
12#include <linux/of_platform.h> 12#include <linux/of_platform.h>
13#include <linux/of_fdt.h>
13#include <linux/serial_core.h> 14#include <linux/serial_core.h>
15#include <linux/memblock.h>
16#include <linux/of_fdt.h>
14 17
15#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
16#include <asm/hardware/gic.h> 19#include <asm/hardware/gic.h>
@@ -18,6 +21,7 @@
18 21
19#include <plat/cpu.h> 22#include <plat/cpu.h>
20#include <plat/regs-serial.h> 23#include <plat/regs-serial.h>
24#include <plat/mfc.h>
21 25
22#include "common.h" 26#include "common.h"
23 27
@@ -47,6 +51,20 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
47 "s3c2440-i2c.0", NULL), 51 "s3c2440-i2c.0", NULL),
48 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1), 52 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
49 "s3c2440-i2c.1", NULL), 53 "s3c2440-i2c.1", NULL),
54 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
55 "s3c2440-i2c.2", NULL),
56 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
57 "s3c2440-i2c.3", NULL),
58 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
59 "s3c2440-i2c.4", NULL),
60 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
61 "s3c2440-i2c.5", NULL),
62 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
63 "s3c2440-i2c.6", NULL),
64 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
65 "s3c2440-i2c.7", NULL),
66 OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8),
67 "s3c2440-hdmiphy-i2c", NULL),
50 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0, 68 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
51 "dw_mmc.0", NULL), 69 "dw_mmc.0", NULL),
52 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1, 70 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1,
@@ -61,6 +79,12 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
61 "exynos4210-spi.1", NULL), 79 "exynos4210-spi.1", NULL),
62 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2, 80 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
63 "exynos4210-spi.2", NULL), 81 "exynos4210-spi.2", NULL),
82 OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000,
83 "exynos5-sata", NULL),
84 OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000,
85 "exynos5-sata-phy", NULL),
86 OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000,
87 "exynos5-sata-phy-i2c", NULL),
64 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), 88 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
65 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), 89 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
66 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), 90 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
@@ -72,35 +96,69 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
72 "exynos-gsc.2", NULL), 96 "exynos-gsc.2", NULL),
73 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3, 97 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
74 "exynos-gsc.3", NULL), 98 "exynos-gsc.3", NULL),
99 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
100 "exynos5-hdmi", NULL),
101 OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000,
102 "exynos5-mixer", NULL),
103 OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
104 OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
105 "exynos-tmu", NULL),
75 {}, 106 {},
76}; 107};
77 108
78static void __init exynos5250_dt_map_io(void) 109static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = {
110 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5440_PA_UART0,
111 "exynos4210-uart.0", NULL),
112 {},
113};
114
115static void __init exynos5_dt_map_io(void)
79{ 116{
117 unsigned long root = of_get_flat_dt_root();
118
80 exynos_init_io(NULL, 0); 119 exynos_init_io(NULL, 0);
81 s3c24xx_init_clocks(24000000); 120
121 if (of_flat_dt_is_compatible(root, "samsung,exynos5250"))
122 s3c24xx_init_clocks(24000000);
82} 123}
83 124
84static void __init exynos5250_dt_machine_init(void) 125static void __init exynos5_dt_machine_init(void)
85{ 126{
86 of_platform_populate(NULL, of_default_bus_match_table, 127 if (of_machine_is_compatible("samsung,exynos5250"))
87 exynos5250_auxdata_lookup, NULL); 128 of_platform_populate(NULL, of_default_bus_match_table,
129 exynos5250_auxdata_lookup, NULL);
130 else if (of_machine_is_compatible("samsung,exynos5440"))
131 of_platform_populate(NULL, of_default_bus_match_table,
132 exynos5440_auxdata_lookup, NULL);
88} 133}
89 134
90static char const *exynos5250_dt_compat[] __initdata = { 135static char const *exynos5_dt_compat[] __initdata = {
91 "samsung,exynos5250", 136 "samsung,exynos5250",
137 "samsung,exynos5440",
92 NULL 138 NULL
93}; 139};
94 140
141static void __init exynos5_reserve(void)
142{
143 struct s5p_mfc_dt_meminfo mfc_mem;
144
145 /* Reserve memory for MFC only if it's available */
146 mfc_mem.compatible = "samsung,mfc-v6";
147 if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
148 s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
149 mfc_mem.lsize);
150}
151
95DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") 152DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
96 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ 153 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
97 .init_irq = exynos5_init_irq, 154 .init_irq = exynos5_init_irq,
98 .smp = smp_ops(exynos_smp_ops), 155 .smp = smp_ops(exynos_smp_ops),
99 .map_io = exynos5250_dt_map_io, 156 .map_io = exynos5_dt_map_io,
100 .handle_irq = gic_handle_irq, 157 .handle_irq = gic_handle_irq,
101 .init_machine = exynos5250_dt_machine_init, 158 .init_machine = exynos5_dt_machine_init,
102 .init_late = exynos_init_late, 159 .init_late = exynos_init_late,
103 .timer = &exynos4_timer, 160 .timer = &exynos4_timer,
104 .dt_compat = exynos5250_dt_compat, 161 .dt_compat = exynos5_dt_compat,
105 .restart = exynos5_restart, 162 .restart = exynos5_restart,
163 .reserve = exynos5_reserve,
106MACHINE_END 164MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index c05d7aa8403..27d4ed8b116 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -25,7 +25,10 @@
25#include <linux/mmc/host.h> 25#include <linux/mmc/host.h>
26#include <linux/fb.h> 26#include <linux/fb.h>
27#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
28#include <linux/platform_data/i2c-s3c2410.h>
29#include <linux/platform_data/mipi-csis.h>
28#include <linux/platform_data/s3c-hsotg.h> 30#include <linux/platform_data/s3c-hsotg.h>
31#include <linux/platform_data/usb-ehci-s5p.h>
29#include <drm/exynos_drm.h> 32#include <drm/exynos_drm.h>
30 33
31#include <video/platform_lcd.h> 34#include <video/platform_lcd.h>
@@ -45,14 +48,11 @@
45#include <plat/devs.h> 48#include <plat/devs.h>
46#include <plat/fb.h> 49#include <plat/fb.h>
47#include <plat/sdhci.h> 50#include <plat/sdhci.h>
48#include <linux/platform_data/usb-ehci-s5p.h>
49#include <plat/clock.h> 51#include <plat/clock.h>
50#include <plat/gpio-cfg.h> 52#include <plat/gpio-cfg.h>
51#include <linux/platform_data/i2c-s3c2410.h>
52#include <plat/mfc.h> 53#include <plat/mfc.h>
53#include <plat/fimc-core.h> 54#include <plat/fimc-core.h>
54#include <plat/camport.h> 55#include <plat/camport.h>
55#include <linux/platform_data/mipi-csis.h>
56 56
57#include <mach/map.h> 57#include <mach/map.h>
58 58
@@ -113,7 +113,6 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
113 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 113 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
114 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 114 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
115 MMC_CAP_ERASE), 115 MMC_CAP_ERASE),
116 .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
117 .cd_type = S3C_SDHCI_CD_PERMANENT, 116 .cd_type = S3C_SDHCI_CD_PERMANENT,
118}; 117};
119 118
@@ -1327,9 +1326,6 @@ static struct platform_device *nuri_devices[] __initdata = {
1327 &cam_vdda_fixed_rdev, 1326 &cam_vdda_fixed_rdev,
1328 &cam_8m_12v_fixed_rdev, 1327 &cam_8m_12v_fixed_rdev,
1329 &exynos4_bus_devfreq, 1328 &exynos4_bus_devfreq,
1330#ifdef CONFIG_DRM_EXYNOS
1331 &exynos_device_drm,
1332#endif
1333}; 1329};
1334 1330
1335static void __init nuri_map_io(void) 1331static void __init nuri_map_io(void)
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index 9adf491674e..e6f4191cd14 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -23,7 +23,10 @@
23#include <linux/mfd/max8997.h> 23#include <linux/mfd/max8997.h>
24#include <linux/lcd.h> 24#include <linux/lcd.h>
25#include <linux/rfkill-gpio.h> 25#include <linux/rfkill-gpio.h>
26#include <linux/platform_data/i2c-s3c2410.h>
26#include <linux/platform_data/s3c-hsotg.h> 27#include <linux/platform_data/s3c-hsotg.h>
28#include <linux/platform_data/usb-ehci-s5p.h>
29#include <linux/platform_data/usb-exynos.h>
27 30
28#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
29#include <asm/hardware/gic.h> 32#include <asm/hardware/gic.h>
@@ -36,8 +39,6 @@
36#include <plat/cpu.h> 39#include <plat/cpu.h>
37#include <plat/devs.h> 40#include <plat/devs.h>
38#include <plat/sdhci.h> 41#include <plat/sdhci.h>
39#include <linux/platform_data/i2c-s3c2410.h>
40#include <linux/platform_data/usb-ehci-s5p.h>
41#include <plat/clock.h> 42#include <plat/clock.h>
42#include <plat/gpio-cfg.h> 43#include <plat/gpio-cfg.h>
43#include <plat/backlight.h> 44#include <plat/backlight.h>
@@ -45,7 +46,6 @@
45#include <plat/mfc.h> 46#include <plat/mfc.h>
46#include <plat/hdmi.h> 47#include <plat/hdmi.h>
47 48
48#include <linux/platform_data/usb-exynos.h>
49#include <mach/map.h> 49#include <mach/map.h>
50 50
51#include <drm/exynos_drm.h> 51#include <drm/exynos_drm.h>
@@ -100,6 +100,7 @@ static struct regulator_consumer_supply __initdata ldo3_consumer[] = {
100 REGULATOR_SUPPLY("vddcore", "s5p-mipi-csis.0"), /* MIPI */ 100 REGULATOR_SUPPLY("vddcore", "s5p-mipi-csis.0"), /* MIPI */
101 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */ 101 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */
102 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */ 102 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */
103 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* OTG */
103}; 104};
104static struct regulator_consumer_supply __initdata ldo6_consumer[] = { 105static struct regulator_consumer_supply __initdata ldo6_consumer[] = {
105 REGULATOR_SUPPLY("vddio", "s5p-mipi-csis.0"), /* MIPI */ 106 REGULATOR_SUPPLY("vddio", "s5p-mipi-csis.0"), /* MIPI */
@@ -110,6 +111,7 @@ static struct regulator_consumer_supply __initdata ldo7_consumer[] = {
110static struct regulator_consumer_supply __initdata ldo8_consumer[] = { 111static struct regulator_consumer_supply __initdata ldo8_consumer[] = {
111 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */ 112 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */
112 REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */ 113 REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */
114 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* OTG */
113}; 115};
114static struct regulator_consumer_supply __initdata ldo9_consumer[] = { 116static struct regulator_consumer_supply __initdata ldo9_consumer[] = {
115 REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ 117 REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
@@ -709,9 +711,6 @@ static struct platform_device *origen_devices[] __initdata = {
709 &s5p_device_mfc_l, 711 &s5p_device_mfc_l,
710 &s5p_device_mfc_r, 712 &s5p_device_mfc_r,
711 &s5p_device_mixer, 713 &s5p_device_mixer,
712#ifdef CONFIG_DRM_EXYNOS
713 &exynos_device_drm,
714#endif
715 &exynos4_device_ohci, 714 &exynos4_device_ohci,
716 &origen_device_gpiokeys, 715 &origen_device_gpiokeys,
717 &origen_lcd_hv070wsa, 716 &origen_lcd_hv070wsa,
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c
index 730f1ac6592..a1555a73c7a 100644
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ b/arch/arm/mach-exynos/mach-smdk4x12.c
@@ -21,6 +21,7 @@
21#include <linux/pwm_backlight.h> 21#include <linux/pwm_backlight.h>
22#include <linux/regulator/machine.h> 22#include <linux/regulator/machine.h>
23#include <linux/serial_core.h> 23#include <linux/serial_core.h>
24#include <linux/platform_data/i2c-s3c2410.h>
24#include <linux/platform_data/s3c-hsotg.h> 25#include <linux/platform_data/s3c-hsotg.h>
25 26
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -34,7 +35,6 @@
34#include <plat/devs.h> 35#include <plat/devs.h>
35#include <plat/fb.h> 36#include <plat/fb.h>
36#include <plat/gpio-cfg.h> 37#include <plat/gpio-cfg.h>
37#include <linux/platform_data/i2c-s3c2410.h>
38#include <plat/keypad.h> 38#include <plat/keypad.h>
39#include <plat/mfc.h> 39#include <plat/mfc.h>
40#include <plat/regs-serial.h> 40#include <plat/regs-serial.h>
@@ -317,9 +317,6 @@ static struct platform_device *smdk4x12_devices[] __initdata = {
317 &s5p_device_mfc, 317 &s5p_device_mfc,
318 &s5p_device_mfc_l, 318 &s5p_device_mfc_l,
319 &s5p_device_mfc_r, 319 &s5p_device_mfc_r,
320#ifdef CONFIG_DRM_EXYNOS
321 &exynos_device_drm,
322#endif
323 &samsung_device_keypad, 320 &samsung_device_keypad,
324}; 321};
325 322
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index ee4fb1a9cb7..b7384241fb0 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -20,7 +20,10 @@
20#include <linux/input.h> 20#include <linux/input.h>
21#include <linux/pwm.h> 21#include <linux/pwm.h>
22#include <linux/pwm_backlight.h> 22#include <linux/pwm_backlight.h>
23#include <linux/platform_data/i2c-s3c2410.h>
23#include <linux/platform_data/s3c-hsotg.h> 24#include <linux/platform_data/s3c-hsotg.h>
25#include <linux/platform_data/usb-ehci-s5p.h>
26#include <linux/platform_data/usb-exynos.h>
24 27
25#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
26#include <asm/hardware/gic.h> 29#include <asm/hardware/gic.h>
@@ -35,16 +38,13 @@
35#include <plat/fb.h> 38#include <plat/fb.h>
36#include <plat/keypad.h> 39#include <plat/keypad.h>
37#include <plat/sdhci.h> 40#include <plat/sdhci.h>
38#include <linux/platform_data/i2c-s3c2410.h>
39#include <plat/gpio-cfg.h> 41#include <plat/gpio-cfg.h>
40#include <plat/backlight.h> 42#include <plat/backlight.h>
41#include <plat/mfc.h> 43#include <plat/mfc.h>
42#include <linux/platform_data/usb-ehci-s5p.h>
43#include <plat/clock.h> 44#include <plat/clock.h>
44#include <plat/hdmi.h> 45#include <plat/hdmi.h>
45 46
46#include <mach/map.h> 47#include <mach/map.h>
47#include <linux/platform_data/usb-exynos.h>
48 48
49#include <drm/exynos_drm.h> 49#include <drm/exynos_drm.h>
50#include "common.h" 50#include "common.h"
@@ -300,9 +300,6 @@ static struct platform_device *smdkv310_devices[] __initdata = {
300 &s5p_device_fimc_md, 300 &s5p_device_fimc_md,
301 &s5p_device_g2d, 301 &s5p_device_g2d,
302 &s5p_device_jpeg, 302 &s5p_device_jpeg,
303#ifdef CONFIG_DRM_EXYNOS
304 &exynos_device_drm,
305#endif
306 &exynos4_device_ac97, 303 &exynos4_device_ac97,
307 &exynos4_device_i2s0, 304 &exynos4_device_i2s0,
308 &exynos4_device_ohci, 305 &exynos4_device_ohci,
@@ -311,7 +308,6 @@ static struct platform_device *smdkv310_devices[] __initdata = {
311 &s5p_device_mfc_l, 308 &s5p_device_mfc_l,
312 &s5p_device_mfc_r, 309 &s5p_device_mfc_r,
313 &exynos4_device_spdif, 310 &exynos4_device_spdif,
314 &samsung_asoc_dma,
315 &samsung_asoc_idma, 311 &samsung_asoc_idma,
316 &s5p_device_fimd0, 312 &s5p_device_fimd0,
317 &smdkv310_device_audio, 313 &smdkv310_device_audio,
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index ebc9dd339a3..9e3340f1895 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -23,6 +23,8 @@
23#include <linux/i2c-gpio.h> 23#include <linux/i2c-gpio.h>
24#include <linux/i2c/mcs.h> 24#include <linux/i2c/mcs.h>
25#include <linux/i2c/atmel_mxt_ts.h> 25#include <linux/i2c/atmel_mxt_ts.h>
26#include <linux/platform_data/i2c-s3c2410.h>
27#include <linux/platform_data/mipi-csis.h>
26#include <linux/platform_data/s3c-hsotg.h> 28#include <linux/platform_data/s3c-hsotg.h>
27#include <drm/exynos_drm.h> 29#include <drm/exynos_drm.h>
28 30
@@ -35,7 +37,6 @@
35#include <plat/clock.h> 37#include <plat/clock.h>
36#include <plat/cpu.h> 38#include <plat/cpu.h>
37#include <plat/devs.h> 39#include <plat/devs.h>
38#include <linux/platform_data/i2c-s3c2410.h>
39#include <plat/gpio-cfg.h> 40#include <plat/gpio-cfg.h>
40#include <plat/fb.h> 41#include <plat/fb.h>
41#include <plat/mfc.h> 42#include <plat/mfc.h>
@@ -43,7 +44,6 @@
43#include <plat/fimc-core.h> 44#include <plat/fimc-core.h>
44#include <plat/s5p-time.h> 45#include <plat/s5p-time.h>
45#include <plat/camport.h> 46#include <plat/camport.h>
46#include <linux/platform_data/mipi-csis.h>
47 47
48#include <mach/map.h> 48#include <mach/map.h>
49 49
@@ -754,7 +754,6 @@ static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
754 .max_width = 8, 754 .max_width = 8,
755 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 755 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
756 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 756 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
757 .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
758 .cd_type = S3C_SDHCI_CD_PERMANENT, 757 .cd_type = S3C_SDHCI_CD_PERMANENT,
759}; 758};
760 759
@@ -1081,9 +1080,6 @@ static struct platform_device *universal_devices[] __initdata = {
1081 &s5p_device_onenand, 1080 &s5p_device_onenand,
1082 &s5p_device_fimd0, 1081 &s5p_device_fimd0,
1083 &s5p_device_jpeg, 1082 &s5p_device_jpeg,
1084#ifdef CONFIG_DRM_EXYNOS
1085 &exynos_device_drm,
1086#endif
1087 &s3c_device_usb_hsotg, 1083 &s3c_device_usb_hsotg,
1088 &s5p_device_mfc, 1084 &s5p_device_mfc,
1089 &s5p_device_mfc_l, 1085 &s5p_device_mfc_l,
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
index b601fb8a408..57668eb68e7 100644
--- a/arch/arm/mach-exynos/mct.c
+++ b/arch/arm/mach-exynos/mct.c
@@ -19,7 +19,9 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22#include <linux/of.h>
22 23
24#include <asm/arch_timer.h>
23#include <asm/hardware/gic.h> 25#include <asm/hardware/gic.h>
24#include <asm/localtimer.h> 26#include <asm/localtimer.h>
25 27
@@ -476,8 +478,13 @@ static void __init exynos4_timer_resources(void)
476#endif /* CONFIG_LOCAL_TIMERS */ 478#endif /* CONFIG_LOCAL_TIMERS */
477} 479}
478 480
479static void __init exynos4_timer_init(void) 481static void __init exynos_timer_init(void)
480{ 482{
483 if (soc_is_exynos5440()) {
484 arch_timer_of_register();
485 return;
486 }
487
481 if ((soc_is_exynos4210()) || (soc_is_exynos5250())) 488 if ((soc_is_exynos4210()) || (soc_is_exynos5250()))
482 mct_int_type = MCT_INT_SPI; 489 mct_int_type = MCT_INT_SPI;
483 else 490 else
@@ -489,5 +496,5 @@ static void __init exynos4_timer_init(void)
489} 496}
490 497
491struct sys_timer exynos4_timer = { 498struct sys_timer exynos4_timer = {
492 .init = exynos4_timer_init, 499 .init = exynos_timer_init,
493}; 500};
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index f93d820ecab..4ca8ff14a5b 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -36,8 +36,22 @@
36 36
37extern void exynos4_secondary_startup(void); 37extern void exynos4_secondary_startup(void);
38 38
39#define CPU1_BOOT_REG (samsung_rev() == EXYNOS4210_REV_1_1 ? \ 39static inline void __iomem *cpu_boot_reg_base(void)
40 S5P_INFORM5 : S5P_VA_SYSRAM) 40{
41 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
42 return S5P_INFORM5;
43 return S5P_VA_SYSRAM;
44}
45
46static inline void __iomem *cpu_boot_reg(int cpu)
47{
48 void __iomem *boot_reg;
49
50 boot_reg = cpu_boot_reg_base();
51 if (soc_is_exynos4412())
52 boot_reg += 4*cpu;
53 return boot_reg;
54}
41 55
42/* 56/*
43 * Write pen_release in a way that is guaranteed to be visible to all 57 * Write pen_release in a way that is guaranteed to be visible to all
@@ -84,6 +98,7 @@ static void __cpuinit exynos_secondary_init(unsigned int cpu)
84static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) 98static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
85{ 99{
86 unsigned long timeout; 100 unsigned long timeout;
101 unsigned long phys_cpu = cpu_logical_map(cpu);
87 102
88 /* 103 /*
89 * Set synchronisation state between this boot processor 104 * Set synchronisation state between this boot processor
@@ -99,7 +114,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct
99 * Note that "pen_release" is the hardware CPU ID, whereas 114 * Note that "pen_release" is the hardware CPU ID, whereas
100 * "cpu" is Linux's internal ID. 115 * "cpu" is Linux's internal ID.
101 */ 116 */
102 write_pen_release(cpu_logical_map(cpu)); 117 write_pen_release(phys_cpu);
103 118
104 if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) { 119 if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) {
105 __raw_writel(S5P_CORE_LOCAL_PWR_EN, 120 __raw_writel(S5P_CORE_LOCAL_PWR_EN,
@@ -133,7 +148,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct
133 smp_rmb(); 148 smp_rmb();
134 149
135 __raw_writel(virt_to_phys(exynos4_secondary_startup), 150 __raw_writel(virt_to_phys(exynos4_secondary_startup),
136 CPU1_BOOT_REG); 151 cpu_boot_reg(phys_cpu));
137 gic_raise_softirq(cpumask_of(cpu), 0); 152 gic_raise_softirq(cpumask_of(cpu), 0);
138 153
139 if (pen_release == -1) 154 if (pen_release == -1)
@@ -181,6 +196,8 @@ static void __init exynos_smp_init_cpus(void)
181 196
182static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) 197static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
183{ 198{
199 int i;
200
184 if (!soc_is_exynos5250()) 201 if (!soc_is_exynos5250())
185 scu_enable(scu_base_addr()); 202 scu_enable(scu_base_addr());
186 203
@@ -190,8 +207,9 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
190 * until it receives a soft interrupt, and then the 207 * until it receives a soft interrupt, and then the
191 * secondary CPU branches to this address. 208 * secondary CPU branches to this address.
192 */ 209 */
193 __raw_writel(virt_to_phys(exynos4_secondary_startup), 210 for (i = 1; i < max_cpus; ++i)
194 CPU1_BOOT_REG); 211 __raw_writel(virt_to_phys(exynos4_secondary_startup),
212 cpu_boot_reg(cpu_logical_map(i)));
195} 213}
196 214
197struct smp_operations exynos_smp_ops __initdata = { 215struct smp_operations exynos_smp_ops __initdata = {
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index c06c992943a..8df6ec547f7 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -81,6 +81,9 @@ static int exynos_cpu_suspend(unsigned long arg)
81 outer_flush_all(); 81 outer_flush_all();
82#endif 82#endif
83 83
84 if (soc_is_exynos5250())
85 flush_cache_all();
86
84 /* issue the standby signal into the pm unit. */ 87 /* issue the standby signal into the pm unit. */
85 cpu_do_idle(); 88 cpu_do_idle();
86 89
@@ -312,6 +315,10 @@ static void exynos_pm_resume(void)
312 } 315 }
313 316
314early_wakeup: 317early_wakeup:
318
319 /* Clear SLEEP mode set in INFORM1 */
320 __raw_writel(0x0, S5P_INFORM1);
321
315 return; 322 return;
316} 323}
317 324
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index c0bc83a7663..9f1351de52f 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -19,6 +19,8 @@
19#include <linux/pm_domain.h> 19#include <linux/pm_domain.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/of_address.h> 21#include <linux/of_address.h>
22#include <linux/of_platform.h>
23#include <linux/sched.h>
22 24
23#include <mach/regs-pmu.h> 25#include <mach/regs-pmu.h>
24#include <plat/devs.h> 26#include <plat/devs.h>
@@ -83,12 +85,88 @@ static struct exynos_pm_domain PD = { \
83} 85}
84 86
85#ifdef CONFIG_OF 87#ifdef CONFIG_OF
88static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
89 struct device *dev)
90{
91 int ret;
92
93 dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
94
95 while (1) {
96 ret = pm_genpd_add_device(&pd->pd, dev);
97 if (ret != -EAGAIN)
98 break;
99 cond_resched();
100 }
101
102 pm_genpd_dev_need_restore(dev, true);
103}
104
105static void exynos_remove_device_from_domain(struct device *dev)
106{
107 struct generic_pm_domain *genpd = dev_to_genpd(dev);
108 int ret;
109
110 dev_dbg(dev, "removing from power domain %s\n", genpd->name);
111
112 while (1) {
113 ret = pm_genpd_remove_device(genpd, dev);
114 if (ret != -EAGAIN)
115 break;
116 cond_resched();
117 }
118}
119
120static void exynos_read_domain_from_dt(struct device *dev)
121{
122 struct platform_device *pd_pdev;
123 struct exynos_pm_domain *pd;
124 struct device_node *node;
125
126 node = of_parse_phandle(dev->of_node, "samsung,power-domain", 0);
127 if (!node)
128 return;
129 pd_pdev = of_find_device_by_node(node);
130 if (!pd_pdev)
131 return;
132 pd = platform_get_drvdata(pd_pdev);
133 exynos_add_device_to_domain(pd, dev);
134}
135
136static int exynos_pm_notifier_call(struct notifier_block *nb,
137 unsigned long event, void *data)
138{
139 struct device *dev = data;
140
141 switch (event) {
142 case BUS_NOTIFY_BIND_DRIVER:
143 if (dev->of_node)
144 exynos_read_domain_from_dt(dev);
145
146 break;
147
148 case BUS_NOTIFY_UNBOUND_DRIVER:
149 exynos_remove_device_from_domain(dev);
150
151 break;
152 }
153 return NOTIFY_DONE;
154}
155
156static struct notifier_block platform_nb = {
157 .notifier_call = exynos_pm_notifier_call,
158};
159
86static __init int exynos_pm_dt_parse_domains(void) 160static __init int exynos_pm_dt_parse_domains(void)
87{ 161{
162 struct platform_device *pdev;
88 struct device_node *np; 163 struct device_node *np;
89 164
90 for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { 165 for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
91 struct exynos_pm_domain *pd; 166 struct exynos_pm_domain *pd;
167 int on;
168
169 pdev = of_find_device_by_node(np);
92 170
93 pd = kzalloc(sizeof(*pd), GFP_KERNEL); 171 pd = kzalloc(sizeof(*pd), GFP_KERNEL);
94 if (!pd) { 172 if (!pd) {
@@ -97,15 +175,22 @@ static __init int exynos_pm_dt_parse_domains(void)
97 return -ENOMEM; 175 return -ENOMEM;
98 } 176 }
99 177
100 if (of_get_property(np, "samsung,exynos4210-pd-off", NULL)) 178 pd->pd.name = kstrdup(np->name, GFP_KERNEL);
101 pd->is_off = true; 179 pd->name = pd->pd.name;
102 pd->name = np->name;
103 pd->base = of_iomap(np, 0); 180 pd->base = of_iomap(np, 0);
104 pd->pd.power_off = exynos_pd_power_off; 181 pd->pd.power_off = exynos_pd_power_off;
105 pd->pd.power_on = exynos_pd_power_on; 182 pd->pd.power_on = exynos_pd_power_on;
106 pd->pd.of_node = np; 183 pd->pd.of_node = np;
107 pm_genpd_init(&pd->pd, NULL, false); 184
185 platform_set_drvdata(pdev, pd);
186
187 on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
188
189 pm_genpd_init(&pd->pd, NULL, !on);
108 } 190 }
191
192 bus_register_notifier(&platform_bus_type, &platform_nb);
193
109 return 0; 194 return 0;
110} 195}
111#else 196#else
diff --git a/arch/arm/mach-exynos/setup-i2c0.c b/arch/arm/mach-exynos/setup-i2c0.c
index 5700f23629f..e2d9dfbf102 100644
--- a/arch/arm/mach-exynos/setup-i2c0.c
+++ b/arch/arm/mach-exynos/setup-i2c0.c
@@ -20,7 +20,7 @@ struct platform_device; /* don't need the contents */
20 20
21void s3c_i2c0_cfg_gpio(struct platform_device *dev) 21void s3c_i2c0_cfg_gpio(struct platform_device *dev)
22{ 22{
23 if (soc_is_exynos5250()) 23 if (soc_is_exynos5250() || soc_is_exynos5440())
24 /* will be implemented with gpio function */ 24 /* will be implemented with gpio function */
25 return; 25 return;
26 26
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index 0e1d0a42a3e..551c97e87a7 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -1,5 +1,5 @@
1config ARCH_HIGHBANK 1config ARCH_HIGHBANK
2 bool "Calxeda ECX-1000 (Highbank)" if ARCH_MULTI_V7 2 bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7
3 select ARCH_WANT_OPTIONAL_GPIOLIB 3 select ARCH_WANT_OPTIONAL_GPIOLIB
4 select ARM_AMBA 4 select ARM_AMBA
5 select ARM_GIC 5 select ARM_GIC
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
index 3ec8bdd25d0..8a1ef576d79 100644
--- a/arch/arm/mach-highbank/Makefile
+++ b/arch/arm/mach-highbank/Makefile
@@ -3,7 +3,6 @@ obj-y := highbank.o system.o smc.o
3plus_sec := $(call as-instr,.arch_extension sec,+sec) 3plus_sec := $(call as-instr,.arch_extension sec,+sec)
4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) 4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec)
5 5
6obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o
7obj-$(CONFIG_SMP) += platsmp.o 6obj-$(CONFIG_SMP) += platsmp.o
8obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 7obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
9obj-$(CONFIG_PM_SLEEP) += pm.o 8obj-$(CONFIG_PM_SLEEP) += pm.o
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index 286ec82a4f6..80235b46cb5 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -1,12 +1,10 @@
1#ifndef __HIGHBANK_CORE_H
2#define __HIGHBANK_CORE_H
3
1extern void highbank_set_cpu_jump(int cpu, void *jump_addr); 4extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
2extern void highbank_clocks_init(void); 5extern void highbank_clocks_init(void);
3extern void highbank_restart(char, const char *); 6extern void highbank_restart(char, const char *);
4extern void __iomem *scu_base_addr; 7extern void __iomem *scu_base_addr;
5#ifdef CONFIG_DEBUG_HIGHBANK_UART
6extern void highbank_lluart_map_io(void);
7#else
8static inline void highbank_lluart_map_io(void) {}
9#endif
10 8
11#ifdef CONFIG_PM_SLEEP 9#ifdef CONFIG_PM_SLEEP
12extern void highbank_pm_init(void); 10extern void highbank_pm_init(void);
@@ -18,3 +16,5 @@ extern void highbank_smc1(int fn, int arg);
18extern void highbank_cpu_die(unsigned int cpu); 16extern void highbank_cpu_die(unsigned int cpu);
19 17
20extern struct smp_operations highbank_smp_ops; 18extern struct smp_operations highbank_smp_ops;
19
20#endif
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 40e36a50304..dc248167d20 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -26,9 +26,9 @@
26#include <linux/smp.h> 26#include <linux/smp.h>
27#include <linux/amba/bus.h> 27#include <linux/amba/bus.h>
28 28
29#include <asm/arch_timer.h>
29#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
30#include <asm/smp_plat.h> 31#include <asm/smp_plat.h>
31#include <asm/smp_scu.h>
32#include <asm/smp_twd.h> 32#include <asm/smp_twd.h>
33#include <asm/hardware/arm_timer.h> 33#include <asm/hardware/arm_timer.h>
34#include <asm/hardware/timer-sp.h> 34#include <asm/hardware/timer-sp.h>
@@ -42,16 +42,7 @@
42#include "sysregs.h" 42#include "sysregs.h"
43 43
44void __iomem *sregs_base; 44void __iomem *sregs_base;
45 45void __iomem *scu_base_addr;
46#define HB_SCU_VIRT_BASE 0xfee00000
47void __iomem *scu_base_addr = ((void __iomem *)(HB_SCU_VIRT_BASE));
48
49static struct map_desc scu_io_desc __initdata = {
50 .virtual = HB_SCU_VIRT_BASE,
51 .pfn = 0, /* run-time */
52 .length = SZ_4K,
53 .type = MT_DEVICE,
54};
55 46
56static void __init highbank_scu_map_io(void) 47static void __init highbank_scu_map_io(void)
57{ 48{
@@ -60,14 +51,7 @@ static void __init highbank_scu_map_io(void)
60 /* Get SCU base */ 51 /* Get SCU base */
61 asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base)); 52 asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
62 53
63 scu_io_desc.pfn = __phys_to_pfn(base); 54 scu_base_addr = ioremap(base, SZ_4K);
64 iotable_init(&scu_io_desc, 1);
65}
66
67static void __init highbank_map_io(void)
68{
69 highbank_scu_map_io();
70 highbank_lluart_map_io();
71} 55}
72 56
73#define HB_JUMP_TABLE_PHYS(cpu) (0x40 + (0x10 * (cpu))) 57#define HB_JUMP_TABLE_PHYS(cpu) (0x40 + (0x10 * (cpu)))
@@ -83,6 +67,7 @@ void highbank_set_cpu_jump(int cpu, void *jump_addr)
83} 67}
84 68
85const static struct of_device_id irq_match[] = { 69const static struct of_device_id irq_match[] = {
70 { .compatible = "arm,cortex-a15-gic", .data = gic_of_init, },
86 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, }, 71 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
87 {} 72 {}
88}; 73};
@@ -99,6 +84,9 @@ static void __init highbank_init_irq(void)
99{ 84{
100 of_irq_init(irq_match); 85 of_irq_init(irq_match);
101 86
87 if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
88 highbank_scu_map_io();
89
102#ifdef CONFIG_CACHE_L2X0 90#ifdef CONFIG_CACHE_L2X0
103 /* Enable PL310 L2 Cache controller */ 91 /* Enable PL310 L2 Cache controller */
104 highbank_smc1(0x102, 0x1); 92 highbank_smc1(0x102, 0x1);
@@ -136,6 +124,9 @@ static void __init highbank_timer_init(void)
136 sp804_clockevents_init(timer_base, irq, "timer0"); 124 sp804_clockevents_init(timer_base, irq, "timer0");
137 125
138 twd_local_timer_of_register(); 126 twd_local_timer_of_register();
127
128 arch_timer_of_register();
129 arch_timer_sched_clock_init();
139} 130}
140 131
141static struct sys_timer highbank_timer = { 132static struct sys_timer highbank_timer = {
@@ -145,7 +136,6 @@ static struct sys_timer highbank_timer = {
145static void highbank_power_off(void) 136static void highbank_power_off(void)
146{ 137{
147 hignbank_set_pwr_shutdown(); 138 hignbank_set_pwr_shutdown();
148 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
149 139
150 while (1) 140 while (1)
151 cpu_do_idle(); 141 cpu_do_idle();
@@ -211,12 +201,13 @@ static void __init highbank_init(void)
211 201
212static const char *highbank_match[] __initconst = { 202static const char *highbank_match[] __initconst = {
213 "calxeda,highbank", 203 "calxeda,highbank",
204 "calxeda,ecx-2000",
214 NULL, 205 NULL,
215}; 206};
216 207
217DT_MACHINE_START(HIGHBANK, "Highbank") 208DT_MACHINE_START(HIGHBANK, "Highbank")
218 .smp = smp_ops(highbank_smp_ops), 209 .smp = smp_ops(highbank_smp_ops),
219 .map_io = highbank_map_io, 210 .map_io = debug_ll_io_init,
220 .init_irq = highbank_init_irq, 211 .init_irq = highbank_init_irq,
221 .timer = &highbank_timer, 212 .timer = &highbank_timer,
222 .handle_irq = gic_handle_irq, 213 .handle_irq = gic_handle_irq,
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
index 2c1b8c3c8e4..7b60faccd55 100644
--- a/arch/arm/mach-highbank/hotplug.c
+++ b/arch/arm/mach-highbank/hotplug.c
@@ -14,13 +14,11 @@
14 * this program. If not, see <http://www.gnu.org/licenses/>. 14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/errno.h>
18#include <linux/smp.h>
19 17
20#include <asm/smp_scu.h>
21#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
22 19
23#include "core.h" 20#include "core.h"
21#include "sysregs.h"
24 22
25extern void secondary_startup(void); 23extern void secondary_startup(void);
26 24
@@ -33,7 +31,7 @@ void __ref highbank_cpu_die(unsigned int cpu)
33 flush_cache_all(); 31 flush_cache_all();
34 32
35 highbank_set_cpu_jump(cpu, secondary_startup); 33 highbank_set_cpu_jump(cpu, secondary_startup);
36 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF); 34 highbank_set_core_pwr();
37 35
38 cpu_do_idle(); 36 cpu_do_idle();
39 37
diff --git a/arch/arm/mach-highbank/lluart.c b/arch/arm/mach-highbank/lluart.c
deleted file mode 100644
index 371575019f3..00000000000
--- a/arch/arm/mach-highbank/lluart.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright 2011 Calxeda, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <linux/init.h>
17#include <asm/page.h>
18#include <asm/sizes.h>
19#include <asm/mach/map.h>
20
21#define HB_DEBUG_LL_PHYS_BASE 0xfff36000
22#define HB_DEBUG_LL_VIRT_BASE 0xfee36000
23
24static struct map_desc lluart_io_desc __initdata = {
25 .virtual = HB_DEBUG_LL_VIRT_BASE,
26 .pfn = __phys_to_pfn(HB_DEBUG_LL_PHYS_BASE),
27 .length = SZ_4K,
28 .type = MT_DEVICE,
29};
30
31void __init highbank_lluart_map_io(void)
32{
33 iotable_init(&lluart_io_desc, 1);
34}
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index fa9560ec6e7..1129957f6c1 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -42,9 +42,7 @@ static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struc
42 */ 42 */
43static void __init highbank_smp_init_cpus(void) 43static void __init highbank_smp_init_cpus(void)
44{ 44{
45 unsigned int i, ncores; 45 unsigned int i, ncores = 4;
46
47 ncores = scu_get_core_count(scu_base_addr);
48 46
49 /* sanity check */ 47 /* sanity check */
50 if (ncores > NR_CPUS) { 48 if (ncores > NR_CPUS) {
@@ -65,7 +63,8 @@ static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
65{ 63{
66 int i; 64 int i;
67 65
68 scu_enable(scu_base_addr); 66 if (scu_base_addr)
67 scu_enable(scu_base_addr);
69 68
70 /* 69 /*
71 * Write the address of secondary startup into the jump table 70 * Write the address of secondary startup into the jump table
diff --git a/arch/arm/mach-highbank/pm.c b/arch/arm/mach-highbank/pm.c
index de866f21331..74aa135966f 100644
--- a/arch/arm/mach-highbank/pm.c
+++ b/arch/arm/mach-highbank/pm.c
@@ -19,7 +19,6 @@
19#include <linux/suspend.h> 19#include <linux/suspend.h>
20 20
21#include <asm/proc-fns.h> 21#include <asm/proc-fns.h>
22#include <asm/smp_scu.h>
23#include <asm/suspend.h> 22#include <asm/suspend.h>
24 23
25#include "core.h" 24#include "core.h"
@@ -35,8 +34,6 @@ static int highbank_pm_enter(suspend_state_t state)
35{ 34{
36 hignbank_set_pwr_suspend(); 35 hignbank_set_pwr_suspend();
37 highbank_set_cpu_jump(0, cpu_resume); 36 highbank_set_cpu_jump(0, cpu_resume);
38
39 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
40 cpu_suspend(0, highbank_suspend_finish); 37 cpu_suspend(0, highbank_suspend_finish);
41 38
42 return 0; 39 return 0;
diff --git a/arch/arm/mach-highbank/sysregs.h b/arch/arm/mach-highbank/sysregs.h
index 0e913389f44..e13e8ea7c6c 100644
--- a/arch/arm/mach-highbank/sysregs.h
+++ b/arch/arm/mach-highbank/sysregs.h
@@ -17,6 +17,10 @@
17#define _MACH_HIGHBANK__SYSREGS_H_ 17#define _MACH_HIGHBANK__SYSREGS_H_
18 18
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/smp.h>
21#include <asm/smp_plat.h>
22#include <asm/smp_scu.h>
23#include "core.h"
20 24
21extern void __iomem *sregs_base; 25extern void __iomem *sregs_base;
22 26
@@ -29,24 +33,39 @@ extern void __iomem *sregs_base;
29#define HB_PWR_HARD_RESET 2 33#define HB_PWR_HARD_RESET 2
30#define HB_PWR_SHUTDOWN 3 34#define HB_PWR_SHUTDOWN 3
31 35
36#define SREG_CPU_PWR_CTRL(c) (0x200 + ((c) * 4))
37
38static inline void highbank_set_core_pwr(void)
39{
40 int cpu = cpu_logical_map(smp_processor_id());
41 if (scu_base_addr)
42 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
43 else
44 writel_relaxed(1, sregs_base + SREG_CPU_PWR_CTRL(cpu));
45}
46
32static inline void hignbank_set_pwr_suspend(void) 47static inline void hignbank_set_pwr_suspend(void)
33{ 48{
34 writel(HB_PWR_SUSPEND, sregs_base + HB_SREG_A9_PWR_REQ); 49 writel(HB_PWR_SUSPEND, sregs_base + HB_SREG_A9_PWR_REQ);
50 highbank_set_core_pwr();
35} 51}
36 52
37static inline void hignbank_set_pwr_shutdown(void) 53static inline void hignbank_set_pwr_shutdown(void)
38{ 54{
39 writel(HB_PWR_SHUTDOWN, sregs_base + HB_SREG_A9_PWR_REQ); 55 writel(HB_PWR_SHUTDOWN, sregs_base + HB_SREG_A9_PWR_REQ);
56 highbank_set_core_pwr();
40} 57}
41 58
42static inline void hignbank_set_pwr_soft_reset(void) 59static inline void hignbank_set_pwr_soft_reset(void)
43{ 60{
44 writel(HB_PWR_SOFT_RESET, sregs_base + HB_SREG_A9_PWR_REQ); 61 writel(HB_PWR_SOFT_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
62 highbank_set_core_pwr();
45} 63}
46 64
47static inline void hignbank_set_pwr_hard_reset(void) 65static inline void hignbank_set_pwr_hard_reset(void)
48{ 66{
49 writel(HB_PWR_HARD_RESET, sregs_base + HB_SREG_A9_PWR_REQ); 67 writel(HB_PWR_HARD_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
68 highbank_set_core_pwr();
50} 69}
51 70
52#endif 71#endif
diff --git a/arch/arm/mach-highbank/system.c b/arch/arm/mach-highbank/system.c
index 86e37cd9376..aed96ad9bd4 100644
--- a/arch/arm/mach-highbank/system.c
+++ b/arch/arm/mach-highbank/system.c
@@ -14,7 +14,6 @@
14 * this program. If not, see <http://www.gnu.org/licenses/>. 14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include <linux/io.h> 16#include <linux/io.h>
17#include <asm/smp_scu.h>
18#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
19 18
20#include "core.h" 19#include "core.h"
@@ -27,7 +26,6 @@ void highbank_restart(char mode, const char *cmd)
27 else 26 else
28 hignbank_set_pwr_soft_reset(); 27 hignbank_set_pwr_soft_reset();
29 28
30 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
31 while (1) 29 while (1)
32 cpu_do_idle(); 30 cpu_do_idle();
33} 31}
diff --git a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/mach-imx/3ds_debugboard.c
index 5c10ad05df7..13437735296 100644
--- a/arch/arm/plat-mxc/3ds_debugboard.c
+++ b/arch/arm/mach-imx/3ds_debugboard.c
@@ -21,7 +21,7 @@
21#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22#include <linux/regulator/fixed.h> 22#include <linux/regulator/fixed.h>
23 23
24#include <mach/hardware.h> 24#include "hardware.h"
25 25
26/* LAN9217 ethernet base address */ 26/* LAN9217 ethernet base address */
27#define LAN9217_BASE_ADDR(n) (n + 0x0) 27#define LAN9217_BASE_ADDR(n) (n + 0x0)
diff --git a/arch/arm/plat-mxc/include/mach/3ds_debugboard.h b/arch/arm/mach-imx/3ds_debugboard.h
index 9fd6cb3f8fa..9fd6cb3f8fa 100644
--- a/arch/arm/plat-mxc/include/mach/3ds_debugboard.h
+++ b/arch/arm/mach-imx/3ds_debugboard.h
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 8d276584650..1ad0d76de8c 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,3 +1,70 @@
1config ARCH_MXC
2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7
3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_PATCH_PHYS_VIRT
5 select AUTO_ZRELADDR if !ZBOOT_ROM
6 select CLKDEV_LOOKUP
7 select CLKSRC_MMIO
8 select GENERIC_CLOCKEVENTS
9 select GENERIC_IRQ_CHIP
10 select MULTI_IRQ_HANDLER
11 select SPARSE_IRQ
12 select USE_OF
13 help
14 Support for Freescale MXC/iMX-based family of processors
15
16menu "Freescale i.MX support"
17 depends on ARCH_MXC
18
19config MXC_IRQ_PRIOR
20 bool "Use IRQ priority"
21 help
22 Select this if you want to use prioritized IRQ handling.
23 This feature prevents higher priority ISR to be interrupted
24 by lower priority IRQ even IRQF_DISABLED flag is not set.
25 This may be useful in embedded applications, where are strong
26 requirements for timing.
27 Say N here, unless you have a specialized requirement.
28
29config MXC_TZIC
30 bool
31
32config MXC_AVIC
33 bool
34
35config MXC_DEBUG_BOARD
36 bool "Enable MXC debug board(for 3-stack)"
37 help
38 The debug board is an integral part of the MXC 3-stack(PDK)
39 platforms, it can be attached or removed from the peripheral
40 board. On debug board, several debug devices(ethernet, UART,
41 buttons, LEDs and JTAG) are implemented. Between the MCU and
42 these devices, a CPLD is added as a bridge which performs
43 data/address de-multiplexing and decode, signal level shift,
44 interrupt control and various board functions.
45
46config HAVE_EPIT
47 bool
48
49config MXC_USE_EPIT
50 bool "Use EPIT instead of GPT"
51 depends on HAVE_EPIT
52 help
53 Use EPIT as the system timer on systems that have it. Normally you
54 don't have a reason to do so as the EPIT has the same features and
55 uses the same clocks as the GPT. Anyway, on some systems the GPT
56 may be in use for other purposes.
57
58config MXC_ULPI
59 bool
60
61config ARCH_HAS_RNGA
62 bool
63
64config IRAM_ALLOC
65 bool
66 select GENERIC_ALLOCATOR
67
1config HAVE_IMX_GPC 68config HAVE_IMX_GPC
2 bool 69 bool
3 70
@@ -5,6 +72,12 @@ config HAVE_IMX_MMDC
5 bool 72 bool
6 73
7config HAVE_IMX_SRC 74config HAVE_IMX_SRC
75 def_bool y if SMP
76
77config IMX_HAVE_IOMUX_V1
78 bool
79
80config ARCH_MXC_IOMUX_V3
8 bool 81 bool
9 82
10config ARCH_MX1 83config ARCH_MX1
@@ -104,7 +177,7 @@ config SOC_IMX51
104 select PINCTRL_IMX51 177 select PINCTRL_IMX51
105 select SOC_IMX5 178 select SOC_IMX5
106 179
107if ARCH_IMX_V4_V5 180if ARCH_MULTI_V4T
108 181
109comment "MX1 platforms:" 182comment "MX1 platforms:"
110config MACH_MXLADS 183config MACH_MXLADS
@@ -133,6 +206,10 @@ config MACH_APF9328
133 help 206 help
134 Say Yes here if you are using the Armadeus APF9328 development board 207 Say Yes here if you are using the Armadeus APF9328 development board
135 208
209endif
210
211if ARCH_MULTI_V5
212
136comment "MX21 platforms:" 213comment "MX21 platforms:"
137 214
138config MACH_MX21ADS 215config MACH_MX21ADS
@@ -195,6 +272,13 @@ config MACH_EUKREA_MBIMXSD25_BASEBOARD
195 272
196endchoice 273endchoice
197 274
275config MACH_IMX25_DT
276 bool "Support i.MX25 platforms from device tree"
277 select SOC_IMX25
278 help
279 Include support for Freescale i.MX25 based platforms
280 using the device tree for discovery
281
198comment "MX27 platforms:" 282comment "MX27 platforms:"
199 283
200config MACH_MX27ADS 284config MACH_MX27ADS
@@ -317,6 +401,7 @@ config MACH_IMX27_VISSTRIM_M10
317 select IMX_HAVE_PLATFORM_IMX_SSI 401 select IMX_HAVE_PLATFORM_IMX_SSI
318 select IMX_HAVE_PLATFORM_IMX_UART 402 select IMX_HAVE_PLATFORM_IMX_UART
319 select IMX_HAVE_PLATFORM_MX2_CAMERA 403 select IMX_HAVE_PLATFORM_MX2_CAMERA
404 select IMX_HAVE_PLATFORM_MX2_EMMA
320 select IMX_HAVE_PLATFORM_MXC_EHCI 405 select IMX_HAVE_PLATFORM_MXC_EHCI
321 select IMX_HAVE_PLATFORM_MXC_MMC 406 select IMX_HAVE_PLATFORM_MXC_MMC
322 select LEDS_GPIO_REGISTER 407 select LEDS_GPIO_REGISTER
@@ -384,7 +469,7 @@ config MACH_IMX27_DT
384 469
385endif 470endif
386 471
387if ARCH_IMX_V6_V7 472if ARCH_MULTI_V6
388 473
389comment "MX31 platforms:" 474comment "MX31 platforms:"
390 475
@@ -649,6 +734,10 @@ config MACH_VPR200
649 Include support for VPR200 platform. This includes specific 734 Include support for VPR200 platform. This includes specific
650 configurations for the board and its peripherals. 735 configurations for the board and its peripherals.
651 736
737endif
738
739if ARCH_MULTI_V7
740
652comment "i.MX5 platforms:" 741comment "i.MX5 platforms:"
653 742
654config MACH_MX50_RDP 743config MACH_MX50_RDP
@@ -739,6 +828,7 @@ config SOC_IMX53
739 select ARCH_MX5 828 select ARCH_MX5
740 select ARCH_MX53 829 select ARCH_MX53
741 select HAVE_CAN_FLEXCAN if CAN 830 select HAVE_CAN_FLEXCAN if CAN
831 select IMX_HAVE_PLATFORM_IMX2_WDT
742 select PINCTRL 832 select PINCTRL
743 select PINCTRL_IMX53 833 select PINCTRL_IMX53
744 select SOC_IMX5 834 select SOC_IMX5
@@ -748,7 +838,14 @@ config SOC_IMX53
748 838
749config SOC_IMX6Q 839config SOC_IMX6Q
750 bool "i.MX6 Quad support" 840 bool "i.MX6 Quad support"
841 select ARCH_HAS_CPUFREQ
842 select ARCH_HAS_OPP
751 select ARM_CPU_SUSPEND if PM 843 select ARM_CPU_SUSPEND if PM
844 select ARM_ERRATA_743622
845 select ARM_ERRATA_751472
846 select ARM_ERRATA_754322
847 select ARM_ERRATA_764369 if SMP
848 select ARM_ERRATA_775420
752 select ARM_GIC 849 select ARM_GIC
753 select COMMON_CLK 850 select COMMON_CLK
754 select CPU_V7 851 select CPU_V7
@@ -756,13 +853,20 @@ config SOC_IMX6Q
756 select HAVE_CAN_FLEXCAN if CAN 853 select HAVE_CAN_FLEXCAN if CAN
757 select HAVE_IMX_GPC 854 select HAVE_IMX_GPC
758 select HAVE_IMX_MMDC 855 select HAVE_IMX_MMDC
759 select HAVE_IMX_SRC
760 select HAVE_SMP 856 select HAVE_SMP
761 select MFD_SYSCON 857 select MFD_SYSCON
762 select PINCTRL 858 select PINCTRL
763 select PINCTRL_IMX6Q 859 select PINCTRL_IMX6Q
860 select PL310_ERRATA_588369 if CACHE_PL310
861 select PL310_ERRATA_727915 if CACHE_PL310
862 select PL310_ERRATA_769419 if CACHE_PL310
863 select PM_OPP if PM
764 864
765 help 865 help
766 This enables support for Freescale i.MX6 Quad processor. 866 This enables support for Freescale i.MX6 Quad processor.
767 867
768endif 868endif
869
870source "arch/arm/mach-imx/devices/Kconfig"
871
872endmenu
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 895754aeb4f..0634b3152c2 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -1,3 +1,5 @@
1obj-y := time.o cpu.o system.o irq-common.o
2
1obj-$(CONFIG_SOC_IMX1) += clk-imx1.o mm-imx1.o 3obj-$(CONFIG_SOC_IMX1) += clk-imx1.o mm-imx1.o
2obj-$(CONFIG_SOC_IMX21) += clk-imx21.o mm-imx21.o 4obj-$(CONFIG_SOC_IMX21) += clk-imx21.o mm-imx21.o
3 5
@@ -15,6 +17,24 @@ obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(i
15obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \ 17obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \
16 clk-pfd.o clk-busy.o clk.o 18 clk-pfd.o clk-busy.o clk.o
17 19
20obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
21obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
22
23obj-$(CONFIG_MXC_TZIC) += tzic.o
24obj-$(CONFIG_MXC_AVIC) += avic.o
25
26obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
27obj-$(CONFIG_MXC_ULPI) += ulpi.o
28obj-$(CONFIG_MXC_USE_EPIT) += epit.o
29obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
30obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
31obj-$(CONFIG_CPU_IDLE) += cpuidle.o
32
33ifdef CONFIG_SND_IMX_SOC
34obj-y += ssi-fiq.o
35obj-y += ssi-fiq-ksym.o
36endif
37
18# Support for CMOS sensor interface 38# Support for CMOS sensor interface
19obj-$(CONFIG_MX1_VIDEO) += mx1-camera-fiq.o mx1-camera-fiq-ksym.o 39obj-$(CONFIG_MX1_VIDEO) += mx1-camera-fiq.o mx1-camera-fiq-ksym.o
20 40
@@ -30,6 +50,7 @@ obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
30obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o 50obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o
31obj-$(CONFIG_MACH_EUKREA_CPUIMX25SD) += mach-eukrea_cpuimx25.o 51obj-$(CONFIG_MACH_EUKREA_CPUIMX25SD) += mach-eukrea_cpuimx25.o
32obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD) += eukrea_mbimxsd25-baseboard.o 52obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD) += eukrea_mbimxsd25-baseboard.o
53obj-$(CONFIG_MACH_IMX25_DT) += imx25-dt.o
33 54
34# i.MX27 based machines 55# i.MX27 based machines
35obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o 56obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
@@ -89,3 +110,5 @@ obj-$(CONFIG_MACH_MX50_RDP) += mach-mx50_rdp.o
89 110
90obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o 111obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
91obj-$(CONFIG_SOC_IMX53) += mach-imx53.o 112obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
113
114obj-y += devices/
diff --git a/arch/arm/plat-mxc/avic.c b/arch/arm/mach-imx/avic.c
index cbd55c36def..0eff23ed92b 100644
--- a/arch/arm/plat-mxc/avic.c
+++ b/arch/arm/mach-imx/avic.c
@@ -22,12 +22,11 @@
22#include <linux/irqdomain.h> 22#include <linux/irqdomain.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <mach/common.h>
26#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
27#include <asm/exception.h> 26#include <asm/exception.h>
28#include <mach/hardware.h>
29#include <mach/irqs.h>
30 27
28#include "common.h"
29#include "hardware.h"
31#include "irq-common.h" 30#include "irq-common.h"
32 31
33#define AVIC_INTCNTL 0x00 /* int control reg */ 32#define AVIC_INTCNTL 0x00 /* int control reg */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lilly.h b/arch/arm/mach-imx/board-mx31lilly.h
index 0df71bfefbb..0df71bfefbb 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31lilly.h
+++ b/arch/arm/mach-imx/board-mx31lilly.h
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lite.h b/arch/arm/mach-imx/board-mx31lite.h
index c1ad0ae807c..c1ad0ae807c 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31lite.h
+++ b/arch/arm/mach-imx/board-mx31lite.h
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/mach-imx/board-mx31moboard.h
index de14543891c..de14543891c 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
+++ b/arch/arm/mach-imx/board-mx31moboard.h
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm038.h b/arch/arm/mach-imx/board-pcm038.h
index 6f371e35753..6f371e35753 100644
--- a/arch/arm/plat-mxc/include/mach/board-pcm038.h
+++ b/arch/arm/mach-imx/board-pcm038.h
diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 516ddee1948..15f9d223cf0 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -22,9 +22,9 @@
22#include <linux/clkdev.h> 22#include <linux/clkdev.h>
23#include <linux/err.h> 23#include <linux/err.h>
24 24
25#include <mach/hardware.h>
26#include <mach/common.h>
27#include "clk.h" 25#include "clk.h"
26#include "common.h"
27#include "hardware.h"
28 28
29/* CCM register addresses */ 29/* CCM register addresses */
30#define IO_ADDR_CCM(off) (MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR + (off))) 30#define IO_ADDR_CCM(off) (MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR + (off)))
@@ -82,7 +82,8 @@ int __init mx1_clocks_init(unsigned long fref)
82 pr_err("imx1 clk %d: register failed with %ld\n", 82 pr_err("imx1 clk %d: register failed with %ld\n",
83 i, PTR_ERR(clk[i])); 83 i, PTR_ERR(clk[i]));
84 84
85 clk_register_clkdev(clk[dma_gate], "ahb", "imx-dma"); 85 clk_register_clkdev(clk[dma_gate], "ahb", "imx1-dma");
86 clk_register_clkdev(clk[hclk], "ipg", "imx1-dma");
86 clk_register_clkdev(clk[csi_gate], NULL, "mx1-camera.0"); 87 clk_register_clkdev(clk[csi_gate], NULL, "mx1-camera.0");
87 clk_register_clkdev(clk[mma_gate], "mma", NULL); 88 clk_register_clkdev(clk[mma_gate], "mma", NULL);
88 clk_register_clkdev(clk[usbd_gate], NULL, "imx_udc.0"); 89 clk_register_clkdev(clk[usbd_gate], NULL, "imx_udc.0");
@@ -94,18 +95,18 @@ int __init mx1_clocks_init(unsigned long fref)
94 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.1"); 95 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.1");
95 clk_register_clkdev(clk[per1], "per", "imx1-uart.2"); 96 clk_register_clkdev(clk[per1], "per", "imx1-uart.2");
96 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.2"); 97 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.2");
97 clk_register_clkdev(clk[hclk], NULL, "imx-i2c.0"); 98 clk_register_clkdev(clk[hclk], NULL, "imx1-i2c.0");
98 clk_register_clkdev(clk[per2], "per", "imx1-cspi.0"); 99 clk_register_clkdev(clk[per2], "per", "imx1-cspi.0");
99 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.0"); 100 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.0");
100 clk_register_clkdev(clk[per2], "per", "imx1-cspi.1"); 101 clk_register_clkdev(clk[per2], "per", "imx1-cspi.1");
101 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.1"); 102 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.1");
102 clk_register_clkdev(clk[per2], NULL, "imx-mmc.0"); 103 clk_register_clkdev(clk[per2], NULL, "imx-mmc.0");
103 clk_register_clkdev(clk[per2], "per", "imx-fb.0"); 104 clk_register_clkdev(clk[per2], "per", "imx1-fb.0");
104 clk_register_clkdev(clk[dummy], "ipg", "imx-fb.0"); 105 clk_register_clkdev(clk[dummy], "ipg", "imx1-fb.0");
105 clk_register_clkdev(clk[dummy], "ahb", "imx-fb.0"); 106 clk_register_clkdev(clk[dummy], "ahb", "imx1-fb.0");
106 clk_register_clkdev(clk[hclk], "mshc", NULL); 107 clk_register_clkdev(clk[hclk], "mshc", NULL);
107 clk_register_clkdev(clk[per3], "ssi", NULL); 108 clk_register_clkdev(clk[per3], "ssi", NULL);
108 clk_register_clkdev(clk[clk32], NULL, "mxc_rtc.0"); 109 clk_register_clkdev(clk[clk32], NULL, "imx1-rtc.0");
109 clk_register_clkdev(clk[clko], "clko", NULL); 110 clk_register_clkdev(clk[clko], "clko", NULL);
110 111
111 mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT); 112 mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT);
diff --git a/arch/arm/mach-imx/clk-imx21.c b/arch/arm/mach-imx/clk-imx21.c
index cf65148bc51..d7ed66091a2 100644
--- a/arch/arm/mach-imx/clk-imx21.c
+++ b/arch/arm/mach-imx/clk-imx21.c
@@ -25,9 +25,9 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/err.h> 26#include <linux/err.h>
27 27
28#include <mach/hardware.h>
29#include <mach/common.h>
30#include "clk.h" 28#include "clk.h"
29#include "common.h"
30#include "hardware.h"
31 31
32#define IO_ADDR_CCM(off) (MX21_IO_ADDRESS(MX21_CCM_BASE_ADDR + (off))) 32#define IO_ADDR_CCM(off) (MX21_IO_ADDRESS(MX21_CCM_BASE_ADDR + (off)))
33 33
@@ -156,16 +156,16 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
156 clk_register_clkdev(clk[cspi2_ipg_gate], "ipg", "imx21-cspi.1"); 156 clk_register_clkdev(clk[cspi2_ipg_gate], "ipg", "imx21-cspi.1");
157 clk_register_clkdev(clk[per2], "per", "imx21-cspi.2"); 157 clk_register_clkdev(clk[per2], "per", "imx21-cspi.2");
158 clk_register_clkdev(clk[cspi3_ipg_gate], "ipg", "imx21-cspi.2"); 158 clk_register_clkdev(clk[cspi3_ipg_gate], "ipg", "imx21-cspi.2");
159 clk_register_clkdev(clk[per3], "per", "imx-fb.0"); 159 clk_register_clkdev(clk[per3], "per", "imx21-fb.0");
160 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0"); 160 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx21-fb.0");
161 clk_register_clkdev(clk[lcdc_hclk_gate], "ahb", "imx-fb.0"); 161 clk_register_clkdev(clk[lcdc_hclk_gate], "ahb", "imx21-fb.0");
162 clk_register_clkdev(clk[usb_gate], "per", "imx21-hcd.0"); 162 clk_register_clkdev(clk[usb_gate], "per", "imx21-hcd.0");
163 clk_register_clkdev(clk[usb_hclk_gate], "ahb", "imx21-hcd.0"); 163 clk_register_clkdev(clk[usb_hclk_gate], "ahb", "imx21-hcd.0");
164 clk_register_clkdev(clk[nfc_gate], NULL, "mxc_nand.0"); 164 clk_register_clkdev(clk[nfc_gate], NULL, "imx21-nand.0");
165 clk_register_clkdev(clk[dma_hclk_gate], "ahb", "imx-dma"); 165 clk_register_clkdev(clk[dma_hclk_gate], "ahb", "imx21-dma");
166 clk_register_clkdev(clk[dma_gate], "ipg", "imx-dma"); 166 clk_register_clkdev(clk[dma_gate], "ipg", "imx21-dma");
167 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0"); 167 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
168 clk_register_clkdev(clk[i2c_gate], NULL, "imx-i2c.0"); 168 clk_register_clkdev(clk[i2c_gate], NULL, "imx21-i2c.0");
169 clk_register_clkdev(clk[kpp_gate], NULL, "mxc-keypad"); 169 clk_register_clkdev(clk[kpp_gate], NULL, "mxc-keypad");
170 clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0"); 170 clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0");
171 clk_register_clkdev(clk[brom_gate], "brom", NULL); 171 clk_register_clkdev(clk[brom_gate], "brom", NULL);
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index 01e2f843bf2..b197aa73dc4 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -23,11 +23,14 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/of.h>
27#include <linux/of_address.h>
28#include <linux/of_irq.h>
26 29
27#include <mach/hardware.h>
28#include <mach/common.h>
29#include <mach/mx25.h>
30#include "clk.h" 30#include "clk.h"
31#include "common.h"
32#include "hardware.h"
33#include "mx25.h"
31 34
32#define CRM_BASE MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR) 35#define CRM_BASE MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR)
33 36
@@ -55,6 +58,8 @@
55 58
56#define ccm(x) (CRM_BASE + (x)) 59#define ccm(x) (CRM_BASE + (x))
57 60
61static struct clk_onecell_data clk_data;
62
58static const char *cpu_sel_clks[] = { "mpll", "mpll_cpu_3_4", }; 63static const char *cpu_sel_clks[] = { "mpll", "mpll_cpu_3_4", };
59static const char *per_sel_clks[] = { "ahb", "upll", }; 64static const char *per_sel_clks[] = { "ahb", "upll", };
60 65
@@ -64,24 +69,30 @@ enum mx25_clks {
64 per7_sel, per8_sel, per9_sel, per10_sel, per11_sel, per12_sel, 69 per7_sel, per8_sel, per9_sel, per10_sel, per11_sel, per12_sel,
65 per13_sel, per14_sel, per15_sel, per0, per1, per2, per3, per4, per5, 70 per13_sel, per14_sel, per15_sel, per0, per1, per2, per3, per4, per5,
66 per6, per7, per8, per9, per10, per11, per12, per13, per14, per15, 71 per6, per7, per8, per9, per10, per11, per12, per13, per14, per15,
67 csi_ipg_per, esdhc1_ipg_per, esdhc2_ipg_per, gpt_ipg_per, i2c_ipg_per, 72 csi_ipg_per, epit_ipg_per, esai_ipg_per, esdhc1_ipg_per, esdhc2_ipg_per,
68 lcdc_ipg_per, nfc_ipg_per, ssi1_ipg_per, ssi2_ipg_per, uart_ipg_per, 73 gpt_ipg_per, i2c_ipg_per, lcdc_ipg_per, nfc_ipg_per, owire_ipg_per,
69 csi_ahb, esdhc1_ahb, esdhc2_ahb, fec_ahb, lcdc_ahb, sdma_ahb, 74 pwm_ipg_per, sim1_ipg_per, sim2_ipg_per, ssi1_ipg_per, ssi2_ipg_per,
70 usbotg_ahb, can1_ipg, can2_ipg, csi_ipg, cspi1_ipg, cspi2_ipg, 75 uart_ipg_per, ata_ahb, reserved1, csi_ahb, emi_ahb, esai_ahb, esdhc1_ahb,
71 cspi3_ipg, dryice_ipg, esdhc1_ipg, esdhc2_ipg, fec_ipg, iim_ipg, 76 esdhc2_ahb, fec_ahb, lcdc_ahb, rtic_ahb, sdma_ahb, slcdc_ahb, usbotg_ahb,
72 kpp_ipg, lcdc_ipg, pwm1_ipg, pwm2_ipg, pwm3_ipg, pwm4_ipg, sdma_ipg, 77 reserved2, reserved3, reserved4, reserved5, can1_ipg, can2_ipg, csi_ipg,
73 ssi1_ipg, ssi2_ipg, tsc_ipg, uart1_ipg, uart2_ipg, uart3_ipg, 78 cspi1_ipg, cspi2_ipg, cspi3_ipg, dryice_ipg, ect_ipg, epit1_ipg, epit2_ipg,
74 uart4_ipg, uart5_ipg, wdt_ipg, clk_max 79 reserved6, esdhc1_ipg, esdhc2_ipg, fec_ipg, reserved7, reserved8, reserved9,
80 gpt1_ipg, gpt2_ipg, gpt3_ipg, gpt4_ipg, reserved10, reserved11, reserved12,
81 iim_ipg, reserved13, reserved14, kpp_ipg, lcdc_ipg, reserved15, pwm1_ipg,
82 pwm2_ipg, pwm3_ipg, pwm4_ipg, rngb_ipg, reserved16, scc_ipg, sdma_ipg,
83 sim1_ipg, sim2_ipg, slcdc_ipg, spba_ipg, ssi1_ipg, ssi2_ipg, tsc_ipg,
84 uart1_ipg, uart2_ipg, uart3_ipg, uart4_ipg, uart5_ipg, reserved17,
85 wdt_ipg, clk_max
75}; 86};
76 87
77static struct clk *clk[clk_max]; 88static struct clk *clk[clk_max];
78 89
79int __init mx25_clocks_init(void) 90static int __init __mx25_clocks_init(unsigned long osc_rate)
80{ 91{
81 int i; 92 int i;
82 93
83 clk[dummy] = imx_clk_fixed("dummy", 0); 94 clk[dummy] = imx_clk_fixed("dummy", 0);
84 clk[osc] = imx_clk_fixed("osc", 24000000); 95 clk[osc] = imx_clk_fixed("osc", osc_rate);
85 clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL)); 96 clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL));
86 clk[upll] = imx_clk_pllv1("upll", "osc", ccm(CCM_UPCTL)); 97 clk[upll] = imx_clk_pllv1("upll", "osc", ccm(CCM_UPCTL));
87 clk[mpll_cpu_3_4] = imx_clk_fixed_factor("mpll_cpu_3_4", "mpll", 3, 4); 98 clk[mpll_cpu_3_4] = imx_clk_fixed_factor("mpll_cpu_3_4", "mpll", 3, 4);
@@ -123,22 +134,36 @@ int __init mx25_clocks_init(void)
123 clk[per14] = imx_clk_divider("per14", "per14_sel", ccm(CCM_PCDR3), 16, 6); 134 clk[per14] = imx_clk_divider("per14", "per14_sel", ccm(CCM_PCDR3), 16, 6);
124 clk[per15] = imx_clk_divider("per15", "per15_sel", ccm(CCM_PCDR3), 24, 6); 135 clk[per15] = imx_clk_divider("per15", "per15_sel", ccm(CCM_PCDR3), 24, 6);
125 clk[csi_ipg_per] = imx_clk_gate("csi_ipg_per", "per0", ccm(CCM_CGCR0), 0); 136 clk[csi_ipg_per] = imx_clk_gate("csi_ipg_per", "per0", ccm(CCM_CGCR0), 0);
137 clk[epit_ipg_per] = imx_clk_gate("epit_ipg_per", "per1", ccm(CCM_CGCR0), 1);
138 clk[esai_ipg_per] = imx_clk_gate("esai_ipg_per", "per2", ccm(CCM_CGCR0), 2);
126 clk[esdhc1_ipg_per] = imx_clk_gate("esdhc1_ipg_per", "per3", ccm(CCM_CGCR0), 3); 139 clk[esdhc1_ipg_per] = imx_clk_gate("esdhc1_ipg_per", "per3", ccm(CCM_CGCR0), 3);
127 clk[esdhc2_ipg_per] = imx_clk_gate("esdhc2_ipg_per", "per4", ccm(CCM_CGCR0), 4); 140 clk[esdhc2_ipg_per] = imx_clk_gate("esdhc2_ipg_per", "per4", ccm(CCM_CGCR0), 4);
128 clk[gpt_ipg_per] = imx_clk_gate("gpt_ipg_per", "per5", ccm(CCM_CGCR0), 5); 141 clk[gpt_ipg_per] = imx_clk_gate("gpt_ipg_per", "per5", ccm(CCM_CGCR0), 5);
129 clk[i2c_ipg_per] = imx_clk_gate("i2c_ipg_per", "per6", ccm(CCM_CGCR0), 6); 142 clk[i2c_ipg_per] = imx_clk_gate("i2c_ipg_per", "per6", ccm(CCM_CGCR0), 6);
130 clk[lcdc_ipg_per] = imx_clk_gate("lcdc_ipg_per", "per7", ccm(CCM_CGCR0), 7); 143 clk[lcdc_ipg_per] = imx_clk_gate("lcdc_ipg_per", "per7", ccm(CCM_CGCR0), 7);
131 clk[nfc_ipg_per] = imx_clk_gate("nfc_ipg_per", "per8", ccm(CCM_CGCR0), 8); 144 clk[nfc_ipg_per] = imx_clk_gate("nfc_ipg_per", "per8", ccm(CCM_CGCR0), 8);
145 clk[owire_ipg_per] = imx_clk_gate("owire_ipg_per", "per9", ccm(CCM_CGCR0), 9);
146 clk[pwm_ipg_per] = imx_clk_gate("pwm_ipg_per", "per10", ccm(CCM_CGCR0), 10);
147 clk[sim1_ipg_per] = imx_clk_gate("sim1_ipg_per", "per11", ccm(CCM_CGCR0), 11);
148 clk[sim2_ipg_per] = imx_clk_gate("sim2_ipg_per", "per12", ccm(CCM_CGCR0), 12);
132 clk[ssi1_ipg_per] = imx_clk_gate("ssi1_ipg_per", "per13", ccm(CCM_CGCR0), 13); 149 clk[ssi1_ipg_per] = imx_clk_gate("ssi1_ipg_per", "per13", ccm(CCM_CGCR0), 13);
133 clk[ssi2_ipg_per] = imx_clk_gate("ssi2_ipg_per", "per14", ccm(CCM_CGCR0), 14); 150 clk[ssi2_ipg_per] = imx_clk_gate("ssi2_ipg_per", "per14", ccm(CCM_CGCR0), 14);
134 clk[uart_ipg_per] = imx_clk_gate("uart_ipg_per", "per15", ccm(CCM_CGCR0), 15); 151 clk[uart_ipg_per] = imx_clk_gate("uart_ipg_per", "per15", ccm(CCM_CGCR0), 15);
152 clk[ata_ahb] = imx_clk_gate("ata_ahb", "ahb", ccm(CCM_CGCR0), 16);
153 /* CCM_CGCR0(17): reserved */
135 clk[csi_ahb] = imx_clk_gate("csi_ahb", "ahb", ccm(CCM_CGCR0), 18); 154 clk[csi_ahb] = imx_clk_gate("csi_ahb", "ahb", ccm(CCM_CGCR0), 18);
155 clk[emi_ahb] = imx_clk_gate("emi_ahb", "ahb", ccm(CCM_CGCR0), 19);
156 clk[esai_ahb] = imx_clk_gate("esai_ahb", "ahb", ccm(CCM_CGCR0), 20);
136 clk[esdhc1_ahb] = imx_clk_gate("esdhc1_ahb", "ahb", ccm(CCM_CGCR0), 21); 157 clk[esdhc1_ahb] = imx_clk_gate("esdhc1_ahb", "ahb", ccm(CCM_CGCR0), 21);
137 clk[esdhc2_ahb] = imx_clk_gate("esdhc2_ahb", "ahb", ccm(CCM_CGCR0), 22); 158 clk[esdhc2_ahb] = imx_clk_gate("esdhc2_ahb", "ahb", ccm(CCM_CGCR0), 22);
138 clk[fec_ahb] = imx_clk_gate("fec_ahb", "ahb", ccm(CCM_CGCR0), 23); 159 clk[fec_ahb] = imx_clk_gate("fec_ahb", "ahb", ccm(CCM_CGCR0), 23);
139 clk[lcdc_ahb] = imx_clk_gate("lcdc_ahb", "ahb", ccm(CCM_CGCR0), 24); 160 clk[lcdc_ahb] = imx_clk_gate("lcdc_ahb", "ahb", ccm(CCM_CGCR0), 24);
161 clk[rtic_ahb] = imx_clk_gate("rtic_ahb", "ahb", ccm(CCM_CGCR0), 25);
140 clk[sdma_ahb] = imx_clk_gate("sdma_ahb", "ahb", ccm(CCM_CGCR0), 26); 162 clk[sdma_ahb] = imx_clk_gate("sdma_ahb", "ahb", ccm(CCM_CGCR0), 26);
163 clk[slcdc_ahb] = imx_clk_gate("slcdc_ahb", "ahb", ccm(CCM_CGCR0), 27);
141 clk[usbotg_ahb] = imx_clk_gate("usbotg_ahb", "ahb", ccm(CCM_CGCR0), 28); 164 clk[usbotg_ahb] = imx_clk_gate("usbotg_ahb", "ahb", ccm(CCM_CGCR0), 28);
165 /* CCM_CGCR0(29-31): reserved */
166 /* CCM_CGCR1(0): reserved in datasheet, used as audmux in FSL kernel */
142 clk[can1_ipg] = imx_clk_gate("can1_ipg", "ipg", ccm(CCM_CGCR1), 2); 167 clk[can1_ipg] = imx_clk_gate("can1_ipg", "ipg", ccm(CCM_CGCR1), 2);
143 clk[can2_ipg] = imx_clk_gate("can2_ipg", "ipg", ccm(CCM_CGCR1), 3); 168 clk[can2_ipg] = imx_clk_gate("can2_ipg", "ipg", ccm(CCM_CGCR1), 3);
144 clk[csi_ipg] = imx_clk_gate("csi_ipg", "ipg", ccm(CCM_CGCR1), 4); 169 clk[csi_ipg] = imx_clk_gate("csi_ipg", "ipg", ccm(CCM_CGCR1), 4);
@@ -146,17 +171,41 @@ int __init mx25_clocks_init(void)
146 clk[cspi2_ipg] = imx_clk_gate("cspi2_ipg", "ipg", ccm(CCM_CGCR1), 6); 171 clk[cspi2_ipg] = imx_clk_gate("cspi2_ipg", "ipg", ccm(CCM_CGCR1), 6);
147 clk[cspi3_ipg] = imx_clk_gate("cspi3_ipg", "ipg", ccm(CCM_CGCR1), 7); 172 clk[cspi3_ipg] = imx_clk_gate("cspi3_ipg", "ipg", ccm(CCM_CGCR1), 7);
148 clk[dryice_ipg] = imx_clk_gate("dryice_ipg", "ipg", ccm(CCM_CGCR1), 8); 173 clk[dryice_ipg] = imx_clk_gate("dryice_ipg", "ipg", ccm(CCM_CGCR1), 8);
174 clk[ect_ipg] = imx_clk_gate("ect_ipg", "ipg", ccm(CCM_CGCR1), 9);
175 clk[epit1_ipg] = imx_clk_gate("epit1_ipg", "ipg", ccm(CCM_CGCR1), 10);
176 clk[epit2_ipg] = imx_clk_gate("epit2_ipg", "ipg", ccm(CCM_CGCR1), 11);
177 /* CCM_CGCR1(12): reserved in datasheet, used as esai in FSL kernel */
149 clk[esdhc1_ipg] = imx_clk_gate("esdhc1_ipg", "ipg", ccm(CCM_CGCR1), 13); 178 clk[esdhc1_ipg] = imx_clk_gate("esdhc1_ipg", "ipg", ccm(CCM_CGCR1), 13);
150 clk[esdhc2_ipg] = imx_clk_gate("esdhc2_ipg", "ipg", ccm(CCM_CGCR1), 14); 179 clk[esdhc2_ipg] = imx_clk_gate("esdhc2_ipg", "ipg", ccm(CCM_CGCR1), 14);
151 clk[fec_ipg] = imx_clk_gate("fec_ipg", "ipg", ccm(CCM_CGCR1), 15); 180 clk[fec_ipg] = imx_clk_gate("fec_ipg", "ipg", ccm(CCM_CGCR1), 15);
181 /* CCM_CGCR1(16): reserved in datasheet, used as gpio1 in FSL kernel */
182 /* CCM_CGCR1(17): reserved in datasheet, used as gpio2 in FSL kernel */
183 /* CCM_CGCR1(18): reserved in datasheet, used as gpio3 in FSL kernel */
184 clk[gpt1_ipg] = imx_clk_gate("gpt1_ipg", "ipg", ccm(CCM_CGCR1), 19);
185 clk[gpt2_ipg] = imx_clk_gate("gpt2_ipg", "ipg", ccm(CCM_CGCR1), 20);
186 clk[gpt3_ipg] = imx_clk_gate("gpt3_ipg", "ipg", ccm(CCM_CGCR1), 21);
187 clk[gpt4_ipg] = imx_clk_gate("gpt4_ipg", "ipg", ccm(CCM_CGCR1), 22);
188 /* CCM_CGCR1(23): reserved in datasheet, used as i2c1 in FSL kernel */
189 /* CCM_CGCR1(24): reserved in datasheet, used as i2c2 in FSL kernel */
190 /* CCM_CGCR1(25): reserved in datasheet, used as i2c3 in FSL kernel */
152 clk[iim_ipg] = imx_clk_gate("iim_ipg", "ipg", ccm(CCM_CGCR1), 26); 191 clk[iim_ipg] = imx_clk_gate("iim_ipg", "ipg", ccm(CCM_CGCR1), 26);
192 /* CCM_CGCR1(27): reserved in datasheet, used as iomuxc in FSL kernel */
193 /* CCM_CGCR1(28): reserved in datasheet, used as kpp in FSL kernel */
153 clk[kpp_ipg] = imx_clk_gate("kpp_ipg", "ipg", ccm(CCM_CGCR1), 28); 194 clk[kpp_ipg] = imx_clk_gate("kpp_ipg", "ipg", ccm(CCM_CGCR1), 28);
154 clk[lcdc_ipg] = imx_clk_gate("lcdc_ipg", "ipg", ccm(CCM_CGCR1), 29); 195 clk[lcdc_ipg] = imx_clk_gate("lcdc_ipg", "ipg", ccm(CCM_CGCR1), 29);
196 /* CCM_CGCR1(30): reserved in datasheet, used as owire in FSL kernel */
155 clk[pwm1_ipg] = imx_clk_gate("pwm1_ipg", "ipg", ccm(CCM_CGCR1), 31); 197 clk[pwm1_ipg] = imx_clk_gate("pwm1_ipg", "ipg", ccm(CCM_CGCR1), 31);
156 clk[pwm2_ipg] = imx_clk_gate("pwm2_ipg", "ipg", ccm(CCM_CGCR2), 0); 198 clk[pwm2_ipg] = imx_clk_gate("pwm2_ipg", "ipg", ccm(CCM_CGCR2), 0);
157 clk[pwm3_ipg] = imx_clk_gate("pwm3_ipg", "ipg", ccm(CCM_CGCR2), 1); 199 clk[pwm3_ipg] = imx_clk_gate("pwm3_ipg", "ipg", ccm(CCM_CGCR2), 1);
158 clk[pwm4_ipg] = imx_clk_gate("pwm4_ipg", "ipg", ccm(CCM_CGCR2), 2); 200 clk[pwm4_ipg] = imx_clk_gate("pwm4_ipg", "ipg", ccm(CCM_CGCR2), 2);
201 clk[rngb_ipg] = imx_clk_gate("rngb_ipg", "ipg", ccm(CCM_CGCR2), 3);
202 /* CCM_CGCR2(4): reserved in datasheet, used as rtic in FSL kernel */
203 clk[scc_ipg] = imx_clk_gate("scc_ipg", "ipg", ccm(CCM_CGCR2), 5);
159 clk[sdma_ipg] = imx_clk_gate("sdma_ipg", "ipg", ccm(CCM_CGCR2), 6); 204 clk[sdma_ipg] = imx_clk_gate("sdma_ipg", "ipg", ccm(CCM_CGCR2), 6);
205 clk[sim1_ipg] = imx_clk_gate("sim1_ipg", "ipg", ccm(CCM_CGCR2), 7);
206 clk[sim2_ipg] = imx_clk_gate("sim2_ipg", "ipg", ccm(CCM_CGCR2), 8);
207 clk[slcdc_ipg] = imx_clk_gate("slcdc_ipg", "ipg", ccm(CCM_CGCR2), 9);
208 clk[spba_ipg] = imx_clk_gate("spba_ipg", "ipg", ccm(CCM_CGCR2), 10);
160 clk[ssi1_ipg] = imx_clk_gate("ssi1_ipg", "ipg", ccm(CCM_CGCR2), 11); 209 clk[ssi1_ipg] = imx_clk_gate("ssi1_ipg", "ipg", ccm(CCM_CGCR2), 11);
161 clk[ssi2_ipg] = imx_clk_gate("ssi2_ipg", "ipg", ccm(CCM_CGCR2), 12); 210 clk[ssi2_ipg] = imx_clk_gate("ssi2_ipg", "ipg", ccm(CCM_CGCR2), 12);
162 clk[tsc_ipg] = imx_clk_gate("tsc_ipg", "ipg", ccm(CCM_CGCR2), 13); 211 clk[tsc_ipg] = imx_clk_gate("tsc_ipg", "ipg", ccm(CCM_CGCR2), 13);
@@ -165,6 +214,7 @@ int __init mx25_clocks_init(void)
165 clk[uart3_ipg] = imx_clk_gate("uart3_ipg", "ipg", ccm(CCM_CGCR2), 16); 214 clk[uart3_ipg] = imx_clk_gate("uart3_ipg", "ipg", ccm(CCM_CGCR2), 16);
166 clk[uart4_ipg] = imx_clk_gate("uart4_ipg", "ipg", ccm(CCM_CGCR2), 17); 215 clk[uart4_ipg] = imx_clk_gate("uart4_ipg", "ipg", ccm(CCM_CGCR2), 17);
167 clk[uart5_ipg] = imx_clk_gate("uart5_ipg", "ipg", ccm(CCM_CGCR2), 18); 216 clk[uart5_ipg] = imx_clk_gate("uart5_ipg", "ipg", ccm(CCM_CGCR2), 18);
217 /* CCM_CGCR2(19): reserved in datasheet, but used as wdt in FSL kernel */
168 clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19); 218 clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19);
169 219
170 for (i = 0; i < ARRAY_SIZE(clk); i++) 220 for (i = 0; i < ARRAY_SIZE(clk); i++)
@@ -172,6 +222,18 @@ int __init mx25_clocks_init(void)
172 pr_err("i.MX25 clk %d: register failed with %ld\n", 222 pr_err("i.MX25 clk %d: register failed with %ld\n",
173 i, PTR_ERR(clk[i])); 223 i, PTR_ERR(clk[i]));
174 224
225 clk_prepare_enable(clk[emi_ahb]);
226
227 clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
228 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
229
230 return 0;
231}
232
233int __init mx25_clocks_init(void)
234{
235 __mx25_clocks_init(24000000);
236
175 /* i.mx25 has the i.mx21 type uart */ 237 /* i.mx25 has the i.mx21 type uart */
176 clk_register_clkdev(clk[uart1_ipg], "ipg", "imx21-uart.0"); 238 clk_register_clkdev(clk[uart1_ipg], "ipg", "imx21-uart.0");
177 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.0"); 239 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.0");
@@ -183,8 +245,6 @@ int __init mx25_clocks_init(void)
183 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.3"); 245 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.3");
184 clk_register_clkdev(clk[uart5_ipg], "ipg", "imx21-uart.4"); 246 clk_register_clkdev(clk[uart5_ipg], "ipg", "imx21-uart.4");
185 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.4"); 247 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.4");
186 clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
187 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
188 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0"); 248 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0");
189 clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.0"); 249 clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.0");
190 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0"); 250 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0");
@@ -197,7 +257,7 @@ int __init mx25_clocks_init(void)
197 clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); 257 clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc");
198 clk_register_clkdev(clk[usbotg_ahb], "ahb", "fsl-usb2-udc"); 258 clk_register_clkdev(clk[usbotg_ahb], "ahb", "fsl-usb2-udc");
199 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); 259 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
200 clk_register_clkdev(clk[nfc_ipg_per], NULL, "mxc_nand.0"); 260 clk_register_clkdev(clk[nfc_ipg_per], NULL, "imx25-nand.0");
201 /* i.mx25 has the i.mx35 type cspi */ 261 /* i.mx25 has the i.mx35 type cspi */
202 clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0"); 262 clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0");
203 clk_register_clkdev(clk[cspi2_ipg], NULL, "imx35-cspi.1"); 263 clk_register_clkdev(clk[cspi2_ipg], NULL, "imx35-cspi.1");
@@ -212,15 +272,15 @@ int __init mx25_clocks_init(void)
212 clk_register_clkdev(clk[per10], "per", "mxc_pwm.3"); 272 clk_register_clkdev(clk[per10], "per", "mxc_pwm.3");
213 clk_register_clkdev(clk[kpp_ipg], NULL, "imx-keypad"); 273 clk_register_clkdev(clk[kpp_ipg], NULL, "imx-keypad");
214 clk_register_clkdev(clk[tsc_ipg], NULL, "mx25-adc"); 274 clk_register_clkdev(clk[tsc_ipg], NULL, "mx25-adc");
215 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx-i2c.0"); 275 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.0");
216 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx-i2c.1"); 276 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.1");
217 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx-i2c.2"); 277 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.2");
218 clk_register_clkdev(clk[fec_ipg], "ipg", "imx25-fec.0"); 278 clk_register_clkdev(clk[fec_ipg], "ipg", "imx25-fec.0");
219 clk_register_clkdev(clk[fec_ahb], "ahb", "imx25-fec.0"); 279 clk_register_clkdev(clk[fec_ahb], "ahb", "imx25-fec.0");
220 clk_register_clkdev(clk[dryice_ipg], NULL, "imxdi_rtc.0"); 280 clk_register_clkdev(clk[dryice_ipg], NULL, "imxdi_rtc.0");
221 clk_register_clkdev(clk[lcdc_ipg_per], "per", "imx-fb.0"); 281 clk_register_clkdev(clk[lcdc_ipg_per], "per", "imx21-fb.0");
222 clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx-fb.0"); 282 clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx21-fb.0");
223 clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx-fb.0"); 283 clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx21-fb.0");
224 clk_register_clkdev(clk[wdt_ipg], NULL, "imx2-wdt.0"); 284 clk_register_clkdev(clk[wdt_ipg], NULL, "imx2-wdt.0");
225 clk_register_clkdev(clk[ssi1_ipg], NULL, "imx-ssi.0"); 285 clk_register_clkdev(clk[ssi1_ipg], NULL, "imx-ssi.0");
226 clk_register_clkdev(clk[ssi2_ipg], NULL, "imx-ssi.1"); 286 clk_register_clkdev(clk[ssi2_ipg], NULL, "imx-ssi.1");
@@ -230,9 +290,9 @@ int __init mx25_clocks_init(void)
230 clk_register_clkdev(clk[esdhc2_ipg_per], "per", "sdhci-esdhc-imx25.1"); 290 clk_register_clkdev(clk[esdhc2_ipg_per], "per", "sdhci-esdhc-imx25.1");
231 clk_register_clkdev(clk[esdhc2_ipg], "ipg", "sdhci-esdhc-imx25.1"); 291 clk_register_clkdev(clk[esdhc2_ipg], "ipg", "sdhci-esdhc-imx25.1");
232 clk_register_clkdev(clk[esdhc2_ahb], "ahb", "sdhci-esdhc-imx25.1"); 292 clk_register_clkdev(clk[esdhc2_ahb], "ahb", "sdhci-esdhc-imx25.1");
233 clk_register_clkdev(clk[csi_ipg_per], "per", "mx2-camera.0"); 293 clk_register_clkdev(clk[csi_ipg_per], "per", "imx25-camera.0");
234 clk_register_clkdev(clk[csi_ipg], "ipg", "mx2-camera.0"); 294 clk_register_clkdev(clk[csi_ipg], "ipg", "imx25-camera.0");
235 clk_register_clkdev(clk[csi_ahb], "ahb", "mx2-camera.0"); 295 clk_register_clkdev(clk[csi_ahb], "ahb", "imx25-camera.0");
236 clk_register_clkdev(clk[dummy], "audmux", NULL); 296 clk_register_clkdev(clk[dummy], "audmux", NULL);
237 clk_register_clkdev(clk[can1_ipg], NULL, "flexcan.0"); 297 clk_register_clkdev(clk[can1_ipg], NULL, "flexcan.0");
238 clk_register_clkdev(clk[can2_ipg], NULL, "flexcan.1"); 298 clk_register_clkdev(clk[can2_ipg], NULL, "flexcan.1");
@@ -242,5 +302,40 @@ int __init mx25_clocks_init(void)
242 clk_register_clkdev(clk[iim_ipg], "iim", NULL); 302 clk_register_clkdev(clk[iim_ipg], "iim", NULL);
243 303
244 mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), MX25_INT_GPT1); 304 mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), MX25_INT_GPT1);
305
306 return 0;
307}
308
309int __init mx25_clocks_init_dt(void)
310{
311 struct device_node *np;
312 void __iomem *base;
313 int irq;
314 unsigned long osc_rate = 24000000;
315
316 /* retrieve the freqency of fixed clocks from device tree */
317 for_each_compatible_node(np, NULL, "fixed-clock") {
318 u32 rate;
319 if (of_property_read_u32(np, "clock-frequency", &rate))
320 continue;
321
322 if (of_device_is_compatible(np, "fsl,imx-osc"))
323 osc_rate = rate;
324 }
325
326 np = of_find_compatible_node(NULL, NULL, "fsl,imx25-ccm");
327 clk_data.clks = clk;
328 clk_data.clk_num = ARRAY_SIZE(clk);
329 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
330
331 __mx25_clocks_init(osc_rate);
332
333 np = of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt");
334 base = of_iomap(np, 0);
335 WARN_ON(!base);
336 irq = irq_of_parse_and_map(np, 0);
337
338 mxc_timer_init(base, irq);
339
245 return 0; 340 return 0;
246} 341}
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 366e5d59d88..4c1d1e4efc7 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -6,9 +6,9 @@
6#include <linux/clk-provider.h> 6#include <linux/clk-provider.h>
7#include <linux/of.h> 7#include <linux/of.h>
8 8
9#include <mach/common.h>
10#include <mach/hardware.h>
11#include "clk.h" 9#include "clk.h"
10#include "common.h"
11#include "hardware.h"
12 12
13#define IO_ADDR_CCM(off) (MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR + (off))) 13#define IO_ADDR_CCM(off) (MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR + (off)))
14 14
@@ -51,8 +51,10 @@
51 51
52static const char *vpu_sel_clks[] = { "spll", "mpll_main2", }; 52static const char *vpu_sel_clks[] = { "spll", "mpll_main2", };
53static const char *cpu_sel_clks[] = { "mpll_main2", "mpll", }; 53static const char *cpu_sel_clks[] = { "mpll_main2", "mpll", };
54static const char *mpll_sel_clks[] = { "fpm", "mpll_osc_sel", };
55static const char *mpll_osc_sel_clks[] = { "ckih", "ckih_div1p5", };
54static const char *clko_sel_clks[] = { 56static const char *clko_sel_clks[] = {
55 "ckil", "prem", "ckih", "ckih", 57 "ckil", "fpm", "ckih", "ckih",
56 "ckih", "mpll", "spll", "cpu_div", 58 "ckih", "mpll", "spll", "cpu_div",
57 "ahb", "ipg", "per1_div", "per2_div", 59 "ahb", "ipg", "per1_div", "per2_div",
58 "per3_div", "per4_div", "ssi1_div", "ssi2_div", 60 "per3_div", "per4_div", "ssi1_div", "ssi2_div",
@@ -79,7 +81,8 @@ enum mx27_clks {
79 vpu_ahb_gate, fec_ahb_gate, emma_ahb_gate, emi_ahb_gate, dma_ahb_gate, 81 vpu_ahb_gate, fec_ahb_gate, emma_ahb_gate, emi_ahb_gate, dma_ahb_gate,
80 csi_ahb_gate, brom_ahb_gate, ata_ahb_gate, wdog_ipg_gate, usb_ipg_gate, 82 csi_ahb_gate, brom_ahb_gate, ata_ahb_gate, wdog_ipg_gate, usb_ipg_gate,
81 uart6_ipg_gate, uart5_ipg_gate, uart4_ipg_gate, uart3_ipg_gate, 83 uart6_ipg_gate, uart5_ipg_gate, uart4_ipg_gate, uart3_ipg_gate,
82 uart2_ipg_gate, uart1_ipg_gate, clk_max 84 uart2_ipg_gate, uart1_ipg_gate, ckih_div1p5, fpm, mpll_osc_sel,
85 mpll_sel, clk_max
83}; 86};
84 87
85static struct clk *clk[clk_max]; 88static struct clk *clk[clk_max];
@@ -91,7 +94,15 @@ int __init mx27_clocks_init(unsigned long fref)
91 clk[dummy] = imx_clk_fixed("dummy", 0); 94 clk[dummy] = imx_clk_fixed("dummy", 0);
92 clk[ckih] = imx_clk_fixed("ckih", fref); 95 clk[ckih] = imx_clk_fixed("ckih", fref);
93 clk[ckil] = imx_clk_fixed("ckil", 32768); 96 clk[ckil] = imx_clk_fixed("ckil", 32768);
94 clk[mpll] = imx_clk_pllv1("mpll", "ckih", CCM_MPCTL0); 97 clk[fpm] = imx_clk_fixed_factor("fpm", "ckil", 1024, 1);
98 clk[ckih_div1p5] = imx_clk_fixed_factor("ckih_div1p5", "ckih", 2, 3);
99
100 clk[mpll_osc_sel] = imx_clk_mux("mpll_osc_sel", CCM_CSCR, 4, 1,
101 mpll_osc_sel_clks,
102 ARRAY_SIZE(mpll_osc_sel_clks));
103 clk[mpll_sel] = imx_clk_mux("mpll_sel", CCM_CSCR, 16, 1, mpll_sel_clks,
104 ARRAY_SIZE(mpll_sel_clks));
105 clk[mpll] = imx_clk_pllv1("mpll", "mpll_sel", CCM_MPCTL0);
95 clk[spll] = imx_clk_pllv1("spll", "ckih", CCM_SPCTL0); 106 clk[spll] = imx_clk_pllv1("spll", "ckih", CCM_SPCTL0);
96 clk[mpll_main2] = imx_clk_fixed_factor("mpll_main2", "mpll", 2, 3); 107 clk[mpll_main2] = imx_clk_fixed_factor("mpll_main2", "mpll", 2, 3);
97 108
@@ -211,19 +222,20 @@ int __init mx27_clocks_init(unsigned long fref)
211 clk_register_clkdev(clk[gpt6_ipg_gate], "ipg", "imx-gpt.5"); 222 clk_register_clkdev(clk[gpt6_ipg_gate], "ipg", "imx-gpt.5");
212 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.5"); 223 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.5");
213 clk_register_clkdev(clk[pwm_ipg_gate], NULL, "mxc_pwm.0"); 224 clk_register_clkdev(clk[pwm_ipg_gate], NULL, "mxc_pwm.0");
214 clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.0"); 225 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0");
215 clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "mxc-mmc.0"); 226 clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0");
216 clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.1"); 227 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1");
217 clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "mxc-mmc.1"); 228 clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.1");
218 clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.2"); 229 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.2");
219 clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "mxc-mmc.2"); 230 clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.2");
220 clk_register_clkdev(clk[cspi1_ipg_gate], NULL, "imx27-cspi.0"); 231 clk_register_clkdev(clk[cspi1_ipg_gate], NULL, "imx27-cspi.0");
221 clk_register_clkdev(clk[cspi2_ipg_gate], NULL, "imx27-cspi.1"); 232 clk_register_clkdev(clk[cspi2_ipg_gate], NULL, "imx27-cspi.1");
222 clk_register_clkdev(clk[cspi3_ipg_gate], NULL, "imx27-cspi.2"); 233 clk_register_clkdev(clk[cspi3_ipg_gate], NULL, "imx27-cspi.2");
223 clk_register_clkdev(clk[per3_gate], "per", "imx-fb.0"); 234 clk_register_clkdev(clk[per3_gate], "per", "imx21-fb.0");
224 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0"); 235 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx21-fb.0");
225 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx-fb.0"); 236 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx21-fb.0");
226 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "mx2-camera.0"); 237 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0");
238 clk_register_clkdev(clk[per4_gate], "per", "imx27-camera.0");
227 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); 239 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
228 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc"); 240 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc");
229 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc"); 241 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc");
@@ -238,27 +250,27 @@ int __init mx27_clocks_init(unsigned long fref)
238 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.2"); 250 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.2");
239 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); 251 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
240 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 252 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
241 clk_register_clkdev(clk[nfc_baud_gate], NULL, "mxc_nand.0"); 253 clk_register_clkdev(clk[nfc_baud_gate], NULL, "imx27-nand.0");
242 clk_register_clkdev(clk[vpu_baud_gate], "per", "coda-imx27.0"); 254 clk_register_clkdev(clk[vpu_baud_gate], "per", "coda-imx27.0");
243 clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "coda-imx27.0"); 255 clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "coda-imx27.0");
244 clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx-dma"); 256 clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx27-dma");
245 clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx-dma"); 257 clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx27-dma");
246 clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0"); 258 clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0");
247 clk_register_clkdev(clk[fec_ahb_gate], "ahb", "imx27-fec.0"); 259 clk_register_clkdev(clk[fec_ahb_gate], "ahb", "imx27-fec.0");
248 clk_register_clkdev(clk[wdog_ipg_gate], NULL, "imx2-wdt.0"); 260 clk_register_clkdev(clk[wdog_ipg_gate], NULL, "imx2-wdt.0");
249 clk_register_clkdev(clk[i2c1_ipg_gate], NULL, "imx-i2c.0"); 261 clk_register_clkdev(clk[i2c1_ipg_gate], NULL, "imx21-i2c.0");
250 clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx-i2c.1"); 262 clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx21-i2c.1");
251 clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0"); 263 clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0");
252 clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad"); 264 clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad");
253 clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "mx2-camera.0"); 265 clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "imx27-camera.0");
254 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "mx2-camera.0"); 266 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "imx27-camera.0");
255 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0"); 267 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0");
256 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0"); 268 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0");
257 clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL); 269 clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL);
258 clk_register_clkdev(clk[gpio_ipg_gate], "gpio", NULL); 270 clk_register_clkdev(clk[gpio_ipg_gate], "gpio", NULL);
259 clk_register_clkdev(clk[brom_ahb_gate], "brom", NULL); 271 clk_register_clkdev(clk[brom_ahb_gate], "brom", NULL);
260 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL); 272 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL);
261 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "mxc_rtc"); 273 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc");
262 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL); 274 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL);
263 clk_register_clkdev(clk[cpu_div], "cpu", NULL); 275 clk_register_clkdev(clk[cpu_div], "cpu", NULL);
264 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL); 276 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL);
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index 1253af2d997..8be64e0a4ac 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -22,12 +22,11 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/of.h> 23#include <linux/of.h>
24 24
25#include <mach/hardware.h>
26#include <mach/mx31.h>
27#include <mach/common.h>
28
29#include "clk.h" 25#include "clk.h"
26#include "common.h"
30#include "crmregs-imx3.h" 27#include "crmregs-imx3.h"
28#include "hardware.h"
29#include "mx31.h"
31 30
32static const char *mcu_main_sel[] = { "spll", "mpll", }; 31static const char *mcu_main_sel[] = { "spll", "mpll", };
33static const char *per_sel[] = { "per_div", "ipg", }; 32static const char *per_sel[] = { "per_div", "ipg", };
@@ -124,10 +123,10 @@ int __init mx31_clocks_init(unsigned long fref)
124 clk_register_clkdev(clk[cspi3_gate], NULL, "imx31-cspi.2"); 123 clk_register_clkdev(clk[cspi3_gate], NULL, "imx31-cspi.2");
125 clk_register_clkdev(clk[pwm_gate], "pwm", NULL); 124 clk_register_clkdev(clk[pwm_gate], "pwm", NULL);
126 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0"); 125 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
127 clk_register_clkdev(clk[rtc_gate], NULL, "mxc_rtc"); 126 clk_register_clkdev(clk[rtc_gate], NULL, "imx21-rtc");
128 clk_register_clkdev(clk[epit1_gate], "epit", NULL); 127 clk_register_clkdev(clk[epit1_gate], "epit", NULL);
129 clk_register_clkdev(clk[epit2_gate], "epit", NULL); 128 clk_register_clkdev(clk[epit2_gate], "epit", NULL);
130 clk_register_clkdev(clk[nfc], NULL, "mxc_nand.0"); 129 clk_register_clkdev(clk[nfc], NULL, "imx27-nand.0");
131 clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core"); 130 clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core");
132 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb"); 131 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
133 clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad"); 132 clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad");
@@ -155,12 +154,12 @@ int __init mx31_clocks_init(unsigned long fref)
155 clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.3"); 154 clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.3");
156 clk_register_clkdev(clk[uart5_gate], "per", "imx21-uart.4"); 155 clk_register_clkdev(clk[uart5_gate], "per", "imx21-uart.4");
157 clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.4"); 156 clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.4");
158 clk_register_clkdev(clk[i2c1_gate], NULL, "imx-i2c.0"); 157 clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
159 clk_register_clkdev(clk[i2c2_gate], NULL, "imx-i2c.1"); 158 clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
160 clk_register_clkdev(clk[i2c3_gate], NULL, "imx-i2c.2"); 159 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
161 clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0"); 160 clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0");
162 clk_register_clkdev(clk[sdhc1_gate], NULL, "mxc-mmc.0"); 161 clk_register_clkdev(clk[sdhc1_gate], NULL, "imx31-mmc.0");
163 clk_register_clkdev(clk[sdhc2_gate], NULL, "mxc-mmc.1"); 162 clk_register_clkdev(clk[sdhc2_gate], NULL, "imx31-mmc.1");
164 clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0"); 163 clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0");
165 clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1"); 164 clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1");
166 clk_register_clkdev(clk[firi_gate], "firi", NULL); 165 clk_register_clkdev(clk[firi_gate], "firi", NULL);
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 177259b523c..66f3d65ea27 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -14,11 +14,10 @@
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/err.h> 15#include <linux/err.h>
16 16
17#include <mach/hardware.h>
18#include <mach/common.h>
19
20#include "crmregs-imx3.h" 17#include "crmregs-imx3.h"
21#include "clk.h" 18#include "clk.h"
19#include "common.h"
20#include "hardware.h"
22 21
23struct arm_ahb_div { 22struct arm_ahb_div {
24 unsigned char arm, ahb, sel; 23 unsigned char arm, ahb, sel;
@@ -226,9 +225,9 @@ int __init mx35_clocks_init()
226 clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0"); 225 clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0");
227 clk_register_clkdev(clk[gpt_gate], "per", "imx-gpt.0"); 226 clk_register_clkdev(clk[gpt_gate], "per", "imx-gpt.0");
228 clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0"); 227 clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
229 clk_register_clkdev(clk[i2c1_gate], NULL, "imx-i2c.0"); 228 clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
230 clk_register_clkdev(clk[i2c2_gate], NULL, "imx-i2c.1"); 229 clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
231 clk_register_clkdev(clk[i2c3_gate], NULL, "imx-i2c.2"); 230 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
232 clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core"); 231 clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core");
233 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb"); 232 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
234 clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad"); 233 clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad");
@@ -256,7 +255,7 @@ int __init mx35_clocks_init()
256 clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); 255 clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc");
257 clk_register_clkdev(clk[usbotg_gate], "ahb", "fsl-usb2-udc"); 256 clk_register_clkdev(clk[usbotg_gate], "ahb", "fsl-usb2-udc");
258 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0"); 257 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
259 clk_register_clkdev(clk[nfc_div], NULL, "mxc_nand.0"); 258 clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0");
260 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); 259 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
261 260
262 clk_prepare_enable(clk[spba_gate]); 261 clk_prepare_enable(clk[spba_gate]);
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index a0bf84803ea..e8c0473c756 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -14,11 +14,10 @@
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/err.h> 15#include <linux/err.h>
16 16
17#include <mach/hardware.h>
18#include <mach/common.h>
19
20#include "crm-regs-imx5.h" 17#include "crm-regs-imx5.h"
21#include "clk.h" 18#include "clk.h"
19#include "common.h"
20#include "hardware.h"
22 21
23/* Low-power Audio Playback Mode clock */ 22/* Low-power Audio Playback Mode clock */
24static const char *lp_apm_sel[] = { "osc", }; 23static const char *lp_apm_sel[] = { "osc", };
@@ -88,6 +87,7 @@ enum imx5_clks {
88}; 87};
89 88
90static struct clk *clk[clk_max]; 89static struct clk *clk[clk_max];
90static struct clk_onecell_data clk_data;
91 91
92static void __init mx5_clocks_common_init(unsigned long rate_ckil, 92static void __init mx5_clocks_common_init(unsigned long rate_ckil,
93 unsigned long rate_osc, unsigned long rate_ckih1, 93 unsigned long rate_osc, unsigned long rate_ckih1,
@@ -258,8 +258,8 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
258 clk_register_clkdev(clk[cspi_ipg_gate], NULL, "imx35-cspi.2"); 258 clk_register_clkdev(clk[cspi_ipg_gate], NULL, "imx35-cspi.2");
259 clk_register_clkdev(clk[pwm1_ipg_gate], "pwm", "mxc_pwm.0"); 259 clk_register_clkdev(clk[pwm1_ipg_gate], "pwm", "mxc_pwm.0");
260 clk_register_clkdev(clk[pwm2_ipg_gate], "pwm", "mxc_pwm.1"); 260 clk_register_clkdev(clk[pwm2_ipg_gate], "pwm", "mxc_pwm.1");
261 clk_register_clkdev(clk[i2c1_gate], NULL, "imx-i2c.0"); 261 clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
262 clk_register_clkdev(clk[i2c2_gate], NULL, "imx-i2c.1"); 262 clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
263 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.0"); 263 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.0");
264 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.0"); 264 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.0");
265 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.0"); 265 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.0");
@@ -272,7 +272,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
272 clk_register_clkdev(clk[usboh3_per_gate], "per", "fsl-usb2-udc"); 272 clk_register_clkdev(clk[usboh3_per_gate], "per", "fsl-usb2-udc");
273 clk_register_clkdev(clk[usboh3_gate], "ipg", "fsl-usb2-udc"); 273 clk_register_clkdev(clk[usboh3_gate], "ipg", "fsl-usb2-udc");
274 clk_register_clkdev(clk[usboh3_gate], "ahb", "fsl-usb2-udc"); 274 clk_register_clkdev(clk[usboh3_gate], "ahb", "fsl-usb2-udc");
275 clk_register_clkdev(clk[nfc_gate], NULL, "mxc_nand"); 275 clk_register_clkdev(clk[nfc_gate], NULL, "imx51-nand");
276 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); 276 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
277 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 277 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
278 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2"); 278 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2");
@@ -306,6 +306,10 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
306 clk_prepare_enable(clk[spba]); 306 clk_prepare_enable(clk[spba]);
307 clk_prepare_enable(clk[emi_fast_gate]); /* fec */ 307 clk_prepare_enable(clk[emi_fast_gate]); /* fec */
308 clk_prepare_enable(clk[emi_slow_gate]); /* eim */ 308 clk_prepare_enable(clk[emi_slow_gate]); /* eim */
309 clk_prepare_enable(clk[mipi_hsc1_gate]);
310 clk_prepare_enable(clk[mipi_hsc2_gate]);
311 clk_prepare_enable(clk[mipi_esc_gate]);
312 clk_prepare_enable(clk[mipi_hsp_gate]);
309 clk_prepare_enable(clk[tmax1]); 313 clk_prepare_enable(clk[tmax1]);
310 clk_prepare_enable(clk[tmax2]); /* esdhc2, fec */ 314 clk_prepare_enable(clk[tmax2]); /* esdhc2, fec */
311 clk_prepare_enable(clk[tmax3]); /* esdhc1, esdhc4 */ 315 clk_prepare_enable(clk[tmax3]); /* esdhc1, esdhc4 */
@@ -315,6 +319,7 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
315 unsigned long rate_ckih1, unsigned long rate_ckih2) 319 unsigned long rate_ckih1, unsigned long rate_ckih2)
316{ 320{
317 int i; 321 int i;
322 struct device_node *np;
318 323
319 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE); 324 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE);
320 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX51_DPLL2_BASE); 325 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX51_DPLL2_BASE);
@@ -343,16 +348,20 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
343 pr_err("i.MX51 clk %d: register failed with %ld\n", 348 pr_err("i.MX51 clk %d: register failed with %ld\n",
344 i, PTR_ERR(clk[i])); 349 i, PTR_ERR(clk[i]));
345 350
351 np = of_find_compatible_node(NULL, NULL, "fsl,imx51-ccm");
352 clk_data.clks = clk;
353 clk_data.clk_num = ARRAY_SIZE(clk);
354 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
355
346 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2); 356 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
347 357
348 clk_register_clkdev(clk[hsi2c_gate], NULL, "imx-i2c.2"); 358 clk_register_clkdev(clk[hsi2c_gate], NULL, "imx21-i2c.2");
349 clk_register_clkdev(clk[mx51_mipi], "mipi_hsp", NULL); 359 clk_register_clkdev(clk[mx51_mipi], "mipi_hsp", NULL);
350 clk_register_clkdev(clk[vpu_gate], NULL, "imx51-vpu.0"); 360 clk_register_clkdev(clk[vpu_gate], NULL, "imx51-vpu.0");
351 clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0"); 361 clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0");
352 clk_register_clkdev(clk[ipu_gate], "bus", "imx51-ipu"); 362 clk_register_clkdev(clk[ipu_gate], "bus", "40000000.ipu");
353 clk_register_clkdev(clk[ipu_di0_gate], "di0", "imx51-ipu"); 363 clk_register_clkdev(clk[ipu_di0_gate], "di0", "40000000.ipu");
354 clk_register_clkdev(clk[ipu_di1_gate], "di1", "imx51-ipu"); 364 clk_register_clkdev(clk[ipu_di1_gate], "di1", "40000000.ipu");
355 clk_register_clkdev(clk[ipu_gate], "hsp", "imx51-ipu");
356 clk_register_clkdev(clk[usb_phy_gate], "phy", "mxc-ehci.0"); 365 clk_register_clkdev(clk[usb_phy_gate], "phy", "mxc-ehci.0");
357 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx51.0"); 366 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx51.0");
358 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.0"); 367 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.0");
@@ -366,10 +375,6 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
366 clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx51.3"); 375 clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx51.3");
367 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.3"); 376 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.3");
368 clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx51.3"); 377 clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx51.3");
369 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "83fcc000.ssi");
370 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "70014000.ssi");
371 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "83fe8000.ssi");
372 clk_register_clkdev(clk[nfc_gate], NULL, "83fdb000.nand");
373 378
374 /* set the usboh3 parent to pll2_sw */ 379 /* set the usboh3 parent to pll2_sw */
375 clk_set_parent(clk[usboh3_sel], clk[pll2_sw]); 380 clk_set_parent(clk[usboh3_sel], clk[pll2_sw]);
@@ -393,6 +398,7 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
393{ 398{
394 int i; 399 int i;
395 unsigned long r; 400 unsigned long r;
401 struct device_node *np;
396 402
397 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 403 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
398 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 404 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
@@ -437,15 +443,20 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
437 pr_err("i.MX53 clk %d: register failed with %ld\n", 443 pr_err("i.MX53 clk %d: register failed with %ld\n",
438 i, PTR_ERR(clk[i])); 444 i, PTR_ERR(clk[i]));
439 445
446 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-ccm");
447 clk_data.clks = clk;
448 clk_data.clk_num = ARRAY_SIZE(clk);
449 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
450
440 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2); 451 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
441 452
442 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0"); 453 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0");
443 clk_register_clkdev(clk[i2c3_gate], NULL, "imx-i2c.2"); 454 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
444 clk_register_clkdev(clk[fec_gate], NULL, "imx25-fec.0"); 455 clk_register_clkdev(clk[fec_gate], NULL, "imx25-fec.0");
445 clk_register_clkdev(clk[ipu_gate], "bus", "imx53-ipu"); 456 clk_register_clkdev(clk[ipu_gate], "bus", "18000000.ipu");
446 clk_register_clkdev(clk[ipu_di0_gate], "di0", "imx53-ipu"); 457 clk_register_clkdev(clk[ipu_di0_gate], "di0", "18000000.ipu");
447 clk_register_clkdev(clk[ipu_di1_gate], "di1", "imx53-ipu"); 458 clk_register_clkdev(clk[ipu_di1_gate], "di1", "18000000.ipu");
448 clk_register_clkdev(clk[ipu_gate], "hsp", "imx53-ipu"); 459 clk_register_clkdev(clk[ipu_gate], "hsp", "18000000.ipu");
449 clk_register_clkdev(clk[usb_phy1_gate], "usb_phy1", "mxc-ehci.0"); 460 clk_register_clkdev(clk[usb_phy1_gate], "usb_phy1", "mxc-ehci.0");
450 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx53.0"); 461 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx53.0");
451 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.0"); 462 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.0");
@@ -459,14 +470,6 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
459 clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx53.3"); 470 clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx53.3");
460 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.3"); 471 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.3");
461 clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx53.3"); 472 clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx53.3");
462 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "63fcc000.ssi");
463 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "50014000.ssi");
464 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "63fd0000.ssi");
465 clk_register_clkdev(clk[nfc_gate], NULL, "63fdb000.nand");
466 clk_register_clkdev(clk[can1_ipg_gate], "ipg", "53fc8000.can");
467 clk_register_clkdev(clk[can1_serial_gate], "per", "53fc8000.can");
468 clk_register_clkdev(clk[can2_ipg_gate], "ipg", "53fcc000.can");
469 clk_register_clkdev(clk[can2_serial_gate], "per", "53fcc000.can");
470 473
471 /* set SDHC root clock to 200MHZ*/ 474 /* set SDHC root clock to 200MHZ*/
472 clk_set_rate(clk[esdhc_a_podf], 200000000); 475 clk_set_rate(clk[esdhc_a_podf], 200000000);
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 3ec242f3341..7f2c10c7413 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -19,8 +19,9 @@
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/of_address.h> 20#include <linux/of_address.h>
21#include <linux/of_irq.h> 21#include <linux/of_irq.h>
22#include <mach/common.h> 22
23#include "clk.h" 23#include "clk.h"
24#include "common.h"
24 25
25#define CCGR0 0x68 26#define CCGR0 0x68
26#define CCGR1 0x6c 27#define CCGR1 0x6c
@@ -104,7 +105,7 @@ static const char *gpu2d_core_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd0_352m"
104static const char *gpu3d_core_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd2_396m", }; 105static const char *gpu3d_core_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd2_396m", };
105static const char *gpu3d_shader_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd9_720m", }; 106static const char *gpu3d_shader_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd9_720m", };
106static const char *ipu_sels[] = { "mmdc_ch0_axi", "pll2_pfd2_396m", "pll3_120m", "pll3_pfd1_540m", }; 107static const char *ipu_sels[] = { "mmdc_ch0_axi", "pll2_pfd2_396m", "pll3_120m", "pll3_pfd1_540m", };
107static const char *ldb_di_sels[] = { "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd1_540m", }; 108static const char *ldb_di_sels[] = { "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "mmdc_ch1_axi", "pll3_pfd1_540m", };
108static const char *ipu_di_pre_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd1_540m", }; 109static const char *ipu_di_pre_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd1_540m", };
109static const char *ipu1_di0_sels[] = { "ipu1_di0_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; 110static const char *ipu1_di0_sels[] = { "ipu1_di0_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", };
110static const char *ipu1_di1_sels[] = { "ipu1_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; 111static const char *ipu1_di1_sels[] = { "ipu1_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", };
@@ -151,8 +152,9 @@ enum mx6q_clks {
151 gpmi_bch_apb, gpmi_bch, gpmi_io, gpmi_apb, sata, sdma, spba, ssi1, 152 gpmi_bch_apb, gpmi_bch, gpmi_io, gpmi_apb, sata, sdma, spba, ssi1,
152 ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3, 153 ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3,
153 usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg, 154 usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg,
154 pll4_audio, pll5_video, pll6_mlb, pll7_usb_host, pll8_enet, ssi1_ipg, 155 pll4_audio, pll5_video, pll8_mlb, pll7_usb_host, pll6_enet, ssi1_ipg,
155 ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5, 156 ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5,
157 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref,
156 clk_max 158 clk_max
157}; 159};
158 160
@@ -163,6 +165,13 @@ static enum mx6q_clks const clks_init_on[] __initconst = {
163 mmdc_ch0_axi, rom, 165 mmdc_ch0_axi, rom,
164}; 166};
165 167
168static struct clk_div_table clk_enet_ref_table[] = {
169 { .val = 0, .div = 20, },
170 { .val = 1, .div = 10, },
171 { .val = 2, .div = 5, },
172 { .val = 3, .div = 4, },
173};
174
166int __init mx6q_clocks_init(void) 175int __init mx6q_clocks_init(void)
167{ 176{
168 struct device_node *np; 177 struct device_node *np;
@@ -189,19 +198,29 @@ int __init mx6q_clocks_init(void)
189 base = of_iomap(np, 0); 198 base = of_iomap(np, 0);
190 WARN_ON(!base); 199 WARN_ON(!base);
191 200
192 /* type name parent_name base gate_mask div_mask */ 201 /* type name parent_name base div_mask */
193 clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x2000, 0x7f); 202 clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f);
194 clk[pll2_bus] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x2000, 0x1); 203 clk[pll2_bus] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1);
195 clk[pll3_usb_otg] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x2000, 0x3); 204 clk[pll3_usb_otg] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3);
196 clk[pll4_audio] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x2000, 0x7f); 205 clk[pll4_audio] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f);
197 clk[pll5_video] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x2000, 0x7f); 206 clk[pll5_video] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f);
198 clk[pll6_mlb] = imx_clk_pllv3(IMX_PLLV3_MLB, "pll6_mlb", "osc", base + 0xd0, 0x2000, 0x0); 207 clk[pll6_enet] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3);
199 clk[pll7_usb_host] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host","osc", base + 0x20, 0x2000, 0x3); 208 clk[pll7_usb_host] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host","osc", base + 0x20, 0x3);
200 clk[pll8_enet] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll8_enet", "osc", base + 0xe0, 0x182000, 0x3); 209 clk[pll8_mlb] = imx_clk_pllv3(IMX_PLLV3_MLB, "pll8_mlb", "osc", base + 0xd0, 0x0);
201 210
202 clk[usbphy1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 6); 211 clk[usbphy1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 6);
203 clk[usbphy2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 6); 212 clk[usbphy2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 6);
204 213
214 clk[sata_ref] = imx_clk_fixed_factor("sata_ref", "pll6_enet", 1, 5);
215 clk[pcie_ref] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 4);
216
217 clk[sata_ref_100m] = imx_clk_gate("sata_ref_100m", "sata_ref", base + 0xe0, 20);
218 clk[pcie_ref_125m] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19);
219
220 clk[enet_ref] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0,
221 base + 0xe0, 0, 2, 0, clk_enet_ref_table,
222 &imx_ccm_lock);
223
205 /* name parent_name reg idx */ 224 /* name parent_name reg idx */
206 clk[pll2_pfd0_352m] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 225 clk[pll2_pfd0_352m] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0);
207 clk[pll2_pfd1_594m] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 226 clk[pll2_pfd1_594m] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1);
@@ -357,7 +376,7 @@ int __init mx6q_clocks_init(void)
357 clk[ldb_di1] = imx_clk_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14); 376 clk[ldb_di1] = imx_clk_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14);
358 clk[ipu2_di1] = imx_clk_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10); 377 clk[ipu2_di1] = imx_clk_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10);
359 clk[hsi_tx] = imx_clk_gate2("hsi_tx", "hsi_tx_podf", base + 0x74, 16); 378 clk[hsi_tx] = imx_clk_gate2("hsi_tx", "hsi_tx_podf", base + 0x74, 16);
360 clk[mlb] = imx_clk_gate2("mlb", "pll6_mlb", base + 0x74, 18); 379 clk[mlb] = imx_clk_gate2("mlb", "pll8_mlb", base + 0x74, 18);
361 clk[mmdc_ch0_axi] = imx_clk_gate2("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20); 380 clk[mmdc_ch0_axi] = imx_clk_gate2("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20);
362 clk[mmdc_ch1_axi] = imx_clk_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22); 381 clk[mmdc_ch1_axi] = imx_clk_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22);
363 clk[ocram] = imx_clk_gate2("ocram", "ahb", base + 0x74, 28); 382 clk[ocram] = imx_clk_gate2("ocram", "ahb", base + 0x74, 28);
@@ -405,6 +424,7 @@ int __init mx6q_clocks_init(void)
405 clk_register_clkdev(clk[cko1_sel], "cko1_sel", NULL); 424 clk_register_clkdev(clk[cko1_sel], "cko1_sel", NULL);
406 clk_register_clkdev(clk[ahb], "ahb", NULL); 425 clk_register_clkdev(clk[ahb], "ahb", NULL);
407 clk_register_clkdev(clk[cko1], "cko1", NULL); 426 clk_register_clkdev(clk[cko1], "cko1", NULL);
427 clk_register_clkdev(clk[arm], NULL, "cpu0");
408 428
409 /* 429 /*
410 * The gpmi needs 100MHz frequency in the EDO/Sync mode, 430 * The gpmi needs 100MHz frequency in the EDO/Sync mode,
diff --git a/arch/arm/mach-imx/clk-pllv1.c b/arch/arm/mach-imx/clk-pllv1.c
index 02be7317891..abff350ba24 100644
--- a/arch/arm/mach-imx/clk-pllv1.c
+++ b/arch/arm/mach-imx/clk-pllv1.c
@@ -4,10 +4,10 @@
4#include <linux/slab.h> 4#include <linux/slab.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/err.h> 6#include <linux/err.h>
7#include <mach/common.h>
8#include <mach/hardware.h>
9 7
10#include "clk.h" 8#include "clk.h"
9#include "common.h"
10#include "hardware.h"
11 11
12/** 12/**
13 * pll v1 13 * pll v1
diff --git a/arch/arm/mach-imx/clk-pllv3.c b/arch/arm/mach-imx/clk-pllv3.c
index 36aac947bce..d09bc3df9a7 100644
--- a/arch/arm/mach-imx/clk-pllv3.c
+++ b/arch/arm/mach-imx/clk-pllv3.c
@@ -31,7 +31,6 @@
31 * @clk_hw: clock source 31 * @clk_hw: clock source
32 * @base: base address of PLL registers 32 * @base: base address of PLL registers
33 * @powerup_set: set POWER bit to power up the PLL 33 * @powerup_set: set POWER bit to power up the PLL
34 * @gate_mask: mask of gate bits
35 * @div_mask: mask of divider bits 34 * @div_mask: mask of divider bits
36 * 35 *
37 * IMX PLL clock version 3, found on i.MX6 series. Divider for pllv3 36 * IMX PLL clock version 3, found on i.MX6 series. Divider for pllv3
@@ -41,7 +40,6 @@ struct clk_pllv3 {
41 struct clk_hw hw; 40 struct clk_hw hw;
42 void __iomem *base; 41 void __iomem *base;
43 bool powerup_set; 42 bool powerup_set;
44 u32 gate_mask;
45 u32 div_mask; 43 u32 div_mask;
46}; 44};
47 45
@@ -89,7 +87,7 @@ static int clk_pllv3_enable(struct clk_hw *hw)
89 u32 val; 87 u32 val;
90 88
91 val = readl_relaxed(pll->base); 89 val = readl_relaxed(pll->base);
92 val |= pll->gate_mask; 90 val |= BM_PLL_ENABLE;
93 writel_relaxed(val, pll->base); 91 writel_relaxed(val, pll->base);
94 92
95 return 0; 93 return 0;
@@ -101,7 +99,7 @@ static void clk_pllv3_disable(struct clk_hw *hw)
101 u32 val; 99 u32 val;
102 100
103 val = readl_relaxed(pll->base); 101 val = readl_relaxed(pll->base);
104 val &= ~pll->gate_mask; 102 val &= ~BM_PLL_ENABLE;
105 writel_relaxed(val, pll->base); 103 writel_relaxed(val, pll->base);
106} 104}
107 105
@@ -287,66 +285,7 @@ static const struct clk_ops clk_pllv3_av_ops = {
287static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw, 285static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw,
288 unsigned long parent_rate) 286 unsigned long parent_rate)
289{ 287{
290 struct clk_pllv3 *pll = to_clk_pllv3(hw); 288 return 500000000;
291 u32 div = readl_relaxed(pll->base) & pll->div_mask;
292
293 switch (div) {
294 case 0:
295 return 25000000;
296 case 1:
297 return 50000000;
298 case 2:
299 return 100000000;
300 case 3:
301 return 125000000;
302 }
303
304 return 0;
305}
306
307static long clk_pllv3_enet_round_rate(struct clk_hw *hw, unsigned long rate,
308 unsigned long *prate)
309{
310 if (rate >= 125000000)
311 rate = 125000000;
312 else if (rate >= 100000000)
313 rate = 100000000;
314 else if (rate >= 50000000)
315 rate = 50000000;
316 else
317 rate = 25000000;
318 return rate;
319}
320
321static int clk_pllv3_enet_set_rate(struct clk_hw *hw, unsigned long rate,
322 unsigned long parent_rate)
323{
324 struct clk_pllv3 *pll = to_clk_pllv3(hw);
325 u32 val, div;
326
327 switch (rate) {
328 case 25000000:
329 div = 0;
330 break;
331 case 50000000:
332 div = 1;
333 break;
334 case 100000000:
335 div = 2;
336 break;
337 case 125000000:
338 div = 3;
339 break;
340 default:
341 return -EINVAL;
342 }
343
344 val = readl_relaxed(pll->base);
345 val &= ~pll->div_mask;
346 val |= div;
347 writel_relaxed(val, pll->base);
348
349 return 0;
350} 289}
351 290
352static const struct clk_ops clk_pllv3_enet_ops = { 291static const struct clk_ops clk_pllv3_enet_ops = {
@@ -355,8 +294,6 @@ static const struct clk_ops clk_pllv3_enet_ops = {
355 .enable = clk_pllv3_enable, 294 .enable = clk_pllv3_enable,
356 .disable = clk_pllv3_disable, 295 .disable = clk_pllv3_disable,
357 .recalc_rate = clk_pllv3_enet_recalc_rate, 296 .recalc_rate = clk_pllv3_enet_recalc_rate,
358 .round_rate = clk_pllv3_enet_round_rate,
359 .set_rate = clk_pllv3_enet_set_rate,
360}; 297};
361 298
362static const struct clk_ops clk_pllv3_mlb_ops = { 299static const struct clk_ops clk_pllv3_mlb_ops = {
@@ -368,7 +305,7 @@ static const struct clk_ops clk_pllv3_mlb_ops = {
368 305
369struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, 306struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
370 const char *parent_name, void __iomem *base, 307 const char *parent_name, void __iomem *base,
371 u32 gate_mask, u32 div_mask) 308 u32 div_mask)
372{ 309{
373 struct clk_pllv3 *pll; 310 struct clk_pllv3 *pll;
374 const struct clk_ops *ops; 311 const struct clk_ops *ops;
@@ -400,7 +337,6 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
400 ops = &clk_pllv3_ops; 337 ops = &clk_pllv3_ops;
401 } 338 }
402 pll->base = base; 339 pll->base = base;
403 pll->gate_mask = gate_mask;
404 pll->div_mask = div_mask; 340 pll->div_mask = div_mask;
405 341
406 init.name = name; 342 init.name = name;
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index 5f2d8acca25..9d1f3b99d1d 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -22,8 +22,7 @@ enum imx_pllv3_type {
22}; 22};
23 23
24struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, 24struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
25 const char *parent_name, void __iomem *base, u32 gate_mask, 25 const char *parent_name, void __iomem *base, u32 div_mask);
26 u32 div_mask);
27 26
28struct clk *clk_register_gate2(struct device *dev, const char *name, 27struct clk *clk_register_gate2(struct device *dev, const char *name,
29 const char *parent_name, unsigned long flags, 28 const char *parent_name, unsigned long flags,
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/mach-imx/common.h
index ead901814c0..7191ab4434e 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -66,6 +66,7 @@ extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
66 unsigned long ckih1, unsigned long ckih2); 66 unsigned long ckih1, unsigned long ckih2);
67extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, 67extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
68 unsigned long ckih1, unsigned long ckih2); 68 unsigned long ckih1, unsigned long ckih2);
69extern int mx25_clocks_init_dt(void);
69extern int mx27_clocks_init_dt(void); 70extern int mx27_clocks_init_dt(void);
70extern int mx31_clocks_init_dt(void); 71extern int mx31_clocks_init_dt(void);
71extern int mx51_clocks_init_dt(void); 72extern int mx51_clocks_init_dt(void);
@@ -79,6 +80,7 @@ extern void mxc_arch_reset_init(void __iomem *);
79extern int mx53_revision(void); 80extern int mx53_revision(void);
80extern int mx53_display_revision(void); 81extern int mx53_display_revision(void);
81extern void imx_set_aips(void __iomem *); 82extern void imx_set_aips(void __iomem *);
83extern int mxc_device_init(void);
82 84
83enum mxc_cpu_pwr_mode { 85enum mxc_cpu_pwr_mode {
84 WAIT_CLOCKED, /* wfi only */ 86 WAIT_CLOCKED, /* wfi only */
diff --git a/arch/arm/mach-imx/cpu-imx25.c b/arch/arm/mach-imx/cpu-imx25.c
index 6914bcbf84e..96ec64b5ff7 100644
--- a/arch/arm/mach-imx/cpu-imx25.c
+++ b/arch/arm/mach-imx/cpu-imx25.c
@@ -11,8 +11,9 @@
11 */ 11 */
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <mach/hardware.h> 14
15#include <mach/iim.h> 15#include "iim.h"
16#include "hardware.h"
16 17
17static int mx25_cpu_rev = -1; 18static int mx25_cpu_rev = -1;
18 19
diff --git a/arch/arm/mach-imx/cpu-imx27.c b/arch/arm/mach-imx/cpu-imx27.c
index ff38e1505f6..fe8d36f7e30 100644
--- a/arch/arm/mach-imx/cpu-imx27.c
+++ b/arch/arm/mach-imx/cpu-imx27.c
@@ -24,7 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/module.h> 25#include <linux/module.h>
26 26
27#include <mach/hardware.h> 27#include "hardware.h"
28 28
29static int mx27_cpu_rev = -1; 29static int mx27_cpu_rev = -1;
30static int mx27_cpu_partnumber; 30static int mx27_cpu_partnumber;
diff --git a/arch/arm/mach-imx/cpu-imx31.c b/arch/arm/mach-imx/cpu-imx31.c
index 3f2345f0cda..fde1860a252 100644
--- a/arch/arm/mach-imx/cpu-imx31.c
+++ b/arch/arm/mach-imx/cpu-imx31.c
@@ -11,9 +11,10 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <mach/hardware.h> 14
15#include <mach/iim.h> 15#include "common.h"
16#include <mach/common.h> 16#include "hardware.h"
17#include "iim.h"
17 18
18static int mx31_cpu_rev = -1; 19static int mx31_cpu_rev = -1;
19 20
diff --git a/arch/arm/mach-imx/cpu-imx35.c b/arch/arm/mach-imx/cpu-imx35.c
index 846e46eb8cb..ec3aaa098c1 100644
--- a/arch/arm/mach-imx/cpu-imx35.c
+++ b/arch/arm/mach-imx/cpu-imx35.c
@@ -10,8 +10,9 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <mach/hardware.h> 13
14#include <mach/iim.h> 14#include "hardware.h"
15#include "iim.h"
15 16
16static int mx35_cpu_rev = -1; 17static int mx35_cpu_rev = -1;
17 18
diff --git a/arch/arm/mach-imx/cpu-imx5.c b/arch/arm/mach-imx/cpu-imx5.c
index 8eb15a2fcaf..d88760014ff 100644
--- a/arch/arm/mach-imx/cpu-imx5.c
+++ b/arch/arm/mach-imx/cpu-imx5.c
@@ -15,9 +15,10 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <mach/hardware.h>
19#include <linux/io.h> 18#include <linux/io.h>
20 19
20#include "hardware.h"
21
21static int mx5_cpu_rev = -1; 22static int mx5_cpu_rev = -1;
22 23
23#define IIM_SREV 0x24 24#define IIM_SREV 0x24
diff --git a/arch/arm/plat-mxc/cpu.c b/arch/arm/mach-imx/cpu.c
index 220dd6f9312..03fcbd08259 100644
--- a/arch/arm/plat-mxc/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -1,7 +1,8 @@
1 1
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/io.h> 3#include <linux/io.h>
4#include <mach/hardware.h> 4
5#include "hardware.h"
5 6
6unsigned int __mxc_cpu_type; 7unsigned int __mxc_cpu_type;
7EXPORT_SYMBOL(__mxc_cpu_type); 8EXPORT_SYMBOL(__mxc_cpu_type);
diff --git a/arch/arm/mach-imx/cpu_op-mx51.c b/arch/arm/mach-imx/cpu_op-mx51.c
index 7b92cd6da6d..b9ef692b61a 100644
--- a/arch/arm/mach-imx/cpu_op-mx51.c
+++ b/arch/arm/mach-imx/cpu_op-mx51.c
@@ -13,9 +13,10 @@
13 13
14#include <linux/bug.h> 14#include <linux/bug.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <mach/hardware.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18 17
18#include "hardware.h"
19
19static struct cpu_op mx51_cpu_op[] = { 20static struct cpu_op mx51_cpu_op[] = {
20 { 21 {
21 .cpu_rate = 160000000,}, 22 .cpu_rate = 160000000,},
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
index b5b6f808313..36e8b399447 100644
--- a/arch/arm/plat-mxc/cpufreq.c
+++ b/arch/arm/mach-imx/cpufreq.c
@@ -22,7 +22,8 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <mach/hardware.h> 25
26#include "hardware.h"
26 27
27#define CLK32_FREQ 32768 28#define CLK32_FREQ 32768
28#define NANOSECOND (1000 * 1000 * 1000) 29#define NANOSECOND (1000 * 1000 * 1000)
diff --git a/arch/arm/plat-mxc/cpuidle.c b/arch/arm/mach-imx/cpuidle.c
index d4cb511a44a..d4cb511a44a 100644
--- a/arch/arm/plat-mxc/cpuidle.c
+++ b/arch/arm/mach-imx/cpuidle.c
diff --git a/arch/arm/plat-mxc/include/mach/cpuidle.h b/arch/arm/mach-imx/cpuidle.h
index bc932d1af37..bc932d1af37 100644
--- a/arch/arm/plat-mxc/include/mach/cpuidle.h
+++ b/arch/arm/mach-imx/cpuidle.h
diff --git a/arch/arm/mach-imx/devices-imx1.h b/arch/arm/mach-imx/devices-imx1.h
index 3aad1e70de9..f9b5afc6bcd 100644
--- a/arch/arm/mach-imx/devices-imx1.h
+++ b/arch/arm/mach-imx/devices-imx1.h
@@ -6,8 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/mx1.h> 9#include "devices/devices-common.h"
10#include <mach/devices-common.h>
11 10
12extern const struct imx_imx_fb_data imx1_imx_fb_data; 11extern const struct imx_imx_fb_data imx1_imx_fb_data;
13#define imx1_add_imx_fb(pdata) \ 12#define imx1_add_imx_fb(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h
index 93ece55f75d..bd939328015 100644
--- a/arch/arm/mach-imx/devices-imx21.h
+++ b/arch/arm/mach-imx/devices-imx21.h
@@ -6,8 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/mx21.h> 9#include "devices/devices-common.h"
10#include <mach/devices-common.h>
11 10
12extern const struct imx_imx21_hcd_data imx21_imx21_hcd_data; 11extern const struct imx_imx21_hcd_data imx21_imx21_hcd_data;
13#define imx21_add_imx21_hcd(pdata) \ 12#define imx21_add_imx21_hcd(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx25.h b/arch/arm/mach-imx/devices-imx25.h
index f8e03dd1f11..0d2922bc575 100644
--- a/arch/arm/mach-imx/devices-imx25.h
+++ b/arch/arm/mach-imx/devices-imx25.h
@@ -6,8 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/mx25.h> 9#include "devices/devices-common.h"
10#include <mach/devices-common.h>
11 10
12extern const struct imx_fec_data imx25_fec_data; 11extern const struct imx_fec_data imx25_fec_data;
13#define imx25_add_fec(pdata) \ 12#define imx25_add_fec(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index 04822932cdd..13096251975 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -6,8 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/mx27.h> 9#include "devices/devices-common.h"
10#include <mach/devices-common.h>
11 10
12extern const struct imx_fec_data imx27_fec_data; 11extern const struct imx_fec_data imx27_fec_data;
13#define imx27_add_fec(pdata) \ 12#define imx27_add_fec(pdata) \
@@ -54,8 +53,10 @@ extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[];
54extern const struct imx_mx2_camera_data imx27_mx2_camera_data; 53extern const struct imx_mx2_camera_data imx27_mx2_camera_data;
55#define imx27_add_mx2_camera(pdata) \ 54#define imx27_add_mx2_camera(pdata) \
56 imx_add_mx2_camera(&imx27_mx2_camera_data, pdata) 55 imx_add_mx2_camera(&imx27_mx2_camera_data, pdata)
56
57extern const struct imx_mx2_emma_data imx27_mx2_emmaprp_data;
57#define imx27_add_mx2_emmaprp() \ 58#define imx27_add_mx2_emmaprp() \
58 imx_add_mx2_emmaprp(&imx27_mx2_camera_data) 59 imx_add_mx2_emmaprp(&imx27_mx2_emmaprp_data)
59 60
60extern const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data; 61extern const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data;
61#define imx27_add_mxc_ehci_otg(pdata) \ 62#define imx27_add_mxc_ehci_otg(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx31.h b/arch/arm/mach-imx/devices-imx31.h
index 8b2ceb45bb8..e8d1611bbc8 100644
--- a/arch/arm/mach-imx/devices-imx31.h
+++ b/arch/arm/mach-imx/devices-imx31.h
@@ -6,8 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/mx31.h> 9#include "devices/devices-common.h"
10#include <mach/devices-common.h>
11 10
12extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data; 11extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data;
13#define imx31_add_fsl_usb2_udc(pdata) \ 12#define imx31_add_fsl_usb2_udc(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx35.h b/arch/arm/mach-imx/devices-imx35.h
index c3e9f206ac2..e2675f1b141 100644
--- a/arch/arm/mach-imx/devices-imx35.h
+++ b/arch/arm/mach-imx/devices-imx35.h
@@ -6,8 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/mx35.h> 9#include "devices/devices-common.h"
10#include <mach/devices-common.h>
11 10
12extern const struct imx_fec_data imx35_fec_data; 11extern const struct imx_fec_data imx35_fec_data;
13#define imx35_add_fec(pdata) \ 12#define imx35_add_fec(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx50.h b/arch/arm/mach-imx/devices-imx50.h
index 7216667eaaf..2c290391f29 100644
--- a/arch/arm/mach-imx/devices-imx50.h
+++ b/arch/arm/mach-imx/devices-imx50.h
@@ -18,8 +18,7 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */ 19 */
20 20
21#include <mach/mx50.h> 21#include "devices/devices-common.h"
22#include <mach/devices-common.h>
23 22
24extern const struct imx_imx_uart_1irq_data imx50_imx_uart_data[]; 23extern const struct imx_imx_uart_1irq_data imx50_imx_uart_data[];
25#define imx50_add_imx_uart(id, pdata) \ 24#define imx50_add_imx_uart(id, pdata) \
diff --git a/arch/arm/mach-imx/devices-imx51.h b/arch/arm/mach-imx/devices-imx51.h
index 9f171872519..deee5baee88 100644
--- a/arch/arm/mach-imx/devices-imx51.h
+++ b/arch/arm/mach-imx/devices-imx51.h
@@ -6,8 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/mx51.h> 9#include "devices/devices-common.h"
10#include <mach/devices-common.h>
11 10
12extern const struct imx_fec_data imx51_fec_data; 11extern const struct imx_fec_data imx51_fec_data;
13#define imx51_add_fec(pdata) \ 12#define imx51_add_fec(pdata) \
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
index a35d9841f49..9a8f1ca7bcb 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -56,6 +56,9 @@ config IMX_HAVE_PLATFORM_MX1_CAMERA
56config IMX_HAVE_PLATFORM_MX2_CAMERA 56config IMX_HAVE_PLATFORM_MX2_CAMERA
57 bool 57 bool
58 58
59config IMX_HAVE_PLATFORM_MX2_EMMA
60 bool
61
59config IMX_HAVE_PLATFORM_MXC_EHCI 62config IMX_HAVE_PLATFORM_MXC_EHCI
60 bool 63 bool
61 64
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/mach-imx/devices/Makefile
index 76f3195475d..6acf37e0c11 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/mach-imx/devices/Makefile
@@ -1,3 +1,5 @@
1obj-y := devices.o
2
1obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o 3obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
2obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o 4obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
3obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o 5obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
@@ -28,3 +30,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
28obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o 30obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o
29obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o 31obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
30obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o 32obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o
33obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_EMMA) += platform-mx2-emma.o
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index eaf79d220c9..6277baf1b7b 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -108,6 +108,7 @@ struct platform_device *__init imx_add_imxdi_rtc(
108 108
109#include <linux/platform_data/video-imxfb.h> 109#include <linux/platform_data/video-imxfb.h>
110struct imx_imx_fb_data { 110struct imx_imx_fb_data {
111 const char *devid;
111 resource_size_t iobase; 112 resource_size_t iobase;
112 resource_size_t iosize; 113 resource_size_t iosize;
113 resource_size_t irq; 114 resource_size_t irq;
@@ -118,6 +119,7 @@ struct platform_device *__init imx_add_imx_fb(
118 119
119#include <linux/platform_data/i2c-imx.h> 120#include <linux/platform_data/i2c-imx.h>
120struct imx_imx_i2c_data { 121struct imx_imx_i2c_data {
122 const char *devid;
121 int id; 123 int id;
122 resource_size_t iobase; 124 resource_size_t iobase;
123 resource_size_t iosize; 125 resource_size_t iosize;
@@ -219,6 +221,7 @@ struct platform_device *__init imx_add_mx1_camera(
219 221
220#include <linux/platform_data/camera-mx2.h> 222#include <linux/platform_data/camera-mx2.h>
221struct imx_mx2_camera_data { 223struct imx_mx2_camera_data {
224 const char *devid;
222 resource_size_t iobasecsi; 225 resource_size_t iobasecsi;
223 resource_size_t iosizecsi; 226 resource_size_t iosizecsi;
224 resource_size_t irqcsi; 227 resource_size_t irqcsi;
@@ -229,8 +232,15 @@ struct imx_mx2_camera_data {
229struct platform_device *__init imx_add_mx2_camera( 232struct platform_device *__init imx_add_mx2_camera(
230 const struct imx_mx2_camera_data *data, 233 const struct imx_mx2_camera_data *data,
231 const struct mx2_camera_platform_data *pdata); 234 const struct mx2_camera_platform_data *pdata);
235
236
237struct imx_mx2_emma_data {
238 resource_size_t iobase;
239 resource_size_t iosize;
240 resource_size_t irq;
241};
232struct platform_device *__init imx_add_mx2_emmaprp( 242struct platform_device *__init imx_add_mx2_emmaprp(
233 const struct imx_mx2_camera_data *data); 243 const struct imx_mx2_emma_data *data);
234 244
235#include <linux/platform_data/usb-ehci-mxc.h> 245#include <linux/platform_data/usb-ehci-mxc.h>
236struct imx_mxc_ehci_data { 246struct imx_mxc_ehci_data {
@@ -244,6 +254,7 @@ struct platform_device *__init imx_add_mxc_ehci(
244 254
245#include <linux/platform_data/mmc-mxcmmc.h> 255#include <linux/platform_data/mmc-mxcmmc.h>
246struct imx_mxc_mmc_data { 256struct imx_mxc_mmc_data {
257 const char *devid;
247 int id; 258 int id;
248 resource_size_t iobase; 259 resource_size_t iobase;
249 resource_size_t iosize; 260 resource_size_t iosize;
@@ -256,6 +267,7 @@ struct platform_device *__init imx_add_mxc_mmc(
256 267
257#include <linux/platform_data/mtd-mxc_nand.h> 268#include <linux/platform_data/mtd-mxc_nand.h>
258struct imx_mxc_nand_data { 269struct imx_mxc_nand_data {
270 const char *devid;
259 /* 271 /*
260 * id is traditionally 0, but -1 is more appropriate. We use -1 for new 272 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
261 * machines but don't change existing devices as the nand device usually 273 * machines but don't change existing devices as the nand device usually
@@ -290,6 +302,7 @@ struct platform_device *__init imx_add_mxc_pwm(
290 302
291/* mxc_rtc */ 303/* mxc_rtc */
292struct imx_mxc_rtc_data { 304struct imx_mxc_rtc_data {
305 const char *devid;
293 resource_size_t iobase; 306 resource_size_t iobase;
294 resource_size_t irq; 307 resource_size_t irq;
295}; 308};
@@ -326,7 +339,8 @@ struct platform_device *__init imx_add_spi_imx(
326 const struct imx_spi_imx_data *data, 339 const struct imx_spi_imx_data *data,
327 const struct spi_imx_master *pdata); 340 const struct spi_imx_master *pdata);
328 341
329struct platform_device *imx_add_imx_dma(void); 342struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
343 int irq, int irq_err);
330struct platform_device *imx_add_imx_sdma(char *name, 344struct platform_device *imx_add_imx_sdma(char *name,
331 resource_size_t iobase, int irq, struct sdma_platform_data *pdata); 345 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
332 346
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/mach-imx/devices/devices.c
index 4d55a7a26e9..1b37482407f 100644
--- a/arch/arm/plat-mxc/devices.c
+++ b/arch/arm/mach-imx/devices/devices.c
@@ -21,7 +21,6 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <mach/common.h>
25 24
26struct device mxc_aips_bus = { 25struct device mxc_aips_bus = {
27 .init_name = "mxc_aips", 26 .init_name = "mxc_aips",
@@ -33,7 +32,7 @@ struct device mxc_ahb_bus = {
33 .parent = &platform_bus, 32 .parent = &platform_bus,
34}; 33};
35 34
36static int __init mxc_device_init(void) 35int __init mxc_device_init(void)
37{ 36{
38 int ret; 37 int ret;
39 38
@@ -46,4 +45,3 @@ static int __init mxc_device_init(void)
46done: 45done:
47 return ret; 46 return ret;
48} 47}
49core_initcall(mxc_device_init);
diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/mach-imx/devices/platform-ahci-imx.c
index ade4a1c4e2a..3d87dd9c284 100644
--- a/arch/arm/plat-mxc/devices/platform-ahci-imx.c
+++ b/arch/arm/mach-imx/devices/platform-ahci-imx.c
@@ -24,8 +24,9 @@
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <asm/sizes.h> 26#include <asm/sizes.h>
27#include <mach/hardware.h> 27
28#include <mach/devices-common.h> 28#include "../hardware.h"
29#include "devices-common.h"
29 30
30#define imx_ahci_imx_data_entry_single(soc, _devid) \ 31#define imx_ahci_imx_data_entry_single(soc, _devid) \
31 { \ 32 { \
diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/mach-imx/devices/platform-fec.c
index 0bae44e890d..2cb188ad9a0 100644
--- a/arch/arm/plat-mxc/devices/platform-fec.c
+++ b/arch/arm/mach-imx/devices/platform-fec.c
@@ -8,8 +8,9 @@
8 */ 8 */
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <asm/sizes.h> 10#include <asm/sizes.h>
11#include <mach/hardware.h> 11
12#include <mach/devices-common.h> 12#include "../hardware.h"
13#include "devices-common.h"
13 14
14#define imx_fec_data_entry_single(soc, _devid) \ 15#define imx_fec_data_entry_single(soc, _devid) \
15 { \ 16 { \
diff --git a/arch/arm/plat-mxc/devices/platform-flexcan.c b/arch/arm/mach-imx/devices/platform-flexcan.c
index 4e8497af2eb..1078bf0a94e 100644
--- a/arch/arm/plat-mxc/devices/platform-flexcan.c
+++ b/arch/arm/mach-imx/devices/platform-flexcan.c
@@ -5,8 +5,8 @@
5 * the terms of the GNU General Public License version 2 as published by the 5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation. 6 * Free Software Foundation.
7 */ 7 */
8#include <mach/hardware.h> 8#include "../hardware.h"
9#include <mach/devices-common.h> 9#include "devices-common.h"
10 10
11#define imx_flexcan_data_entry_single(soc, _id, _hwid, _size) \ 11#define imx_flexcan_data_entry_single(soc, _id, _hwid, _size) \
12 { \ 12 { \
diff --git a/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
index 848038f301f..37e44398197 100644
--- a/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c
+++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
@@ -7,8 +7,9 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <mach/hardware.h> 10
11#include <mach/devices-common.h> 11#include "../hardware.h"
12#include "devices-common.h"
12 13
13#define imx_fsl_usb2_udc_data_entry_single(soc) \ 14#define imx_fsl_usb2_udc_data_entry_single(soc) \
14 { \ 15 { \
diff --git a/arch/arm/plat-mxc/devices/platform-gpio-mxc.c b/arch/arm/mach-imx/devices/platform-gpio-mxc.c
index a7919a24103..26483fa94b7 100644
--- a/arch/arm/plat-mxc/devices/platform-gpio-mxc.c
+++ b/arch/arm/mach-imx/devices/platform-gpio-mxc.c
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices-common.h"
10 10
11struct platform_device *__init mxc_register_gpio(char *name, int id, 11struct platform_device *__init mxc_register_gpio(char *name, int id,
12 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high) 12 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high)
diff --git a/arch/arm/plat-mxc/devices/platform-gpio_keys.c b/arch/arm/mach-imx/devices/platform-gpio_keys.c
index 1c53a532ea0..486282539c7 100644
--- a/arch/arm/plat-mxc/devices/platform-gpio_keys.c
+++ b/arch/arm/mach-imx/devices/platform-gpio_keys.c
@@ -16,8 +16,9 @@
16 * Boston, MA 02110-1301, USA. 16 * Boston, MA 02110-1301, USA.
17 */ 17 */
18#include <asm/sizes.h> 18#include <asm/sizes.h>
19#include <mach/hardware.h> 19
20#include <mach/devices-common.h> 20#include "../hardware.h"
21#include "devices-common.h"
21 22
22struct platform_device *__init imx_add_gpio_keys( 23struct platform_device *__init imx_add_gpio_keys(
23 const struct gpio_keys_platform_data *pdata) 24 const struct gpio_keys_platform_data *pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/mach-imx/devices/platform-imx-dma.c
index 7fa7e9c9246..ccdb5dc4ddb 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-dma.c
+++ b/arch/arm/mach-imx/devices/platform-imx-dma.c
@@ -6,12 +6,29 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices-common.h"
10 10
11struct platform_device __init __maybe_unused *imx_add_imx_dma(void) 11struct platform_device __init __maybe_unused *imx_add_imx_dma(char *name,
12 resource_size_t iobase, int irq, int irq_err)
12{ 13{
14 struct resource res[] = {
15 {
16 .start = iobase,
17 .end = iobase + SZ_4K - 1,
18 .flags = IORESOURCE_MEM,
19 }, {
20 .start = irq,
21 .end = irq,
22 .flags = IORESOURCE_IRQ,
23 }, {
24 .start = irq_err,
25 .end = irq_err,
26 .flags = IORESOURCE_IRQ,
27 },
28 };
29
13 return platform_device_register_resndata(&mxc_ahb_bus, 30 return platform_device_register_resndata(&mxc_ahb_bus,
14 "imx-dma", -1, NULL, 0, NULL, 0); 31 name, -1, res, ARRAY_SIZE(res), NULL, 0);
15} 32}
16 33
17struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name, 34struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
diff --git a/arch/arm/plat-mxc/devices/platform-imx-fb.c b/arch/arm/mach-imx/devices/platform-imx-fb.c
index 2b0b5e0aa99..10b0ed39f07 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-fb.c
+++ b/arch/arm/mach-imx/devices/platform-imx-fb.c
@@ -7,11 +7,13 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <mach/hardware.h>
11#include <mach/devices-common.h>
12 10
13#define imx_imx_fb_data_entry_single(soc, _size) \ 11#include "../hardware.h"
12#include "devices-common.h"
13
14#define imx_imx_fb_data_entry_single(soc, _devid, _size) \
14 { \ 15 { \
16 .devid = _devid, \
15 .iobase = soc ## _LCDC_BASE_ADDR, \ 17 .iobase = soc ## _LCDC_BASE_ADDR, \
16 .iosize = _size, \ 18 .iosize = _size, \
17 .irq = soc ## _INT_LCDC, \ 19 .irq = soc ## _INT_LCDC, \
@@ -19,22 +21,22 @@
19 21
20#ifdef CONFIG_SOC_IMX1 22#ifdef CONFIG_SOC_IMX1
21const struct imx_imx_fb_data imx1_imx_fb_data __initconst = 23const struct imx_imx_fb_data imx1_imx_fb_data __initconst =
22 imx_imx_fb_data_entry_single(MX1, SZ_4K); 24 imx_imx_fb_data_entry_single(MX1, "imx1-fb", SZ_4K);
23#endif /* ifdef CONFIG_SOC_IMX1 */ 25#endif /* ifdef CONFIG_SOC_IMX1 */
24 26
25#ifdef CONFIG_SOC_IMX21 27#ifdef CONFIG_SOC_IMX21
26const struct imx_imx_fb_data imx21_imx_fb_data __initconst = 28const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
27 imx_imx_fb_data_entry_single(MX21, SZ_4K); 29 imx_imx_fb_data_entry_single(MX21, "imx21-fb", SZ_4K);
28#endif /* ifdef CONFIG_SOC_IMX21 */ 30#endif /* ifdef CONFIG_SOC_IMX21 */
29 31
30#ifdef CONFIG_SOC_IMX25 32#ifdef CONFIG_SOC_IMX25
31const struct imx_imx_fb_data imx25_imx_fb_data __initconst = 33const struct imx_imx_fb_data imx25_imx_fb_data __initconst =
32 imx_imx_fb_data_entry_single(MX25, SZ_16K); 34 imx_imx_fb_data_entry_single(MX25, "imx21-fb", SZ_16K);
33#endif /* ifdef CONFIG_SOC_IMX25 */ 35#endif /* ifdef CONFIG_SOC_IMX25 */
34 36
35#ifdef CONFIG_SOC_IMX27 37#ifdef CONFIG_SOC_IMX27
36const struct imx_imx_fb_data imx27_imx_fb_data __initconst = 38const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
37 imx_imx_fb_data_entry_single(MX27, SZ_4K); 39 imx_imx_fb_data_entry_single(MX27, "imx21-fb", SZ_4K);
38#endif /* ifdef CONFIG_SOC_IMX27 */ 40#endif /* ifdef CONFIG_SOC_IMX27 */
39 41
40struct platform_device *__init imx_add_imx_fb( 42struct platform_device *__init imx_add_imx_fb(
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/mach-imx/devices/platform-imx-i2c.c
index 19ad580c0be..8e30e5703cd 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c
+++ b/arch/arm/mach-imx/devices/platform-imx-i2c.c
@@ -6,34 +6,35 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size) \ 12#define imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size) \
13 { \ 13 { \
14 .devid = _devid, \
14 .id = _id, \ 15 .id = _id, \
15 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR, \ 16 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \ 17 .iosize = _size, \
17 .irq = soc ## _INT_I2C ## _hwid, \ 18 .irq = soc ## _INT_I2C ## _hwid, \
18 } 19 }
19 20
20#define imx_imx_i2c_data_entry(soc, _id, _hwid, _size) \ 21#define imx_imx_i2c_data_entry(soc, _devid, _id, _hwid, _size) \
21 [_id] = imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size) 22 [_id] = imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)
22 23
23#ifdef CONFIG_SOC_IMX1 24#ifdef CONFIG_SOC_IMX1
24const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst = 25const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst =
25 imx_imx_i2c_data_entry_single(MX1, 0, , SZ_4K); 26 imx_imx_i2c_data_entry_single(MX1, "imx1-i2c", 0, , SZ_4K);
26#endif /* ifdef CONFIG_SOC_IMX1 */ 27#endif /* ifdef CONFIG_SOC_IMX1 */
27 28
28#ifdef CONFIG_SOC_IMX21 29#ifdef CONFIG_SOC_IMX21
29const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst = 30const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
30 imx_imx_i2c_data_entry_single(MX21, 0, , SZ_4K); 31 imx_imx_i2c_data_entry_single(MX21, "imx21-i2c", 0, , SZ_4K);
31#endif /* ifdef CONFIG_SOC_IMX21 */ 32#endif /* ifdef CONFIG_SOC_IMX21 */
32 33
33#ifdef CONFIG_SOC_IMX25 34#ifdef CONFIG_SOC_IMX25
34const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = { 35const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
35#define imx25_imx_i2c_data_entry(_id, _hwid) \ 36#define imx25_imx_i2c_data_entry(_id, _hwid) \
36 imx_imx_i2c_data_entry(MX25, _id, _hwid, SZ_16K) 37 imx_imx_i2c_data_entry(MX25, "imx21-i2c", _id, _hwid, SZ_16K)
37 imx25_imx_i2c_data_entry(0, 1), 38 imx25_imx_i2c_data_entry(0, 1),
38 imx25_imx_i2c_data_entry(1, 2), 39 imx25_imx_i2c_data_entry(1, 2),
39 imx25_imx_i2c_data_entry(2, 3), 40 imx25_imx_i2c_data_entry(2, 3),
@@ -43,7 +44,7 @@ const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
43#ifdef CONFIG_SOC_IMX27 44#ifdef CONFIG_SOC_IMX27
44const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = { 45const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
45#define imx27_imx_i2c_data_entry(_id, _hwid) \ 46#define imx27_imx_i2c_data_entry(_id, _hwid) \
46 imx_imx_i2c_data_entry(MX27, _id, _hwid, SZ_4K) 47 imx_imx_i2c_data_entry(MX27, "imx21-i2c", _id, _hwid, SZ_4K)
47 imx27_imx_i2c_data_entry(0, 1), 48 imx27_imx_i2c_data_entry(0, 1),
48 imx27_imx_i2c_data_entry(1, 2), 49 imx27_imx_i2c_data_entry(1, 2),
49}; 50};
@@ -52,7 +53,7 @@ const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
52#ifdef CONFIG_SOC_IMX31 53#ifdef CONFIG_SOC_IMX31
53const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = { 54const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
54#define imx31_imx_i2c_data_entry(_id, _hwid) \ 55#define imx31_imx_i2c_data_entry(_id, _hwid) \
55 imx_imx_i2c_data_entry(MX31, _id, _hwid, SZ_4K) 56 imx_imx_i2c_data_entry(MX31, "imx21-i2c", _id, _hwid, SZ_4K)
56 imx31_imx_i2c_data_entry(0, 1), 57 imx31_imx_i2c_data_entry(0, 1),
57 imx31_imx_i2c_data_entry(1, 2), 58 imx31_imx_i2c_data_entry(1, 2),
58 imx31_imx_i2c_data_entry(2, 3), 59 imx31_imx_i2c_data_entry(2, 3),
@@ -62,7 +63,7 @@ const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
62#ifdef CONFIG_SOC_IMX35 63#ifdef CONFIG_SOC_IMX35
63const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = { 64const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
64#define imx35_imx_i2c_data_entry(_id, _hwid) \ 65#define imx35_imx_i2c_data_entry(_id, _hwid) \
65 imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K) 66 imx_imx_i2c_data_entry(MX35, "imx21-i2c", _id, _hwid, SZ_4K)
66 imx35_imx_i2c_data_entry(0, 1), 67 imx35_imx_i2c_data_entry(0, 1),
67 imx35_imx_i2c_data_entry(1, 2), 68 imx35_imx_i2c_data_entry(1, 2),
68 imx35_imx_i2c_data_entry(2, 3), 69 imx35_imx_i2c_data_entry(2, 3),
@@ -72,7 +73,7 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
72#ifdef CONFIG_SOC_IMX50 73#ifdef CONFIG_SOC_IMX50
73const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst = { 74const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst = {
74#define imx50_imx_i2c_data_entry(_id, _hwid) \ 75#define imx50_imx_i2c_data_entry(_id, _hwid) \
75 imx_imx_i2c_data_entry(MX50, _id, _hwid, SZ_4K) 76 imx_imx_i2c_data_entry(MX50, "imx21-i2c", _id, _hwid, SZ_4K)
76 imx50_imx_i2c_data_entry(0, 1), 77 imx50_imx_i2c_data_entry(0, 1),
77 imx50_imx_i2c_data_entry(1, 2), 78 imx50_imx_i2c_data_entry(1, 2),
78 imx50_imx_i2c_data_entry(2, 3), 79 imx50_imx_i2c_data_entry(2, 3),
@@ -82,10 +83,11 @@ const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst = {
82#ifdef CONFIG_SOC_IMX51 83#ifdef CONFIG_SOC_IMX51
83const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = { 84const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
84#define imx51_imx_i2c_data_entry(_id, _hwid) \ 85#define imx51_imx_i2c_data_entry(_id, _hwid) \
85 imx_imx_i2c_data_entry(MX51, _id, _hwid, SZ_4K) 86 imx_imx_i2c_data_entry(MX51, "imx21-i2c", _id, _hwid, SZ_4K)
86 imx51_imx_i2c_data_entry(0, 1), 87 imx51_imx_i2c_data_entry(0, 1),
87 imx51_imx_i2c_data_entry(1, 2), 88 imx51_imx_i2c_data_entry(1, 2),
88 { 89 {
90 .devid = "imx21-i2c",
89 .id = 2, 91 .id = 2,
90 .iobase = MX51_HSI2C_DMA_BASE_ADDR, 92 .iobase = MX51_HSI2C_DMA_BASE_ADDR,
91 .iosize = SZ_16K, 93 .iosize = SZ_16K,
@@ -97,7 +99,7 @@ const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
97#ifdef CONFIG_SOC_IMX53 99#ifdef CONFIG_SOC_IMX53
98const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = { 100const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = {
99#define imx53_imx_i2c_data_entry(_id, _hwid) \ 101#define imx53_imx_i2c_data_entry(_id, _hwid) \
100 imx_imx_i2c_data_entry(MX53, _id, _hwid, SZ_4K) 102 imx_imx_i2c_data_entry(MX53, "imx21-i2c", _id, _hwid, SZ_4K)
101 imx53_imx_i2c_data_entry(0, 1), 103 imx53_imx_i2c_data_entry(0, 1),
102 imx53_imx_i2c_data_entry(1, 2), 104 imx53_imx_i2c_data_entry(1, 2),
103 imx53_imx_i2c_data_entry(2, 3), 105 imx53_imx_i2c_data_entry(2, 3),
@@ -120,7 +122,7 @@ struct platform_device *__init imx_add_imx_i2c(
120 }, 122 },
121 }; 123 };
122 124
123 return imx_add_platform_device("imx-i2c", data->id, 125 return imx_add_platform_device(data->devid, data->id,
124 res, ARRAY_SIZE(res), 126 res, ARRAY_SIZE(res),
125 pdata, sizeof(*pdata)); 127 pdata, sizeof(*pdata));
126} 128}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-keypad.c b/arch/arm/mach-imx/devices/platform-imx-keypad.c
index 479c3e9f771..8f22a4c98a4 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-keypad.c
+++ b/arch/arm/mach-imx/devices/platform-imx-keypad.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_imx_keypad_data_entry_single(soc, _size) \ 12#define imx_imx_keypad_data_entry_single(soc, _size) \
13 { \ 13 { \
diff --git a/arch/arm/plat-mxc/devices/platform-imx-ssi.c b/arch/arm/mach-imx/devices/platform-imx-ssi.c
index 21c6f30e101..bfcb8f3dfa8 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-ssi.c
+++ b/arch/arm/mach-imx/devices/platform-imx-ssi.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_imx_ssi_data_entry(soc, _id, _hwid, _size) \ 12#define imx_imx_ssi_data_entry(soc, _id, _hwid, _size) \
13 [_id] = { \ 13 [_id] = { \
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/mach-imx/devices/platform-imx-uart.c
index d390f00bd29..67bf866a2cb 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-uart.c
+++ b/arch/arm/mach-imx/devices/platform-imx-uart.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size) \ 12#define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size) \
13 [_id] = { \ 13 [_id] = { \
diff --git a/arch/arm/plat-mxc/devices/platform-imx2-wdt.c b/arch/arm/mach-imx/devices/platform-imx2-wdt.c
index 5e07ef2bf1c..ec75d641368 100644
--- a/arch/arm/plat-mxc/devices/platform-imx2-wdt.c
+++ b/arch/arm/mach-imx/devices/platform-imx2-wdt.c
@@ -7,8 +7,9 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <asm/sizes.h> 9#include <asm/sizes.h>
10#include <mach/hardware.h> 10
11#include <mach/devices-common.h> 11#include "../hardware.h"
12#include "devices-common.h"
12 13
13#define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) \ 14#define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) \
14 { \ 15 { \
diff --git a/arch/arm/plat-mxc/devices/platform-imx21-hcd.c b/arch/arm/mach-imx/devices/platform-imx21-hcd.c
index 5770a42f33b..30c81616a9a 100644
--- a/arch/arm/plat-mxc/devices/platform-imx21-hcd.c
+++ b/arch/arm/mach-imx/devices/platform-imx21-hcd.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_imx21_hcd_data_entry_single(soc) \ 12#define imx_imx21_hcd_data_entry_single(soc) \
13 { \ 13 { \
diff --git a/arch/arm/plat-mxc/devices/platform-imx27-coda.c b/arch/arm/mach-imx/devices/platform-imx27-coda.c
index 8b12aacdf39..25bebc29e54 100644
--- a/arch/arm/plat-mxc/devices/platform-imx27-coda.c
+++ b/arch/arm/mach-imx/devices/platform-imx27-coda.c
@@ -7,8 +7,8 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9 9
10#include <mach/hardware.h> 10#include "../hardware.h"
11#include <mach/devices-common.h> 11#include "devices-common.h"
12 12
13#ifdef CONFIG_SOC_IMX27 13#ifdef CONFIG_SOC_IMX27
14const struct imx_imx27_coda_data imx27_coda_data __initconst = { 14const struct imx_imx27_coda_data imx27_coda_data __initconst = {
diff --git a/arch/arm/plat-mxc/devices/platform-imx_udc.c b/arch/arm/mach-imx/devices/platform-imx_udc.c
index 6fd675dfce1..5ced7e4e2c7 100644
--- a/arch/arm/plat-mxc/devices/platform-imx_udc.c
+++ b/arch/arm/mach-imx/devices/platform-imx_udc.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_imx_udc_data_entry_single(soc, _size) \ 12#define imx_imx_udc_data_entry_single(soc, _size) \
13 { \ 13 { \
diff --git a/arch/arm/plat-mxc/devices/platform-imxdi_rtc.c b/arch/arm/mach-imx/devices/platform-imxdi_rtc.c
index 805336fdc25..5bb490d556e 100644
--- a/arch/arm/plat-mxc/devices/platform-imxdi_rtc.c
+++ b/arch/arm/mach-imx/devices/platform-imxdi_rtc.c
@@ -7,8 +7,9 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <asm/sizes.h> 9#include <asm/sizes.h>
10#include <mach/hardware.h> 10
11#include <mach/devices-common.h> 11#include "../hardware.h"
12#include "devices-common.h"
12 13
13#define imx_imxdi_rtc_data_entry_single(soc) \ 14#define imx_imxdi_rtc_data_entry_single(soc) \
14 { \ 15 { \
diff --git a/arch/arm/plat-mxc/devices/platform-ipu-core.c b/arch/arm/mach-imx/devices/platform-ipu-core.c
index d1e33cc6f12..fc4dd7cedc1 100644
--- a/arch/arm/plat-mxc/devices/platform-ipu-core.c
+++ b/arch/arm/mach-imx/devices/platform-ipu-core.c
@@ -7,8 +7,9 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <mach/hardware.h> 10
11#include <mach/devices-common.h> 11#include "../hardware.h"
12#include "devices-common.h"
12 13
13#define imx_ipu_core_entry_single(soc) \ 14#define imx_ipu_core_entry_single(soc) \
14{ \ 15{ \
diff --git a/arch/arm/plat-mxc/devices/platform-mx1-camera.c b/arch/arm/mach-imx/devices/platform-mx1-camera.c
index edcc581a30a..2c678813108 100644
--- a/arch/arm/plat-mxc/devices/platform-mx1-camera.c
+++ b/arch/arm/mach-imx/devices/platform-mx1-camera.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_mx1_camera_data_entry_single(soc, _size) \ 12#define imx_mx1_camera_data_entry_single(soc, _size) \
13 { \ 13 { \
diff --git a/arch/arm/plat-mxc/devices/platform-mx2-camera.c b/arch/arm/mach-imx/devices/platform-mx2-camera.c
index 11eace953a0..b53e1f348f5 100644
--- a/arch/arm/plat-mxc/devices/platform-mx2-camera.c
+++ b/arch/arm/mach-imx/devices/platform-mx2-camera.c
@@ -6,17 +6,19 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_mx2_camera_data_entry_single(soc) \ 12#define imx_mx2_camera_data_entry_single(soc, _devid) \
13 { \ 13 { \
14 .devid = _devid, \
14 .iobasecsi = soc ## _CSI_BASE_ADDR, \ 15 .iobasecsi = soc ## _CSI_BASE_ADDR, \
15 .iosizecsi = SZ_4K, \ 16 .iosizecsi = SZ_4K, \
16 .irqcsi = soc ## _INT_CSI, \ 17 .irqcsi = soc ## _INT_CSI, \
17 } 18 }
18#define imx_mx2_camera_data_entry_single_emma(soc) \ 19#define imx_mx2_camera_data_entry_single_emma(soc, _devid) \
19 { \ 20 { \
21 .devid = _devid, \
20 .iobasecsi = soc ## _CSI_BASE_ADDR, \ 22 .iobasecsi = soc ## _CSI_BASE_ADDR, \
21 .iosizecsi = SZ_32, \ 23 .iosizecsi = SZ_32, \
22 .irqcsi = soc ## _INT_CSI, \ 24 .irqcsi = soc ## _INT_CSI, \
@@ -27,12 +29,12 @@
27 29
28#ifdef CONFIG_SOC_IMX25 30#ifdef CONFIG_SOC_IMX25
29const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst = 31const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst =
30 imx_mx2_camera_data_entry_single(MX25); 32 imx_mx2_camera_data_entry_single(MX25, "imx25-camera");
31#endif /* ifdef CONFIG_SOC_IMX25 */ 33#endif /* ifdef CONFIG_SOC_IMX25 */
32 34
33#ifdef CONFIG_SOC_IMX27 35#ifdef CONFIG_SOC_IMX27
34const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = 36const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
35 imx_mx2_camera_data_entry_single_emma(MX27); 37 imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera");
36#endif /* ifdef CONFIG_SOC_IMX27 */ 38#endif /* ifdef CONFIG_SOC_IMX27 */
37 39
38struct platform_device *__init imx_add_mx2_camera( 40struct platform_device *__init imx_add_mx2_camera(
@@ -58,25 +60,8 @@ struct platform_device *__init imx_add_mx2_camera(
58 .flags = IORESOURCE_IRQ, 60 .flags = IORESOURCE_IRQ,
59 }, 61 },
60 }; 62 };
61 return imx_add_platform_device_dmamask("mx2-camera", 0, 63 return imx_add_platform_device_dmamask(data->devid, 0,
62 res, data->iobaseemmaprp ? 4 : 2, 64 res, data->iobaseemmaprp ? 4 : 2,
63 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 65 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
64} 66}
65 67
66struct platform_device *__init imx_add_mx2_emmaprp(
67 const struct imx_mx2_camera_data *data)
68{
69 struct resource res[] = {
70 {
71 .start = data->iobaseemmaprp,
72 .end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
73 .flags = IORESOURCE_MEM,
74 }, {
75 .start = data->irqemmaprp,
76 .end = data->irqemmaprp,
77 .flags = IORESOURCE_IRQ,
78 },
79 };
80 return imx_add_platform_device_dmamask("m2m-emmaprp", 0,
81 res, 2, NULL, 0, DMA_BIT_MASK(32));
82}
diff --git a/arch/arm/plat-mxc/devices/platform-mxc-ehci.c b/arch/arm/mach-imx/devices/platform-mxc-ehci.c
index 35851d889ac..5d4bbbfde64 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc-ehci.c
+++ b/arch/arm/mach-imx/devices/platform-mxc-ehci.c
@@ -7,8 +7,9 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <mach/hardware.h> 10
11#include <mach/devices-common.h> 11#include "../hardware.h"
12#include "devices-common.h"
12 13
13#define imx_mxc_ehci_data_entry_single(soc, _id, hs) \ 14#define imx_mxc_ehci_data_entry_single(soc, _id, hs) \
14 { \ 15 { \
diff --git a/arch/arm/plat-mxc/devices/platform-mxc-mmc.c b/arch/arm/mach-imx/devices/platform-mxc-mmc.c
index e7b920b5867..b8203c760c8 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc-mmc.c
+++ b/arch/arm/mach-imx/devices/platform-mxc-mmc.c
@@ -7,24 +7,26 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <mach/hardware.h>
11#include <mach/devices-common.h>
12 10
13#define imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size) \ 11#include "../hardware.h"
12#include "devices-common.h"
13
14#define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size) \
14 { \ 15 { \
16 .devid = _devid, \
15 .id = _id, \ 17 .id = _id, \
16 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \ 18 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \
17 .iosize = _size, \ 19 .iosize = _size, \
18 .irq = soc ## _INT_SDHC ## _hwid, \ 20 .irq = soc ## _INT_SDHC ## _hwid, \
19 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \ 21 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \
20 } 22 }
21#define imx_mxc_mmc_data_entry(soc, _id, _hwid, _size) \ 23#define imx_mxc_mmc_data_entry(soc, _devid, _id, _hwid, _size) \
22 [_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size) 24 [_id] = imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)
23 25
24#ifdef CONFIG_SOC_IMX21 26#ifdef CONFIG_SOC_IMX21
25const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = { 27const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
26#define imx21_mxc_mmc_data_entry(_id, _hwid) \ 28#define imx21_mxc_mmc_data_entry(_id, _hwid) \
27 imx_mxc_mmc_data_entry(MX21, _id, _hwid, SZ_4K) 29 imx_mxc_mmc_data_entry(MX21, "imx21-mmc", _id, _hwid, SZ_4K)
28 imx21_mxc_mmc_data_entry(0, 1), 30 imx21_mxc_mmc_data_entry(0, 1),
29 imx21_mxc_mmc_data_entry(1, 2), 31 imx21_mxc_mmc_data_entry(1, 2),
30}; 32};
@@ -33,7 +35,7 @@ const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
33#ifdef CONFIG_SOC_IMX27 35#ifdef CONFIG_SOC_IMX27
34const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = { 36const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
35#define imx27_mxc_mmc_data_entry(_id, _hwid) \ 37#define imx27_mxc_mmc_data_entry(_id, _hwid) \
36 imx_mxc_mmc_data_entry(MX27, _id, _hwid, SZ_4K) 38 imx_mxc_mmc_data_entry(MX27, "imx21-mmc", _id, _hwid, SZ_4K)
37 imx27_mxc_mmc_data_entry(0, 1), 39 imx27_mxc_mmc_data_entry(0, 1),
38 imx27_mxc_mmc_data_entry(1, 2), 40 imx27_mxc_mmc_data_entry(1, 2),
39}; 41};
@@ -42,7 +44,7 @@ const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
42#ifdef CONFIG_SOC_IMX31 44#ifdef CONFIG_SOC_IMX31
43const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = { 45const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
44#define imx31_mxc_mmc_data_entry(_id, _hwid) \ 46#define imx31_mxc_mmc_data_entry(_id, _hwid) \
45 imx_mxc_mmc_data_entry(MX31, _id, _hwid, SZ_16K) 47 imx_mxc_mmc_data_entry(MX31, "imx31-mmc", _id, _hwid, SZ_16K)
46 imx31_mxc_mmc_data_entry(0, 1), 48 imx31_mxc_mmc_data_entry(0, 1),
47 imx31_mxc_mmc_data_entry(1, 2), 49 imx31_mxc_mmc_data_entry(1, 2),
48}; 50};
@@ -67,7 +69,7 @@ struct platform_device *__init imx_add_mxc_mmc(
67 .flags = IORESOURCE_DMA, 69 .flags = IORESOURCE_DMA,
68 }, 70 },
69 }; 71 };
70 return imx_add_platform_device_dmamask("mxc-mmc", data->id, 72 return imx_add_platform_device_dmamask(data->devid, data->id,
71 res, ARRAY_SIZE(res), 73 res, ARRAY_SIZE(res),
72 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 74 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
73} 75}
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_nand.c b/arch/arm/mach-imx/devices/platform-mxc_nand.c
index 95b75cc7051..7af1c53e42b 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_nand.c
+++ b/arch/arm/mach-imx/devices/platform-mxc_nand.c
@@ -7,18 +7,21 @@
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <asm/sizes.h> 9#include <asm/sizes.h>
10#include <mach/hardware.h>
11#include <mach/devices-common.h>
12 10
13#define imx_mxc_nand_data_entry_single(soc, _size) \ 11#include "../hardware.h"
12#include "devices-common.h"
13
14#define imx_mxc_nand_data_entry_single(soc, _devid, _size) \
14 { \ 15 { \
16 .devid = _devid, \
15 .iobase = soc ## _NFC_BASE_ADDR, \ 17 .iobase = soc ## _NFC_BASE_ADDR, \
16 .iosize = _size, \ 18 .iosize = _size, \
17 .irq = soc ## _INT_NFC \ 19 .irq = soc ## _INT_NFC \
18 } 20 }
19 21
20#define imx_mxc_nandv3_data_entry_single(soc, _size) \ 22#define imx_mxc_nandv3_data_entry_single(soc, _devid, _size) \
21 { \ 23 { \
24 .devid = _devid, \
22 .id = -1, \ 25 .id = -1, \
23 .iobase = soc ## _NFC_BASE_ADDR, \ 26 .iobase = soc ## _NFC_BASE_ADDR, \
24 .iosize = _size, \ 27 .iosize = _size, \
@@ -28,32 +31,32 @@
28 31
29#ifdef CONFIG_SOC_IMX21 32#ifdef CONFIG_SOC_IMX21
30const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst = 33const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
31 imx_mxc_nand_data_entry_single(MX21, SZ_4K); 34 imx_mxc_nand_data_entry_single(MX21, "imx21-nand", SZ_4K);
32#endif /* ifdef CONFIG_SOC_IMX21 */ 35#endif /* ifdef CONFIG_SOC_IMX21 */
33 36
34#ifdef CONFIG_SOC_IMX25 37#ifdef CONFIG_SOC_IMX25
35const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst = 38const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
36 imx_mxc_nand_data_entry_single(MX25, SZ_8K); 39 imx_mxc_nand_data_entry_single(MX25, "imx25-nand", SZ_8K);
37#endif /* ifdef CONFIG_SOC_IMX25 */ 40#endif /* ifdef CONFIG_SOC_IMX25 */
38 41
39#ifdef CONFIG_SOC_IMX27 42#ifdef CONFIG_SOC_IMX27
40const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst = 43const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
41 imx_mxc_nand_data_entry_single(MX27, SZ_4K); 44 imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K);
42#endif /* ifdef CONFIG_SOC_IMX27 */ 45#endif /* ifdef CONFIG_SOC_IMX27 */
43 46
44#ifdef CONFIG_SOC_IMX31 47#ifdef CONFIG_SOC_IMX31
45const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst = 48const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
46 imx_mxc_nand_data_entry_single(MX31, SZ_4K); 49 imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K);
47#endif 50#endif
48 51
49#ifdef CONFIG_SOC_IMX35 52#ifdef CONFIG_SOC_IMX35
50const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst = 53const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
51 imx_mxc_nand_data_entry_single(MX35, SZ_8K); 54 imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K);
52#endif 55#endif
53 56
54#ifdef CONFIG_SOC_IMX51 57#ifdef CONFIG_SOC_IMX51
55const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst = 58const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
56 imx_mxc_nandv3_data_entry_single(MX51, SZ_16K); 59 imx_mxc_nandv3_data_entry_single(MX51, "imx51-nand", SZ_16K);
57#endif 60#endif
58 61
59struct platform_device *__init imx_add_mxc_nand( 62struct platform_device *__init imx_add_mxc_nand(
@@ -76,7 +79,7 @@ struct platform_device *__init imx_add_mxc_nand(
76 .flags = IORESOURCE_MEM, 79 .flags = IORESOURCE_MEM,
77 }, 80 },
78 }; 81 };
79 return imx_add_platform_device("mxc_nand", data->id, 82 return imx_add_platform_device(data->devid, data->id,
80 res, ARRAY_SIZE(res) - !data->axibase, 83 res, ARRAY_SIZE(res) - !data->axibase,
81 pdata, sizeof(*pdata)); 84 pdata, sizeof(*pdata));
82} 85}
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/mach-imx/devices/platform-mxc_pwm.c
index b0c4ae29811..dcd28977768 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
+++ b/arch/arm/mach-imx/devices/platform-mxc_pwm.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) \ 12#define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) \
13 { \ 13 { \
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_rnga.c b/arch/arm/mach-imx/devices/platform-mxc_rnga.c
index b4b7612b6e1..c58404badb5 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_rnga.c
+++ b/arch/arm/mach-imx/devices/platform-mxc_rnga.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12struct imx_mxc_rnga_data { 12struct imx_mxc_rnga_data {
13 resource_size_t iobase; 13 resource_size_t iobase;
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_rtc.c b/arch/arm/mach-imx/devices/platform-mxc_rtc.c
index a5c9ad5721c..c7fffaadf84 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_rtc.c
+++ b/arch/arm/mach-imx/devices/platform-mxc_rtc.c
@@ -6,23 +6,24 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_mxc_rtc_data_entry_single(soc) \ 12#define imx_mxc_rtc_data_entry_single(soc, _devid) \
13 { \ 13 { \
14 .devid = _devid, \
14 .iobase = soc ## _RTC_BASE_ADDR, \ 15 .iobase = soc ## _RTC_BASE_ADDR, \
15 .irq = soc ## _INT_RTC, \ 16 .irq = soc ## _INT_RTC, \
16 } 17 }
17 18
18#ifdef CONFIG_SOC_IMX31 19#ifdef CONFIG_SOC_IMX31
19const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst = 20const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst =
20 imx_mxc_rtc_data_entry_single(MX31); 21 imx_mxc_rtc_data_entry_single(MX31, "imx21-rtc");
21#endif /* ifdef CONFIG_SOC_IMX31 */ 22#endif /* ifdef CONFIG_SOC_IMX31 */
22 23
23#ifdef CONFIG_SOC_IMX35 24#ifdef CONFIG_SOC_IMX35
24const struct imx_mxc_rtc_data imx35_mxc_rtc_data __initconst = 25const struct imx_mxc_rtc_data imx35_mxc_rtc_data __initconst =
25 imx_mxc_rtc_data_entry_single(MX35); 26 imx_mxc_rtc_data_entry_single(MX35, "imx21-rtc");
26#endif /* ifdef CONFIG_SOC_IMX35 */ 27#endif /* ifdef CONFIG_SOC_IMX35 */
27 28
28struct platform_device *__init imx_add_mxc_rtc( 29struct platform_device *__init imx_add_mxc_rtc(
@@ -40,6 +41,6 @@ struct platform_device *__init imx_add_mxc_rtc(
40 }, 41 },
41 }; 42 };
42 43
43 return imx_add_platform_device("mxc_rtc", -1, 44 return imx_add_platform_device(data->devid, -1,
44 res, ARRAY_SIZE(res), NULL, 0); 45 res, ARRAY_SIZE(res), NULL, 0);
45} 46}
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_w1.c b/arch/arm/mach-imx/devices/platform-mxc_w1.c
index 96fa5ea91fe..88c18b720d6 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_w1.c
+++ b/arch/arm/mach-imx/devices/platform-mxc_w1.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_mxc_w1_data_entry_single(soc) \ 12#define imx_mxc_w1_data_entry_single(soc) \
13 { \ 13 { \
diff --git a/arch/arm/plat-mxc/devices/platform-pata_imx.c b/arch/arm/mach-imx/devices/platform-pata_imx.c
index 70e2f2a4471..e4ec11c8ce5 100644
--- a/arch/arm/plat-mxc/devices/platform-pata_imx.c
+++ b/arch/arm/mach-imx/devices/platform-pata_imx.c
@@ -3,8 +3,8 @@
3 * the terms of the GNU General Public License version 2 as published by the 3 * the terms of the GNU General Public License version 2 as published by the
4 * Free Software Foundation. 4 * Free Software Foundation.
5 */ 5 */
6#include <mach/hardware.h> 6#include "../hardware.h"
7#include <mach/devices-common.h> 7#include "devices-common.h"
8 8
9#define imx_pata_imx_data_entry_single(soc, _size) \ 9#define imx_pata_imx_data_entry_single(soc, _size) \
10 { \ 10 { \
diff --git a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
index 3793e475cd9..e66a4e31631 100644
--- a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
+++ b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
@@ -6,10 +6,11 @@
6 * Free Software Foundation. 6 * Free Software Foundation.
7 */ 7 */
8 8
9#include <mach/hardware.h>
10#include <mach/devices-common.h>
11#include <linux/platform_data/mmc-esdhc-imx.h> 9#include <linux/platform_data/mmc-esdhc-imx.h>
12 10
11#include "../hardware.h"
12#include "devices-common.h"
13
13#define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \ 14#define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \
14 { \ 15 { \
15 .devid = _devid, \ 16 .devid = _devid, \
diff --git a/arch/arm/plat-mxc/devices/platform-spi_imx.c b/arch/arm/mach-imx/devices/platform-spi_imx.c
index 9c50c14c8f9..8880bcb11e0 100644
--- a/arch/arm/plat-mxc/devices/platform-spi_imx.c
+++ b/arch/arm/mach-imx/devices/platform-spi_imx.c
@@ -6,8 +6,8 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h> 9#include "../hardware.h"
10#include <mach/devices-common.h> 10#include "devices-common.h"
11 11
12#define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \ 12#define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \
13 { \ 13 { \
diff --git a/arch/arm/mach-imx/ehci-imx25.c b/arch/arm/mach-imx/ehci-imx25.c
index 576af744695..134c190e300 100644
--- a/arch/arm/mach-imx/ehci-imx25.c
+++ b/arch/arm/mach-imx/ehci-imx25.c
@@ -15,10 +15,10 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18
19#include <mach/hardware.h>
20#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
21 19
20#include "hardware.h"
21
22#define USBCTRL_OTGBASE_OFFSET 0x600 22#define USBCTRL_OTGBASE_OFFSET 0x600
23 23
24#define MX25_OTG_SIC_SHIFT 29 24#define MX25_OTG_SIC_SHIFT 29
diff --git a/arch/arm/mach-imx/ehci-imx27.c b/arch/arm/mach-imx/ehci-imx27.c
index cd6e1f81508..448d9115539 100644
--- a/arch/arm/mach-imx/ehci-imx27.c
+++ b/arch/arm/mach-imx/ehci-imx27.c
@@ -15,10 +15,10 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18
19#include <mach/hardware.h>
20#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
21 19
20#include "hardware.h"
21
22#define USBCTRL_OTGBASE_OFFSET 0x600 22#define USBCTRL_OTGBASE_OFFSET 0x600
23 23
24#define MX27_OTG_SIC_SHIFT 29 24#define MX27_OTG_SIC_SHIFT 29
diff --git a/arch/arm/mach-imx/ehci-imx31.c b/arch/arm/mach-imx/ehci-imx31.c
index 9a880c78af3..05de4e1e39d 100644
--- a/arch/arm/mach-imx/ehci-imx31.c
+++ b/arch/arm/mach-imx/ehci-imx31.c
@@ -15,10 +15,10 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18
19#include <mach/hardware.h>
20#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
21 19
20#include "hardware.h"
21
22#define USBCTRL_OTGBASE_OFFSET 0x600 22#define USBCTRL_OTGBASE_OFFSET 0x600
23 23
24#define MX31_OTG_SIC_SHIFT 29 24#define MX31_OTG_SIC_SHIFT 29
diff --git a/arch/arm/mach-imx/ehci-imx35.c b/arch/arm/mach-imx/ehci-imx35.c
index 293397852e4..554e7cccff5 100644
--- a/arch/arm/mach-imx/ehci-imx35.c
+++ b/arch/arm/mach-imx/ehci-imx35.c
@@ -15,10 +15,10 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18
19#include <mach/hardware.h>
20#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
21 19
20#include "hardware.h"
21
22#define USBCTRL_OTGBASE_OFFSET 0x600 22#define USBCTRL_OTGBASE_OFFSET 0x600
23 23
24#define MX35_OTG_SIC_SHIFT 29 24#define MX35_OTG_SIC_SHIFT 29
diff --git a/arch/arm/mach-imx/ehci-imx5.c b/arch/arm/mach-imx/ehci-imx5.c
index cf8d00e5cce..e49710b10c6 100644
--- a/arch/arm/mach-imx/ehci-imx5.c
+++ b/arch/arm/mach-imx/ehci-imx5.c
@@ -15,10 +15,10 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18
19#include <mach/hardware.h>
20#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
21 19
20#include "hardware.h"
21
22#define MXC_OTG_OFFSET 0 22#define MXC_OTG_OFFSET 0
23#define MXC_H1_OFFSET 0x200 23#define MXC_H1_OFFSET 0x200
24#define MXC_H2_OFFSET 0x400 24#define MXC_H2_OFFSET 0x400
diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/mach-imx/epit.c
index 88726f4dbbf..04a5961beea 100644
--- a/arch/arm/plat-mxc/epit.c
+++ b/arch/arm/mach-imx/epit.c
@@ -51,10 +51,10 @@
51#include <linux/clockchips.h> 51#include <linux/clockchips.h>
52#include <linux/clk.h> 52#include <linux/clk.h>
53#include <linux/err.h> 53#include <linux/err.h>
54
55#include <mach/hardware.h>
56#include <asm/mach/time.h> 54#include <asm/mach/time.h>
57#include <mach/common.h> 55
56#include "common.h"
57#include "hardware.h"
58 58
59static struct clock_event_device clockevent_epit; 59static struct clock_event_device clockevent_epit;
60static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; 60static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
diff --git a/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h b/arch/arm/mach-imx/eukrea-baseboards.h
index a21d3313f99..a21d3313f99 100644
--- a/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h
+++ b/arch/arm/mach-imx/eukrea-baseboards.h
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index 98aef571b9f..b4c70028d35 100644
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -29,11 +29,10 @@
29 29
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31 31
32#include <mach/common.h> 32#include "common.h"
33#include <mach/iomux-mx27.h>
34#include <mach/hardware.h>
35
36#include "devices-imx27.h" 33#include "devices-imx27.h"
34#include "hardware.h"
35#include "iomux-mx27.h"
37 36
38static const int eukrea_mbimx27_pins[] __initconst = { 37static const int eukrea_mbimx27_pins[] __initconst = {
39 /* UART2 */ 38 /* UART2 */
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
index 0b84666792f..e2b70f4c1a2 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
@@ -26,14 +26,14 @@
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <video/platform_lcd.h> 27#include <video/platform_lcd.h>
28 28
29#include <mach/hardware.h>
30#include <mach/iomux-mx25.h>
31#include <mach/common.h>
32#include <asm/mach-types.h> 29#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
34#include <mach/mx25.h>
35 31
32#include "common.h"
36#include "devices-imx25.h" 33#include "devices-imx25.h"
34#include "hardware.h"
35#include "iomux-mx25.h"
36#include "mx25.h"
37 37
38static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { 38static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
39 /* LCD */ 39 /* LCD */
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
index c6532a007d4..5a2d5ef12dd 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
@@ -36,11 +36,10 @@
36#include <asm/mach/time.h> 36#include <asm/mach/time.h>
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38 38
39#include <mach/hardware.h> 39#include "common.h"
40#include <mach/common.h>
41#include <mach/iomux-mx35.h>
42
43#include "devices-imx35.h" 40#include "devices-imx35.h"
41#include "hardware.h"
42#include "iomux-mx35.h"
44 43
45static const struct fb_videomode fb_modedb[] = { 44static const struct fb_videomode fb_modedb[] = {
46 { 45 {
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
index 8b0de30d7a3..9be6c1e69d6 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
@@ -36,11 +36,10 @@
36#include <asm/mach/time.h> 36#include <asm/mach/time.h>
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38 38
39#include <mach/hardware.h> 39#include "common.h"
40#include <mach/common.h>
41#include <mach/iomux-mx51.h>
42
43#include "devices-imx51.h" 40#include "devices-imx51.h"
41#include "hardware.h"
42#include "iomux-mx51.h"
44 43
45static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = { 44static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = {
46 /* LED */ 45 /* LED */
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/mach-imx/hardware.h
index ebf10654bb4..3ce7fa3bd43 100644
--- a/arch/arm/plat-mxc/include/mach/hardware.h
+++ b/arch/arm/mach-imx/hardware.h
@@ -105,20 +105,20 @@
105 105
106#define IMX_IO_ADDRESS(x) IOMEM(IMX_IO_P2V(x)) 106#define IMX_IO_ADDRESS(x) IOMEM(IMX_IO_P2V(x))
107 107
108#include <mach/mxc.h> 108#include "mxc.h"
109 109
110#include <mach/mx6q.h> 110#include "mx6q.h"
111#include <mach/mx50.h> 111#include "mx50.h"
112#include <mach/mx51.h> 112#include "mx51.h"
113#include <mach/mx53.h> 113#include "mx53.h"
114#include <mach/mx3x.h> 114#include "mx3x.h"
115#include <mach/mx31.h> 115#include "mx31.h"
116#include <mach/mx35.h> 116#include "mx35.h"
117#include <mach/mx2x.h> 117#include "mx2x.h"
118#include <mach/mx21.h> 118#include "mx21.h"
119#include <mach/mx27.h> 119#include "mx27.h"
120#include <mach/mx1.h> 120#include "mx1.h"
121#include <mach/mx25.h> 121#include "mx25.h"
122 122
123#define imx_map_entry(soc, name, _type) { \ 123#define imx_map_entry(soc, name, _type) { \
124 .virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR), \ 124 .virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR), \
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index b07b778dc9a..3dec962b077 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -13,7 +13,8 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/cp15.h> 15#include <asm/cp15.h>
16#include <mach/common.h> 16
17#include "common.h"
17 18
18static inline void cpu_enter_lowpower(void) 19static inline void cpu_enter_lowpower(void)
19{ 20{
diff --git a/arch/arm/plat-mxc/include/mach/iim.h b/arch/arm/mach-imx/iim.h
index 315bffadafd..315bffadafd 100644
--- a/arch/arm/plat-mxc/include/mach/iim.h
+++ b/arch/arm/mach-imx/iim.h
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
new file mode 100644
index 00000000000..e17dfbc4219
--- /dev/null
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2012 Sascha Hauer, Pengutronix
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <linux/irq.h>
13#include <linux/of_irq.h>
14#include <linux/of_platform.h>
15#include <asm/mach/arch.h>
16#include <asm/mach/time.h>
17#include "common.h"
18#include "mx25.h"
19
20static void __init imx25_dt_init(void)
21{
22 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
23}
24
25static void __init imx25_timer_init(void)
26{
27 mx25_clocks_init_dt();
28}
29
30static struct sys_timer imx25_timer = {
31 .init = imx25_timer_init,
32};
33
34static const char * const imx25_dt_board_compat[] __initconst = {
35 "fsl,imx25",
36 NULL
37};
38
39DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
40 .map_io = mx25_map_io,
41 .init_early = imx25_init_early,
42 .init_irq = mx25_init_irq,
43 .handle_irq = imx25_handle_irq,
44 .timer = &imx25_timer,
45 .init_machine = imx25_dt_init,
46 .dt_compat = imx25_dt_board_compat,
47 .restart = mxc_restart,
48MACHINE_END
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index e80d5235dac..ebfae96543c 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -14,21 +14,22 @@
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/mach/time.h> 16#include <asm/mach/time.h>
17#include <mach/common.h> 17
18#include <mach/mx27.h> 18#include "common.h"
19#include "mx27.h"
19 20
20static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = { 21static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
21 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART1_BASE_ADDR, "imx21-uart.0", NULL), 22 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART1_BASE_ADDR, "imx21-uart.0", NULL),
22 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART2_BASE_ADDR, "imx21-uart.1", NULL), 23 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART2_BASE_ADDR, "imx21-uart.1", NULL),
23 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART3_BASE_ADDR, "imx21-uart.2", NULL), 24 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART3_BASE_ADDR, "imx21-uart.2", NULL),
24 OF_DEV_AUXDATA("fsl,imx27-fec", MX27_FEC_BASE_ADDR, "imx27-fec.0", NULL), 25 OF_DEV_AUXDATA("fsl,imx27-fec", MX27_FEC_BASE_ADDR, "imx27-fec.0", NULL),
25 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx-i2c.0", NULL), 26 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx21-i2c.0", NULL),
26 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx-i2c.1", NULL), 27 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx21-i2c.1", NULL),
27 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI1_BASE_ADDR, "imx27-cspi.0", NULL), 28 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI1_BASE_ADDR, "imx27-cspi.0", NULL),
28 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI2_BASE_ADDR, "imx27-cspi.1", NULL), 29 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI2_BASE_ADDR, "imx27-cspi.1", NULL),
29 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI3_BASE_ADDR, "imx27-cspi.2", NULL), 30 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI3_BASE_ADDR, "imx27-cspi.2", NULL),
30 OF_DEV_AUXDATA("fsl,imx27-wdt", MX27_WDOG_BASE_ADDR, "imx2-wdt.0", NULL), 31 OF_DEV_AUXDATA("fsl,imx27-wdt", MX27_WDOG_BASE_ADDR, "imx2-wdt.0", NULL),
31 OF_DEV_AUXDATA("fsl,imx27-nand", MX27_NFC_BASE_ADDR, "mxc_nand.0", NULL), 32 OF_DEV_AUXDATA("fsl,imx27-nand", MX27_NFC_BASE_ADDR, "imx27-nand.0", NULL),
32 { /* sentinel */ } 33 { /* sentinel */ }
33}; 34};
34 35
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index a68ba207b2b..af476de2570 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -14,8 +14,9 @@
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/mach/time.h> 16#include <asm/mach/time.h>
17#include <mach/common.h> 17
18#include <mach/mx31.h> 18#include "common.h"
19#include "mx31.h"
19 20
20static const struct of_dev_auxdata imx31_auxdata_lookup[] __initconst = { 21static const struct of_dev_auxdata imx31_auxdata_lookup[] __initconst = {
21 OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART1_BASE_ADDR, 22 OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART1_BASE_ADDR,
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index f233b4bb234..5ffa40c673f 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -15,38 +15,13 @@
15#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/time.h> 17#include <asm/mach/time.h>
18#include <mach/common.h>
19#include <mach/mx51.h>
20 18
21/* 19#include "common.h"
22 * Lookup table for attaching a specific name and platform_data pointer to 20#include "mx51.h"
23 * devices as they get created by of_platform_populate(). Ideally this table
24 * would not exist, but the current clock implementation depends on some devices
25 * having a specific name.
26 */
27static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {
28 OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART1_BASE_ADDR, "imx21-uart.0", NULL),
29 OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART2_BASE_ADDR, "imx21-uart.1", NULL),
30 OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART3_BASE_ADDR, "imx21-uart.2", NULL),
31 OF_DEV_AUXDATA("fsl,imx51-fec", MX51_FEC_BASE_ADDR, "imx27-fec.0", NULL),
32 OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC1_BASE_ADDR, "sdhci-esdhc-imx51.0", NULL),
33 OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC2_BASE_ADDR, "sdhci-esdhc-imx51.1", NULL),
34 OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC3_BASE_ADDR, "sdhci-esdhc-imx51.2", NULL),
35 OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC4_BASE_ADDR, "sdhci-esdhc-imx51.3", NULL),
36 OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI1_BASE_ADDR, "imx51-ecspi.0", NULL),
37 OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI2_BASE_ADDR, "imx51-ecspi.1", NULL),
38 OF_DEV_AUXDATA("fsl,imx51-cspi", MX51_CSPI_BASE_ADDR, "imx35-cspi.0", NULL),
39 OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C1_BASE_ADDR, "imx-i2c.0", NULL),
40 OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C2_BASE_ADDR, "imx-i2c.1", NULL),
41 OF_DEV_AUXDATA("fsl,imx51-sdma", MX51_SDMA_BASE_ADDR, "imx35-sdma", NULL),
42 OF_DEV_AUXDATA("fsl,imx51-wdt", MX51_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL),
43 { /* sentinel */ }
44};
45 21
46static void __init imx51_dt_init(void) 22static void __init imx51_dt_init(void)
47{ 23{
48 of_platform_populate(NULL, of_default_bus_match_table, 24 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
49 imx51_auxdata_lookup, NULL);
50} 25}
51 26
52static void __init imx51_timer_init(void) 27static void __init imx51_timer_init(void)
diff --git a/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h b/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h
deleted file mode 100644
index df5f522da6b..00000000000
--- a/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __MACH_DMA_MX1_MX2_H__
2#define __MACH_DMA_MX1_MX2_H__
3/*
4 * Don't use this header in new code, it will go away when all users are
5 * converted to mach/dma-v1.h
6 */
7
8#include <mach/dma-v1.h>
9
10#endif /* ifndef __MACH_DMA_MX1_MX2_H__ */
diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index 82bd4403b45..cabefbc5e7c 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -22,8 +22,9 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <mach/hardware.h> 25
26#include <mach/iomux-mx3.h> 26#include "hardware.h"
27#include "iomux-mx3.h"
27 28
28/* 29/*
29 * IOMUX register (base) addresses 30 * IOMUX register (base) addresses
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx1.h b/arch/arm/mach-imx/iomux-mx1.h
index 6b1507cf378..95f4681d85d 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx1.h
+++ b/arch/arm/mach-imx/iomux-mx1.h
@@ -18,7 +18,7 @@
18#ifndef __MACH_IOMUX_MX1_H__ 18#ifndef __MACH_IOMUX_MX1_H__
19#define __MACH_IOMUX_MX1_H__ 19#define __MACH_IOMUX_MX1_H__
20 20
21#include <mach/iomux-v1.h> 21#include "iomux-v1.h"
22 22
23#define PA0_AIN_SPI2_CLK (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 0) 23#define PA0_AIN_SPI2_CLK (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 0)
24#define PA0_AF_ETMTRACESYNC (GPIO_PORTA | GPIO_AF | 0) 24#define PA0_AF_ETMTRACESYNC (GPIO_PORTA | GPIO_AF | 0)
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx21.h b/arch/arm/mach-imx/iomux-mx21.h
index 1495dfda783..a70cffceb08 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx21.h
+++ b/arch/arm/mach-imx/iomux-mx21.h
@@ -18,8 +18,8 @@
18#ifndef __MACH_IOMUX_MX21_H__ 18#ifndef __MACH_IOMUX_MX21_H__
19#define __MACH_IOMUX_MX21_H__ 19#define __MACH_IOMUX_MX21_H__
20 20
21#include <mach/iomux-mx2x.h> 21#include "iomux-mx2x.h"
22#include <mach/iomux-v1.h> 22#include "iomux-v1.h"
23 23
24/* Primary GPIO pin functions */ 24/* Primary GPIO pin functions */
25 25
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx25.h b/arch/arm/mach-imx/iomux-mx25.h
index c61ec0fc10d..be51e838375 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx25.h
+++ b/arch/arm/mach-imx/iomux-mx25.h
@@ -19,7 +19,7 @@
19#ifndef __MACH_IOMUX_MX25_H__ 19#ifndef __MACH_IOMUX_MX25_H__
20#define __MACH_IOMUX_MX25_H__ 20#define __MACH_IOMUX_MX25_H__
21 21
22#include <mach/iomux-v3.h> 22#include "iomux-v3.h"
23 23
24/* 24/*
25 * IOMUX/PAD Bit field definitions 25 * IOMUX/PAD Bit field definitions
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx27.h b/arch/arm/mach-imx/iomux-mx27.h
index d9f9a6e32d8..218e99e89e8 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx27.h
+++ b/arch/arm/mach-imx/iomux-mx27.h
@@ -19,8 +19,8 @@
19#ifndef __MACH_IOMUX_MX27_H__ 19#ifndef __MACH_IOMUX_MX27_H__
20#define __MACH_IOMUX_MX27_H__ 20#define __MACH_IOMUX_MX27_H__
21 21
22#include <mach/iomux-mx2x.h> 22#include "iomux-mx2x.h"
23#include <mach/iomux-v1.h> 23#include "iomux-v1.h"
24 24
25/* Primary GPIO pin functions */ 25/* Primary GPIO pin functions */
26 26
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx2x.h b/arch/arm/mach-imx/iomux-mx2x.h
index 7a9b20abda0..7a9b20abda0 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx2x.h
+++ b/arch/arm/mach-imx/iomux-mx2x.h
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx3.h b/arch/arm/mach-imx/iomux-mx3.h
index f79f78a1c0e..f79f78a1c0e 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx3.h
+++ b/arch/arm/mach-imx/iomux-mx3.h
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx35.h b/arch/arm/mach-imx/iomux-mx35.h
index 3117c18bbbd..90bfa6b5be6 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx35.h
+++ b/arch/arm/mach-imx/iomux-mx35.h
@@ -19,7 +19,7 @@
19#ifndef __MACH_IOMUX_MX35_H__ 19#ifndef __MACH_IOMUX_MX35_H__
20#define __MACH_IOMUX_MX35_H__ 20#define __MACH_IOMUX_MX35_H__
21 21
22#include <mach/iomux-v3.h> 22#include "iomux-v3.h"
23 23
24/* 24/*
25 * The naming convention for the pad modes is MX35_PAD_<padname>__<padmode> 25 * The naming convention for the pad modes is MX35_PAD_<padname>__<padmode>
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx50.h b/arch/arm/mach-imx/iomux-mx50.h
index 98e7fd0b908..00f56e0e800 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx50.h
+++ b/arch/arm/mach-imx/iomux-mx50.h
@@ -19,7 +19,7 @@
19#ifndef __MACH_IOMUX_MX50_H__ 19#ifndef __MACH_IOMUX_MX50_H__
20#define __MACH_IOMUX_MX50_H__ 20#define __MACH_IOMUX_MX50_H__
21 21
22#include <mach/iomux-v3.h> 22#include "iomux-v3.h"
23 23
24#define MX50_ELCDIF_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_DSE_HIGH) 24#define MX50_ELCDIF_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_DSE_HIGH)
25 25
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/mach-imx/iomux-mx51.h
index 2623e7a2e19..75bbcc4aa2d 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
+++ b/arch/arm/mach-imx/iomux-mx51.h
@@ -13,7 +13,7 @@
13#ifndef __MACH_IOMUX_MX51_H__ 13#ifndef __MACH_IOMUX_MX51_H__
14#define __MACH_IOMUX_MX51_H__ 14#define __MACH_IOMUX_MX51_H__
15 15
16#include <mach/iomux-v3.h> 16#include "iomux-v3.h"
17#define __NA_ 0x000 17#define __NA_ 0x000
18 18
19 19
diff --git a/arch/arm/plat-mxc/iomux-v1.c b/arch/arm/mach-imx/iomux-v1.c
index 1f73963bc13..2b156d1d9e2 100644
--- a/arch/arm/plat-mxc/iomux-v1.c
+++ b/arch/arm/mach-imx/iomux-v1.c
@@ -28,9 +28,10 @@
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30 30
31#include <mach/hardware.h>
32#include <asm/mach/map.h> 31#include <asm/mach/map.h>
33#include <mach/iomux-v1.h> 32
33#include "hardware.h"
34#include "iomux-v1.h"
34 35
35static void __iomem *imx_iomuxv1_baseaddr; 36static void __iomem *imx_iomuxv1_baseaddr;
36static unsigned imx_iomuxv1_numports; 37static unsigned imx_iomuxv1_numports;
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v1.h b/arch/arm/mach-imx/iomux-v1.h
index 02651a40fe2..02651a40fe2 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-v1.h
+++ b/arch/arm/mach-imx/iomux-v1.h
diff --git a/arch/arm/plat-mxc/iomux-v3.c b/arch/arm/mach-imx/iomux-v3.c
index 99a9cdb9d6b..9dae74bf47f 100644
--- a/arch/arm/plat-mxc/iomux-v3.c
+++ b/arch/arm/mach-imx/iomux-v3.c
@@ -25,9 +25,10 @@
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27 27
28#include <mach/hardware.h>
29#include <asm/mach/map.h> 28#include <asm/mach/map.h>
30#include <mach/iomux-v3.h> 29
30#include "hardware.h"
31#include "iomux-v3.h"
31 32
32static void __iomem *base; 33static void __iomem *base;
33 34
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/mach-imx/iomux-v3.h
index 2fa3b543010..2fa3b543010 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-v3.h
+++ b/arch/arm/mach-imx/iomux-v3.h
diff --git a/arch/arm/plat-mxc/include/mach/iram.h b/arch/arm/mach-imx/iram.h
index 022690c3370..022690c3370 100644
--- a/arch/arm/plat-mxc/include/mach/iram.h
+++ b/arch/arm/mach-imx/iram.h
diff --git a/arch/arm/plat-mxc/iram_alloc.c b/arch/arm/mach-imx/iram_alloc.c
index 074c3869626..6c80424f678 100644
--- a/arch/arm/plat-mxc/iram_alloc.c
+++ b/arch/arm/mach-imx/iram_alloc.c
@@ -22,7 +22,8 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/genalloc.h> 24#include <linux/genalloc.h>
25#include <mach/iram.h> 25
26#include "iram.h"
26 27
27static unsigned long iram_phys_base; 28static unsigned long iram_phys_base;
28static void __iomem *iram_virt_base; 29static void __iomem *iram_virt_base;
diff --git a/arch/arm/plat-mxc/irq-common.c b/arch/arm/mach-imx/irq-common.c
index b6e11458e5a..b6e11458e5a 100644
--- a/arch/arm/plat-mxc/irq-common.c
+++ b/arch/arm/mach-imx/irq-common.c
diff --git a/arch/arm/plat-mxc/irq-common.h b/arch/arm/mach-imx/irq-common.h
index 6ccb3a14c69..5b2dabba330 100644
--- a/arch/arm/plat-mxc/irq-common.h
+++ b/arch/arm/mach-imx/irq-common.h
@@ -19,6 +19,9 @@
19#ifndef __PLAT_MXC_IRQ_COMMON_H__ 19#ifndef __PLAT_MXC_IRQ_COMMON_H__
20#define __PLAT_MXC_IRQ_COMMON_H__ 20#define __PLAT_MXC_IRQ_COMMON_H__
21 21
22/* all normal IRQs can be FIQs */
23#define FIQ_START 0
24
22struct mxc_extra_irq 25struct mxc_extra_irq
23{ 26{
24 int (*set_priority)(unsigned char irq, unsigned char prio); 27 int (*set_priority)(unsigned char irq, unsigned char prio);
diff --git a/arch/arm/mach-imx/lluart.c b/arch/arm/mach-imx/lluart.c
index c40a34c0048..2fdc9bf2fb5 100644
--- a/arch/arm/mach-imx/lluart.c
+++ b/arch/arm/mach-imx/lluart.c
@@ -14,19 +14,28 @@
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/sizes.h> 15#include <asm/sizes.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <mach/hardware.h> 17
18#include "hardware.h"
19
20#define IMX6Q_UART1_BASE_ADDR 0x02020000
21#define IMX6Q_UART2_BASE_ADDR 0x021e8000
22#define IMX6Q_UART3_BASE_ADDR 0x021ec000
23#define IMX6Q_UART4_BASE_ADDR 0x021f0000
24#define IMX6Q_UART5_BASE_ADDR 0x021f4000
25
26/*
27 * IMX6Q_UART_BASE_ADDR is put in the middle to force the expansion
28 * of IMX6Q_UART##n##_BASE_ADDR.
29 */
30#define IMX6Q_UART_BASE_ADDR(n) IMX6Q_UART##n##_BASE_ADDR
31#define IMX6Q_UART_BASE(n) IMX6Q_UART_BASE_ADDR(n)
32#define IMX6Q_DEBUG_UART_BASE IMX6Q_UART_BASE(CONFIG_DEBUG_IMX6Q_UART_PORT)
18 33
19static struct map_desc imx_lluart_desc = { 34static struct map_desc imx_lluart_desc = {
20#ifdef CONFIG_DEBUG_IMX6Q_UART2 35#ifdef CONFIG_DEBUG_IMX6Q_UART
21 .virtual = MX6Q_IO_P2V(MX6Q_UART2_BASE_ADDR), 36 .virtual = IMX_IO_P2V(IMX6Q_DEBUG_UART_BASE),
22 .pfn = __phys_to_pfn(MX6Q_UART2_BASE_ADDR), 37 .pfn = __phys_to_pfn(IMX6Q_DEBUG_UART_BASE),
23 .length = MX6Q_UART2_SIZE, 38 .length = 0x4000,
24 .type = MT_DEVICE,
25#endif
26#ifdef CONFIG_DEBUG_IMX6Q_UART4
27 .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR),
28 .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR),
29 .length = MX6Q_UART4_SIZE,
30 .type = MT_DEVICE, 39 .type = MT_DEVICE,
31#endif 40#endif
32}; 41};
diff --git a/arch/arm/mach-imx/mach-apf9328.c b/arch/arm/mach-imx/mach-apf9328.c
index 7b99a79722b..5c9bd2c66e6 100644
--- a/arch/arm/mach-imx/mach-apf9328.c
+++ b/arch/arm/mach-imx/mach-apf9328.c
@@ -25,11 +25,10 @@
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/time.h> 26#include <asm/mach/time.h>
27 27
28#include <mach/common.h> 28#include "common.h"
29#include <mach/hardware.h>
30#include <mach/iomux-mx1.h>
31
32#include "devices-imx1.h" 29#include "devices-imx1.h"
30#include "hardware.h"
31#include "iomux-mx1.h"
33 32
34static const int apf9328_pins[] __initconst = { 33static const int apf9328_pins[] __initconst = {
35 /* UART1 */ 34 /* UART1 */
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
index 5985ed1b8c9..59bd6b06a6b 100644
--- a/arch/arm/mach-imx/mach-armadillo5x0.c
+++ b/arch/arm/mach-imx/mach-armadillo5x0.c
@@ -41,19 +41,18 @@
41#include <linux/regulator/machine.h> 41#include <linux/regulator/machine.h>
42#include <linux/regulator/fixed.h> 42#include <linux/regulator/fixed.h>
43 43
44#include <mach/hardware.h>
45#include <asm/mach-types.h> 44#include <asm/mach-types.h>
46#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
47#include <asm/mach/time.h> 46#include <asm/mach/time.h>
48#include <asm/memory.h> 47#include <asm/memory.h>
49#include <asm/mach/map.h> 48#include <asm/mach/map.h>
50 49
51#include <mach/common.h> 50#include "common.h"
52#include <mach/iomux-mx3.h>
53#include <mach/ulpi.h>
54
55#include "devices-imx31.h" 51#include "devices-imx31.h"
56#include "crmregs-imx3.h" 52#include "crmregs-imx3.h"
53#include "hardware.h"
54#include "iomux-mx3.h"
55#include "ulpi.h"
57 56
58static int armadillo5x0_pins[] = { 57static int armadillo5x0_pins[] = {
59 /* UART1 */ 58 /* UART1 */
diff --git a/arch/arm/mach-imx/mach-bug.c b/arch/arm/mach-imx/mach-bug.c
index 9a9897749dd..3a39d5aec07 100644
--- a/arch/arm/mach-imx/mach-bug.c
+++ b/arch/arm/mach-imx/mach-bug.c
@@ -19,15 +19,14 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21 21
22#include <mach/iomux-mx3.h>
23#include <mach/hardware.h>
24#include <mach/common.h>
25
26#include <asm/mach/time.h> 22#include <asm/mach/time.h>
27#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
28#include <asm/mach-types.h> 24#include <asm/mach-types.h>
29 25
26#include "common.h"
30#include "devices-imx31.h" 27#include "devices-imx31.h"
28#include "hardware.h"
29#include "iomux-mx3.h"
31 30
32static const struct imxuart_platform_data uart_pdata __initconst = { 31static const struct imxuart_platform_data uart_pdata __initconst = {
33 .flags = IMXUART_HAVE_RTSCTS, 32 .flags = IMXUART_HAVE_RTSCTS,
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 2bb9e18d9ee..12a370646b4 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -34,13 +34,12 @@
34#include <asm/mach/time.h> 34#include <asm/mach/time.h>
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include <mach/eukrea-baseboards.h> 37#include "common.h"
38#include <mach/common.h>
39#include <mach/hardware.h>
40#include <mach/iomux-mx27.h>
41#include <mach/ulpi.h>
42
43#include "devices-imx27.h" 38#include "devices-imx27.h"
39#include "eukrea-baseboards.h"
40#include "hardware.h"
41#include "iomux-mx27.h"
42#include "ulpi.h"
44 43
45static const int eukrea_cpuimx27_pins[] __initconst = { 44static const int eukrea_cpuimx27_pins[] __initconst = {
46 /* UART1 */ 45 /* UART1 */
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index d49b0ec6bde..5a31bf8c8f4 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -37,12 +37,11 @@
37#include <asm/mach/time.h> 37#include <asm/mach/time.h>
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39 39
40#include <mach/eukrea-baseboards.h> 40#include "common.h"
41#include <mach/hardware.h>
42#include <mach/common.h>
43#include <mach/iomux-mx35.h>
44
45#include "devices-imx35.h" 41#include "devices-imx35.h"
42#include "eukrea-baseboards.h"
43#include "hardware.h"
44#include "iomux-mx35.h"
46 45
47static const struct imxuart_platform_data uart_pdata __initconst = { 46static const struct imxuart_platform_data uart_pdata __initconst = {
48 .flags = IMXUART_HAVE_RTSCTS, 47 .flags = IMXUART_HAVE_RTSCTS,
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
index b87cc49ab1e..b727de029c8 100644
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c
@@ -26,18 +26,17 @@
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/can/platform/mcp251x.h> 27#include <linux/can/platform/mcp251x.h>
28 28
29#include <mach/eukrea-baseboards.h>
30#include <mach/common.h>
31#include <mach/hardware.h>
32#include <mach/iomux-mx51.h>
33
34#include <asm/setup.h> 29#include <asm/setup.h>
35#include <asm/mach-types.h> 30#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
37#include <asm/mach/time.h> 32#include <asm/mach/time.h>
38 33
34#include "common.h"
39#include "devices-imx51.h" 35#include "devices-imx51.h"
40#include "cpu_op-mx51.h" 36#include "cpu_op-mx51.h"
37#include "eukrea-baseboards.h"
38#include "hardware.h"
39#include "iomux-mx51.h"
41 40
42#define USBH1_RST IMX_GPIO_NR(2, 28) 41#define USBH1_RST IMX_GPIO_NR(2, 28)
43#define ETH_RST IMX_GPIO_NR(2, 31) 42#define ETH_RST IMX_GPIO_NR(2, 31)
diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
index 017bbb70ea4..75027a5ad8b 100644
--- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
@@ -27,18 +27,18 @@
27#include <linux/usb/otg.h> 27#include <linux/usb/otg.h>
28#include <linux/usb/ulpi.h> 28#include <linux/usb/ulpi.h>
29 29
30#include <mach/eukrea-baseboards.h>
31#include <mach/hardware.h>
32#include <asm/mach-types.h> 30#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
34#include <asm/mach/time.h> 32#include <asm/mach/time.h>
35#include <asm/memory.h> 33#include <asm/memory.h>
36#include <asm/mach/map.h> 34#include <asm/mach/map.h>
37#include <mach/common.h>
38#include <mach/mx25.h>
39#include <mach/iomux-mx25.h>
40 35
36#include "common.h"
41#include "devices-imx25.h" 37#include "devices-imx25.h"
38#include "eukrea-baseboards.h"
39#include "hardware.h"
40#include "iomux-mx25.h"
41#include "mx25.h"
42 42
43static const struct imxuart_platform_data uart_pdata __initconst = { 43static const struct imxuart_platform_data uart_pdata __initconst = {
44 .flags = IMXUART_HAVE_RTSCTS, 44 .flags = IMXUART_HAVE_RTSCTS,
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 141756f00ae..318bd8df7fc 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -40,17 +40,21 @@
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <asm/system_info.h> 41#include <asm/system_info.h>
42#include <asm/memblock.h> 42#include <asm/memblock.h>
43#include <mach/common.h>
44#include <mach/hardware.h>
45#include <mach/iomux-mx27.h>
46 43
44#include "common.h"
47#include "devices-imx27.h" 45#include "devices-imx27.h"
46#include "hardware.h"
47#include "iomux-mx27.h"
48 48
49#define TVP5150_RSTN (GPIO_PORTC + 18) 49#define TVP5150_RSTN (GPIO_PORTC + 18)
50#define TVP5150_PWDN (GPIO_PORTC + 19) 50#define TVP5150_PWDN (GPIO_PORTC + 19)
51#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) 51#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
52#define SDHC1_IRQ_GPIO IMX_GPIO_NR(2, 25) 52#define SDHC1_IRQ_GPIO IMX_GPIO_NR(2, 25)
53 53
54#define VERSION_MASK 0x7
55#define MOTHERBOARD_SHIFT 4
56#define EXPBOARD_SHIFT 0
57
54#define MOTHERBOARD_BIT2 (GPIO_PORTD + 31) 58#define MOTHERBOARD_BIT2 (GPIO_PORTD + 31)
55#define MOTHERBOARD_BIT1 (GPIO_PORTD + 30) 59#define MOTHERBOARD_BIT1 (GPIO_PORTD + 30)
56#define MOTHERBOARD_BIT0 (GPIO_PORTD + 29) 60#define MOTHERBOARD_BIT0 (GPIO_PORTD + 29)
@@ -237,7 +241,7 @@ static struct mx2_camera_platform_data visstrim_camera = {
237static phys_addr_t mx2_camera_base __initdata; 241static phys_addr_t mx2_camera_base __initdata;
238#define MX2_CAMERA_BUF_SIZE SZ_8M 242#define MX2_CAMERA_BUF_SIZE SZ_8M
239 243
240static void __init visstrim_camera_init(void) 244static void __init visstrim_analog_camera_init(void)
241{ 245{
242 struct platform_device *pdev; 246 struct platform_device *pdev;
243 int dma; 247 int dma;
@@ -474,6 +478,27 @@ static void __init visstrim_deinterlace_init(void)
474 return; 478 return;
475} 479}
476 480
481/* Emma-PrP for format conversion */
482static void __init visstrim_emmaprp_init(void)
483{
484 struct platform_device *pdev;
485 int dma;
486
487 pdev = imx27_add_mx2_emmaprp();
488 if (IS_ERR(pdev))
489 return;
490
491 /*
492 * Use the same memory area as the analog camera since both
493 * devices are, by nature, exclusive.
494 */
495 dma = dma_declare_coherent_memory(&pdev->dev,
496 mx2_camera_base, mx2_camera_base,
497 MX2_CAMERA_BUF_SIZE,
498 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
499 if (!(dma & DMA_MEMORY_MAP))
500 pr_err("Failed to declare memory for emmaprp\n");
501}
477 502
478/* Audio */ 503/* Audio */
479static const struct snd_mx27vis_platform_data snd_mx27vis_pdata __initconst = { 504static const struct snd_mx27vis_platform_data snd_mx27vis_pdata __initconst = {
@@ -507,13 +532,14 @@ static void __init visstrim_m10_revision(void)
507 mo_version |= !gpio_get_value(MOTHERBOARD_BIT0); 532 mo_version |= !gpio_get_value(MOTHERBOARD_BIT0);
508 533
509 system_rev = 0x27000; 534 system_rev = 0x27000;
510 system_rev |= (mo_version << 4); 535 system_rev |= (mo_version << MOTHERBOARD_SHIFT);
511 system_rev |= exp_version; 536 system_rev |= (exp_version << EXPBOARD_SHIFT);
512} 537}
513 538
514static void __init visstrim_m10_board_init(void) 539static void __init visstrim_m10_board_init(void)
515{ 540{
516 int ret; 541 int ret;
542 int mo_version;
517 543
518 imx27_soc_init(); 544 imx27_soc_init();
519 visstrim_m10_revision(); 545 visstrim_m10_revision();
@@ -546,8 +572,24 @@ static void __init visstrim_m10_board_init(void)
546 platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0, 572 platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0,
547 &iclink_tvp5150, sizeof(iclink_tvp5150)); 573 &iclink_tvp5150, sizeof(iclink_tvp5150));
548 gpio_led_register_device(0, &visstrim_m10_led_data); 574 gpio_led_register_device(0, &visstrim_m10_led_data);
549 visstrim_deinterlace_init(); 575
550 visstrim_camera_init(); 576 /* Use mother board version to decide what video devices we shall use */
577 mo_version = (system_rev >> MOTHERBOARD_SHIFT) & VERSION_MASK;
578 if (mo_version & 0x1) {
579 visstrim_emmaprp_init();
580
581 /*
582 * Despite not being used, tvp5150 must be
583 * powered on to avoid I2C problems. To minimize
584 * power consupmtion keep reset enabled.
585 */
586 gpio_set_value(TVP5150_PWDN, 1);
587 ndelay(1);
588 gpio_set_value(TVP5150_RSTN, 0);
589 } else {
590 visstrim_deinterlace_init();
591 visstrim_analog_camera_init();
592 }
551 visstrim_coda_init(); 593 visstrim_coda_init();
552} 594}
553 595
diff --git a/arch/arm/mach-imx/mach-imx27ipcam.c b/arch/arm/mach-imx/mach-imx27ipcam.c
index 7381387a890..53a86011293 100644
--- a/arch/arm/mach-imx/mach-imx27ipcam.c
+++ b/arch/arm/mach-imx/mach-imx27ipcam.c
@@ -17,11 +17,11 @@
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/mach/time.h> 19#include <asm/mach/time.h>
20#include <mach/hardware.h>
21#include <mach/common.h>
22#include <mach/iomux-mx27.h>
23 20
21#include "hardware.h"
22#include "common.h"
24#include "devices-imx27.h" 23#include "devices-imx27.h"
24#include "iomux-mx27.h"
25 25
26static const int mx27ipcam_pins[] __initconst = { 26static const int mx27ipcam_pins[] __initconst = {
27 /* UART1 */ 27 /* UART1 */
diff --git a/arch/arm/mach-imx/mach-imx27lite.c b/arch/arm/mach-imx/mach-imx27lite.c
index 1f45b918922..fc8dce93137 100644
--- a/arch/arm/mach-imx/mach-imx27lite.c
+++ b/arch/arm/mach-imx/mach-imx27lite.c
@@ -20,11 +20,11 @@
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/time.h> 21#include <asm/mach/time.h>
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23#include <mach/hardware.h>
24#include <mach/common.h>
25#include <mach/iomux-mx27.h>
26 23
24#include "common.h"
27#include "devices-imx27.h" 25#include "devices-imx27.h"
26#include "hardware.h"
27#include "iomux-mx27.h"
28 28
29static const int mx27lite_pins[] __initconst = { 29static const int mx27lite_pins[] __initconst = {
30 /* UART1 */ 30 /* UART1 */
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 29711e95579..860284dea0e 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -19,36 +19,9 @@
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/time.h> 21#include <asm/mach/time.h>
22#include <mach/common.h>
23#include <mach/mx53.h>
24 22
25/* 23#include "common.h"
26 * Lookup table for attaching a specific name and platform_data pointer to 24#include "mx53.h"
27 * devices as they get created by of_platform_populate(). Ideally this table
28 * would not exist, but the current clock implementation depends on some devices
29 * having a specific name.
30 */
31static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = {
32 OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART1_BASE_ADDR, "imx21-uart.0", NULL),
33 OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART2_BASE_ADDR, "imx21-uart.1", NULL),
34 OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART3_BASE_ADDR, "imx21-uart.2", NULL),
35 OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART4_BASE_ADDR, "imx21-uart.3", NULL),
36 OF_DEV_AUXDATA("fsl,imx53-uart", MX53_UART5_BASE_ADDR, "imx21-uart.4", NULL),
37 OF_DEV_AUXDATA("fsl,imx53-fec", MX53_FEC_BASE_ADDR, "imx25-fec.0", NULL),
38 OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC1_BASE_ADDR, "sdhci-esdhc-imx53.0", NULL),
39 OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC2_BASE_ADDR, "sdhci-esdhc-imx53.1", NULL),
40 OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC3_BASE_ADDR, "sdhci-esdhc-imx53.2", NULL),
41 OF_DEV_AUXDATA("fsl,imx53-esdhc", MX53_ESDHC4_BASE_ADDR, "sdhci-esdhc-imx53.3", NULL),
42 OF_DEV_AUXDATA("fsl,imx53-ecspi", MX53_ECSPI1_BASE_ADDR, "imx51-ecspi.0", NULL),
43 OF_DEV_AUXDATA("fsl,imx53-ecspi", MX53_ECSPI2_BASE_ADDR, "imx51-ecspi.1", NULL),
44 OF_DEV_AUXDATA("fsl,imx53-cspi", MX53_CSPI_BASE_ADDR, "imx35-cspi.0", NULL),
45 OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C1_BASE_ADDR, "imx-i2c.0", NULL),
46 OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C2_BASE_ADDR, "imx-i2c.1", NULL),
47 OF_DEV_AUXDATA("fsl,imx53-i2c", MX53_I2C3_BASE_ADDR, "imx-i2c.2", NULL),
48 OF_DEV_AUXDATA("fsl,imx53-sdma", MX53_SDMA_BASE_ADDR, "imx35-sdma", NULL),
49 OF_DEV_AUXDATA("fsl,imx53-wdt", MX53_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL),
50 { /* sentinel */ }
51};
52 25
53static void __init imx53_qsb_init(void) 26static void __init imx53_qsb_init(void)
54{ 27{
@@ -68,8 +41,7 @@ static void __init imx53_dt_init(void)
68 if (of_machine_is_compatible("fsl,imx53-qsb")) 41 if (of_machine_is_compatible("fsl,imx53-qsb"))
69 imx53_qsb_init(); 42 imx53_qsb_init();
70 43
71 of_platform_populate(NULL, of_default_bus_match_table, 44 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
72 imx53_auxdata_lookup, NULL);
73} 45}
74 46
75static void __init imx53_timer_init(void) 47static void __init imx53_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 47c91f7185d..4eb1b3ac794 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -33,10 +33,44 @@
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/time.h> 34#include <asm/mach/time.h>
35#include <asm/system_misc.h> 35#include <asm/system_misc.h>
36#include <mach/common.h>
37#include <mach/cpuidle.h>
38#include <mach/hardware.h>
39 36
37#include "common.h"
38#include "cpuidle.h"
39#include "hardware.h"
40
41#define IMX6Q_ANALOG_DIGPROG 0x260
42
43static int imx6q_revision(void)
44{
45 struct device_node *np;
46 void __iomem *base;
47 static u32 rev;
48
49 if (!rev) {
50 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
51 if (!np)
52 return IMX_CHIP_REVISION_UNKNOWN;
53 base = of_iomap(np, 0);
54 if (!base) {
55 of_node_put(np);
56 return IMX_CHIP_REVISION_UNKNOWN;
57 }
58 rev = readl_relaxed(base + IMX6Q_ANALOG_DIGPROG);
59 iounmap(base);
60 of_node_put(np);
61 }
62
63 switch (rev & 0xff) {
64 case 0:
65 return IMX_CHIP_REVISION_1_0;
66 case 1:
67 return IMX_CHIP_REVISION_1_1;
68 case 2:
69 return IMX_CHIP_REVISION_1_2;
70 default:
71 return IMX_CHIP_REVISION_UNKNOWN;
72 }
73}
40 74
41void imx6q_restart(char mode, const char *cmd) 75void imx6q_restart(char mode, const char *cmd)
42{ 76{
@@ -117,6 +151,17 @@ static void __init imx6q_sabrelite_init(void)
117 imx6q_sabrelite_cko1_setup(); 151 imx6q_sabrelite_cko1_setup();
118} 152}
119 153
154static void __init imx6q_1588_init(void)
155{
156 struct regmap *gpr;
157
158 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
159 if (!IS_ERR(gpr))
160 regmap_update_bits(gpr, 0x4, 1 << 21, 1 << 21);
161 else
162 pr_err("failed to find fsl,imx6q-iomux-gpr regmap\n");
163
164}
120static void __init imx6q_usb_init(void) 165static void __init imx6q_usb_init(void)
121{ 166{
122 struct regmap *anatop; 167 struct regmap *anatop;
@@ -153,6 +198,7 @@ static void __init imx6q_init_machine(void)
153 198
154 imx6q_pm_init(); 199 imx6q_pm_init();
155 imx6q_usb_init(); 200 imx6q_usb_init();
201 imx6q_1588_init();
156} 202}
157 203
158static struct cpuidle_driver imx6q_cpuidle_driver = { 204static struct cpuidle_driver imx6q_cpuidle_driver = {
@@ -192,6 +238,7 @@ static void __init imx6q_timer_init(void)
192{ 238{
193 mx6q_clocks_init(); 239 mx6q_clocks_init();
194 twd_local_timer_of_register(); 240 twd_local_timer_of_register();
241 imx_print_silicon_rev("i.MX6Q", imx6q_revision());
195} 242}
196 243
197static struct sys_timer imx6q_timer = { 244static struct sys_timer imx6q_timer = {
diff --git a/arch/arm/mach-imx/mach-kzm_arm11_01.c b/arch/arm/mach-imx/mach-kzm_arm11_01.c
index 0330078ff78..2e536ea5344 100644
--- a/arch/arm/mach-imx/mach-kzm_arm11_01.c
+++ b/arch/arm/mach-imx/mach-kzm_arm11_01.c
@@ -36,11 +36,10 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/time.h> 37#include <asm/mach/time.h>
38 38
39#include <mach/common.h> 39#include "common.h"
40#include <mach/hardware.h>
41#include <mach/iomux-mx3.h>
42
43#include "devices-imx31.h" 40#include "devices-imx31.h"
41#include "hardware.h"
42#include "iomux-mx3.h"
44 43
45#define KZM_ARM11_IO_ADDRESS(x) (IOMEM( \ 44#define KZM_ARM11_IO_ADDRESS(x) (IOMEM( \
46 IMX_IO_P2V_MODULE(x, MX31_CS4) ?: \ 45 IMX_IO_P2V_MODULE(x, MX31_CS4) ?: \
diff --git a/arch/arm/mach-imx/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c
index 667f359a2e8..06b483783e6 100644
--- a/arch/arm/mach-imx/mach-mx1ads.c
+++ b/arch/arm/mach-imx/mach-mx1ads.c
@@ -23,11 +23,10 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25 25
26#include <mach/common.h> 26#include "common.h"
27#include <mach/hardware.h>
28#include <mach/iomux-mx1.h>
29
30#include "devices-imx1.h" 27#include "devices-imx1.h"
28#include "hardware.h"
29#include "iomux-mx1.h"
31 30
32static const int mx1ads_pins[] __initconst = { 31static const int mx1ads_pins[] __initconst = {
33 /* UART1 */ 32 /* UART1 */
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index ed22e3fe6ec..6adb3136bb0 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -18,15 +18,15 @@
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <mach/common.h>
22#include <mach/hardware.h>
23#include <asm/mach-types.h> 21#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
25#include <asm/mach/time.h> 23#include <asm/mach/time.h>
26#include <asm/mach/map.h> 24#include <asm/mach/map.h>
27#include <mach/iomux-mx21.h>
28 25
26#include "common.h"
29#include "devices-imx21.h" 27#include "devices-imx21.h"
28#include "hardware.h"
29#include "iomux-mx21.h"
30 30
31/* 31/*
32 * Memory-mapped I/O on MX21ADS base board 32 * Memory-mapped I/O on MX21ADS base board
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index ce247fd1269..b1b03aa55bb 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -31,17 +31,17 @@
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/usb/otg.h> 32#include <linux/usb/otg.h>
33 33
34#include <mach/hardware.h>
35#include <asm/mach-types.h> 34#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
37#include <asm/mach/time.h> 36#include <asm/mach/time.h>
38#include <asm/memory.h> 37#include <asm/memory.h>
39#include <asm/mach/map.h> 38#include <asm/mach/map.h>
40#include <mach/common.h>
41#include <mach/mx25.h>
42#include <mach/iomux-mx25.h>
43 39
40#include "common.h"
44#include "devices-imx25.h" 41#include "devices-imx25.h"
42#include "hardware.h"
43#include "iomux-mx25.h"
44#include "mx25.h"
45 45
46#define MX25PDK_CAN_PWDN IMX_GPIO_NR(4, 6) 46#define MX25PDK_CAN_PWDN IMX_GPIO_NR(4, 6)
47 47
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 05996f39005..d0e547fa925 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -36,13 +36,13 @@
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
38#include <asm/mach/time.h> 38#include <asm/mach/time.h>
39#include <mach/hardware.h>
40#include <mach/common.h>
41#include <mach/iomux-mx27.h>
42#include <mach/ulpi.h>
43#include <mach/3ds_debugboard.h>
44 39
40#include "3ds_debugboard.h"
41#include "common.h"
45#include "devices-imx27.h" 42#include "devices-imx27.h"
43#include "hardware.h"
44#include "iomux-mx27.h"
45#include "ulpi.h"
46 46
47#define SD1_EN_GPIO IMX_GPIO_NR(2, 25) 47#define SD1_EN_GPIO IMX_GPIO_NR(2, 25)
48#define OTG_PHY_RESET_GPIO IMX_GPIO_NR(2, 23) 48#define OTG_PHY_RESET_GPIO IMX_GPIO_NR(2, 23)
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 7dc59bac0e5..3d036f57f0e 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -21,15 +21,15 @@
21#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <mach/common.h>
25#include <mach/hardware.h>
26#include <asm/mach-types.h> 24#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 26#include <asm/mach/time.h>
29#include <asm/mach/map.h> 27#include <asm/mach/map.h>
30#include <mach/iomux-mx27.h>
31 28
29#include "common.h"
32#include "devices-imx27.h" 30#include "devices-imx27.h"
31#include "hardware.h"
32#include "iomux-mx27.h"
33 33
34/* 34/*
35 * Base address of PBC controller, CS4 35 * Base address of PBC controller, CS4
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 8915f937b7d..bc301befdd0 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -30,19 +30,19 @@
30 30
31#include <media/soc_camera.h> 31#include <media/soc_camera.h>
32 32
33#include <mach/hardware.h>
34#include <asm/mach-types.h> 33#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
36#include <asm/mach/time.h> 35#include <asm/mach/time.h>
37#include <asm/memory.h> 36#include <asm/memory.h>
38#include <asm/mach/map.h> 37#include <asm/mach/map.h>
39#include <asm/memblock.h> 38#include <asm/memblock.h>
40#include <mach/common.h>
41#include <mach/iomux-mx3.h>
42#include <mach/3ds_debugboard.h>
43#include <mach/ulpi.h>
44 39
40#include "3ds_debugboard.h"
41#include "common.h"
45#include "devices-imx31.h" 42#include "devices-imx31.h"
43#include "hardware.h"
44#include "iomux-mx3.h"
45#include "ulpi.h"
46 46
47static int mx31_3ds_pins[] = { 47static int mx31_3ds_pins[] = {
48 /* UART1 */ 48 /* UART1 */
@@ -393,7 +393,7 @@ static struct regulator_init_data gpo_init = {
393}; 393};
394 394
395static struct regulator_consumer_supply vmmc2_consumers[] = { 395static struct regulator_consumer_supply vmmc2_consumers[] = {
396 REGULATOR_SUPPLY("vmmc", "mxc-mmc.0"), 396 REGULATOR_SUPPLY("vmmc", "imx31-mmc.0"),
397}; 397};
398 398
399static struct regulator_init_data vmmc2_init = { 399static struct regulator_init_data vmmc2_init = {
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
index e774b07f48d..8b56f8883f3 100644
--- a/arch/arm/mach-imx/mach-mx31ads.c
+++ b/arch/arm/mach-imx/mach-mx31ads.c
@@ -28,8 +28,6 @@
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29#include <asm/memory.h> 29#include <asm/memory.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <mach/common.h>
32#include <mach/iomux-mx3.h>
33 31
34#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 32#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
35#include <linux/mfd/wm8350/audio.h> 33#include <linux/mfd/wm8350/audio.h>
@@ -37,7 +35,10 @@
37#include <linux/mfd/wm8350/pmic.h> 35#include <linux/mfd/wm8350/pmic.h>
38#endif 36#endif
39 37
38#include "common.h"
40#include "devices-imx31.h" 39#include "devices-imx31.h"
40#include "hardware.h"
41#include "iomux-mx3.h"
41 42
42/* Base address of PBC controller */ 43/* Base address of PBC controller */
43#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT 44#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
index 34b9bf075da..08b9965c8b3 100644
--- a/arch/arm/mach-imx/mach-mx31lilly.c
+++ b/arch/arm/mach-imx/mach-mx31lilly.c
@@ -42,13 +42,12 @@
42#include <asm/mach/time.h> 42#include <asm/mach/time.h>
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44 44
45#include <mach/hardware.h> 45#include "board-mx31lilly.h"
46#include <mach/common.h> 46#include "common.h"
47#include <mach/iomux-mx3.h>
48#include <mach/board-mx31lilly.h>
49#include <mach/ulpi.h>
50
51#include "devices-imx31.h" 47#include "devices-imx31.h"
48#include "hardware.h"
49#include "iomux-mx3.h"
50#include "ulpi.h"
52 51
53/* 52/*
54 * This file contains module-specific initialization routines for LILLY-1131. 53 * This file contains module-specific initialization routines for LILLY-1131.
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index ef57cff5abf..bdcd92e5951 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -39,13 +39,12 @@
39#include <asm/page.h> 39#include <asm/page.h>
40#include <asm/setup.h> 40#include <asm/setup.h>
41 41
42#include <mach/hardware.h> 42#include "board-mx31lite.h"
43#include <mach/common.h> 43#include "common.h"
44#include <mach/board-mx31lite.h>
45#include <mach/iomux-mx3.h>
46#include <mach/ulpi.h>
47
48#include "devices-imx31.h" 44#include "devices-imx31.h"
45#include "hardware.h"
46#include "iomux-mx3.h"
47#include "ulpi.h"
49 48
50/* 49/*
51 * This file contains the module-specific initialization routines. 50 * This file contains the module-specific initialization routines.
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 459e754ef8c..2517cfa9f26 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -42,14 +42,14 @@
42#include <asm/mach/time.h> 42#include <asm/mach/time.h>
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44#include <asm/memblock.h> 44#include <asm/memblock.h>
45#include <mach/board-mx31moboard.h>
46#include <mach/common.h>
47#include <mach/hardware.h>
48#include <mach/iomux-mx3.h>
49#include <mach/ulpi.h>
50#include <linux/platform_data/asoc-imx-ssi.h> 45#include <linux/platform_data/asoc-imx-ssi.h>
51 46
47#include "board-mx31moboard.h"
48#include "common.h"
52#include "devices-imx31.h" 49#include "devices-imx31.h"
50#include "hardware.h"
51#include "iomux-mx3.h"
52#include "ulpi.h"
53 53
54static unsigned int moboard_pins[] = { 54static unsigned int moboard_pins[] = {
55 /* UART0 */ 55 /* UART0 */
@@ -175,11 +175,11 @@ static const struct spi_imx_master moboard_spi1_pdata __initconst = {
175 175
176static struct regulator_consumer_supply sdhc_consumers[] = { 176static struct regulator_consumer_supply sdhc_consumers[] = {
177 { 177 {
178 .dev_name = "mxc-mmc.0", 178 .dev_name = "imx31-mmc.0",
179 .supply = "sdhc0_vcc", 179 .supply = "sdhc0_vcc",
180 }, 180 },
181 { 181 {
182 .dev_name = "mxc-mmc.1", 182 .dev_name = "imx31-mmc.1",
183 .supply = "sdhc1_vcc", 183 .supply = "sdhc1_vcc",
184 }, 184 },
185}; 185};
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 504983c68aa..5277da45d60 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -43,15 +43,15 @@
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44#include <asm/memblock.h> 44#include <asm/memblock.h>
45 45
46#include <mach/hardware.h>
47#include <mach/common.h>
48#include <mach/iomux-mx35.h>
49#include <mach/3ds_debugboard.h>
50#include <video/platform_lcd.h> 46#include <video/platform_lcd.h>
51 47
52#include <media/soc_camera.h> 48#include <media/soc_camera.h>
53 49
50#include "3ds_debugboard.h"
51#include "common.h"
54#include "devices-imx35.h" 52#include "devices-imx35.h"
53#include "hardware.h"
54#include "iomux-mx35.h"
55 55
56#define GPIO_MC9S08DZ60_GPS_ENABLE 0 56#define GPIO_MC9S08DZ60_GPS_ENABLE 0
57#define GPIO_MC9S08DZ60_HDD_ENABLE 4 57#define GPIO_MC9S08DZ60_HDD_ENABLE 4
diff --git a/arch/arm/mach-imx/mach-mx50_rdp.c b/arch/arm/mach-imx/mach-mx50_rdp.c
index 42b66e8d961..0c1f88a80bd 100644
--- a/arch/arm/mach-imx/mach-mx50_rdp.c
+++ b/arch/arm/mach-imx/mach-mx50_rdp.c
@@ -24,17 +24,16 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/iomux-mx50.h>
30
31#include <asm/irq.h> 27#include <asm/irq.h>
32#include <asm/setup.h> 28#include <asm/setup.h>
33#include <asm/mach-types.h> 29#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
35#include <asm/mach/time.h> 31#include <asm/mach/time.h>
36 32
33#include "common.h"
37#include "devices-imx50.h" 34#include "devices-imx50.h"
35#include "hardware.h"
36#include "iomux-mx50.h"
38 37
39#define FEC_EN IMX_GPIO_NR(6, 23) 38#define FEC_EN IMX_GPIO_NR(6, 23)
40#define FEC_RESET_B IMX_GPIO_NR(4, 12) 39#define FEC_RESET_B IMX_GPIO_NR(4, 12)
diff --git a/arch/arm/mach-imx/mach-mx51_3ds.c b/arch/arm/mach-imx/mach-mx51_3ds.c
index 9ee84a4af63..abc25bd1107 100644
--- a/arch/arm/mach-imx/mach-mx51_3ds.c
+++ b/arch/arm/mach-imx/mach-mx51_3ds.c
@@ -19,12 +19,11 @@
19#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
20#include <asm/mach/time.h> 20#include <asm/mach/time.h>
21 21
22#include <mach/hardware.h> 22#include "3ds_debugboard.h"
23#include <mach/common.h> 23#include "common.h"
24#include <mach/iomux-mx51.h>
25#include <mach/3ds_debugboard.h>
26
27#include "devices-imx51.h" 24#include "devices-imx51.h"
25#include "hardware.h"
26#include "iomux-mx51.h"
28 27
29#define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28) 28#define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28)
30 29
diff --git a/arch/arm/mach-imx/mach-mx51_babbage.c b/arch/arm/mach-imx/mach-mx51_babbage.c
index 7b31cbde877..d9a84ca2199 100644
--- a/arch/arm/mach-imx/mach-mx51_babbage.c
+++ b/arch/arm/mach-imx/mach-mx51_babbage.c
@@ -20,17 +20,16 @@
20#include <linux/spi/flash.h> 20#include <linux/spi/flash.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22 22
23#include <mach/common.h>
24#include <mach/hardware.h>
25#include <mach/iomux-mx51.h>
26
27#include <asm/setup.h> 23#include <asm/setup.h>
28#include <asm/mach-types.h> 24#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
30#include <asm/mach/time.h> 26#include <asm/mach/time.h>
31 27
28#include "common.h"
32#include "devices-imx51.h" 29#include "devices-imx51.h"
33#include "cpu_op-mx51.h" 30#include "cpu_op-mx51.h"
31#include "hardware.h"
32#include "iomux-mx51.h"
34 33
35#define BABBAGE_USB_HUB_RESET IMX_GPIO_NR(1, 7) 34#define BABBAGE_USB_HUB_RESET IMX_GPIO_NR(1, 7)
36#define BABBAGE_USBH1_STP IMX_GPIO_NR(1, 27) 35#define BABBAGE_USBH1_STP IMX_GPIO_NR(1, 27)
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index 0bf6d30aa32..f4a8c7e108e 100644
--- a/arch/arm/mach-imx/mach-mxt_td60.c
+++ b/arch/arm/mach-imx/mach-mxt_td60.c
@@ -21,17 +21,17 @@
21#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <mach/common.h>
25#include <mach/hardware.h>
26#include <asm/mach-types.h> 24#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 26#include <asm/mach/time.h>
29#include <asm/mach/map.h> 27#include <asm/mach/map.h>
30#include <linux/gpio.h> 28#include <linux/gpio.h>
31#include <mach/iomux-mx27.h>
32#include <linux/i2c/pca953x.h> 29#include <linux/i2c/pca953x.h>
33 30
31#include "common.h"
34#include "devices-imx27.h" 32#include "devices-imx27.h"
33#include "hardware.h"
34#include "iomux-mx27.h"
35 35
36static const int mxt_td60_pins[] __initconst = { 36static const int mxt_td60_pins[] __initconst = {
37 /* UART0 */ 37 /* UART0 */
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index de8516b7d69..eee369fa94a 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -32,13 +32,13 @@
32 32
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <mach/common.h>
36#include <mach/hardware.h>
37#include <mach/iomux-mx27.h>
38#include <asm/mach/time.h> 35#include <asm/mach/time.h>
39#include <mach/ulpi.h>
40 36
37#include "common.h"
41#include "devices-imx27.h" 38#include "devices-imx27.h"
39#include "hardware.h"
40#include "iomux-mx27.h"
41#include "ulpi.h"
42 42
43#define OTG_PHY_CS_GPIO (GPIO_PORTB + 23) 43#define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
44#define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24) 44#define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24)
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index e3c45130fb3..547fef133f6 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -42,13 +42,13 @@
42#include <asm/mach/time.h> 42#include <asm/mach/time.h>
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44#include <asm/memblock.h> 44#include <asm/memblock.h>
45#include <mach/common.h>
46#include <mach/hardware.h>
47#include <mach/iomux-mx3.h>
48#include <mach/ulpi.h>
49 45
46#include "common.h"
50#include "devices-imx31.h" 47#include "devices-imx31.h"
48#include "hardware.h"
49#include "iomux-mx3.h"
51#include "pcm037.h" 50#include "pcm037.h"
51#include "ulpi.h"
52 52
53static enum pcm037_board_variant pcm037_instance = PCM037_PCM970; 53static enum pcm037_board_variant pcm037_instance = PCM037_PCM970;
54 54
diff --git a/arch/arm/mach-imx/mach-pcm037_eet.c b/arch/arm/mach-imx/mach-pcm037_eet.c
index 11ffa81ad17..8fd8255068e 100644
--- a/arch/arm/mach-imx/mach-pcm037_eet.c
+++ b/arch/arm/mach-imx/mach-pcm037_eet.c
@@ -11,13 +11,12 @@
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/spi/spi.h> 12#include <linux/spi/spi.h>
13 13
14#include <mach/common.h>
15#include <mach/iomux-mx3.h>
16
17#include <asm/mach-types.h> 14#include <asm/mach-types.h>
18 15
19#include "pcm037.h" 16#include "pcm037.h"
17#include "common.h"
20#include "devices-imx31.h" 18#include "devices-imx31.h"
19#include "iomux-mx3.h"
21 20
22static unsigned int pcm037_eet_pins[] = { 21static unsigned int pcm037_eet_pins[] = {
23 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */ 22 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 95f49d936fd..4aa0d079860 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -33,13 +33,12 @@
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/time.h> 34#include <asm/mach/time.h>
35 35
36#include <mach/board-pcm038.h> 36#include "board-pcm038.h"
37#include <mach/common.h> 37#include "common.h"
38#include <mach/hardware.h>
39#include <mach/iomux-mx27.h>
40#include <mach/ulpi.h>
41
42#include "devices-imx27.h" 38#include "devices-imx27.h"
39#include "hardware.h"
40#include "iomux-mx27.h"
41#include "ulpi.h"
43 42
44static const int pcm038_pins[] __initconst = { 43static const int pcm038_pins[] __initconst = {
45 /* UART1 */ 44 /* UART1 */
@@ -212,7 +211,7 @@ static const struct spi_imx_master pcm038_spi0_data __initconst = {
212 211
213static struct regulator_consumer_supply sdhc1_consumers[] = { 212static struct regulator_consumer_supply sdhc1_consumers[] = {
214 { 213 {
215 .dev_name = "mxc-mmc.1", 214 .dev_name = "imx21-mmc.1",
216 .supply = "sdhc_vcc", 215 .supply = "sdhc_vcc",
217 }, 216 },
218}; 217};
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index e4bd4387e34..92445440221 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -33,12 +33,11 @@
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <mach/hardware.h> 36#include "common.h"
37#include <mach/common.h>
38#include <mach/iomux-mx35.h>
39#include <mach/ulpi.h>
40
41#include "devices-imx35.h" 37#include "devices-imx35.h"
38#include "hardware.h"
39#include "iomux-mx35.h"
40#include "ulpi.h"
42 41
43static const struct fb_videomode fb_modedb[] = { 42static const struct fb_videomode fb_modedb[] = {
44 { 43 {
diff --git a/arch/arm/mach-imx/mach-qong.c b/arch/arm/mach-imx/mach-qong.c
index fb25fbd3122..96d9a91f8a3 100644
--- a/arch/arm/mach-imx/mach-qong.c
+++ b/arch/arm/mach-imx/mach-qong.c
@@ -21,17 +21,17 @@
21#include <linux/mtd/nand.h> 21#include <linux/mtd/nand.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23 23
24#include <mach/hardware.h>
25#include <asm/mach-types.h> 24#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
27#include <asm/mach/time.h> 26#include <asm/mach/time.h>
28#include <asm/mach/map.h> 27#include <asm/mach/map.h>
29#include <mach/common.h>
30#include <asm/page.h> 28#include <asm/page.h>
31#include <asm/setup.h> 29#include <asm/setup.h>
32#include <mach/iomux-mx3.h>
33 30
31#include "common.h"
34#include "devices-imx31.h" 32#include "devices-imx31.h"
33#include "hardware.h"
34#include "iomux-mx3.h"
35 35
36/* FPGA defines */ 36/* FPGA defines */
37#define QONG_FPGA_VERSION(major, minor, rev) \ 37#define QONG_FPGA_VERSION(major, minor, rev) \
diff --git a/arch/arm/mach-imx/mach-scb9328.c b/arch/arm/mach-imx/mach-scb9328.c
index 67ff38e9a3c..fc970409dba 100644
--- a/arch/arm/mach-imx/mach-scb9328.c
+++ b/arch/arm/mach-imx/mach-scb9328.c
@@ -20,11 +20,10 @@
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/time.h> 21#include <asm/mach/time.h>
22 22
23#include <mach/common.h> 23#include "common.h"
24#include <mach/hardware.h>
25#include <mach/iomux-mx1.h>
26
27#include "devices-imx1.h" 24#include "devices-imx1.h"
25#include "hardware.h"
26#include "iomux-mx1.h"
28 27
29/* 28/*
30 * This scb9328 has a 32MiB flash 29 * This scb9328 has a 32MiB flash
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
index 39eb7960e2a..3aecf91e428 100644
--- a/arch/arm/mach-imx/mach-vpr200.c
+++ b/arch/arm/mach-imx/mach-vpr200.c
@@ -28,15 +28,14 @@
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30 30
31#include <mach/hardware.h>
32#include <mach/common.h>
33#include <mach/iomux-mx35.h>
34
35#include <linux/i2c.h> 31#include <linux/i2c.h>
36#include <linux/i2c/at24.h> 32#include <linux/i2c/at24.h>
37#include <linux/mfd/mc13xxx.h> 33#include <linux/mfd/mc13xxx.h>
38 34
35#include "common.h"
39#include "devices-imx35.h" 36#include "devices-imx35.h"
37#include "hardware.h"
38#include "iomux-mx35.h"
40 39
41#define GPIO_LCDPWR IMX_GPIO_NR(1, 2) 40#define GPIO_LCDPWR IMX_GPIO_NR(1, 2)
42#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0) 41#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
diff --git a/arch/arm/mach-imx/mm-imx1.c b/arch/arm/mach-imx/mm-imx1.c
index 6d60d51868b..7a146671e65 100644
--- a/arch/arm/mach-imx/mm-imx1.c
+++ b/arch/arm/mach-imx/mm-imx1.c
@@ -22,9 +22,10 @@
22 22
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <mach/common.h> 25#include "common.h"
26#include <mach/hardware.h> 26#include "devices/devices-common.h"
27#include <mach/iomux-v1.h> 27#include "hardware.h"
28#include "iomux-v1.h"
28 29
29static struct map_desc imx_io_desc[] __initdata = { 30static struct map_desc imx_io_desc[] __initdata = {
30 imx_map_entry(MX1, IO, MT_DEVICE), 31 imx_map_entry(MX1, IO, MT_DEVICE),
@@ -58,5 +59,7 @@ void __init imx1_soc_init(void)
58 MX1_GPIO_INT_PORTC, 0); 59 MX1_GPIO_INT_PORTC, 0);
59 mxc_register_gpio("imx1-gpio", 3, MX1_GPIO4_BASE_ADDR, SZ_256, 60 mxc_register_gpio("imx1-gpio", 3, MX1_GPIO4_BASE_ADDR, SZ_256,
60 MX1_GPIO_INT_PORTD, 0); 61 MX1_GPIO_INT_PORTD, 0);
62 imx_add_imx_dma("imx1-dma", MX1_DMA_BASE_ADDR,
63 MX1_DMA_INT, MX1_DMA_ERR);
61 pinctrl_provide_dummies(); 64 pinctrl_provide_dummies();
62} 65}
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index d056dad0940..d8ccd3a8ec5 100644
--- a/arch/arm/mach-imx/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -21,12 +21,13 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/pinctrl/machine.h> 23#include <linux/pinctrl/machine.h>
24#include <mach/hardware.h>
25#include <mach/common.h>
26#include <mach/devices-common.h>
27#include <asm/pgtable.h> 24#include <asm/pgtable.h>
28#include <asm/mach/map.h> 25#include <asm/mach/map.h>
29#include <mach/iomux-v1.h> 26
27#include "common.h"
28#include "devices/devices-common.h"
29#include "hardware.h"
30#include "iomux-v1.h"
30 31
31/* MX21 memory map definition */ 32/* MX21 memory map definition */
32static struct map_desc imx21_io_desc[] __initdata = { 33static struct map_desc imx21_io_desc[] __initdata = {
@@ -81,6 +82,8 @@ static const struct resource imx21_audmux_res[] __initconst = {
81 82
82void __init imx21_soc_init(void) 83void __init imx21_soc_init(void)
83{ 84{
85 mxc_device_init();
86
84 mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 87 mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
85 mxc_register_gpio("imx21-gpio", 1, MX21_GPIO2_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 88 mxc_register_gpio("imx21-gpio", 1, MX21_GPIO2_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
86 mxc_register_gpio("imx21-gpio", 2, MX21_GPIO3_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 89 mxc_register_gpio("imx21-gpio", 2, MX21_GPIO3_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
@@ -89,7 +92,8 @@ void __init imx21_soc_init(void)
89 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 92 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
90 93
91 pinctrl_provide_dummies(); 94 pinctrl_provide_dummies();
92 imx_add_imx_dma(); 95 imx_add_imx_dma("imx21-dma", MX21_DMA_BASE_ADDR,
96 MX21_INT_DMACH0, 0); /* No ERR irq */
93 platform_device_register_simple("imx21-audmux", 0, imx21_audmux_res, 97 platform_device_register_simple("imx21-audmux", 0, imx21_audmux_res,
94 ARRAY_SIZE(imx21_audmux_res)); 98 ARRAY_SIZE(imx21_audmux_res));
95} 99}
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index f3f5c6542ab..9357707bb7a 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -24,11 +24,11 @@
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <mach/common.h> 27#include "common.h"
28#include <mach/devices-common.h> 28#include "devices/devices-common.h"
29#include <mach/hardware.h> 29#include "hardware.h"
30#include <mach/mx25.h> 30#include "iomux-v3.h"
31#include <mach/iomux-v3.h> 31#include "mx25.h"
32 32
33/* 33/*
34 * This table defines static virtual address mappings for I/O regions. 34 * This table defines static virtual address mappings for I/O regions.
@@ -89,6 +89,8 @@ static const struct resource imx25_audmux_res[] __initconst = {
89 89
90void __init imx25_soc_init(void) 90void __init imx25_soc_init(void)
91{ 91{
92 mxc_device_init();
93
92 /* i.mx25 has the i.mx35 type gpio */ 94 /* i.mx25 has the i.mx35 type gpio */
93 mxc_register_gpio("imx35-gpio", 0, MX25_GPIO1_BASE_ADDR, SZ_16K, MX25_INT_GPIO1, 0); 95 mxc_register_gpio("imx35-gpio", 0, MX25_GPIO1_BASE_ADDR, SZ_16K, MX25_INT_GPIO1, 0);
94 mxc_register_gpio("imx35-gpio", 1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0); 96 mxc_register_gpio("imx35-gpio", 1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0);
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index e7e24afc45e..4f1be65a7b5 100644
--- a/arch/arm/mach-imx/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -21,12 +21,13 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/pinctrl/machine.h> 23#include <linux/pinctrl/machine.h>
24#include <mach/hardware.h>
25#include <mach/common.h>
26#include <mach/devices-common.h>
27#include <asm/pgtable.h> 24#include <asm/pgtable.h>
28#include <asm/mach/map.h> 25#include <asm/mach/map.h>
29#include <mach/iomux-v1.h> 26
27#include "common.h"
28#include "devices/devices-common.h"
29#include "hardware.h"
30#include "iomux-v1.h"
30 31
31/* MX27 memory map definition */ 32/* MX27 memory map definition */
32static struct map_desc imx27_io_desc[] __initdata = { 33static struct map_desc imx27_io_desc[] __initdata = {
@@ -81,6 +82,8 @@ static const struct resource imx27_audmux_res[] __initconst = {
81 82
82void __init imx27_soc_init(void) 83void __init imx27_soc_init(void)
83{ 84{
85 mxc_device_init();
86
84 /* i.mx27 has the i.mx21 type gpio */ 87 /* i.mx27 has the i.mx21 type gpio */
85 mxc_register_gpio("imx21-gpio", 0, MX27_GPIO1_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 88 mxc_register_gpio("imx21-gpio", 0, MX27_GPIO1_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
86 mxc_register_gpio("imx21-gpio", 1, MX27_GPIO2_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 89 mxc_register_gpio("imx21-gpio", 1, MX27_GPIO2_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
@@ -90,7 +93,8 @@ void __init imx27_soc_init(void)
90 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 93 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
91 94
92 pinctrl_provide_dummies(); 95 pinctrl_provide_dummies();
93 imx_add_imx_dma(); 96 imx_add_imx_dma("imx27-dma", MX27_DMA_BASE_ADDR,
97 MX27_INT_DMACH0, 0); /* No ERR irq */
94 /* imx27 has the imx21 type audmux */ 98 /* imx27 has the imx21 type audmux */
95 platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res, 99 platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res,
96 ARRAY_SIZE(imx27_audmux_res)); 100 ARRAY_SIZE(imx27_audmux_res));
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index b5deb055455..cefa047c405 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -26,12 +26,11 @@
26#include <asm/hardware/cache-l2x0.h> 26#include <asm/hardware/cache-l2x0.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <mach/common.h> 29#include "common.h"
30#include <mach/devices-common.h>
31#include <mach/hardware.h>
32#include <mach/iomux-v3.h>
33
34#include "crmregs-imx3.h" 30#include "crmregs-imx3.h"
31#include "devices/devices-common.h"
32#include "hardware.h"
33#include "iomux-v3.h"
35 34
36void __iomem *mx3_ccm_base; 35void __iomem *mx3_ccm_base;
37 36
@@ -175,6 +174,8 @@ void __init imx31_soc_init(void)
175 174
176 imx3_init_l2x0(); 175 imx3_init_l2x0();
177 176
177 mxc_device_init();
178
178 mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0); 179 mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0);
179 mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0); 180 mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0);
180 mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0); 181 mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0);
@@ -271,6 +272,8 @@ void __init imx35_soc_init(void)
271 272
272 imx3_init_l2x0(); 273 imx3_init_l2x0();
273 274
275 mxc_device_init();
276
274 mxc_register_gpio("imx35-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0); 277 mxc_register_gpio("imx35-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0);
275 mxc_register_gpio("imx35-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0); 278 mxc_register_gpio("imx35-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0);
276 mxc_register_gpio("imx35-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0); 279 mxc_register_gpio("imx35-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0);
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index acb0aadb425..79d71cf23a1 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -18,10 +18,10 @@
18 18
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20 20
21#include <mach/hardware.h> 21#include "common.h"
22#include <mach/common.h> 22#include "devices/devices-common.h"
23#include <mach/devices-common.h> 23#include "hardware.h"
24#include <mach/iomux-v3.h> 24#include "iomux-v3.h"
25 25
26/* 26/*
27 * Define the MX50 memory map. 27 * Define the MX50 memory map.
@@ -81,8 +81,28 @@ void __init imx50_init_early(void)
81 mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR)); 81 mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR));
82} 82}
83 83
84/*
85 * The MIPI HSC unit has been removed from the i.MX51 Reference Manual by
86 * the Freescale marketing division. However this did not remove the
87 * hardware from the chip which still needs to be configured for proper
88 * IPU support.
89 */
90static void __init imx51_ipu_mipi_setup(void)
91{
92 void __iomem *hsc_addr;
93 hsc_addr = MX51_IO_ADDRESS(MX51_MIPI_HSC_BASE_ADDR);
94
95 /* setup MIPI module to legacy mode */
96 __raw_writel(0xf00, hsc_addr);
97
98 /* CSI mode: reserved; DI control mode: legacy (from Freescale BSP) */
99 __raw_writel(__raw_readl(hsc_addr + 0x800) | 0x30ff,
100 hsc_addr + 0x800);
101}
102
84void __init imx51_init_early(void) 103void __init imx51_init_early(void)
85{ 104{
105 imx51_ipu_mipi_setup();
86 mxc_set_cpu_type(MXC_CPU_MX51); 106 mxc_set_cpu_type(MXC_CPU_MX51);
87 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); 107 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
88 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); 108 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
@@ -138,6 +158,8 @@ static const struct resource imx51_audmux_res[] __initconst = {
138 158
139void __init imx50_soc_init(void) 159void __init imx50_soc_init(void)
140{ 160{
161 mxc_device_init();
162
141 /* i.mx50 has the i.mx35 type gpio */ 163 /* i.mx50 has the i.mx35 type gpio */
142 mxc_register_gpio("imx35-gpio", 0, MX50_GPIO1_BASE_ADDR, SZ_16K, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH); 164 mxc_register_gpio("imx35-gpio", 0, MX50_GPIO1_BASE_ADDR, SZ_16K, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH);
143 mxc_register_gpio("imx35-gpio", 1, MX50_GPIO2_BASE_ADDR, SZ_16K, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH); 165 mxc_register_gpio("imx35-gpio", 1, MX50_GPIO2_BASE_ADDR, SZ_16K, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH);
@@ -153,6 +175,8 @@ void __init imx50_soc_init(void)
153 175
154void __init imx51_soc_init(void) 176void __init imx51_soc_init(void)
155{ 177{
178 mxc_device_init();
179
156 /* i.mx51 has the i.mx35 type gpio */ 180 /* i.mx51 has the i.mx35 type gpio */
157 mxc_register_gpio("imx35-gpio", 0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_INT_GPIO1_LOW, MX51_INT_GPIO1_HIGH); 181 mxc_register_gpio("imx35-gpio", 0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_INT_GPIO1_LOW, MX51_INT_GPIO1_HIGH);
158 mxc_register_gpio("imx35-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_INT_GPIO2_LOW, MX51_INT_GPIO2_HIGH); 182 mxc_register_gpio("imx35-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_INT_GPIO2_LOW, MX51_INT_GPIO2_HIGH);
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/mach-imx/mx1.h
index 45bd31cc34d..45bd31cc34d 100644
--- a/arch/arm/plat-mxc/include/mach/mx1.h
+++ b/arch/arm/mach-imx/mx1.h
diff --git a/arch/arm/plat-mxc/include/mach/mx21.h b/arch/arm/mach-imx/mx21.h
index 468738aa997..468738aa997 100644
--- a/arch/arm/plat-mxc/include/mach/mx21.h
+++ b/arch/arm/mach-imx/mx21.h
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/mach-imx/mx25.h
index ec466400a20..ec466400a20 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/mach-imx/mx25.h
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/mach-imx/mx27.h
index e074616d54c..e074616d54c 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/mach-imx/mx27.h
diff --git a/arch/arm/plat-mxc/include/mach/mx2x.h b/arch/arm/mach-imx/mx2x.h
index 11642f5b224..11642f5b224 100644
--- a/arch/arm/plat-mxc/include/mach/mx2x.h
+++ b/arch/arm/mach-imx/mx2x.h
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/mach-imx/mx31.h
index ee9b1f9215d..ee9b1f9215d 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/mach-imx/mx31.h
diff --git a/arch/arm/mach-imx/mx31lilly-db.c b/arch/arm/mach-imx/mx31lilly-db.c
index 29e890f9205..d4361b80c5f 100644
--- a/arch/arm/mach-imx/mx31lilly-db.c
+++ b/arch/arm/mach-imx/mx31lilly-db.c
@@ -30,12 +30,11 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <mach/hardware.h> 33#include "board-mx31lilly.h"
34#include <mach/common.h> 34#include "common.h"
35#include <mach/iomux-mx3.h>
36#include <mach/board-mx31lilly.h>
37
38#include "devices-imx31.h" 35#include "devices-imx31.h"
36#include "hardware.h"
37#include "iomux-mx3.h"
39 38
40/* 39/*
41 * This file contains board-specific initialization routines for the 40 * This file contains board-specific initialization routines for the
diff --git a/arch/arm/mach-imx/mx31lite-db.c b/arch/arm/mach-imx/mx31lite-db.c
index 83d17d9e0bc..5a160b7e4fc 100644
--- a/arch/arm/mach-imx/mx31lite-db.c
+++ b/arch/arm/mach-imx/mx31lite-db.c
@@ -31,12 +31,11 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <mach/hardware.h> 34#include "board-mx31lite.h"
35#include <mach/common.h> 35#include "common.h"
36#include <mach/iomux-mx3.h>
37#include <mach/board-mx31lite.h>
38
39#include "devices-imx31.h" 36#include "devices-imx31.h"
37#include "hardware.h"
38#include "iomux-mx3.h"
40 39
41/* 40/*
42 * This file contains board-specific initialization routines for the 41 * This file contains board-specific initialization routines for the
diff --git a/arch/arm/mach-imx/mx31moboard-devboard.c b/arch/arm/mach-imx/mx31moboard-devboard.c
index cc285e50728..52d5b157472 100644
--- a/arch/arm/mach-imx/mx31moboard-devboard.c
+++ b/arch/arm/mach-imx/mx31moboard-devboard.c
@@ -22,12 +22,11 @@
22 22
23#include <linux/usb/otg.h> 23#include <linux/usb/otg.h>
24 24
25#include <mach/common.h> 25#include "common.h"
26#include <mach/iomux-mx3.h>
27#include <mach/hardware.h>
28#include <mach/ulpi.h>
29
30#include "devices-imx31.h" 26#include "devices-imx31.h"
27#include "hardware.h"
28#include "iomux-mx3.h"
29#include "ulpi.h"
31 30
32static unsigned int devboard_pins[] = { 31static unsigned int devboard_pins[] = {
33 /* UART1 */ 32 /* UART1 */
diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c
index 135c90e3a45..a4f43e90f3c 100644
--- a/arch/arm/mach-imx/mx31moboard-marxbot.c
+++ b/arch/arm/mach-imx/mx31moboard-marxbot.c
@@ -24,14 +24,13 @@
24 24
25#include <linux/usb/otg.h> 25#include <linux/usb/otg.h>
26 26
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/iomux-mx3.h>
30#include <mach/ulpi.h>
31
32#include <media/soc_camera.h> 27#include <media/soc_camera.h>
33 28
29#include "common.h"
34#include "devices-imx31.h" 30#include "devices-imx31.h"
31#include "hardware.h"
32#include "iomux-mx3.h"
33#include "ulpi.h"
35 34
36static unsigned int marxbot_pins[] = { 35static unsigned int marxbot_pins[] = {
37 /* SDHC2 */ 36 /* SDHC2 */
diff --git a/arch/arm/mach-imx/mx31moboard-smartbot.c b/arch/arm/mach-imx/mx31moboard-smartbot.c
index fabb801e799..04ae45dbfaa 100644
--- a/arch/arm/mach-imx/mx31moboard-smartbot.c
+++ b/arch/arm/mach-imx/mx31moboard-smartbot.c
@@ -23,15 +23,14 @@
23#include <linux/usb/otg.h> 23#include <linux/usb/otg.h>
24#include <linux/usb/ulpi.h> 24#include <linux/usb/ulpi.h>
25 25
26#include <mach/common.h>
27#include <mach/hardware.h>
28#include <mach/iomux-mx3.h>
29#include <mach/board-mx31moboard.h>
30#include <mach/ulpi.h>
31
32#include <media/soc_camera.h> 26#include <media/soc_camera.h>
33 27
28#include "board-mx31moboard.h"
29#include "common.h"
34#include "devices-imx31.h" 30#include "devices-imx31.h"
31#include "hardware.h"
32#include "iomux-mx3.h"
33#include "ulpi.h"
35 34
36static unsigned int smartbot_pins[] = { 35static unsigned int smartbot_pins[] = {
37 /* UART1 */ 36 /* UART1 */
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/mach-imx/mx35.h
index 2af5d3a699c..2af5d3a699c 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/mach-imx/mx35.h
diff --git a/arch/arm/plat-mxc/include/mach/mx3x.h b/arch/arm/mach-imx/mx3x.h
index 96fb4fbc8ad..96fb4fbc8ad 100644
--- a/arch/arm/plat-mxc/include/mach/mx3x.h
+++ b/arch/arm/mach-imx/mx3x.h
diff --git a/arch/arm/plat-mxc/include/mach/mx50.h b/arch/arm/mach-imx/mx50.h
index 09ac19c1570..09ac19c1570 100644
--- a/arch/arm/plat-mxc/include/mach/mx50.h
+++ b/arch/arm/mach-imx/mx50.h
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/mach-imx/mx51.h
index af844f76261..af844f76261 100644
--- a/arch/arm/plat-mxc/include/mach/mx51.h
+++ b/arch/arm/mach-imx/mx51.h
diff --git a/arch/arm/plat-mxc/include/mach/mx53.h b/arch/arm/mach-imx/mx53.h
index f829d1c2250..f829d1c2250 100644
--- a/arch/arm/plat-mxc/include/mach/mx53.h
+++ b/arch/arm/mach-imx/mx53.h
diff --git a/arch/arm/plat-mxc/include/mach/mx6q.h b/arch/arm/mach-imx/mx6q.h
index f7e7dbac8f4..19d3f54db5a 100644
--- a/arch/arm/plat-mxc/include/mach/mx6q.h
+++ b/arch/arm/mach-imx/mx6q.h
@@ -27,9 +27,5 @@
27#define MX6Q_CCM_SIZE 0x4000 27#define MX6Q_CCM_SIZE 0x4000
28#define MX6Q_ANATOP_BASE_ADDR 0x020c8000 28#define MX6Q_ANATOP_BASE_ADDR 0x020c8000
29#define MX6Q_ANATOP_SIZE 0x1000 29#define MX6Q_ANATOP_SIZE 0x1000
30#define MX6Q_UART2_BASE_ADDR 0x021e8000
31#define MX6Q_UART2_SIZE 0x4000
32#define MX6Q_UART4_BASE_ADDR 0x021f0000
33#define MX6Q_UART4_SIZE 0x4000
34 30
35#endif /* __MACH_MX6Q_H__ */ 31#endif /* __MACH_MX6Q_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mxc.h b/arch/arm/mach-imx/mxc.h
index d78298366a9..d78298366a9 100644
--- a/arch/arm/plat-mxc/include/mach/mxc.h
+++ b/arch/arm/mach-imx/mxc.h
diff --git a/arch/arm/mach-imx/pcm970-baseboard.c b/arch/arm/mach-imx/pcm970-baseboard.c
index 9917e2ff51d..51c60823408 100644
--- a/arch/arm/mach-imx/pcm970-baseboard.c
+++ b/arch/arm/mach-imx/pcm970-baseboard.c
@@ -23,11 +23,10 @@
23 23
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
26#include <mach/common.h> 26#include "common.h"
27#include <mach/iomux-mx27.h>
28#include <mach/hardware.h>
29
30#include "devices-imx27.h" 27#include "devices-imx27.h"
28#include "hardware.h"
29#include "iomux-mx27.h"
31 30
32static const int pcm970_pins[] __initconst = { 31static const int pcm970_pins[] __initconst = {
33 /* SDHC */ 32 /* SDHC */
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 2ac43e1a2df..3777b805b76 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -16,8 +16,9 @@
16#include <asm/smp_scu.h> 16#include <asm/smp_scu.h>
17#include <asm/hardware/gic.h> 17#include <asm/hardware/gic.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <mach/common.h> 19
20#include <mach/hardware.h> 20#include "common.h"
21#include "hardware.h"
21 22
22static void __iomem *scu_base; 23static void __iomem *scu_base;
23 24
diff --git a/arch/arm/mach-imx/pm-imx27.c b/arch/arm/mach-imx/pm-imx27.c
index 6fcffa7db97..56d02d064fb 100644
--- a/arch/arm/mach-imx/pm-imx27.c
+++ b/arch/arm/mach-imx/pm-imx27.c
@@ -10,7 +10,8 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/suspend.h> 11#include <linux/suspend.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <mach/hardware.h> 13
14#include "hardware.h"
14 15
15static int mx27_suspend_enter(suspend_state_t state) 16static int mx27_suspend_enter(suspend_state_t state)
16{ 17{
diff --git a/arch/arm/mach-imx/pm-imx3.c b/arch/arm/mach-imx/pm-imx3.c
index 822103bdb70..6a07006ff0f 100644
--- a/arch/arm/mach-imx/pm-imx3.c
+++ b/arch/arm/mach-imx/pm-imx3.c
@@ -9,10 +9,11 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11#include <linux/io.h> 11#include <linux/io.h>
12#include <mach/common.h> 12
13#include <mach/hardware.h> 13#include "common.h"
14#include <mach/devices-common.h>
15#include "crmregs-imx3.h" 14#include "crmregs-imx3.h"
15#include "devices/devices-common.h"
16#include "hardware.h"
16 17
17/* 18/*
18 * Set cpu low power mode before WFI instruction. This function is called 19 * Set cpu low power mode before WFI instruction. This function is called
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index 19621ed1ffa..2e063c2deb9 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -16,10 +16,11 @@
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/system_misc.h> 17#include <asm/system_misc.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include <mach/common.h> 19
20#include <mach/cpuidle.h> 20#include "common.h"
21#include <mach/hardware.h> 21#include "cpuidle.h"
22#include "crm-regs-imx5.h" 22#include "crm-regs-imx5.h"
23#include "hardware.h"
23 24
24/* 25/*
25 * The WAIT_UNCLOCKED_POWER_OFF state only requires <= 500ns to exit. 26 * The WAIT_UNCLOCKED_POWER_OFF state only requires <= 500ns to exit.
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
index f7b0c2b1b90..a17543da602 100644
--- a/arch/arm/mach-imx/pm-imx6q.c
+++ b/arch/arm/mach-imx/pm-imx6q.c
@@ -18,8 +18,9 @@
18#include <asm/proc-fns.h> 18#include <asm/proc-fns.h>
19#include <asm/suspend.h> 19#include <asm/suspend.h>
20#include <asm/hardware/cache-l2x0.h> 20#include <asm/hardware/cache-l2x0.h>
21#include <mach/common.h> 21
22#include <mach/hardware.h> 22#include "common.h"
23#include "hardware.h"
23 24
24extern unsigned long phys_l2x0_saved_regs; 25extern unsigned long phys_l2x0_saved_regs;
25 26
diff --git a/arch/arm/plat-mxc/ssi-fiq-ksym.c b/arch/arm/mach-imx/ssi-fiq-ksym.c
index 792090f9a03..792090f9a03 100644
--- a/arch/arm/plat-mxc/ssi-fiq-ksym.c
+++ b/arch/arm/mach-imx/ssi-fiq-ksym.c
diff --git a/arch/arm/plat-mxc/ssi-fiq.S b/arch/arm/mach-imx/ssi-fiq.S
index a8b93c5f29b..a8b93c5f29b 100644
--- a/arch/arm/plat-mxc/ssi-fiq.S
+++ b/arch/arm/mach-imx/ssi-fiq.S
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/mach-imx/system.c
index 3da78cfc5a9..695e0d73bf8 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -22,12 +22,13 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24 24
25#include <mach/hardware.h>
26#include <mach/common.h>
27#include <asm/system_misc.h> 25#include <asm/system_misc.h>
28#include <asm/proc-fns.h> 26#include <asm/proc-fns.h>
29#include <asm/mach-types.h> 27#include <asm/mach-types.h>
30 28
29#include "common.h"
30#include "hardware.h"
31
31static void __iomem *wdog_base; 32static void __iomem *wdog_base;
32 33
33/* 34/*
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/mach-imx/time.c
index a17abcf9832..f017302f6d0 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -27,10 +27,11 @@
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/err.h> 28#include <linux/err.h>
29 29
30#include <mach/hardware.h>
31#include <asm/sched_clock.h> 30#include <asm/sched_clock.h>
32#include <asm/mach/time.h> 31#include <asm/mach/time.h>
33#include <mach/common.h> 32
33#include "common.h"
34#include "hardware.h"
34 35
35/* 36/*
36 * There are 2 versions of the timer hardware on Freescale MXC hardware. 37 * There are 2 versions of the timer hardware on Freescale MXC hardware.
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/mach-imx/tzic.c
index 3ed1adbc09f..9721161f208 100644
--- a/arch/arm/plat-mxc/tzic.c
+++ b/arch/arm/mach-imx/tzic.c
@@ -21,10 +21,8 @@
21#include <asm/mach/irq.h> 21#include <asm/mach/irq.h>
22#include <asm/exception.h> 22#include <asm/exception.h>
23 23
24#include <mach/hardware.h> 24#include "common.h"
25#include <mach/common.h> 25#include "hardware.h"
26#include <mach/irqs.h>
27
28#include "irq-common.h" 26#include "irq-common.h"
29 27
30/* 28/*
diff --git a/arch/arm/plat-mxc/ulpi.c b/arch/arm/mach-imx/ulpi.c
index d2963427184..0f051957d10 100644
--- a/arch/arm/plat-mxc/ulpi.c
+++ b/arch/arm/mach-imx/ulpi.c
@@ -24,7 +24,7 @@
24#include <linux/usb/otg.h> 24#include <linux/usb/otg.h>
25#include <linux/usb/ulpi.h> 25#include <linux/usb/ulpi.h>
26 26
27#include <mach/ulpi.h> 27#include "ulpi.h"
28 28
29/* ULPIVIEW register bits */ 29/* ULPIVIEW register bits */
30#define ULPIVW_WU (1 << 31) /* Wakeup */ 30#define ULPIVW_WU (1 << 31) /* Wakeup */
diff --git a/arch/arm/plat-mxc/include/mach/ulpi.h b/arch/arm/mach-imx/ulpi.h
index 42bdaca6d7d..42bdaca6d7d 100644
--- a/arch/arm/plat-mxc/include/mach/ulpi.h
+++ b/arch/arm/mach-imx/ulpi.h
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index 350e26636a0..abeff25532a 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -8,6 +8,7 @@ config ARCH_INTEGRATOR_AP
8 select MIGHT_HAVE_PCI 8 select MIGHT_HAVE_PCI
9 select SERIAL_AMBA_PL010 9 select SERIAL_AMBA_PL010
10 select SERIAL_AMBA_PL010_CONSOLE 10 select SERIAL_AMBA_PL010_CONSOLE
11 select SOC_BUS
11 help 12 help
12 Include support for the ARM(R) Integrator/AP and 13 Include support for the ARM(R) Integrator/AP and
13 Integrator/PP2 platforms. 14 Integrator/PP2 platforms.
@@ -19,6 +20,7 @@ config ARCH_INTEGRATOR_CP
19 select PLAT_VERSATILE_CLCD 20 select PLAT_VERSATILE_CLCD
20 select SERIAL_AMBA_PL011 21 select SERIAL_AMBA_PL011
21 select SERIAL_AMBA_PL011_CONSOLE 22 select SERIAL_AMBA_PL011_CONSOLE
23 select SOC_BUS
22 help 24 help
23 Include support for the ARM(R) Integrator CP platform. 25 Include support for the ARM(R) Integrator CP platform.
24 26
diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h
index c3ff21b5ea2..79197d8b34a 100644
--- a/arch/arm/mach-integrator/common.h
+++ b/arch/arm/mach-integrator/common.h
@@ -1,6 +1,12 @@
1#include <linux/amba/serial.h> 1#include <linux/amba/serial.h>
2extern struct amba_pl010_data integrator_uart_data; 2#ifdef CONFIG_ARCH_INTEGRATOR_AP
3extern struct amba_pl010_data ap_uart_data;
4#else
5/* Not used without Integrator/AP support anyway */
6struct amba_pl010_data ap_uart_data {};
7#endif
3void integrator_init_early(void); 8void integrator_init_early(void);
4int integrator_init(bool is_cp); 9int integrator_init(bool is_cp);
5void integrator_reserve(void); 10void integrator_reserve(void);
6void integrator_restart(char, const char *); 11void integrator_restart(char, const char *);
12void integrator_init_sysfs(struct device *parent, u32 id);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index ea22a17246d..39c060f75e4 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -18,10 +18,10 @@
18#include <linux/memblock.h> 18#include <linux/memblock.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
21#include <linux/termios.h>
22#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
23#include <linux/amba/serial.h> 22#include <linux/amba/serial.h>
24#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/stat.h>
25 25
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/platform.h> 27#include <mach/platform.h>
@@ -46,10 +46,10 @@ static AMBA_APB_DEVICE(rtc, "rtc", 0,
46 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL); 46 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL);
47 47
48static AMBA_APB_DEVICE(uart0, "uart0", 0, 48static AMBA_APB_DEVICE(uart0, "uart0", 0,
49 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, &integrator_uart_data); 49 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, NULL);
50 50
51static AMBA_APB_DEVICE(uart1, "uart1", 0, 51static AMBA_APB_DEVICE(uart1, "uart1", 0,
52 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, &integrator_uart_data); 52 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, NULL);
53 53
54static AMBA_APB_DEVICE(kmi0, "kmi0", 0, KMI0_BASE, KMI0_IRQ, NULL); 54static AMBA_APB_DEVICE(kmi0, "kmi0", 0, KMI0_BASE, KMI0_IRQ, NULL);
55static AMBA_APB_DEVICE(kmi1, "kmi1", 0, KMI1_BASE, KMI1_IRQ, NULL); 55static AMBA_APB_DEVICE(kmi1, "kmi1", 0, KMI1_BASE, KMI1_IRQ, NULL);
@@ -77,6 +77,8 @@ int __init integrator_init(bool is_cp)
77 uart1_device.periphid = 0x00041010; 77 uart1_device.periphid = 0x00041010;
78 kmi0_device.periphid = 0x00041050; 78 kmi0_device.periphid = 0x00041050;
79 kmi1_device.periphid = 0x00041050; 79 kmi1_device.periphid = 0x00041050;
80 uart0_device.dev.platform_data = &ap_uart_data;
81 uart1_device.dev.platform_data = &ap_uart_data;
80 } 82 }
81 83
82 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 84 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
@@ -89,49 +91,6 @@ int __init integrator_init(bool is_cp)
89 91
90#endif 92#endif
91 93
92/*
93 * On the Integrator platform, the port RTS and DTR are provided by
94 * bits in the following SC_CTRLS register bits:
95 * RTS DTR
96 * UART0 7 6
97 * UART1 5 4
98 */
99#define SC_CTRLC __io_address(INTEGRATOR_SC_CTRLC)
100#define SC_CTRLS __io_address(INTEGRATOR_SC_CTRLS)
101
102static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
103{
104 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
105 u32 phybase = dev->res.start;
106
107 if (phybase == INTEGRATOR_UART0_BASE) {
108 /* UART0 */
109 rts_mask = 1 << 4;
110 dtr_mask = 1 << 5;
111 } else {
112 /* UART1 */
113 rts_mask = 1 << 6;
114 dtr_mask = 1 << 7;
115 }
116
117 if (mctrl & TIOCM_RTS)
118 ctrlc |= rts_mask;
119 else
120 ctrls |= rts_mask;
121
122 if (mctrl & TIOCM_DTR)
123 ctrlc |= dtr_mask;
124 else
125 ctrls |= dtr_mask;
126
127 __raw_writel(ctrls, SC_CTRLS);
128 __raw_writel(ctrlc, SC_CTRLC);
129}
130
131struct amba_pl010_data integrator_uart_data = {
132 .set_mctrl = integrator_uart_set_mctrl,
133};
134
135static DEFINE_RAW_SPINLOCK(cm_lock); 94static DEFINE_RAW_SPINLOCK(cm_lock);
136 95
137/** 96/**
@@ -169,3 +128,93 @@ void integrator_restart(char mode, const char *cmd)
169{ 128{
170 cm_control(CM_CTRL_RESET, CM_CTRL_RESET); 129 cm_control(CM_CTRL_RESET, CM_CTRL_RESET);
171} 130}
131
132static u32 integrator_id;
133
134static ssize_t intcp_get_manf(struct device *dev,
135 struct device_attribute *attr,
136 char *buf)
137{
138 return sprintf(buf, "%02x\n", integrator_id >> 24);
139}
140
141static struct device_attribute intcp_manf_attr =
142 __ATTR(manufacturer, S_IRUGO, intcp_get_manf, NULL);
143
144static ssize_t intcp_get_arch(struct device *dev,
145 struct device_attribute *attr,
146 char *buf)
147{
148 const char *arch;
149
150 switch ((integrator_id >> 16) & 0xff) {
151 case 0x00:
152 arch = "ASB little-endian";
153 break;
154 case 0x01:
155 arch = "AHB little-endian";
156 break;
157 case 0x03:
158 arch = "AHB-Lite system bus, bi-endian";
159 break;
160 case 0x04:
161 arch = "AHB";
162 break;
163 default:
164 arch = "Unknown";
165 break;
166 }
167
168 return sprintf(buf, "%s\n", arch);
169}
170
171static struct device_attribute intcp_arch_attr =
172 __ATTR(architecture, S_IRUGO, intcp_get_arch, NULL);
173
174static ssize_t intcp_get_fpga(struct device *dev,
175 struct device_attribute *attr,
176 char *buf)
177{
178 const char *fpga;
179
180 switch ((integrator_id >> 12) & 0xf) {
181 case 0x01:
182 fpga = "XC4062";
183 break;
184 case 0x02:
185 fpga = "XC4085";
186 break;
187 case 0x04:
188 fpga = "EPM7256AE (Altera PLD)";
189 break;
190 default:
191 fpga = "Unknown";
192 break;
193 }
194
195 return sprintf(buf, "%s\n", fpga);
196}
197
198static struct device_attribute intcp_fpga_attr =
199 __ATTR(fpga, S_IRUGO, intcp_get_fpga, NULL);
200
201static ssize_t intcp_get_build(struct device *dev,
202 struct device_attribute *attr,
203 char *buf)
204{
205 return sprintf(buf, "%02x\n", (integrator_id >> 4) & 0xFF);
206}
207
208static struct device_attribute intcp_build_attr =
209 __ATTR(build, S_IRUGO, intcp_get_build, NULL);
210
211
212
213void integrator_init_sysfs(struct device *parent, u32 id)
214{
215 integrator_id = id;
216 device_create_file(parent, &intcp_manf_attr);
217 device_create_file(parent, &intcp_arch_attr);
218 device_create_file(parent, &intcp_fpga_attr);
219 device_create_file(parent, &intcp_build_attr);
220}
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index e428f3ab15c..9f82f9dcbb9 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -21,10 +21,9 @@
21#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
22#include <linux/amba/clcd.h> 22#include <linux/amba/clcd.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/platform_data/clk-integrator.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
25#include <linux/clkdev.h>
26 26
27#include <asm/hardware/icst.h>
28#include <mach/lm.h> 27#include <mach/lm.h>
29#include <mach/impd1.h> 28#include <mach/impd1.h>
30#include <asm/sizes.h> 29#include <asm/sizes.h>
@@ -36,45 +35,6 @@ MODULE_PARM_DESC(lmid, "logic module stack position");
36 35
37struct impd1_module { 36struct impd1_module {
38 void __iomem *base; 37 void __iomem *base;
39 struct clk vcos[2];
40 struct clk_lookup *clks[3];
41};
42
43static const struct icst_params impd1_vco_params = {
44 .ref = 24000000, /* 24 MHz */
45 .vco_max = ICST525_VCO_MAX_3V,
46 .vco_min = ICST525_VCO_MIN,
47 .vd_min = 12,
48 .vd_max = 519,
49 .rd_min = 3,
50 .rd_max = 120,
51 .s2div = icst525_s2div,
52 .idx2s = icst525_idx2s,
53};
54
55static void impd1_setvco(struct clk *clk, struct icst_vco vco)
56{
57 struct impd1_module *impd1 = clk->data;
58 u32 val = vco.v | (vco.r << 9) | (vco.s << 16);
59
60 writel(0xa05f, impd1->base + IMPD1_LOCK);
61 writel(val, clk->vcoreg);
62 writel(0, impd1->base + IMPD1_LOCK);
63
64#ifdef DEBUG
65 vco.v = val & 0x1ff;
66 vco.r = (val >> 9) & 0x7f;
67 vco.s = (val >> 16) & 7;
68
69 pr_debug("IM-PD1: VCO%d clock is %ld Hz\n",
70 vconr, icst525_hz(&impd1_vco_params, vco));
71#endif
72}
73
74static const struct clk_ops impd1_clk_ops = {
75 .round = icst_clk_round,
76 .set = icst_clk_set,
77 .setvco = impd1_setvco,
78}; 38};
79 39
80void impd1_tweak_control(struct device *dev, u32 mask, u32 val) 40void impd1_tweak_control(struct device *dev, u32 mask, u32 val)
@@ -344,10 +304,6 @@ static struct impd1_device impd1_devs[] = {
344 } 304 }
345}; 305};
346 306
347static struct clk fixed_14745600 = {
348 .rate = 14745600,
349};
350
351static int impd1_probe(struct lm_device *dev) 307static int impd1_probe(struct lm_device *dev)
352{ 308{
353 struct impd1_module *impd1; 309 struct impd1_module *impd1;
@@ -376,23 +332,7 @@ static int impd1_probe(struct lm_device *dev)
376 printk("IM-PD1 found at 0x%08lx\n", 332 printk("IM-PD1 found at 0x%08lx\n",
377 (unsigned long)dev->resource.start); 333 (unsigned long)dev->resource.start);
378 334
379 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) { 335 integrator_impd1_clk_init(impd1->base, dev->id);
380 impd1->vcos[i].ops = &impd1_clk_ops,
381 impd1->vcos[i].owner = THIS_MODULE,
382 impd1->vcos[i].params = &impd1_vco_params,
383 impd1->vcos[i].data = impd1;
384 }
385 impd1->vcos[0].vcoreg = impd1->base + IMPD1_OSC1;
386 impd1->vcos[1].vcoreg = impd1->base + IMPD1_OSC2;
387
388 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
389 dev->id);
390 impd1->clks[1] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00100",
391 dev->id);
392 impd1->clks[2] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00200",
393 dev->id);
394 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
395 clkdev_add(impd1->clks[i]);
396 336
397 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) { 337 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) {
398 struct impd1_device *idev = impd1_devs + i; 338 struct impd1_device *idev = impd1_devs + i;
@@ -402,9 +342,10 @@ static int impd1_probe(struct lm_device *dev)
402 342
403 pc_base = dev->resource.start + idev->offset; 343 pc_base = dev->resource.start + idev->offset;
404 snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12); 344 snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12);
405 d = amba_ahb_device_add(&dev->dev, devname, pc_base, SZ_4K, 345 d = amba_ahb_device_add_res(&dev->dev, devname, pc_base, SZ_4K,
406 dev->irq, dev->irq, 346 dev->irq, dev->irq,
407 idev->platform_data, idev->id); 347 idev->platform_data, idev->id,
348 &dev->resource);
408 if (IS_ERR(d)) { 349 if (IS_ERR(d)) {
409 dev_err(&dev->dev, "unable to register device: %ld\n", PTR_ERR(d)); 350 dev_err(&dev->dev, "unable to register device: %ld\n", PTR_ERR(d));
410 continue; 351 continue;
@@ -431,12 +372,9 @@ static int impd1_remove_one(struct device *dev, void *data)
431static void impd1_remove(struct lm_device *dev) 372static void impd1_remove(struct lm_device *dev)
432{ 373{
433 struct impd1_module *impd1 = lm_get_drvdata(dev); 374 struct impd1_module *impd1 = lm_get_drvdata(dev);
434 int i;
435 375
436 device_for_each_child(&dev->dev, NULL, impd1_remove_one); 376 device_for_each_child(&dev->dev, NULL, impd1_remove_one);
437 377 integrator_impd1_clk_exit(dev->id);
438 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
439 clkdev_drop(impd1->clks[i]);
440 378
441 lm_set_drvdata(dev, NULL); 379 lm_set_drvdata(dev, NULL);
442 380
diff --git a/arch/arm/mach-integrator/include/mach/irqs.h b/arch/arm/mach-integrator/include/mach/irqs.h
index 7371018455d..eff0adad9ae 100644
--- a/arch/arm/mach-integrator/include/mach/irqs.h
+++ b/arch/arm/mach-integrator/include/mach/irqs.h
@@ -19,64 +19,63 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22/* 22/*
23 * Interrupt numbers 23 * Interrupt numbers, all of the above are just static reservations
24 * used so they can be encoded into device resources. They will finally
25 * be done away with when switching to device tree.
24 */ 26 */
25#define IRQ_PIC_START 1 27#define IRQ_PIC_START 64
26#define IRQ_SOFTINT 1 28#define IRQ_SOFTINT (IRQ_PIC_START+0)
27#define IRQ_UARTINT0 2 29#define IRQ_UARTINT0 (IRQ_PIC_START+1)
28#define IRQ_UARTINT1 3 30#define IRQ_UARTINT1 (IRQ_PIC_START+2)
29#define IRQ_KMIINT0 4 31#define IRQ_KMIINT0 (IRQ_PIC_START+3)
30#define IRQ_KMIINT1 5 32#define IRQ_KMIINT1 (IRQ_PIC_START+4)
31#define IRQ_TIMERINT0 6 33#define IRQ_TIMERINT0 (IRQ_PIC_START+5)
32#define IRQ_TIMERINT1 7 34#define IRQ_TIMERINT1 (IRQ_PIC_START+6)
33#define IRQ_TIMERINT2 8 35#define IRQ_TIMERINT2 (IRQ_PIC_START+7)
34#define IRQ_RTCINT 9 36#define IRQ_RTCINT (IRQ_PIC_START+8)
35#define IRQ_AP_EXPINT0 10 37#define IRQ_AP_EXPINT0 (IRQ_PIC_START+9)
36#define IRQ_AP_EXPINT1 11 38#define IRQ_AP_EXPINT1 (IRQ_PIC_START+10)
37#define IRQ_AP_EXPINT2 12 39#define IRQ_AP_EXPINT2 (IRQ_PIC_START+11)
38#define IRQ_AP_EXPINT3 13 40#define IRQ_AP_EXPINT3 (IRQ_PIC_START+12)
39#define IRQ_AP_PCIINT0 14 41#define IRQ_AP_PCIINT0 (IRQ_PIC_START+13)
40#define IRQ_AP_PCIINT1 15 42#define IRQ_AP_PCIINT1 (IRQ_PIC_START+14)
41#define IRQ_AP_PCIINT2 16 43#define IRQ_AP_PCIINT2 (IRQ_PIC_START+15)
42#define IRQ_AP_PCIINT3 17 44#define IRQ_AP_PCIINT3 (IRQ_PIC_START+16)
43#define IRQ_AP_V3INT 18 45#define IRQ_AP_V3INT (IRQ_PIC_START+17)
44#define IRQ_AP_CPINT0 19 46#define IRQ_AP_CPINT0 (IRQ_PIC_START+18)
45#define IRQ_AP_CPINT1 20 47#define IRQ_AP_CPINT1 (IRQ_PIC_START+19)
46#define IRQ_AP_LBUSTIMEOUT 21 48#define IRQ_AP_LBUSTIMEOUT (IRQ_PIC_START+20)
47#define IRQ_AP_APCINT 22 49#define IRQ_AP_APCINT (IRQ_PIC_START+21)
48#define IRQ_CP_CLCDCINT 23 50#define IRQ_CP_CLCDCINT (IRQ_PIC_START+22)
49#define IRQ_CP_MMCIINT0 24 51#define IRQ_CP_MMCIINT0 (IRQ_PIC_START+23)
50#define IRQ_CP_MMCIINT1 25 52#define IRQ_CP_MMCIINT1 (IRQ_PIC_START+24)
51#define IRQ_CP_AACIINT 26 53#define IRQ_CP_AACIINT (IRQ_PIC_START+25)
52#define IRQ_CP_CPPLDINT 27 54#define IRQ_CP_CPPLDINT (IRQ_PIC_START+26)
53#define IRQ_CP_ETHINT 28 55#define IRQ_CP_ETHINT (IRQ_PIC_START+27)
54#define IRQ_CP_TSPENINT 29 56#define IRQ_CP_TSPENINT (IRQ_PIC_START+28)
55#define IRQ_PIC_END 29 57#define IRQ_PIC_END (IRQ_PIC_START+28)
56 58
57#define IRQ_CIC_START 32 59#define IRQ_CIC_START (IRQ_PIC_END+1)
58#define IRQ_CM_SOFTINT 32 60#define IRQ_CM_SOFTINT (IRQ_CIC_START+0)
59#define IRQ_CM_COMMRX 33 61#define IRQ_CM_COMMRX (IRQ_CIC_START+1)
60#define IRQ_CM_COMMTX 34 62#define IRQ_CM_COMMTX (IRQ_CIC_START+2)
61#define IRQ_CIC_END 34 63#define IRQ_CIC_END (IRQ_CIC_START+2)
62 64
63/* 65/*
64 * IntegratorCP only 66 * IntegratorCP only
65 */ 67 */
66#define IRQ_SIC_START 35 68#define IRQ_SIC_START (IRQ_CIC_END+1)
67#define IRQ_SIC_CP_SOFTINT 35 69#define IRQ_SIC_CP_SOFTINT (IRQ_SIC_START+0)
68#define IRQ_SIC_CP_RI0 36 70#define IRQ_SIC_CP_RI0 (IRQ_SIC_START+1)
69#define IRQ_SIC_CP_RI1 37 71#define IRQ_SIC_CP_RI1 (IRQ_SIC_START+2)
70#define IRQ_SIC_CP_CARDIN 38 72#define IRQ_SIC_CP_CARDIN (IRQ_SIC_START+3)
71#define IRQ_SIC_CP_LMINT0 39 73#define IRQ_SIC_CP_LMINT0 (IRQ_SIC_START+4)
72#define IRQ_SIC_CP_LMINT1 40 74#define IRQ_SIC_CP_LMINT1 (IRQ_SIC_START+5)
73#define IRQ_SIC_CP_LMINT2 41 75#define IRQ_SIC_CP_LMINT2 (IRQ_SIC_START+6)
74#define IRQ_SIC_CP_LMINT3 42 76#define IRQ_SIC_CP_LMINT3 (IRQ_SIC_START+7)
75#define IRQ_SIC_CP_LMINT4 43 77#define IRQ_SIC_CP_LMINT4 (IRQ_SIC_START+8)
76#define IRQ_SIC_CP_LMINT5 44 78#define IRQ_SIC_CP_LMINT5 (IRQ_SIC_START+9)
77#define IRQ_SIC_CP_LMINT6 45 79#define IRQ_SIC_CP_LMINT6 (IRQ_SIC_START+10)
78#define IRQ_SIC_CP_LMINT7 46 80#define IRQ_SIC_CP_LMINT7 (IRQ_SIC_START+11)
79#define IRQ_SIC_END 46 81#define IRQ_SIC_END (IRQ_SIC_START+11)
80
81#define NR_IRQS_INTEGRATOR_AP 34
82#define NR_IRQS_INTEGRATOR_CP 47
diff --git a/arch/arm/mach-integrator/include/mach/platform.h b/arch/arm/mach-integrator/include/mach/platform.h
index efeac5d0bc9..be5859efe10 100644
--- a/arch/arm/mach-integrator/include/mach/platform.h
+++ b/arch/arm/mach-integrator/include/mach/platform.h
@@ -190,7 +190,6 @@
190#define INTEGRATOR_SC_CTRLC_OFFSET 0x0C 190#define INTEGRATOR_SC_CTRLC_OFFSET 0x0C
191#define INTEGRATOR_SC_DEC_OFFSET 0x10 191#define INTEGRATOR_SC_DEC_OFFSET 0x10
192#define INTEGRATOR_SC_ARB_OFFSET 0x14 192#define INTEGRATOR_SC_ARB_OFFSET 0x14
193#define INTEGRATOR_SC_PCIENABLE_OFFSET 0x18
194#define INTEGRATOR_SC_LOCK_OFFSET 0x1C 193#define INTEGRATOR_SC_LOCK_OFFSET 0x1C
195 194
196#define INTEGRATOR_SC_BASE 0x11000000 195#define INTEGRATOR_SC_BASE 0x11000000
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index e6617c134fa..11e2a414580 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -31,12 +31,16 @@
31#include <linux/clockchips.h> 31#include <linux/clockchips.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/irqchip/versatile-fpga.h>
34#include <linux/mtd/physmap.h> 35#include <linux/mtd/physmap.h>
35#include <linux/clk.h> 36#include <linux/clk.h>
36#include <linux/platform_data/clk-integrator.h> 37#include <linux/platform_data/clk-integrator.h>
37#include <linux/of_irq.h> 38#include <linux/of_irq.h>
38#include <linux/of_address.h> 39#include <linux/of_address.h>
39#include <linux/of_platform.h> 40#include <linux/of_platform.h>
41#include <linux/stat.h>
42#include <linux/sys_soc.h>
43#include <linux/termios.h>
40#include <video/vga.h> 44#include <video/vga.h>
41 45
42#include <mach/hardware.h> 46#include <mach/hardware.h>
@@ -56,11 +60,12 @@
56#include <asm/mach/pci.h> 60#include <asm/mach/pci.h>
57#include <asm/mach/time.h> 61#include <asm/mach/time.h>
58 62
59#include <plat/fpga-irq.h>
60
61#include "common.h" 63#include "common.h"
62 64
63/* 65/* Base address to the AP system controller */
66void __iomem *ap_syscon_base;
67
68/*
64 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx 69 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
65 * is the (PA >> 12). 70 * is the (PA >> 12).
66 * 71 *
@@ -68,7 +73,6 @@
68 * just for now). 73 * just for now).
69 */ 74 */
70#define VA_IC_BASE __io_address(INTEGRATOR_IC_BASE) 75#define VA_IC_BASE __io_address(INTEGRATOR_IC_BASE)
71#define VA_SC_BASE __io_address(INTEGRATOR_SC_BASE)
72#define VA_EBI_BASE __io_address(INTEGRATOR_EBI_BASE) 76#define VA_EBI_BASE __io_address(INTEGRATOR_EBI_BASE)
73#define VA_CMIC_BASE __io_address(INTEGRATOR_HDR_IC) 77#define VA_CMIC_BASE __io_address(INTEGRATOR_HDR_IC)
74 78
@@ -97,11 +101,6 @@ static struct map_desc ap_io_desc[] __initdata = {
97 .length = SZ_4K, 101 .length = SZ_4K,
98 .type = MT_DEVICE 102 .type = MT_DEVICE
99 }, { 103 }, {
100 .virtual = IO_ADDRESS(INTEGRATOR_SC_BASE),
101 .pfn = __phys_to_pfn(INTEGRATOR_SC_BASE),
102 .length = SZ_4K,
103 .type = MT_DEVICE
104 }, {
105 .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE), 104 .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE),
106 .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE), 105 .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE),
107 .length = SZ_4K, 106 .length = SZ_4K,
@@ -122,11 +121,6 @@ static struct map_desc ap_io_desc[] __initdata = {
122 .length = SZ_4K, 121 .length = SZ_4K,
123 .type = MT_DEVICE 122 .type = MT_DEVICE
124 }, { 123 }, {
125 .virtual = IO_ADDRESS(INTEGRATOR_UART1_BASE),
126 .pfn = __phys_to_pfn(INTEGRATOR_UART1_BASE),
127 .length = SZ_4K,
128 .type = MT_DEVICE
129 }, {
130 .virtual = IO_ADDRESS(INTEGRATOR_DBG_BASE), 124 .virtual = IO_ADDRESS(INTEGRATOR_DBG_BASE),
131 .pfn = __phys_to_pfn(INTEGRATOR_DBG_BASE), 125 .pfn = __phys_to_pfn(INTEGRATOR_DBG_BASE),
132 .length = SZ_4K, 126 .length = SZ_4K,
@@ -201,8 +195,6 @@ device_initcall(irq_syscore_init);
201/* 195/*
202 * Flash handling. 196 * Flash handling.
203 */ 197 */
204#define SC_CTRLC (VA_SC_BASE + INTEGRATOR_SC_CTRLC_OFFSET)
205#define SC_CTRLS (VA_SC_BASE + INTEGRATOR_SC_CTRLS_OFFSET)
206#define EBI_CSR1 (VA_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET) 198#define EBI_CSR1 (VA_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET)
207#define EBI_LOCK (VA_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET) 199#define EBI_LOCK (VA_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET)
208 200
@@ -210,7 +202,8 @@ static int ap_flash_init(struct platform_device *dev)
210{ 202{
211 u32 tmp; 203 u32 tmp;
212 204
213 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, SC_CTRLC); 205 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
206 ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
214 207
215 tmp = readl(EBI_CSR1) | INTEGRATOR_EBI_WRITE_ENABLE; 208 tmp = readl(EBI_CSR1) | INTEGRATOR_EBI_WRITE_ENABLE;
216 writel(tmp, EBI_CSR1); 209 writel(tmp, EBI_CSR1);
@@ -227,7 +220,8 @@ static void ap_flash_exit(struct platform_device *dev)
227{ 220{
228 u32 tmp; 221 u32 tmp;
229 222
230 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, SC_CTRLC); 223 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
224 ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
231 225
232 tmp = readl(EBI_CSR1) & ~INTEGRATOR_EBI_WRITE_ENABLE; 226 tmp = readl(EBI_CSR1) & ~INTEGRATOR_EBI_WRITE_ENABLE;
233 writel(tmp, EBI_CSR1); 227 writel(tmp, EBI_CSR1);
@@ -241,9 +235,12 @@ static void ap_flash_exit(struct platform_device *dev)
241 235
242static void ap_flash_set_vpp(struct platform_device *pdev, int on) 236static void ap_flash_set_vpp(struct platform_device *pdev, int on)
243{ 237{
244 void __iomem *reg = on ? SC_CTRLS : SC_CTRLC; 238 if (on)
245 239 writel(INTEGRATOR_SC_CTRL_nFLVPPEN,
246 writel(INTEGRATOR_SC_CTRL_nFLVPPEN, reg); 240 ap_syscon_base + INTEGRATOR_SC_CTRLS_OFFSET);
241 else
242 writel(INTEGRATOR_SC_CTRL_nFLVPPEN,
243 ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
247} 244}
248 245
249static struct physmap_flash_data ap_flash_data = { 246static struct physmap_flash_data ap_flash_data = {
@@ -254,6 +251,45 @@ static struct physmap_flash_data ap_flash_data = {
254}; 251};
255 252
256/* 253/*
254 * For the PL010 found in the Integrator/AP some of the UART control is
255 * implemented in the system controller and accessed using a callback
256 * from the driver.
257 */
258static void integrator_uart_set_mctrl(struct amba_device *dev,
259 void __iomem *base, unsigned int mctrl)
260{
261 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
262 u32 phybase = dev->res.start;
263
264 if (phybase == INTEGRATOR_UART0_BASE) {
265 /* UART0 */
266 rts_mask = 1 << 4;
267 dtr_mask = 1 << 5;
268 } else {
269 /* UART1 */
270 rts_mask = 1 << 6;
271 dtr_mask = 1 << 7;
272 }
273
274 if (mctrl & TIOCM_RTS)
275 ctrlc |= rts_mask;
276 else
277 ctrls |= rts_mask;
278
279 if (mctrl & TIOCM_DTR)
280 ctrlc |= dtr_mask;
281 else
282 ctrls |= dtr_mask;
283
284 __raw_writel(ctrls, ap_syscon_base + INTEGRATOR_SC_CTRLS_OFFSET);
285 __raw_writel(ctrlc, ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
286}
287
288struct amba_pl010_data ap_uart_data = {
289 .set_mctrl = integrator_uart_set_mctrl,
290};
291
292/*
257 * Where is the timer (VA)? 293 * Where is the timer (VA)?
258 */ 294 */
259#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE) 295#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
@@ -450,9 +486,9 @@ static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
450 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE, 486 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE,
451 "rtc", NULL), 487 "rtc", NULL),
452 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE, 488 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE,
453 "uart0", &integrator_uart_data), 489 "uart0", &ap_uart_data),
454 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE, 490 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE,
455 "uart1", &integrator_uart_data), 491 "uart1", &ap_uart_data),
456 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE, 492 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE,
457 "kmi0", NULL), 493 "kmi0", NULL),
458 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE, 494 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE,
@@ -465,12 +501,60 @@ static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
465static void __init ap_init_of(void) 501static void __init ap_init_of(void)
466{ 502{
467 unsigned long sc_dec; 503 unsigned long sc_dec;
504 struct device_node *root;
505 struct device_node *syscon;
506 struct device *parent;
507 struct soc_device *soc_dev;
508 struct soc_device_attribute *soc_dev_attr;
509 u32 ap_sc_id;
510 int err;
468 int i; 511 int i;
469 512
470 of_platform_populate(NULL, of_default_bus_match_table, 513 /* Here we create an SoC device for the root node */
471 ap_auxdata_lookup, NULL); 514 root = of_find_node_by_path("/");
515 if (!root)
516 return;
517 syscon = of_find_node_by_path("/syscon");
518 if (!syscon)
519 return;
520
521 ap_syscon_base = of_iomap(syscon, 0);
522 if (!ap_syscon_base)
523 return;
524
525 ap_sc_id = readl(ap_syscon_base);
526
527 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
528 if (!soc_dev_attr)
529 return;
530
531 err = of_property_read_string(root, "compatible",
532 &soc_dev_attr->soc_id);
533 if (err)
534 return;
535 err = of_property_read_string(root, "model", &soc_dev_attr->machine);
536 if (err)
537 return;
538 soc_dev_attr->family = "Integrator";
539 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
540 'A' + (ap_sc_id & 0x0f));
541
542 soc_dev = soc_device_register(soc_dev_attr);
543 if (IS_ERR_OR_NULL(soc_dev)) {
544 kfree(soc_dev_attr->revision);
545 kfree(soc_dev_attr);
546 return;
547 }
548
549 parent = soc_device_to_device(soc_dev);
550
551 if (!IS_ERR_OR_NULL(parent))
552 integrator_init_sysfs(parent, ap_sc_id);
472 553
473 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET); 554 of_platform_populate(root, of_default_bus_match_table,
555 ap_auxdata_lookup, parent);
556
557 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
474 for (i = 0; i < 4; i++) { 558 for (i = 0; i < 4; i++) {
475 struct lm_device *lmdev; 559 struct lm_device *lmdev;
476 560
@@ -499,7 +583,6 @@ static const char * ap_dt_board_compat[] = {
499DT_MACHINE_START(INTEGRATOR_AP_DT, "ARM Integrator/AP (Device Tree)") 583DT_MACHINE_START(INTEGRATOR_AP_DT, "ARM Integrator/AP (Device Tree)")
500 .reserve = integrator_reserve, 584 .reserve = integrator_reserve,
501 .map_io = ap_map_io, 585 .map_io = ap_map_io,
502 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
503 .init_early = ap_init_early, 586 .init_early = ap_init_early,
504 .init_irq = ap_init_irq_of, 587 .init_irq = ap_init_irq_of,
505 .handle_irq = fpga_handle_irq, 588 .handle_irq = fpga_handle_irq,
@@ -514,6 +597,27 @@ MACHINE_END
514#ifdef CONFIG_ATAGS 597#ifdef CONFIG_ATAGS
515 598
516/* 599/*
600 * For the ATAG boot some static mappings are needed. This will
601 * go away with the ATAG support down the road.
602 */
603
604static struct map_desc ap_io_desc_atag[] __initdata = {
605 {
606 .virtual = IO_ADDRESS(INTEGRATOR_SC_BASE),
607 .pfn = __phys_to_pfn(INTEGRATOR_SC_BASE),
608 .length = SZ_4K,
609 .type = MT_DEVICE
610 },
611};
612
613static void __init ap_map_io_atag(void)
614{
615 iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag));
616 ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
617 ap_map_io();
618}
619
620/*
517 * This is where non-devicetree initialization code is collected and stashed 621 * This is where non-devicetree initialization code is collected and stashed
518 * for eventual deletion. 622 * for eventual deletion.
519 */ 623 */
@@ -581,7 +685,7 @@ static void __init ap_init(void)
581 685
582 platform_device_register(&cfi_flash_device); 686 platform_device_register(&cfi_flash_device);
583 687
584 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET); 688 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
585 for (i = 0; i < 4; i++) { 689 for (i = 0; i < 4; i++) {
586 struct lm_device *lmdev; 690 struct lm_device *lmdev;
587 691
@@ -608,8 +712,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
608 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 712 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
609 .atag_offset = 0x100, 713 .atag_offset = 0x100,
610 .reserve = integrator_reserve, 714 .reserve = integrator_reserve,
611 .map_io = ap_map_io, 715 .map_io = ap_map_io_atag,
612 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
613 .init_early = ap_init_early, 716 .init_early = ap_init_early,
614 .init_irq = ap_init_irq, 717 .init_irq = ap_init_irq,
615 .handle_irq = fpga_handle_irq, 718 .handle_irq = fpga_handle_irq,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 5b08e8e4cc8..7322838c044 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -20,12 +20,14 @@
20#include <linux/amba/clcd.h> 20#include <linux/amba/clcd.h>
21#include <linux/amba/mmci.h> 21#include <linux/amba/mmci.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irqchip/versatile-fpga.h>
23#include <linux/gfp.h> 24#include <linux/gfp.h>
24#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
25#include <linux/platform_data/clk-integrator.h> 26#include <linux/platform_data/clk-integrator.h>
26#include <linux/of_irq.h> 27#include <linux/of_irq.h>
27#include <linux/of_address.h> 28#include <linux/of_address.h>
28#include <linux/of_platform.h> 29#include <linux/of_platform.h>
30#include <linux/sys_soc.h>
29 31
30#include <mach/hardware.h> 32#include <mach/hardware.h>
31#include <mach/platform.h> 33#include <mach/platform.h>
@@ -46,16 +48,17 @@
46#include <asm/hardware/timer-sp.h> 48#include <asm/hardware/timer-sp.h>
47 49
48#include <plat/clcd.h> 50#include <plat/clcd.h>
49#include <plat/fpga-irq.h>
50#include <plat/sched_clock.h> 51#include <plat/sched_clock.h>
51 52
52#include "common.h" 53#include "common.h"
53 54
55/* Base address to the CP controller */
56static void __iomem *intcp_con_base;
57
54#define INTCP_PA_FLASH_BASE 0x24000000 58#define INTCP_PA_FLASH_BASE 0x24000000
55 59
56#define INTCP_PA_CLCD_BASE 0xc0000000 60#define INTCP_PA_CLCD_BASE 0xc0000000
57 61
58#define INTCP_VA_CTRL_BASE __io_address(INTEGRATOR_CP_CTL_BASE)
59#define INTCP_FLASHPROG 0x04 62#define INTCP_FLASHPROG 0x04
60#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0) 63#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
61#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1) 64#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1)
@@ -82,11 +85,6 @@ static struct map_desc intcp_io_desc[] __initdata = {
82 .length = SZ_4K, 85 .length = SZ_4K,
83 .type = MT_DEVICE 86 .type = MT_DEVICE
84 }, { 87 }, {
85 .virtual = IO_ADDRESS(INTEGRATOR_SC_BASE),
86 .pfn = __phys_to_pfn(INTEGRATOR_SC_BASE),
87 .length = SZ_4K,
88 .type = MT_DEVICE
89 }, {
90 .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE), 88 .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE),
91 .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE), 89 .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE),
92 .length = SZ_4K, 90 .length = SZ_4K,
@@ -107,11 +105,6 @@ static struct map_desc intcp_io_desc[] __initdata = {
107 .length = SZ_4K, 105 .length = SZ_4K,
108 .type = MT_DEVICE 106 .type = MT_DEVICE
109 }, { 107 }, {
110 .virtual = IO_ADDRESS(INTEGRATOR_UART1_BASE),
111 .pfn = __phys_to_pfn(INTEGRATOR_UART1_BASE),
112 .length = SZ_4K,
113 .type = MT_DEVICE
114 }, {
115 .virtual = IO_ADDRESS(INTEGRATOR_DBG_BASE), 108 .virtual = IO_ADDRESS(INTEGRATOR_DBG_BASE),
116 .pfn = __phys_to_pfn(INTEGRATOR_DBG_BASE), 109 .pfn = __phys_to_pfn(INTEGRATOR_DBG_BASE),
117 .length = SZ_4K, 110 .length = SZ_4K,
@@ -126,11 +119,6 @@ static struct map_desc intcp_io_desc[] __initdata = {
126 .pfn = __phys_to_pfn(INTEGRATOR_CP_SIC_BASE), 119 .pfn = __phys_to_pfn(INTEGRATOR_CP_SIC_BASE),
127 .length = SZ_4K, 120 .length = SZ_4K,
128 .type = MT_DEVICE 121 .type = MT_DEVICE
129 }, {
130 .virtual = IO_ADDRESS(INTEGRATOR_CP_CTL_BASE),
131 .pfn = __phys_to_pfn(INTEGRATOR_CP_CTL_BASE),
132 .length = SZ_4K,
133 .type = MT_DEVICE
134 } 122 }
135}; 123};
136 124
@@ -146,9 +134,9 @@ static int intcp_flash_init(struct platform_device *dev)
146{ 134{
147 u32 val; 135 u32 val;
148 136
149 val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); 137 val = readl(intcp_con_base + INTCP_FLASHPROG);
150 val |= CINTEGRATOR_FLASHPROG_FLWREN; 138 val |= CINTEGRATOR_FLASHPROG_FLWREN;
151 writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); 139 writel(val, intcp_con_base + INTCP_FLASHPROG);
152 140
153 return 0; 141 return 0;
154} 142}
@@ -157,21 +145,21 @@ static void intcp_flash_exit(struct platform_device *dev)
157{ 145{
158 u32 val; 146 u32 val;
159 147
160 val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); 148 val = readl(intcp_con_base + INTCP_FLASHPROG);
161 val &= ~(CINTEGRATOR_FLASHPROG_FLVPPEN|CINTEGRATOR_FLASHPROG_FLWREN); 149 val &= ~(CINTEGRATOR_FLASHPROG_FLVPPEN|CINTEGRATOR_FLASHPROG_FLWREN);
162 writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); 150 writel(val, intcp_con_base + INTCP_FLASHPROG);
163} 151}
164 152
165static void intcp_flash_set_vpp(struct platform_device *pdev, int on) 153static void intcp_flash_set_vpp(struct platform_device *pdev, int on)
166{ 154{
167 u32 val; 155 u32 val;
168 156
169 val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); 157 val = readl(intcp_con_base + INTCP_FLASHPROG);
170 if (on) 158 if (on)
171 val |= CINTEGRATOR_FLASHPROG_FLVPPEN; 159 val |= CINTEGRATOR_FLASHPROG_FLVPPEN;
172 else 160 else
173 val &= ~CINTEGRATOR_FLASHPROG_FLVPPEN; 161 val &= ~CINTEGRATOR_FLASHPROG_FLVPPEN;
174 writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); 162 writel(val, intcp_con_base + INTCP_FLASHPROG);
175} 163}
176 164
177static struct physmap_flash_data intcp_flash_data = { 165static struct physmap_flash_data intcp_flash_data = {
@@ -190,7 +178,7 @@ static struct physmap_flash_data intcp_flash_data = {
190static unsigned int mmc_status(struct device *dev) 178static unsigned int mmc_status(struct device *dev)
191{ 179{
192 unsigned int status = readl(__io_address(0xca000000 + 4)); 180 unsigned int status = readl(__io_address(0xca000000 + 4));
193 writel(8, __io_address(INTEGRATOR_CP_CTL_BASE + 8)); 181 writel(8, intcp_con_base + 8);
194 182
195 return status & 8; 183 return status & 8;
196} 184}
@@ -318,9 +306,9 @@ static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
318 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE, 306 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE,
319 "rtc", NULL), 307 "rtc", NULL),
320 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE, 308 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE,
321 "uart0", &integrator_uart_data), 309 "uart0", NULL),
322 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE, 310 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE,
323 "uart1", &integrator_uart_data), 311 "uart1", NULL),
324 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE, 312 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE,
325 "kmi0", NULL), 313 "kmi0", NULL),
326 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE, 314 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE,
@@ -338,8 +326,57 @@ static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
338 326
339static void __init intcp_init_of(void) 327static void __init intcp_init_of(void)
340{ 328{
341 of_platform_populate(NULL, of_default_bus_match_table, 329 struct device_node *root;
342 intcp_auxdata_lookup, NULL); 330 struct device_node *cpcon;
331 struct device *parent;
332 struct soc_device *soc_dev;
333 struct soc_device_attribute *soc_dev_attr;
334 u32 intcp_sc_id;
335 int err;
336
337 /* Here we create an SoC device for the root node */
338 root = of_find_node_by_path("/");
339 if (!root)
340 return;
341 cpcon = of_find_node_by_path("/cpcon");
342 if (!cpcon)
343 return;
344
345 intcp_con_base = of_iomap(cpcon, 0);
346 if (!intcp_con_base)
347 return;
348
349 intcp_sc_id = readl(intcp_con_base);
350
351 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
352 if (!soc_dev_attr)
353 return;
354
355 err = of_property_read_string(root, "compatible",
356 &soc_dev_attr->soc_id);
357 if (err)
358 return;
359 err = of_property_read_string(root, "model", &soc_dev_attr->machine);
360 if (err)
361 return;
362 soc_dev_attr->family = "Integrator";
363 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
364 'A' + (intcp_sc_id & 0x0f));
365
366 soc_dev = soc_device_register(soc_dev_attr);
367 if (IS_ERR_OR_NULL(soc_dev)) {
368 kfree(soc_dev_attr->revision);
369 kfree(soc_dev_attr);
370 return;
371 }
372
373 parent = soc_device_to_device(soc_dev);
374
375 if (!IS_ERR_OR_NULL(parent))
376 integrator_init_sysfs(parent, intcp_sc_id);
377
378 of_platform_populate(root, of_default_bus_match_table,
379 intcp_auxdata_lookup, parent);
343} 380}
344 381
345static const char * intcp_dt_board_compat[] = { 382static const char * intcp_dt_board_compat[] = {
@@ -350,7 +387,6 @@ static const char * intcp_dt_board_compat[] = {
350DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)") 387DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)")
351 .reserve = integrator_reserve, 388 .reserve = integrator_reserve,
352 .map_io = intcp_map_io, 389 .map_io = intcp_map_io,
353 .nr_irqs = NR_IRQS_INTEGRATOR_CP,
354 .init_early = intcp_init_early, 390 .init_early = intcp_init_early,
355 .init_irq = intcp_init_irq_of, 391 .init_irq = intcp_init_irq_of,
356 .handle_irq = fpga_handle_irq, 392 .handle_irq = fpga_handle_irq,
@@ -365,6 +401,28 @@ MACHINE_END
365#ifdef CONFIG_ATAGS 401#ifdef CONFIG_ATAGS
366 402
367/* 403/*
404 * For the ATAG boot some static mappings are needed. This will
405 * go away with the ATAG support down the road.
406 */
407
408static struct map_desc intcp_io_desc_atag[] __initdata = {
409 {
410 .virtual = IO_ADDRESS(INTEGRATOR_CP_CTL_BASE),
411 .pfn = __phys_to_pfn(INTEGRATOR_CP_CTL_BASE),
412 .length = SZ_4K,
413 .type = MT_DEVICE
414 },
415};
416
417static void __init intcp_map_io_atag(void)
418{
419 iotable_init(intcp_io_desc_atag, ARRAY_SIZE(intcp_io_desc_atag));
420 intcp_con_base = __io_address(INTEGRATOR_CP_CTL_BASE);
421 intcp_map_io();
422}
423
424
425/*
368 * This is where non-devicetree initialization code is collected and stashed 426 * This is where non-devicetree initialization code is collected and stashed
369 * for eventual deletion. 427 * for eventual deletion.
370 */ 428 */
@@ -423,7 +481,7 @@ static void __init intcp_init_irq(void)
423 u32 pic_mask, cic_mask, sic_mask; 481 u32 pic_mask, cic_mask, sic_mask;
424 482
425 /* These masks are for the HW IRQ registers */ 483 /* These masks are for the HW IRQ registers */
426 pic_mask = ~((~0u) << (11 - IRQ_PIC_START)); 484 pic_mask = ~((~0u) << (11 - 0));
427 pic_mask |= (~((~0u) << (29 - 22))) << 22; 485 pic_mask |= (~((~0u) << (29 - 22))) << 22;
428 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START)); 486 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START));
429 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START)); 487 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
@@ -503,8 +561,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
503 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 561 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
504 .atag_offset = 0x100, 562 .atag_offset = 0x100,
505 .reserve = integrator_reserve, 563 .reserve = integrator_reserve,
506 .map_io = intcp_map_io, 564 .map_io = intcp_map_io_atag,
507 .nr_irqs = NR_IRQS_INTEGRATOR_CP,
508 .init_early = intcp_init_early, 565 .init_early = intcp_init_early,
509 .init_irq = intcp_init_irq, 566 .init_irq = intcp_init_irq,
510 .handle_irq = fpga_handle_irq, 567 .handle_irq = fpga_handle_irq,
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index bbeca59df66..be50e795536 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -191,12 +191,9 @@ static void __iomem *v3_open_config_window(struct pci_bus *bus,
191 /* 191 /*
192 * Trap out illegal values 192 * Trap out illegal values
193 */ 193 */
194 if (offset > 255) 194 BUG_ON(offset > 255);
195 BUG(); 195 BUG_ON(busnr > 255);
196 if (busnr > 255) 196 BUG_ON(devfn > 255);
197 BUG();
198 if (devfn > 255)
199 BUG();
200 197
201 if (busnr == 0) { 198 if (busnr == 0) {
202 int slot = PCI_SLOT(devfn); 199 int slot = PCI_SLOT(devfn);
@@ -388,9 +385,10 @@ static int __init pci_v3_setup_resources(struct pci_sys_data *sys)
388 * means I can't get additional information on the reason for the pm2fb 385 * means I can't get additional information on the reason for the pm2fb
389 * problems. I suppose I'll just have to mind-meld with the machine. ;) 386 * problems. I suppose I'll just have to mind-meld with the machine. ;)
390 */ 387 */
391#define SC_PCI __io_address(INTEGRATOR_SC_PCIENABLE) 388static void __iomem *ap_syscon_base;
392#define SC_LBFADDR __io_address(INTEGRATOR_SC_BASE + 0x20) 389#define INTEGRATOR_SC_PCIENABLE_OFFSET 0x18
393#define SC_LBFCODE __io_address(INTEGRATOR_SC_BASE + 0x24) 390#define INTEGRATOR_SC_LBFADDR_OFFSET 0x20
391#define INTEGRATOR_SC_LBFCODE_OFFSET 0x24
394 392
395static int 393static int
396v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) 394v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
@@ -401,13 +399,13 @@ v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
401 char buf[128]; 399 char buf[128];
402 400
403 sprintf(buf, "V3 fault: addr 0x%08lx, FSR 0x%03x, PC 0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x ISTAT=%02x\n", 401 sprintf(buf, "V3 fault: addr 0x%08lx, FSR 0x%03x, PC 0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x ISTAT=%02x\n",
404 addr, fsr, pc, instr, __raw_readl(SC_LBFADDR), __raw_readl(SC_LBFCODE) & 255, 402 addr, fsr, pc, instr, __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFADDR_OFFSET), __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFCODE_OFFSET) & 255,
405 v3_readb(V3_LB_ISTAT)); 403 v3_readb(V3_LB_ISTAT));
406 printk(KERN_DEBUG "%s", buf); 404 printk(KERN_DEBUG "%s", buf);
407#endif 405#endif
408 406
409 v3_writeb(V3_LB_ISTAT, 0); 407 v3_writeb(V3_LB_ISTAT, 0);
410 __raw_writel(3, SC_PCI); 408 __raw_writel(3, ap_syscon_base + INTEGRATOR_SC_PCIENABLE_OFFSET);
411 409
412 /* 410 /*
413 * If the instruction being executed was a read, 411 * If the instruction being executed was a read,
@@ -449,15 +447,15 @@ static irqreturn_t v3_irq(int dummy, void *devid)
449 447
450 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x " 448 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x "
451 "ISTAT=%02x\n", IRQ_AP_V3INT, pc, instr, 449 "ISTAT=%02x\n", IRQ_AP_V3INT, pc, instr,
452 __raw_readl(SC_LBFADDR), 450 __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFADDR_OFFSET),
453 __raw_readl(SC_LBFCODE) & 255, 451 __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFCODE_OFFSET) & 255,
454 v3_readb(V3_LB_ISTAT)); 452 v3_readb(V3_LB_ISTAT));
455 printascii(buf); 453 printascii(buf);
456#endif 454#endif
457 455
458 v3_writew(V3_PCI_STAT, 0xf000); 456 v3_writew(V3_PCI_STAT, 0xf000);
459 v3_writeb(V3_LB_ISTAT, 0); 457 v3_writeb(V3_LB_ISTAT, 0);
460 __raw_writel(3, SC_PCI); 458 __raw_writel(3, ap_syscon_base + INTEGRATOR_SC_PCIENABLE_OFFSET);
461 459
462#ifdef CONFIG_DEBUG_LL 460#ifdef CONFIG_DEBUG_LL
463 /* 461 /*
@@ -480,6 +478,10 @@ int __init pci_v3_setup(int nr, struct pci_sys_data *sys)
480 if (nr == 0) { 478 if (nr == 0) {
481 sys->mem_offset = PHYS_PCI_MEM_BASE; 479 sys->mem_offset = PHYS_PCI_MEM_BASE;
482 ret = pci_v3_setup_resources(sys); 480 ret = pci_v3_setup_resources(sys);
481 /* Remap the Integrator system controller */
482 ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100);
483 if (!ap_syscon_base)
484 return -EINVAL;
483 } 485 }
484 486
485 return ret; 487 return ret;
@@ -568,7 +570,7 @@ void __init pci_v3_preinit(void)
568 v3_writeb(V3_LB_ISTAT, 0); 570 v3_writeb(V3_LB_ISTAT, 0);
569 v3_writew(V3_LB_CFG, v3_readw(V3_LB_CFG) | (1 << 10)); 571 v3_writew(V3_LB_CFG, v3_readw(V3_LB_CFG) | (1 << 10));
570 v3_writeb(V3_LB_IMASK, 0x28); 572 v3_writeb(V3_LB_IMASK, 0x28);
571 __raw_writel(3, SC_PCI); 573 __raw_writel(3, ap_syscon_base + INTEGRATOR_SC_PCIENABLE_OFFSET);
572 574
573 /* 575 /*
574 * Grab the PCI error interrupt. 576 * Grab the PCI error interrupt.
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 1694f01ce2b..6d6bde3e15f 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -410,6 +410,7 @@ void __init ixp4xx_pci_preinit(void)
410 * Enable the IO window to be way up high, at 0xfffffc00 410 * Enable the IO window to be way up high, at 0xfffffc00
411 */ 411 */
412 local_write_config(PCI_BASE_ADDRESS_5, 4, 0xfffffc01); 412 local_write_config(PCI_BASE_ADDRESS_5, 4, 0xfffffc01);
413 local_write_config(0x40, 4, 0x000080FF); /* No TRDY time limit */
413 } else { 414 } else {
414 printk("PCI: IXP4xx is target - No bus scan performed\n"); 415 printk("PCI: IXP4xx is target - No bus scan performed\n");
415 } 416 }
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index fdf91a16088..8c0c0e2d072 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -67,15 +67,12 @@ static struct map_desc ixp4xx_io_desc[] __initdata = {
67 .pfn = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS), 67 .pfn = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS),
68 .length = IXP4XX_PCI_CFG_REGION_SIZE, 68 .length = IXP4XX_PCI_CFG_REGION_SIZE,
69 .type = MT_DEVICE 69 .type = MT_DEVICE
70 }, 70 }, { /* Queue Manager */
71#ifdef CONFIG_DEBUG_LL 71 .virtual = (unsigned long)IXP4XX_QMGR_BASE_VIRT,
72 { /* Debug UART mapping */ 72 .pfn = __phys_to_pfn(IXP4XX_QMGR_BASE_PHYS),
73 .virtual = (unsigned long)IXP4XX_DEBUG_UART_BASE_VIRT, 73 .length = IXP4XX_QMGR_REGION_SIZE,
74 .pfn = __phys_to_pfn(IXP4XX_DEBUG_UART_BASE_PHYS),
75 .length = IXP4XX_DEBUG_UART_REGION_SIZE,
76 .type = MT_DEVICE 74 .type = MT_DEVICE
77 } 75 },
78#endif
79}; 76};
80 77
81void __init ixp4xx_map_io(void) 78void __init ixp4xx_map_io(void)
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index b800a031207..53b8348dfcc 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -15,6 +15,7 @@
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/mach/flash.h> 16#include <asm/mach/flash.h>
17#include <asm/mach/pci.h> 17#include <asm/mach/pci.h>
18#include <asm/system_info.h>
18 19
19#define SLOT_ETHA 0x0B /* IDSEL = AD21 */ 20#define SLOT_ETHA 0x0B /* IDSEL = AD21 */
20#define SLOT_ETHB 0x0C /* IDSEL = AD20 */ 21#define SLOT_ETHB 0x0C /* IDSEL = AD20 */
@@ -329,7 +330,7 @@ static struct platform_device device_hss_tab[] = {
329}; 330};
330 331
331 332
332static struct platform_device *device_tab[6] __initdata = { 333static struct platform_device *device_tab[7] __initdata = {
333 &device_flash, /* index 0 */ 334 &device_flash, /* index 0 */
334}; 335};
335 336
diff --git a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
index 8c9f8d56449..ff686cbc5df 100644
--- a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
@@ -17,8 +17,8 @@
17#else 17#else
18 mov \rp, #0 18 mov \rp, #0
19#endif 19#endif
20 orr \rv, \rp, #0xff000000 @ virtual 20 orr \rv, \rp, #0xfe000000 @ virtual
21 orr \rv, \rv, #0x00b00000 21 orr \rv, \rv, #0x00f00000
22 orr \rp, \rp, #0xc8000000 @ physical 22 orr \rp, \rp, #0xc8000000 @ physical
23 .endm 23 .endm
24 24
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
index eb68b61ce97..c5bae9c035d 100644
--- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
+++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
@@ -30,51 +30,43 @@
30 * 30 *
31 * 0x50000000 0x10000000 ioremap'd EXP BUS 31 * 0x50000000 0x10000000 ioremap'd EXP BUS
32 * 32 *
33 * 0x6000000 0x00004000 ioremap'd QMgr 33 * 0xC8000000 0x00013000 0xFEF00000 On-Chip Peripherals
34 * 34 *
35 * 0xC0000000 0x00001000 0xffbff000 PCI CFG 35 * 0xC0000000 0x00001000 0xFEF13000 PCI CFG
36 * 36 *
37 * 0xC4000000 0x00001000 0xffbfe000 EXP CFG 37 * 0xC4000000 0x00001000 0xFEF14000 EXP CFG
38 * 38 *
39 * 0xC8000000 0x00013000 0xffbeb000 On-Chip Peripherals 39 * 0x60000000 0x00004000 0xFEF15000 QMgr
40 */ 40 */
41 41
42/* 42/*
43 * Queue Manager 43 * Queue Manager
44 */ 44 */
45#define IXP4XX_QMGR_BASE_PHYS (0x60000000) 45#define IXP4XX_QMGR_BASE_PHYS 0x60000000
46#define IXP4XX_QMGR_REGION_SIZE (0x00004000) 46#define IXP4XX_QMGR_BASE_VIRT IOMEM(0xFEF15000)
47#define IXP4XX_QMGR_REGION_SIZE 0x00004000
47 48
48/* 49/*
49 * Expansion BUS Configuration registers 50 * Peripheral space, including debug UART. Must be section-aligned so that
51 * it can be used with the low-level debug code.
50 */ 52 */
51#define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000) 53#define IXP4XX_PERIPHERAL_BASE_PHYS 0xC8000000
52#define IXP4XX_EXP_CFG_BASE_VIRT IOMEM(0xFFBFE000) 54#define IXP4XX_PERIPHERAL_BASE_VIRT IOMEM(0xFEF00000)
53#define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000) 55#define IXP4XX_PERIPHERAL_REGION_SIZE 0x00013000
54 56
55/* 57/*
56 * PCI Config registers 58 * PCI Config registers
57 */ 59 */
58#define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000) 60#define IXP4XX_PCI_CFG_BASE_PHYS 0xC0000000
59#define IXP4XX_PCI_CFG_BASE_VIRT IOMEM(0xFFBFF000) 61#define IXP4XX_PCI_CFG_BASE_VIRT IOMEM(0xFEF13000)
60#define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000) 62#define IXP4XX_PCI_CFG_REGION_SIZE 0x00001000
61
62/*
63 * Peripheral space
64 */
65#define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000)
66#define IXP4XX_PERIPHERAL_BASE_VIRT IOMEM(0xFFBEB000)
67#define IXP4XX_PERIPHERAL_REGION_SIZE (0x00013000)
68 63
69/* 64/*
70 * Debug UART 65 * Expansion BUS Configuration registers
71 *
72 * This is basically a remap of UART1 into a region that is section
73 * aligned so that it * can be used with the low-level debug code.
74 */ 66 */
75#define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000) 67#define IXP4XX_EXP_CFG_BASE_PHYS 0xC4000000
76#define IXP4XX_DEBUG_UART_BASE_VIRT IOMEM(0xffb00000) 68#define IXP4XX_EXP_CFG_BASE_VIRT 0xFEF14000
77#define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000) 69#define IXP4XX_EXP_CFG_REGION_SIZE 0x00001000
78 70
79#define IXP4XX_EXP_CS0_OFFSET 0x00 71#define IXP4XX_EXP_CS0_OFFSET 0x00
80#define IXP4XX_EXP_CS1_OFFSET 0x04 72#define IXP4XX_EXP_CS1_OFFSET 0x04
diff --git a/arch/arm/mach-ixp4xx/include/mach/qmgr.h b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
index 9e7cad2d54c..4de8da536db 100644
--- a/arch/arm/mach-ixp4xx/include/mach/qmgr.h
+++ b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
@@ -86,7 +86,7 @@ void qmgr_release_queue(unsigned int queue);
86 86
87static inline void qmgr_put_entry(unsigned int queue, u32 val) 87static inline void qmgr_put_entry(unsigned int queue, u32 val)
88{ 88{
89 extern struct qmgr_regs __iomem *qmgr_regs; 89 struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
90#if DEBUG_QMGR 90#if DEBUG_QMGR
91 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 91 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
92 92
@@ -99,7 +99,7 @@ static inline void qmgr_put_entry(unsigned int queue, u32 val)
99static inline u32 qmgr_get_entry(unsigned int queue) 99static inline u32 qmgr_get_entry(unsigned int queue)
100{ 100{
101 u32 val; 101 u32 val;
102 extern struct qmgr_regs __iomem *qmgr_regs; 102 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
103 val = __raw_readl(&qmgr_regs->acc[queue][0]); 103 val = __raw_readl(&qmgr_regs->acc[queue][0]);
104#if DEBUG_QMGR 104#if DEBUG_QMGR
105 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 105 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
@@ -112,14 +112,14 @@ static inline u32 qmgr_get_entry(unsigned int queue)
112 112
113static inline int __qmgr_get_stat1(unsigned int queue) 113static inline int __qmgr_get_stat1(unsigned int queue)
114{ 114{
115 extern struct qmgr_regs __iomem *qmgr_regs; 115 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
116 return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) 116 return (__raw_readl(&qmgr_regs->stat1[queue >> 3])
117 >> ((queue & 7) << 2)) & 0xF; 117 >> ((queue & 7) << 2)) & 0xF;
118} 118}
119 119
120static inline int __qmgr_get_stat2(unsigned int queue) 120static inline int __qmgr_get_stat2(unsigned int queue)
121{ 121{
122 extern struct qmgr_regs __iomem *qmgr_regs; 122 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
123 BUG_ON(queue >= HALF_QUEUES); 123 BUG_ON(queue >= HALF_QUEUES);
124 return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) 124 return (__raw_readl(&qmgr_regs->stat2[queue >> 4])
125 >> ((queue & 0xF) << 1)) & 0x3; 125 >> ((queue & 0xF) << 1)) & 0x3;
@@ -145,7 +145,7 @@ static inline int qmgr_stat_empty(unsigned int queue)
145 */ 145 */
146static inline int qmgr_stat_below_low_watermark(unsigned int queue) 146static inline int qmgr_stat_below_low_watermark(unsigned int queue)
147{ 147{
148 extern struct qmgr_regs __iomem *qmgr_regs; 148 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
149 if (queue >= HALF_QUEUES) 149 if (queue >= HALF_QUEUES)
150 return (__raw_readl(&qmgr_regs->statne_h) >> 150 return (__raw_readl(&qmgr_regs->statne_h) >>
151 (queue - HALF_QUEUES)) & 0x01; 151 (queue - HALF_QUEUES)) & 0x01;
@@ -172,7 +172,7 @@ static inline int qmgr_stat_above_high_watermark(unsigned int queue)
172 */ 172 */
173static inline int qmgr_stat_full(unsigned int queue) 173static inline int qmgr_stat_full(unsigned int queue)
174{ 174{
175 extern struct qmgr_regs __iomem *qmgr_regs; 175 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
176 if (queue >= HALF_QUEUES) 176 if (queue >= HALF_QUEUES)
177 return (__raw_readl(&qmgr_regs->statf_h) >> 177 return (__raw_readl(&qmgr_regs->statf_h) >>
178 (queue - HALF_QUEUES)) & 0x01; 178 (queue - HALF_QUEUES)) & 0x01;
diff --git a/arch/arm/mach-ixp4xx/include/mach/udc.h b/arch/arm/mach-ixp4xx/include/mach/udc.h
index 80d6da2eafa..7bd8b96c884 100644
--- a/arch/arm/mach-ixp4xx/include/mach/udc.h
+++ b/arch/arm/mach-ixp4xx/include/mach/udc.h
@@ -2,7 +2,7 @@
2 * arch/arm/mach-ixp4xx/include/mach/udc.h 2 * arch/arm/mach-ixp4xx/include/mach/udc.h
3 * 3 *
4 */ 4 */
5#include <asm/mach/udc_pxa2xx.h> 5#include <linux/platform_data/pxa2xx_udc.h>
6 6
7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info); 7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info);
8 8
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
index a17ed79207a..d4eb09a6286 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
@@ -116,7 +116,11 @@
116/* NPE mailbox_status value for reset */ 116/* NPE mailbox_status value for reset */
117#define RESET_MBOX_STAT 0x0000F0F0 117#define RESET_MBOX_STAT 0x0000F0F0
118 118
119const char *npe_names[] = { "NPE-A", "NPE-B", "NPE-C" }; 119#define NPE_A_FIRMWARE "NPE-A"
120#define NPE_B_FIRMWARE "NPE-B"
121#define NPE_C_FIRMWARE "NPE-C"
122
123const char *npe_names[] = { NPE_A_FIRMWARE, NPE_B_FIRMWARE, NPE_C_FIRMWARE };
120 124
121#define print_npe(pri, npe, fmt, ...) \ 125#define print_npe(pri, npe, fmt, ...) \
122 printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__) 126 printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__)
@@ -724,6 +728,9 @@ module_exit(npe_cleanup_module);
724 728
725MODULE_AUTHOR("Krzysztof Halasa"); 729MODULE_AUTHOR("Krzysztof Halasa");
726MODULE_LICENSE("GPL v2"); 730MODULE_LICENSE("GPL v2");
731MODULE_FIRMWARE(NPE_A_FIRMWARE);
732MODULE_FIRMWARE(NPE_B_FIRMWARE);
733MODULE_FIRMWARE(NPE_C_FIRMWARE);
727 734
728EXPORT_SYMBOL(npe_names); 735EXPORT_SYMBOL(npe_names);
729EXPORT_SYMBOL(npe_running); 736EXPORT_SYMBOL(npe_running);
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
index 852f7c9f87d..9d1b6b7c394 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
@@ -14,7 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <mach/qmgr.h> 15#include <mach/qmgr.h>
16 16
17struct qmgr_regs __iomem *qmgr_regs; 17static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
18static struct resource *mem_res; 18static struct resource *mem_res;
19static spinlock_t qmgr_lock; 19static spinlock_t qmgr_lock;
20static u32 used_sram_bitmap[4]; /* 128 16-dword pages */ 20static u32 used_sram_bitmap[4]; /* 128 16-dword pages */
@@ -293,12 +293,6 @@ static int qmgr_init(void)
293 if (mem_res == NULL) 293 if (mem_res == NULL)
294 return -EBUSY; 294 return -EBUSY;
295 295
296 qmgr_regs = ioremap(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
297 if (qmgr_regs == NULL) {
298 err = -ENOMEM;
299 goto error_map;
300 }
301
302 /* reset qmgr registers */ 296 /* reset qmgr registers */
303 for (i = 0; i < 4; i++) { 297 for (i = 0; i < 4; i++) {
304 __raw_writel(0x33333333, &qmgr_regs->stat1[i]); 298 __raw_writel(0x33333333, &qmgr_regs->stat1[i]);
@@ -347,8 +341,6 @@ static int qmgr_init(void)
347error_irq2: 341error_irq2:
348 free_irq(IRQ_IXP4XX_QM1, NULL); 342 free_irq(IRQ_IXP4XX_QM1, NULL);
349error_irq: 343error_irq:
350 iounmap(qmgr_regs);
351error_map:
352 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); 344 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
353 return err; 345 return err;
354} 346}
@@ -359,7 +351,6 @@ static void qmgr_remove(void)
359 free_irq(IRQ_IXP4XX_QM2, NULL); 351 free_irq(IRQ_IXP4XX_QM2, NULL);
360 synchronize_irq(IRQ_IXP4XX_QM1); 352 synchronize_irq(IRQ_IXP4XX_QM1);
361 synchronize_irq(IRQ_IXP4XX_QM2); 353 synchronize_irq(IRQ_IXP4XX_QM2);
362 iounmap(qmgr_regs);
363 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); 354 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
364} 355}
365 356
@@ -369,7 +360,6 @@ module_exit(qmgr_remove);
369MODULE_LICENSE("GPL v2"); 360MODULE_LICENSE("GPL v2");
370MODULE_AUTHOR("Krzysztof Halasa"); 361MODULE_AUTHOR("Krzysztof Halasa");
371 362
372EXPORT_SYMBOL(qmgr_regs);
373EXPORT_SYMBOL(qmgr_set_irq); 363EXPORT_SYMBOL(qmgr_set_irq);
374EXPORT_SYMBOL(qmgr_enable_irq); 364EXPORT_SYMBOL(qmgr_enable_irq);
375EXPORT_SYMBOL(qmgr_disable_irq); 365EXPORT_SYMBOL(qmgr_disable_irq);
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 50bca5032b7..503d7dd944f 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -46,6 +46,11 @@ config MACH_GURUPLUG
46 46
47config ARCH_KIRKWOOD_DT 47config ARCH_KIRKWOOD_DT
48 bool "Marvell Kirkwood Flattened Device Tree" 48 bool "Marvell Kirkwood Flattened Device Tree"
49 select POWER_SUPPLY
50 select POWER_RESET
51 select POWER_RESET_GPIO
52 select REGULATOR
53 select REGULATOR_FIXED_VOLTAGE
49 select USE_OF 54 select USE_OF
50 help 55 help
51 Say 'Y' here if you want your kernel to support the 56 Say 'Y' here if you want your kernel to support the
@@ -130,6 +135,63 @@ config MACH_KM_KIRKWOOD_DT
130 Say 'Y' here if you want your kernel to support the 135 Say 'Y' here if you want your kernel to support the
131 Keymile Kirkwood Reference Desgin, using Flattened Device Tree. 136 Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
132 137
138config MACH_INETSPACE_V2_DT
139 bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
140 select ARCH_KIRKWOOD_DT
141 help
142 Say 'Y' here if you want your kernel to support the LaCie
143 Internet Space v2 NAS, using Flattened Device Tree.
144
145config MACH_MPLCEC4_DT
146 bool "MPL CEC4 (Flattened Device Tree)"
147 select ARCH_KIRKWOOD_DT
148 help
149 Say 'Y' here if you want your kernel to support the
150 MPL CEC4 (Flattened Device Tree).
151
152config MACH_NETSPACE_V2_DT
153 bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
154 select ARCH_KIRKWOOD_DT
155 help
156 Say 'Y' here if you want your kernel to support the LaCie
157 Network Space v2 NAS, using Flattened Device Tree.
158
159config MACH_NETSPACE_MAX_V2_DT
160 bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
161 select ARCH_KIRKWOOD_DT
162 help
163 Say 'Y' here if you want your kernel to support the LaCie
164 Network Space Max v2 NAS, using Flattened Device Tree.
165
166config MACH_NETSPACE_LITE_V2_DT
167 bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
168 select ARCH_KIRKWOOD_DT
169 help
170 Say 'Y' here if you want your kernel to support the LaCie
171 Network Space Lite v2 NAS, using Flattened Device Tree.
172
173config MACH_NETSPACE_MINI_V2_DT
174 bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)"
175 select ARCH_KIRKWOOD_DT
176 help
177 Say 'Y' here if you want your kernel to support the LaCie
178 Network Space Mini v2 NAS (aka SafeBox), using Flattened
179 Device Tree.
180
181config MACH_OPENBLOCKS_A6_DT
182 bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)"
183 select ARCH_KIRKWOOD_DT
184 help
185 Say 'Y' here if you want your kernel to support the
186 Plat'Home OpenBlocks A6 (Flattened Device Tree).
187
188config MACH_TOPKICK_DT
189 bool "USI Topkick (Flattened Device Tree)"
190 select ARCH_KIRKWOOD_DT
191 help
192 Say 'Y' here if you want your kernel to support the
193 USI Topkick, using Flattened Device Tree
194
133config MACH_TS219 195config MACH_TS219
134 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 196 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
135 help 197 help
@@ -216,6 +278,14 @@ config MACH_T5325
216 Say 'Y' here if you want your kernel to support the 278 Say 'Y' here if you want your kernel to support the
217 HP t5325 Thin Client. 279 HP t5325 Thin Client.
218 280
281config MACH_NSA310_DT
282 bool "ZyXEL NSA-310 (Flattened Device Tree)"
283 select ARCH_KIRKWOOD_DT
284 select ARM_ATAG_DTB_COMPAT
285 help
286 Say 'Y' here if you want your kernel to support the
287 ZyXEL NSA-310 board (Flattened Device Tree).
288
219endmenu 289endmenu
220 290
221endif 291endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 294779f892d..8d2e5a96247 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -31,3 +31,12 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
31obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o 31obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
32obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o 32obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o
33obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o 33obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o
34obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o
35obj-$(CONFIG_MACH_MPLCEC4_DT) += board-mplcec4.o
36obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
37obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
38obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o
39obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o
40obj-$(CONFIG_MACH_NSA310_DT) += board-nsa310.o
41obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o
42obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 43d16d6714b..a1aa87f0918 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -17,51 +17,11 @@
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include "common.h" 19#include "common.h"
20#include "mpp.h"
21 20
22static struct mv643xx_eth_platform_data dnskw_ge00_data = { 21static struct mv643xx_eth_platform_data dnskw_ge00_data = {
23 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 22 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
24}; 23};
25 24
26static unsigned int dnskw_mpp_config[] __initdata = {
27 MPP13_UART1_TXD, /* Custom ... */
28 MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */
29 MPP20_SATA1_ACTn, /* LED: White Right HDD */
30 MPP21_SATA0_ACTn, /* LED: White Left HDD */
31 MPP24_GPIO,
32 MPP25_GPIO,
33 MPP26_GPIO, /* LED: Power */
34 MPP27_GPIO, /* LED: Red Right HDD */
35 MPP28_GPIO, /* LED: Red Left HDD */
36 MPP29_GPIO, /* LED: Red USB (DNS-325 only) */
37 MPP30_GPIO,
38 MPP31_GPIO,
39 MPP32_GPIO,
40 MPP33_GPO,
41 MPP34_GPIO, /* Button: Front power */
42 MPP35_GPIO, /* LED: Red USB (DNS-320 only) */
43 MPP36_GPIO, /* Power: Turn off board */
44 MPP37_GPIO, /* Power: Turn back on after power failure */
45 MPP38_GPIO,
46 MPP39_GPIO, /* Power: SATA0 */
47 MPP40_GPIO, /* Power: SATA1 */
48 MPP41_GPIO, /* SATA0 present */
49 MPP42_GPIO, /* SATA1 present */
50 MPP43_GPIO, /* LED: White USB */
51 MPP44_GPIO, /* Fan: Tachometer Pin */
52 MPP45_GPIO, /* Fan: high speed */
53 MPP46_GPIO, /* Fan: low speed */
54 MPP47_GPIO, /* Button: Back unmount */
55 MPP48_GPIO, /* Button: Back reset */
56 MPP49_GPIO, /* Temp Alarm (DNS-325) Pin of U5 (DNS-320) */
57 0
58};
59
60static void dnskw_power_off(void)
61{
62 gpio_set_value(36, 1);
63}
64
65/* Register any GPIO for output and set the value */ 25/* Register any GPIO for output and set the value */
66static void __init dnskw_gpio_register(unsigned gpio, char *name, int def) 26static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
67{ 27{
@@ -76,22 +36,8 @@ static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
76 36
77void __init dnskw_init(void) 37void __init dnskw_init(void)
78{ 38{
79 kirkwood_mpp_conf(dnskw_mpp_config);
80
81 kirkwood_ehci_init();
82 kirkwood_ge00_init(&dnskw_ge00_data); 39 kirkwood_ge00_init(&dnskw_ge00_data);
83 40
84 /* Register power-off GPIO. */
85 if (gpio_request(36, "dnskw:power:off") == 0
86 && gpio_direction_output(36, 0) == 0)
87 pm_power_off = dnskw_power_off;
88 else
89 pr_err("dnskw: failed to configure power-off GPIO\n");
90
91 /* Ensure power is supplied to both HDDs */
92 dnskw_gpio_register(39, "dnskw:power:sata0", 1);
93 dnskw_gpio_register(40, "dnskw:power:sata1", 1);
94
95 /* Set NAS to turn back on after a power failure */ 41 /* Set NAS to turn back on after a power failure */
96 dnskw_gpio_register(37, "dnskw:power:recover", 1); 42 dnskw_gpio_register(37, "dnskw:power:recover", 1);
97} 43}
diff --git a/arch/arm/mach-kirkwood/board-dockstar.c b/arch/arm/mach-kirkwood/board-dockstar.c
index f2fbb023e67..d7196db3398 100644
--- a/arch/arm/mach-kirkwood/board-dockstar.c
+++ b/arch/arm/mach-kirkwood/board-dockstar.c
@@ -16,46 +16,17 @@
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/platform_device.h>
20#include <linux/ata_platform.h>
21#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
22#include <linux/of.h>
23#include <linux/of_address.h>
24#include <linux/of_fdt.h>
25#include <linux/of_irq.h>
26#include <linux/of_platform.h>
27#include <linux/gpio.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <mach/kirkwood.h>
32#include <mach/bridge-regs.h>
33#include <linux/platform_data/mmc-mvsdio.h>
34#include "common.h" 20#include "common.h"
35#include "mpp.h"
36 21
37static struct mv643xx_eth_platform_data dockstar_ge00_data = { 22static struct mv643xx_eth_platform_data dockstar_ge00_data = {
38 .phy_addr = MV643XX_ETH_PHY_ADDR(0), 23 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
39}; 24};
40 25
41static unsigned int dockstar_mpp_config[] __initdata = {
42 MPP29_GPIO, /* USB Power Enable */
43 MPP46_GPIO, /* LED green */
44 MPP47_GPIO, /* LED orange */
45 0
46};
47
48void __init dockstar_dt_init(void) 26void __init dockstar_dt_init(void)
49{ 27{
50 /* 28 /*
51 * Basic setup. Needs to be called early. 29 * Basic setup. Needs to be called early.
52 */ 30 */
53 kirkwood_mpp_conf(dockstar_mpp_config);
54
55 if (gpio_request(29, "USB Power Enable") != 0 ||
56 gpio_direction_output(29, 1) != 0)
57 pr_err("can't setup GPIO 29 (USB Power Enable)\n");
58 kirkwood_ehci_init();
59
60 kirkwood_ge00_init(&dockstar_ge00_data); 31 kirkwood_ge00_init(&dockstar_ge00_data);
61} 32}
diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c
index 20af53a56c0..08248e24ffc 100644
--- a/arch/arm/mach-kirkwood/board-dreamplug.c
+++ b/arch/arm/mach-kirkwood/board-dreamplug.c
@@ -13,26 +13,10 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/ata_platform.h>
18#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
19#include <linux/of.h>
20#include <linux/of_address.h>
21#include <linux/of_fdt.h>
22#include <linux/of_irq.h>
23#include <linux/of_platform.h>
24#include <linux/gpio.h> 17#include <linux/gpio.h>
25#include <linux/mtd/physmap.h>
26#include <linux/spi/flash.h>
27#include <linux/spi/spi.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <mach/kirkwood.h>
32#include <mach/bridge-regs.h>
33#include <linux/platform_data/mmc-mvsdio.h> 18#include <linux/platform_data/mmc-mvsdio.h>
34#include "common.h" 19#include "common.h"
35#include "mpp.h"
36 20
37static struct mv643xx_eth_platform_data dreamplug_ge00_data = { 21static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
38 .phy_addr = MV643XX_ETH_PHY_ADDR(0), 22 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
@@ -46,25 +30,11 @@ static struct mvsdio_platform_data dreamplug_mvsdio_data = {
46 /* unfortunately the CD signal has not been connected */ 30 /* unfortunately the CD signal has not been connected */
47}; 31};
48 32
49static unsigned int dreamplug_mpp_config[] __initdata = {
50 MPP0_SPI_SCn,
51 MPP1_SPI_MOSI,
52 MPP2_SPI_SCK,
53 MPP3_SPI_MISO,
54 MPP47_GPIO, /* Bluetooth LED */
55 MPP48_GPIO, /* Wifi LED */
56 MPP49_GPIO, /* Wifi AP LED */
57 0
58};
59
60void __init dreamplug_init(void) 33void __init dreamplug_init(void)
61{ 34{
62 /* 35 /*
63 * Basic setup. Needs to be called early. 36 * Basic setup. Needs to be called early.
64 */ 37 */
65 kirkwood_mpp_conf(dreamplug_mpp_config);
66
67 kirkwood_ehci_init();
68 kirkwood_ge00_init(&dreamplug_ge00_data); 38 kirkwood_ge00_init(&dreamplug_ge00_data);
69 kirkwood_ge01_init(&dreamplug_ge01_data); 39 kirkwood_ge01_init(&dreamplug_ge01_data);
70 kirkwood_sdio_init(&dreamplug_mvsdio_data); 40 kirkwood_sdio_init(&dreamplug_mvsdio_data);
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index d94872fed8c..375f7d88551 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -26,10 +26,12 @@ static struct of_device_id kirkwood_dt_match_table[] __initdata = {
26 { } 26 { }
27}; 27};
28 28
29struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { 29static struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
30 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), 30 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
31 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", 31 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
32 NULL), 32 NULL),
33 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011100, "mv64xxx_i2c.1",
34 NULL),
33 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), 35 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
34 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL), 36 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
35 OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL), 37 OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
@@ -94,11 +96,30 @@ static void __init kirkwood_dt_init(void)
94 if (of_machine_is_compatible("keymile,km_kirkwood")) 96 if (of_machine_is_compatible("keymile,km_kirkwood"))
95 km_kirkwood_init(); 97 km_kirkwood_init();
96 98
99 if (of_machine_is_compatible("lacie,inetspace_v2") ||
100 of_machine_is_compatible("lacie,netspace_v2") ||
101 of_machine_is_compatible("lacie,netspace_max_v2") ||
102 of_machine_is_compatible("lacie,netspace_lite_v2") ||
103 of_machine_is_compatible("lacie,netspace_mini_v2"))
104 ns2_init();
105
106 if (of_machine_is_compatible("mpl,cec4"))
107 mplcec4_init();
108
109 if (of_machine_is_compatible("plathome,openblocks-a6"))
110 openblocks_a6_init();
111
112 if (of_machine_is_compatible("usi,topkick"))
113 usi_topkick_init();
114
115 if (of_machine_is_compatible("zyxel,nsa310"))
116 nsa310_init();
117
97 of_platform_populate(NULL, kirkwood_dt_match_table, 118 of_platform_populate(NULL, kirkwood_dt_match_table,
98 kirkwood_auxdata_lookup, NULL); 119 kirkwood_auxdata_lookup, NULL);
99} 120}
100 121
101static const char *kirkwood_dt_board_compat[] = { 122static const char * const kirkwood_dt_board_compat[] = {
102 "globalscale,dreamplug", 123 "globalscale,dreamplug",
103 "dlink,dns-320", 124 "dlink,dns-320",
104 "dlink,dns-325", 125 "dlink,dns-325",
@@ -110,6 +131,15 @@ static const char *kirkwood_dt_board_compat[] = {
110 "buffalo,lsxl", 131 "buffalo,lsxl",
111 "iom,ix2-200", 132 "iom,ix2-200",
112 "keymile,km_kirkwood", 133 "keymile,km_kirkwood",
134 "lacie,inetspace_v2",
135 "lacie,netspace_max_v2",
136 "lacie,netspace_v2",
137 "lacie,netspace_lite_v2",
138 "lacie,netspace_mini_v2",
139 "mpl,cec4",
140 "plathome,openblocks-a6",
141 "usi,topkick",
142 "zyxel,nsa310",
113 NULL 143 NULL
114}; 144};
115 145
diff --git a/arch/arm/mach-kirkwood/board-goflexnet.c b/arch/arm/mach-kirkwood/board-goflexnet.c
index 001ca8c9698..9db979aec82 100644
--- a/arch/arm/mach-kirkwood/board-goflexnet.c
+++ b/arch/arm/mach-kirkwood/board-goflexnet.c
@@ -18,54 +18,17 @@
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/ata_platform.h>
23#include <linux/mv643xx_eth.h> 21#include <linux/mv643xx_eth.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
26#include <linux/of_fdt.h>
27#include <linux/of_irq.h>
28#include <linux/of_platform.h>
29#include <linux/gpio.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <mach/kirkwood.h>
34#include <mach/bridge-regs.h>
35#include <linux/platform_data/mmc-mvsdio.h>
36#include "common.h" 22#include "common.h"
37#include "mpp.h"
38 23
39static struct mv643xx_eth_platform_data goflexnet_ge00_data = { 24static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
40 .phy_addr = MV643XX_ETH_PHY_ADDR(0), 25 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
41}; 26};
42 27
43static unsigned int goflexnet_mpp_config[] __initdata = {
44 MPP29_GPIO, /* USB Power Enable */
45 MPP47_GPIO, /* LED Orange */
46 MPP46_GPIO, /* LED Green */
47 MPP45_GPIO, /* LED Left Capacity 3 */
48 MPP44_GPIO, /* LED Left Capacity 2 */
49 MPP43_GPIO, /* LED Left Capacity 1 */
50 MPP42_GPIO, /* LED Left Capacity 0 */
51 MPP41_GPIO, /* LED Right Capacity 3 */
52 MPP40_GPIO, /* LED Right Capacity 2 */
53 MPP39_GPIO, /* LED Right Capacity 1 */
54 MPP38_GPIO, /* LED Right Capacity 0 */
55 0
56};
57
58void __init goflexnet_init(void) 28void __init goflexnet_init(void)
59{ 29{
60 /* 30 /*
61 * Basic setup. Needs to be called early. 31 * Basic setup. Needs to be called early.
62 */ 32 */
63 kirkwood_mpp_conf(goflexnet_mpp_config);
64
65 if (gpio_request(29, "USB Power Enable") != 0 ||
66 gpio_direction_output(29, 1) != 0)
67 pr_err("can't setup GPIO 29 (USB Power Enable)\n");
68 kirkwood_ehci_init();
69
70 kirkwood_ge00_init(&goflexnet_ge00_data); 33 kirkwood_ge00_init(&goflexnet_ge00_data);
71} 34}
diff --git a/arch/arm/mach-kirkwood/board-ib62x0.c b/arch/arm/mach-kirkwood/board-ib62x0.c
index cfc47f80e73..9f6f496380d 100644
--- a/arch/arm/mach-kirkwood/board-ib62x0.c
+++ b/arch/arm/mach-kirkwood/board-ib62x0.c
@@ -13,59 +13,18 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
20#include <linux/gpio.h>
21#include <linux/input.h> 17#include <linux/input.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <mach/kirkwood.h>
25#include "common.h" 18#include "common.h"
26#include "mpp.h"
27
28#define IB62X0_GPIO_POWER_OFF 24
29 19
30static struct mv643xx_eth_platform_data ib62x0_ge00_data = { 20static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
31 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 21 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
32}; 22};
33 23
34static unsigned int ib62x0_mpp_config[] __initdata = {
35 MPP0_NF_IO2,
36 MPP1_NF_IO3,
37 MPP2_NF_IO4,
38 MPP3_NF_IO5,
39 MPP4_NF_IO6,
40 MPP5_NF_IO7,
41 MPP18_NF_IO0,
42 MPP19_NF_IO1,
43 MPP22_GPIO, /* OS LED red */
44 MPP24_GPIO, /* Power off device */
45 MPP25_GPIO, /* OS LED green */
46 MPP27_GPIO, /* USB transfer LED */
47 MPP28_GPIO, /* Reset button */
48 MPP29_GPIO, /* USB Copy button */
49 0
50};
51
52static void ib62x0_power_off(void)
53{
54 gpio_set_value(IB62X0_GPIO_POWER_OFF, 1);
55}
56
57void __init ib62x0_init(void) 24void __init ib62x0_init(void)
58{ 25{
59 /* 26 /*
60 * Basic setup. Needs to be called early. 27 * Basic setup. Needs to be called early.
61 */ 28 */
62 kirkwood_mpp_conf(ib62x0_mpp_config);
63
64 kirkwood_ehci_init();
65 kirkwood_ge00_init(&ib62x0_ge00_data); 29 kirkwood_ge00_init(&ib62x0_ge00_data);
66 if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
67 gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
68 pm_power_off = ib62x0_power_off;
69 else
70 pr_err("board-ib62x0: failed to configure power-off GPIO\n");
71} 30}
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
index d084b1e2943..c8ebde4919e 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -10,42 +10,16 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/of.h> 13#include <linux/of.h>
15#include <linux/of_address.h>
16#include <linux/of_fdt.h>
17#include <linux/of_irq.h>
18#include <linux/of_platform.h>
19#include <linux/mv643xx_eth.h> 14#include <linux/mv643xx_eth.h>
20#include <linux/gpio.h>
21#include <asm/mach/arch.h>
22#include <mach/kirkwood.h>
23#include "common.h" 15#include "common.h"
24#include "mpp.h"
25 16
26static struct mv643xx_eth_platform_data iconnect_ge00_data = { 17static struct mv643xx_eth_platform_data iconnect_ge00_data = {
27 .phy_addr = MV643XX_ETH_PHY_ADDR(11), 18 .phy_addr = MV643XX_ETH_PHY_ADDR(11),
28}; 19};
29 20
30static unsigned int iconnect_mpp_config[] __initdata = {
31 MPP12_GPIO,
32 MPP35_GPIO,
33 MPP41_GPIO,
34 MPP42_GPIO,
35 MPP43_GPIO,
36 MPP44_GPIO,
37 MPP45_GPIO,
38 MPP46_GPIO,
39 MPP47_GPIO,
40 MPP48_GPIO,
41 0
42};
43
44void __init iconnect_init(void) 21void __init iconnect_init(void)
45{ 22{
46 kirkwood_mpp_conf(iconnect_mpp_config);
47
48 kirkwood_ehci_init();
49 kirkwood_ge00_init(&iconnect_ge00_data); 23 kirkwood_ge00_init(&iconnect_ge00_data);
50} 24}
51 25
diff --git a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
index 158fb97d039..f655b2637b0 100644
--- a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
+++ b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
@@ -10,12 +10,9 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mv643xx_eth.h> 13#include <linux/mv643xx_eth.h>
15#include <linux/ethtool.h> 14#include <linux/ethtool.h>
16#include <mach/kirkwood.h>
17#include "common.h" 15#include "common.h"
18#include "mpp.h"
19 16
20static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = { 17static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
21 .phy_addr = MV643XX_ETH_PHY_NONE, 18 .phy_addr = MV643XX_ETH_PHY_NONE,
@@ -23,35 +20,10 @@ static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
23 .duplex = DUPLEX_FULL, 20 .duplex = DUPLEX_FULL,
24}; 21};
25 22
26static unsigned int iomega_ix2_200_mpp_config[] __initdata = {
27 MPP12_GPIO, /* Reset Button */
28 MPP14_GPIO, /* Power Button */
29 MPP15_GPIO, /* Backup LED (blue) */
30 MPP16_GPIO, /* Power LED (white) */
31 MPP35_GPIO, /* OTB Button */
32 MPP36_GPIO, /* Rebuild LED (white) */
33 MPP37_GPIO, /* Health LED (red) */
34 MPP38_GPIO, /* SATA LED brightness control 1 */
35 MPP39_GPIO, /* SATA LED brightness control 2 */
36 MPP40_GPIO, /* Backup LED brightness control 1 */
37 MPP41_GPIO, /* Backup LED brightness control 2 */
38 MPP42_GPIO, /* Power LED brightness control 1 */
39 MPP43_GPIO, /* Power LED brightness control 2 */
40 MPP44_GPIO, /* Health LED brightness control 1 */
41 MPP45_GPIO, /* Health LED brightness control 2 */
42 MPP46_GPIO, /* Rebuild LED brightness control 1 */
43 MPP47_GPIO, /* Rebuild LED brightness control 2 */
44 0
45};
46
47void __init iomega_ix2_200_init(void) 23void __init iomega_ix2_200_init(void)
48{ 24{
49 /* 25 /*
50 * Basic setup. Needs to be called early. 26 * Basic setup. Needs to be called early.
51 */ 27 */
52 kirkwood_mpp_conf(iomega_ix2_200_mpp_config);
53
54 kirkwood_ehci_init();
55
56 kirkwood_ge01_init(&iomega_ix2_200_ge00_data); 28 kirkwood_ge01_init(&iomega_ix2_200_ge00_data);
57} 29}
diff --git a/arch/arm/mach-kirkwood/board-km_kirkwood.c b/arch/arm/mach-kirkwood/board-km_kirkwood.c
index f7d32834b75..44e4605ba0b 100644
--- a/arch/arm/mach-kirkwood/board-km_kirkwood.c
+++ b/arch/arm/mach-kirkwood/board-km_kirkwood.c
@@ -18,27 +18,15 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/clk-private.h> 19#include <linux/clk-private.h>
20#include "common.h" 20#include "common.h"
21#include "mpp.h"
22 21
23static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = { 22static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
24 .phy_addr = MV643XX_ETH_PHY_ADDR(0), 23 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
25}; 24};
26 25
27static unsigned int km_kirkwood_mpp_config[] __initdata = {
28 MPP8_GPIO, /* I2C SDA */
29 MPP9_GPIO, /* I2C SCL */
30 0
31};
32
33void __init km_kirkwood_init(void) 26void __init km_kirkwood_init(void)
34{ 27{
35 struct clk *sata_clk; 28 struct clk *sata_clk;
36 /* 29 /*
37 * Basic setup. Needs to be called early.
38 */
39 kirkwood_mpp_conf(km_kirkwood_mpp_config);
40
41 /*
42 * Our variant of kirkwood (integrated in the Bobcat) hangs on accessing 30 * Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
43 * SATA bits (14-15) of the Clock Gating Control Register. Since these 31 * SATA bits (14-15) of the Clock Gating Control Register. Since these
44 * devices are also not present in this variant, their clocks get 32 * devices are also not present in this variant, their clocks get
@@ -52,6 +40,5 @@ void __init km_kirkwood_init(void)
52 if (!IS_ERR(sata_clk)) 40 if (!IS_ERR(sata_clk))
53 sata_clk->flags |= CLK_IGNORE_UNUSED; 41 sata_clk->flags |= CLK_IGNORE_UNUSED;
54 42
55 kirkwood_ehci_init();
56 kirkwood_ge00_init(&km_kirkwood_ge00_data); 43 kirkwood_ge00_init(&km_kirkwood_ge00_data);
57} 44}
diff --git a/arch/arm/mach-kirkwood/board-lsxl.c b/arch/arm/mach-kirkwood/board-lsxl.c
index 83d8975592f..4ec8b7ae784 100644
--- a/arch/arm/mach-kirkwood/board-lsxl.c
+++ b/arch/arm/mach-kirkwood/board-lsxl.c
@@ -14,19 +14,8 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/spi/flash.h>
20#include <linux/spi/spi.h>
21#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
22#include <linux/gpio.h>
23#include <linux/gpio-fan.h>
24#include <linux/input.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/kirkwood.h>
28#include "common.h" 18#include "common.h"
29#include "mpp.h"
30 19
31static struct mv643xx_eth_platform_data lsxl_ge00_data = { 20static struct mv643xx_eth_platform_data lsxl_ge00_data = {
32 .phy_addr = MV643XX_ETH_PHY_ADDR(0), 21 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
@@ -36,68 +25,6 @@ static struct mv643xx_eth_platform_data lsxl_ge01_data = {
36 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 25 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
37}; 26};
38 27
39static unsigned int lsxl_mpp_config[] __initdata = {
40 MPP10_GPO, /* HDD Power Enable */
41 MPP11_GPIO, /* USB Vbus Enable */
42 MPP18_GPO, /* FAN High Enable# */
43 MPP19_GPO, /* FAN Low Enable# */
44 MPP36_GPIO, /* Function Blue LED */
45 MPP37_GPIO, /* Alarm LED */
46 MPP38_GPIO, /* Info LED */
47 MPP39_GPIO, /* Power LED */
48 MPP40_GPIO, /* Fan Lock */
49 MPP41_GPIO, /* Function Button */
50 MPP42_GPIO, /* Power Switch */
51 MPP43_GPIO, /* Power Auto Switch */
52 MPP48_GPIO, /* Function Red LED */
53 0
54};
55
56#define LSXL_GPIO_FAN_HIGH 18
57#define LSXL_GPIO_FAN_LOW 19
58#define LSXL_GPIO_FAN_LOCK 40
59
60static struct gpio_fan_alarm lsxl_alarm = {
61 .gpio = LSXL_GPIO_FAN_LOCK,
62};
63
64static struct gpio_fan_speed lsxl_speeds[] = {
65 {
66 .rpm = 0,
67 .ctrl_val = 3,
68 }, {
69 .rpm = 1500,
70 .ctrl_val = 1,
71 }, {
72 .rpm = 3250,
73 .ctrl_val = 2,
74 }, {
75 .rpm = 5000,
76 .ctrl_val = 0,
77 }
78};
79
80static int lsxl_gpio_list[] = {
81 LSXL_GPIO_FAN_HIGH, LSXL_GPIO_FAN_LOW,
82};
83
84static struct gpio_fan_platform_data lsxl_fan_data = {
85 .num_ctrl = ARRAY_SIZE(lsxl_gpio_list),
86 .ctrl = lsxl_gpio_list,
87 .alarm = &lsxl_alarm,
88 .num_speed = ARRAY_SIZE(lsxl_speeds),
89 .speed = lsxl_speeds,
90};
91
92static struct platform_device lsxl_fan_device = {
93 .name = "gpio-fan",
94 .id = -1,
95 .num_resources = 0,
96 .dev = {
97 .platform_data = &lsxl_fan_data,
98 },
99};
100
101/* 28/*
102 * On the LS-XHL/LS-CHLv2, the shutdown process is following: 29 * On the LS-XHL/LS-CHLv2, the shutdown process is following:
103 * - Userland monitors key events until the power switch goes to off position 30 * - Userland monitors key events until the power switch goes to off position
@@ -111,24 +38,14 @@ static void lsxl_power_off(void)
111 kirkwood_restart('h', NULL); 38 kirkwood_restart('h', NULL);
112} 39}
113 40
114#define LSXL_GPIO_HDD_POWER 10
115#define LSXL_GPIO_USB_POWER 11
116
117void __init lsxl_init(void) 41void __init lsxl_init(void)
118{ 42{
119 /* 43 /*
120 * Basic setup. Needs to be called early. 44 * Basic setup. Needs to be called early.
121 */ 45 */
122 kirkwood_mpp_conf(lsxl_mpp_config);
123
124 /* usb and sata power on */
125 gpio_set_value(LSXL_GPIO_USB_POWER, 1);
126 gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
127 46
128 kirkwood_ehci_init();
129 kirkwood_ge00_init(&lsxl_ge00_data); 47 kirkwood_ge00_init(&lsxl_ge00_data);
130 kirkwood_ge01_init(&lsxl_ge01_data); 48 kirkwood_ge01_init(&lsxl_ge01_data);
131 platform_device_register(&lsxl_fan_device);
132 49
133 /* register power-off method */ 50 /* register power-off method */
134 pm_power_off = lsxl_power_off; 51 pm_power_off = lsxl_power_off;
diff --git a/arch/arm/mach-kirkwood/board-mplcec4.c b/arch/arm/mach-kirkwood/board-mplcec4.c
new file mode 100644
index 00000000000..56bfe5a1605
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-mplcec4.c
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2012 MPL AG, Switzerland
3 * Stefan Peter <s.peter@mpl.ch>
4 *
5 * arch/arm/mach-kirkwood/board-mplcec4.c
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/mv643xx_eth.h>
15#include <linux/platform_data/mmc-mvsdio.h>
16#include "common.h"
17#include "mpp.h"
18
19static struct mv643xx_eth_platform_data mplcec4_ge00_data = {
20 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
21};
22
23static struct mv643xx_eth_platform_data mplcec4_ge01_data = {
24 .phy_addr = MV643XX_ETH_PHY_ADDR(2),
25};
26
27static struct mvsdio_platform_data mplcec4_mvsdio_data = {
28 .gpio_card_detect = 47, /* MPP47 used as SD card detect */
29};
30
31
32void __init mplcec4_init(void)
33{
34 /*
35 * Basic setup. Needs to be called early.
36 */
37 kirkwood_ge00_init(&mplcec4_ge00_data);
38 kirkwood_ge01_init(&mplcec4_ge01_data);
39 kirkwood_sdio_init(&mplcec4_mvsdio_data);
40 kirkwood_pcie_init(KW_PCIE0);
41}
42
43
44
diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
new file mode 100644
index 00000000000..8821720ab5a
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ns2.c
@@ -0,0 +1,86 @@
1/*
2 * Copyright 2012 (C), Simon Guinot <simon.guinot@sequanux.org>
3 *
4 * arch/arm/mach-kirkwood/board-ns2.c
5 *
6 * LaCie Network Space v2 board (and parents) initialization for drivers
7 * not converted to flattened device tree yet.
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/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/gpio.h>
19#include <linux/of.h>
20#include "common.h"
21#include "mpp.h"
22
23static struct mv643xx_eth_platform_data ns2_ge00_data = {
24 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
25};
26
27static unsigned int ns2_mpp_config[] __initdata = {
28 MPP0_SPI_SCn,
29 MPP1_SPI_MOSI,
30 MPP2_SPI_SCK,
31 MPP3_SPI_MISO,
32 MPP4_NF_IO6,
33 MPP5_NF_IO7,
34 MPP6_SYSRST_OUTn,
35 MPP7_GPO, /* Fan speed (bit 1) */
36 MPP8_TW0_SDA,
37 MPP9_TW0_SCK,
38 MPP10_UART0_TXD,
39 MPP11_UART0_RXD,
40 MPP12_GPO, /* Red led */
41 MPP14_GPIO, /* USB fuse */
42 MPP16_GPIO, /* SATA 0 power */
43 MPP17_GPIO, /* SATA 1 power */
44 MPP18_NF_IO0,
45 MPP19_NF_IO1,
46 MPP20_SATA1_ACTn,
47 MPP21_SATA0_ACTn,
48 MPP22_GPIO, /* Fan speed (bit 0) */
49 MPP23_GPIO, /* Fan power */
50 MPP24_GPIO, /* USB mode select */
51 MPP25_GPIO, /* Fan rotation fail */
52 MPP26_GPIO, /* USB device vbus */
53 MPP28_GPIO, /* USB enable host vbus */
54 MPP29_GPIO, /* Blue led (slow register) */
55 MPP30_GPIO, /* Blue led (command register) */
56 MPP31_GPIO, /* Board power off */
57 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */
58 MPP33_GPO, /* Fan speed (bit 2) */
59 0
60};
61
62#define NS2_GPIO_POWER_OFF 31
63
64static void ns2_power_off(void)
65{
66 gpio_set_value(NS2_GPIO_POWER_OFF, 1);
67}
68
69void __init ns2_init(void)
70{
71 /*
72 * Basic setup. Needs to be called early.
73 */
74 kirkwood_mpp_conf(ns2_mpp_config);
75
76 if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
77 of_machine_is_compatible("lacie,netspace_mini_v2"))
78 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
79 kirkwood_ge00_init(&ns2_ge00_data);
80
81 if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 &&
82 gpio_direction_output(NS2_GPIO_POWER_OFF, 0) == 0)
83 pm_power_off = ns2_power_off;
84 else
85 pr_err("ns2: failed to configure power-off GPIO\n");
86}
diff --git a/arch/arm/mach-kirkwood/board-nsa310.c b/arch/arm/mach-kirkwood/board-nsa310.c
new file mode 100644
index 00000000000..f58d2e1a404
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-nsa310.c
@@ -0,0 +1,101 @@
1/*
2 * arch/arm/mach-kirkwood/nsa-310-setup.c
3 *
4 * ZyXEL NSA-310 Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/i2c.h>
14#include <linux/gpio.h>
15
16#include <asm/mach-types.h>
17#include <asm/mach/arch.h>
18#include <mach/kirkwood.h>
19#include "common.h"
20#include "mpp.h"
21
22#define NSA310_GPIO_USB_POWER_OFF 21
23#define NSA310_GPIO_POWER_OFF 48
24
25static unsigned int nsa310_mpp_config[] __initdata = {
26 MPP12_GPIO, /* led esata green */
27 MPP13_GPIO, /* led esata red */
28 MPP15_GPIO, /* led usb green */
29 MPP16_GPIO, /* led usb red */
30 MPP21_GPIO, /* control usb power off */
31 MPP28_GPIO, /* led sys green */
32 MPP29_GPIO, /* led sys red */
33 MPP36_GPIO, /* key reset */
34 MPP37_GPIO, /* key copy */
35 MPP39_GPIO, /* led copy green */
36 MPP40_GPIO, /* led copy red */
37 MPP41_GPIO, /* led hdd green */
38 MPP42_GPIO, /* led hdd red */
39 MPP44_GPIO, /* ?? */
40 MPP46_GPIO, /* key power */
41 MPP48_GPIO, /* control power off */
42 0
43};
44
45static struct i2c_board_info __initdata nsa310_i2c_info[] = {
46 { I2C_BOARD_INFO("adt7476", 0x2e) },
47};
48
49static void nsa310_power_off(void)
50{
51 gpio_set_value(NSA310_GPIO_POWER_OFF, 1);
52}
53
54static int __init nsa310_gpio_request(unsigned int gpio, unsigned long flags,
55 const char *label)
56{
57 int err;
58
59 err = gpio_request_one(gpio, flags, label);
60 if (err)
61 pr_err("NSA-310: can't setup GPIO%u (%s), err=%d\n",
62 gpio, label, err);
63
64 return err;
65}
66
67static void __init nsa310_gpio_init(void)
68{
69 int err;
70
71 err = nsa310_gpio_request(NSA310_GPIO_POWER_OFF, GPIOF_OUT_INIT_LOW,
72 "Power Off");
73 if (!err)
74 pm_power_off = nsa310_power_off;
75
76 nsa310_gpio_request(NSA310_GPIO_USB_POWER_OFF, GPIOF_OUT_INIT_LOW,
77 "USB Power Off");
78}
79
80void __init nsa310_init(void)
81{
82 u32 dev, rev;
83
84 kirkwood_mpp_conf(nsa310_mpp_config);
85
86 nsa310_gpio_init();
87
88 kirkwood_pcie_id(&dev, &rev);
89
90 i2c_register_board_info(0, ARRAY_AND_SIZE(nsa310_i2c_info));
91}
92
93static int __init nsa310_pci_init(void)
94{
95 if (of_machine_is_compatible("zyxel,nsa310"))
96 kirkwood_pcie_init(KW_PCIE0);
97
98 return 0;
99}
100
101subsys_initcall(nsa310_pci_init);
diff --git a/arch/arm/mach-kirkwood/board-openblocks_a6.c b/arch/arm/mach-kirkwood/board-openblocks_a6.c
new file mode 100644
index 00000000000..815fc6451d5
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-openblocks_a6.c
@@ -0,0 +1,70 @@
1/*
2 * Copyright 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
3 *
4 * arch/arm/mach-kirkwood/board-openblocks_a6.c
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mv643xx_eth.h>
14#include <linux/clk.h>
15#include <linux/clk-private.h>
16#include "common.h"
17#include "mpp.h"
18
19static struct mv643xx_eth_platform_data openblocks_ge00_data = {
20 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
21};
22
23static unsigned int openblocks_a6_mpp_config[] __initdata = {
24 MPP0_NF_IO2,
25 MPP1_NF_IO3,
26 MPP2_NF_IO4,
27 MPP3_NF_IO5,
28 MPP4_NF_IO6,
29 MPP5_NF_IO7,
30 MPP6_SYSRST_OUTn,
31 MPP8_UART1_RTS,
32 MPP9_UART1_CTS,
33 MPP10_UART0_TXD,
34 MPP11_UART0_RXD,
35 MPP13_UART1_TXD,
36 MPP14_UART1_RXD,
37 MPP15_UART0_RTS,
38 MPP16_UART0_CTS,
39 MPP18_NF_IO0,
40 MPP19_NF_IO1,
41 MPP20_GPIO, /* DIP SW0 */
42 MPP21_GPIO, /* DIP SW1 */
43 MPP22_GPIO, /* DIP SW2 */
44 MPP23_GPIO, /* DIP SW3 */
45 MPP24_GPIO, /* GPIO 0 */
46 MPP25_GPIO, /* GPIO 1 */
47 MPP26_GPIO, /* GPIO 2 */
48 MPP27_GPIO, /* GPIO 3 */
49 MPP28_GPIO, /* GPIO 4 */
50 MPP29_GPIO, /* GPIO 5 */
51 MPP30_GPIO, /* GPIO 6 */
52 MPP31_GPIO, /* GPIO 7 */
53 MPP36_TW1_SDA,
54 MPP37_TW1_SCK,
55 MPP38_GPIO, /* INIT */
56 MPP39_GPIO, /* USB OC */
57 MPP41_GPIO, /* LED: Red */
58 MPP42_GPIO, /* LED: Green */
59 MPP43_GPIO, /* LED: Yellow */
60 0,
61};
62
63void __init openblocks_a6_init(void)
64{
65 /*
66 * Basic setup. Needs to be called early.
67 */
68 kirkwood_mpp_conf(openblocks_a6_mpp_config);
69 kirkwood_ge00_init(&openblocks_ge00_data);
70}
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
index 1750e68506c..acb0187c7ee 100644
--- a/arch/arm/mach-kirkwood/board-ts219.c
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -19,54 +19,25 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/mv643xx_eth.h> 21#include <linux/mv643xx_eth.h>
22#include <linux/ata_platform.h>
23#include <linux/gpio_keys.h>
24#include <linux/input.h>
25#include <asm/mach-types.h> 22#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
27#include <mach/kirkwood.h> 24#include <mach/kirkwood.h>
28#include "common.h" 25#include "common.h"
29#include "mpp.h"
30#include "tsx1x-common.h" 26#include "tsx1x-common.h"
31 27
32static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = { 28static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 29 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34}; 30};
35 31
36static unsigned int qnap_ts219_mpp_config[] __initdata = {
37 MPP0_SPI_SCn,
38 MPP1_SPI_MOSI,
39 MPP2_SPI_SCK,
40 MPP3_SPI_MISO,
41 MPP4_SATA1_ACTn,
42 MPP5_SATA0_ACTn,
43 MPP8_TW0_SDA,
44 MPP9_TW0_SCK,
45 MPP10_UART0_TXD,
46 MPP11_UART0_RXD,
47 MPP13_UART1_TXD, /* PIC controller */
48 MPP14_UART1_RXD, /* PIC controller */
49 MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
50 MPP16_GPIO, /* Reset button (on devices with 88F6281) */
51 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
52 MPP37_GPIO, /* Reset button (on devices with 88F6282) */
53 MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
54 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
55 0
56};
57
58void __init qnap_dt_ts219_init(void) 32void __init qnap_dt_ts219_init(void)
59{ 33{
60 u32 dev, rev; 34 u32 dev, rev;
61 35
62 kirkwood_mpp_conf(qnap_ts219_mpp_config);
63
64 kirkwood_pcie_id(&dev, &rev); 36 kirkwood_pcie_id(&dev, &rev);
65 if (dev == MV88F6282_DEV_ID) 37 if (dev == MV88F6282_DEV_ID)
66 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0); 38 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
67 39
68 kirkwood_ge00_init(&qnap_ts219_ge00_data); 40 kirkwood_ge00_init(&qnap_ts219_ge00_data);
69 kirkwood_ehci_init();
70 41
71 pm_power_off = qnap_tsx1x_power_off; 42 pm_power_off = qnap_tsx1x_power_off;
72} 43}
diff --git a/arch/arm/mach-kirkwood/board-usi_topkick.c b/arch/arm/mach-kirkwood/board-usi_topkick.c
new file mode 100644
index 00000000000..15e69fcde9f
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-usi_topkick.c
@@ -0,0 +1,81 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-usi_topkick.c
5 *
6 * USI Topkick Init for drivers not converted to flattened device tree yet.
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/gpio.h>
17#include <linux/platform_data/mmc-mvsdio.h>
18#include "common.h"
19#include "mpp.h"
20
21static struct mv643xx_eth_platform_data topkick_ge00_data = {
22 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
23};
24
25static struct mvsdio_platform_data topkick_mvsdio_data = {
26 /* unfortunately the CD signal has not been connected */
27};
28
29/*
30 * GPIO LED layout
31 *
32 * /-SYS_LED(2)
33 * |
34 * | /-DISK_LED
35 * | |
36 * | | /-WLAN_LED(2)
37 * | | |
38 * [SW] [*] [*] [*]
39 */
40
41/*
42 * Switch positions
43 *
44 * /-SW_LEFT
45 * |
46 * | /-SW_IDLE
47 * | |
48 * | | /-SW_RIGHT
49 * | | |
50 * PS [L] [I] [R] LEDS
51 */
52
53static unsigned int topkick_mpp_config[] __initdata = {
54 MPP21_GPIO, /* DISK_LED (low active) - yellow */
55 MPP36_GPIO, /* SATA0 power enable (high active) */
56 MPP37_GPIO, /* SYS_LED2 (low active) - red */
57 MPP38_GPIO, /* SYS_LED (low active) - blue */
58 MPP39_GPIO, /* WLAN_LED (low active) - green */
59 MPP43_GPIO, /* SW_LEFT (low active) */
60 MPP44_GPIO, /* SW_RIGHT (low active) */
61 MPP45_GPIO, /* SW_IDLE (low active) */
62 MPP46_GPIO, /* SW_LEFT (low active) */
63 MPP48_GPIO, /* WLAN_LED2 (low active) - yellow */
64 0
65};
66
67#define TOPKICK_SATA0_PWR_ENABLE 36
68
69void __init usi_topkick_init(void)
70{
71 /*
72 * Basic setup. Needs to be called early.
73 */
74 kirkwood_mpp_conf(topkick_mpp_config);
75
76 /* SATA0 power enable */
77 gpio_set_value(TOPKICK_SATA0_PWR_ENABLE, 1);
78
79 kirkwood_ge00_init(&topkick_ge00_data);
80 kirkwood_sdio_init(&topkick_mvsdio_data);
81}
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 2c6c218fb79..5303be62b31 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -18,10 +18,10 @@
18#include <linux/clk-provider.h> 18#include <linux/clk-provider.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mv643xx_i2c.h> 20#include <linux/mv643xx_i2c.h>
21#include <linux/timex.h>
22#include <linux/kexec.h>
21#include <net/dsa.h> 23#include <net/dsa.h>
22#include <asm/page.h> 24#include <asm/page.h>
23#include <asm/timex.h>
24#include <asm/kexec.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/time.h> 26#include <asm/mach/time.h>
27#include <mach/kirkwood.h> 27#include <mach/kirkwood.h>
@@ -266,6 +266,7 @@ void __init kirkwood_clk_init(void)
266 orion_clkdev_add("1", "pcie", pex1); 266 orion_clkdev_add("1", "pcie", pex1);
267 orion_clkdev_add(NULL, "kirkwood-i2s", audio); 267 orion_clkdev_add(NULL, "kirkwood-i2s", audio);
268 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", runit); 268 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", runit);
269 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".1", runit);
269 270
270 /* Marvell says runit is used by SPI, UART, NAND, TWSI, ..., 271 /* Marvell says runit is used by SPI, UART, NAND, TWSI, ...,
271 * so should never be gated. 272 * so should never be gated.
@@ -425,7 +426,7 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
425/***************************************************************************** 426/*****************************************************************************
426 * SPI 427 * SPI
427 ****************************************************************************/ 428 ****************************************************************************/
428void __init kirkwood_spi_init() 429void __init kirkwood_spi_init(void)
429{ 430{
430 orion_spi_init(SPI_PHYS_BASE); 431 orion_spi_init(SPI_PHYS_BASE);
431} 432}
@@ -646,8 +647,7 @@ void __init kirkwood_l2_init(void)
646 647
647void __init kirkwood_init(void) 648void __init kirkwood_init(void)
648{ 649{
649 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", 650 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
650 kirkwood_id(), kirkwood_tclk);
651 651
652 /* 652 /*
653 * Disable propagation of mbus errors to the CPU local bus, 653 * Disable propagation of mbus errors to the CPU local bus,
@@ -671,7 +671,7 @@ void __init kirkwood_init(void)
671 kirkwood_xor1_init(); 671 kirkwood_xor1_init();
672 kirkwood_crypto_init(); 672 kirkwood_crypto_init();
673 673
674#ifdef CONFIG_KEXEC 674#ifdef CONFIG_KEXEC
675 kexec_reinit = kirkwood_enable_pcie; 675 kexec_reinit = kirkwood_enable_pcie;
676#endif 676#endif
677} 677}
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index bcffd7ca1ca..5ffa57f08c8 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -47,7 +47,8 @@ void kirkwood_i2c_init(void);
47void kirkwood_uart0_init(void); 47void kirkwood_uart0_init(void);
48void kirkwood_uart1_init(void); 48void kirkwood_uart1_init(void);
49void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay); 49void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay);
50void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts, int (*dev_ready)(struct mtd_info *)); 50void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts,
51 int (*dev_ready)(struct mtd_info *));
51void kirkwood_audio_init(void); 52void kirkwood_audio_init(void);
52void kirkwood_restart(char, const char *); 53void kirkwood_restart(char, const char *);
53void kirkwood_clk_init(void); 54void kirkwood_clk_init(void);
@@ -112,6 +113,40 @@ void km_kirkwood_init(void);
112static inline void km_kirkwood_init(void) {}; 113static inline void km_kirkwood_init(void) {};
113#endif 114#endif
114 115
116#ifdef CONFIG_MACH_MPLCEC4_DT
117void mplcec4_init(void);
118#else
119static inline void mplcec4_init(void) {};
120#endif
121
122#if defined(CONFIG_MACH_INETSPACE_V2_DT) || \
123 defined(CONFIG_MACH_NETSPACE_V2_DT) || \
124 defined(CONFIG_MACH_NETSPACE_MAX_V2_DT) || \
125 defined(CONFIG_MACH_NETSPACE_LITE_V2_DT) || \
126 defined(CONFIG_MACH_NETSPACE_MINI_V2_DT)
127void ns2_init(void);
128#else
129static inline void ns2_init(void) {};
130#endif
131
132#ifdef CONFIG_MACH_NSA310_DT
133void nsa310_init(void);
134#else
135static inline void nsa310_init(void) {};
136#endif
137
138#ifdef CONFIG_MACH_OPENBLOCKS_A6_DT
139void openblocks_a6_init(void);
140#else
141static inline void openblocks_a6_init(void) {};
142#endif
143
144#ifdef CONFIG_MACH_TOPKICK_DT
145void usi_topkick_init(void);
146#else
147static inline void usi_topkick_init(void) {};
148#endif
149
115/* early init functions not converted to fdt yet */ 150/* early init functions not converted to fdt yet */
116char *kirkwood_id(void); 151char *kirkwood_id(void);
117void kirkwood_l2_init(void); 152void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
index 0f171094187..f7304670f2f 100644
--- a/arch/arm/mach-kirkwood/cpuidle.c
+++ b/arch/arm/mach-kirkwood/cpuidle.c
@@ -64,7 +64,7 @@ static int kirkwood_init_cpuidle(void)
64 64
65 cpuidle_register_driver(&kirkwood_idle_driver); 65 cpuidle_register_driver(&kirkwood_idle_driver);
66 if (cpuidle_register_device(device)) { 66 if (cpuidle_register_device(device)) {
67 printk(KERN_ERR "kirkwood_init_cpuidle: Failed registering\n"); 67 pr_err("kirkwood_init_cpuidle: Failed registering\n");
68 return -EIO; 68 return -EIO;
69 } 69 }
70 return 0; 70 return 0;
diff --git a/arch/arm/mach-kirkwood/dockstar-setup.c b/arch/arm/mach-kirkwood/dockstar-setup.c
index 23dcb19cc2a..791a98fafa2 100644
--- a/arch/arm/mach-kirkwood/dockstar-setup.c
+++ b/arch/arm/mach-kirkwood/dockstar-setup.c
@@ -93,7 +93,7 @@ static void __init dockstar_init(void)
93 93
94 if (gpio_request(29, "USB Power Enable") != 0 || 94 if (gpio_request(29, "USB Power Enable") != 0 ||
95 gpio_direction_output(29, 1) != 0) 95 gpio_direction_output(29, 1) != 0)
96 printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n"); 96 pr_err("can't set up GPIO 29 (USB Power Enable)\n");
97 kirkwood_ehci_init(); 97 kirkwood_ehci_init();
98 98
99 kirkwood_ge00_init(&dockstar_ge00_data); 99 kirkwood_ge00_init(&dockstar_ge00_data);
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index 884703535a0..2a97a2e4163 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -14,6 +14,7 @@
14#include <mach/bridge-regs.h> 14#include <mach/bridge-regs.h>
15#include <plat/orion-gpio.h> 15#include <plat/orion-gpio.h>
16#include <plat/irq.h> 16#include <plat/irq.h>
17#include "common.h"
17 18
18static int __initdata gpio0_irqs[4] = { 19static int __initdata gpio0_irqs[4] = {
19 IRQ_KIRKWOOD_GPIO_LOW_0_7, 20 IRQ_KIRKWOOD_GPIO_LOW_0_7,
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c
index 285edab776e..489495976fc 100644
--- a/arch/arm/mach-kirkwood/lacie_v2-common.c
+++ b/arch/arm/mach-kirkwood/lacie_v2-common.c
@@ -19,6 +19,7 @@
19#include <mach/irqs.h> 19#include <mach/irqs.h>
20#include <plat/time.h> 20#include <plat/time.h>
21#include "common.h" 21#include "common.h"
22#include "lacie_v2-common.h"
22 23
23/***************************************************************************** 24/*****************************************************************************
24 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) 25 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index 0c6ad63f10c..827cde42414 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -30,8 +30,8 @@ static unsigned int __init kirkwood_variant(void)
30 if (dev == MV88F6180_DEV_ID) 30 if (dev == MV88F6180_DEV_ID)
31 return MPP_F6180_MASK; 31 return MPP_F6180_MASK;
32 32
33 printk(KERN_ERR "MPP setup: unknown kirkwood variant " 33 pr_err("MPP setup: unknown kirkwood variant (dev %#x rev %#x)\n",
34 "(dev %#x rev %#x)\n", dev, rev); 34 dev, rev);
35 return 0; 35 return 0;
36} 36}
37 37
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
index 88b0788baca..728e86d33f0 100644
--- a/arch/arm/mach-kirkwood/netspace_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c
@@ -79,7 +79,7 @@ static struct platform_device netspace_v2_gpio_buttons = {
79 .name = "gpio-keys", 79 .name = "gpio-keys",
80 .id = -1, 80 .id = -1,
81 .dev = { 81 .dev = {
82 .platform_data = &netspace_v2_button_data, 82 .platform_data = &netspace_v2_button_data,
83 }, 83 },
84}; 84};
85 85
@@ -211,7 +211,7 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {
211 MPP29_GPIO, /* Blue led (slow register) */ 211 MPP29_GPIO, /* Blue led (slow register) */
212 MPP30_GPIO, /* Blue led (command register) */ 212 MPP30_GPIO, /* Blue led (command register) */
213 MPP31_GPIO, /* Board power off */ 213 MPP31_GPIO, /* Board power off */
214 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */ 214 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */
215 MPP33_GPO, /* Fan speed (bit 2) */ 215 MPP33_GPO, /* Fan speed (bit 2) */
216 0 216 0
217}; 217};
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
index 134ef50d58f..7e81e9b586b 100644
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ b/arch/arm/mach-kirkwood/openrd-setup.c
@@ -121,14 +121,12 @@ static int __init uart1_mpp_config(void)
121 kirkwood_mpp_conf(openrd_uart1_mpp_config); 121 kirkwood_mpp_conf(openrd_uart1_mpp_config);
122 122
123 if (gpio_request(34, "SD_UART1_SEL")) { 123 if (gpio_request(34, "SD_UART1_SEL")) {
124 printk(KERN_ERR "GPIO request failed for SD/UART1 selection" 124 pr_err("GPIO request 34 failed for SD/UART1 selection\n");
125 ", gpio: 34\n");
126 return -EIO; 125 return -EIO;
127 } 126 }
128 127
129 if (gpio_request(28, "RS232_RS485_SEL")) { 128 if (gpio_request(28, "RS232_RS485_SEL")) {
130 printk(KERN_ERR "GPIO request failed for RS232/RS485 selection" 129 pr_err("GPIO request 28 failed for RS232/RS485 selection\n");
131 ", gpio# 28\n");
132 gpio_free(34); 130 gpio_free(34);
133 return -EIO; 131 return -EIO;
134 } 132 }
@@ -185,15 +183,13 @@ static void __init openrd_init(void)
185 183
186 if (uart1 <= 0) { 184 if (uart1 <= 0) {
187 if (uart1 < 0) 185 if (uart1 < 0)
188 printk(KERN_ERR "Invalid kernel parameter to select " 186 pr_err("Invalid kernel parameter to select UART1. Defaulting to SD. ERROR CODE: %d\n",
189 "UART1. Defaulting to SD. ERROR CODE: %d\n", 187 uart1);
190 uart1);
191 188
192 /* Select SD 189 /* Select SD
193 * Pin # 34: 0 => UART1, 1 => SD */ 190 * Pin # 34: 0 => UART1, 1 => SD */
194 if (gpio_request(34, "SD_UART1_SEL")) { 191 if (gpio_request(34, "SD_UART1_SEL")) {
195 printk(KERN_ERR "GPIO request failed for SD/UART1 " 192 pr_err("GPIO request 34 failed for SD/UART1 selection\n");
196 "selection, gpio: 34\n");
197 } else { 193 } else {
198 194
199 gpio_direction_output(34, 1); 195 gpio_direction_output(34, 1);
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index ec544918b12..ef102646ba9 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -26,7 +26,7 @@ static void kirkwood_enable_pcie_clk(const char *port)
26 26
27 clk = clk_get_sys("pcie", port); 27 clk = clk_get_sys("pcie", port);
28 if (IS_ERR(clk)) { 28 if (IS_ERR(clk)) {
29 printk(KERN_ERR "PCIE clock %s missing\n", port); 29 pr_err("PCIE clock %s missing\n", port);
30 return; 30 return;
31 } 31 }
32 clk_prepare_enable(clk); 32 clk_prepare_enable(clk);
@@ -168,7 +168,7 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
168 return 0; 168 return 0;
169 169
170 index = pcie_port_map[nr]; 170 index = pcie_port_map[nr];
171 printk(KERN_INFO "PCI: bus%d uses PCIe port %d\n", sys->busnr, index); 171 pr_info("PCI: bus%d uses PCIe port %d\n", sys->busnr, index);
172 172
173 pp = kzalloc(sizeof(*pp), GFP_KERNEL); 173 pp = kzalloc(sizeof(*pp), GFP_KERNEL);
174 if (!pp) 174 if (!pp)
@@ -186,7 +186,8 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
186 case 1: 186 case 1:
187 kirkwood_enable_pcie_clk("1"); 187 kirkwood_enable_pcie_clk("1");
188 pcie1_ioresources_init(pp); 188 pcie1_ioresources_init(pp);
189 pci_ioremap_io(SZ_64K * sys->busnr, KIRKWOOD_PCIE1_IO_PHYS_BASE); 189 pci_ioremap_io(SZ_64K * sys->busnr,
190 KIRKWOOD_PCIE1_IO_PHYS_BASE);
190 break; 191 break;
191 default: 192 default:
192 panic("PCIe setup: invalid controller %d", index); 193 panic("PCIe setup: invalid controller %d", index);
@@ -207,14 +208,19 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
207 return 1; 208 return 1;
208} 209}
209 210
211/*
212 * The root complex has a hardwired class of PCI_CLASS_MEMORY_OTHER, when it
213 * is operating as a root complex this needs to be switched to
214 * PCI_CLASS_BRIDGE_HOST or Linux will errantly try to process the BAR's on
215 * the device. Decoding setup is handled by the orion code.
216 */
210static void __devinit rc_pci_fixup(struct pci_dev *dev) 217static void __devinit rc_pci_fixup(struct pci_dev *dev)
211{ 218{
212 /*
213 * Prevent enumeration of root complex.
214 */
215 if (dev->bus->parent == NULL && dev->devfn == 0) { 219 if (dev->bus->parent == NULL && dev->devfn == 0) {
216 int i; 220 int i;
217 221
222 dev->class &= 0xff;
223 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
218 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 224 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
219 dev->resource[i].start = 0; 225 dev->resource[i].start = 0;
220 dev->resource[i].end = 0; 226 dev->resource[i].end = 0;
@@ -224,22 +230,6 @@ static void __devinit rc_pci_fixup(struct pci_dev *dev)
224} 230}
225DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); 231DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
226 232
227static struct pci_bus __init *
228kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys)
229{
230 struct pci_bus *bus;
231
232 if (nr < num_pcie_ports) {
233 bus = pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys,
234 &sys->resources);
235 } else {
236 bus = NULL;
237 BUG();
238 }
239
240 return bus;
241}
242
243static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot, 233static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot,
244 u8 pin) 234 u8 pin)
245{ 235{
@@ -251,19 +241,19 @@ static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot,
251 241
252static struct hw_pci kirkwood_pci __initdata = { 242static struct hw_pci kirkwood_pci __initdata = {
253 .setup = kirkwood_pcie_setup, 243 .setup = kirkwood_pcie_setup,
254 .scan = kirkwood_pcie_scan_bus,
255 .map_irq = kirkwood_pcie_map_irq, 244 .map_irq = kirkwood_pcie_map_irq,
245 .ops = &pcie_ops,
256}; 246};
257 247
258static void __init add_pcie_port(int index, void __iomem *base) 248static void __init add_pcie_port(int index, void __iomem *base)
259{ 249{
260 printk(KERN_INFO "Kirkwood PCIe port %d: ", index); 250 pr_info("Kirkwood PCIe port %d: ", index);
261 251
262 if (orion_pcie_link_up(base)) { 252 if (orion_pcie_link_up(base)) {
263 printk(KERN_INFO "link up\n"); 253 pr_info("link up\n");
264 pcie_port_map[num_pcie_ports++] = index; 254 pcie_port_map[num_pcie_ports++] = index;
265 } else 255 } else
266 printk(KERN_INFO "link down, ignoring\n"); 256 pr_info("link down, ignoring\n");
267} 257}
268 258
269void __init kirkwood_pcie_init(unsigned int portmask) 259void __init kirkwood_pcie_init(unsigned int portmask)
diff --git a/arch/arm/mach-kirkwood/sheevaplug-setup.c b/arch/arm/mach-kirkwood/sheevaplug-setup.c
index 28d0abaf4bd..8a175948b28 100644
--- a/arch/arm/mach-kirkwood/sheevaplug-setup.c
+++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c
@@ -117,7 +117,7 @@ static void __init sheevaplug_init(void)
117 117
118 if (gpio_request(29, "USB Power Enable") != 0 || 118 if (gpio_request(29, "USB Power Enable") != 0 ||
119 gpio_direction_output(29, 1) != 0) 119 gpio_direction_output(29, 1) != 0)
120 printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n"); 120 pr_err("can't set up GPIO 29 (USB Power Enable)\n");
121 kirkwood_ehci_init(); 121 kirkwood_ehci_init();
122 122
123 kirkwood_ge00_init(&sheevaplug_ge00_data); 123 kirkwood_ge00_init(&sheevaplug_ge00_data);
diff --git a/arch/arm/mach-kirkwood/t5325-setup.c b/arch/arm/mach-kirkwood/t5325-setup.c
index bad738e4404..f2daf711e72 100644
--- a/arch/arm/mach-kirkwood/t5325-setup.c
+++ b/arch/arm/mach-kirkwood/t5325-setup.c
@@ -29,7 +29,7 @@
29#include "common.h" 29#include "common.h"
30#include "mpp.h" 30#include "mpp.h"
31 31
32struct mtd_partition hp_t5325_partitions[] = { 32static struct mtd_partition hp_t5325_partitions[] = {
33 { 33 {
34 .name = "u-boot env", 34 .name = "u-boot env",
35 .size = SZ_64K, 35 .size = SZ_64K,
@@ -59,14 +59,14 @@ struct mtd_partition hp_t5325_partitions[] = {
59 }, 59 },
60}; 60};
61 61
62const struct flash_platform_data hp_t5325_flash = { 62static const struct flash_platform_data hp_t5325_flash = {
63 .type = "mx25l8005", 63 .type = "mx25l8005",
64 .name = "spi_flash", 64 .name = "spi_flash",
65 .parts = hp_t5325_partitions, 65 .parts = hp_t5325_partitions,
66 .nr_parts = ARRAY_SIZE(hp_t5325_partitions), 66 .nr_parts = ARRAY_SIZE(hp_t5325_partitions),
67}; 67};
68 68
69struct spi_board_info __initdata hp_t5325_spi_slave_info[] = { 69static struct spi_board_info __initdata hp_t5325_spi_slave_info[] = {
70 { 70 {
71 .modalias = "m25p80", 71 .modalias = "m25p80",
72 .platform_data = &hp_t5325_flash, 72 .platform_data = &hp_t5325_flash,
diff --git a/arch/arm/mach-kirkwood/ts41x-setup.c b/arch/arm/mach-kirkwood/ts41x-setup.c
index 367a9400f53..e4c61279ea8 100644
--- a/arch/arm/mach-kirkwood/ts41x-setup.c
+++ b/arch/arm/mach-kirkwood/ts41x-setup.c
@@ -170,8 +170,7 @@ static int __init ts41x_pci_init(void)
170 else 170 else
171 kirkwood_pcie_init(KW_PCIE0); 171 kirkwood_pcie_init(KW_PCIE0);
172 } 172 }
173 173 return 0;
174 return 0;
175} 174}
176subsys_initcall(ts41x_pci_init); 175subsys_initcall(ts41x_pci_init);
177 176
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.c b/arch/arm/mach-kirkwood/tsx1x-common.c
index 8943ede29b4..cec87cef76c 100644
--- a/arch/arm/mach-kirkwood/tsx1x-common.c
+++ b/arch/arm/mach-kirkwood/tsx1x-common.c
@@ -7,6 +7,7 @@
7#include <linux/serial_reg.h> 7#include <linux/serial_reg.h>
8#include <mach/kirkwood.h> 8#include <mach/kirkwood.h>
9#include "common.h" 9#include "common.h"
10#include "tsx1x-common.h"
10 11
11/* 12/*
12 * QNAP TS-x1x Boards flash 13 * QNAP TS-x1x Boards flash
@@ -29,7 +30,7 @@
29 * 30 *
30 ***************************************************************************/ 31 ***************************************************************************/
31 32
32struct mtd_partition qnap_tsx1x_partitions[] = { 33static struct mtd_partition qnap_tsx1x_partitions[] = {
33 { 34 {
34 .name = "U-Boot", 35 .name = "U-Boot",
35 .size = 0x00080000, 36 .size = 0x00080000,
@@ -58,14 +59,14 @@ struct mtd_partition qnap_tsx1x_partitions[] = {
58 }, 59 },
59}; 60};
60 61
61const struct flash_platform_data qnap_tsx1x_flash = { 62static const struct flash_platform_data qnap_tsx1x_flash = {
62 .type = "m25p128", 63 .type = "m25p128",
63 .name = "spi_flash", 64 .name = "spi_flash",
64 .parts = qnap_tsx1x_partitions, 65 .parts = qnap_tsx1x_partitions,
65 .nr_parts = ARRAY_SIZE(qnap_tsx1x_partitions), 66 .nr_parts = ARRAY_SIZE(qnap_tsx1x_partitions),
66}; 67};
67 68
68struct spi_board_info __initdata qnap_tsx1x_spi_slave_info[] = { 69static struct spi_board_info __initdata qnap_tsx1x_spi_slave_info[] = {
69 { 70 {
70 .modalias = "m25p80", 71 .modalias = "m25p80",
71 .platform_data = &qnap_tsx1x_flash, 72 .platform_data = &qnap_tsx1x_flash,
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c
index f48c2e961b8..dd5d6f532e8 100644
--- a/arch/arm/mach-lpc32xx/clock.c
+++ b/arch/arm/mach-lpc32xx/clock.c
@@ -585,6 +585,13 @@ static struct clk clk_timer3 = {
585 .enable_mask = LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN, 585 .enable_mask = LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN,
586 .get_rate = local_return_parent_rate, 586 .get_rate = local_return_parent_rate,
587}; 587};
588static struct clk clk_mpwm = {
589 .parent = &clk_pclk,
590 .enable = local_onoff_enable,
591 .enable_reg = LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1,
592 .enable_mask = LPC32XX_CLKPWR_TMRPWMCLK_MPWM_EN,
593 .get_rate = local_return_parent_rate,
594};
588static struct clk clk_wdt = { 595static struct clk clk_wdt = {
589 .parent = &clk_pclk, 596 .parent = &clk_pclk,
590 .enable = local_onoff_enable, 597 .enable = local_onoff_enable,
@@ -1202,6 +1209,7 @@ static struct clk_lookup lookups[] = {
1202 CLKDEV_INIT("pl08xdmac", NULL, &clk_dma), 1209 CLKDEV_INIT("pl08xdmac", NULL, &clk_dma),
1203 CLKDEV_INIT("4003c000.watchdog", NULL, &clk_wdt), 1210 CLKDEV_INIT("4003c000.watchdog", NULL, &clk_wdt),
1204 CLKDEV_INIT("4005c000.pwm", NULL, &clk_pwm), 1211 CLKDEV_INIT("4005c000.pwm", NULL, &clk_pwm),
1212 CLKDEV_INIT("400e8000.mpwm", NULL, &clk_mpwm),
1205 CLKDEV_INIT(NULL, "uart3_ck", &clk_uart3), 1213 CLKDEV_INIT(NULL, "uart3_ck", &clk_uart3),
1206 CLKDEV_INIT(NULL, "uart4_ck", &clk_uart4), 1214 CLKDEV_INIT(NULL, "uart4_ck", &clk_uart4),
1207 CLKDEV_INIT(NULL, "uart5_ck", &clk_uart5), 1215 CLKDEV_INIT(NULL, "uart5_ck", &clk_uart5),
diff --git a/arch/arm/mach-lpc32xx/include/mach/platform.h b/arch/arm/mach-lpc32xx/include/mach/platform.h
index acc4aabf1c7..b5612a1d183 100644
--- a/arch/arm/mach-lpc32xx/include/mach/platform.h
+++ b/arch/arm/mach-lpc32xx/include/mach/platform.h
@@ -515,6 +515,7 @@
515/* 515/*
516 * clkpwr_timers_pwms_clk_ctrl_1 register definitions 516 * clkpwr_timers_pwms_clk_ctrl_1 register definitions
517 */ 517 */
518#define LPC32XX_CLKPWR_TMRPWMCLK_MPWM_EN 0x40
518#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN 0x20 519#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN 0x20
519#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER2_EN 0x10 520#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER2_EN 0x10
520#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN 0x08 521#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN 0x08
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index 3c633275335..9ecb8f9c4ef 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -412,7 +412,6 @@ static const struct of_device_id mic_of_match[] __initconst = {
412void __init lpc32xx_init_irq(void) 412void __init lpc32xx_init_irq(void)
413{ 413{
414 unsigned int i; 414 unsigned int i;
415 int irq_base;
416 415
417 /* Setup MIC */ 416 /* Setup MIC */
418 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE)); 417 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE));
@@ -443,15 +442,6 @@ void __init lpc32xx_init_irq(void)
443 lpc32xx_set_default_mappings(SIC1_APR_DEFAULT, SIC1_ATR_DEFAULT, 32); 442 lpc32xx_set_default_mappings(SIC1_APR_DEFAULT, SIC1_ATR_DEFAULT, 32);
444 lpc32xx_set_default_mappings(SIC2_APR_DEFAULT, SIC2_ATR_DEFAULT, 64); 443 lpc32xx_set_default_mappings(SIC2_APR_DEFAULT, SIC2_ATR_DEFAULT, 64);
445 444
446 /* mask all interrupts except SUBIRQ */
447 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE));
448 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE));
449 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));
450
451 /* MIC SUBIRQx interrupts will route handling to the chain handlers */
452 irq_set_chained_handler(IRQ_LPC32XX_SUB1IRQ, lpc32xx_sic1_handler);
453 irq_set_chained_handler(IRQ_LPC32XX_SUB2IRQ, lpc32xx_sic2_handler);
454
455 /* Initially disable all wake events */ 445 /* Initially disable all wake events */
456 __raw_writel(0, LPC32XX_CLKPWR_P01_ER); 446 __raw_writel(0, LPC32XX_CLKPWR_P01_ER);
457 __raw_writel(0, LPC32XX_CLKPWR_INT_ER); 447 __raw_writel(0, LPC32XX_CLKPWR_INT_ER);
@@ -475,16 +465,13 @@ void __init lpc32xx_init_irq(void)
475 465
476 of_irq_init(mic_of_match); 466 of_irq_init(mic_of_match);
477 467
478 irq_base = irq_alloc_descs(-1, 0, NR_IRQS, 0);
479 if (irq_base < 0) {
480 pr_warn("Cannot allocate irq_descs, assuming pre-allocated\n");
481 irq_base = 0;
482 }
483
484 lpc32xx_mic_domain = irq_domain_add_legacy(lpc32xx_mic_np, NR_IRQS, 468 lpc32xx_mic_domain = irq_domain_add_legacy(lpc32xx_mic_np, NR_IRQS,
485 irq_base, 0, 469 0, 0, &irq_domain_simple_ops,
486 &irq_domain_simple_ops,
487 NULL); 470 NULL);
488 if (!lpc32xx_mic_domain) 471 if (!lpc32xx_mic_domain)
489 panic("Unable to add MIC irq domain\n"); 472 panic("Unable to add MIC irq domain\n");
473
474 /* MIC SUBIRQx interrupts will route handling to the chain handlers */
475 irq_set_chained_handler(IRQ_LPC32XX_SUB1IRQ, lpc32xx_sic1_handler);
476 irq_set_chained_handler(IRQ_LPC32XX_SUB2IRQ, lpc32xx_sic2_handler);
490} 477}
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 178d4daa5e1..ebdda8346a2 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -89,6 +89,8 @@ config MACH_MMP_DT
89 select CPU_PXA168 89 select CPU_PXA168
90 select CPU_PXA910 90 select CPU_PXA910
91 select USE_OF 91 select USE_OF
92 select PINCTRL
93 select PINCTRL_SINGLE
92 help 94 help
93 Include support for Marvell MMP2 based platforms using 95 Include support for Marvell MMP2 based platforms using
94 the device tree. Needn't select any other machine while 96 the device tree. Needn't select any other machine while
@@ -99,6 +101,8 @@ config MACH_MMP2_DT
99 depends on !CPU_MOHAWK 101 depends on !CPU_MOHAWK
100 select CPU_MMP2 102 select CPU_MMP2
101 select USE_OF 103 select USE_OF
104 select PINCTRL
105 select PINCTRL_SINGLE
102 help 106 help
103 Include support for Marvell MMP2 based platforms using 107 Include support for Marvell MMP2 based platforms using
104 the device tree. 108 the device tree.
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 4748ec551a6..98070370d60 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -100,6 +100,25 @@ static struct fb_videomode apx4devkit_video_modes[] = {
100 }, 100 },
101}; 101};
102 102
103static struct fb_videomode apf28dev_video_modes[] = {
104 {
105 .name = "LW700",
106 .refresh = 60,
107 .xres = 800,
108 .yres = 480,
109 .pixclock = 30303, /* picosecond */
110 .left_margin = 96,
111 .right_margin = 96, /* at least 3 & 1 */
112 .upper_margin = 0x14,
113 .lower_margin = 0x15,
114 .hsync_len = 64,
115 .vsync_len = 4,
116 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT |
117 FB_SYNC_DATA_ENABLE_HIGH_ACT |
118 FB_SYNC_DOTCLK_FAILING_ACT,
119 },
120};
121
103static struct mxsfb_platform_data mxsfb_pdata __initdata; 122static struct mxsfb_platform_data mxsfb_pdata __initdata;
104 123
105/* 124/*
@@ -160,6 +179,7 @@ static struct sys_timer imx28_timer = {
160enum mac_oui { 179enum mac_oui {
161 OUI_FSL, 180 OUI_FSL,
162 OUI_DENX, 181 OUI_DENX,
182 OUI_CRYSTALFONTZ,
163}; 183};
164 184
165static void __init update_fec_mac_prop(enum mac_oui oui) 185static void __init update_fec_mac_prop(enum mac_oui oui)
@@ -175,8 +195,12 @@ static void __init update_fec_mac_prop(enum mac_oui oui)
175 np = of_find_compatible_node(from, NULL, "fsl,imx28-fec"); 195 np = of_find_compatible_node(from, NULL, "fsl,imx28-fec");
176 if (!np) 196 if (!np)
177 return; 197 return;
198
178 from = np; 199 from = np;
179 200
201 if (of_get_property(np, "local-mac-address", NULL))
202 continue;
203
180 newmac = kzalloc(sizeof(*newmac) + 6, GFP_KERNEL); 204 newmac = kzalloc(sizeof(*newmac) + 6, GFP_KERNEL);
181 if (!newmac) 205 if (!newmac)
182 return; 206 return;
@@ -205,6 +229,11 @@ static void __init update_fec_mac_prop(enum mac_oui oui)
205 macaddr[1] = 0xe5; 229 macaddr[1] = 0xe5;
206 macaddr[2] = 0x4e; 230 macaddr[2] = 0x4e;
207 break; 231 break;
232 case OUI_CRYSTALFONTZ:
233 macaddr[0] = 0x58;
234 macaddr[1] = 0xb9;
235 macaddr[2] = 0xe1;
236 break;
208 } 237 }
209 val = ocotp[i]; 238 val = ocotp[i];
210 macaddr[3] = (val >> 16) & 0xff; 239 macaddr[3] = (val >> 16) & 0xff;
@@ -261,6 +290,11 @@ static void __init m28evk_init(void)
261 mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; 290 mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT;
262} 291}
263 292
293static void __init sc_sps1_init(void)
294{
295 enable_clk_enet_out();
296}
297
264static int apx4devkit_phy_fixup(struct phy_device *phy) 298static int apx4devkit_phy_fixup(struct phy_device *phy)
265{ 299{
266 phy->dev_flags |= MICREL_PHY_50MHZ_CLK; 300 phy->dev_flags |= MICREL_PHY_50MHZ_CLK;
@@ -355,6 +389,22 @@ static void __init tx28_post_init(void)
355 pinctrl_put(pctl); 389 pinctrl_put(pctl);
356} 390}
357 391
392static void __init cfa10049_init(void)
393{
394 enable_clk_enet_out();
395 update_fec_mac_prop(OUI_CRYSTALFONTZ);
396}
397
398static void __init apf28_init(void)
399{
400 enable_clk_enet_out();
401
402 mxsfb_pdata.mode_list = apf28dev_video_modes;
403 mxsfb_pdata.mode_count = ARRAY_SIZE(apf28dev_video_modes);
404 mxsfb_pdata.default_bpp = 16;
405 mxsfb_pdata.ld_intf_width = STMLCDIF_16BIT;
406}
407
358static void __init mxs_machine_init(void) 408static void __init mxs_machine_init(void)
359{ 409{
360 if (of_machine_is_compatible("fsl,imx28-evk")) 410 if (of_machine_is_compatible("fsl,imx28-evk"))
@@ -365,6 +415,12 @@ static void __init mxs_machine_init(void)
365 m28evk_init(); 415 m28evk_init();
366 else if (of_machine_is_compatible("bluegiga,apx4devkit")) 416 else if (of_machine_is_compatible("bluegiga,apx4devkit"))
367 apx4devkit_init(); 417 apx4devkit_init();
418 else if (of_machine_is_compatible("crystalfontz,cfa10049"))
419 cfa10049_init();
420 else if (of_machine_is_compatible("armadeus,imx28-apf28"))
421 apf28_init();
422 else if (of_machine_is_compatible("schulercontrol,imx28-sps1"))
423 sc_sps1_init();
368 424
369 of_platform_populate(NULL, of_default_bus_match_table, 425 of_platform_populate(NULL, of_default_bus_match_table,
370 mxs_auxdata_lookup, NULL); 426 mxs_auxdata_lookup, NULL);
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index 7c379261339..856f4c79606 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -29,6 +29,7 @@
29#include <linux/of_irq.h> 29#include <linux/of_irq.h>
30 30
31#include <asm/mach/time.h> 31#include <asm/mach/time.h>
32#include <asm/sched_clock.h>
32#include <mach/mxs.h> 33#include <mach/mxs.h>
33#include <mach/common.h> 34#include <mach/common.h>
34 35
@@ -233,15 +234,22 @@ static struct clocksource clocksource_mxs = {
233 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 234 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
234}; 235};
235 236
237static u32 notrace mxs_read_sched_clock_v2(void)
238{
239 return ~readl_relaxed(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1));
240}
241
236static int __init mxs_clocksource_init(struct clk *timer_clk) 242static int __init mxs_clocksource_init(struct clk *timer_clk)
237{ 243{
238 unsigned int c = clk_get_rate(timer_clk); 244 unsigned int c = clk_get_rate(timer_clk);
239 245
240 if (timrot_is_v1()) 246 if (timrot_is_v1())
241 clocksource_register_hz(&clocksource_mxs, c); 247 clocksource_register_hz(&clocksource_mxs, c);
242 else 248 else {
243 clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1), 249 clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1),
244 "mxs_timer", c, 200, 32, clocksource_mmio_readl_down); 250 "mxs_timer", c, 200, 32, clocksource_mmio_readl_down);
251 setup_sched_clock(mxs_read_sched_clock_v2, 32, c);
252 }
245 253
246 return 0; 254 return 0;
247} 255}
diff --git a/arch/arm/mach-netx/xc.c b/arch/arm/mach-netx/xc.c
index e4cfb7e5361..f1c972d87ba 100644
--- a/arch/arm/mach-netx/xc.c
+++ b/arch/arm/mach-netx/xc.c
@@ -136,7 +136,7 @@ int xc_request_firmware(struct xc *x)
136 if (head->magic != 0x4e657458) { 136 if (head->magic != 0x4e657458) {
137 if (head->magic == 0x5874654e) { 137 if (head->magic == 0x5874654e) {
138 dev_err(x->dev, 138 dev_err(x->dev,
139 "firmware magic is 'XteN'. Endianess problems?\n"); 139 "firmware magic is 'XteN'. Endianness problems?\n");
140 ret = -ENODEV; 140 ret = -ENODEV;
141 goto exit_release_firmware; 141 goto exit_release_firmware;
142 } 142 }
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index c744946ef02..706dc5727bb 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -4,7 +4,7 @@ menu "Nomadik boards"
4 4
5config MACH_NOMADIK_8815NHK 5config MACH_NOMADIK_8815NHK
6 bool "ST 8815 Nomadik Hardware Kit (evaluation board)" 6 bool "ST 8815 Nomadik Hardware Kit (evaluation board)"
7 select HAS_MTU 7 select CLKSRC_NOMADIK_MTU
8 select NOMADIK_8815 8 select NOMADIK_8815
9 9
10endmenu 10endmenu
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index bfa1eab91f4..5ccdf53c5a9 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -24,20 +24,17 @@
24#include <linux/i2c.h> 24#include <linux/i2c.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/pinctrl/machine.h> 26#include <linux/pinctrl/machine.h>
27#include <linux/platform_data/pinctrl-nomadik.h>
28#include <linux/platform_data/clocksource-nomadik-mtu.h>
29#include <linux/platform_data/mtd-nomadik-nand.h>
27#include <asm/hardware/vic.h> 30#include <asm/hardware/vic.h>
28#include <asm/sizes.h> 31#include <asm/sizes.h>
29#include <asm/mach-types.h> 32#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
31#include <asm/mach/irq.h>
32#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
33#include <asm/mach/time.h> 35#include <asm/mach/time.h>
34
35#include <plat/gpio-nomadik.h>
36#include <plat/mtu.h>
37#include <plat/pincfg.h>
38
39#include <linux/platform_data/mtd-nomadik-nand.h>
40#include <mach/fsmc.h> 36#include <mach/fsmc.h>
37#include <mach/irqs.h>
41 38
42#include "cpu-8815.h" 39#include "cpu-8815.h"
43 40
@@ -261,7 +258,7 @@ static void __init nomadik_timer_init(void)
261 src_cr |= SRC_CR_INIT_VAL; 258 src_cr |= SRC_CR_INIT_VAL;
262 writel(src_cr, io_p2v(NOMADIK_SRC_BASE)); 259 writel(src_cr, io_p2v(NOMADIK_SRC_BASE));
263 260
264 nmdk_timer_init(io_p2v(NOMADIK_MTU0_BASE)); 261 nmdk_timer_init(io_p2v(NOMADIK_MTU0_BASE), IRQ_MTU0);
265} 262}
266 263
267static struct sys_timer nomadik_timer = { 264static struct sys_timer nomadik_timer = {
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index b617eaed0ce..1273931303f 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -26,8 +26,8 @@
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/platform_data/clk-nomadik.h> 28#include <linux/platform_data/clk-nomadik.h>
29#include <linux/platform_data/pinctrl-nomadik.h>
29 30
30#include <plat/gpio-nomadik.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/irqs.h> 32#include <mach/irqs.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c
index 6d14454d460..0c2f6628299 100644
--- a/arch/arm/mach-nomadik/i2c-8815nhk.c
+++ b/arch/arm/mach-nomadik/i2c-8815nhk.c
@@ -4,8 +4,7 @@
4#include <linux/i2c-algo-bit.h> 4#include <linux/i2c-algo-bit.h>
5#include <linux/i2c-gpio.h> 5#include <linux/i2c-gpio.h>
6#include <linux/platform_device.h> 6#include <linux/platform_device.h>
7#include <plat/gpio-nomadik.h> 7#include <linux/platform_data/pinctrl-nomadik.h>
8#include <plat/pincfg.h>
9 8
10/* 9/*
11 * There are two busses in the 8815NHK. 10 * There are two busses in the 8815NHK.
diff --git a/arch/arm/mach-nomadik/include/mach/irqs.h b/arch/arm/mach-nomadik/include/mach/irqs.h
index a118e615f86..b549d057154 100644
--- a/arch/arm/mach-nomadik/include/mach/irqs.h
+++ b/arch/arm/mach-nomadik/include/mach/irqs.h
@@ -72,7 +72,7 @@
72#define NOMADIK_NR_GPIO 128 /* last 4 not wired to pins */ 72#define NOMADIK_NR_GPIO 128 /* last 4 not wired to pins */
73#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + NOMADIK_GPIO_OFFSET) 73#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + NOMADIK_GPIO_OFFSET)
74#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - NOMADIK_GPIO_OFFSET) 74#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - NOMADIK_GPIO_OFFSET)
75#define NR_IRQS NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO) 75#define NOMADIK_NR_IRQS NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO)
76 76
77/* Following two are used by entry_macro.S, to access our dual-vic */ 77/* Following two are used by entry_macro.S, to access our dual-vic */
78#define VIC_REG_IRQSR0 0 78#define VIC_REG_IRQSR0 0
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index cd169c38616..f0e69cbc5ba 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,8 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o 6obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
7 serial.o devices.o dma.o
7obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o 8obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
8 9
9ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 10ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index e255164ff08..a8fce3ccc70 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -625,7 +625,6 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
625 .atag_offset = 0x100, 625 .atag_offset = 0x100,
626 .map_io = ams_delta_map_io, 626 .map_io = ams_delta_map_io,
627 .init_early = omap1_init_early, 627 .init_early = omap1_init_early,
628 .reserve = omap_reserve,
629 .init_irq = omap1_init_irq, 628 .init_irq = omap1_init_irq,
630 .init_machine = ams_delta_init, 629 .init_machine = ams_delta_init,
631 .init_late = ams_delta_init_late, 630 .init_late = ams_delta_init_late,
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 4b6de70c47a..560a7dcf0a5 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -27,16 +27,16 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <plat/tc.h> 30#include <mach/tc.h>
31#include <mach/mux.h> 31#include <mach/mux.h>
32#include <mach/flash.h> 32#include <mach/flash.h>
33#include <plat/fpga.h>
34#include <linux/platform_data/keypad-omap.h> 33#include <linux/platform_data/keypad-omap.h>
35 34
36#include <mach/hardware.h> 35#include <mach/hardware.h>
37 36
38#include "iomap.h" 37#include "iomap.h"
39#include "common.h" 38#include "common.h"
39#include "fpga.h"
40 40
41/* fsample is pretty close to p2-sample */ 41/* fsample is pretty close to p2-sample */
42 42
@@ -123,9 +123,9 @@ static struct resource smc91x_resources[] = {
123 123
124static void __init fsample_init_smc91x(void) 124static void __init fsample_init_smc91x(void)
125{ 125{
126 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET); 126 __raw_writeb(1, H2P2_DBG_FPGA_LAN_RESET);
127 mdelay(50); 127 mdelay(50);
128 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1, 128 __raw_writeb(__raw_readb(H2P2_DBG_FPGA_LAN_RESET) & ~1,
129 H2P2_DBG_FPGA_LAN_RESET); 129 H2P2_DBG_FPGA_LAN_RESET);
130 mdelay(50); 130 mdelay(50);
131} 131}
@@ -307,8 +307,7 @@ static void __init omap_fsample_init(void)
307 307
308 fsample_init_smc91x(); 308 fsample_init_smc91x();
309 309
310 if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0) 310 BUG_ON(gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0);
311 BUG();
312 gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN); 311 gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
313 312
314 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 313 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
@@ -362,7 +361,6 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
362 .atag_offset = 0x100, 361 .atag_offset = 0x100,
363 .map_io = omap_fsample_map_io, 362 .map_io = omap_fsample_map_io,
364 .init_early = omap1_init_early, 363 .init_early = omap1_init_early,
365 .reserve = omap_reserve,
366 .init_irq = omap1_init_irq, 364 .init_irq = omap1_init_irq,
367 .init_machine = omap_fsample_init, 365 .init_machine = omap_fsample_init,
368 .init_late = omap1_init_late, 366 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 4ec579fdd36..608e7d2a277 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -81,7 +81,6 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
81 .atag_offset = 0x100, 81 .atag_offset = 0x100,
82 .map_io = omap16xx_map_io, 82 .map_io = omap16xx_map_io,
83 .init_early = omap1_init_early, 83 .init_early = omap1_init_early,
84 .reserve = omap_reserve,
85 .init_irq = omap1_init_irq, 84 .init_irq = omap1_init_irq,
86 .init_machine = omap_generic_init, 85 .init_machine = omap_generic_init,
87 .init_late = omap1_init_late, 86 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index e1362ce4849..7119ef28e0a 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -13,12 +13,11 @@
13 */ 13 */
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16#include <linux/platform_data/gpio-omap.h>
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h>
20
21#include "board-h2.h" 19#include "board-h2.h"
20#include "mmc.h"
22 21
23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
24 23
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 376f7f29ef7..2274bd677ef 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -39,8 +39,8 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include <mach/mux.h> 41#include <mach/mux.h>
42#include <plat/dma.h> 42#include <linux/omap-dma.h>
43#include <plat/tc.h> 43#include <mach/tc.h>
44#include <mach/irda.h> 44#include <mach/irda.h>
45#include <linux/platform_data/keypad-omap.h> 45#include <linux/platform_data/keypad-omap.h>
46#include <mach/flash.h> 46#include <mach/flash.h>
@@ -50,6 +50,7 @@
50 50
51#include "common.h" 51#include "common.h"
52#include "board-h2.h" 52#include "board-h2.h"
53#include "dma.h"
53 54
54/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 55/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
55#define OMAP1610_ETHR_START 0x04000300 56#define OMAP1610_ETHR_START 0x04000300
@@ -411,8 +412,7 @@ static void __init h2_init(void)
411 412
412 h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS; 413 h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
413 h2_nand_resource.end += SZ_4K - 1; 414 h2_nand_resource.end += SZ_4K - 1;
414 if (gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0) 415 BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
415 BUG();
416 gpio_direction_input(H2_NAND_RB_GPIO_PIN); 416 gpio_direction_input(H2_NAND_RB_GPIO_PIN);
417 417
418 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 418 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
@@ -458,7 +458,6 @@ MACHINE_START(OMAP_H2, "TI-H2")
458 .atag_offset = 0x100, 458 .atag_offset = 0x100,
459 .map_io = omap16xx_map_io, 459 .map_io = omap16xx_map_io,
460 .init_early = omap1_init_early, 460 .init_early = omap1_init_early,
461 .reserve = omap_reserve,
462 .init_irq = omap1_init_irq, 461 .init_irq = omap1_init_irq,
463 .init_machine = h2_init, 462 .init_machine = h2_init,
464 .init_late = omap1_init_late, 463 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index c74daace8cd..17d77914d76 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -16,9 +16,8 @@
16 16
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h>
20
21#include "board-h3.h" 19#include "board-h3.h"
20#include "mmc.h"
22 21
23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
24 23
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index ededdb7ef28..1051935f0aa 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -41,9 +41,9 @@
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42 42
43#include <mach/mux.h> 43#include <mach/mux.h>
44#include <plat/tc.h> 44#include <mach/tc.h>
45#include <linux/platform_data/keypad-omap.h> 45#include <linux/platform_data/keypad-omap.h>
46#include <plat/dma.h> 46#include <linux/omap-dma.h>
47#include <mach/flash.h> 47#include <mach/flash.h>
48 48
49#include <mach/hardware.h> 49#include <mach/hardware.h>
@@ -406,8 +406,7 @@ static void __init h3_init(void)
406 406
407 nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS; 407 nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS;
408 nand_resource.end += SZ_4K - 1; 408 nand_resource.end += SZ_4K - 1;
409 if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0) 409 BUG_ON(gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0);
410 BUG();
411 gpio_direction_input(H3_NAND_RB_GPIO_PIN); 410 gpio_direction_input(H3_NAND_RB_GPIO_PIN);
412 411
413 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */ 412 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */
@@ -452,7 +451,6 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
452 .atag_offset = 0x100, 451 .atag_offset = 0x100,
453 .map_io = omap16xx_map_io, 452 .map_io = omap16xx_map_io,
454 .init_early = omap1_init_early, 453 .init_early = omap1_init_early,
455 .reserve = omap_reserve,
456 .init_irq = omap1_init_irq, 454 .init_irq = omap1_init_irq,
457 .init_machine = h3_init, 455 .init_machine = h3_init,
458 .init_late = omap1_init_late, 456 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 87ab2086ef9..356f816c84a 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -43,7 +43,7 @@
43#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
44 44
45#include <mach/omap7xx.h> 45#include <mach/omap7xx.h>
46#include <plat/mmc.h> 46#include "mmc.h"
47 47
48#include <mach/irqs.h> 48#include <mach/irqs.h>
49#include <mach/usb.h> 49#include <mach/usb.h>
@@ -600,7 +600,6 @@ MACHINE_START(HERALD, "HTC Herald")
600 .atag_offset = 0x100, 600 .atag_offset = 0x100,
601 .map_io = htcherald_map_io, 601 .map_io = htcherald_map_io,
602 .init_early = omap1_init_early, 602 .init_early = omap1_init_early,
603 .reserve = omap_reserve,
604 .init_irq = omap1_init_irq, 603 .init_irq = omap1_init_irq,
605 .init_machine = htcherald_init, 604 .init_machine = htcherald_init,
606 .init_late = omap1_init_late, 605 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index db5f7d2976e..f8033fab0f8 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -33,16 +33,15 @@
33 33
34#include <mach/mux.h> 34#include <mach/mux.h>
35#include <mach/flash.h> 35#include <mach/flash.h>
36#include <plat/fpga.h> 36#include <mach/tc.h>
37#include <plat/tc.h>
38#include <linux/platform_data/keypad-omap.h> 37#include <linux/platform_data/keypad-omap.h>
39#include <plat/mmc.h>
40 38
41#include <mach/hardware.h> 39#include <mach/hardware.h>
42#include <mach/usb.h> 40#include <mach/usb.h>
43 41
44#include "iomap.h" 42#include "iomap.h"
45#include "common.h" 43#include "common.h"
44#include "mmc.h"
46 45
47/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 46/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
48#define INNOVATOR1610_ETHR_START 0x04000300 47#define INNOVATOR1610_ETHR_START 0x04000300
@@ -215,7 +214,7 @@ static struct platform_device *innovator1510_devices[] __initdata = {
215 214
216static int innovator_get_pendown_state(void) 215static int innovator_get_pendown_state(void)
217{ 216{
218 return !(fpga_read(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5)); 217 return !(__raw_readb(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
219} 218}
220 219
221static const struct ads7846_platform_data innovator1510_ts_info = { 220static const struct ads7846_platform_data innovator1510_ts_info = {
@@ -279,7 +278,7 @@ static struct platform_device *innovator1610_devices[] __initdata = {
279static void __init innovator_init_smc91x(void) 278static void __init innovator_init_smc91x(void)
280{ 279{
281 if (cpu_is_omap1510()) { 280 if (cpu_is_omap1510()) {
282 fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1, 281 __raw_writeb(__raw_readb(OMAP1510_FPGA_RST) & ~1,
283 OMAP1510_FPGA_RST); 282 OMAP1510_FPGA_RST);
284 udelay(750); 283 udelay(750);
285 } else { 284 } else {
@@ -335,10 +334,10 @@ static int mmc_set_power(struct device *dev, int slot, int power_on,
335 int vdd) 334 int vdd)
336{ 335{
337 if (power_on) 336 if (power_on)
338 fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3), 337 __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER) | (1 << 3),
339 OMAP1510_FPGA_POWER); 338 OMAP1510_FPGA_POWER);
340 else 339 else
341 fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3), 340 __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER) & ~(1 << 3),
342 OMAP1510_FPGA_POWER); 341 OMAP1510_FPGA_POWER);
343 342
344 return 0; 343 return 0;
@@ -390,14 +389,14 @@ static void __init innovator_init(void)
390 omap_cfg_reg(UART3_TX); 389 omap_cfg_reg(UART3_TX);
391 omap_cfg_reg(UART3_RX); 390 omap_cfg_reg(UART3_RX);
392 391
393 reg = fpga_read(OMAP1510_FPGA_POWER); 392 reg = __raw_readb(OMAP1510_FPGA_POWER);
394 reg |= OMAP1510_FPGA_PCR_COM1_EN; 393 reg |= OMAP1510_FPGA_PCR_COM1_EN;
395 fpga_write(reg, OMAP1510_FPGA_POWER); 394 __raw_writeb(reg, OMAP1510_FPGA_POWER);
396 udelay(10); 395 udelay(10);
397 396
398 reg = fpga_read(OMAP1510_FPGA_POWER); 397 reg = __raw_readb(OMAP1510_FPGA_POWER);
399 reg |= OMAP1510_FPGA_PCR_COM2_EN; 398 reg |= OMAP1510_FPGA_PCR_COM2_EN;
400 fpga_write(reg, OMAP1510_FPGA_POWER); 399 __raw_writeb(reg, OMAP1510_FPGA_POWER);
401 udelay(10); 400 udelay(10);
402 401
403 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices)); 402 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
@@ -437,6 +436,7 @@ static void __init innovator_init(void)
437 */ 436 */
438static void __init innovator_map_io(void) 437static void __init innovator_map_io(void)
439{ 438{
439#ifdef CONFIG_ARCH_OMAP15XX
440 omap15xx_map_io(); 440 omap15xx_map_io();
441 441
442 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc)); 442 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
@@ -444,9 +444,10 @@ static void __init innovator_map_io(void)
444 444
445 /* Dump the Innovator FPGA rev early - useful info for support. */ 445 /* Dump the Innovator FPGA rev early - useful info for support. */
446 pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n", 446 pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n",
447 fpga_read(OMAP1510_FPGA_REV_HIGH), 447 __raw_readb(OMAP1510_FPGA_REV_HIGH),
448 fpga_read(OMAP1510_FPGA_REV_LOW), 448 __raw_readb(OMAP1510_FPGA_REV_LOW),
449 fpga_read(OMAP1510_FPGA_BOARD_REV)); 449 __raw_readb(OMAP1510_FPGA_BOARD_REV));
450#endif
450} 451}
451 452
452MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") 453MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
@@ -454,7 +455,6 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
454 .atag_offset = 0x100, 455 .atag_offset = 0x100,
455 .map_io = innovator_map_io, 456 .map_io = innovator_map_io,
456 .init_early = omap1_init_early, 457 .init_early = omap1_init_early,
457 .reserve = omap_reserve,
458 .init_irq = omap1_init_irq, 458 .init_irq = omap1_init_irq,
459 .init_machine = innovator_init, 459 .init_machine = innovator_init,
460 .init_late = omap1_init_late, 460 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 7d5c06d6a52..3e8ead67e45 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -29,13 +29,13 @@
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <mach/mux.h> 31#include <mach/mux.h>
32#include <plat/mmc.h>
33#include <plat/clock.h>
34 32
35#include <mach/hardware.h> 33#include <mach/hardware.h>
36#include <mach/usb.h> 34#include <mach/usb.h>
37 35
38#include "common.h" 36#include "common.h"
37#include "clock.h"
38#include "mmc.h"
39 39
40#define ADS7846_PENDOWN_GPIO 15 40#define ADS7846_PENDOWN_GPIO 15
41 41
@@ -251,7 +251,6 @@ MACHINE_START(NOKIA770, "Nokia 770")
251 .atag_offset = 0x100, 251 .atag_offset = 0x100,
252 .map_io = omap16xx_map_io, 252 .map_io = omap16xx_map_io,
253 .init_early = omap1_init_early, 253 .init_early = omap1_init_early,
254 .reserve = omap_reserve,
255 .init_irq = omap1_init_irq, 254 .init_irq = omap1_init_irq,
256 .init_machine = omap_nokia770_init, 255 .init_machine = omap_nokia770_init,
257 .init_late = omap1_init_late, 256 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 5973945a874..872ea47cd28 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -48,7 +48,7 @@
48 48
49#include <mach/flash.h> 49#include <mach/flash.h>
50#include <mach/mux.h> 50#include <mach/mux.h>
51#include <plat/tc.h> 51#include <mach/tc.h>
52 52
53#include <mach/hardware.h> 53#include <mach/hardware.h>
54#include <mach/usb.h> 54#include <mach/usb.h>
@@ -606,7 +606,6 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
606 .atag_offset = 0x100, 606 .atag_offset = 0x100,
607 .map_io = omap16xx_map_io, 607 .map_io = omap16xx_map_io,
608 .init_early = omap1_init_early, 608 .init_early = omap1_init_early,
609 .reserve = omap_reserve,
610 .init_irq = omap1_init_irq, 609 .init_irq = omap1_init_irq,
611 .init_machine = osk_init, 610 .init_machine = osk_init,
612 .init_late = omap1_init_late, 611 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 1c578d58923..c33dceb4660 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -36,8 +36,8 @@
36 36
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/tc.h> 39#include <mach/tc.h>
40#include <plat/dma.h> 40#include <linux/omap-dma.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 42#include <linux/platform_data/keypad-omap.h>
43 43
@@ -45,6 +45,7 @@
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49#define PALMTE_USBDETECT_GPIO 0 50#define PALMTE_USBDETECT_GPIO 0
50#define PALMTE_USB_OR_DC_GPIO 1 51#define PALMTE_USB_OR_DC_GPIO 1
@@ -264,7 +265,6 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
264 .atag_offset = 0x100, 265 .atag_offset = 0x100,
265 .map_io = omap15xx_map_io, 266 .map_io = omap15xx_map_io,
266 .init_early = omap1_init_early, 267 .init_early = omap1_init_early,
267 .reserve = omap_reserve,
268 .init_irq = omap1_init_irq, 268 .init_irq = omap1_init_irq,
269 .init_machine = omap_palmte_init, 269 .init_machine = omap_palmte_init,
270 .init_late = omap1_init_late, 270 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 97158095083..2948b0ee4be 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -28,16 +28,16 @@
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/spi/ads7846.h> 29#include <linux/spi/ads7846.h>
30#include <linux/platform_data/omap1_bl.h> 30#include <linux/platform_data/omap1_bl.h>
31#include <linux/platform_data/leds-omap.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 35#include <asm/mach/map.h>
35 36
36#include <plat/led.h>
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/dma.h> 39#include <linux/omap-dma.h>
40#include <plat/tc.h> 40#include <mach/tc.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 42#include <linux/platform_data/keypad-omap.h>
43 43
@@ -45,6 +45,7 @@
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49#define PALMTT_USBDETECT_GPIO 0 50#define PALMTT_USBDETECT_GPIO 0
50#define PALMTT_CABLE_GPIO 1 51#define PALMTT_CABLE_GPIO 1
@@ -310,7 +311,6 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
310 .atag_offset = 0x100, 311 .atag_offset = 0x100,
311 .map_io = omap15xx_map_io, 312 .map_io = omap15xx_map_io,
312 .init_early = omap1_init_early, 313 .init_early = omap1_init_early,
313 .reserve = omap_reserve,
314 .init_irq = omap1_init_irq, 314 .init_irq = omap1_init_irq,
315 .init_machine = omap_palmtt_init, 315 .init_machine = omap_palmtt_init,
316 .init_late = omap1_init_late, 316 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index e311032e7ee..7a05895c0be 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -38,8 +38,8 @@
38 38
39#include <mach/flash.h> 39#include <mach/flash.h>
40#include <mach/mux.h> 40#include <mach/mux.h>
41#include <plat/dma.h> 41#include <linux/omap-dma.h>
42#include <plat/tc.h> 42#include <mach/tc.h>
43#include <mach/irda.h> 43#include <mach/irda.h>
44#include <linux/platform_data/keypad-omap.h> 44#include <linux/platform_data/keypad-omap.h>
45 45
@@ -47,6 +47,7 @@
47#include <mach/usb.h> 47#include <mach/usb.h>
48 48
49#include "common.h" 49#include "common.h"
50#include "dma.h"
50 51
51#define PALMZ71_USBDETECT_GPIO 0 52#define PALMZ71_USBDETECT_GPIO 0
52#define PALMZ71_PENIRQ_GPIO 6 53#define PALMZ71_PENIRQ_GPIO 6
@@ -326,7 +327,6 @@ MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
326 .atag_offset = 0x100, 327 .atag_offset = 0x100,
327 .map_io = omap15xx_map_io, 328 .map_io = omap15xx_map_io,
328 .init_early = omap1_init_early, 329 .init_early = omap1_init_early,
329 .reserve = omap_reserve,
330 .init_irq = omap1_init_irq, 330 .init_irq = omap1_init_irq,
331 .init_machine = omap_palmz71_init, 331 .init_machine = omap_palmz71_init,
332 .init_late = omap1_init_late, 332 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 198b05417bf..27f8d12ec22 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -28,15 +28,15 @@
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <plat/tc.h> 31#include <mach/tc.h>
32#include <mach/mux.h> 32#include <mach/mux.h>
33#include <plat/fpga.h>
34#include <mach/flash.h> 33#include <mach/flash.h>
35 34
36#include <mach/hardware.h> 35#include <mach/hardware.h>
37 36
38#include "iomap.h" 37#include "iomap.h"
39#include "common.h" 38#include "common.h"
39#include "fpga.h"
40 40
41static const unsigned int p2_keymap[] = { 41static const unsigned int p2_keymap[] = {
42 KEY(0, 0, KEY_UP), 42 KEY(0, 0, KEY_UP),
@@ -231,9 +231,9 @@ static struct omap_lcd_config perseus2_lcd_config __initdata = {
231 231
232static void __init perseus2_init_smc91x(void) 232static void __init perseus2_init_smc91x(void)
233{ 233{
234 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET); 234 __raw_writeb(1, H2P2_DBG_FPGA_LAN_RESET);
235 mdelay(50); 235 mdelay(50);
236 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1, 236 __raw_writeb(__raw_readb(H2P2_DBG_FPGA_LAN_RESET) & ~1,
237 H2P2_DBG_FPGA_LAN_RESET); 237 H2P2_DBG_FPGA_LAN_RESET);
238 mdelay(50); 238 mdelay(50);
239} 239}
@@ -275,8 +275,7 @@ static void __init omap_perseus2_init(void)
275 275
276 perseus2_init_smc91x(); 276 perseus2_init_smc91x();
277 277
278 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) 278 BUG_ON(gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
279 BUG();
280 gpio_direction_input(P2_NAND_RB_GPIO_PIN); 279 gpio_direction_input(P2_NAND_RB_GPIO_PIN);
281 280
282 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 281 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
@@ -324,7 +323,6 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
324 .atag_offset = 0x100, 323 .atag_offset = 0x100,
325 .map_io = omap_perseus2_map_io, 324 .map_io = omap_perseus2_map_io,
326 .init_early = omap1_init_early, 325 .init_early = omap1_init_early,
327 .reserve = omap_reserve,
328 .init_irq = omap1_init_irq, 326 .init_irq = omap1_init_irq,
329 .init_machine = omap_perseus2_init, 327 .init_machine = omap_perseus2_init,
330 .init_late = omap1_init_late, 328 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index 5932d56e17b..4fcf19c78a0 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -16,9 +16,10 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include <plat/mmc.h>
20#include <mach/board-sx1.h> 19#include <mach/board-sx1.h>
21 20
21#include "mmc.h"
22
22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
23 24
24static int mmc_set_power(struct device *dev, int slot, int power_on, 25static int mmc_set_power(struct device *dev, int slot, int power_on,
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 13bf2cc5681..20ed52ae171 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -36,15 +36,16 @@
36 36
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/dma.h> 39#include <linux/omap-dma.h>
40#include <mach/irda.h> 40#include <mach/irda.h>
41#include <plat/tc.h> 41#include <mach/tc.h>
42#include <mach/board-sx1.h> 42#include <mach/board-sx1.h>
43 43
44#include <mach/hardware.h> 44#include <mach/hardware.h>
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49/* Write to I2C device */ 50/* Write to I2C device */
50int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) 51int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
@@ -403,7 +404,6 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
403 .atag_offset = 0x100, 404 .atag_offset = 0x100,
404 .map_io = omap15xx_map_io, 405 .map_io = omap15xx_map_io,
405 .init_early = omap1_init_early, 406 .init_early = omap1_init_early,
406 .reserve = omap_reserve,
407 .init_irq = omap1_init_irq, 407 .init_irq = omap1_init_irq,
408 .init_machine = omap_sx1_init, 408 .init_machine = omap_sx1_init,
409 .init_late = omap1_init_late, 409 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index ad75e3411d4..abf705f49b1 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -34,7 +34,7 @@
34#include <mach/board-voiceblue.h> 34#include <mach/board-voiceblue.h>
35#include <mach/flash.h> 35#include <mach/flash.h>
36#include <mach/mux.h> 36#include <mach/mux.h>
37#include <plat/tc.h> 37#include <mach/tc.h>
38 38
39#include <mach/hardware.h> 39#include <mach/hardware.h>
40#include <mach/usb.h> 40#include <mach/usb.h>
@@ -286,7 +286,6 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
286 .atag_offset = 0x100, 286 .atag_offset = 0x100,
287 .map_io = omap15xx_map_io, 287 .map_io = omap15xx_map_io,
288 .init_early = omap1_init_early, 288 .init_early = omap1_init_early,
289 .reserve = omap_reserve,
290 .init_irq = omap1_init_irq, 289 .init_irq = omap1_init_irq,
291 .init_machine = voiceblue_init, 290 .init_machine = voiceblue_init,
292 .init_late = omap1_init_late, 291 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 638f4070fc7..4f5fd4a084c 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -12,6 +12,7 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/export.h>
15#include <linux/list.h> 16#include <linux/list.h>
16#include <linux/errno.h> 17#include <linux/errno.h>
17#include <linux/err.h> 18#include <linux/err.h>
@@ -21,21 +22,21 @@
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23 24
24#include <plat/cpu.h>
25#include <plat/usb.h>
26#include <plat/clock.h>
27#include <plat/sram.h>
28#include <plat/clkdev_omap.h>
29
30#include <mach/hardware.h> 25#include <mach/hardware.h>
31 26
27#include "soc.h"
32#include "iomap.h" 28#include "iomap.h"
33#include "clock.h" 29#include "clock.h"
34#include "opp.h" 30#include "opp.h"
31#include "sram.h"
35 32
36__u32 arm_idlect1_mask; 33__u32 arm_idlect1_mask;
37struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p; 34struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
38 35
36static LIST_HEAD(clocks);
37static DEFINE_MUTEX(clocks_mutex);
38static DEFINE_SPINLOCK(clockfw_lock);
39
39/* 40/*
40 * Omap1 specific clock functions 41 * Omap1 specific clock functions
41 */ 42 */
@@ -607,3 +608,497 @@ void omap1_clk_disable_unused(struct clk *clk)
607} 608}
608 609
609#endif 610#endif
611
612
613int clk_enable(struct clk *clk)
614{
615 unsigned long flags;
616 int ret;
617
618 if (clk == NULL || IS_ERR(clk))
619 return -EINVAL;
620
621 spin_lock_irqsave(&clockfw_lock, flags);
622 ret = omap1_clk_enable(clk);
623 spin_unlock_irqrestore(&clockfw_lock, flags);
624
625 return ret;
626}
627EXPORT_SYMBOL(clk_enable);
628
629void clk_disable(struct clk *clk)
630{
631 unsigned long flags;
632
633 if (clk == NULL || IS_ERR(clk))
634 return;
635
636 spin_lock_irqsave(&clockfw_lock, flags);
637 if (clk->usecount == 0) {
638 pr_err("Trying disable clock %s with 0 usecount\n",
639 clk->name);
640 WARN_ON(1);
641 goto out;
642 }
643
644 omap1_clk_disable(clk);
645
646out:
647 spin_unlock_irqrestore(&clockfw_lock, flags);
648}
649EXPORT_SYMBOL(clk_disable);
650
651unsigned long clk_get_rate(struct clk *clk)
652{
653 unsigned long flags;
654 unsigned long ret;
655
656 if (clk == NULL || IS_ERR(clk))
657 return 0;
658
659 spin_lock_irqsave(&clockfw_lock, flags);
660 ret = clk->rate;
661 spin_unlock_irqrestore(&clockfw_lock, flags);
662
663 return ret;
664}
665EXPORT_SYMBOL(clk_get_rate);
666
667/*
668 * Optional clock functions defined in include/linux/clk.h
669 */
670
671long clk_round_rate(struct clk *clk, unsigned long rate)
672{
673 unsigned long flags;
674 long ret;
675
676 if (clk == NULL || IS_ERR(clk))
677 return 0;
678
679 spin_lock_irqsave(&clockfw_lock, flags);
680 ret = omap1_clk_round_rate(clk, rate);
681 spin_unlock_irqrestore(&clockfw_lock, flags);
682
683 return ret;
684}
685EXPORT_SYMBOL(clk_round_rate);
686
687int clk_set_rate(struct clk *clk, unsigned long rate)
688{
689 unsigned long flags;
690 int ret = -EINVAL;
691
692 if (clk == NULL || IS_ERR(clk))
693 return ret;
694
695 spin_lock_irqsave(&clockfw_lock, flags);
696 ret = omap1_clk_set_rate(clk, rate);
697 if (ret == 0)
698 propagate_rate(clk);
699 spin_unlock_irqrestore(&clockfw_lock, flags);
700
701 return ret;
702}
703EXPORT_SYMBOL(clk_set_rate);
704
705int clk_set_parent(struct clk *clk, struct clk *parent)
706{
707 WARN_ONCE(1, "clk_set_parent() not implemented for OMAP1\n");
708
709 return -EINVAL;
710}
711EXPORT_SYMBOL(clk_set_parent);
712
713struct clk *clk_get_parent(struct clk *clk)
714{
715 return clk->parent;
716}
717EXPORT_SYMBOL(clk_get_parent);
718
719/*
720 * OMAP specific clock functions shared between omap1 and omap2
721 */
722
723int __initdata mpurate;
724
725/*
726 * By default we use the rate set by the bootloader.
727 * You can override this with mpurate= cmdline option.
728 */
729static int __init omap_clk_setup(char *str)
730{
731 get_option(&str, &mpurate);
732
733 if (!mpurate)
734 return 1;
735
736 if (mpurate < 1000)
737 mpurate *= 1000000;
738
739 return 1;
740}
741__setup("mpurate=", omap_clk_setup);
742
743/* Used for clocks that always have same value as the parent clock */
744unsigned long followparent_recalc(struct clk *clk)
745{
746 return clk->parent->rate;
747}
748
749/*
750 * Used for clocks that have the same value as the parent clock,
751 * divided by some factor
752 */
753unsigned long omap_fixed_divisor_recalc(struct clk *clk)
754{
755 WARN_ON(!clk->fixed_div);
756
757 return clk->parent->rate / clk->fixed_div;
758}
759
760void clk_reparent(struct clk *child, struct clk *parent)
761{
762 list_del_init(&child->sibling);
763 if (parent)
764 list_add(&child->sibling, &parent->children);
765 child->parent = parent;
766
767 /* now do the debugfs renaming to reattach the child
768 to the proper parent */
769}
770
771/* Propagate rate to children */
772void propagate_rate(struct clk *tclk)
773{
774 struct clk *clkp;
775
776 list_for_each_entry(clkp, &tclk->children, sibling) {
777 if (clkp->recalc)
778 clkp->rate = clkp->recalc(clkp);
779 propagate_rate(clkp);
780 }
781}
782
783static LIST_HEAD(root_clks);
784
785/**
786 * recalculate_root_clocks - recalculate and propagate all root clocks
787 *
788 * Recalculates all root clocks (clocks with no parent), which if the
789 * clock's .recalc is set correctly, should also propagate their rates.
790 * Called at init.
791 */
792void recalculate_root_clocks(void)
793{
794 struct clk *clkp;
795
796 list_for_each_entry(clkp, &root_clks, sibling) {
797 if (clkp->recalc)
798 clkp->rate = clkp->recalc(clkp);
799 propagate_rate(clkp);
800 }
801}
802
803/**
804 * clk_preinit - initialize any fields in the struct clk before clk init
805 * @clk: struct clk * to initialize
806 *
807 * Initialize any struct clk fields needed before normal clk initialization
808 * can run. No return value.
809 */
810void clk_preinit(struct clk *clk)
811{
812 INIT_LIST_HEAD(&clk->children);
813}
814
815int clk_register(struct clk *clk)
816{
817 if (clk == NULL || IS_ERR(clk))
818 return -EINVAL;
819
820 /*
821 * trap out already registered clocks
822 */
823 if (clk->node.next || clk->node.prev)
824 return 0;
825
826 mutex_lock(&clocks_mutex);
827 if (clk->parent)
828 list_add(&clk->sibling, &clk->parent->children);
829 else
830 list_add(&clk->sibling, &root_clks);
831
832 list_add(&clk->node, &clocks);
833 if (clk->init)
834 clk->init(clk);
835 mutex_unlock(&clocks_mutex);
836
837 return 0;
838}
839EXPORT_SYMBOL(clk_register);
840
841void clk_unregister(struct clk *clk)
842{
843 if (clk == NULL || IS_ERR(clk))
844 return;
845
846 mutex_lock(&clocks_mutex);
847 list_del(&clk->sibling);
848 list_del(&clk->node);
849 mutex_unlock(&clocks_mutex);
850}
851EXPORT_SYMBOL(clk_unregister);
852
853void clk_enable_init_clocks(void)
854{
855 struct clk *clkp;
856
857 list_for_each_entry(clkp, &clocks, node)
858 if (clkp->flags & ENABLE_ON_INIT)
859 clk_enable(clkp);
860}
861
862/**
863 * omap_clk_get_by_name - locate OMAP struct clk by its name
864 * @name: name of the struct clk to locate
865 *
866 * Locate an OMAP struct clk by its name. Assumes that struct clk
867 * names are unique. Returns NULL if not found or a pointer to the
868 * struct clk if found.
869 */
870struct clk *omap_clk_get_by_name(const char *name)
871{
872 struct clk *c;
873 struct clk *ret = NULL;
874
875 mutex_lock(&clocks_mutex);
876
877 list_for_each_entry(c, &clocks, node) {
878 if (!strcmp(c->name, name)) {
879 ret = c;
880 break;
881 }
882 }
883
884 mutex_unlock(&clocks_mutex);
885
886 return ret;
887}
888
889int omap_clk_enable_autoidle_all(void)
890{
891 struct clk *c;
892 unsigned long flags;
893
894 spin_lock_irqsave(&clockfw_lock, flags);
895
896 list_for_each_entry(c, &clocks, node)
897 if (c->ops->allow_idle)
898 c->ops->allow_idle(c);
899
900 spin_unlock_irqrestore(&clockfw_lock, flags);
901
902 return 0;
903}
904
905int omap_clk_disable_autoidle_all(void)
906{
907 struct clk *c;
908 unsigned long flags;
909
910 spin_lock_irqsave(&clockfw_lock, flags);
911
912 list_for_each_entry(c, &clocks, node)
913 if (c->ops->deny_idle)
914 c->ops->deny_idle(c);
915
916 spin_unlock_irqrestore(&clockfw_lock, flags);
917
918 return 0;
919}
920
921/*
922 * Low level helpers
923 */
924static int clkll_enable_null(struct clk *clk)
925{
926 return 0;
927}
928
929static void clkll_disable_null(struct clk *clk)
930{
931}
932
933const struct clkops clkops_null = {
934 .enable = clkll_enable_null,
935 .disable = clkll_disable_null,
936};
937
938/*
939 * Dummy clock
940 *
941 * Used for clock aliases that are needed on some OMAPs, but not others
942 */
943struct clk dummy_ck = {
944 .name = "dummy",
945 .ops = &clkops_null,
946};
947
948/*
949 *
950 */
951
952#ifdef CONFIG_OMAP_RESET_CLOCKS
953/*
954 * Disable any unused clocks left on by the bootloader
955 */
956static int __init clk_disable_unused(void)
957{
958 struct clk *ck;
959 unsigned long flags;
960
961 pr_info("clock: disabling unused clocks to save power\n");
962
963 spin_lock_irqsave(&clockfw_lock, flags);
964 list_for_each_entry(ck, &clocks, node) {
965 if (ck->ops == &clkops_null)
966 continue;
967
968 if (ck->usecount > 0 || !ck->enable_reg)
969 continue;
970
971 omap1_clk_disable_unused(ck);
972 }
973 spin_unlock_irqrestore(&clockfw_lock, flags);
974
975 return 0;
976}
977late_initcall(clk_disable_unused);
978late_initcall(omap_clk_enable_autoidle_all);
979#endif
980
981#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
982/*
983 * debugfs support to trace clock tree hierarchy and attributes
984 */
985
986#include <linux/debugfs.h>
987#include <linux/seq_file.h>
988
989static struct dentry *clk_debugfs_root;
990
991static int clk_dbg_show_summary(struct seq_file *s, void *unused)
992{
993 struct clk *c;
994 struct clk *pa;
995
996 mutex_lock(&clocks_mutex);
997 seq_printf(s, "%-30s %-30s %-10s %s\n",
998 "clock-name", "parent-name", "rate", "use-count");
999
1000 list_for_each_entry(c, &clocks, node) {
1001 pa = c->parent;
1002 seq_printf(s, "%-30s %-30s %-10lu %d\n",
1003 c->name, pa ? pa->name : "none", c->rate,
1004 c->usecount);
1005 }
1006 mutex_unlock(&clocks_mutex);
1007
1008 return 0;
1009}
1010
1011static int clk_dbg_open(struct inode *inode, struct file *file)
1012{
1013 return single_open(file, clk_dbg_show_summary, inode->i_private);
1014}
1015
1016static const struct file_operations debug_clock_fops = {
1017 .open = clk_dbg_open,
1018 .read = seq_read,
1019 .llseek = seq_lseek,
1020 .release = single_release,
1021};
1022
1023static int clk_debugfs_register_one(struct clk *c)
1024{
1025 int err;
1026 struct dentry *d;
1027 struct clk *pa = c->parent;
1028
1029 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
1030 if (!d)
1031 return -ENOMEM;
1032 c->dent = d;
1033
1034 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
1035 if (!d) {
1036 err = -ENOMEM;
1037 goto err_out;
1038 }
1039 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
1040 if (!d) {
1041 err = -ENOMEM;
1042 goto err_out;
1043 }
1044 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
1045 if (!d) {
1046 err = -ENOMEM;
1047 goto err_out;
1048 }
1049 return 0;
1050
1051err_out:
1052 debugfs_remove_recursive(c->dent);
1053 return err;
1054}
1055
1056static int clk_debugfs_register(struct clk *c)
1057{
1058 int err;
1059 struct clk *pa = c->parent;
1060
1061 if (pa && !pa->dent) {
1062 err = clk_debugfs_register(pa);
1063 if (err)
1064 return err;
1065 }
1066
1067 if (!c->dent) {
1068 err = clk_debugfs_register_one(c);
1069 if (err)
1070 return err;
1071 }
1072 return 0;
1073}
1074
1075static int __init clk_debugfs_init(void)
1076{
1077 struct clk *c;
1078 struct dentry *d;
1079 int err;
1080
1081 d = debugfs_create_dir("clock", NULL);
1082 if (!d)
1083 return -ENOMEM;
1084 clk_debugfs_root = d;
1085
1086 list_for_each_entry(c, &clocks, node) {
1087 err = clk_debugfs_register(c);
1088 if (err)
1089 goto err_out;
1090 }
1091
1092 d = debugfs_create_file("summary", S_IRUGO,
1093 d, NULL, &debug_clock_fops);
1094 if (!d)
1095 return -ENOMEM;
1096
1097 return 0;
1098err_out:
1099 debugfs_remove_recursive(clk_debugfs_root);
1100 return err;
1101}
1102late_initcall(clk_debugfs_init);
1103
1104#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index 3d04f4f6767..1e4918a3a5e 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -14,8 +14,184 @@
14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H 14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H
15 15
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/list.h>
17 18
18#include <plat/clock.h> 19#include <linux/clkdev.h>
20
21struct module;
22struct clk;
23
24struct omap_clk {
25 u16 cpu;
26 struct clk_lookup lk;
27};
28
29#define CLK(dev, con, ck, cp) \
30 { \
31 .cpu = cp, \
32 .lk = { \
33 .dev_id = dev, \
34 .con_id = con, \
35 .clk = ck, \
36 }, \
37 }
38
39/* Platform flags for the clkdev-OMAP integration code */
40#define CK_310 (1 << 0)
41#define CK_7XX (1 << 1) /* 7xx, 850 */
42#define CK_1510 (1 << 2)
43#define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */
44#define CK_1710 (1 << 4) /* 1710 extra for rate selection */
45
46
47/* Temporary, needed during the common clock framework conversion */
48#define __clk_get_name(clk) (clk->name)
49#define __clk_get_parent(clk) (clk->parent)
50#define __clk_get_rate(clk) (clk->rate)
51
52/**
53 * struct clkops - some clock function pointers
54 * @enable: fn ptr that enables the current clock in hardware
55 * @disable: fn ptr that enables the current clock in hardware
56 * @find_idlest: function returning the IDLEST register for the clock's IP blk
57 * @find_companion: function returning the "companion" clk reg for the clock
58 * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
59 * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
60 *
61 * A "companion" clk is an accompanying clock to the one being queried
62 * that must be enabled for the IP module connected to the clock to
63 * become accessible by the hardware. Neither @find_idlest nor
64 * @find_companion should be needed; that information is IP
65 * block-specific; the hwmod code has been created to handle this, but
66 * until hwmod data is ready and drivers have been converted to use PM
67 * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
68 * @find_companion must, unfortunately, remain.
69 */
70struct clkops {
71 int (*enable)(struct clk *);
72 void (*disable)(struct clk *);
73 void (*find_idlest)(struct clk *, void __iomem **,
74 u8 *, u8 *);
75 void (*find_companion)(struct clk *, void __iomem **,
76 u8 *);
77 void (*allow_idle)(struct clk *);
78 void (*deny_idle)(struct clk *);
79};
80
81/*
82 * struct clk.flags possibilities
83 *
84 * XXX document the rest of the clock flags here
85 *
86 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
87 * bits share the same register. This flag allows the
88 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
89 * should be used. This is a temporary solution - a better approach
90 * would be to associate clock type-specific data with the clock,
91 * similar to the struct dpll_data approach.
92 */
93#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
94#define CLOCK_IDLE_CONTROL (1 << 1)
95#define CLOCK_NO_IDLE_PARENT (1 << 2)
96#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
97#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
98#define CLOCK_CLKOUTX2 (1 << 5)
99
100/**
101 * struct clk - OMAP struct clk
102 * @node: list_head connecting this clock into the full clock list
103 * @ops: struct clkops * for this clock
104 * @name: the name of the clock in the hardware (used in hwmod data and debug)
105 * @parent: pointer to this clock's parent struct clk
106 * @children: list_head connecting to the child clks' @sibling list_heads
107 * @sibling: list_head connecting this clk to its parent clk's @children
108 * @rate: current clock rate
109 * @enable_reg: register to write to enable the clock (see @enable_bit)
110 * @recalc: fn ptr that returns the clock's current rate
111 * @set_rate: fn ptr that can change the clock's current rate
112 * @round_rate: fn ptr that can round the clock's current rate
113 * @init: fn ptr to do clock-specific initialization
114 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
115 * @usecount: number of users that have requested this clock to be enabled
116 * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
117 * @flags: see "struct clk.flags possibilities" above
118 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
119 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
120 *
121 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
122 * clock code converted to use clksel.
123 *
124 * XXX @usecount is poorly named. It should be "enable_count" or
125 * something similar. "users" in the description refers to kernel
126 * code (core code or drivers) that have called clk_enable() and not
127 * yet called clk_disable(); the usecount of parent clocks is also
128 * incremented by the clock code when clk_enable() is called on child
129 * clocks and decremented by the clock code when clk_disable() is
130 * called on child clocks.
131 *
132 * XXX @clkdm, @usecount, @children, @sibling should be marked for
133 * internal use only.
134 *
135 * @children and @sibling are used to optimize parent-to-child clock
136 * tree traversals. (child-to-parent traversals use @parent.)
137 *
138 * XXX The notion of the clock's current rate probably needs to be
139 * separated from the clock's target rate.
140 */
141struct clk {
142 struct list_head node;
143 const struct clkops *ops;
144 const char *name;
145 struct clk *parent;
146 struct list_head children;
147 struct list_head sibling; /* node for children */
148 unsigned long rate;
149 void __iomem *enable_reg;
150 unsigned long (*recalc)(struct clk *);
151 int (*set_rate)(struct clk *, unsigned long);
152 long (*round_rate)(struct clk *, unsigned long);
153 void (*init)(struct clk *);
154 u8 enable_bit;
155 s8 usecount;
156 u8 fixed_div;
157 u8 flags;
158 u8 rate_offset;
159 u8 src_offset;
160#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
161 struct dentry *dent; /* For visible tree hierarchy */
162#endif
163};
164
165struct clk_functions {
166 int (*clk_enable)(struct clk *clk);
167 void (*clk_disable)(struct clk *clk);
168 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
169 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
170 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
171 void (*clk_allow_idle)(struct clk *clk);
172 void (*clk_deny_idle)(struct clk *clk);
173 void (*clk_disable_unused)(struct clk *clk);
174};
175
176extern int mpurate;
177
178extern int clk_init(struct clk_functions *custom_clocks);
179extern void clk_preinit(struct clk *clk);
180extern int clk_register(struct clk *clk);
181extern void clk_reparent(struct clk *child, struct clk *parent);
182extern void clk_unregister(struct clk *clk);
183extern void propagate_rate(struct clk *clk);
184extern void recalculate_root_clocks(void);
185extern unsigned long followparent_recalc(struct clk *clk);
186extern void clk_enable_init_clocks(void);
187unsigned long omap_fixed_divisor_recalc(struct clk *clk);
188extern struct clk *omap_clk_get_by_name(const char *name);
189extern int omap_clk_enable_autoidle_all(void);
190extern int omap_clk_disable_autoidle_all(void);
191
192extern const struct clkops clkops_null;
193
194extern struct clk dummy_ck;
19 195
20int omap1_clk_init(void); 196int omap1_clk_init(void);
21void omap1_clk_late_init(void); 197void omap1_clk_late_init(void);
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 9b45f4b0ee2..cb7c6ae2e3f 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -22,16 +22,14 @@
22 22
23#include <asm/mach-types.h> /* for machine_is_* */ 23#include <asm/mach-types.h> /* for machine_is_* */
24 24
25#include <plat/clock.h> 25#include "soc.h"
26#include <plat/cpu.h>
27#include <plat/clkdev_omap.h>
28#include <plat/sram.h> /* for omap_sram_reprogram_clock() */
29 26
30#include <mach/hardware.h> 27#include <mach/hardware.h>
31#include <mach/usb.h> /* for OTG_BASE */ 28#include <mach/usb.h> /* for OTG_BASE */
32 29
33#include "iomap.h" 30#include "iomap.h"
34#include "clock.h" 31#include "clock.h"
32#include "sram.h"
35 33
36/* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */ 34/* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
37#define IDL_CLKOUT_ARM_SHIFT 12 35#define IDL_CLKOUT_ARM_SHIFT 12
@@ -765,14 +763,6 @@ static struct omap_clk omap_clks[] = {
765 * init 763 * init
766 */ 764 */
767 765
768static struct clk_functions omap1_clk_functions = {
769 .clk_enable = omap1_clk_enable,
770 .clk_disable = omap1_clk_disable,
771 .clk_round_rate = omap1_clk_round_rate,
772 .clk_set_rate = omap1_clk_set_rate,
773 .clk_disable_unused = omap1_clk_disable_unused,
774};
775
776static void __init omap1_show_rates(void) 766static void __init omap1_show_rates(void)
777{ 767{
778 pr_notice("Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n", 768 pr_notice("Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
@@ -803,8 +793,6 @@ int __init omap1_clk_init(void)
803 if (!cpu_is_omap15xx()) 793 if (!cpu_is_omap15xx())
804 omap_writew(0, SOFT_REQ_REG2); 794 omap_writew(0, SOFT_REQ_REG2);
805 795
806 clk_init(&omap1_clk_functions);
807
808 /* By default all idlect1 clocks are allowed to idle */ 796 /* By default all idlect1 clocks are allowed to idle */
809 arm_idlect1_mask = ~0; 797 arm_idlect1_mask = ~0;
810 798
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index c2552b24f9f..b53e0854422 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -26,8 +26,10 @@
26#ifndef __ARCH_ARM_MACH_OMAP1_COMMON_H 26#ifndef __ARCH_ARM_MACH_OMAP1_COMMON_H
27#define __ARCH_ARM_MACH_OMAP1_COMMON_H 27#define __ARCH_ARM_MACH_OMAP1_COMMON_H
28 28
29#include <plat/common.h>
30#include <linux/mtd/mtd.h> 29#include <linux/mtd/mtd.h>
30#include <linux/i2c-omap.h>
31
32#include <plat/i2c.h>
31 33
32#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 34#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
33void omap7xx_map_io(void); 35void omap7xx_map_io(void);
@@ -38,6 +40,7 @@ static inline void omap7xx_map_io(void)
38#endif 40#endif
39 41
40#ifdef CONFIG_ARCH_OMAP15XX 42#ifdef CONFIG_ARCH_OMAP15XX
43void omap1510_fpga_init_irq(void);
41void omap15xx_map_io(void); 44void omap15xx_map_io(void);
42#else 45#else
43static inline void omap15xx_map_io(void) 46static inline void omap15xx_map_io(void)
@@ -90,4 +93,6 @@ extern int ocpi_enable(void);
90static inline int ocpi_enable(void) { return 0; } 93static inline int ocpi_enable(void) { return 0; }
91#endif 94#endif
92 95
96extern u32 omap1_get_reset_sources(void);
97
93#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ 98#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index d3fec92c54c..0af635205e8 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -17,12 +17,12 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19 19
20#include <linux/platform_data/omap-wd-timer.h>
21
20#include <asm/mach/map.h> 22#include <asm/mach/map.h>
21 23
22#include <plat/tc.h> 24#include <mach/tc.h>
23#include <mach/mux.h> 25#include <mach/mux.h>
24#include <plat/dma.h>
25#include <plat/mmc.h>
26 26
27#include <mach/omap7xx.h> 27#include <mach/omap7xx.h>
28#include <mach/camera.h> 28#include <mach/camera.h>
@@ -30,6 +30,9 @@
30 30
31#include "common.h" 31#include "common.h"
32#include "clock.h" 32#include "clock.h"
33#include "dma.h"
34#include "mmc.h"
35#include "sram.h"
33 36
34#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) 37#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
35 38
@@ -175,6 +178,13 @@ static int __init omap_mmc_add(const char *name, int id, unsigned long base,
175 res[3].name = "tx"; 178 res[3].name = "tx";
176 res[3].flags = IORESOURCE_DMA; 179 res[3].flags = IORESOURCE_DMA;
177 180
181 if (cpu_is_omap7xx())
182 data->slots[0].features = MMC_OMAP7XX;
183 if (cpu_is_omap15xx())
184 data->slots[0].features = MMC_OMAP15XX;
185 if (cpu_is_omap16xx())
186 data->slots[0].features = MMC_OMAP16XX;
187
178 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); 188 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
179 if (ret == 0) 189 if (ret == 0)
180 ret = platform_device_add_data(pdev, data, sizeof(*data)); 190 ret = platform_device_add_data(pdev, data, sizeof(*data));
@@ -439,18 +449,31 @@ static struct resource wdt_resources[] = {
439}; 449};
440 450
441static struct platform_device omap_wdt_device = { 451static struct platform_device omap_wdt_device = {
442 .name = "omap_wdt", 452 .name = "omap_wdt",
443 .id = -1, 453 .id = -1,
444 .num_resources = ARRAY_SIZE(wdt_resources), 454 .num_resources = ARRAY_SIZE(wdt_resources),
445 .resource = wdt_resources, 455 .resource = wdt_resources,
446}; 456};
447 457
448static int __init omap_init_wdt(void) 458static int __init omap_init_wdt(void)
449{ 459{
460 struct omap_wd_timer_platform_data pdata;
461 int ret;
462
450 if (!cpu_is_omap16xx()) 463 if (!cpu_is_omap16xx())
451 return -ENODEV; 464 return -ENODEV;
452 465
453 return platform_device_register(&omap_wdt_device); 466 pdata.read_reset_sources = omap1_get_reset_sources;
467
468 ret = platform_device_register(&omap_wdt_device);
469 if (!ret) {
470 ret = platform_device_add_data(&omap_wdt_device, &pdata,
471 sizeof(pdata));
472 if (ret)
473 platform_device_del(&omap_wdt_device);
474 }
475
476 return ret;
454} 477}
455subsys_initcall(omap_init_wdt); 478subsys_initcall(omap_init_wdt);
456#endif 479#endif
diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
index 29007fef84c..e190611e4b4 100644
--- a/arch/arm/mach-omap1/dma.c
+++ b/arch/arm/mach-omap1/dma.c
@@ -25,11 +25,13 @@
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/io.h> 26#include <linux/io.h>
27 27
28#include <plat/dma.h> 28#include <linux/omap-dma.h>
29#include <plat/tc.h> 29#include <mach/tc.h>
30 30
31#include <mach/irqs.h> 31#include <mach/irqs.h>
32 32
33#include "dma.h"
34
33#define OMAP1_DMA_BASE (0xfffed800) 35#define OMAP1_DMA_BASE (0xfffed800)
34#define OMAP1_LOGICAL_DMA_CH_COUNT 17 36#define OMAP1_LOGICAL_DMA_CH_COUNT 17
35#define OMAP1_DMA_STRIDE 0x40 37#define OMAP1_DMA_STRIDE 0x40
@@ -319,6 +321,9 @@ static int __init omap1_system_dma_init(void)
319 d->dev_caps = ENABLE_1510_MODE; 321 d->dev_caps = ENABLE_1510_MODE;
320 enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; 322 enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
321 323
324 if (cpu_is_omap16xx())
325 d->dev_caps = ENABLE_16XX_MODE;
326
322 d->dev_caps |= SRC_PORT; 327 d->dev_caps |= SRC_PORT;
323 d->dev_caps |= DST_PORT; 328 d->dev_caps |= DST_PORT;
324 d->dev_caps |= SRC_INDEX; 329 d->dev_caps |= SRC_INDEX;
diff --git a/arch/arm/mach-omap1/dma.h b/arch/arm/mach-omap1/dma.h
new file mode 100644
index 00000000000..da6345dab03
--- /dev/null
+++ b/arch/arm/mach-omap1/dma.h
@@ -0,0 +1,83 @@
1/*
2 * OMAP1 DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP1_DMA_CHANNEL_H
20#define __OMAP1_DMA_CHANNEL_H
21
22/* DMA channels for omap1 */
23#define OMAP_DMA_NO_DEVICE 0
24#define OMAP_DMA_MCSI1_TX 1
25#define OMAP_DMA_MCSI1_RX 2
26#define OMAP_DMA_I2C_RX 3
27#define OMAP_DMA_I2C_TX 4
28#define OMAP_DMA_EXT_NDMA_REQ 5
29#define OMAP_DMA_EXT_NDMA_REQ2 6
30#define OMAP_DMA_UWIRE_TX 7
31#define OMAP_DMA_MCBSP1_TX 8
32#define OMAP_DMA_MCBSP1_RX 9
33#define OMAP_DMA_MCBSP3_TX 10
34#define OMAP_DMA_MCBSP3_RX 11
35#define OMAP_DMA_UART1_TX 12
36#define OMAP_DMA_UART1_RX 13
37#define OMAP_DMA_UART2_TX 14
38#define OMAP_DMA_UART2_RX 15
39#define OMAP_DMA_MCBSP2_TX 16
40#define OMAP_DMA_MCBSP2_RX 17
41#define OMAP_DMA_UART3_TX 18
42#define OMAP_DMA_UART3_RX 19
43#define OMAP_DMA_CAMERA_IF_RX 20
44#define OMAP_DMA_MMC_TX 21
45#define OMAP_DMA_MMC_RX 22
46#define OMAP_DMA_NAND 23
47#define OMAP_DMA_IRQ_LCD_LINE 24
48#define OMAP_DMA_MEMORY_STICK 25
49#define OMAP_DMA_USB_W2FC_RX0 26
50#define OMAP_DMA_USB_W2FC_RX1 27
51#define OMAP_DMA_USB_W2FC_RX2 28
52#define OMAP_DMA_USB_W2FC_TX0 29
53#define OMAP_DMA_USB_W2FC_TX1 30
54#define OMAP_DMA_USB_W2FC_TX2 31
55
56/* These are only for 1610 */
57#define OMAP_DMA_CRYPTO_DES_IN 32
58#define OMAP_DMA_SPI_TX 33
59#define OMAP_DMA_SPI_RX 34
60#define OMAP_DMA_CRYPTO_HASH 35
61#define OMAP_DMA_CCP_ATTN 36
62#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
63#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
64#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
65#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
66#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
67#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
68#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
69#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
70#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
71#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
72#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
73#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
74#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
75#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
76#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
77#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
78#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
79#define OMAP_DMA_MMC2_TX 54
80#define OMAP_DMA_MMC2_RX 55
81#define OMAP_DMA_CRYPTO_DES_OUT 56
82
83#endif /* __OMAP1_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap1/flash.c b/arch/arm/mach-omap1/flash.c
index 73ae6169aa4..b3fb531af94 100644
--- a/arch/arm/mach-omap1/flash.c
+++ b/arch/arm/mach-omap1/flash.c
@@ -10,7 +10,7 @@
10#include <linux/mtd/mtd.h> 10#include <linux/mtd/mtd.h>
11#include <linux/mtd/map.h> 11#include <linux/mtd/map.h>
12 12
13#include <plat/tc.h> 13#include <mach/tc.h>
14#include <mach/flash.h> 14#include <mach/flash.h>
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 29ec50fc688..8bd71b2d096 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -27,11 +27,11 @@
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <plat/fpga.h>
31
32#include <mach/hardware.h> 30#include <mach/hardware.h>
33 31
34#include "iomap.h" 32#include "iomap.h"
33#include "common.h"
34#include "fpga.h"
35 35
36static void fpga_mask_irq(struct irq_data *d) 36static void fpga_mask_irq(struct irq_data *d)
37{ 37{
diff --git a/arch/arm/mach-omap1/fpga.h b/arch/arm/mach-omap1/fpga.h
new file mode 100644
index 00000000000..4b4307a80e4
--- /dev/null
+++ b/arch/arm/mach-omap1/fpga.h
@@ -0,0 +1,52 @@
1/*
2 * Interrupt handler for OMAP-1510 FPGA
3 *
4 * Copyright (C) 2001 RidgeRun, Inc.
5 * Author: Greg Lonnon <glonnon@ridgerun.com>
6 *
7 * Copyright (C) 2002 MontaVista Software, Inc.
8 *
9 * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
10 * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#ifndef __ASM_ARCH_OMAP_FPGA_H
18#define __ASM_ARCH_OMAP_FPGA_H
19
20/*
21 * ---------------------------------------------------------------------------
22 * H2/P2 Debug board FPGA
23 * ---------------------------------------------------------------------------
24 */
25/* maps in the FPGA registers and the ETHR registers */
26#define H2P2_DBG_FPGA_BASE 0xE8000000 /* VA */
27#define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */
28#define H2P2_DBG_FPGA_START 0x04000000 /* PA */
29
30#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
31#define H2P2_DBG_FPGA_FPGA_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */
32#define H2P2_DBG_FPGA_BOARD_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x12) /* Board Revision */
33#define H2P2_DBG_FPGA_GPIO IOMEM(H2P2_DBG_FPGA_BASE + 0x14) /* GPIO outputs */
34#define H2P2_DBG_FPGA_LEDS IOMEM(H2P2_DBG_FPGA_BASE + 0x16) /* LEDs outputs */
35#define H2P2_DBG_FPGA_MISC_INPUTS IOMEM(H2P2_DBG_FPGA_BASE + 0x18) /* Misc inputs */
36#define H2P2_DBG_FPGA_LAN_STATUS IOMEM(H2P2_DBG_FPGA_BASE + 0x1A) /* LAN Status line */
37#define H2P2_DBG_FPGA_LAN_RESET IOMEM(H2P2_DBG_FPGA_BASE + 0x1C) /* LAN Reset line */
38
39/* LEDs definition on debug board (16 LEDs, all physically green) */
40#define H2P2_DBG_FPGA_LED_GREEN (1 << 15)
41#define H2P2_DBG_FPGA_LED_AMBER (1 << 14)
42#define H2P2_DBG_FPGA_LED_RED (1 << 13)
43#define H2P2_DBG_FPGA_LED_BLUE (1 << 12)
44/* cpu0 load-meter LEDs */
45#define H2P2_DBG_FPGA_LOAD_METER (1 << 0) // A bit of fun on our board ...
46#define H2P2_DBG_FPGA_LOAD_METER_SIZE 11
47#define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
48
49#define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0)
50#define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1)
51
52#endif
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 98e6f39224a..02b3eb2e201 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -19,6 +19,8 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
21 21
22#include <mach/irqs.h>
23
22#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE 24#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
23#define OMAP1510_GPIO_BASE 0xFFFCE000 25#define OMAP1510_GPIO_BASE 0xFFFCE000
24 26
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index 33f419236b1..b9952a258d8 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -19,6 +19,8 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
21 21
22#include <mach/irqs.h>
23
22#define OMAP1610_GPIO1_BASE 0xfffbe400 24#define OMAP1610_GPIO1_BASE 0xfffbe400
23#define OMAP1610_GPIO2_BASE 0xfffbec00 25#define OMAP1610_GPIO2_BASE 0xfffbec00
24#define OMAP1610_GPIO3_BASE 0xfffbb400 26#define OMAP1610_GPIO3_BASE 0xfffbb400
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
index 958ce9acee9..f5819b2b7cb 100644
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -19,6 +19,8 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
21 21
22#include <mach/irqs.h>
23
22#define OMAP7XX_GPIO1_BASE 0xfffbc000 24#define OMAP7XX_GPIO1_BASE 0xfffbc000
23#define OMAP7XX_GPIO2_BASE 0xfffbc800 25#define OMAP7XX_GPIO2_BASE 0xfffbc800
24#define OMAP7XX_GPIO3_BASE 0xfffbd000 26#define OMAP7XX_GPIO3_BASE 0xfffbd000
diff --git a/arch/arm/mach-omap1/i2c.c b/arch/arm/mach-omap1/i2c.c
index a0551a6d745..faca808cb3d 100644
--- a/arch/arm/mach-omap1/i2c.c
+++ b/arch/arm/mach-omap1/i2c.c
@@ -19,11 +19,25 @@
19 * 19 *
20 */ 20 */
21 21
22#include <plat/i2c.h> 22#include <linux/i2c-omap.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <plat/cpu.h> 24#include "soc.h"
25
26#include <plat/i2c.h>
27
28#define OMAP_I2C_SIZE 0x3f
29#define OMAP1_I2C_BASE 0xfffb3800
30#define OMAP1_INT_I2C (32 + 4)
31
32static const char name[] = "omap_i2c";
25 33
26void __init omap1_i2c_mux_pins(int bus_id) 34static struct resource i2c_resources[2] = {
35};
36
37static struct platform_device omap_i2c_devices[1] = {
38};
39
40static void __init omap1_i2c_mux_pins(int bus_id)
27{ 41{
28 if (cpu_is_omap7xx()) { 42 if (cpu_is_omap7xx()) {
29 omap_cfg_reg(I2C_7XX_SDA); 43 omap_cfg_reg(I2C_7XX_SDA);
@@ -33,3 +47,47 @@ void __init omap1_i2c_mux_pins(int bus_id)
33 omap_cfg_reg(I2C_SCL); 47 omap_cfg_reg(I2C_SCL);
34 } 48 }
35} 49}
50
51int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *pdata,
52 int bus_id)
53{
54 struct platform_device *pdev;
55 struct resource *res;
56
57 if (bus_id > 1)
58 return -EINVAL;
59
60 omap1_i2c_mux_pins(bus_id);
61
62 pdev = &omap_i2c_devices[bus_id - 1];
63 pdev->id = bus_id;
64 pdev->name = name;
65 pdev->num_resources = ARRAY_SIZE(i2c_resources);
66 res = i2c_resources;
67 res[0].start = OMAP1_I2C_BASE;
68 res[0].end = res[0].start + OMAP_I2C_SIZE;
69 res[0].flags = IORESOURCE_MEM;
70 res[1].start = OMAP1_INT_I2C;
71 res[1].flags = IORESOURCE_IRQ;
72 pdev->resource = res;
73
74 /* all OMAP1 have IP version 1 register set */
75 pdata->rev = OMAP_I2C_IP_VERSION_1;
76
77 /* all OMAP1 I2C are implemented like this */
78 pdata->flags = OMAP_I2C_FLAG_NO_FIFO |
79 OMAP_I2C_FLAG_SIMPLE_CLOCK |
80 OMAP_I2C_FLAG_16BIT_DATA_REG |
81 OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK;
82
83 /* how the cpu bus is wired up differs for 7xx only */
84
85 if (cpu_is_omap7xx())
86 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_1;
87 else
88 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2;
89
90 pdev->dev.platform_data = pdata;
91
92 return platform_device_register(pdev);
93}
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index a1b846aacda..52de382fc80 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -17,7 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <asm/system_info.h> 18#include <asm/system_info.h>
19 19
20#include <plat/cpu.h> 20#include "soc.h"
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23 23
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 2b36a281dc8..5c1a26c9f49 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -13,7 +13,7 @@
13 13
14#include <linux/serial_reg.h> 14#include <linux/serial_reg.h>
15 15
16#include <plat/serial.h> 16#include "serial.h"
17 17
18 .pushsection .data 18 .pushsection .data
19omap_uart_phys: .word 0x0 19omap_uart_phys: .word 0x0
diff --git a/arch/arm/mach-omap1/include/mach/entry-macro.S b/arch/arm/mach-omap1/include/mach/entry-macro.S
index 88f08cab171..78a8c6c2476 100644
--- a/arch/arm/mach-omap1/include/mach/entry-macro.S
+++ b/arch/arm/mach-omap1/include/mach/entry-macro.S
@@ -13,8 +13,6 @@
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14#include <mach/irqs.h> 14#include <mach/irqs.h>
15 15
16#include "../../iomap.h"
17
18 .macro get_irqnr_preamble, base, tmp 16 .macro get_irqnr_preamble, base, tmp
19 .endm 17 .endm
20 18
diff --git a/arch/arm/mach-omap1/include/mach/gpio.h b/arch/arm/mach-omap1/include/mach/gpio.h
deleted file mode 100644
index ebf86c0f4f4..00000000000
--- a/arch/arm/mach-omap1/include/mach/gpio.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * arch/arm/mach-omap1/include/mach/gpio.h
3 */
diff --git a/arch/arm/mach-omap1/include/mach/hardware.h b/arch/arm/mach-omap1/include/mach/hardware.h
index 84248d250ad..5875a5098d3 100644
--- a/arch/arm/mach-omap1/include/mach/hardware.h
+++ b/arch/arm/mach-omap1/include/mach/hardware.h
@@ -39,7 +39,7 @@
39#include <asm/sizes.h> 39#include <asm/sizes.h>
40#ifndef __ASSEMBLER__ 40#ifndef __ASSEMBLER__
41#include <asm/types.h> 41#include <asm/types.h>
42#include <plat/cpu.h> 42#include <mach/soc.h>
43 43
44/* 44/*
45 * NOTE: Please use ioremap + __raw_read/write where possible instead of these 45 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
@@ -51,7 +51,7 @@ extern void omap_writeb(u8 v, u32 pa);
51extern void omap_writew(u16 v, u32 pa); 51extern void omap_writew(u16 v, u32 pa);
52extern void omap_writel(u32 v, u32 pa); 52extern void omap_writel(u32 v, u32 pa);
53 53
54#include <plat/tc.h> 54#include <mach/tc.h>
55 55
56/* Almost all documentation for chip and board memory maps assumes 56/* Almost all documentation for chip and board memory maps assumes
57 * BM is clear. Most devel boards have a switch to control booting 57 * BM is clear. Most devel boards have a switch to control booting
@@ -72,7 +72,10 @@ static inline u32 omap_cs3_phys(void)
72 72
73#endif /* ifndef __ASSEMBLER__ */ 73#endif /* ifndef __ASSEMBLER__ */
74 74
75#include <plat/serial.h> 75#define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
76#define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET)
77
78#include <mach/serial.h>
76 79
77/* 80/*
78 * --------------------------------------------------------------------------- 81 * ---------------------------------------------------------------------------
diff --git a/arch/arm/mach-omap1/include/mach/memory.h b/arch/arm/mach-omap1/include/mach/memory.h
index 901082def9b..3c253052311 100644
--- a/arch/arm/mach-omap1/include/mach/memory.h
+++ b/arch/arm/mach-omap1/include/mach/memory.h
@@ -19,7 +19,7 @@
19 * because of the strncmp(). 19 * because of the strncmp().
20 */ 20 */
21#if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__) 21#if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__)
22#include <plat/cpu.h> 22#include <mach/soc.h>
23 23
24/* 24/*
25 * OMAP-1510 Local Bus address offset 25 * OMAP-1510 Local Bus address offset
diff --git a/arch/arm/mach-omap1/include/mach/omap1510.h b/arch/arm/mach-omap1/include/mach/omap1510.h
index 8fe05d6137c..3d235244bf5 100644
--- a/arch/arm/mach-omap1/include/mach/omap1510.h
+++ b/arch/arm/mach-omap1/include/mach/omap1510.h
@@ -45,5 +45,118 @@
45 45
46#define OMAP1510_DSP_MMU_BASE (0xfffed200) 46#define OMAP1510_DSP_MMU_BASE (0xfffed200)
47 47
48/*
49 * ---------------------------------------------------------------------------
50 * OMAP-1510 FPGA
51 * ---------------------------------------------------------------------------
52 */
53#define OMAP1510_FPGA_BASE 0xE8000000 /* VA */
54#define OMAP1510_FPGA_SIZE SZ_4K
55#define OMAP1510_FPGA_START 0x08000000 /* PA */
56
57/* Revision */
58#define OMAP1510_FPGA_REV_LOW IOMEM(OMAP1510_FPGA_BASE + 0x0)
59#define OMAP1510_FPGA_REV_HIGH IOMEM(OMAP1510_FPGA_BASE + 0x1)
60#define OMAP1510_FPGA_LCD_PANEL_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x2)
61#define OMAP1510_FPGA_LED_DIGIT IOMEM(OMAP1510_FPGA_BASE + 0x3)
62#define INNOVATOR_FPGA_HID_SPI IOMEM(OMAP1510_FPGA_BASE + 0x4)
63#define OMAP1510_FPGA_POWER IOMEM(OMAP1510_FPGA_BASE + 0x5)
64
65/* Interrupt status */
66#define OMAP1510_FPGA_ISR_LO IOMEM(OMAP1510_FPGA_BASE + 0x6)
67#define OMAP1510_FPGA_ISR_HI IOMEM(OMAP1510_FPGA_BASE + 0x7)
68
69/* Interrupt mask */
70#define OMAP1510_FPGA_IMR_LO IOMEM(OMAP1510_FPGA_BASE + 0x8)
71#define OMAP1510_FPGA_IMR_HI IOMEM(OMAP1510_FPGA_BASE + 0x9)
72
73/* Reset registers */
74#define OMAP1510_FPGA_HOST_RESET IOMEM(OMAP1510_FPGA_BASE + 0xa)
75#define OMAP1510_FPGA_RST IOMEM(OMAP1510_FPGA_BASE + 0xb)
76
77#define OMAP1510_FPGA_AUDIO IOMEM(OMAP1510_FPGA_BASE + 0xc)
78#define OMAP1510_FPGA_DIP IOMEM(OMAP1510_FPGA_BASE + 0xe)
79#define OMAP1510_FPGA_FPGA_IO IOMEM(OMAP1510_FPGA_BASE + 0xf)
80#define OMAP1510_FPGA_UART1 IOMEM(OMAP1510_FPGA_BASE + 0x14)
81#define OMAP1510_FPGA_UART2 IOMEM(OMAP1510_FPGA_BASE + 0x15)
82#define OMAP1510_FPGA_OMAP1510_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x16)
83#define OMAP1510_FPGA_BOARD_REV IOMEM(OMAP1510_FPGA_BASE + 0x18)
84#define INNOVATOR_FPGA_CAM_USB_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20c)
85#define OMAP1510P1_PPT_DATA IOMEM(OMAP1510_FPGA_BASE + 0x100)
86#define OMAP1510P1_PPT_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x101)
87#define OMAP1510P1_PPT_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x102)
88
89#define OMAP1510_FPGA_TOUCHSCREEN IOMEM(OMAP1510_FPGA_BASE + 0x204)
90
91#define INNOVATOR_FPGA_INFO IOMEM(OMAP1510_FPGA_BASE + 0x205)
92#define INNOVATOR_FPGA_LCD_BRIGHT_LO IOMEM(OMAP1510_FPGA_BASE + 0x206)
93#define INNOVATOR_FPGA_LCD_BRIGHT_HI IOMEM(OMAP1510_FPGA_BASE + 0x207)
94#define INNOVATOR_FPGA_LED_GRN_LO IOMEM(OMAP1510_FPGA_BASE + 0x208)
95#define INNOVATOR_FPGA_LED_GRN_HI IOMEM(OMAP1510_FPGA_BASE + 0x209)
96#define INNOVATOR_FPGA_LED_RED_LO IOMEM(OMAP1510_FPGA_BASE + 0x20a)
97#define INNOVATOR_FPGA_LED_RED_HI IOMEM(OMAP1510_FPGA_BASE + 0x20b)
98#define INNOVATOR_FPGA_EXP_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20d)
99#define INNOVATOR_FPGA_ISR2 IOMEM(OMAP1510_FPGA_BASE + 0x20e)
100#define INNOVATOR_FPGA_IMR2 IOMEM(OMAP1510_FPGA_BASE + 0x210)
101
102#define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300)
103
104/*
105 * Power up Giga UART driver, turn on HID clock.
106 * Turn off BT power, since we're not using it and it
107 * draws power.
108 */
109#define OMAP1510_FPGA_RESET_VALUE 0x42
110
111#define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7)
112#define OMAP1510_FPGA_PCR_COM2_EN (1 << 6)
113#define OMAP1510_FPGA_PCR_COM1_EN (1 << 5)
114#define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4)
115#define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3)
116#define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2)
117#define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1)
118#define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0)
119
120/*
121 * Innovator/OMAP1510 FPGA HID register bit definitions
122 */
123#define OMAP1510_FPGA_HID_SCLK (1<<0) /* output */
124#define OMAP1510_FPGA_HID_MOSI (1<<1) /* output */
125#define OMAP1510_FPGA_HID_nSS (1<<2) /* output 0/1 chip idle/select */
126#define OMAP1510_FPGA_HID_nHSUS (1<<3) /* output 0/1 host active/suspended */
127#define OMAP1510_FPGA_HID_MISO (1<<4) /* input */
128#define OMAP1510_FPGA_HID_ATN (1<<5) /* input 0/1 chip idle/ATN */
129#define OMAP1510_FPGA_HID_rsrvd (1<<6)
130#define OMAP1510_FPGA_HID_RESETn (1<<7) /* output - 0/1 USAR reset/run */
131
132/* The FPGA IRQ is cascaded through GPIO_13 */
133#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
134
135/* IRQ Numbers for interrupts muxed through the FPGA */
136#define OMAP1510_INT_FPGA_ATN (OMAP_FPGA_IRQ_BASE + 0)
137#define OMAP1510_INT_FPGA_ACK (OMAP_FPGA_IRQ_BASE + 1)
138#define OMAP1510_INT_FPGA2 (OMAP_FPGA_IRQ_BASE + 2)
139#define OMAP1510_INT_FPGA3 (OMAP_FPGA_IRQ_BASE + 3)
140#define OMAP1510_INT_FPGA4 (OMAP_FPGA_IRQ_BASE + 4)
141#define OMAP1510_INT_FPGA5 (OMAP_FPGA_IRQ_BASE + 5)
142#define OMAP1510_INT_FPGA6 (OMAP_FPGA_IRQ_BASE + 6)
143#define OMAP1510_INT_FPGA7 (OMAP_FPGA_IRQ_BASE + 7)
144#define OMAP1510_INT_FPGA8 (OMAP_FPGA_IRQ_BASE + 8)
145#define OMAP1510_INT_FPGA9 (OMAP_FPGA_IRQ_BASE + 9)
146#define OMAP1510_INT_FPGA10 (OMAP_FPGA_IRQ_BASE + 10)
147#define OMAP1510_INT_FPGA11 (OMAP_FPGA_IRQ_BASE + 11)
148#define OMAP1510_INT_FPGA12 (OMAP_FPGA_IRQ_BASE + 12)
149#define OMAP1510_INT_ETHER (OMAP_FPGA_IRQ_BASE + 13)
150#define OMAP1510_INT_FPGAUART1 (OMAP_FPGA_IRQ_BASE + 14)
151#define OMAP1510_INT_FPGAUART2 (OMAP_FPGA_IRQ_BASE + 15)
152#define OMAP1510_INT_FPGA_TS (OMAP_FPGA_IRQ_BASE + 16)
153#define OMAP1510_INT_FPGA17 (OMAP_FPGA_IRQ_BASE + 17)
154#define OMAP1510_INT_FPGA_CAM (OMAP_FPGA_IRQ_BASE + 18)
155#define OMAP1510_INT_FPGA_RTC_A (OMAP_FPGA_IRQ_BASE + 19)
156#define OMAP1510_INT_FPGA_RTC_B (OMAP_FPGA_IRQ_BASE + 20)
157#define OMAP1510_INT_FPGA_CD (OMAP_FPGA_IRQ_BASE + 21)
158#define OMAP1510_INT_FPGA22 (OMAP_FPGA_IRQ_BASE + 22)
159#define OMAP1510_INT_FPGA23 (OMAP_FPGA_IRQ_BASE + 23)
160
48#endif /* __ASM_ARCH_OMAP15XX_H */ 161#endif /* __ASM_ARCH_OMAP15XX_H */
49 162
diff --git a/arch/arm/mach-omap1/include/mach/serial.h b/arch/arm/mach-omap1/include/mach/serial.h
new file mode 100644
index 00000000000..2ce6a2db470
--- /dev/null
+++ b/arch/arm/mach-omap1/include/mach/serial.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2009 Texas Instruments
3 * Added OMAP4 support- Santosh Shilimkar <santosh.shilimkar@ti.com>
4 *
5 * This program is distributed in the hope that it will be useful,
6 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 * GNU General Public License for more details.
9 */
10
11#ifndef __ASM_ARCH_SERIAL_H
12#define __ASM_ARCH_SERIAL_H
13
14#include <linux/init.h>
15
16/*
17 * Memory entry used for the DEBUG_LL UART configuration, relative to
18 * start of RAM. See also uncompress.h and debug-macro.S.
19 *
20 * Note that using a memory location for storing the UART configuration
21 * has at least two limitations:
22 *
23 * 1. Kernel uncompress code cannot overlap OMAP_UART_INFO as the
24 * uncompress code could then partially overwrite itself
25 * 2. We assume printascii is called at least once before paging_init,
26 * and addruart has a chance to read OMAP_UART_INFO
27 */
28#define OMAP_UART_INFO_OFS 0x3ffc
29
30/* OMAP1 serial ports */
31#define OMAP1_UART1_BASE 0xfffb0000
32#define OMAP1_UART2_BASE 0xfffb0800
33#define OMAP1_UART3_BASE 0xfffb9800
34
35#define OMAP_PORT_SHIFT 2
36#define OMAP7XX_PORT_SHIFT 0
37
38#define OMAP1510_BASE_BAUD (12000000/16)
39#define OMAP16XX_BASE_BAUD (48000000/16)
40
41/*
42 * DEBUG_LL port encoding stored into the UART1 scratchpad register by
43 * decomp_setup in uncompress.h
44 */
45#define OMAP1UART1 11
46#define OMAP1UART2 12
47#define OMAP1UART3 13
48
49#ifndef __ASSEMBLER__
50extern void omap_serial_init(void);
51#endif
52
53#endif
diff --git a/arch/arm/mach-omap1/include/mach/soc.h b/arch/arm/mach-omap1/include/mach/soc.h
new file mode 100644
index 00000000000..6cf9c1cc2be
--- /dev/null
+++ b/arch/arm/mach-omap1/include/mach/soc.h
@@ -0,0 +1,229 @@
1/*
2 * OMAP cpu type detection
3 *
4 * Copyright (C) 2004, 2008 Nokia Corporation
5 *
6 * Copyright (C) 2009-11 Texas Instruments.
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@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 as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28#ifndef __ASM_ARCH_OMAP_CPU_H
29#define __ASM_ARCH_OMAP_CPU_H
30
31#ifndef __ASSEMBLY__
32
33#include <linux/bitops.h>
34
35/*
36 * Test if multicore OMAP support is needed
37 */
38#undef MULTI_OMAP1
39#undef OMAP_NAME
40
41#ifdef CONFIG_ARCH_OMAP730
42# ifdef OMAP_NAME
43# undef MULTI_OMAP1
44# define MULTI_OMAP1
45# else
46# define OMAP_NAME omap730
47# endif
48#endif
49#ifdef CONFIG_ARCH_OMAP850
50# ifdef OMAP_NAME
51# undef MULTI_OMAP1
52# define MULTI_OMAP1
53# else
54# define OMAP_NAME omap850
55# endif
56#endif
57#ifdef CONFIG_ARCH_OMAP15XX
58# ifdef OMAP_NAME
59# undef MULTI_OMAP1
60# define MULTI_OMAP1
61# else
62# define OMAP_NAME omap1510
63# endif
64#endif
65#ifdef CONFIG_ARCH_OMAP16XX
66# ifdef OMAP_NAME
67# undef MULTI_OMAP1
68# define MULTI_OMAP1
69# else
70# define OMAP_NAME omap16xx
71# endif
72#endif
73
74/*
75 * omap_rev bits:
76 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
77 * CPU revision (See _REV_ defined in cpu.h) [15:08]
78 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
79 */
80unsigned int omap_rev(void);
81
82/*
83 * Get the CPU revision for OMAP devices
84 */
85#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
86
87/*
88 * Macros to group OMAP into cpu classes.
89 * These can be used in most places.
90 * cpu_is_omap7xx(): True for OMAP730, OMAP850
91 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
92 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
93 */
94#define GET_OMAP_CLASS (omap_rev() & 0xff)
95
96#define IS_OMAP_CLASS(class, id) \
97static inline int is_omap ##class (void) \
98{ \
99 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
100}
101
102#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
103
104#define IS_OMAP_SUBCLASS(subclass, id) \
105static inline int is_omap ##subclass (void) \
106{ \
107 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
108}
109
110IS_OMAP_CLASS(7xx, 0x07)
111IS_OMAP_CLASS(15xx, 0x15)
112IS_OMAP_CLASS(16xx, 0x16)
113
114#define cpu_is_omap7xx() 0
115#define cpu_is_omap15xx() 0
116#define cpu_is_omap16xx() 0
117
118#if defined(MULTI_OMAP1)
119# if defined(CONFIG_ARCH_OMAP730)
120# undef cpu_is_omap7xx
121# define cpu_is_omap7xx() is_omap7xx()
122# endif
123# if defined(CONFIG_ARCH_OMAP850)
124# undef cpu_is_omap7xx
125# define cpu_is_omap7xx() is_omap7xx()
126# endif
127# if defined(CONFIG_ARCH_OMAP15XX)
128# undef cpu_is_omap15xx
129# define cpu_is_omap15xx() is_omap15xx()
130# endif
131# if defined(CONFIG_ARCH_OMAP16XX)
132# undef cpu_is_omap16xx
133# define cpu_is_omap16xx() is_omap16xx()
134# endif
135#else
136# if defined(CONFIG_ARCH_OMAP730)
137# undef cpu_is_omap7xx
138# define cpu_is_omap7xx() 1
139# endif
140# if defined(CONFIG_ARCH_OMAP850)
141# undef cpu_is_omap7xx
142# define cpu_is_omap7xx() 1
143# endif
144# if defined(CONFIG_ARCH_OMAP15XX)
145# undef cpu_is_omap15xx
146# define cpu_is_omap15xx() 1
147# endif
148# if defined(CONFIG_ARCH_OMAP16XX)
149# undef cpu_is_omap16xx
150# define cpu_is_omap16xx() 1
151# endif
152#endif
153
154/*
155 * Macros to detect individual cpu types.
156 * These are only rarely needed.
157 * cpu_is_omap310(): True for OMAP310
158 * cpu_is_omap1510(): True for OMAP1510
159 * cpu_is_omap1610(): True for OMAP1610
160 * cpu_is_omap1611(): True for OMAP1611
161 * cpu_is_omap5912(): True for OMAP5912
162 * cpu_is_omap1621(): True for OMAP1621
163 * cpu_is_omap1710(): True for OMAP1710
164 */
165#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
166
167#define IS_OMAP_TYPE(type, id) \
168static inline int is_omap ##type (void) \
169{ \
170 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
171}
172
173IS_OMAP_TYPE(310, 0x0310)
174IS_OMAP_TYPE(1510, 0x1510)
175IS_OMAP_TYPE(1610, 0x1610)
176IS_OMAP_TYPE(1611, 0x1611)
177IS_OMAP_TYPE(5912, 0x1611)
178IS_OMAP_TYPE(1621, 0x1621)
179IS_OMAP_TYPE(1710, 0x1710)
180
181#define cpu_is_omap310() 0
182#define cpu_is_omap1510() 0
183#define cpu_is_omap1610() 0
184#define cpu_is_omap5912() 0
185#define cpu_is_omap1611() 0
186#define cpu_is_omap1621() 0
187#define cpu_is_omap1710() 0
188
189/* These are needed to compile common code */
190#ifdef CONFIG_ARCH_OMAP1
191#define cpu_is_omap242x() 0
192#define cpu_is_omap2430() 0
193#define cpu_is_omap243x() 0
194#define cpu_is_omap24xx() 0
195#define cpu_is_omap34xx() 0
196#define cpu_is_omap44xx() 0
197#define soc_is_omap54xx() 0
198#define soc_is_am33xx() 0
199#define cpu_class_is_omap1() 1
200#define cpu_class_is_omap2() 0
201#endif
202
203/*
204 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
205 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
206 */
207
208#if defined(CONFIG_ARCH_OMAP15XX)
209# undef cpu_is_omap310
210# undef cpu_is_omap1510
211# define cpu_is_omap310() is_omap310()
212# define cpu_is_omap1510() is_omap1510()
213#endif
214
215#if defined(CONFIG_ARCH_OMAP16XX)
216# undef cpu_is_omap1610
217# undef cpu_is_omap1611
218# undef cpu_is_omap5912
219# undef cpu_is_omap1621
220# undef cpu_is_omap1710
221# define cpu_is_omap1610() is_omap1610()
222# define cpu_is_omap1611() is_omap1611()
223# define cpu_is_omap5912() is_omap5912()
224# define cpu_is_omap1621() is_omap1621()
225# define cpu_is_omap1710() is_omap1710()
226#endif
227
228#endif /* __ASSEMBLY__ */
229#endif
diff --git a/arch/arm/plat-omap/include/plat/tc.h b/arch/arm/mach-omap1/include/mach/tc.h
index 1b4b2da8620..1b4b2da8620 100644
--- a/arch/arm/plat-omap/include/plat/tc.h
+++ b/arch/arm/mach-omap1/include/mach/tc.h
diff --git a/arch/arm/mach-omap1/include/mach/uncompress.h b/arch/arm/mach-omap1/include/mach/uncompress.h
index 0ff22dc075c..ad6fbe7d83f 100644
--- a/arch/arm/mach-omap1/include/mach/uncompress.h
+++ b/arch/arm/mach-omap1/include/mach/uncompress.h
@@ -1,5 +1,122 @@
1/* 1/*
2 * arch/arm/mach-omap1/include/mach/uncompress.h 2 * arch/arm/plat-omap/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Initially based on:
7 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Author: Greg Lonnon <glonnon@ridgerun.com>
10 *
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
3 */ 18 */
4 19
5#include <plat/uncompress.h> 20#include <linux/types.h>
21#include <linux/serial_reg.h>
22
23#include <asm/memory.h>
24#include <asm/mach-types.h>
25
26#include "serial.h"
27
28#define MDR1_MODE_MASK 0x07
29
30volatile u8 *uart_base;
31int uart_shift;
32
33/*
34 * Store the DEBUG_LL uart number into memory.
35 * See also debug-macro.S, and serial.c for related code.
36 */
37static void set_omap_uart_info(unsigned char port)
38{
39 /*
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
42 */
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
46}
47
48static void putc(int c)
49{
50 if (!uart_base)
51 return;
52
53 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
56
57 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
58 barrier();
59 uart_base[UART_TX << uart_shift] = c;
60}
61
62static inline void flush(void)
63{
64}
65
66/*
67 * Macros to configure UART1 and debug UART
68 */
69#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
70 if (machine_is_##mach()) { \
71 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
74 set_omap_uart_info(port); \
75 break; \
76 }
77
78#define DEBUG_LL_OMAP7XX(p, mach) \
79 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
80 OMAP1UART##p)
81
82#define DEBUG_LL_OMAP1(p, mach) \
83 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP1UART##p)
85
86static inline void arch_decomp_setup(void)
87{
88 int port = 0;
89
90 /*
91 * Initialize the port based on the machine ID from the bootloader.
92 * Note that we're using macros here instead of switch statement
93 * as machine_is functions are optimized out for the boards that
94 * are not selected.
95 */
96 do {
97 /* omap7xx/8xx based boards using UART1 with shift 0 */
98 DEBUG_LL_OMAP7XX(1, herald);
99 DEBUG_LL_OMAP7XX(1, omap_perseus2);
100
101 /* omap15xx/16xx based boards using UART1 */
102 DEBUG_LL_OMAP1(1, ams_delta);
103 DEBUG_LL_OMAP1(1, nokia770);
104 DEBUG_LL_OMAP1(1, omap_h2);
105 DEBUG_LL_OMAP1(1, omap_h3);
106 DEBUG_LL_OMAP1(1, omap_innovator);
107 DEBUG_LL_OMAP1(1, omap_osk);
108 DEBUG_LL_OMAP1(1, omap_palmte);
109 DEBUG_LL_OMAP1(1, omap_palmz71);
110
111 /* omap15xx/16xx based boards using UART2 */
112 DEBUG_LL_OMAP1(2, omap_palmtt);
113
114 /* omap15xx/16xx based boards using UART3 */
115 DEBUG_LL_OMAP1(3, sx1);
116 } while (0);
117}
118
119/*
120 * nothing to do
121 */
122#define arch_decomp_wdog()
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 6a5baab1f4c..499b8accb83 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -17,8 +17,8 @@
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18 18
19#include <mach/mux.h> 19#include <mach/mux.h>
20#include <plat/tc.h> 20#include <mach/tc.h>
21#include <plat/dma.h> 21#include <linux/omap-dma.h>
22 22
23#include "iomap.h" 23#include "iomap.h"
24#include "common.h" 24#include "common.h"
@@ -134,7 +134,6 @@ void __init omap1_init_early(void)
134 */ 134 */
135 omap1_clk_init(); 135 omap1_clk_init();
136 omap1_mux_init(); 136 omap1_mux_init();
137 omap_init_consistent_dma_size();
138} 137}
139 138
140void __init omap1_init_late(void) 139void __init omap1_init_late(void)
diff --git a/arch/arm/mach-omap1/iomap.h b/arch/arm/mach-omap1/iomap.h
index 330c4716b02..f4e2d7a2136 100644
--- a/arch/arm/mach-omap1/iomap.h
+++ b/arch/arm/mach-omap1/iomap.h
@@ -22,9 +22,6 @@
22 * 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 23 */
24 24
25#define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
26#define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET)
27
28/* 25/*
29 * ---------------------------------------------------------------------------- 26 * ----------------------------------------------------------------------------
30 * Omap1 specific IO mapping 27 * Omap1 specific IO mapping
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 6995fb6a334..122ef67939a 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -45,7 +45,7 @@
45#include <asm/irq.h> 45#include <asm/irq.h>
46#include <asm/mach/irq.h> 46#include <asm/mach/irq.h>
47 47
48#include <plat/cpu.h> 48#include "soc.h"
49 49
50#include <mach/hardware.h> 50#include <mach/hardware.h>
51 51
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index ed42628611b..77924be37d4 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -27,11 +27,13 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <plat/dma.h> 30#include <linux/omap-dma.h>
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/lcdc.h> 33#include <mach/lcdc.h>
34 34
35#include "dma.h"
36
35int omap_lcd_dma_running(void) 37int omap_lcd_dma_running(void)
36{ 38{
37 /* 39 /*
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index bdc2e7541ad..b0d4723c9a9 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -19,14 +19,15 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21 21
22#include <plat/dma.h> 22#include <linux/omap-dma.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <plat/cpu.h> 24#include "soc.h"
25#include <linux/platform_data/asoc-ti-mcbsp.h> 25#include <linux/platform_data/asoc-ti-mcbsp.h>
26 26
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28 28
29#include "iomap.h" 29#include "iomap.h"
30#include "dma.h"
30 31
31#define DPS_RSTCT2_PER_EN (1 << 0) 32#define DPS_RSTCT2_PER_EN (1 << 0)
32#define DSP_RSTCT2_WD_PER_EN (1 << 1) 33#define DSP_RSTCT2_WD_PER_EN (1 << 1)
diff --git a/arch/arm/mach-omap1/mmc.h b/arch/arm/mach-omap1/mmc.h
new file mode 100644
index 00000000000..39c2b13de88
--- /dev/null
+++ b/arch/arm/mach-omap1/mmc.h
@@ -0,0 +1,18 @@
1#include <linux/mmc/host.h>
2#include <linux/platform_data/mmc-omap.h>
3
4#define OMAP15XX_NR_MMC 1
5#define OMAP16XX_NR_MMC 2
6#define OMAP1_MMC_SIZE 0x080
7#define OMAP1_MMC1_BASE 0xfffb7800
8#define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
9
10#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
11void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
12 int nr_controllers);
13#else
14static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
15 int nr_controllers)
16{
17}
18#endif
diff --git a/arch/arm/mach-omap1/opp_data.c b/arch/arm/mach-omap1/opp_data.c
index 9cd4ddb5139..8dcebe6d888 100644
--- a/arch/arm/mach-omap1/opp_data.c
+++ b/arch/arm/mach-omap1/opp_data.c
@@ -10,7 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#include <plat/clkdev_omap.h> 13#include "clock.h"
14#include "opp.h" 14#include "opp.h"
15 15
16/*------------------------------------------------------------------------- 16/*-------------------------------------------------------------------------
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 47ec1615548..7a7690ab6cb 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -44,23 +44,23 @@
44#include <linux/io.h> 44#include <linux/io.h>
45#include <linux/atomic.h> 45#include <linux/atomic.h>
46 46
47#include <asm/fncpy.h>
47#include <asm/system_misc.h> 48#include <asm/system_misc.h>
48#include <asm/irq.h> 49#include <asm/irq.h>
49#include <asm/mach/time.h> 50#include <asm/mach/time.h>
50#include <asm/mach/irq.h> 51#include <asm/mach/irq.h>
51 52
52#include <plat/cpu.h> 53#include <mach/tc.h>
53#include <plat/clock.h>
54#include <plat/sram.h>
55#include <plat/tc.h>
56#include <mach/mux.h> 54#include <mach/mux.h>
57#include <plat/dma.h> 55#include <linux/omap-dma.h>
58#include <plat/dmtimer.h> 56#include <plat/dmtimer.h>
59 57
60#include <mach/irqs.h> 58#include <mach/irqs.h>
61 59
62#include "iomap.h" 60#include "iomap.h"
61#include "clock.h"
63#include "pm.h" 62#include "pm.h"
63#include "sram.h"
64 64
65static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE]; 65static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
66static unsigned short dsp_sleep_save[DSP_SLEEP_SAVE_SIZE]; 66static unsigned short dsp_sleep_save[DSP_SLEEP_SAVE_SIZE];
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
index 7868e75ad07..3f2d3967239 100644
--- a/arch/arm/mach-omap1/pm_bus.c
+++ b/arch/arm/mach-omap1/pm_bus.c
@@ -19,8 +19,7 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/err.h> 20#include <linux/err.h>
21 21
22#include <plat/omap_device.h> 22#include "soc.h"
23#include <plat/omap-pm.h>
24 23
25#ifdef CONFIG_PM_RUNTIME 24#ifdef CONFIG_PM_RUNTIME
26static int omap1_pm_runtime_suspend(struct device *dev) 25static int omap1_pm_runtime_suspend(struct device *dev)
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index b1770910386..5eebd7e889d 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -4,12 +4,24 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/io.h> 5#include <linux/io.h>
6 6
7#include <plat/prcm.h>
8
9#include <mach/hardware.h> 7#include <mach/hardware.h>
10 8
9#include "iomap.h"
11#include "common.h" 10#include "common.h"
12 11
12/* ARM_SYSST bit shifts related to SoC reset sources */
13#define ARM_SYSST_POR_SHIFT 5
14#define ARM_SYSST_EXT_RST_SHIFT 4
15#define ARM_SYSST_ARM_WDRST_SHIFT 2
16#define ARM_SYSST_GLOB_SWRST_SHIFT 1
17
18/* Standardized reset source bits (across all OMAP SoCs) */
19#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
20#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
21#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
22#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
23
24
13void omap1_restart(char mode, const char *cmd) 25void omap1_restart(char mode, const char *cmd)
14{ 26{
15 /* 27 /*
@@ -23,3 +35,28 @@ void omap1_restart(char mode, const char *cmd)
23 35
24 omap_writew(1, ARM_RSTCT1); 36 omap_writew(1, ARM_RSTCT1);
25} 37}
38
39/**
40 * omap1_get_reset_sources - return the source of the SoC's last reset
41 *
42 * Returns bits that represent the last reset source for the SoC. The
43 * format is standardized across OMAPs for use by the OMAP watchdog.
44 */
45u32 omap1_get_reset_sources(void)
46{
47 u32 ret = 0;
48 u16 rs;
49
50 rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST));
51
52 if (rs & (1 << ARM_SYSST_POR_SHIFT))
53 ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT;
54 if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT))
55 ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT;
56 if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT))
57 ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT;
58 if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT))
59 ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT;
60
61 return ret;
62}
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index b9d6834af83..d1ac08016f0 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -23,7 +23,6 @@
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <mach/mux.h> 25#include <mach/mux.h>
26#include <plat/fpga.h>
27 26
28#include "pm.h" 27#include "pm.h"
29 28
diff --git a/arch/arm/mach-omap1/sleep.S b/arch/arm/mach-omap1/sleep.S
index 0e628743bd0..a908c51839a 100644
--- a/arch/arm/mach-omap1/sleep.S
+++ b/arch/arm/mach-omap1/sleep.S
@@ -36,6 +36,8 @@
36 36
37#include <asm/assembler.h> 37#include <asm/assembler.h>
38 38
39#include <mach/hardware.h>
40
39#include "iomap.h" 41#include "iomap.h"
40#include "pm.h" 42#include "pm.h"
41 43
diff --git a/arch/arm/mach-omap1/soc.h b/arch/arm/mach-omap1/soc.h
new file mode 100644
index 00000000000..69daf0187b1
--- /dev/null
+++ b/arch/arm/mach-omap1/soc.h
@@ -0,0 +1,4 @@
1/*
2 * We can move mach/soc.h here once the drivers are fixed
3 */
4#include <mach/soc.h>
diff --git a/arch/arm/mach-omap1/sram-init.c b/arch/arm/mach-omap1/sram-init.c
new file mode 100644
index 00000000000..6431b0f862c
--- /dev/null
+++ b/arch/arm/mach-omap1/sram-init.c
@@ -0,0 +1,76 @@
1/*
2 * OMAP SRAM detection and management
3 *
4 * Copyright (C) 2005 Nokia Corporation
5 * Written by Tony Lindgren <tony@atomide.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/io.h>
16
17#include <asm/fncpy.h>
18#include <asm/tlb.h>
19#include <asm/cacheflush.h>
20
21#include <asm/mach/map.h>
22
23#include "soc.h"
24#include "sram.h"
25
26#define OMAP1_SRAM_PA 0x20000000
27#define SRAM_BOOTLOADER_SZ 0x80
28
29/*
30 * The amount of SRAM depends on the core type.
31 * Note that we cannot try to test for SRAM here because writes
32 * to secure SRAM will hang the system. Also the SRAM is not
33 * yet mapped at this point.
34 */
35static void __init omap_detect_and_map_sram(void)
36{
37 unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ;
38 unsigned long omap_sram_start = OMAP1_SRAM_PA;
39 unsigned long omap_sram_size;
40
41 if (cpu_is_omap7xx())
42 omap_sram_size = 0x32000; /* 200K */
43 else if (cpu_is_omap15xx())
44 omap_sram_size = 0x30000; /* 192K */
45 else if (cpu_is_omap1610() || cpu_is_omap1611() ||
46 cpu_is_omap1621() || cpu_is_omap1710())
47 omap_sram_size = 0x4000; /* 16K */
48 else {
49 pr_err("Could not detect SRAM size\n");
50 omap_sram_size = 0x4000;
51 }
52
53 omap_map_sram(omap_sram_start, omap_sram_size,
54 omap_sram_skip, 1);
55}
56
57static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
58
59void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
60{
61 BUG_ON(!_omap_sram_reprogram_clock);
62 /* On 730, bit 13 must always be 1 */
63 if (cpu_is_omap7xx())
64 ckctl |= 0x2000;
65 _omap_sram_reprogram_clock(dpllctl, ckctl);
66}
67
68int __init omap_sram_init(void)
69{
70 omap_detect_and_map_sram();
71 _omap_sram_reprogram_clock =
72 omap_sram_push(omap1_sram_reprogram_clock,
73 omap1_sram_reprogram_clock_sz);
74
75 return 0;
76}
diff --git a/arch/arm/mach-omap1/sram.h b/arch/arm/mach-omap1/sram.h
new file mode 100644
index 00000000000..d5a6c836230
--- /dev/null
+++ b/arch/arm/mach-omap1/sram.h
@@ -0,0 +1,7 @@
1#include <plat/sram.h>
2
3extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
4
5/* Do not use these */
6extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
7extern unsigned long omap1_sram_reprogram_clock_sz;
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index cdeb9d3ef64..bde7a35e500 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -25,6 +25,7 @@
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/platform_data/dmtimer-omap.h>
28 29
29#include <mach/irqs.h> 30#include <mach/irqs.h>
30 31
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index 74529549130..41152fadd4c 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -50,7 +50,7 @@
50#include <asm/mach/irq.h> 50#include <asm/mach/irq.h>
51#include <asm/mach/time.h> 51#include <asm/mach/time.h>
52 52
53#include <plat/dmtimer.h> 53#include <plat/counter-32k.h>
54 54
55#include <mach/hardware.h> 55#include <mach/hardware.h>
56 56
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c
index 84267edd942..104fed366b8 100644
--- a/arch/arm/mach-omap1/usb.c
+++ b/arch/arm/mach-omap1/usb.c
@@ -301,7 +301,7 @@ static inline void otg_device_init(struct omap_usb_config *pdata)
301 301
302#endif 302#endif
303 303
304u32 __init omap1_usb0_init(unsigned nwires, unsigned is_device) 304static u32 __init omap1_usb0_init(unsigned nwires, unsigned is_device)
305{ 305{
306 u32 syscon1 = 0; 306 u32 syscon1 = 0;
307 307
@@ -409,7 +409,7 @@ u32 __init omap1_usb0_init(unsigned nwires, unsigned is_device)
409 return syscon1 << 16; 409 return syscon1 << 16;
410} 410}
411 411
412u32 __init omap1_usb1_init(unsigned nwires) 412static u32 __init omap1_usb1_init(unsigned nwires)
413{ 413{
414 u32 syscon1 = 0; 414 u32 syscon1 = 0;
415 415
@@ -475,7 +475,7 @@ bad:
475 return syscon1 << 20; 475 return syscon1 << 20;
476} 476}
477 477
478u32 __init omap1_usb2_init(unsigned nwires, unsigned alt_pingroup) 478static u32 __init omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
479{ 479{
480 u32 syscon1 = 0; 480 u32 syscon1 = 0;
481 481
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index d669e227e00..be0f62bf903 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -34,6 +34,7 @@ config ARCH_OMAP2
34 select CPU_V6 34 select CPU_V6
35 select MULTI_IRQ_HANDLER 35 select MULTI_IRQ_HANDLER
36 select SOC_HAS_OMAP2_SDRC 36 select SOC_HAS_OMAP2_SDRC
37 select COMMON_CLK
37 38
38config ARCH_OMAP3 39config ARCH_OMAP3
39 bool "TI OMAP3" 40 bool "TI OMAP3"
@@ -47,6 +48,7 @@ config ARCH_OMAP3
47 select PM_OPP if PM 48 select PM_OPP if PM
48 select PM_RUNTIME if CPU_IDLE 49 select PM_RUNTIME if CPU_IDLE
49 select SOC_HAS_OMAP2_SDRC 50 select SOC_HAS_OMAP2_SDRC
51 select COMMON_CLK
50 select USB_ARCH_HAS_EHCI if USB_SUPPORT 52 select USB_ARCH_HAS_EHCI if USB_SUPPORT
51 53
52config ARCH_OMAP4 54config ARCH_OMAP4
@@ -68,6 +70,7 @@ config ARCH_OMAP4
68 select PM_OPP if PM 70 select PM_OPP if PM
69 select PM_RUNTIME if CPU_IDLE 71 select PM_RUNTIME if CPU_IDLE
70 select USB_ARCH_HAS_EHCI if USB_SUPPORT 72 select USB_ARCH_HAS_EHCI if USB_SUPPORT
73 select COMMON_CLK
71 74
72config SOC_OMAP5 75config SOC_OMAP5
73 bool "TI OMAP5" 76 bool "TI OMAP5"
@@ -77,6 +80,7 @@ config SOC_OMAP5
77 select CPU_V7 80 select CPU_V7
78 select HAVE_SMP 81 select HAVE_SMP
79 select SOC_HAS_REALTIME_COUNTER 82 select SOC_HAS_REALTIME_COUNTER
83 select COMMON_CLK
80 84
81comment "OMAP Core Type" 85comment "OMAP Core Type"
82 depends on ARCH_OMAP2 86 depends on ARCH_OMAP2
@@ -111,6 +115,7 @@ config SOC_AM33XX
111 select ARM_CPU_SUSPEND if PM 115 select ARM_CPU_SUSPEND if PM
112 select CPU_V7 116 select CPU_V7
113 select MULTI_IRQ_HANDLER 117 select MULTI_IRQ_HANDLER
118 select COMMON_CLK
114 119
115config OMAP_PACKAGE_ZAF 120config OMAP_PACKAGE_ZAF
116 bool 121 bool
@@ -270,14 +275,14 @@ config MACH_NOKIA_N8X0
270 select OMAP_PACKAGE_ZAC 275 select OMAP_PACKAGE_ZAC
271 276
272config MACH_NOKIA_RM680 277config MACH_NOKIA_RM680
273 bool "Nokia RM-680/696 board" 278 bool "Nokia N950 (RM-680) / N9 (RM-696) phones"
274 depends on ARCH_OMAP3 279 depends on ARCH_OMAP3
275 default y 280 default y
276 select MACH_NOKIA_RM696 281 select MACH_NOKIA_RM696
277 select OMAP_PACKAGE_CBB 282 select OMAP_PACKAGE_CBB
278 283
279config MACH_NOKIA_RX51 284config MACH_NOKIA_RX51
280 bool "Nokia RX-51 board" 285 bool "Nokia N900 (RX-51) phone"
281 depends on ARCH_OMAP3 286 depends on ARCH_OMAP3
282 default y 287 default y
283 select OMAP_PACKAGE_CBB 288 select OMAP_PACKAGE_CBB
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e488c..a8004f33b7e 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,30 +4,37 @@
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
8 8 omap_device.o sram.o
9# INTCPS IP block support - XXX should be moved to drivers/ 9
10obj-$(CONFIG_ARCH_OMAP2) += irq.o 10omap-2-3-common = irq.o
11obj-$(CONFIG_ARCH_OMAP3) += irq.o 11hwmod-common = omap_hwmod.o \
12obj-$(CONFIG_SOC_AM33XX) += irq.o 12 omap_hwmod_common_data.o
13 13clock-common = clock.o clock_common_data.o \
14# Secure monitor API support 14 clkt_dpll.o clkt_clksel.o
15obj-$(CONFIG_ARCH_OMAP3) += omap-smc.o omap-secure.o 15secure-common = omap-smc.o omap-secure.o
16obj-$(CONFIG_ARCH_OMAP4) += omap-smc.o omap-secure.o 16
17obj-$(CONFIG_SOC_OMAP5) += omap-smc.o omap-secure.o 17obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
18obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
19obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
20obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common)
21obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common)
18 22
19ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 23ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
20obj-y += mcbsp.o 24obj-y += mcbsp.o
21endif 25endif
22 26
23obj-$(CONFIG_TWL4030_CORE) += omap_twl.o 27obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
28obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
24 29
25# SMP support ONLY available for OMAP4 30# SMP support ONLY available for OMAP4
26 31
27obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 32obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
28obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o 33obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
29obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o 34omap-4-5-common = omap4-common.o omap-wakeupgen.o \
30obj-$(CONFIG_SOC_OMAP5) += omap4-common.o omap-wakeupgen.o 35 sleep44xx.o
36obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common)
37obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common)
31 38
32plus_sec := $(call as-instr,.arch_extension sec,+sec) 39plus_sec := $(call as-instr,.arch_extension sec,+sec)
33AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) 40AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -43,6 +50,11 @@ AFLAGS_sram242x.o :=-Wa,-march=armv6
43AFLAGS_sram243x.o :=-Wa,-march=armv6 50AFLAGS_sram243x.o :=-Wa,-march=armv6
44AFLAGS_sram34xx.o :=-Wa,-march=armv7-a 51AFLAGS_sram34xx.o :=-Wa,-march=armv7-a
45 52
53# Restart code (OMAP4/5 currently in omap4-common.c)
54obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o
55obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o
56obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o
57
46# Pin multiplexing 58# Pin multiplexing
47obj-$(CONFIG_SOC_OMAP2420) += mux2420.o 59obj-$(CONFIG_SOC_OMAP2420) += mux2420.o
48obj-$(CONFIG_SOC_OMAP2430) += mux2430.o 60obj-$(CONFIG_SOC_OMAP2430) += mux2430.o
@@ -52,7 +64,6 @@ obj-$(CONFIG_ARCH_OMAP4) += mux44xx.o
52# SMS/SDRC 64# SMS/SDRC
53obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o 65obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
54# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o 66# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o
55obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
56 67
57# OPP table initialization 68# OPP table initialization
58ifeq ($(CONFIG_PM_OPP),y) 69ifeq ($(CONFIG_PM_OPP),y)
@@ -62,16 +73,18 @@ obj-$(CONFIG_ARCH_OMAP4) += opp4xxx_data.o
62endif 73endif
63 74
64# Power Management 75# Power Management
76obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
77
65ifeq ($(CONFIG_PM),y) 78ifeq ($(CONFIG_PM),y)
66obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o sleep24xx.o 79obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
80obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o
67obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o 81obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o
68obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o 82obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o
69obj-$(CONFIG_ARCH_OMAP4) += sleep44xx.o 83obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o
70obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o sleep44xx.o
71obj-$(CONFIG_PM_DEBUG) += pm-debug.o 84obj-$(CONFIG_PM_DEBUG) += pm-debug.o
72 85
73obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o 86obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o
74obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o 87obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o
75 88
76AFLAGS_sleep24xx.o :=-Wa,-march=armv6 89AFLAGS_sleep24xx.o :=-Wa,-march=armv6
77AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) 90AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -83,76 +96,82 @@ endif
83endif 96endif
84 97
85ifeq ($(CONFIG_CPU_IDLE),y) 98ifeq ($(CONFIG_CPU_IDLE),y)
86obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o 99obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
87obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o 100obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o
88endif 101endif
89 102
90# PRCM 103# PRCM
91obj-y += prcm.o prm_common.o 104obj-y += prm_common.o cm_common.o
92obj-$(CONFIG_ARCH_OMAP2) += cm2xxx_3xxx.o prm2xxx_3xxx.o 105obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
93obj-$(CONFIG_ARCH_OMAP3) += cm2xxx_3xxx.o prm2xxx_3xxx.o 106obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
94obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 107obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
95obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o 108obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o
96omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ 109omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \
97 prcm_mpu44xx.o prminst44xx.o \ 110 prcm_mpu44xx.o prminst44xx.o \
98 vc44xx_data.o vp44xx_data.o \ 111 vc44xx_data.o vp44xx_data.o
99 prm44xx.o
100obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) 112obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common)
101obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) 113obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common)
102 114
103# OMAP voltage domains 115# OMAP voltage domains
104obj-y += voltage.o vc.o vp.o 116voltagedomain-common := voltage.o vc.o vp.o
117obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common)
105obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o 118obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o
119obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common)
106obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o 120obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o
121obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common)
107obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o 122obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o
108obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o 123obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common)
124obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o
125obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common)
109 126
110# OMAP powerdomain framework 127# OMAP powerdomain framework
111obj-y += powerdomain.o powerdomain-common.o 128powerdomain-common += powerdomain.o powerdomain-common.o
129obj-$(CONFIG_ARCH_OMAP2) += $(powerdomain-common)
112obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o 130obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o
113obj-$(CONFIG_ARCH_OMAP2) += powerdomain2xxx_3xxx.o
114obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o 131obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o
115obj-$(CONFIG_ARCH_OMAP3) += powerdomain2xxx_3xxx.o 132obj-$(CONFIG_ARCH_OMAP3) += $(powerdomain-common)
116obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o 133obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o
117obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o 134obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o
118obj-$(CONFIG_ARCH_OMAP4) += powerdomain44xx.o 135obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common)
119obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o 136obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o
120obj-$(CONFIG_SOC_AM33XX) += powerdomain33xx.o 137obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common)
121obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o 138obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o
122obj-$(CONFIG_SOC_OMAP5) += powerdomain44xx.o 139obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common)
123 140
124# PRCM clockdomain control 141# PRCM clockdomain control
125obj-y += clockdomain.o 142clockdomain-common += clockdomain.o
126obj-$(CONFIG_ARCH_OMAP2) += clockdomain2xxx_3xxx.o 143obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common)
127obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o 144obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o
128obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o 145obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o
129obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o 146obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o
130obj-$(CONFIG_ARCH_OMAP3) += clockdomain2xxx_3xxx.o 147obj-$(CONFIG_ARCH_OMAP3) += $(clockdomain-common)
131obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o 148obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o
132obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o 149obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o
133obj-$(CONFIG_ARCH_OMAP4) += clockdomain44xx.o 150obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common)
134obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o 151obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o
135obj-$(CONFIG_SOC_AM33XX) += clockdomain33xx.o 152obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common)
136obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o 153obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o
137obj-$(CONFIG_SOC_OMAP5) += clockdomain44xx.o 154obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common)
138 155
139# Clock framework 156# Clock framework
140obj-y += clock.o clock_common_data.o \ 157obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o
141 clkt_dpll.o clkt_clksel.o 158obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_sys.o
142obj-$(CONFIG_ARCH_OMAP2) += clock2xxx.o 159obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o
143obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o clkt2xxx_sys.o
144obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o 160obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o
145obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o 161obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o
146obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o 162obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o
147obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o 163obj-$(CONFIG_SOC_OMAP2420) += cclock2420_data.o
148obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o 164obj-$(CONFIG_SOC_OMAP2430) += clock2430.o cclock2430_data.o
149obj-$(CONFIG_ARCH_OMAP3) += clock3xxx.o 165obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o
150obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o 166obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o
151obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o clkt_iclk.o 167obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o
152obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o 168obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o cclock3xxx_data.o
153obj-$(CONFIG_ARCH_OMAP4) += clock44xx_data.o 169obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o
170obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) cclock44xx_data.o
154obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o 171obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
155obj-$(CONFIG_SOC_AM33XX) += dpll3xxx.o clock33xx_data.o 172obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o
173obj-$(CONFIG_SOC_AM33XX) += cclock33xx_data.o
174obj-$(CONFIG_SOC_OMAP5) += $(clock-common)
156obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o 175obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o
157 176
158# OMAP2 clock rate set data (old "OPP" data) 177# OMAP2 clock rate set data (old "OPP" data)
@@ -160,7 +179,6 @@ obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
160obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o 179obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o
161 180
162# hwmod data 181# hwmod data
163obj-y += omap_hwmod_common_data.o
164obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o 182obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o
165obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o 183obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o
166obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o 184obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o
@@ -184,8 +202,6 @@ obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o
184obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o 202obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
185mailbox_mach-objs := mailbox.o 203mailbox_mach-objs := mailbox.o
186 204
187obj-$(CONFIG_OMAP_IOMMU) += iommu2.o
188
189iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o 205iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
190obj-y += $(iommu-m) $(iommu-y) 206obj-y += $(iommu-m) $(iommu-y)
191 207
@@ -206,10 +222,10 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
206obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o 222obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
207obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o 223obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o
208obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o 224obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
209obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o 225obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
210obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 226obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
211obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o 227obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
212obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o 228obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
213obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o 229obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o
214obj-$(CONFIG_MACH_OVERO) += board-overo.o 230obj-$(CONFIG_MACH_OVERO) += board-overo.o
215obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o 231obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
@@ -279,4 +295,4 @@ endif
279emac-$(CONFIG_TI_DAVINCI_EMAC) := am35xx-emac.o 295emac-$(CONFIG_TI_DAVINCI_EMAC) := am35xx-emac.o
280obj-y += $(emac-m) $(emac-y) 296obj-y += $(emac-m) $(emac-y)
281 297
282obj-y += common-board-devices.o twl-common.o 298obj-y += common-board-devices.o twl-common.o dss-common.o
diff --git a/arch/arm/mach-omap2/am33xx.h b/arch/arm/mach-omap2/am33xx.h
index 06c19bb7bca..43296c1af9e 100644
--- a/arch/arm/mach-omap2/am33xx.h
+++ b/arch/arm/mach-omap2/am33xx.h
@@ -21,5 +21,6 @@
21#define AM33XX_SCM_BASE 0x44E10000 21#define AM33XX_SCM_BASE 0x44E10000
22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE 22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE
23#define AM33XX_PRCM_BASE 0x44E00000 23#define AM33XX_PRCM_BASE 0x44E00000
24#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + 0x3FC)
24 25
25#endif /* __ASM_ARCH_AM33XX_H */ 26#endif /* __ASM_ARCH_AM33XX_H */
diff --git a/arch/arm/mach-omap2/am35xx-emac.c b/arch/arm/mach-omap2/am35xx-emac.c
index d0c54c573d3..af11dcdb7e2 100644
--- a/arch/arm/mach-omap2/am35xx-emac.c
+++ b/arch/arm/mach-omap2/am35xx-emac.c
@@ -18,7 +18,7 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/davinci_emac.h> 19#include <linux/davinci_emac.h>
20#include <asm/system.h> 20#include <asm/system.h>
21#include <plat/omap_device.h> 21#include "omap_device.h"
22#include "am35xx.h" 22#include "am35xx.h"
23#include "control.h" 23#include "control.h"
24#include "am35xx-emac.h" 24#include "am35xx-emac.h"
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 95b384d54f8..4815ea6f8f5 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -28,14 +28,12 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30 30
31#include <mach/hardware.h>
32#include <asm/mach-types.h> 31#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 33#include <asm/mach/map.h>
35 34
36#include "common.h" 35#include "common.h"
37#include <plat/gpmc.h> 36#include "gpmc.h"
38#include <plat/usb.h>
39#include "gpmc-smc91x.h" 37#include "gpmc-smc91x.h"
40 38
41#include <video/omapdss.h> 39#include <video/omapdss.h>
@@ -287,5 +285,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
287 .init_machine = omap_2430sdp_init, 285 .init_machine = omap_2430sdp_init,
288 .init_late = omap2430_init_late, 286 .init_late = omap2430_init_late,
289 .timer = &omap2_timer, 287 .timer = &omap2_timer,
290 .restart = omap_prcm_restart, 288 .restart = omap2xxx_restart,
291MACHINE_END 289MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 96cd3693e1a..7b201546834 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -30,15 +30,15 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <plat/usb.h>
34#include "common.h" 33#include "common.h"
35#include <plat/dma.h> 34#include <linux/omap-dma.h>
36#include <plat/gpmc.h>
37#include <video/omapdss.h> 35#include <video/omapdss.h>
38#include <video/omap-panel-tfp410.h> 36#include <video/omap-panel-tfp410.h>
39 37
38#include "gpmc.h"
40#include "gpmc-smc91x.h" 39#include "gpmc-smc91x.h"
41 40
41#include "soc.h"
42#include "board-flash.h" 42#include "board-flash.h"
43#include "mux.h" 43#include "mux.h"
44#include "sdram-qimonda-hyb18m512160af-6.h" 44#include "sdram-qimonda-hyb18m512160af-6.h"
@@ -597,5 +597,5 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
597 .init_machine = omap_3430sdp_init, 597 .init_machine = omap_3430sdp_init,
598 .init_late = omap3430_init_late, 598 .init_late = omap3430_init_late,
599 .timer = &omap3_timer, 599 .timer = &omap3_timer,
600 .restart = omap_prcm_restart, 600 .restart = omap3xxx_restart,
601MACHINE_END 601MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index fc224ad8674..050aaa77125 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -18,9 +18,8 @@
18 18
19#include "common.h" 19#include "common.h"
20#include "gpmc-smc91x.h" 20#include "gpmc-smc91x.h"
21#include <plat/usb.h>
22 21
23#include <mach/board-zoom.h> 22#include "board-zoom.h"
24 23
25#include "board-flash.h" 24#include "board-flash.h"
26#include "mux.h" 25#include "mux.h"
@@ -213,5 +212,5 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
213 .init_machine = omap_sdp_init, 212 .init_machine = omap_sdp_init,
214 .init_late = omap3630_init_late, 213 .init_late = omap3630_init_late,
215 .timer = &omap3_timer, 214 .timer = &omap3_timer,
216 .restart = omap_prcm_restart, 215 .restart = omap3xxx_restart,
217MACHINE_END 216MACHINE_END
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 3669c120c7e..1cc6696594f 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -27,6 +27,7 @@
27#include <linux/leds.h> 27#include <linux/leds.h>
28#include <linux/leds_pwm.h> 28#include <linux/leds_pwm.h>
29#include <linux/platform_data/omap4-keypad.h> 29#include <linux/platform_data/omap4-keypad.h>
30#include <linux/usb/musb.h>
30 31
31#include <asm/hardware/gic.h> 32#include <asm/hardware/gic.h>
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
@@ -34,31 +35,23 @@
34#include <asm/mach/map.h> 35#include <asm/mach/map.h>
35 36
36#include "common.h" 37#include "common.h"
37#include <plat/usb.h>
38#include <plat/mmc.h>
39#include "omap4-keypad.h" 38#include "omap4-keypad.h"
40#include <video/omapdss.h>
41#include <video/omap-panel-nokia-dsi.h>
42#include <video/omap-panel-picodlp.h>
43#include <linux/wl12xx.h> 39#include <linux/wl12xx.h>
44#include <linux/platform_data/omap-abe-twl6040.h> 40#include <linux/platform_data/omap-abe-twl6040.h>
45 41
46#include "soc.h" 42#include "soc.h"
47#include "mux.h" 43#include "mux.h"
44#include "mmc.h"
48#include "hsmmc.h" 45#include "hsmmc.h"
49#include "control.h" 46#include "control.h"
50#include "common-board-devices.h" 47#include "common-board-devices.h"
48#include "dss-common.h"
51 49
52#define ETH_KS8851_IRQ 34 50#define ETH_KS8851_IRQ 34
53#define ETH_KS8851_POWER_ON 48 51#define ETH_KS8851_POWER_ON 48
54#define ETH_KS8851_QUART 138 52#define ETH_KS8851_QUART 138
55#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 53#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
56#define OMAP4_SFH7741_ENABLE_GPIO 188 54#define OMAP4_SFH7741_ENABLE_GPIO 188
57#define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
58#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
59#define HDMI_GPIO_HPD 63 /* Hotplug detect */
60#define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */
61#define DLP_POWER_ON_GPIO 40
62 55
63#define GPIO_WIFI_PMENA 54 56#define GPIO_WIFI_PMENA 54
64#define GPIO_WIFI_IRQ 53 57#define GPIO_WIFI_IRQ 53
@@ -607,154 +600,6 @@ static void __init omap_sfh7741prox_init(void)
607 __func__, OMAP4_SFH7741_ENABLE_GPIO, error); 600 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
608} 601}
609 602
610static struct nokia_dsi_panel_data dsi1_panel = {
611 .name = "taal",
612 .reset_gpio = 102,
613 .use_ext_te = false,
614 .ext_te_gpio = 101,
615 .esd_interval = 0,
616 .pin_config = {
617 .num_pins = 6,
618 .pins = { 0, 1, 2, 3, 4, 5 },
619 },
620};
621
622static struct omap_dss_device sdp4430_lcd_device = {
623 .name = "lcd",
624 .driver_name = "taal",
625 .type = OMAP_DISPLAY_TYPE_DSI,
626 .data = &dsi1_panel,
627 .phy.dsi = {
628 .module = 0,
629 },
630 .channel = OMAP_DSS_CHANNEL_LCD,
631};
632
633static struct nokia_dsi_panel_data dsi2_panel = {
634 .name = "taal",
635 .reset_gpio = 104,
636 .use_ext_te = false,
637 .ext_te_gpio = 103,
638 .esd_interval = 0,
639 .pin_config = {
640 .num_pins = 6,
641 .pins = { 0, 1, 2, 3, 4, 5 },
642 },
643};
644
645static struct omap_dss_device sdp4430_lcd2_device = {
646 .name = "lcd2",
647 .driver_name = "taal",
648 .type = OMAP_DISPLAY_TYPE_DSI,
649 .data = &dsi2_panel,
650 .phy.dsi = {
651
652 .module = 1,
653 },
654 .channel = OMAP_DSS_CHANNEL_LCD2,
655};
656
657static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
658 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
659 .ls_oe_gpio = HDMI_GPIO_LS_OE,
660 .hpd_gpio = HDMI_GPIO_HPD,
661};
662
663static struct omap_dss_device sdp4430_hdmi_device = {
664 .name = "hdmi",
665 .driver_name = "hdmi_panel",
666 .type = OMAP_DISPLAY_TYPE_HDMI,
667 .channel = OMAP_DSS_CHANNEL_DIGIT,
668 .data = &sdp4430_hdmi_data,
669};
670
671static struct picodlp_panel_data sdp4430_picodlp_pdata = {
672 .picodlp_adapter_id = 2,
673 .emu_done_gpio = 44,
674 .pwrgood_gpio = 45,
675};
676
677static void sdp4430_picodlp_init(void)
678{
679 int r;
680 const struct gpio picodlp_gpios[] = {
681 {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
682 "DLP POWER ON"},
683 {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN,
684 "DLP EMU DONE"},
685 {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW,
686 "DLP PWRGOOD"},
687 };
688
689 r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios));
690 if (r)
691 pr_err("Cannot request PicoDLP GPIOs, error %d\n", r);
692}
693
694static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev)
695{
696 gpio_set_value(DISPLAY_SEL_GPIO, 0);
697 gpio_set_value(DLP_POWER_ON_GPIO, 1);
698
699 return 0;
700}
701
702static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev)
703{
704 gpio_set_value(DLP_POWER_ON_GPIO, 0);
705 gpio_set_value(DISPLAY_SEL_GPIO, 1);
706}
707
708static struct omap_dss_device sdp4430_picodlp_device = {
709 .name = "picodlp",
710 .driver_name = "picodlp_panel",
711 .type = OMAP_DISPLAY_TYPE_DPI,
712 .phy.dpi.data_lines = 24,
713 .channel = OMAP_DSS_CHANNEL_LCD2,
714 .platform_enable = sdp4430_panel_enable_picodlp,
715 .platform_disable = sdp4430_panel_disable_picodlp,
716 .data = &sdp4430_picodlp_pdata,
717};
718
719static struct omap_dss_device *sdp4430_dss_devices[] = {
720 &sdp4430_lcd_device,
721 &sdp4430_lcd2_device,
722 &sdp4430_hdmi_device,
723 &sdp4430_picodlp_device,
724};
725
726static struct omap_dss_board_info sdp4430_dss_data = {
727 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
728 .devices = sdp4430_dss_devices,
729 .default_device = &sdp4430_lcd_device,
730};
731
732static void __init omap_4430sdp_display_init(void)
733{
734 int r;
735
736 /* Enable LCD2 by default (instead of Pico DLP) */
737 r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
738 "display_sel");
739 if (r)
740 pr_err("%s: Could not get display_sel GPIO\n", __func__);
741
742 sdp4430_picodlp_init();
743 omap_display_init(&sdp4430_dss_data);
744 /*
745 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
746 * later have external pull up on the HDMI I2C lines
747 */
748 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
749 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
750 else
751 omap_hdmi_init(0);
752
753 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
754 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
755 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
756}
757
758#ifdef CONFIG_OMAP_MUX 603#ifdef CONFIG_OMAP_MUX
759static struct omap_board_mux board_mux[] __initdata = { 604static struct omap_board_mux board_mux[] __initdata = {
760 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 605 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
@@ -881,5 +726,5 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
881 .init_machine = omap_4430sdp_init, 726 .init_machine = omap_4430sdp_init,
882 .init_late = omap4430_init_late, 727 .init_late = omap4430_init_late,
883 .timer = &omap4_timer, 728 .timer = &omap4_timer,
884 .restart = omap_prcm_restart, 729 .restart = omap44xx_restart,
885MACHINE_END 730MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 318feadb1d6..51b96a1206d 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -26,7 +26,6 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include "common.h" 28#include "common.h"
29#include <plat/usb.h>
30 29
31#include "am35xx-emac.h" 30#include "am35xx-emac.h"
32#include "mux.h" 31#include "mux.h"
@@ -94,5 +93,5 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
94 .init_machine = am3517_crane_init, 93 .init_machine = am3517_crane_init,
95 .init_late = am35xx_init_late, 94 .init_late = am35xx_init_late,
96 .timer = &omap3_timer, 95 .timer = &omap3_timer,
97 .restart = omap_prcm_restart, 96 .restart = omap3xxx_restart,
98MACHINE_END 97MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index e16289755f2..4be58fd071f 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -25,6 +25,7 @@
25#include <linux/can/platform/ti_hecc.h> 25#include <linux/can/platform/ti_hecc.h>
26#include <linux/davinci_emac.h> 26#include <linux/davinci_emac.h>
27#include <linux/mmc/host.h> 27#include <linux/mmc/host.h>
28#include <linux/usb/musb.h>
28#include <linux/platform_data/gpio-omap.h> 29#include <linux/platform_data/gpio-omap.h>
29 30
30#include "am35xx.h" 31#include "am35xx.h"
@@ -33,7 +34,6 @@
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34 35
35#include "common.h" 36#include "common.h"
36#include <plat/usb.h>
37#include <video/omapdss.h> 37#include <video/omapdss.h>
38#include <video/omap-panel-generic-dpi.h> 38#include <video/omap-panel-generic-dpi.h>
39#include <video/omap-panel-tfp410.h> 39#include <video/omap-panel-tfp410.h>
@@ -393,5 +393,5 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
393 .init_machine = am3517_evm_init, 393 .init_machine = am3517_evm_init,
394 .init_late = am35xx_init_late, 394 .init_late = am35xx_init_late,
395 .timer = &omap3_timer, 395 .timer = &omap3_timer,
396 .restart = omap_prcm_restart, 396 .restart = omap3xxx_restart,
397MACHINE_END 397MACHINE_END
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index cea3abace81..5d0a61f5416 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -28,14 +28,14 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/smc91x.h> 29#include <linux/smc91x.h>
30#include <linux/gpio.h> 30#include <linux/gpio.h>
31#include <linux/platform_data/leds-omap.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
34#include <asm/mach/flash.h> 35#include <asm/mach/flash.h>
35 36
36#include <plat/led.h>
37#include "common.h" 37#include "common.h"
38#include <plat/gpmc.h> 38#include "gpmc.h"
39 39
40#include <video/omapdss.h> 40#include <video/omapdss.h>
41#include <video/omap-panel-generic-dpi.h> 41#include <video/omap-panel-generic-dpi.h>
@@ -338,5 +338,5 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
338 .init_machine = omap_apollon_init, 338 .init_machine = omap_apollon_init,
339 .init_late = omap2420_init_late, 339 .init_late = omap2420_init_late,
340 .timer = &omap2_timer, 340 .timer = &omap2_timer,
341 .restart = omap_prcm_restart, 341 .restart = omap2xxx_restart,
342MACHINE_END 342MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 376d26eb601..c8e37dc0089 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -38,21 +38,19 @@
38#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include "common.h"
42#include <linux/platform_data/mtd-nand-omap2.h> 41#include <linux/platform_data/mtd-nand-omap2.h>
43#include <plat/gpmc.h>
44#include <plat/usb.h>
45#include <video/omapdss.h> 42#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 43#include <video/omap-panel-generic-dpi.h>
47#include <video/omap-panel-tfp410.h> 44#include <video/omap-panel-tfp410.h>
48#include <linux/platform_data/spi-omap2-mcspi.h> 45#include <linux/platform_data/spi-omap2-mcspi.h>
49 46
50#include <mach/hardware.h> 47#include "common.h"
51
52#include "mux.h" 48#include "mux.h"
53#include "sdram-micron-mt46h32m32lf-6.h" 49#include "sdram-micron-mt46h32m32lf-6.h"
54#include "hsmmc.h" 50#include "hsmmc.h"
55#include "common-board-devices.h" 51#include "common-board-devices.h"
52#include "gpmc.h"
53#include "gpmc-nand.h"
56 54
57#define CM_T35_GPIO_PENDOWN 57 55#define CM_T35_GPIO_PENDOWN 57
58#define SB_T35_USB_HUB_RESET_GPIO 167 56#define SB_T35_USB_HUB_RESET_GPIO 167
@@ -181,7 +179,7 @@ static struct omap_nand_platform_data cm_t35_nand_data = {
181 179
182static void __init cm_t35_init_nand(void) 180static void __init cm_t35_init_nand(void)
183{ 181{
184 if (gpmc_nand_init(&cm_t35_nand_data) < 0) 182 if (gpmc_nand_init(&cm_t35_nand_data, NULL) < 0)
185 pr_err("CM-T35: Unable to register NAND device\n"); 183 pr_err("CM-T35: Unable to register NAND device\n");
186} 184}
187#else 185#else
@@ -753,18 +751,18 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
753 .init_machine = cm_t35_init, 751 .init_machine = cm_t35_init,
754 .init_late = omap35xx_init_late, 752 .init_late = omap35xx_init_late,
755 .timer = &omap3_timer, 753 .timer = &omap3_timer,
756 .restart = omap_prcm_restart, 754 .restart = omap3xxx_restart,
757MACHINE_END 755MACHINE_END
758 756
759MACHINE_START(CM_T3730, "Compulab CM-T3730") 757MACHINE_START(CM_T3730, "Compulab CM-T3730")
760 .atag_offset = 0x100, 758 .atag_offset = 0x100,
761 .reserve = omap_reserve, 759 .reserve = omap_reserve,
762 .map_io = omap3_map_io, 760 .map_io = omap3_map_io,
763 .init_early = omap3630_init_early, 761 .init_early = omap3630_init_early,
764 .init_irq = omap3_init_irq, 762 .init_irq = omap3_init_irq,
765 .handle_irq = omap3_intc_handle_irq, 763 .handle_irq = omap3_intc_handle_irq,
766 .init_machine = cm_t3730_init, 764 .init_machine = cm_t3730_init,
767 .init_late = omap3630_init_late, 765 .init_late = omap3630_init_late,
768 .timer = &omap3_timer, 766 .timer = &omap3_timer,
769 .restart = omap_prcm_restart, 767 .restart = omap3xxx_restart,
770MACHINE_END 768MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 59c0a45f75b..ebbc2adb499 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -39,9 +39,8 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/usb.h>
43#include <linux/platform_data/mtd-nand-omap2.h> 42#include <linux/platform_data/mtd-nand-omap2.h>
44#include <plat/gpmc.h> 43#include "gpmc.h"
45 44
46#include "am35xx.h" 45#include "am35xx.h"
47 46
@@ -49,6 +48,7 @@
49#include "control.h" 48#include "control.h"
50#include "common-board-devices.h" 49#include "common-board-devices.h"
51#include "am35xx-emac.h" 50#include "am35xx-emac.h"
51#include "gpmc-nand.h"
52 52
53#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 53#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
54static struct gpio_led cm_t3517_leds[] = { 54static struct gpio_led cm_t3517_leds[] = {
@@ -240,7 +240,7 @@ static struct omap_nand_platform_data cm_t3517_nand_data = {
240 240
241static void __init cm_t3517_init_nand(void) 241static void __init cm_t3517_init_nand(void)
242{ 242{
243 if (gpmc_nand_init(&cm_t3517_nand_data) < 0) 243 if (gpmc_nand_init(&cm_t3517_nand_data, NULL) < 0)
244 pr_err("CM-T3517: NAND initialization failed\n"); 244 pr_err("CM-T3517: NAND initialization failed\n");
245} 245}
246#else 246#else
@@ -297,6 +297,6 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
297 .handle_irq = omap3_intc_handle_irq, 297 .handle_irq = omap3_intc_handle_irq,
298 .init_machine = cm_t3517_init, 298 .init_machine = cm_t3517_init,
299 .init_late = am35xx_init_late, 299 .init_late = am35xx_init_late,
300 .timer = &omap3_timer, 300 .timer = &omap3_gp_timer,
301 .restart = omap_prcm_restart, 301 .restart = omap3xxx_restart,
302MACHINE_END 302MACHINE_END
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 1fd161e934c..7667eb74952 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -39,9 +39,8 @@
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/gpmc.h> 42#include "gpmc.h"
43#include <linux/platform_data/mtd-nand-omap2.h> 43#include <linux/platform_data/mtd-nand-omap2.h>
44#include <plat/usb.h>
45#include <video/omapdss.h> 44#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 45#include <video/omap-panel-generic-dpi.h>
47#include <video/omap-panel-tfp410.h> 46#include <video/omap-panel-tfp410.h>
@@ -55,8 +54,11 @@
55#include "sdram-micron-mt46h32m32lf-6.h" 54#include "sdram-micron-mt46h32m32lf-6.h"
56#include "mux.h" 55#include "mux.h"
57#include "hsmmc.h" 56#include "hsmmc.h"
57#include "board-flash.h"
58#include "common-board-devices.h" 58#include "common-board-devices.h"
59 59
60#define NAND_CS 0
61
60#define OMAP_DM9000_GPIO_IRQ 25 62#define OMAP_DM9000_GPIO_IRQ 25
61#define OMAP3_DEVKIT_TS_GPIO 27 63#define OMAP3_DEVKIT_TS_GPIO 27
62 64
@@ -621,8 +623,9 @@ static void __init devkit8000_init(void)
621 623
622 usb_musb_init(NULL); 624 usb_musb_init(NULL);
623 usbhs_init(&usbhs_bdata); 625 usbhs_init(&usbhs_bdata);
624 omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions, 626 board_nand_init(devkit8000_nand_partitions,
625 ARRAY_SIZE(devkit8000_nand_partitions)); 627 ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
628 NAND_BUSWIDTH_16, NULL);
626 omap_twl4030_audio_init("omap3beagle"); 629 omap_twl4030_audio_init("omap3beagle");
627 630
628 /* Ensure SDRC pins are mux'd for self-refresh */ 631 /* Ensure SDRC pins are mux'd for self-refresh */
@@ -640,5 +643,5 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
640 .init_machine = devkit8000_init, 643 .init_machine = devkit8000_init,
641 .init_late = omap35xx_init_late, 644 .init_late = omap35xx_init_late,
642 .timer = &omap3_secure_timer, 645 .timer = &omap3_secure_timer,
643 .restart = omap_prcm_restart, 646 .restart = omap3xxx_restart,
644MACHINE_END 647MACHINE_END
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index e642acf9cad..c33adea0247 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -17,14 +17,14 @@
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include <plat/cpu.h>
21#include <plat/gpmc.h>
22#include <linux/platform_data/mtd-nand-omap2.h> 20#include <linux/platform_data/mtd-nand-omap2.h>
23#include <linux/platform_data/mtd-onenand-omap2.h> 21#include <linux/platform_data/mtd-onenand-omap2.h>
24#include <plat/tc.h>
25 22
23#include "soc.h"
26#include "common.h" 24#include "common.h"
27#include "board-flash.h" 25#include "board-flash.h"
26#include "gpmc-onenand.h"
27#include "gpmc-nand.h"
28 28
29#define REG_FPGA_REV 0x10 29#define REG_FPGA_REV 0x10
30#define REG_FPGA_DIP_SWITCH_INPUT2 0x60 30#define REG_FPGA_DIP_SWITCH_INPUT2 0x60
@@ -104,36 +104,35 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
104 defined(CONFIG_MTD_NAND_OMAP2_MODULE) 104 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
105 105
106/* Note that all values in this struct are in nanoseconds */ 106/* Note that all values in this struct are in nanoseconds */
107static struct gpmc_timings nand_timings = { 107struct gpmc_timings nand_default_timings[1] = {
108 {
109 .sync_clk = 0,
108 110
109 .sync_clk = 0, 111 .cs_on = 0,
112 .cs_rd_off = 36,
113 .cs_wr_off = 36,
110 114
111 .cs_on = 0, 115 .adv_on = 6,
112 .cs_rd_off = 36, 116 .adv_rd_off = 24,
113 .cs_wr_off = 36, 117 .adv_wr_off = 36,
114 118
115 .adv_on = 6, 119 .we_off = 30,
116 .adv_rd_off = 24, 120 .oe_off = 48,
117 .adv_wr_off = 36,
118 121
119 .we_off = 30, 122 .access = 54,
120 .oe_off = 48, 123 .rd_cycle = 72,
124 .wr_cycle = 72,
121 125
122 .access = 54, 126 .wr_access = 30,
123 .rd_cycle = 72, 127 .wr_data_mux_bus = 0,
124 .wr_cycle = 72, 128 },
125
126 .wr_access = 30,
127 .wr_data_mux_bus = 0,
128}; 129};
129 130
130static struct omap_nand_platform_data board_nand_data = { 131static struct omap_nand_platform_data board_nand_data;
131 .gpmc_t = &nand_timings,
132};
133 132
134void 133void
135__init board_nand_init(struct mtd_partition *nand_parts, 134__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
136 u8 nr_parts, u8 cs, int nand_type) 135 int nand_type, struct gpmc_timings *gpmc_t)
137{ 136{
138 board_nand_data.cs = cs; 137 board_nand_data.cs = cs;
139 board_nand_data.parts = nand_parts; 138 board_nand_data.parts = nand_parts;
@@ -141,7 +140,7 @@ __init board_nand_init(struct mtd_partition *nand_parts,
141 board_nand_data.devsize = nand_type; 140 board_nand_data.devsize = nand_type;
142 141
143 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT; 142 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
144 gpmc_nand_init(&board_nand_data); 143 gpmc_nand_init(&board_nand_data, gpmc_t);
145} 144}
146#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 145#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
147 146
@@ -238,5 +237,6 @@ void __init board_flash_init(struct flash_partitions partition_info[],
238 pr_err("NAND: Unable to find configuration in GPMC\n"); 237 pr_err("NAND: Unable to find configuration in GPMC\n");
239 else 238 else
240 board_nand_init(partition_info[2].parts, 239 board_nand_init(partition_info[2].parts,
241 partition_info[2].nr_parts, nandcs, nand_type); 240 partition_info[2].nr_parts, nandcs,
241 nand_type, nand_default_timings);
242} 242}
diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h
index c44b70d5202..2fb5d41a9fa 100644
--- a/arch/arm/mach-omap2/board-flash.h
+++ b/arch/arm/mach-omap2/board-flash.h
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
15#include <plat/gpmc.h> 15#include "gpmc.h"
16 16
17#define PDC_NOR 1 17#define PDC_NOR 1
18#define PDC_NAND 2 18#define PDC_NAND 2
@@ -40,12 +40,14 @@ static inline void board_flash_init(struct flash_partitions part[],
40#if defined(CONFIG_MTD_NAND_OMAP2) || \ 40#if defined(CONFIG_MTD_NAND_OMAP2) || \
41 defined(CONFIG_MTD_NAND_OMAP2_MODULE) 41 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
42extern void board_nand_init(struct mtd_partition *nand_parts, 42extern void board_nand_init(struct mtd_partition *nand_parts,
43 u8 nr_parts, u8 cs, int nand_type); 43 u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t);
44extern struct gpmc_timings nand_default_timings[];
44#else 45#else
45static inline void board_nand_init(struct mtd_partition *nand_parts, 46static inline void board_nand_init(struct mtd_partition *nand_parts,
46 u8 nr_parts, u8 cs, int nand_type) 47 u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t)
47{ 48{
48} 49}
50#define nand_default_timings NULL
49#endif 51#endif
50 52
51#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 53#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 601ecdfb1cf..53cb380b787 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -21,6 +21,7 @@
21 21
22#include "common.h" 22#include "common.h"
23#include "common-board-devices.h" 23#include "common-board-devices.h"
24#include "dss-common.h"
24 25
25#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)) 26#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
26#define intc_of_init NULL 27#define intc_of_init NULL
@@ -40,6 +41,15 @@ static void __init omap_generic_init(void)
40 omap_sdrc_init(NULL, NULL); 41 omap_sdrc_init(NULL, NULL);
41 42
42 of_platform_populate(NULL, omap_dt_match_table, NULL, NULL); 43 of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
44
45 /*
46 * HACK: call display setup code for selected boards to enable omapdss.
47 * This will be removed when omapdss supports DT.
48 */
49 if (of_machine_is_compatible("ti,omap4-panda"))
50 omap4_panda_display_init_of();
51 else if (of_machine_is_compatible("ti,omap4-sdp"))
52 omap_4430sdp_display_init_of();
43} 53}
44 54
45#ifdef CONFIG_SOC_OMAP2420 55#ifdef CONFIG_SOC_OMAP2420
@@ -57,7 +67,7 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
57 .init_machine = omap_generic_init, 67 .init_machine = omap_generic_init,
58 .timer = &omap2_timer, 68 .timer = &omap2_timer,
59 .dt_compat = omap242x_boards_compat, 69 .dt_compat = omap242x_boards_compat,
60 .restart = omap_prcm_restart, 70 .restart = omap2xxx_restart,
61MACHINE_END 71MACHINE_END
62#endif 72#endif
63 73
@@ -76,7 +86,7 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
76 .init_machine = omap_generic_init, 86 .init_machine = omap_generic_init,
77 .timer = &omap2_timer, 87 .timer = &omap2_timer,
78 .dt_compat = omap243x_boards_compat, 88 .dt_compat = omap243x_boards_compat,
79 .restart = omap_prcm_restart, 89 .restart = omap2xxx_restart,
80MACHINE_END 90MACHINE_END
81#endif 91#endif
82 92
@@ -95,7 +105,24 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
95 .init_machine = omap_generic_init, 105 .init_machine = omap_generic_init,
96 .timer = &omap3_timer, 106 .timer = &omap3_timer,
97 .dt_compat = omap3_boards_compat, 107 .dt_compat = omap3_boards_compat,
98 .restart = omap_prcm_restart, 108 .restart = omap3xxx_restart,
109MACHINE_END
110
111static const char *omap3_gp_boards_compat[] __initdata = {
112 "ti,omap3-beagle",
113 NULL,
114};
115
116DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
117 .reserve = omap_reserve,
118 .map_io = omap3_map_io,
119 .init_early = omap3430_init_early,
120 .init_irq = omap_intc_of_init,
121 .handle_irq = omap3_intc_handle_irq,
122 .init_machine = omap_generic_init,
123 .timer = &omap3_secure_timer,
124 .dt_compat = omap3_gp_boards_compat,
125 .restart = omap3xxx_restart,
99MACHINE_END 126MACHINE_END
100#endif 127#endif
101 128
@@ -134,7 +161,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
134 .init_late = omap4430_init_late, 161 .init_late = omap4430_init_late,
135 .timer = &omap4_timer, 162 .timer = &omap4_timer,
136 .dt_compat = omap4_boards_compat, 163 .dt_compat = omap4_boards_compat,
137 .restart = omap_prcm_restart, 164 .restart = omap44xx_restart,
138MACHINE_END 165MACHINE_END
139#endif 166#endif
140 167
@@ -154,6 +181,6 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
154 .init_machine = omap_generic_init, 181 .init_machine = omap_generic_init,
155 .timer = &omap5_timer, 182 .timer = &omap5_timer,
156 .dt_compat = omap5_boards_compat, 183 .dt_compat = omap5_boards_compat,
157 .restart = omap_prcm_restart, 184 .restart = omap44xx_restart,
158MACHINE_END 185MACHINE_END
159#endif 186#endif
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 8d04bf851af..9a3878ec225 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -26,15 +26,14 @@
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/input/matrix_keypad.h> 28#include <linux/input/matrix_keypad.h>
29#include <linux/mfd/menelaus.h>
29 30
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 33#include <asm/mach/map.h>
33 34
34#include <plat/menelaus.h> 35#include <linux/omap-dma.h>
35#include <plat/dma.h> 36#include <plat/debug-devices.h>
36#include <plat/gpmc.h>
37#include "debug-devices.h"
38 37
39#include <video/omapdss.h> 38#include <video/omapdss.h>
40#include <video/omap-panel-generic-dpi.h> 39#include <video/omap-panel-generic-dpi.h>
@@ -42,6 +41,7 @@
42#include "common.h" 41#include "common.h"
43#include "mux.h" 42#include "mux.h"
44#include "control.h" 43#include "control.h"
44#include "gpmc.h"
45 45
46#define H4_FLASH_CS 0 46#define H4_FLASH_CS 0
47#define H4_SMC91X_CS 1 47#define H4_SMC91X_CS 1
@@ -386,5 +386,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
386 .init_machine = omap_h4_init, 386 .init_machine = omap_h4_init,
387 .init_late = omap2420_init_late, 387 .init_late = omap2420_init_late,
388 .timer = &omap2_timer, 388 .timer = &omap2_timer,
389 .restart = omap_prcm_restart, 389 .restart = omap2xxx_restart,
390MACHINE_END 390MACHINE_END
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 37859069444..0f24cb84ba5 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -29,20 +29,19 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31 31
32#include "common.h"
33#include <plat/gpmc.h>
34#include <plat/usb.h>
35
36#include <video/omapdss.h> 32#include <video/omapdss.h>
37#include <video/omap-panel-tfp410.h> 33#include <video/omap-panel-tfp410.h>
38#include <linux/platform_data/mtd-onenand-omap2.h> 34#include <linux/platform_data/mtd-onenand-omap2.h>
39 35
36#include "common.h"
37#include "gpmc.h"
40#include "mux.h" 38#include "mux.h"
41#include "hsmmc.h" 39#include "hsmmc.h"
42#include "sdram-numonyx-m65kxxxxam.h" 40#include "sdram-numonyx-m65kxxxxam.h"
43#include "common-board-devices.h" 41#include "common-board-devices.h"
44#include "board-flash.h" 42#include "board-flash.h"
45#include "control.h" 43#include "control.h"
44#include "gpmc-onenand.h"
46 45
47#define IGEP2_SMSC911X_CS 5 46#define IGEP2_SMSC911X_CS 5
48#define IGEP2_SMSC911X_GPIO 176 47#define IGEP2_SMSC911X_GPIO 176
@@ -175,7 +174,7 @@ static void __init igep_flash_init(void)
175 pr_info("IGEP: initializing NAND memory device\n"); 174 pr_info("IGEP: initializing NAND memory device\n");
176 board_nand_init(igep_flash_partitions, 175 board_nand_init(igep_flash_partitions,
177 ARRAY_SIZE(igep_flash_partitions), 176 ARRAY_SIZE(igep_flash_partitions),
178 0, NAND_BUSWIDTH_16); 177 0, NAND_BUSWIDTH_16, nand_default_timings);
179 } else if (mux == IGEP_SYSBOOT_ONENAND) { 178 } else if (mux == IGEP_SYSBOOT_ONENAND) {
180 pr_info("IGEP: initializing OneNAND memory device\n"); 179 pr_info("IGEP: initializing OneNAND memory device\n");
181 board_onenand_init(igep_flash_partitions, 180 board_onenand_init(igep_flash_partitions,
@@ -657,7 +656,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
657 .init_machine = igep_init, 656 .init_machine = igep_init,
658 .init_late = omap35xx_init_late, 657 .init_late = omap35xx_init_late,
659 .timer = &omap3_timer, 658 .timer = &omap3_timer,
660 .restart = omap_prcm_restart, 659 .restart = omap3xxx_restart,
661MACHINE_END 660MACHINE_END
662 661
663MACHINE_START(IGEP0030, "IGEP OMAP3 module") 662MACHINE_START(IGEP0030, "IGEP OMAP3 module")
@@ -670,5 +669,5 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
670 .init_machine = igep_init, 669 .init_machine = igep_init,
671 .init_late = omap35xx_init_late, 670 .init_late = omap35xx_init_late,
672 .timer = &omap3_timer, 671 .timer = &omap3_timer,
673 .restart = omap_prcm_restart, 672 .restart = omap3xxx_restart,
674MACHINE_END 673MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index ee8c3cfb95b..0869f4f3d3e 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -35,9 +35,8 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include "common.h" 37#include "common.h"
38#include <plat/gpmc.h> 38#include "board-zoom.h"
39#include <mach/board-zoom.h> 39#include "gpmc.h"
40#include <plat/usb.h>
41#include "gpmc-smsc911x.h" 40#include "gpmc-smsc911x.h"
42 41
43#include <video/omapdss.h> 42#include <video/omapdss.h>
@@ -420,8 +419,8 @@ static void __init omap_ldp_init(void)
420 omap_serial_init(); 419 omap_serial_init();
421 omap_sdrc_init(NULL, NULL); 420 omap_sdrc_init(NULL, NULL);
422 usb_musb_init(NULL); 421 usb_musb_init(NULL);
423 board_nand_init(ldp_nand_partitions, 422 board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
424 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 423 ZOOM_NAND_CS, 0, nand_default_timings);
425 424
426 omap_hsmmc_init(mmc); 425 omap_hsmmc_init(mmc);
427 ldp_display_init(); 426 ldp_display_init();
@@ -437,5 +436,5 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
437 .init_machine = omap_ldp_init, 436 .init_machine = omap_ldp_init,
438 .init_late = omap3430_init_late, 437 .init_late = omap3430_init_late,
439 .timer = &omap3_timer, 438 .timer = &omap3_timer,
440 .restart = omap_prcm_restart, 439 .restart = omap3xxx_restart,
441MACHINE_END 440MACHINE_END
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index d95f727ca39..a4e167c55c1 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -22,16 +22,17 @@
22#include <linux/usb/musb.h> 22#include <linux/usb/musb.h>
23#include <linux/platform_data/spi-omap2-mcspi.h> 23#include <linux/platform_data/spi-omap2-mcspi.h>
24#include <linux/platform_data/mtd-onenand-omap2.h> 24#include <linux/platform_data/mtd-onenand-omap2.h>
25#include <linux/mfd/menelaus.h>
25#include <sound/tlv320aic3x.h> 26#include <sound/tlv320aic3x.h>
26 27
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29 30
30#include "common.h" 31#include "common.h"
31#include <plat/menelaus.h> 32#include "mmc.h"
32#include <plat/mmc.h>
33 33
34#include "mux.h" 34#include "mux.h"
35#include "gpmc-onenand.h"
35 36
36#define TUSB6010_ASYNC_CS 1 37#define TUSB6010_ASYNC_CS 1
37#define TUSB6010_SYNC_CS 4 38#define TUSB6010_SYNC_CS 4
@@ -689,7 +690,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
689 .init_machine = n8x0_init_machine, 690 .init_machine = n8x0_init_machine,
690 .init_late = omap2420_init_late, 691 .init_late = omap2420_init_late,
691 .timer = &omap2_timer, 692 .timer = &omap2_timer,
692 .restart = omap_prcm_restart, 693 .restart = omap2xxx_restart,
693MACHINE_END 694MACHINE_END
694 695
695MACHINE_START(NOKIA_N810, "Nokia N810") 696MACHINE_START(NOKIA_N810, "Nokia N810")
@@ -702,7 +703,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
702 .init_machine = n8x0_init_machine, 703 .init_machine = n8x0_init_machine,
703 .init_late = omap2420_init_late, 704 .init_late = omap2420_init_late,
704 .timer = &omap2_timer, 705 .timer = &omap2_timer,
705 .restart = omap_prcm_restart, 706 .restart = omap2xxx_restart,
706MACHINE_END 707MACHINE_END
707 708
708MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") 709MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
@@ -715,5 +716,5 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
715 .init_machine = n8x0_init_machine, 716 .init_machine = n8x0_init_machine,
716 .init_late = omap2420_init_late, 717 .init_late = omap2420_init_late,
717 .timer = &omap2_timer, 718 .timer = &omap2_timer,
718 .restart = omap_prcm_restart, 719 .restart = omap2xxx_restart,
719MACHINE_END 720MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index d41ab98890f..22c483d5dfa 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -39,19 +39,22 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41 41
42#include "common.h"
43#include <video/omapdss.h> 42#include <video/omapdss.h>
44#include <video/omap-panel-tfp410.h> 43#include <video/omap-panel-tfp410.h>
45#include <plat/gpmc.h>
46#include <linux/platform_data/mtd-nand-omap2.h> 44#include <linux/platform_data/mtd-nand-omap2.h>
47#include <plat/usb.h>
48#include <plat/omap_device.h>
49 45
46#include "common.h"
47#include "omap_device.h"
48#include "gpmc.h"
49#include "soc.h"
50#include "mux.h" 50#include "mux.h"
51#include "hsmmc.h" 51#include "hsmmc.h"
52#include "pm.h" 52#include "pm.h"
53#include "board-flash.h"
53#include "common-board-devices.h" 54#include "common-board-devices.h"
54 55
56#define NAND_CS 0
57
55/* 58/*
56 * OMAP3 Beagle revision 59 * OMAP3 Beagle revision
57 * Run time detection of Beagle revision is done by reading GPIO. 60 * Run time detection of Beagle revision is done by reading GPIO.
@@ -518,8 +521,9 @@ static void __init omap3_beagle_init(void)
518 521
519 usb_musb_init(NULL); 522 usb_musb_init(NULL);
520 usbhs_init(&usbhs_bdata); 523 usbhs_init(&usbhs_bdata);
521 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, 524 board_nand_init(omap3beagle_nand_partitions,
522 ARRAY_SIZE(omap3beagle_nand_partitions)); 525 ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
526 NAND_BUSWIDTH_16, NULL);
523 omap_twl4030_audio_init("omap3beagle"); 527 omap_twl4030_audio_init("omap3beagle");
524 528
525 /* Ensure msecure is mux'd to be able to set the RTC. */ 529 /* Ensure msecure is mux'd to be able to set the RTC. */
@@ -541,5 +545,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
541 .init_machine = omap3_beagle_init, 545 .init_machine = omap3_beagle_init,
542 .init_late = omap3_init_late, 546 .init_late = omap3_init_late,
543 .timer = &omap3_secure_timer, 547 .timer = &omap3_secure_timer,
544 .restart = omap_prcm_restart, 548 .restart = omap3xxx_restart,
545MACHINE_END 549MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index b9b776b6c95..54647d6286b 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -32,6 +32,7 @@
32#include <linux/spi/ads7846.h> 32#include <linux/spi/ads7846.h>
33#include <linux/i2c/twl.h> 33#include <linux/i2c/twl.h>
34#include <linux/usb/otg.h> 34#include <linux/usb/otg.h>
35#include <linux/usb/musb.h>
35#include <linux/usb/nop-usb-xceiv.h> 36#include <linux/usb/nop-usb-xceiv.h>
36#include <linux/smsc911x.h> 37#include <linux/smsc911x.h>
37 38
@@ -45,17 +46,20 @@
45#include <asm/mach/arch.h> 46#include <asm/mach/arch.h>
46#include <asm/mach/map.h> 47#include <asm/mach/map.h>
47 48
48#include <plat/usb.h>
49#include <linux/platform_data/mtd-nand-omap2.h> 49#include <linux/platform_data/mtd-nand-omap2.h>
50#include "common.h" 50#include "common.h"
51#include <linux/platform_data/spi-omap2-mcspi.h> 51#include <linux/platform_data/spi-omap2-mcspi.h>
52#include <video/omapdss.h> 52#include <video/omapdss.h>
53#include <video/omap-panel-tfp410.h> 53#include <video/omap-panel-tfp410.h>
54 54
55#include "soc.h"
55#include "mux.h" 56#include "mux.h"
56#include "sdram-micron-mt46h32m32lf-6.h" 57#include "sdram-micron-mt46h32m32lf-6.h"
57#include "hsmmc.h" 58#include "hsmmc.h"
58#include "common-board-devices.h" 59#include "common-board-devices.h"
60#include "board-flash.h"
61
62#define NAND_CS 0
59 63
60#define OMAP3_EVM_TS_GPIO 175 64#define OMAP3_EVM_TS_GPIO 175
61#define OMAP3_EVM_EHCI_VBUS 22 65#define OMAP3_EVM_EHCI_VBUS 22
@@ -731,8 +735,9 @@ static void __init omap3_evm_init(void)
731 } 735 }
732 usb_musb_init(&musb_board_data); 736 usb_musb_init(&musb_board_data);
733 usbhs_init(&usbhs_bdata); 737 usbhs_init(&usbhs_bdata);
734 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions, 738 board_nand_init(omap3evm_nand_partitions,
735 ARRAY_SIZE(omap3evm_nand_partitions)); 739 ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
740 NAND_BUSWIDTH_16, NULL);
736 741
737 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL); 742 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
738 omap3evm_init_smsc911x(); 743 omap3evm_init_smsc911x();
@@ -752,5 +757,5 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
752 .init_machine = omap3_evm_init, 757 .init_machine = omap3_evm_init,
753 .init_late = omap35xx_init_late, 758 .init_late = omap35xx_init_late,
754 .timer = &omap3_timer, 759 .timer = &omap3_timer,
755 .restart = omap_prcm_restart, 760 .restart = omap3xxx_restart,
756MACHINE_END 761MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 7bd8253b5d1..2a065ba6eb5 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -34,16 +34,13 @@
34#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include "gpmc-smsc911x.h"
38#include <plat/gpmc.h>
39#include <plat/sdrc.h>
40#include <plat/usb.h>
41
42#include "common.h" 37#include "common.h"
43#include "mux.h" 38#include "mux.h"
44#include "hsmmc.h" 39#include "hsmmc.h"
45#include "control.h" 40#include "control.h"
46#include "common-board-devices.h" 41#include "common-board-devices.h"
42#include "gpmc.h"
43#include "gpmc-smsc911x.h"
47 44
48#define OMAP3LOGIC_SMSC911X_CS 1 45#define OMAP3LOGIC_SMSC911X_CS 1
49 46
@@ -235,7 +232,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
235 .init_machine = omap3logic_init, 232 .init_machine = omap3logic_init,
236 .init_late = omap35xx_init_late, 233 .init_late = omap35xx_init_late,
237 .timer = &omap3_timer, 234 .timer = &omap3_timer,
238 .restart = omap_prcm_restart, 235 .restart = omap3xxx_restart,
239MACHINE_END 236MACHINE_END
240 237
241MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board") 238MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
@@ -248,5 +245,5 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
248 .init_machine = omap3logic_init, 245 .init_machine = omap3logic_init,
249 .init_late = omap35xx_init_late, 246 .init_late = omap35xx_init_late,
250 .timer = &omap3_timer, 247 .timer = &omap3_timer,
251 .restart = omap_prcm_restart, 248 .restart = omap3xxx_restart,
252MACHINE_END 249MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 00a1f4ae6e4..a53a6683c1b 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -42,7 +42,6 @@
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43 43
44#include "common.h" 44#include "common.h"
45#include <plat/usb.h>
46#include <video/omapdss.h> 45#include <video/omapdss.h>
47#include <linux/platform_data/mtd-nand-omap2.h> 46#include <linux/platform_data/mtd-nand-omap2.h>
48 47
@@ -50,6 +49,7 @@
50#include "sdram-micron-mt46h32m32lf-6.h" 49#include "sdram-micron-mt46h32m32lf-6.h"
51#include "hsmmc.h" 50#include "hsmmc.h"
52#include "common-board-devices.h" 51#include "common-board-devices.h"
52#include "gpmc-nand.h"
53 53
54#define PANDORA_WIFI_IRQ_GPIO 21 54#define PANDORA_WIFI_IRQ_GPIO 21
55#define PANDORA_WIFI_NRESET_GPIO 23 55#define PANDORA_WIFI_NRESET_GPIO 23
@@ -602,7 +602,7 @@ static void __init omap3pandora_init(void)
602 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 602 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
603 usbhs_init(&usbhs_bdata); 603 usbhs_init(&usbhs_bdata);
604 usb_musb_init(NULL); 604 usb_musb_init(NULL);
605 gpmc_nand_init(&pandora_nand_data); 605 gpmc_nand_init(&pandora_nand_data, NULL);
606 606
607 /* Ensure SDRC pins are mux'd for self-refresh */ 607 /* Ensure SDRC pins are mux'd for self-refresh */
608 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 608 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -619,5 +619,5 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
619 .init_machine = omap3pandora_init, 619 .init_machine = omap3pandora_init,
620 .init_late = omap35xx_init_late, 620 .init_late = omap35xx_init_late,
621 .timer = &omap3_timer, 621 .timer = &omap3_timer,
622 .restart = omap_prcm_restart, 622 .restart = omap3xxx_restart,
623MACHINE_END 623MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 731235eb319..d8638b3b4f9 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -40,9 +40,8 @@
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41 41
42#include "common.h" 42#include "common.h"
43#include <plat/gpmc.h> 43#include "gpmc.h"
44#include <linux/platform_data/mtd-nand-omap2.h> 44#include <linux/platform_data/mtd-nand-omap2.h>
45#include <plat/usb.h>
46#include <video/omapdss.h> 45#include <video/omapdss.h>
47#include <video/omap-panel-generic-dpi.h> 46#include <video/omap-panel-generic-dpi.h>
48#include <video/omap-panel-tfp410.h> 47#include <video/omap-panel-tfp410.h>
@@ -428,5 +427,5 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
428 .init_machine = omap3_stalker_init, 427 .init_machine = omap3_stalker_init,
429 .init_late = omap35xx_init_late, 428 .init_late = omap35xx_init_late,
430 .timer = &omap3_secure_timer, 429 .timer = &omap3_secure_timer,
431 .restart = omap_prcm_restart, 430 .restart = omap3xxx_restart,
432MACHINE_END 431MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 944ffc43657..263cb9cfbf3 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -44,12 +44,12 @@
44#include <asm/system_info.h> 44#include <asm/system_info.h>
45 45
46#include "common.h" 46#include "common.h"
47#include <plat/gpmc.h> 47#include "gpmc.h"
48#include <linux/platform_data/mtd-nand-omap2.h> 48#include <linux/platform_data/mtd-nand-omap2.h>
49#include <plat/usb.h>
50 49
51#include "mux.h" 50#include "mux.h"
52#include "hsmmc.h" 51#include "hsmmc.h"
52#include "board-flash.h"
53#include "common-board-devices.h" 53#include "common-board-devices.h"
54 54
55#include <asm/setup.h> 55#include <asm/setup.h>
@@ -59,6 +59,8 @@
59#define TB_BL_PWM_TIMER 9 59#define TB_BL_PWM_TIMER 9
60#define TB_KILL_POWER_GPIO 168 60#define TB_KILL_POWER_GPIO 168
61 61
62#define NAND_CS 0
63
62static unsigned long touchbook_revision; 64static unsigned long touchbook_revision;
63 65
64static struct mtd_partition omap3touchbook_nand_partitions[] = { 66static struct mtd_partition omap3touchbook_nand_partitions[] = {
@@ -365,8 +367,9 @@ static void __init omap3_touchbook_init(void)
365 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 367 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
366 usb_musb_init(NULL); 368 usb_musb_init(NULL);
367 usbhs_init(&usbhs_bdata); 369 usbhs_init(&usbhs_bdata);
368 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions, 370 board_nand_init(omap3touchbook_nand_partitions,
369 ARRAY_SIZE(omap3touchbook_nand_partitions)); 371 ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
372 NAND_BUSWIDTH_16, NULL);
370 373
371 /* Ensure SDRC pins are mux'd for self-refresh */ 374 /* Ensure SDRC pins are mux'd for self-refresh */
372 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 375 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -384,5 +387,5 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
384 .init_machine = omap3_touchbook_init, 387 .init_machine = omap3_touchbook_init,
385 .init_late = omap3430_init_late, 388 .init_late = omap3430_init_late,
386 .timer = &omap3_secure_timer, 389 .timer = &omap3_secure_timer,
387 .restart = omap_prcm_restart, 390 .restart = omap3xxx_restart,
388MACHINE_END 391MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index bfcd397e233..5c8e9cee2c2 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -29,6 +29,7 @@
29#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
30#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/ti_wilink_st.h> 31#include <linux/ti_wilink_st.h>
32#include <linux/usb/musb.h>
32#include <linux/wl12xx.h> 33#include <linux/wl12xx.h>
33#include <linux/platform_data/omap-abe-twl6040.h> 34#include <linux/platform_data/omap-abe-twl6040.h>
34 35
@@ -36,26 +37,20 @@
36#include <asm/mach-types.h> 37#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
38#include <asm/mach/map.h> 39#include <asm/mach/map.h>
39#include <video/omapdss.h>
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/usb.h>
43#include <plat/mmc.h>
44#include <video/omap-panel-tfp410.h>
45
46#include "soc.h" 42#include "soc.h"
43#include "mmc.h"
47#include "hsmmc.h" 44#include "hsmmc.h"
48#include "control.h" 45#include "control.h"
49#include "mux.h" 46#include "mux.h"
50#include "common-board-devices.h" 47#include "common-board-devices.h"
48#include "dss-common.h"
51 49
52#define GPIO_HUB_POWER 1 50#define GPIO_HUB_POWER 1
53#define GPIO_HUB_NRESET 62 51#define GPIO_HUB_NRESET 62
54#define GPIO_WIFI_PMENA 43 52#define GPIO_WIFI_PMENA 43
55#define GPIO_WIFI_IRQ 53 53#define GPIO_WIFI_IRQ 53
56#define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
57#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
58#define HDMI_GPIO_HPD 63 /* Hotplug detect */
59 54
60/* wl127x BT, FM, GPS connectivity chip */ 55/* wl127x BT, FM, GPS connectivity chip */
61static struct ti_st_plat_data wilink_platform_data = { 56static struct ti_st_plat_data wilink_platform_data = {
@@ -409,68 +404,6 @@ static struct omap_board_mux board_mux[] __initdata = {
409#define board_mux NULL 404#define board_mux NULL
410#endif 405#endif
411 406
412/* Display DVI */
413#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
414
415/* Using generic display panel */
416static struct tfp410_platform_data omap4_dvi_panel = {
417 .i2c_bus_num = 3,
418 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
419};
420
421static struct omap_dss_device omap4_panda_dvi_device = {
422 .type = OMAP_DISPLAY_TYPE_DPI,
423 .name = "dvi",
424 .driver_name = "tfp410",
425 .data = &omap4_dvi_panel,
426 .phy.dpi.data_lines = 24,
427 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
428 .channel = OMAP_DSS_CHANNEL_LCD2,
429};
430
431static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
432 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
433 .ls_oe_gpio = HDMI_GPIO_LS_OE,
434 .hpd_gpio = HDMI_GPIO_HPD,
435};
436
437static struct omap_dss_device omap4_panda_hdmi_device = {
438 .name = "hdmi",
439 .driver_name = "hdmi_panel",
440 .type = OMAP_DISPLAY_TYPE_HDMI,
441 .channel = OMAP_DSS_CHANNEL_DIGIT,
442 .data = &omap4_panda_hdmi_data,
443};
444
445static struct omap_dss_device *omap4_panda_dss_devices[] = {
446 &omap4_panda_dvi_device,
447 &omap4_panda_hdmi_device,
448};
449
450static struct omap_dss_board_info omap4_panda_dss_data = {
451 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
452 .devices = omap4_panda_dss_devices,
453 .default_device = &omap4_panda_dvi_device,
454};
455
456static void __init omap4_panda_display_init(void)
457{
458
459 omap_display_init(&omap4_panda_dss_data);
460
461 /*
462 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
463 * later have external pull up on the HDMI I2C lines
464 */
465 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
466 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
467 else
468 omap_hdmi_init(0);
469
470 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
471 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
472 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
473}
474 407
475static void omap4_panda_init_rev(void) 408static void omap4_panda_init_rev(void)
476{ 409{
@@ -524,5 +457,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
524 .init_machine = omap4_panda_init, 457 .init_machine = omap4_panda_init,
525 .init_late = omap4430_init_late, 458 .init_late = omap4430_init_late,
526 .timer = &omap4_timer, 459 .timer = &omap4_timer,
527 .restart = omap_prcm_restart, 460 .restart = omap44xx_restart,
528MACHINE_END 461MACHINE_END
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index b700685762b..c8fde3e5644 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -45,18 +45,20 @@
45#include <asm/mach/flash.h> 45#include <asm/mach/flash.h>
46#include <asm/mach/map.h> 46#include <asm/mach/map.h>
47 47
48#include "common.h"
49#include <video/omapdss.h> 48#include <video/omapdss.h>
50#include <video/omap-panel-generic-dpi.h> 49#include <video/omap-panel-generic-dpi.h>
51#include <video/omap-panel-tfp410.h> 50#include <video/omap-panel-tfp410.h>
52#include <plat/gpmc.h>
53#include <plat/usb.h>
54 51
52#include "common.h"
55#include "mux.h" 53#include "mux.h"
56#include "sdram-micron-mt46h32m32lf-6.h" 54#include "sdram-micron-mt46h32m32lf-6.h"
55#include "gpmc.h"
57#include "hsmmc.h" 56#include "hsmmc.h"
57#include "board-flash.h"
58#include "common-board-devices.h" 58#include "common-board-devices.h"
59 59
60#define NAND_CS 0
61
60#define OVERO_GPIO_BT_XGATE 15 62#define OVERO_GPIO_BT_XGATE 15
61#define OVERO_GPIO_W2W_NRESET 16 63#define OVERO_GPIO_W2W_NRESET 16
62#define OVERO_GPIO_PENDOWN 114 64#define OVERO_GPIO_PENDOWN 114
@@ -495,8 +497,8 @@ static void __init overo_init(void)
495 omap_serial_init(); 497 omap_serial_init();
496 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 498 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
497 mt46h32m32lf6_sdrc_params); 499 mt46h32m32lf6_sdrc_params);
498 omap_nand_flash_init(0, overo_nand_partitions, 500 board_nand_init(overo_nand_partitions,
499 ARRAY_SIZE(overo_nand_partitions)); 501 ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
500 usb_musb_init(NULL); 502 usb_musb_init(NULL);
501 usbhs_init(&usbhs_bdata); 503 usbhs_init(&usbhs_bdata);
502 overo_spi_init(); 504 overo_spi_init();
@@ -550,5 +552,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
550 .init_machine = overo_init, 552 .init_machine = overo_init,
551 .init_late = omap35xx_init_late, 553 .init_late = omap35xx_init_late,
552 .timer = &omap3_timer, 554 .timer = &omap3_timer,
553 .restart = omap_prcm_restart, 555 .restart = omap3xxx_restart,
554MACHINE_END 556MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 45997bfbcbd..0c777b75e48 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Board support file for Nokia RM-680/696. 2 * Board support file for Nokia N950 (RM-680) / N9 (RM-696).
3 * 3 *
4 * Copyright (C) 2010 Nokia 4 * Copyright (C) 2010 Nokia
5 * 5 *
@@ -22,17 +22,14 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <plat/usb.h>
28#include <plat/gpmc.h>
29#include "common.h" 25#include "common.h"
30#include <plat/serial.h>
31
32#include "mux.h" 26#include "mux.h"
27#include "gpmc.h"
28#include "mmc.h"
33#include "hsmmc.h" 29#include "hsmmc.h"
34#include "sdram-nokia.h" 30#include "sdram-nokia.h"
35#include "common-board-devices.h" 31#include "common-board-devices.h"
32#include "gpmc-onenand.h"
36 33
37static struct regulator_consumer_supply rm680_vemmc_consumers[] = { 34static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
38 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 35 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
@@ -151,7 +148,7 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
151 .init_machine = rm680_init, 148 .init_machine = rm680_init,
152 .init_late = omap3630_init_late, 149 .init_late = omap3630_init_late,
153 .timer = &omap3_timer, 150 .timer = &omap3_timer,
154 .restart = omap_prcm_restart, 151 .restart = omap3xxx_restart,
155MACHINE_END 152MACHINE_END
156 153
157MACHINE_START(NOKIA_RM696, "Nokia RM-696 board") 154MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
@@ -164,5 +161,5 @@ MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
164 .init_machine = rm680_init, 161 .init_machine = rm680_init,
165 .init_late = omap3630_init_late, 162 .init_late = omap3630_init_late,
166 .timer = &omap3_timer, 163 .timer = &omap3_timer,
167 .restart = omap_prcm_restart, 164 .restart = omap3xxx_restart,
168MACHINE_END 165MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 020e03c95bf..60529e0b3d6 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -31,9 +31,7 @@
31#include <asm/system_info.h> 31#include <asm/system_info.h>
32 32
33#include "common.h" 33#include "common.h"
34#include <plat/dma.h> 34#include <linux/omap-dma.h>
35#include <plat/gpmc.h>
36#include <plat/omap-pm.h>
37#include "gpmc-smc91x.h" 35#include "gpmc-smc91x.h"
38 36
39#include "board-rx51.h" 37#include "board-rx51.h"
@@ -52,8 +50,11 @@
52#endif 50#endif
53 51
54#include "mux.h" 52#include "mux.h"
53#include "omap-pm.h"
55#include "hsmmc.h" 54#include "hsmmc.h"
56#include "common-board-devices.h" 55#include "common-board-devices.h"
56#include "gpmc.h"
57#include "gpmc-onenand.h"
57 58
58#define SYSTEM_REV_B_USES_VAUX3 0x1699 59#define SYSTEM_REV_B_USES_VAUX3 0x1699
59#define SYSTEM_REV_S_USES_VAUX3 0x8 60#define SYSTEM_REV_S_USES_VAUX3 0x8
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 7bbb05d9689..f1d6efe079c 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/board-rx51.c 2 * Board support file for Nokia N900 (aka RX-51).
3 * 3 *
4 * Copyright (C) 2007, 2008 Nokia 4 * Copyright (C) 2007, 2008 Nokia
5 * 5 *
@@ -17,18 +17,18 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/leds.h> 19#include <linux/leds.h>
20#include <linux/usb/musb.h>
20#include <linux/platform_data/spi-omap2-mcspi.h> 21#include <linux/platform_data/spi-omap2-mcspi.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25 26
26#include "common.h" 27#include <linux/omap-dma.h>
27#include <plat/dma.h>
28#include <plat/gpmc.h>
29#include <plat/usb.h>
30 28
29#include "common.h"
31#include "mux.h" 30#include "mux.h"
31#include "gpmc.h"
32#include "pm.h" 32#include "pm.h"
33#include "sdram-nokia.h" 33#include "sdram-nokia.h"
34 34
@@ -127,5 +127,5 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
127 .init_machine = rx51_init, 127 .init_machine = rx51_init,
128 .init_late = omap3430_init_late, 128 .init_late = omap3430_init_late,
129 .timer = &omap3_timer, 129 .timer = &omap3_timer,
130 .restart = omap_prcm_restart, 130 .restart = omap3xxx_restart,
131MACHINE_END 131MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index c4f8833b4c3..1a3e056d63a 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -14,13 +14,14 @@
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/usb/musb.h>
17 19
18#include <asm/mach-types.h> 20#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
20#include <asm/mach/map.h> 22#include <asm/mach/map.h>
21 23
22#include "common.h" 24#include "common.h"
23#include <plat/usb.h>
24 25
25static struct omap_musb_board_data musb_board_data = { 26static struct omap_musb_board_data musb_board_data = {
26 .set_phy_power = ti81xx_musb_phy_power, 27 .set_phy_power = ti81xx_musb_phy_power,
@@ -45,7 +46,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
45 .timer = &omap3_timer, 46 .timer = &omap3_timer,
46 .init_machine = ti81xx_evm_init, 47 .init_machine = ti81xx_evm_init,
47 .init_late = ti81xx_init_late, 48 .init_late = ti81xx_init_late,
48 .restart = omap_prcm_restart, 49 .restart = omap44xx_restart,
49MACHINE_END 50MACHINE_END
50 51
51MACHINE_START(TI8148EVM, "ti8148evm") 52MACHINE_START(TI8148EVM, "ti8148evm")
@@ -57,5 +58,5 @@ MACHINE_START(TI8148EVM, "ti8148evm")
57 .timer = &omap3_timer, 58 .timer = &omap3_timer,
58 .init_machine = ti81xx_evm_init, 59 .init_machine = ti81xx_evm_init,
59 .init_late = ti81xx_init_late, 60 .init_late = ti81xx_init_late,
60 .restart = omap_prcm_restart, 61 .restart = omap44xx_restart,
61MACHINE_END 62MACHINE_END
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index afb2278a29f..42e5f231a79 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -17,10 +17,10 @@
17#include <linux/regulator/fixed.h> 17#include <linux/regulator/fixed.h>
18#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21#include "gpmc-smsc911x.h" 21#include "gpmc-smsc911x.h"
22 22
23#include <mach/board-zoom.h> 23#include "board-zoom.h"
24 24
25#include "soc.h" 25#include "soc.h"
26#include "common.h" 26#include "common.h"
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index b940ab2259f..1c7c834a5b5 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -16,8 +16,9 @@
16#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/platform_data/spi-omap2-mcspi.h> 17#include <linux/platform_data/spi-omap2-mcspi.h>
18#include <video/omapdss.h> 18#include <video/omapdss.h>
19#include <mach/board-zoom.h> 19#include "board-zoom.h"
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22 23
23#define LCD_PANEL_RESET_GPIO_PROD 96 24#define LCD_PANEL_RESET_GPIO_PROD 96
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index c166fe1fdff..26e07addc9d 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -26,9 +26,8 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include "common.h" 28#include "common.h"
29#include <plat/usb.h>
30 29
31#include <mach/board-zoom.h> 30#include "board-zoom.h"
32 31
33#include "mux.h" 32#include "mux.h"
34#include "hsmmc.h" 33#include "hsmmc.h"
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 4994438e1f4..d7fa31e6723 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -22,9 +22,8 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23 23
24#include "common.h" 24#include "common.h"
25#include <plat/usb.h>
26 25
27#include <mach/board-zoom.h> 26#include "board-zoom.h"
28 27
29#include "board-flash.h" 28#include "board-flash.h"
30#include "mux.h" 29#include "mux.h"
@@ -113,8 +112,9 @@ static void __init omap_zoom_init(void)
113 usbhs_init(&usbhs_bdata); 112 usbhs_init(&usbhs_bdata);
114 } 113 }
115 114
116 board_nand_init(zoom_nand_partitions, ARRAY_SIZE(zoom_nand_partitions), 115 board_nand_init(zoom_nand_partitions,
117 ZOOM_NAND_CS, NAND_BUSWIDTH_16); 116 ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
117 NAND_BUSWIDTH_16, nand_default_timings);
118 zoom_debugboard_init(); 118 zoom_debugboard_init();
119 zoom_peripherals_init(); 119 zoom_peripherals_init();
120 120
@@ -138,7 +138,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
138 .init_machine = omap_zoom_init, 138 .init_machine = omap_zoom_init,
139 .init_late = omap3430_init_late, 139 .init_late = omap3430_init_late,
140 .timer = &omap3_timer, 140 .timer = &omap3_timer,
141 .restart = omap_prcm_restart, 141 .restart = omap3xxx_restart,
142MACHINE_END 142MACHINE_END
143 143
144MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board") 144MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
@@ -151,5 +151,5 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
151 .init_machine = omap_zoom_init, 151 .init_machine = omap_zoom_init,
152 .init_late = omap3630_init_late, 152 .init_late = omap3630_init_late,
153 .timer = &omap3_timer, 153 .timer = &omap3_timer,
154 .restart = omap_prcm_restart, 154 .restart = omap3xxx_restart,
155MACHINE_END 155MACHINE_END
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h b/arch/arm/mach-omap2/board-zoom.h
index 2e9486940ea..2e9486940ea 100644
--- a/arch/arm/mach-omap2/include/mach/board-zoom.h
+++ b/arch/arm/mach-omap2/board-zoom.h
diff --git a/arch/arm/mach-omap2/cclock2420_data.c b/arch/arm/mach-omap2/cclock2420_data.c
new file mode 100644
index 00000000000..7e5febe456d
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock2420_data.c
@@ -0,0 +1,1950 @@
1/*
2 * OMAP2420 clock data
3 *
4 * Copyright (C) 2005-2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 * Updated to COMMON clk format by Rajendra Nayak <rnayak@ti.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kernel.h>
18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/clk-private.h>
21#include <linux/list.h>
22
23#include "soc.h"
24#include "iomap.h"
25#include "clock.h"
26#include "clock2xxx.h"
27#include "opp2xxx.h"
28#include "cm2xxx.h"
29#include "prm2xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm-regbits-24xx.h"
32#include "sdrc.h"
33#include "control.h"
34
35#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
36
37/*
38 * 2420 clock tree.
39 *
40 * NOTE:In many cases here we are assigning a 'default' parent. In
41 * many cases the parent is selectable. The set parent calls will
42 * also switch sources.
43 *
44 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func.
46 *
47 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived
51 * clocks.
52 */
53
54DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
55
56DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
57
58DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
59
60static struct clk osc_ck;
61
62static const struct clk_ops osc_ck_ops = {
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static struct clk func_96m_ck;
226
227static const char *func_96m_ck_parent_names[] = {
228 "apll96_ck",
229};
230
231DEFINE_STRUCT_CLK_HW_OMAP(func_96m_ck, "wkup_clkdm");
232DEFINE_STRUCT_CLK(func_96m_ck, func_96m_ck_parent_names, core_ck_ops);
233
234static struct clk cam_fck;
235
236static const char *cam_fck_parent_names[] = {
237 "func_96m_ck",
238};
239
240static struct clk_hw_omap cam_fck_hw = {
241 .hw = {
242 .clk = &cam_fck,
243 },
244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
245 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
246 .clkdm_name = "core_l3_clkdm",
247};
248
249DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
250
251static struct clk cam_ick;
252
253static struct clk_hw_omap cam_ick_hw = {
254 .hw = {
255 .clk = &cam_ick,
256 },
257 .ops = &clkhwops_iclk,
258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
259 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
260 .clkdm_name = "core_l4_clkdm",
261};
262
263DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
264
265static struct clk des_ick;
266
267static struct clk_hw_omap des_ick_hw = {
268 .hw = {
269 .clk = &des_ick,
270 },
271 .ops = &clkhwops_iclk_wait,
272 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
273 .enable_bit = OMAP24XX_EN_DES_SHIFT,
274 .clkdm_name = "core_l4_clkdm",
275};
276
277DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
278
279static const struct clksel_rate dsp_fck_core_rates[] = {
280 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
281 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
282 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
283 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
284 { .div = 6, .val = 6, .flags = RATE_IN_242X },
285 { .div = 8, .val = 8, .flags = RATE_IN_242X },
286 { .div = 12, .val = 12, .flags = RATE_IN_242X },
287 { .div = 0 }
288};
289
290static const struct clksel dsp_fck_clksel[] = {
291 { .parent = &core_ck, .rates = dsp_fck_core_rates },
292 { .parent = NULL },
293};
294
295static const char *dsp_fck_parent_names[] = {
296 "core_ck",
297};
298
299static const struct clk_ops dsp_fck_ops = {
300 .init = &omap2_init_clk_clkdm,
301 .enable = &omap2_dflt_clk_enable,
302 .disable = &omap2_dflt_clk_disable,
303 .is_enabled = &omap2_dflt_clk_is_enabled,
304 .recalc_rate = &omap2_clksel_recalc,
305 .set_rate = &omap2_clksel_set_rate,
306 .round_rate = &omap2_clksel_round_rate,
307};
308
309DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
311 OMAP24XX_CLKSEL_DSP_MASK,
312 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
313 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
314 dsp_fck_parent_names, dsp_fck_ops);
315
316static const struct clksel dsp_ick_clksel[] = {
317 { .parent = &dsp_fck, .rates = dsp_ick_rates },
318 { .parent = NULL },
319};
320
321static const char *dsp_ick_parent_names[] = {
322 "dsp_fck",
323};
324
325DEFINE_CLK_OMAP_MUX_GATE(dsp_ick, "dsp_clkdm", dsp_ick_clksel,
326 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
327 OMAP24XX_CLKSEL_DSP_IF_MASK,
328 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
329 OMAP2420_EN_DSP_IPI_SHIFT, &clkhwops_iclk_wait,
330 dsp_ick_parent_names, dsp_fck_ops);
331
332static const struct clksel_rate dss1_fck_sys_rates[] = {
333 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
334 { .div = 0 }
335};
336
337static const struct clksel_rate dss1_fck_core_rates[] = {
338 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
339 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
340 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
341 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
342 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
343 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
344 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
345 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
346 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
347 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
348 { .div = 0 }
349};
350
351static const struct clksel dss1_fck_clksel[] = {
352 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
353 { .parent = &core_ck, .rates = dss1_fck_core_rates },
354 { .parent = NULL },
355};
356
357static const char *dss1_fck_parent_names[] = {
358 "sys_ck", "core_ck",
359};
360
361static struct clk dss1_fck;
362
363static const struct clk_ops dss1_fck_ops = {
364 .init = &omap2_init_clk_clkdm,
365 .enable = &omap2_dflt_clk_enable,
366 .disable = &omap2_dflt_clk_disable,
367 .is_enabled = &omap2_dflt_clk_is_enabled,
368 .recalc_rate = &omap2_clksel_recalc,
369 .get_parent = &omap2_clksel_find_parent_index,
370 .set_parent = &omap2_clksel_set_parent,
371};
372
373DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
374 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
375 OMAP24XX_CLKSEL_DSS1_MASK,
376 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
377 OMAP24XX_EN_DSS1_SHIFT, NULL,
378 dss1_fck_parent_names, dss1_fck_ops);
379
380static const struct clksel_rate dss2_fck_sys_rates[] = {
381 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
382 { .div = 0 }
383};
384
385static const struct clksel_rate dss2_fck_48m_rates[] = {
386 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
387 { .div = 0 }
388};
389
390static const struct clksel_rate func_48m_apll96_rates[] = {
391 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
392 { .div = 0 }
393};
394
395static const struct clksel_rate func_48m_alt_rates[] = {
396 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
397 { .div = 0 }
398};
399
400static const struct clksel func_48m_clksel[] = {
401 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
402 { .parent = &alt_ck, .rates = func_48m_alt_rates },
403 { .parent = NULL },
404};
405
406static const char *func_48m_ck_parent_names[] = {
407 "apll96_ck", "alt_ck",
408};
409
410static struct clk func_48m_ck;
411
412static const struct clk_ops func_48m_ck_ops = {
413 .init = &omap2_init_clk_clkdm,
414 .recalc_rate = &omap2_clksel_recalc,
415 .set_rate = &omap2_clksel_set_rate,
416 .round_rate = &omap2_clksel_round_rate,
417 .get_parent = &omap2_clksel_find_parent_index,
418 .set_parent = &omap2_clksel_set_parent,
419};
420
421static struct clk_hw_omap func_48m_ck_hw = {
422 .hw = {
423 .clk = &func_48m_ck,
424 },
425 .clksel = func_48m_clksel,
426 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
427 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
428 .clkdm_name = "wkup_clkdm",
429};
430
431DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
432
433static const struct clksel dss2_fck_clksel[] = {
434 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
435 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
436 { .parent = NULL },
437};
438
439static const char *dss2_fck_parent_names[] = {
440 "sys_ck", "func_48m_ck",
441};
442
443DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
444 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
445 OMAP24XX_CLKSEL_DSS2_MASK,
446 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
447 OMAP24XX_EN_DSS2_SHIFT, NULL,
448 dss2_fck_parent_names, dss1_fck_ops);
449
450static const char *func_54m_ck_parent_names[] = {
451 "apll54_ck", "alt_ck",
452};
453
454DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
455 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
456 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH,
457 0x0, NULL);
458
459static struct clk dss_54m_fck;
460
461static const char *dss_54m_fck_parent_names[] = {
462 "func_54m_ck",
463};
464
465static struct clk_hw_omap dss_54m_fck_hw = {
466 .hw = {
467 .clk = &dss_54m_fck,
468 },
469 .ops = &clkhwops_wait,
470 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
471 .enable_bit = OMAP24XX_EN_TV_SHIFT,
472 .clkdm_name = "dss_clkdm",
473};
474
475DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
476
477static struct clk dss_ick;
478
479static struct clk_hw_omap dss_ick_hw = {
480 .hw = {
481 .clk = &dss_ick,
482 },
483 .ops = &clkhwops_iclk,
484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
485 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
486 .clkdm_name = "dss_clkdm",
487};
488
489DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
490
491static struct clk eac_fck;
492
493static struct clk_hw_omap eac_fck_hw = {
494 .hw = {
495 .clk = &eac_fck,
496 },
497 .ops = &clkhwops_wait,
498 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
499 .enable_bit = OMAP2420_EN_EAC_SHIFT,
500 .clkdm_name = "core_l4_clkdm",
501};
502
503DEFINE_STRUCT_CLK(eac_fck, cam_fck_parent_names, aes_ick_ops);
504
505static struct clk eac_ick;
506
507static struct clk_hw_omap eac_ick_hw = {
508 .hw = {
509 .clk = &eac_ick,
510 },
511 .ops = &clkhwops_iclk_wait,
512 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
513 .enable_bit = OMAP2420_EN_EAC_SHIFT,
514 .clkdm_name = "core_l4_clkdm",
515};
516
517DEFINE_STRUCT_CLK(eac_ick, aes_ick_parent_names, aes_ick_ops);
518
519static struct clk emul_ck;
520
521static struct clk_hw_omap emul_ck_hw = {
522 .hw = {
523 .clk = &emul_ck,
524 },
525 .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
526 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
527 .clkdm_name = "wkup_clkdm",
528};
529
530DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
531
532DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
533
534static struct clk fac_fck;
535
536static const char *fac_fck_parent_names[] = {
537 "func_12m_ck",
538};
539
540static struct clk_hw_omap fac_fck_hw = {
541 .hw = {
542 .clk = &fac_fck,
543 },
544 .ops = &clkhwops_wait,
545 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
546 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
547 .clkdm_name = "core_l4_clkdm",
548};
549
550DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
551
552static struct clk fac_ick;
553
554static struct clk_hw_omap fac_ick_hw = {
555 .hw = {
556 .clk = &fac_ick,
557 },
558 .ops = &clkhwops_iclk_wait,
559 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
560 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
561 .clkdm_name = "core_l4_clkdm",
562};
563
564DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
565
566static const struct clksel gfx_fck_clksel[] = {
567 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
568 { .parent = NULL },
569};
570
571static const char *gfx_2d_fck_parent_names[] = {
572 "core_l3_ck",
573};
574
575DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
576 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
577 OMAP_CLKSEL_GFX_MASK,
578 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
579 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
580 gfx_2d_fck_parent_names, dsp_fck_ops);
581
582DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
583 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
584 OMAP_CLKSEL_GFX_MASK,
585 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
586 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
587 gfx_2d_fck_parent_names, dsp_fck_ops);
588
589static struct clk gfx_ick;
590
591static const char *gfx_ick_parent_names[] = {
592 "core_l3_ck",
593};
594
595static struct clk_hw_omap gfx_ick_hw = {
596 .hw = {
597 .clk = &gfx_ick,
598 },
599 .ops = &clkhwops_wait,
600 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
601 .enable_bit = OMAP_EN_GFX_SHIFT,
602 .clkdm_name = "gfx_clkdm",
603};
604
605DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
606
607static struct clk gpios_fck;
608
609static const char *gpios_fck_parent_names[] = {
610 "func_32k_ck",
611};
612
613static struct clk_hw_omap gpios_fck_hw = {
614 .hw = {
615 .clk = &gpios_fck,
616 },
617 .ops = &clkhwops_wait,
618 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
619 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
620 .clkdm_name = "wkup_clkdm",
621};
622
623DEFINE_STRUCT_CLK(gpios_fck, gpios_fck_parent_names, aes_ick_ops);
624
625static struct clk wu_l4_ick;
626
627DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
628DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
629
630static struct clk gpios_ick;
631
632static const char *gpios_ick_parent_names[] = {
633 "wu_l4_ick",
634};
635
636static struct clk_hw_omap gpios_ick_hw = {
637 .hw = {
638 .clk = &gpios_ick,
639 },
640 .ops = &clkhwops_iclk_wait,
641 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
642 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
643 .clkdm_name = "wkup_clkdm",
644};
645
646DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
647
648static struct clk gpmc_fck;
649
650static struct clk_hw_omap gpmc_fck_hw = {
651 .hw = {
652 .clk = &gpmc_fck,
653 },
654 .ops = &clkhwops_iclk,
655 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
656 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
657 .flags = ENABLE_ON_INIT,
658 .clkdm_name = "core_l3_clkdm",
659};
660
661DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
662
663static const struct clksel_rate gpt_alt_rates[] = {
664 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
665 { .div = 0 }
666};
667
668static const struct clksel omap24xx_gpt_clksel[] = {
669 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
670 { .parent = &sys_ck, .rates = gpt_sys_rates },
671 { .parent = &alt_ck, .rates = gpt_alt_rates },
672 { .parent = NULL },
673};
674
675static const char *gpt10_fck_parent_names[] = {
676 "func_32k_ck", "sys_ck", "alt_ck",
677};
678
679DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
680 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
681 OMAP24XX_CLKSEL_GPT10_MASK,
682 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
683 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
684 gpt10_fck_parent_names, dss1_fck_ops);
685
686static struct clk gpt10_ick;
687
688static struct clk_hw_omap gpt10_ick_hw = {
689 .hw = {
690 .clk = &gpt10_ick,
691 },
692 .ops = &clkhwops_iclk_wait,
693 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
694 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
695 .clkdm_name = "core_l4_clkdm",
696};
697
698DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
699
700DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
701 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
702 OMAP24XX_CLKSEL_GPT11_MASK,
703 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
704 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
705 gpt10_fck_parent_names, dss1_fck_ops);
706
707static struct clk gpt11_ick;
708
709static struct clk_hw_omap gpt11_ick_hw = {
710 .hw = {
711 .clk = &gpt11_ick,
712 },
713 .ops = &clkhwops_iclk_wait,
714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
715 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
716 .clkdm_name = "core_l4_clkdm",
717};
718
719DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
720
721DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
722 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
723 OMAP24XX_CLKSEL_GPT12_MASK,
724 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
725 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
726 gpt10_fck_parent_names, dss1_fck_ops);
727
728static struct clk gpt12_ick;
729
730static struct clk_hw_omap gpt12_ick_hw = {
731 .hw = {
732 .clk = &gpt12_ick,
733 },
734 .ops = &clkhwops_iclk_wait,
735 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
736 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
737 .clkdm_name = "core_l4_clkdm",
738};
739
740DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
741
742static const struct clk_ops gpt1_fck_ops = {
743 .init = &omap2_init_clk_clkdm,
744 .enable = &omap2_dflt_clk_enable,
745 .disable = &omap2_dflt_clk_disable,
746 .is_enabled = &omap2_dflt_clk_is_enabled,
747 .recalc_rate = &omap2_clksel_recalc,
748 .set_rate = &omap2_clksel_set_rate,
749 .round_rate = &omap2_clksel_round_rate,
750 .get_parent = &omap2_clksel_find_parent_index,
751 .set_parent = &omap2_clksel_set_parent,
752};
753
754DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
755 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
756 OMAP24XX_CLKSEL_GPT1_MASK,
757 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
758 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
759 gpt10_fck_parent_names, gpt1_fck_ops);
760
761static struct clk gpt1_ick;
762
763static struct clk_hw_omap gpt1_ick_hw = {
764 .hw = {
765 .clk = &gpt1_ick,
766 },
767 .ops = &clkhwops_iclk_wait,
768 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
769 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
770 .clkdm_name = "wkup_clkdm",
771};
772
773DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
774
775DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
776 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
777 OMAP24XX_CLKSEL_GPT2_MASK,
778 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
779 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
780 gpt10_fck_parent_names, dss1_fck_ops);
781
782static struct clk gpt2_ick;
783
784static struct clk_hw_omap gpt2_ick_hw = {
785 .hw = {
786 .clk = &gpt2_ick,
787 },
788 .ops = &clkhwops_iclk_wait,
789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
790 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
791 .clkdm_name = "core_l4_clkdm",
792};
793
794DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
795
796DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
797 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
798 OMAP24XX_CLKSEL_GPT3_MASK,
799 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
800 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
801 gpt10_fck_parent_names, dss1_fck_ops);
802
803static struct clk gpt3_ick;
804
805static struct clk_hw_omap gpt3_ick_hw = {
806 .hw = {
807 .clk = &gpt3_ick,
808 },
809 .ops = &clkhwops_iclk_wait,
810 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
811 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
812 .clkdm_name = "core_l4_clkdm",
813};
814
815DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
816
817DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
818 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
819 OMAP24XX_CLKSEL_GPT4_MASK,
820 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
821 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
822 gpt10_fck_parent_names, dss1_fck_ops);
823
824static struct clk gpt4_ick;
825
826static struct clk_hw_omap gpt4_ick_hw = {
827 .hw = {
828 .clk = &gpt4_ick,
829 },
830 .ops = &clkhwops_iclk_wait,
831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
832 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
833 .clkdm_name = "core_l4_clkdm",
834};
835
836DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
837
838DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
839 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
840 OMAP24XX_CLKSEL_GPT5_MASK,
841 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
842 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
843 gpt10_fck_parent_names, dss1_fck_ops);
844
845static struct clk gpt5_ick;
846
847static struct clk_hw_omap gpt5_ick_hw = {
848 .hw = {
849 .clk = &gpt5_ick,
850 },
851 .ops = &clkhwops_iclk_wait,
852 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
853 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
854 .clkdm_name = "core_l4_clkdm",
855};
856
857DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
858
859DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
860 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
861 OMAP24XX_CLKSEL_GPT6_MASK,
862 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
863 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
864 gpt10_fck_parent_names, dss1_fck_ops);
865
866static struct clk gpt6_ick;
867
868static struct clk_hw_omap gpt6_ick_hw = {
869 .hw = {
870 .clk = &gpt6_ick,
871 },
872 .ops = &clkhwops_iclk_wait,
873 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
874 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
875 .clkdm_name = "core_l4_clkdm",
876};
877
878DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
879
880DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
881 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
882 OMAP24XX_CLKSEL_GPT7_MASK,
883 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
884 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
885 gpt10_fck_parent_names, dss1_fck_ops);
886
887static struct clk gpt7_ick;
888
889static struct clk_hw_omap gpt7_ick_hw = {
890 .hw = {
891 .clk = &gpt7_ick,
892 },
893 .ops = &clkhwops_iclk_wait,
894 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
895 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
896 .clkdm_name = "core_l4_clkdm",
897};
898
899DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
900
901DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
902 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
903 OMAP24XX_CLKSEL_GPT8_MASK,
904 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
905 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
906 gpt10_fck_parent_names, dss1_fck_ops);
907
908static struct clk gpt8_ick;
909
910static struct clk_hw_omap gpt8_ick_hw = {
911 .hw = {
912 .clk = &gpt8_ick,
913 },
914 .ops = &clkhwops_iclk_wait,
915 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
916 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
917 .clkdm_name = "core_l4_clkdm",
918};
919
920DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
921
922DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
923 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
924 OMAP24XX_CLKSEL_GPT9_MASK,
925 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
926 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
927 gpt10_fck_parent_names, dss1_fck_ops);
928
929static struct clk gpt9_ick;
930
931static struct clk_hw_omap gpt9_ick_hw = {
932 .hw = {
933 .clk = &gpt9_ick,
934 },
935 .ops = &clkhwops_iclk_wait,
936 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
937 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
938 .clkdm_name = "core_l4_clkdm",
939};
940
941DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
942
943static struct clk hdq_fck;
944
945static struct clk_hw_omap hdq_fck_hw = {
946 .hw = {
947 .clk = &hdq_fck,
948 },
949 .ops = &clkhwops_wait,
950 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
951 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
952 .clkdm_name = "core_l4_clkdm",
953};
954
955DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
956
957static struct clk hdq_ick;
958
959static struct clk_hw_omap hdq_ick_hw = {
960 .hw = {
961 .clk = &hdq_ick,
962 },
963 .ops = &clkhwops_iclk_wait,
964 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
965 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
966 .clkdm_name = "core_l4_clkdm",
967};
968
969DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
970
971static struct clk i2c1_fck;
972
973static struct clk_hw_omap i2c1_fck_hw = {
974 .hw = {
975 .clk = &i2c1_fck,
976 },
977 .ops = &clkhwops_wait,
978 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
979 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
980 .clkdm_name = "core_l4_clkdm",
981};
982
983DEFINE_STRUCT_CLK(i2c1_fck, fac_fck_parent_names, aes_ick_ops);
984
985static struct clk i2c1_ick;
986
987static struct clk_hw_omap i2c1_ick_hw = {
988 .hw = {
989 .clk = &i2c1_ick,
990 },
991 .ops = &clkhwops_iclk_wait,
992 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
993 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
994 .clkdm_name = "core_l4_clkdm",
995};
996
997DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
998
999static struct clk i2c2_fck;
1000
1001static struct clk_hw_omap i2c2_fck_hw = {
1002 .hw = {
1003 .clk = &i2c2_fck,
1004 },
1005 .ops = &clkhwops_wait,
1006 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1007 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1008 .clkdm_name = "core_l4_clkdm",
1009};
1010
1011DEFINE_STRUCT_CLK(i2c2_fck, fac_fck_parent_names, aes_ick_ops);
1012
1013static struct clk i2c2_ick;
1014
1015static struct clk_hw_omap i2c2_ick_hw = {
1016 .hw = {
1017 .clk = &i2c2_ick,
1018 },
1019 .ops = &clkhwops_iclk_wait,
1020 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1021 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1022 .clkdm_name = "core_l4_clkdm",
1023};
1024
1025DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
1026
1027DEFINE_CLK_OMAP_MUX_GATE(iva1_ifck, "iva1_clkdm", dsp_fck_clksel,
1028 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1029 OMAP2420_CLKSEL_IVA_MASK,
1030 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1031 OMAP2420_EN_IVA_COP_SHIFT, &clkhwops_wait,
1032 dsp_fck_parent_names, dsp_fck_ops);
1033
1034static struct clk iva1_mpu_int_ifck;
1035
1036static const char *iva1_mpu_int_ifck_parent_names[] = {
1037 "iva1_ifck",
1038};
1039
1040static const struct clk_ops iva1_mpu_int_ifck_ops = {
1041 .init = &omap2_init_clk_clkdm,
1042 .enable = &omap2_dflt_clk_enable,
1043 .disable = &omap2_dflt_clk_disable,
1044 .is_enabled = &omap2_dflt_clk_is_enabled,
1045 .recalc_rate = &omap_fixed_divisor_recalc,
1046};
1047
1048static struct clk_hw_omap iva1_mpu_int_ifck_hw = {
1049 .hw = {
1050 .clk = &iva1_mpu_int_ifck,
1051 },
1052 .ops = &clkhwops_wait,
1053 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1054 .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
1055 .clkdm_name = "iva1_clkdm",
1056 .fixed_div = 2,
1057};
1058
1059DEFINE_STRUCT_CLK(iva1_mpu_int_ifck, iva1_mpu_int_ifck_parent_names,
1060 iva1_mpu_int_ifck_ops);
1061
1062static struct clk mailboxes_ick;
1063
1064static struct clk_hw_omap mailboxes_ick_hw = {
1065 .hw = {
1066 .clk = &mailboxes_ick,
1067 },
1068 .ops = &clkhwops_iclk_wait,
1069 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1070 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1071 .clkdm_name = "core_l4_clkdm",
1072};
1073
1074DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1075
1076static const struct clksel_rate common_mcbsp_96m_rates[] = {
1077 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1078 { .div = 0 }
1079};
1080
1081static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1082 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1083 { .div = 0 }
1084};
1085
1086static const struct clksel mcbsp_fck_clksel[] = {
1087 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1088 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1089 { .parent = NULL },
1090};
1091
1092static const char *mcbsp1_fck_parent_names[] = {
1093 "func_96m_ck", "mcbsp_clks",
1094};
1095
1096DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1097 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1098 OMAP2_MCBSP1_CLKS_MASK,
1099 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1100 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1101 mcbsp1_fck_parent_names, dss1_fck_ops);
1102
1103static struct clk mcbsp1_ick;
1104
1105static struct clk_hw_omap mcbsp1_ick_hw = {
1106 .hw = {
1107 .clk = &mcbsp1_ick,
1108 },
1109 .ops = &clkhwops_iclk_wait,
1110 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1111 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1112 .clkdm_name = "core_l4_clkdm",
1113};
1114
1115DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1116
1117DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1118 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1119 OMAP2_MCBSP2_CLKS_MASK,
1120 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1121 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1122 mcbsp1_fck_parent_names, dss1_fck_ops);
1123
1124static struct clk mcbsp2_ick;
1125
1126static struct clk_hw_omap mcbsp2_ick_hw = {
1127 .hw = {
1128 .clk = &mcbsp2_ick,
1129 },
1130 .ops = &clkhwops_iclk_wait,
1131 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1132 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1133 .clkdm_name = "core_l4_clkdm",
1134};
1135
1136DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1137
1138static struct clk mcspi1_fck;
1139
1140static const char *mcspi1_fck_parent_names[] = {
1141 "func_48m_ck",
1142};
1143
1144static struct clk_hw_omap mcspi1_fck_hw = {
1145 .hw = {
1146 .clk = &mcspi1_fck,
1147 },
1148 .ops = &clkhwops_wait,
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1150 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1151 .clkdm_name = "core_l4_clkdm",
1152};
1153
1154DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1155
1156static struct clk mcspi1_ick;
1157
1158static struct clk_hw_omap mcspi1_ick_hw = {
1159 .hw = {
1160 .clk = &mcspi1_ick,
1161 },
1162 .ops = &clkhwops_iclk_wait,
1163 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1164 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1165 .clkdm_name = "core_l4_clkdm",
1166};
1167
1168DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1169
1170static struct clk mcspi2_fck;
1171
1172static struct clk_hw_omap mcspi2_fck_hw = {
1173 .hw = {
1174 .clk = &mcspi2_fck,
1175 },
1176 .ops = &clkhwops_wait,
1177 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1178 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1179 .clkdm_name = "core_l4_clkdm",
1180};
1181
1182DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1183
1184static struct clk mcspi2_ick;
1185
1186static struct clk_hw_omap mcspi2_ick_hw = {
1187 .hw = {
1188 .clk = &mcspi2_ick,
1189 },
1190 .ops = &clkhwops_iclk_wait,
1191 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1192 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1193 .clkdm_name = "core_l4_clkdm",
1194};
1195
1196DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1197
1198static struct clk mmc_fck;
1199
1200static struct clk_hw_omap mmc_fck_hw = {
1201 .hw = {
1202 .clk = &mmc_fck,
1203 },
1204 .ops = &clkhwops_wait,
1205 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1206 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1207 .clkdm_name = "core_l4_clkdm",
1208};
1209
1210DEFINE_STRUCT_CLK(mmc_fck, cam_fck_parent_names, aes_ick_ops);
1211
1212static struct clk mmc_ick;
1213
1214static struct clk_hw_omap mmc_ick_hw = {
1215 .hw = {
1216 .clk = &mmc_ick,
1217 },
1218 .ops = &clkhwops_iclk_wait,
1219 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1220 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1221 .clkdm_name = "core_l4_clkdm",
1222};
1223
1224DEFINE_STRUCT_CLK(mmc_ick, aes_ick_parent_names, aes_ick_ops);
1225
1226DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1227 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1228 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1229 CLK_DIVIDER_ONE_BASED, NULL);
1230
1231static struct clk mpu_wdt_fck;
1232
1233static struct clk_hw_omap mpu_wdt_fck_hw = {
1234 .hw = {
1235 .clk = &mpu_wdt_fck,
1236 },
1237 .ops = &clkhwops_wait,
1238 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1239 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1240 .clkdm_name = "wkup_clkdm",
1241};
1242
1243DEFINE_STRUCT_CLK(mpu_wdt_fck, gpios_fck_parent_names, aes_ick_ops);
1244
1245static struct clk mpu_wdt_ick;
1246
1247static struct clk_hw_omap mpu_wdt_ick_hw = {
1248 .hw = {
1249 .clk = &mpu_wdt_ick,
1250 },
1251 .ops = &clkhwops_iclk_wait,
1252 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1253 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1254 .clkdm_name = "wkup_clkdm",
1255};
1256
1257DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1258
1259static struct clk mspro_fck;
1260
1261static struct clk_hw_omap mspro_fck_hw = {
1262 .hw = {
1263 .clk = &mspro_fck,
1264 },
1265 .ops = &clkhwops_wait,
1266 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1267 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1268 .clkdm_name = "core_l4_clkdm",
1269};
1270
1271DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1272
1273static struct clk mspro_ick;
1274
1275static struct clk_hw_omap mspro_ick_hw = {
1276 .hw = {
1277 .clk = &mspro_ick,
1278 },
1279 .ops = &clkhwops_iclk_wait,
1280 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1281 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1282 .clkdm_name = "core_l4_clkdm",
1283};
1284
1285DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1286
1287static struct clk omapctrl_ick;
1288
1289static struct clk_hw_omap omapctrl_ick_hw = {
1290 .hw = {
1291 .clk = &omapctrl_ick,
1292 },
1293 .ops = &clkhwops_iclk_wait,
1294 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1295 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1296 .flags = ENABLE_ON_INIT,
1297 .clkdm_name = "wkup_clkdm",
1298};
1299
1300DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1301
1302static struct clk pka_ick;
1303
1304static struct clk_hw_omap pka_ick_hw = {
1305 .hw = {
1306 .clk = &pka_ick,
1307 },
1308 .ops = &clkhwops_iclk_wait,
1309 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1310 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1311 .clkdm_name = "core_l4_clkdm",
1312};
1313
1314DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1315
1316static struct clk rng_ick;
1317
1318static struct clk_hw_omap rng_ick_hw = {
1319 .hw = {
1320 .clk = &rng_ick,
1321 },
1322 .ops = &clkhwops_iclk_wait,
1323 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1324 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1325 .clkdm_name = "core_l4_clkdm",
1326};
1327
1328DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1329
1330static struct clk sdma_fck;
1331
1332DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1333DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1334
1335static struct clk sdma_ick;
1336
1337static struct clk_hw_omap sdma_ick_hw = {
1338 .hw = {
1339 .clk = &sdma_ick,
1340 },
1341 .ops = &clkhwops_iclk,
1342 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1343 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1344 .clkdm_name = "core_l3_clkdm",
1345};
1346
1347DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1348
1349static struct clk sdrc_ick;
1350
1351static struct clk_hw_omap sdrc_ick_hw = {
1352 .hw = {
1353 .clk = &sdrc_ick,
1354 },
1355 .ops = &clkhwops_iclk,
1356 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1357 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1358 .flags = ENABLE_ON_INIT,
1359 .clkdm_name = "core_l3_clkdm",
1360};
1361
1362DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1363
1364static struct clk sha_ick;
1365
1366static struct clk_hw_omap sha_ick_hw = {
1367 .hw = {
1368 .clk = &sha_ick,
1369 },
1370 .ops = &clkhwops_iclk_wait,
1371 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1372 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1373 .clkdm_name = "core_l4_clkdm",
1374};
1375
1376DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1377
1378static struct clk ssi_l4_ick;
1379
1380static struct clk_hw_omap ssi_l4_ick_hw = {
1381 .hw = {
1382 .clk = &ssi_l4_ick,
1383 },
1384 .ops = &clkhwops_iclk_wait,
1385 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1386 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1387 .clkdm_name = "core_l4_clkdm",
1388};
1389
1390DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1391
1392static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1393 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1394 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1395 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1396 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1397 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1398 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1399 { .div = 0 }
1400};
1401
1402static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1403 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1404 { .parent = NULL },
1405};
1406
1407static const char *ssi_ssr_sst_fck_parent_names[] = {
1408 "core_ck",
1409};
1410
1411DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1412 ssi_ssr_sst_fck_clksel,
1413 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1414 OMAP24XX_CLKSEL_SSI_MASK,
1415 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1416 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1417 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1418
1419static struct clk sync_32k_ick;
1420
1421static struct clk_hw_omap sync_32k_ick_hw = {
1422 .hw = {
1423 .clk = &sync_32k_ick,
1424 },
1425 .ops = &clkhwops_iclk_wait,
1426 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1427 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1428 .flags = ENABLE_ON_INIT,
1429 .clkdm_name = "wkup_clkdm",
1430};
1431
1432DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1433
1434static const struct clksel_rate common_clkout_src_core_rates[] = {
1435 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1436 { .div = 0 }
1437};
1438
1439static const struct clksel_rate common_clkout_src_sys_rates[] = {
1440 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1441 { .div = 0 }
1442};
1443
1444static const struct clksel_rate common_clkout_src_96m_rates[] = {
1445 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1446 { .div = 0 }
1447};
1448
1449static const struct clksel_rate common_clkout_src_54m_rates[] = {
1450 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1451 { .div = 0 }
1452};
1453
1454static const struct clksel common_clkout_src_clksel[] = {
1455 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1456 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1457 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1458 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1459 { .parent = NULL },
1460};
1461
1462static const char *sys_clkout_src_parent_names[] = {
1463 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1464};
1465
1466DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1467 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1468 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1469 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1470
1471DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1472 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1473 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1474
1475DEFINE_CLK_OMAP_MUX_GATE(sys_clkout2_src, "wkup_clkdm",
1476 common_clkout_src_clksel, OMAP2420_PRCM_CLKOUT_CTRL,
1477 OMAP2420_CLKOUT2_SOURCE_MASK,
1478 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_EN_SHIFT,
1479 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1480
1481DEFINE_CLK_DIVIDER(sys_clkout2, "sys_clkout2_src", &sys_clkout2_src, 0x0,
1482 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_DIV_SHIFT,
1483 OMAP2420_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1484
1485static struct clk uart1_fck;
1486
1487static struct clk_hw_omap uart1_fck_hw = {
1488 .hw = {
1489 .clk = &uart1_fck,
1490 },
1491 .ops = &clkhwops_wait,
1492 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1493 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1494 .clkdm_name = "core_l4_clkdm",
1495};
1496
1497DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1498
1499static struct clk uart1_ick;
1500
1501static struct clk_hw_omap uart1_ick_hw = {
1502 .hw = {
1503 .clk = &uart1_ick,
1504 },
1505 .ops = &clkhwops_iclk_wait,
1506 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1507 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1508 .clkdm_name = "core_l4_clkdm",
1509};
1510
1511DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1512
1513static struct clk uart2_fck;
1514
1515static struct clk_hw_omap uart2_fck_hw = {
1516 .hw = {
1517 .clk = &uart2_fck,
1518 },
1519 .ops = &clkhwops_wait,
1520 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1521 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1522 .clkdm_name = "core_l4_clkdm",
1523};
1524
1525DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1526
1527static struct clk uart2_ick;
1528
1529static struct clk_hw_omap uart2_ick_hw = {
1530 .hw = {
1531 .clk = &uart2_ick,
1532 },
1533 .ops = &clkhwops_iclk_wait,
1534 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1535 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1536 .clkdm_name = "core_l4_clkdm",
1537};
1538
1539DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1540
1541static struct clk uart3_fck;
1542
1543static struct clk_hw_omap uart3_fck_hw = {
1544 .hw = {
1545 .clk = &uart3_fck,
1546 },
1547 .ops = &clkhwops_wait,
1548 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1549 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1550 .clkdm_name = "core_l4_clkdm",
1551};
1552
1553DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1554
1555static struct clk uart3_ick;
1556
1557static struct clk_hw_omap uart3_ick_hw = {
1558 .hw = {
1559 .clk = &uart3_ick,
1560 },
1561 .ops = &clkhwops_iclk_wait,
1562 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1563 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1564 .clkdm_name = "core_l4_clkdm",
1565};
1566
1567DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1568
1569static struct clk usb_fck;
1570
1571static struct clk_hw_omap usb_fck_hw = {
1572 .hw = {
1573 .clk = &usb_fck,
1574 },
1575 .ops = &clkhwops_wait,
1576 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1577 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1578 .clkdm_name = "core_l3_clkdm",
1579};
1580
1581DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1582
1583static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1584 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1585 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1586 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1587 { .div = 0 }
1588};
1589
1590static const struct clksel usb_l4_ick_clksel[] = {
1591 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1592 { .parent = NULL },
1593};
1594
1595static const char *usb_l4_ick_parent_names[] = {
1596 "core_l3_ck",
1597};
1598
1599DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1600 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1601 OMAP24XX_CLKSEL_USB_MASK,
1602 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1603 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1604 usb_l4_ick_parent_names, dsp_fck_ops);
1605
1606static struct clk virt_prcm_set;
1607
1608static const char *virt_prcm_set_parent_names[] = {
1609 "mpu_ck",
1610};
1611
1612static const struct clk_ops virt_prcm_set_ops = {
1613 .recalc_rate = &omap2_table_mpu_recalc,
1614 .set_rate = &omap2_select_table_rate,
1615 .round_rate = &omap2_round_to_table_rate,
1616};
1617
1618DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1619DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1620
1621static const struct clksel_rate vlynq_fck_96m_rates[] = {
1622 { .div = 1, .val = 0, .flags = RATE_IN_242X },
1623 { .div = 0 }
1624};
1625
1626static const struct clksel_rate vlynq_fck_core_rates[] = {
1627 { .div = 1, .val = 1, .flags = RATE_IN_242X },
1628 { .div = 2, .val = 2, .flags = RATE_IN_242X },
1629 { .div = 3, .val = 3, .flags = RATE_IN_242X },
1630 { .div = 4, .val = 4, .flags = RATE_IN_242X },
1631 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1632 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1633 { .div = 9, .val = 9, .flags = RATE_IN_242X },
1634 { .div = 12, .val = 12, .flags = RATE_IN_242X },
1635 { .div = 16, .val = 16, .flags = RATE_IN_242X },
1636 { .div = 18, .val = 18, .flags = RATE_IN_242X },
1637 { .div = 0 }
1638};
1639
1640static const struct clksel vlynq_fck_clksel[] = {
1641 { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
1642 { .parent = &core_ck, .rates = vlynq_fck_core_rates },
1643 { .parent = NULL },
1644};
1645
1646static const char *vlynq_fck_parent_names[] = {
1647 "func_96m_ck", "core_ck",
1648};
1649
1650DEFINE_CLK_OMAP_MUX_GATE(vlynq_fck, "core_l3_clkdm", vlynq_fck_clksel,
1651 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1652 OMAP2420_CLKSEL_VLYNQ_MASK,
1653 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1654 OMAP2420_EN_VLYNQ_SHIFT, &clkhwops_wait,
1655 vlynq_fck_parent_names, dss1_fck_ops);
1656
1657static struct clk vlynq_ick;
1658
1659static struct clk_hw_omap vlynq_ick_hw = {
1660 .hw = {
1661 .clk = &vlynq_ick,
1662 },
1663 .ops = &clkhwops_iclk_wait,
1664 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1665 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1666 .clkdm_name = "core_l3_clkdm",
1667};
1668
1669DEFINE_STRUCT_CLK(vlynq_ick, gfx_ick_parent_names, aes_ick_ops);
1670
1671static struct clk wdt1_ick;
1672
1673static struct clk_hw_omap wdt1_ick_hw = {
1674 .hw = {
1675 .clk = &wdt1_ick,
1676 },
1677 .ops = &clkhwops_iclk_wait,
1678 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1679 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1680 .clkdm_name = "wkup_clkdm",
1681};
1682
1683DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1684
1685static struct clk wdt1_osc_ck;
1686
1687static const struct clk_ops wdt1_osc_ck_ops = {};
1688
1689DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
1690DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
1691
1692static struct clk wdt3_fck;
1693
1694static struct clk_hw_omap wdt3_fck_hw = {
1695 .hw = {
1696 .clk = &wdt3_fck,
1697 },
1698 .ops = &clkhwops_wait,
1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1700 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1701 .clkdm_name = "core_l4_clkdm",
1702};
1703
1704DEFINE_STRUCT_CLK(wdt3_fck, gpios_fck_parent_names, aes_ick_ops);
1705
1706static struct clk wdt3_ick;
1707
1708static struct clk_hw_omap wdt3_ick_hw = {
1709 .hw = {
1710 .clk = &wdt3_ick,
1711 },
1712 .ops = &clkhwops_iclk_wait,
1713 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1714 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1715 .clkdm_name = "core_l4_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(wdt3_ick, aes_ick_parent_names, aes_ick_ops);
1719
1720static struct clk wdt4_fck;
1721
1722static struct clk_hw_omap wdt4_fck_hw = {
1723 .hw = {
1724 .clk = &wdt4_fck,
1725 },
1726 .ops = &clkhwops_wait,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1728 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1729 .clkdm_name = "core_l4_clkdm",
1730};
1731
1732DEFINE_STRUCT_CLK(wdt4_fck, gpios_fck_parent_names, aes_ick_ops);
1733
1734static struct clk wdt4_ick;
1735
1736static struct clk_hw_omap wdt4_ick_hw = {
1737 .hw = {
1738 .clk = &wdt4_ick,
1739 },
1740 .ops = &clkhwops_iclk_wait,
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1742 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1743 .clkdm_name = "core_l4_clkdm",
1744};
1745
1746DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1747
1748/*
1749 * clkdev integration
1750 */
1751
1752static struct omap_clk omap2420_clks[] = {
1753 /* external root sources */
1754 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_242X),
1755 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_242X),
1756 CLK(NULL, "osc_ck", &osc_ck, CK_242X),
1757 CLK(NULL, "sys_ck", &sys_ck, CK_242X),
1758 CLK(NULL, "alt_ck", &alt_ck, CK_242X),
1759 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
1760 /* internal analog sources */
1761 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
1762 CLK(NULL, "apll96_ck", &apll96_ck, CK_242X),
1763 CLK(NULL, "apll54_ck", &apll54_ck, CK_242X),
1764 /* internal prcm root sources */
1765 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
1766 CLK(NULL, "core_ck", &core_ck, CK_242X),
1767 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
1768 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
1769 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
1770 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_242X),
1771 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_242X),
1772 CLK(NULL, "sys_clkout", &sys_clkout, CK_242X),
1773 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
1774 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
1775 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
1776 /* mpu domain clocks */
1777 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X),
1778 /* dsp domain clocks */
1779 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X),
1780 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
1781 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
1782 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
1783 /* GFX domain clocks */
1784 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_242X),
1785 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_242X),
1786 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1787 /* DSS domain clocks */
1788 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1789 CLK(NULL, "dss_ick", &dss_ick, CK_242X),
1790 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1791 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1792 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
1793 /* L3 domain clocks */
1794 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X),
1795 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X),
1796 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_242X),
1797 /* L4 domain clocks */
1798 CLK(NULL, "l4_ck", &l4_ck, CK_242X),
1799 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X),
1800 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_242X),
1801 /* virtual meta-group clock */
1802 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X),
1803 /* general l4 interface ck, multi-parent functional clk */
1804 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_242X),
1805 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_242X),
1806 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_242X),
1807 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_242X),
1808 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_242X),
1809 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_242X),
1810 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_242X),
1811 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_242X),
1812 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_242X),
1813 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_242X),
1814 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_242X),
1815 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_242X),
1816 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_242X),
1817 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_242X),
1818 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_242X),
1819 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_242X),
1820 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_242X),
1821 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_242X),
1822 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_242X),
1823 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_242X),
1824 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_242X),
1825 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_242X),
1826 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1827 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1828 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1829 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X),
1830 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1831 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1832 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X),
1833 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1834 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1835 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X),
1836 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1837 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1838 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X),
1839 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1840 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1841 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
1842 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X),
1843 CLK(NULL, "uart2_fck", &uart2_fck, CK_242X),
1844 CLK(NULL, "uart3_ick", &uart3_ick, CK_242X),
1845 CLK(NULL, "uart3_fck", &uart3_fck, CK_242X),
1846 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1847 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1848 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1849 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X),
1850 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1851 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1852 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1853 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
1854 CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
1855 CLK(NULL, "cam_fck", &cam_fck, CK_242X),
1856 CLK("omap24xxcam", "ick", &cam_ick, CK_242X),
1857 CLK(NULL, "cam_ick", &cam_ick, CK_242X),
1858 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X),
1859 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X),
1860 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X),
1861 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
1862 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
1863 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X),
1864 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X),
1865 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
1866 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X),
1867 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
1868 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X),
1869 CLK(NULL, "fac_ick", &fac_ick, CK_242X),
1870 CLK(NULL, "fac_fck", &fac_fck, CK_242X),
1871 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1872 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1873 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1874 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X),
1875 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1876 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X),
1877 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1878 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X),
1879 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1880 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1881 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X),
1882 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1883 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1884 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1885 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
1886 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X),
1887 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
1888 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1889 CLK(NULL, "des_ick", &des_ick, CK_242X),
1890 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1891 CLK(NULL, "sha_ick", &sha_ick, CK_242X),
1892 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1893 CLK(NULL, "rng_ick", &rng_ick, CK_242X),
1894 CLK("omap-aes", "ick", &aes_ick, CK_242X),
1895 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1896 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1897 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1898 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1899 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X),
1900 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X),
1901 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X),
1902 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
1903};
1904
1905
1906static const char *enable_init_clks[] = {
1907 "apll96_ck",
1908 "apll54_ck",
1909 "sync_32k_ick",
1910 "omapctrl_ick",
1911 "gpmc_fck",
1912 "sdrc_ick",
1913};
1914
1915/*
1916 * init code
1917 */
1918
1919int __init omap2420_clk_init(void)
1920{
1921 struct omap_clk *c;
1922
1923 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1924 cpu_mask = RATE_IN_242X;
1925 rate_table = omap2420_rate_table;
1926
1927 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
1928
1929 omap2xxx_clkt_vps_check_bootloader_rates();
1930
1931 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1932 c++) {
1933 clkdev_add(&c->lk);
1934 if (!__clk_init(NULL, c->lk.clk))
1935 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1936 }
1937
1938 omap2_clk_disable_autoidle_all();
1939
1940 omap2_clk_enable_init_clocks(enable_init_clks,
1941 ARRAY_SIZE(enable_init_clks));
1942
1943 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
1944 (clk_get_rate(&sys_ck) / 1000000),
1945 (clk_get_rate(&sys_ck) / 100000) % 10,
1946 (clk_get_rate(&dpll_ck) / 1000000),
1947 (clk_get_rate(&mpu_ck) / 1000000));
1948
1949 return 0;
1950}
diff --git a/arch/arm/mach-omap2/cclock2430_data.c b/arch/arm/mach-omap2/cclock2430_data.c
new file mode 100644
index 00000000000..eda079b96c6
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock2430_data.c
@@ -0,0 +1,2065 @@
1/*
2 * OMAP2430 clock data
3 *
4 * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/clk.h>
18#include <linux/clk-private.h>
19#include <linux/list.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "clock.h"
24#include "clock2xxx.h"
25#include "opp2xxx.h"
26#include "cm2xxx.h"
27#include "prm2xxx.h"
28#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h"
30#include "sdrc.h"
31#include "control.h"
32
33#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
34
35/*
36 * 2430 clock tree.
37 *
38 * NOTE:In many cases here we are assigning a 'default' parent. In
39 * many cases the parent is selectable. The set parent calls will
40 * also switch sources.
41 *
42 * Several sources are given initial rates which may be wrong, this will
43 * be fixed up in the init func.
44 *
45 * Things are broadly separated below by clock domains. It is
46 * noteworthy that most peripherals have dependencies on multiple clock
47 * domains. Many get their interface clocks from the L4 domain, but get
48 * functional clocks from fixed sources or other core domain derived
49 * clocks.
50 */
51
52DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
53
54DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
55
56DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
57
58static struct clk osc_ck;
59
60static const struct clk_ops osc_ck_ops = {
61 .enable = &omap2_enable_osc_ck,
62 .disable = omap2_disable_osc_ck,
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static const char *func_96m_ck_parent_names[] = {
226 "apll96_ck", "alt_ck",
227};
228
229DEFINE_CLK_MUX(func_96m_ck, func_96m_ck_parent_names, NULL, 0x0,
230 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP2430_96M_SOURCE_SHIFT,
231 OMAP2430_96M_SOURCE_WIDTH, 0x0, NULL);
232
233static struct clk cam_fck;
234
235static const char *cam_fck_parent_names[] = {
236 "func_96m_ck",
237};
238
239static struct clk_hw_omap cam_fck_hw = {
240 .hw = {
241 .clk = &cam_fck,
242 },
243 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
244 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
245 .clkdm_name = "core_l3_clkdm",
246};
247
248DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
249
250static struct clk cam_ick;
251
252static struct clk_hw_omap cam_ick_hw = {
253 .hw = {
254 .clk = &cam_ick,
255 },
256 .ops = &clkhwops_iclk,
257 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
258 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
259 .clkdm_name = "core_l4_clkdm",
260};
261
262DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
263
264static struct clk des_ick;
265
266static struct clk_hw_omap des_ick_hw = {
267 .hw = {
268 .clk = &des_ick,
269 },
270 .ops = &clkhwops_iclk_wait,
271 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
272 .enable_bit = OMAP24XX_EN_DES_SHIFT,
273 .clkdm_name = "core_l4_clkdm",
274};
275
276DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
277
278static const struct clksel_rate dsp_fck_core_rates[] = {
279 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
280 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
281 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
282 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
283 { .div = 0 }
284};
285
286static const struct clksel dsp_fck_clksel[] = {
287 { .parent = &core_ck, .rates = dsp_fck_core_rates },
288 { .parent = NULL },
289};
290
291static const char *dsp_fck_parent_names[] = {
292 "core_ck",
293};
294
295static struct clk dsp_fck;
296
297static const struct clk_ops dsp_fck_ops = {
298 .init = &omap2_init_clk_clkdm,
299 .enable = &omap2_dflt_clk_enable,
300 .disable = &omap2_dflt_clk_disable,
301 .is_enabled = &omap2_dflt_clk_is_enabled,
302 .recalc_rate = &omap2_clksel_recalc,
303 .set_rate = &omap2_clksel_set_rate,
304 .round_rate = &omap2_clksel_round_rate,
305};
306
307DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
308 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
309 OMAP24XX_CLKSEL_DSP_MASK,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
311 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
312 dsp_fck_parent_names, dsp_fck_ops);
313
314static const struct clksel_rate dss1_fck_sys_rates[] = {
315 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
316 { .div = 0 }
317};
318
319static const struct clksel_rate dss1_fck_core_rates[] = {
320 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
321 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
322 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
323 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
324 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
325 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
326 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
327 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
328 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
329 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
330 { .div = 0 }
331};
332
333static const struct clksel dss1_fck_clksel[] = {
334 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
335 { .parent = &core_ck, .rates = dss1_fck_core_rates },
336 { .parent = NULL },
337};
338
339static const char *dss1_fck_parent_names[] = {
340 "sys_ck", "core_ck",
341};
342
343static const struct clk_ops dss1_fck_ops = {
344 .init = &omap2_init_clk_clkdm,
345 .enable = &omap2_dflt_clk_enable,
346 .disable = &omap2_dflt_clk_disable,
347 .is_enabled = &omap2_dflt_clk_is_enabled,
348 .recalc_rate = &omap2_clksel_recalc,
349 .get_parent = &omap2_clksel_find_parent_index,
350 .set_parent = &omap2_clksel_set_parent,
351};
352
353DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
354 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
355 OMAP24XX_CLKSEL_DSS1_MASK,
356 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
357 OMAP24XX_EN_DSS1_SHIFT, NULL,
358 dss1_fck_parent_names, dss1_fck_ops);
359
360static const struct clksel_rate dss2_fck_sys_rates[] = {
361 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
362 { .div = 0 }
363};
364
365static const struct clksel_rate dss2_fck_48m_rates[] = {
366 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
367 { .div = 0 }
368};
369
370static const struct clksel_rate func_48m_apll96_rates[] = {
371 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
372 { .div = 0 }
373};
374
375static const struct clksel_rate func_48m_alt_rates[] = {
376 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
377 { .div = 0 }
378};
379
380static const struct clksel func_48m_clksel[] = {
381 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
382 { .parent = &alt_ck, .rates = func_48m_alt_rates },
383 { .parent = NULL },
384};
385
386static const char *func_48m_ck_parent_names[] = {
387 "apll96_ck", "alt_ck",
388};
389
390static struct clk func_48m_ck;
391
392static const struct clk_ops func_48m_ck_ops = {
393 .init = &omap2_init_clk_clkdm,
394 .recalc_rate = &omap2_clksel_recalc,
395 .set_rate = &omap2_clksel_set_rate,
396 .round_rate = &omap2_clksel_round_rate,
397 .get_parent = &omap2_clksel_find_parent_index,
398 .set_parent = &omap2_clksel_set_parent,
399};
400
401static struct clk_hw_omap func_48m_ck_hw = {
402 .hw = {
403 .clk = &func_48m_ck,
404 },
405 .clksel = func_48m_clksel,
406 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
407 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
408 .clkdm_name = "wkup_clkdm",
409};
410
411DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
412
413static const struct clksel dss2_fck_clksel[] = {
414 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
415 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
416 { .parent = NULL },
417};
418
419static const char *dss2_fck_parent_names[] = {
420 "sys_ck", "func_48m_ck",
421};
422
423DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
424 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
425 OMAP24XX_CLKSEL_DSS2_MASK,
426 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
427 OMAP24XX_EN_DSS2_SHIFT, NULL,
428 dss2_fck_parent_names, dss1_fck_ops);
429
430static const char *func_54m_ck_parent_names[] = {
431 "apll54_ck", "alt_ck",
432};
433
434DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
435 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
436 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH, 0x0, NULL);
437
438static struct clk dss_54m_fck;
439
440static const char *dss_54m_fck_parent_names[] = {
441 "func_54m_ck",
442};
443
444static struct clk_hw_omap dss_54m_fck_hw = {
445 .hw = {
446 .clk = &dss_54m_fck,
447 },
448 .ops = &clkhwops_wait,
449 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
450 .enable_bit = OMAP24XX_EN_TV_SHIFT,
451 .clkdm_name = "dss_clkdm",
452};
453
454DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
455
456static struct clk dss_ick;
457
458static struct clk_hw_omap dss_ick_hw = {
459 .hw = {
460 .clk = &dss_ick,
461 },
462 .ops = &clkhwops_iclk,
463 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
464 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
465 .clkdm_name = "dss_clkdm",
466};
467
468DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
469
470static struct clk emul_ck;
471
472static struct clk_hw_omap emul_ck_hw = {
473 .hw = {
474 .clk = &emul_ck,
475 },
476 .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
477 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
478 .clkdm_name = "wkup_clkdm",
479};
480
481DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
482
483DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
484
485static struct clk fac_fck;
486
487static const char *fac_fck_parent_names[] = {
488 "func_12m_ck",
489};
490
491static struct clk_hw_omap fac_fck_hw = {
492 .hw = {
493 .clk = &fac_fck,
494 },
495 .ops = &clkhwops_wait,
496 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
497 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
498 .clkdm_name = "core_l4_clkdm",
499};
500
501DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
502
503static struct clk fac_ick;
504
505static struct clk_hw_omap fac_ick_hw = {
506 .hw = {
507 .clk = &fac_ick,
508 },
509 .ops = &clkhwops_iclk_wait,
510 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
511 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
512 .clkdm_name = "core_l4_clkdm",
513};
514
515DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
516
517static const struct clksel gfx_fck_clksel[] = {
518 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
519 { .parent = NULL },
520};
521
522static const char *gfx_2d_fck_parent_names[] = {
523 "core_l3_ck",
524};
525
526DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
527 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
528 OMAP_CLKSEL_GFX_MASK,
529 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
530 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
531 gfx_2d_fck_parent_names, dsp_fck_ops);
532
533DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
534 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
535 OMAP_CLKSEL_GFX_MASK,
536 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
537 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
538 gfx_2d_fck_parent_names, dsp_fck_ops);
539
540static struct clk gfx_ick;
541
542static const char *gfx_ick_parent_names[] = {
543 "core_l3_ck",
544};
545
546static struct clk_hw_omap gfx_ick_hw = {
547 .hw = {
548 .clk = &gfx_ick,
549 },
550 .ops = &clkhwops_wait,
551 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
552 .enable_bit = OMAP_EN_GFX_SHIFT,
553 .clkdm_name = "gfx_clkdm",
554};
555
556DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
557
558static struct clk gpio5_fck;
559
560static const char *gpio5_fck_parent_names[] = {
561 "func_32k_ck",
562};
563
564static struct clk_hw_omap gpio5_fck_hw = {
565 .hw = {
566 .clk = &gpio5_fck,
567 },
568 .ops = &clkhwops_wait,
569 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
570 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
571 .clkdm_name = "core_l4_clkdm",
572};
573
574DEFINE_STRUCT_CLK(gpio5_fck, gpio5_fck_parent_names, aes_ick_ops);
575
576static struct clk gpio5_ick;
577
578static struct clk_hw_omap gpio5_ick_hw = {
579 .hw = {
580 .clk = &gpio5_ick,
581 },
582 .ops = &clkhwops_iclk_wait,
583 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
584 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
585 .clkdm_name = "core_l4_clkdm",
586};
587
588DEFINE_STRUCT_CLK(gpio5_ick, aes_ick_parent_names, aes_ick_ops);
589
590static struct clk gpios_fck;
591
592static struct clk_hw_omap gpios_fck_hw = {
593 .hw = {
594 .clk = &gpios_fck,
595 },
596 .ops = &clkhwops_wait,
597 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
598 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
599 .clkdm_name = "wkup_clkdm",
600};
601
602DEFINE_STRUCT_CLK(gpios_fck, gpio5_fck_parent_names, aes_ick_ops);
603
604static struct clk wu_l4_ick;
605
606DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
607DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
608
609static struct clk gpios_ick;
610
611static const char *gpios_ick_parent_names[] = {
612 "wu_l4_ick",
613};
614
615static struct clk_hw_omap gpios_ick_hw = {
616 .hw = {
617 .clk = &gpios_ick,
618 },
619 .ops = &clkhwops_iclk_wait,
620 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
621 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
622 .clkdm_name = "wkup_clkdm",
623};
624
625DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
626
627static struct clk gpmc_fck;
628
629static struct clk_hw_omap gpmc_fck_hw = {
630 .hw = {
631 .clk = &gpmc_fck,
632 },
633 .ops = &clkhwops_iclk,
634 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
635 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
636 .flags = ENABLE_ON_INIT,
637 .clkdm_name = "core_l3_clkdm",
638};
639
640DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
641
642static const struct clksel_rate gpt_alt_rates[] = {
643 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
644 { .div = 0 }
645};
646
647static const struct clksel omap24xx_gpt_clksel[] = {
648 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
649 { .parent = &sys_ck, .rates = gpt_sys_rates },
650 { .parent = &alt_ck, .rates = gpt_alt_rates },
651 { .parent = NULL },
652};
653
654static const char *gpt10_fck_parent_names[] = {
655 "func_32k_ck", "sys_ck", "alt_ck",
656};
657
658DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
659 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
660 OMAP24XX_CLKSEL_GPT10_MASK,
661 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
662 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
663 gpt10_fck_parent_names, dss1_fck_ops);
664
665static struct clk gpt10_ick;
666
667static struct clk_hw_omap gpt10_ick_hw = {
668 .hw = {
669 .clk = &gpt10_ick,
670 },
671 .ops = &clkhwops_iclk_wait,
672 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
673 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
674 .clkdm_name = "core_l4_clkdm",
675};
676
677DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
678
679DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
680 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
681 OMAP24XX_CLKSEL_GPT11_MASK,
682 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
683 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
684 gpt10_fck_parent_names, dss1_fck_ops);
685
686static struct clk gpt11_ick;
687
688static struct clk_hw_omap gpt11_ick_hw = {
689 .hw = {
690 .clk = &gpt11_ick,
691 },
692 .ops = &clkhwops_iclk_wait,
693 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
694 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
695 .clkdm_name = "core_l4_clkdm",
696};
697
698DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
699
700DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
701 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
702 OMAP24XX_CLKSEL_GPT12_MASK,
703 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
704 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
705 gpt10_fck_parent_names, dss1_fck_ops);
706
707static struct clk gpt12_ick;
708
709static struct clk_hw_omap gpt12_ick_hw = {
710 .hw = {
711 .clk = &gpt12_ick,
712 },
713 .ops = &clkhwops_iclk_wait,
714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
715 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
716 .clkdm_name = "core_l4_clkdm",
717};
718
719DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
720
721static const struct clk_ops gpt1_fck_ops = {
722 .init = &omap2_init_clk_clkdm,
723 .enable = &omap2_dflt_clk_enable,
724 .disable = &omap2_dflt_clk_disable,
725 .is_enabled = &omap2_dflt_clk_is_enabled,
726 .recalc_rate = &omap2_clksel_recalc,
727 .set_rate = &omap2_clksel_set_rate,
728 .round_rate = &omap2_clksel_round_rate,
729 .get_parent = &omap2_clksel_find_parent_index,
730 .set_parent = &omap2_clksel_set_parent,
731};
732
733DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
734 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
735 OMAP24XX_CLKSEL_GPT1_MASK,
736 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
737 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
738 gpt10_fck_parent_names, gpt1_fck_ops);
739
740static struct clk gpt1_ick;
741
742static struct clk_hw_omap gpt1_ick_hw = {
743 .hw = {
744 .clk = &gpt1_ick,
745 },
746 .ops = &clkhwops_iclk_wait,
747 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
748 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
749 .clkdm_name = "wkup_clkdm",
750};
751
752DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
753
754DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
755 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
756 OMAP24XX_CLKSEL_GPT2_MASK,
757 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
758 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
759 gpt10_fck_parent_names, dss1_fck_ops);
760
761static struct clk gpt2_ick;
762
763static struct clk_hw_omap gpt2_ick_hw = {
764 .hw = {
765 .clk = &gpt2_ick,
766 },
767 .ops = &clkhwops_iclk_wait,
768 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
769 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
770 .clkdm_name = "core_l4_clkdm",
771};
772
773DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
774
775DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
776 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
777 OMAP24XX_CLKSEL_GPT3_MASK,
778 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
779 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
780 gpt10_fck_parent_names, dss1_fck_ops);
781
782static struct clk gpt3_ick;
783
784static struct clk_hw_omap gpt3_ick_hw = {
785 .hw = {
786 .clk = &gpt3_ick,
787 },
788 .ops = &clkhwops_iclk_wait,
789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
790 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
791 .clkdm_name = "core_l4_clkdm",
792};
793
794DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
795
796DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
797 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
798 OMAP24XX_CLKSEL_GPT4_MASK,
799 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
800 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
801 gpt10_fck_parent_names, dss1_fck_ops);
802
803static struct clk gpt4_ick;
804
805static struct clk_hw_omap gpt4_ick_hw = {
806 .hw = {
807 .clk = &gpt4_ick,
808 },
809 .ops = &clkhwops_iclk_wait,
810 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
811 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
812 .clkdm_name = "core_l4_clkdm",
813};
814
815DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
816
817DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
818 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
819 OMAP24XX_CLKSEL_GPT5_MASK,
820 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
821 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
822 gpt10_fck_parent_names, dss1_fck_ops);
823
824static struct clk gpt5_ick;
825
826static struct clk_hw_omap gpt5_ick_hw = {
827 .hw = {
828 .clk = &gpt5_ick,
829 },
830 .ops = &clkhwops_iclk_wait,
831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
832 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
833 .clkdm_name = "core_l4_clkdm",
834};
835
836DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
837
838DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
839 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
840 OMAP24XX_CLKSEL_GPT6_MASK,
841 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
842 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
843 gpt10_fck_parent_names, dss1_fck_ops);
844
845static struct clk gpt6_ick;
846
847static struct clk_hw_omap gpt6_ick_hw = {
848 .hw = {
849 .clk = &gpt6_ick,
850 },
851 .ops = &clkhwops_iclk_wait,
852 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
853 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
854 .clkdm_name = "core_l4_clkdm",
855};
856
857DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
858
859DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
860 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
861 OMAP24XX_CLKSEL_GPT7_MASK,
862 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
863 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
864 gpt10_fck_parent_names, dss1_fck_ops);
865
866static struct clk gpt7_ick;
867
868static struct clk_hw_omap gpt7_ick_hw = {
869 .hw = {
870 .clk = &gpt7_ick,
871 },
872 .ops = &clkhwops_iclk_wait,
873 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
874 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
875 .clkdm_name = "core_l4_clkdm",
876};
877
878DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
879
880static struct clk gpt8_fck;
881
882DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
883 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
884 OMAP24XX_CLKSEL_GPT8_MASK,
885 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
886 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
887 gpt10_fck_parent_names, dss1_fck_ops);
888
889static struct clk gpt8_ick;
890
891static struct clk_hw_omap gpt8_ick_hw = {
892 .hw = {
893 .clk = &gpt8_ick,
894 },
895 .ops = &clkhwops_iclk_wait,
896 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
897 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
898 .clkdm_name = "core_l4_clkdm",
899};
900
901DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
902
903DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
904 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
905 OMAP24XX_CLKSEL_GPT9_MASK,
906 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
907 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
908 gpt10_fck_parent_names, dss1_fck_ops);
909
910static struct clk gpt9_ick;
911
912static struct clk_hw_omap gpt9_ick_hw = {
913 .hw = {
914 .clk = &gpt9_ick,
915 },
916 .ops = &clkhwops_iclk_wait,
917 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
918 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
919 .clkdm_name = "core_l4_clkdm",
920};
921
922DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
923
924static struct clk hdq_fck;
925
926static struct clk_hw_omap hdq_fck_hw = {
927 .hw = {
928 .clk = &hdq_fck,
929 },
930 .ops = &clkhwops_wait,
931 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
932 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
933 .clkdm_name = "core_l4_clkdm",
934};
935
936DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
937
938static struct clk hdq_ick;
939
940static struct clk_hw_omap hdq_ick_hw = {
941 .hw = {
942 .clk = &hdq_ick,
943 },
944 .ops = &clkhwops_iclk_wait,
945 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
946 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
947 .clkdm_name = "core_l4_clkdm",
948};
949
950DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
951
952static struct clk i2c1_ick;
953
954static struct clk_hw_omap i2c1_ick_hw = {
955 .hw = {
956 .clk = &i2c1_ick,
957 },
958 .ops = &clkhwops_iclk_wait,
959 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
960 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
961 .clkdm_name = "core_l4_clkdm",
962};
963
964DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
965
966static struct clk i2c2_ick;
967
968static struct clk_hw_omap i2c2_ick_hw = {
969 .hw = {
970 .clk = &i2c2_ick,
971 },
972 .ops = &clkhwops_iclk_wait,
973 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
974 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
975 .clkdm_name = "core_l4_clkdm",
976};
977
978DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
979
980static struct clk i2chs1_fck;
981
982static struct clk_hw_omap i2chs1_fck_hw = {
983 .hw = {
984 .clk = &i2chs1_fck,
985 },
986 .ops = &clkhwops_omap2430_i2chs_wait,
987 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
988 .enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
989 .clkdm_name = "core_l4_clkdm",
990};
991
992DEFINE_STRUCT_CLK(i2chs1_fck, cam_fck_parent_names, aes_ick_ops);
993
994static struct clk i2chs2_fck;
995
996static struct clk_hw_omap i2chs2_fck_hw = {
997 .hw = {
998 .clk = &i2chs2_fck,
999 },
1000 .ops = &clkhwops_omap2430_i2chs_wait,
1001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1002 .enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
1003 .clkdm_name = "core_l4_clkdm",
1004};
1005
1006DEFINE_STRUCT_CLK(i2chs2_fck, cam_fck_parent_names, aes_ick_ops);
1007
1008static struct clk icr_ick;
1009
1010static struct clk_hw_omap icr_ick_hw = {
1011 .hw = {
1012 .clk = &icr_ick,
1013 },
1014 .ops = &clkhwops_iclk_wait,
1015 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1016 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1017 .clkdm_name = "wkup_clkdm",
1018};
1019
1020DEFINE_STRUCT_CLK(icr_ick, gpios_ick_parent_names, aes_ick_ops);
1021
1022static const struct clksel dsp_ick_clksel[] = {
1023 { .parent = &dsp_fck, .rates = dsp_ick_rates },
1024 { .parent = NULL },
1025};
1026
1027static const char *iva2_1_ick_parent_names[] = {
1028 "dsp_fck",
1029};
1030
1031DEFINE_CLK_OMAP_MUX_GATE(iva2_1_ick, "dsp_clkdm", dsp_ick_clksel,
1032 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1033 OMAP24XX_CLKSEL_DSP_IF_MASK,
1034 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1035 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
1036 iva2_1_ick_parent_names, dsp_fck_ops);
1037
1038static struct clk mailboxes_ick;
1039
1040static struct clk_hw_omap mailboxes_ick_hw = {
1041 .hw = {
1042 .clk = &mailboxes_ick,
1043 },
1044 .ops = &clkhwops_iclk_wait,
1045 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1046 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1047 .clkdm_name = "core_l4_clkdm",
1048};
1049
1050DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1051
1052static const struct clksel_rate common_mcbsp_96m_rates[] = {
1053 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1054 { .div = 0 }
1055};
1056
1057static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1058 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1059 { .div = 0 }
1060};
1061
1062static const struct clksel mcbsp_fck_clksel[] = {
1063 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1064 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1065 { .parent = NULL },
1066};
1067
1068static const char *mcbsp1_fck_parent_names[] = {
1069 "func_96m_ck", "mcbsp_clks",
1070};
1071
1072DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1073 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1074 OMAP2_MCBSP1_CLKS_MASK,
1075 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1076 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1077 mcbsp1_fck_parent_names, dss1_fck_ops);
1078
1079static struct clk mcbsp1_ick;
1080
1081static struct clk_hw_omap mcbsp1_ick_hw = {
1082 .hw = {
1083 .clk = &mcbsp1_ick,
1084 },
1085 .ops = &clkhwops_iclk_wait,
1086 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1087 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1088 .clkdm_name = "core_l4_clkdm",
1089};
1090
1091DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1092
1093DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1094 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1095 OMAP2_MCBSP2_CLKS_MASK,
1096 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1097 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1098 mcbsp1_fck_parent_names, dss1_fck_ops);
1099
1100static struct clk mcbsp2_ick;
1101
1102static struct clk_hw_omap mcbsp2_ick_hw = {
1103 .hw = {
1104 .clk = &mcbsp2_ick,
1105 },
1106 .ops = &clkhwops_iclk_wait,
1107 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1108 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1109 .clkdm_name = "core_l4_clkdm",
1110};
1111
1112DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1113
1114DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1115 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1116 OMAP2_MCBSP3_CLKS_MASK,
1117 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1118 OMAP2430_EN_MCBSP3_SHIFT, &clkhwops_wait,
1119 mcbsp1_fck_parent_names, dss1_fck_ops);
1120
1121static struct clk mcbsp3_ick;
1122
1123static struct clk_hw_omap mcbsp3_ick_hw = {
1124 .hw = {
1125 .clk = &mcbsp3_ick,
1126 },
1127 .ops = &clkhwops_iclk_wait,
1128 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1129 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1130 .clkdm_name = "core_l4_clkdm",
1131};
1132
1133DEFINE_STRUCT_CLK(mcbsp3_ick, aes_ick_parent_names, aes_ick_ops);
1134
1135DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1136 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1137 OMAP2_MCBSP4_CLKS_MASK,
1138 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1139 OMAP2430_EN_MCBSP4_SHIFT, &clkhwops_wait,
1140 mcbsp1_fck_parent_names, dss1_fck_ops);
1141
1142static struct clk mcbsp4_ick;
1143
1144static struct clk_hw_omap mcbsp4_ick_hw = {
1145 .hw = {
1146 .clk = &mcbsp4_ick,
1147 },
1148 .ops = &clkhwops_iclk_wait,
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1150 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1151 .clkdm_name = "core_l4_clkdm",
1152};
1153
1154DEFINE_STRUCT_CLK(mcbsp4_ick, aes_ick_parent_names, aes_ick_ops);
1155
1156DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1157 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1158 OMAP2_MCBSP5_CLKS_MASK,
1159 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1160 OMAP2430_EN_MCBSP5_SHIFT, &clkhwops_wait,
1161 mcbsp1_fck_parent_names, dss1_fck_ops);
1162
1163static struct clk mcbsp5_ick;
1164
1165static struct clk_hw_omap mcbsp5_ick_hw = {
1166 .hw = {
1167 .clk = &mcbsp5_ick,
1168 },
1169 .ops = &clkhwops_iclk_wait,
1170 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1171 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1172 .clkdm_name = "core_l4_clkdm",
1173};
1174
1175DEFINE_STRUCT_CLK(mcbsp5_ick, aes_ick_parent_names, aes_ick_ops);
1176
1177static struct clk mcspi1_fck;
1178
1179static const char *mcspi1_fck_parent_names[] = {
1180 "func_48m_ck",
1181};
1182
1183static struct clk_hw_omap mcspi1_fck_hw = {
1184 .hw = {
1185 .clk = &mcspi1_fck,
1186 },
1187 .ops = &clkhwops_wait,
1188 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1189 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1190 .clkdm_name = "core_l4_clkdm",
1191};
1192
1193DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1194
1195static struct clk mcspi1_ick;
1196
1197static struct clk_hw_omap mcspi1_ick_hw = {
1198 .hw = {
1199 .clk = &mcspi1_ick,
1200 },
1201 .ops = &clkhwops_iclk_wait,
1202 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1203 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1204 .clkdm_name = "core_l4_clkdm",
1205};
1206
1207DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1208
1209static struct clk mcspi2_fck;
1210
1211static struct clk_hw_omap mcspi2_fck_hw = {
1212 .hw = {
1213 .clk = &mcspi2_fck,
1214 },
1215 .ops = &clkhwops_wait,
1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1217 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1218 .clkdm_name = "core_l4_clkdm",
1219};
1220
1221DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1222
1223static struct clk mcspi2_ick;
1224
1225static struct clk_hw_omap mcspi2_ick_hw = {
1226 .hw = {
1227 .clk = &mcspi2_ick,
1228 },
1229 .ops = &clkhwops_iclk_wait,
1230 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1231 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1232 .clkdm_name = "core_l4_clkdm",
1233};
1234
1235DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1236
1237static struct clk mcspi3_fck;
1238
1239static struct clk_hw_omap mcspi3_fck_hw = {
1240 .hw = {
1241 .clk = &mcspi3_fck,
1242 },
1243 .ops = &clkhwops_wait,
1244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1245 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1246 .clkdm_name = "core_l4_clkdm",
1247};
1248
1249DEFINE_STRUCT_CLK(mcspi3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1250
1251static struct clk mcspi3_ick;
1252
1253static struct clk_hw_omap mcspi3_ick_hw = {
1254 .hw = {
1255 .clk = &mcspi3_ick,
1256 },
1257 .ops = &clkhwops_iclk_wait,
1258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1259 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1260 .clkdm_name = "core_l4_clkdm",
1261};
1262
1263DEFINE_STRUCT_CLK(mcspi3_ick, aes_ick_parent_names, aes_ick_ops);
1264
1265static const struct clksel_rate mdm_ick_core_rates[] = {
1266 { .div = 1, .val = 1, .flags = RATE_IN_243X },
1267 { .div = 4, .val = 4, .flags = RATE_IN_243X },
1268 { .div = 6, .val = 6, .flags = RATE_IN_243X },
1269 { .div = 9, .val = 9, .flags = RATE_IN_243X },
1270 { .div = 0 }
1271};
1272
1273static const struct clksel mdm_ick_clksel[] = {
1274 { .parent = &core_ck, .rates = mdm_ick_core_rates },
1275 { .parent = NULL },
1276};
1277
1278static const char *mdm_ick_parent_names[] = {
1279 "core_ck",
1280};
1281
1282DEFINE_CLK_OMAP_MUX_GATE(mdm_ick, "mdm_clkdm", mdm_ick_clksel,
1283 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
1284 OMAP2430_CLKSEL_MDM_MASK,
1285 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
1286 OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
1287 &clkhwops_iclk_wait, mdm_ick_parent_names,
1288 dsp_fck_ops);
1289
1290static struct clk mdm_intc_ick;
1291
1292static struct clk_hw_omap mdm_intc_ick_hw = {
1293 .hw = {
1294 .clk = &mdm_intc_ick,
1295 },
1296 .ops = &clkhwops_iclk_wait,
1297 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1298 .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
1299 .clkdm_name = "core_l4_clkdm",
1300};
1301
1302DEFINE_STRUCT_CLK(mdm_intc_ick, aes_ick_parent_names, aes_ick_ops);
1303
1304static struct clk mdm_osc_ck;
1305
1306static struct clk_hw_omap mdm_osc_ck_hw = {
1307 .hw = {
1308 .clk = &mdm_osc_ck,
1309 },
1310 .ops = &clkhwops_iclk_wait,
1311 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
1312 .enable_bit = OMAP2430_EN_OSC_SHIFT,
1313 .clkdm_name = "mdm_clkdm",
1314};
1315
1316DEFINE_STRUCT_CLK(mdm_osc_ck, sys_ck_parent_names, aes_ick_ops);
1317
1318static struct clk mmchs1_fck;
1319
1320static struct clk_hw_omap mmchs1_fck_hw = {
1321 .hw = {
1322 .clk = &mmchs1_fck,
1323 },
1324 .ops = &clkhwops_wait,
1325 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1326 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1327 .clkdm_name = "core_l4_clkdm",
1328};
1329
1330DEFINE_STRUCT_CLK(mmchs1_fck, cam_fck_parent_names, aes_ick_ops);
1331
1332static struct clk mmchs1_ick;
1333
1334static struct clk_hw_omap mmchs1_ick_hw = {
1335 .hw = {
1336 .clk = &mmchs1_ick,
1337 },
1338 .ops = &clkhwops_iclk_wait,
1339 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1340 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1341 .clkdm_name = "core_l4_clkdm",
1342};
1343
1344DEFINE_STRUCT_CLK(mmchs1_ick, aes_ick_parent_names, aes_ick_ops);
1345
1346static struct clk mmchs2_fck;
1347
1348static struct clk_hw_omap mmchs2_fck_hw = {
1349 .hw = {
1350 .clk = &mmchs2_fck,
1351 },
1352 .ops = &clkhwops_wait,
1353 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1354 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1355 .clkdm_name = "core_l4_clkdm",
1356};
1357
1358DEFINE_STRUCT_CLK(mmchs2_fck, cam_fck_parent_names, aes_ick_ops);
1359
1360static struct clk mmchs2_ick;
1361
1362static struct clk_hw_omap mmchs2_ick_hw = {
1363 .hw = {
1364 .clk = &mmchs2_ick,
1365 },
1366 .ops = &clkhwops_iclk_wait,
1367 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1368 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1369 .clkdm_name = "core_l4_clkdm",
1370};
1371
1372DEFINE_STRUCT_CLK(mmchs2_ick, aes_ick_parent_names, aes_ick_ops);
1373
1374static struct clk mmchsdb1_fck;
1375
1376static struct clk_hw_omap mmchsdb1_fck_hw = {
1377 .hw = {
1378 .clk = &mmchsdb1_fck,
1379 },
1380 .ops = &clkhwops_wait,
1381 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1382 .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
1383 .clkdm_name = "core_l4_clkdm",
1384};
1385
1386DEFINE_STRUCT_CLK(mmchsdb1_fck, gpio5_fck_parent_names, aes_ick_ops);
1387
1388static struct clk mmchsdb2_fck;
1389
1390static struct clk_hw_omap mmchsdb2_fck_hw = {
1391 .hw = {
1392 .clk = &mmchsdb2_fck,
1393 },
1394 .ops = &clkhwops_wait,
1395 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1396 .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
1397 .clkdm_name = "core_l4_clkdm",
1398};
1399
1400DEFINE_STRUCT_CLK(mmchsdb2_fck, gpio5_fck_parent_names, aes_ick_ops);
1401
1402DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1403 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1404 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1405 CLK_DIVIDER_ONE_BASED, NULL);
1406
1407static struct clk mpu_wdt_fck;
1408
1409static struct clk_hw_omap mpu_wdt_fck_hw = {
1410 .hw = {
1411 .clk = &mpu_wdt_fck,
1412 },
1413 .ops = &clkhwops_wait,
1414 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1415 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1416 .clkdm_name = "wkup_clkdm",
1417};
1418
1419DEFINE_STRUCT_CLK(mpu_wdt_fck, gpio5_fck_parent_names, aes_ick_ops);
1420
1421static struct clk mpu_wdt_ick;
1422
1423static struct clk_hw_omap mpu_wdt_ick_hw = {
1424 .hw = {
1425 .clk = &mpu_wdt_ick,
1426 },
1427 .ops = &clkhwops_iclk_wait,
1428 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1429 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1430 .clkdm_name = "wkup_clkdm",
1431};
1432
1433DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1434
1435static struct clk mspro_fck;
1436
1437static struct clk_hw_omap mspro_fck_hw = {
1438 .hw = {
1439 .clk = &mspro_fck,
1440 },
1441 .ops = &clkhwops_wait,
1442 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1443 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1444 .clkdm_name = "core_l4_clkdm",
1445};
1446
1447DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1448
1449static struct clk mspro_ick;
1450
1451static struct clk_hw_omap mspro_ick_hw = {
1452 .hw = {
1453 .clk = &mspro_ick,
1454 },
1455 .ops = &clkhwops_iclk_wait,
1456 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1457 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1458 .clkdm_name = "core_l4_clkdm",
1459};
1460
1461DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1462
1463static struct clk omapctrl_ick;
1464
1465static struct clk_hw_omap omapctrl_ick_hw = {
1466 .hw = {
1467 .clk = &omapctrl_ick,
1468 },
1469 .ops = &clkhwops_iclk_wait,
1470 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1471 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1472 .flags = ENABLE_ON_INIT,
1473 .clkdm_name = "wkup_clkdm",
1474};
1475
1476DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1477
1478static struct clk pka_ick;
1479
1480static struct clk_hw_omap pka_ick_hw = {
1481 .hw = {
1482 .clk = &pka_ick,
1483 },
1484 .ops = &clkhwops_iclk_wait,
1485 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1486 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1487 .clkdm_name = "core_l4_clkdm",
1488};
1489
1490DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1491
1492static struct clk rng_ick;
1493
1494static struct clk_hw_omap rng_ick_hw = {
1495 .hw = {
1496 .clk = &rng_ick,
1497 },
1498 .ops = &clkhwops_iclk_wait,
1499 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1500 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1501 .clkdm_name = "core_l4_clkdm",
1502};
1503
1504DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1505
1506static struct clk sdma_fck;
1507
1508DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1509DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1510
1511static struct clk sdma_ick;
1512
1513static struct clk_hw_omap sdma_ick_hw = {
1514 .hw = {
1515 .clk = &sdma_ick,
1516 },
1517 .ops = &clkhwops_iclk,
1518 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1519 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1520 .clkdm_name = "core_l3_clkdm",
1521};
1522
1523DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1524
1525static struct clk sdrc_ick;
1526
1527static struct clk_hw_omap sdrc_ick_hw = {
1528 .hw = {
1529 .clk = &sdrc_ick,
1530 },
1531 .ops = &clkhwops_iclk,
1532 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1533 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1534 .flags = ENABLE_ON_INIT,
1535 .clkdm_name = "core_l3_clkdm",
1536};
1537
1538DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1539
1540static struct clk sha_ick;
1541
1542static struct clk_hw_omap sha_ick_hw = {
1543 .hw = {
1544 .clk = &sha_ick,
1545 },
1546 .ops = &clkhwops_iclk_wait,
1547 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1548 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1549 .clkdm_name = "core_l4_clkdm",
1550};
1551
1552DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1553
1554static struct clk ssi_l4_ick;
1555
1556static struct clk_hw_omap ssi_l4_ick_hw = {
1557 .hw = {
1558 .clk = &ssi_l4_ick,
1559 },
1560 .ops = &clkhwops_iclk_wait,
1561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1562 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1563 .clkdm_name = "core_l4_clkdm",
1564};
1565
1566DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1567
1568static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1569 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1570 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1571 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1572 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1573 { .div = 5, .val = 5, .flags = RATE_IN_243X },
1574 { .div = 0 }
1575};
1576
1577static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1578 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1579 { .parent = NULL },
1580};
1581
1582static const char *ssi_ssr_sst_fck_parent_names[] = {
1583 "core_ck",
1584};
1585
1586DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1587 ssi_ssr_sst_fck_clksel,
1588 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1589 OMAP24XX_CLKSEL_SSI_MASK,
1590 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1591 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1592 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1593
1594static struct clk sync_32k_ick;
1595
1596static struct clk_hw_omap sync_32k_ick_hw = {
1597 .hw = {
1598 .clk = &sync_32k_ick,
1599 },
1600 .ops = &clkhwops_iclk_wait,
1601 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1602 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1603 .flags = ENABLE_ON_INIT,
1604 .clkdm_name = "wkup_clkdm",
1605};
1606
1607DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1608
1609static const struct clksel_rate common_clkout_src_core_rates[] = {
1610 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1611 { .div = 0 }
1612};
1613
1614static const struct clksel_rate common_clkout_src_sys_rates[] = {
1615 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1616 { .div = 0 }
1617};
1618
1619static const struct clksel_rate common_clkout_src_96m_rates[] = {
1620 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1621 { .div = 0 }
1622};
1623
1624static const struct clksel_rate common_clkout_src_54m_rates[] = {
1625 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1626 { .div = 0 }
1627};
1628
1629static const struct clksel common_clkout_src_clksel[] = {
1630 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1631 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1632 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1633 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1634 { .parent = NULL },
1635};
1636
1637static const char *sys_clkout_src_parent_names[] = {
1638 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1639};
1640
1641DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1642 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1643 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1644 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1645
1646DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1647 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1648 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1649
1650static struct clk uart1_fck;
1651
1652static struct clk_hw_omap uart1_fck_hw = {
1653 .hw = {
1654 .clk = &uart1_fck,
1655 },
1656 .ops = &clkhwops_wait,
1657 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1658 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1659 .clkdm_name = "core_l4_clkdm",
1660};
1661
1662DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1663
1664static struct clk uart1_ick;
1665
1666static struct clk_hw_omap uart1_ick_hw = {
1667 .hw = {
1668 .clk = &uart1_ick,
1669 },
1670 .ops = &clkhwops_iclk_wait,
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1672 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1673 .clkdm_name = "core_l4_clkdm",
1674};
1675
1676DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1677
1678static struct clk uart2_fck;
1679
1680static struct clk_hw_omap uart2_fck_hw = {
1681 .hw = {
1682 .clk = &uart2_fck,
1683 },
1684 .ops = &clkhwops_wait,
1685 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1686 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1687 .clkdm_name = "core_l4_clkdm",
1688};
1689
1690DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1691
1692static struct clk uart2_ick;
1693
1694static struct clk_hw_omap uart2_ick_hw = {
1695 .hw = {
1696 .clk = &uart2_ick,
1697 },
1698 .ops = &clkhwops_iclk_wait,
1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1700 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1701 .clkdm_name = "core_l4_clkdm",
1702};
1703
1704DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1705
1706static struct clk uart3_fck;
1707
1708static struct clk_hw_omap uart3_fck_hw = {
1709 .hw = {
1710 .clk = &uart3_fck,
1711 },
1712 .ops = &clkhwops_wait,
1713 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1714 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1715 .clkdm_name = "core_l4_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1719
1720static struct clk uart3_ick;
1721
1722static struct clk_hw_omap uart3_ick_hw = {
1723 .hw = {
1724 .clk = &uart3_ick,
1725 },
1726 .ops = &clkhwops_iclk_wait,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1728 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1729 .clkdm_name = "core_l4_clkdm",
1730};
1731
1732DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1733
1734static struct clk usb_fck;
1735
1736static struct clk_hw_omap usb_fck_hw = {
1737 .hw = {
1738 .clk = &usb_fck,
1739 },
1740 .ops = &clkhwops_wait,
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1742 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1743 .clkdm_name = "core_l3_clkdm",
1744};
1745
1746DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1747
1748static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1749 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1750 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1751 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1752 { .div = 0 }
1753};
1754
1755static const struct clksel usb_l4_ick_clksel[] = {
1756 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1757 { .parent = NULL },
1758};
1759
1760static const char *usb_l4_ick_parent_names[] = {
1761 "core_l3_ck",
1762};
1763
1764DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1765 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1766 OMAP24XX_CLKSEL_USB_MASK,
1767 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1768 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1769 usb_l4_ick_parent_names, dsp_fck_ops);
1770
1771static struct clk usbhs_ick;
1772
1773static struct clk_hw_omap usbhs_ick_hw = {
1774 .hw = {
1775 .clk = &usbhs_ick,
1776 },
1777 .ops = &clkhwops_iclk_wait,
1778 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1779 .enable_bit = OMAP2430_EN_USBHS_SHIFT,
1780 .clkdm_name = "core_l3_clkdm",
1781};
1782
1783DEFINE_STRUCT_CLK(usbhs_ick, gfx_ick_parent_names, aes_ick_ops);
1784
1785static struct clk virt_prcm_set;
1786
1787static const char *virt_prcm_set_parent_names[] = {
1788 "mpu_ck",
1789};
1790
1791static const struct clk_ops virt_prcm_set_ops = {
1792 .recalc_rate = &omap2_table_mpu_recalc,
1793 .set_rate = &omap2_select_table_rate,
1794 .round_rate = &omap2_round_to_table_rate,
1795};
1796
1797DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1798DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1799
1800static struct clk wdt1_ick;
1801
1802static struct clk_hw_omap wdt1_ick_hw = {
1803 .hw = {
1804 .clk = &wdt1_ick,
1805 },
1806 .ops = &clkhwops_iclk_wait,
1807 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1808 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1809 .clkdm_name = "wkup_clkdm",
1810};
1811
1812DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1813
1814static struct clk wdt1_osc_ck;
1815
1816static const struct clk_ops wdt1_osc_ck_ops = {};
1817
1818DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
1819DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
1820
1821static struct clk wdt4_fck;
1822
1823static struct clk_hw_omap wdt4_fck_hw = {
1824 .hw = {
1825 .clk = &wdt4_fck,
1826 },
1827 .ops = &clkhwops_wait,
1828 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1829 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1830 .clkdm_name = "core_l4_clkdm",
1831};
1832
1833DEFINE_STRUCT_CLK(wdt4_fck, gpio5_fck_parent_names, aes_ick_ops);
1834
1835static struct clk wdt4_ick;
1836
1837static struct clk_hw_omap wdt4_ick_hw = {
1838 .hw = {
1839 .clk = &wdt4_ick,
1840 },
1841 .ops = &clkhwops_iclk_wait,
1842 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1843 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1844 .clkdm_name = "core_l4_clkdm",
1845};
1846
1847DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1848
1849/*
1850 * clkdev integration
1851 */
1852
1853static struct omap_clk omap2430_clks[] = {
1854 /* external root sources */
1855 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X),
1856 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X),
1857 CLK(NULL, "osc_ck", &osc_ck, CK_243X),
1858 CLK("twl", "fck", &osc_ck, CK_243X),
1859 CLK(NULL, "sys_ck", &sys_ck, CK_243X),
1860 CLK(NULL, "alt_ck", &alt_ck, CK_243X),
1861 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
1862 /* internal analog sources */
1863 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
1864 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X),
1865 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X),
1866 /* internal prcm root sources */
1867 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
1868 CLK(NULL, "core_ck", &core_ck, CK_243X),
1869 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
1870 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
1871 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
1872 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X),
1873 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X),
1874 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X),
1875 CLK(NULL, "emul_ck", &emul_ck, CK_243X),
1876 /* mpu domain clocks */
1877 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X),
1878 /* dsp domain clocks */
1879 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X),
1880 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
1881 /* GFX domain clocks */
1882 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X),
1883 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X),
1884 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X),
1885 /* Modem domain clocks */
1886 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
1887 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1888 /* DSS domain clocks */
1889 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1890 CLK(NULL, "dss_ick", &dss_ick, CK_243X),
1891 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1892 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1893 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
1894 /* L3 domain clocks */
1895 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X),
1896 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X),
1897 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X),
1898 /* L4 domain clocks */
1899 CLK(NULL, "l4_ck", &l4_ck, CK_243X),
1900 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X),
1901 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_243X),
1902 /* virtual meta-group clock */
1903 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X),
1904 /* general l4 interface ck, multi-parent functional clk */
1905 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X),
1906 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X),
1907 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X),
1908 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X),
1909 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X),
1910 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X),
1911 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X),
1912 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X),
1913 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X),
1914 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X),
1915 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X),
1916 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X),
1917 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X),
1918 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X),
1919 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X),
1920 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X),
1921 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X),
1922 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X),
1923 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X),
1924 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X),
1925 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X),
1926 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X),
1927 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1928 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1929 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1930 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X),
1931 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1932 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1933 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X),
1934 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1935 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1936 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X),
1937 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1938 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1939 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X),
1940 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1941 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1942 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X),
1943 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1944 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1945 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X),
1946 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1947 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1948 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X),
1949 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1950 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1951 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X),
1952 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1953 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1954 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
1955 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X),
1956 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X),
1957 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X),
1958 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X),
1959 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1960 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1961 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1962 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X),
1963 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1964 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1965 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1966 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
1967 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
1968 CLK("omap24xxcam", "fck", &cam_fck, CK_243X),
1969 CLK(NULL, "cam_fck", &cam_fck, CK_243X),
1970 CLK("omap24xxcam", "ick", &cam_ick, CK_243X),
1971 CLK(NULL, "cam_ick", &cam_ick, CK_243X),
1972 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X),
1973 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X),
1974 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X),
1975 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X),
1976 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X),
1977 CLK(NULL, "fac_ick", &fac_ick, CK_243X),
1978 CLK(NULL, "fac_fck", &fac_fck, CK_243X),
1979 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1980 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X),
1981 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1982 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X),
1983 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1984 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X),
1985 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1986 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1987 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X),
1988 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1989 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1990 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
1991 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X),
1992 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
1993 CLK(NULL, "des_ick", &des_ick, CK_243X),
1994 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1995 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1996 CLK(NULL, "rng_ick", &rng_ick, CK_243X),
1997 CLK("omap-aes", "ick", &aes_ick, CK_243X),
1998 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
1999 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
2000 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
2001 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
2002 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
2003 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X),
2004 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
2005 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
2006 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X),
2007 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
2008 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
2009 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
2010 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2011 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2012 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X),
2013 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2014 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X),
2015 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
2016 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
2017 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2018 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
2019};
2020
2021static const char *enable_init_clks[] = {
2022 "apll96_ck",
2023 "apll54_ck",
2024 "sync_32k_ick",
2025 "omapctrl_ick",
2026 "gpmc_fck",
2027 "sdrc_ick",
2028};
2029
2030/*
2031 * init code
2032 */
2033
2034int __init omap2430_clk_init(void)
2035{
2036 struct omap_clk *c;
2037
2038 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2039 cpu_mask = RATE_IN_243X;
2040 rate_table = omap2430_rate_table;
2041
2042 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
2043
2044 omap2xxx_clkt_vps_check_bootloader_rates();
2045
2046 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2047 c++) {
2048 clkdev_add(&c->lk);
2049 if (!__clk_init(NULL, c->lk.clk))
2050 omap2_init_clk_hw_omap_clocks(c->lk.clk);
2051 }
2052
2053 omap2_clk_disable_autoidle_all();
2054
2055 omap2_clk_enable_init_clocks(enable_init_clks,
2056 ARRAY_SIZE(enable_init_clks));
2057
2058 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
2059 (clk_get_rate(&sys_ck) / 1000000),
2060 (clk_get_rate(&sys_ck) / 100000) % 10,
2061 (clk_get_rate(&dpll_ck) / 1000000),
2062 (clk_get_rate(&mpu_ck) / 1000000));
2063
2064 return 0;
2065}
diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
new file mode 100644
index 00000000000..ea64ad60675
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -0,0 +1,961 @@
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, 0x0,
288 AM33XX_CM_DIV_M2_DPLL_DISP, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
289 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
290
291/* DPLL_PER */
292static struct dpll_data dpll_per_dd = {
293 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
294 .clk_bypass = &sys_clkin_ck,
295 .clk_ref = &sys_clkin_ck,
296 .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
297 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
298 .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
299 .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
300 .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
301 .enable_mask = AM33XX_DPLL_EN_MASK,
302 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
303 .max_multiplier = 2047,
304 .max_divider = 128,
305 .min_divider = 1,
306 .flags = DPLL_J_TYPE,
307};
308
309/* CLKDCOLDO */
310static struct clk dpll_per_ck;
311
312static struct clk_hw_omap dpll_per_ck_hw = {
313 .hw = {
314 .clk = &dpll_per_ck,
315 },
316 .dpll_data = &dpll_per_dd,
317 .ops = &clkhwops_omap3_dpll,
318};
319
320DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
321
322/* CLKOUT: fdpll/M2 */
323DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
324 AM33XX_CM_DIV_M2_DPLL_PER, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
325 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
326 NULL);
327
328DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_wkupdm_ck, "dpll_per_m2_ck",
329 &dpll_per_m2_ck, 0x0, 1, 4);
330
331DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_ck, "dpll_per_m2_ck",
332 &dpll_per_m2_ck, 0x0, 1, 4);
333
334DEFINE_CLK_FIXED_FACTOR(dpll_core_m4_div2_ck, "dpll_core_m4_ck",
335 &dpll_core_m4_ck, 0x0, 1, 2);
336
337DEFINE_CLK_FIXED_FACTOR(l4_rtc_gclk, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
338 1, 2);
339
340DEFINE_CLK_FIXED_FACTOR(clk_24mhz, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1,
341 8);
342
343/*
344 * Below clock nodes describes clockdomains derived out
345 * of core clock.
346 */
347static const struct clk_ops clk_ops_null = {
348};
349
350static const char *l3_gclk_parents[] = {
351 "dpll_core_m4_ck"
352};
353
354static struct clk l3_gclk;
355DEFINE_STRUCT_CLK_HW_OMAP(l3_gclk, NULL);
356DEFINE_STRUCT_CLK(l3_gclk, l3_gclk_parents, clk_ops_null);
357
358static struct clk l4hs_gclk;
359DEFINE_STRUCT_CLK_HW_OMAP(l4hs_gclk, NULL);
360DEFINE_STRUCT_CLK(l4hs_gclk, l3_gclk_parents, clk_ops_null);
361
362static const char *l3s_gclk_parents[] = {
363 "dpll_core_m4_div2_ck"
364};
365
366static struct clk l3s_gclk;
367DEFINE_STRUCT_CLK_HW_OMAP(l3s_gclk, NULL);
368DEFINE_STRUCT_CLK(l3s_gclk, l3s_gclk_parents, clk_ops_null);
369
370static struct clk l4fw_gclk;
371DEFINE_STRUCT_CLK_HW_OMAP(l4fw_gclk, NULL);
372DEFINE_STRUCT_CLK(l4fw_gclk, l3s_gclk_parents, clk_ops_null);
373
374static struct clk l4ls_gclk;
375DEFINE_STRUCT_CLK_HW_OMAP(l4ls_gclk, NULL);
376DEFINE_STRUCT_CLK(l4ls_gclk, l3s_gclk_parents, clk_ops_null);
377
378static struct clk sysclk_div_ck;
379DEFINE_STRUCT_CLK_HW_OMAP(sysclk_div_ck, NULL);
380DEFINE_STRUCT_CLK(sysclk_div_ck, l3_gclk_parents, clk_ops_null);
381
382/*
383 * In order to match the clock domain with hwmod clockdomain entry,
384 * separate clock nodes is required for the modules which are
385 * directly getting their funtioncal clock from sys_clkin.
386 */
387static struct clk adc_tsc_fck;
388DEFINE_STRUCT_CLK_HW_OMAP(adc_tsc_fck, NULL);
389DEFINE_STRUCT_CLK(adc_tsc_fck, dpll_core_ck_parents, clk_ops_null);
390
391static struct clk dcan0_fck;
392DEFINE_STRUCT_CLK_HW_OMAP(dcan0_fck, NULL);
393DEFINE_STRUCT_CLK(dcan0_fck, dpll_core_ck_parents, clk_ops_null);
394
395static struct clk dcan1_fck;
396DEFINE_STRUCT_CLK_HW_OMAP(dcan1_fck, NULL);
397DEFINE_STRUCT_CLK(dcan1_fck, dpll_core_ck_parents, clk_ops_null);
398
399static struct clk mcasp0_fck;
400DEFINE_STRUCT_CLK_HW_OMAP(mcasp0_fck, NULL);
401DEFINE_STRUCT_CLK(mcasp0_fck, dpll_core_ck_parents, clk_ops_null);
402
403static struct clk mcasp1_fck;
404DEFINE_STRUCT_CLK_HW_OMAP(mcasp1_fck, NULL);
405DEFINE_STRUCT_CLK(mcasp1_fck, dpll_core_ck_parents, clk_ops_null);
406
407static struct clk smartreflex0_fck;
408DEFINE_STRUCT_CLK_HW_OMAP(smartreflex0_fck, NULL);
409DEFINE_STRUCT_CLK(smartreflex0_fck, dpll_core_ck_parents, clk_ops_null);
410
411static struct clk smartreflex1_fck;
412DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
413DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
414
415/*
416 * Modules clock nodes
417 *
418 * The following clock leaf nodes are added for the moment because:
419 *
420 * - hwmod data is not present for these modules, either hwmod
421 * control is not required or its not populated.
422 * - Driver code is not yet migrated to use hwmod/runtime pm
423 * - Modules outside kernel access (to disable them by default)
424 *
425 * - debugss
426 * - mmu (gfx domain)
427 * - cefuse
428 * - usbotg_fck (its additional clock and not really a modulemode)
429 * - ieee5000
430 */
431DEFINE_CLK_GATE(debugss_ick, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
432 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
433 0x0, NULL);
434
435DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
436 AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
437 0x0, NULL);
438
439DEFINE_CLK_GATE(cefuse_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
440 AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
441 0x0, NULL);
442
443/*
444 * clkdiv32 is generated from fixed division of 732.4219
445 */
446DEFINE_CLK_FIXED_FACTOR(clkdiv32k_ck, "clk_24mhz", &clk_24mhz, 0x0, 1, 732);
447
448DEFINE_CLK_GATE(clkdiv32k_ick, "clkdiv32k_ck", &clkdiv32k_ck, 0x0,
449 AM33XX_CM_PER_CLKDIV32K_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
450 0x0, NULL);
451
452/* "usbotg_fck" is an additional clock and not really a modulemode */
453DEFINE_CLK_GATE(usbotg_fck, "dpll_per_ck", &dpll_per_ck, 0x0,
454 AM33XX_CM_CLKDCOLDO_DPLL_PER, AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
455 0x0, NULL);
456
457DEFINE_CLK_GATE(ieee5000_fck, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck,
458 0x0, AM33XX_CM_PER_IEEE5000_CLKCTRL,
459 AM33XX_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
460
461/* Timers */
462static const struct clksel timer1_clkmux_sel[] = {
463 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
464 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
465 { .parent = &tclkin_ck, .rates = div_1_2_rates },
466 { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
467 { .parent = &clk_32768_ck, .rates = div_1_4_rates },
468 { .parent = NULL },
469};
470
471static const char *timer1_ck_parents[] = {
472 "sys_clkin_ck", "clkdiv32k_ick", "tclkin_ck", "clk_rc32k_ck",
473 "clk_32768_ck",
474};
475
476static struct clk timer1_fck;
477
478static const struct clk_ops timer1_fck_ops = {
479 .recalc_rate = &omap2_clksel_recalc,
480 .get_parent = &omap2_clksel_find_parent_index,
481 .set_parent = &omap2_clksel_set_parent,
482 .init = &omap2_init_clk_clkdm,
483};
484
485static struct clk_hw_omap timer1_fck_hw = {
486 .hw = {
487 .clk = &timer1_fck,
488 },
489 .clkdm_name = "l4ls_clkdm",
490 .clksel = timer1_clkmux_sel,
491 .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
492 .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
493};
494
495DEFINE_STRUCT_CLK(timer1_fck, timer1_ck_parents, timer1_fck_ops);
496
497static const struct clksel timer2_to_7_clk_sel[] = {
498 { .parent = &tclkin_ck, .rates = div_1_0_rates },
499 { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
500 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
501 { .parent = NULL },
502};
503
504static const char *timer2_to_7_ck_parents[] = {
505 "tclkin_ck", "sys_clkin_ck", "clkdiv32k_ick",
506};
507
508static struct clk timer2_fck;
509
510static struct clk_hw_omap timer2_fck_hw = {
511 .hw = {
512 .clk = &timer2_fck,
513 },
514 .clkdm_name = "l4ls_clkdm",
515 .clksel = timer2_to_7_clk_sel,
516 .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
517 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
518};
519
520DEFINE_STRUCT_CLK(timer2_fck, timer2_to_7_ck_parents, timer1_fck_ops);
521
522static struct clk timer3_fck;
523
524static struct clk_hw_omap timer3_fck_hw = {
525 .hw = {
526 .clk = &timer3_fck,
527 },
528 .clkdm_name = "l4ls_clkdm",
529 .clksel = timer2_to_7_clk_sel,
530 .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
531 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
532};
533
534DEFINE_STRUCT_CLK(timer3_fck, timer2_to_7_ck_parents, timer1_fck_ops);
535
536static struct clk timer4_fck;
537
538static struct clk_hw_omap timer4_fck_hw = {
539 .hw = {
540 .clk = &timer4_fck,
541 },
542 .clkdm_name = "l4ls_clkdm",
543 .clksel = timer2_to_7_clk_sel,
544 .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
545 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
546};
547
548DEFINE_STRUCT_CLK(timer4_fck, timer2_to_7_ck_parents, timer1_fck_ops);
549
550static struct clk timer5_fck;
551
552static struct clk_hw_omap timer5_fck_hw = {
553 .hw = {
554 .clk = &timer5_fck,
555 },
556 .clkdm_name = "l4ls_clkdm",
557 .clksel = timer2_to_7_clk_sel,
558 .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
559 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
560};
561
562DEFINE_STRUCT_CLK(timer5_fck, timer2_to_7_ck_parents, timer1_fck_ops);
563
564static struct clk timer6_fck;
565
566static struct clk_hw_omap timer6_fck_hw = {
567 .hw = {
568 .clk = &timer6_fck,
569 },
570 .clkdm_name = "l4ls_clkdm",
571 .clksel = timer2_to_7_clk_sel,
572 .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
573 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
574};
575
576DEFINE_STRUCT_CLK(timer6_fck, timer2_to_7_ck_parents, timer1_fck_ops);
577
578static struct clk timer7_fck;
579
580static struct clk_hw_omap timer7_fck_hw = {
581 .hw = {
582 .clk = &timer7_fck,
583 },
584 .clkdm_name = "l4ls_clkdm",
585 .clksel = timer2_to_7_clk_sel,
586 .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
587 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
588};
589
590DEFINE_STRUCT_CLK(timer7_fck, timer2_to_7_ck_parents, timer1_fck_ops);
591
592DEFINE_CLK_FIXED_FACTOR(cpsw_125mhz_gclk,
593 "dpll_core_m5_ck",
594 &dpll_core_m5_ck,
595 0x0,
596 1, 2);
597
598static const struct clk_ops cpsw_fck_ops = {
599 .recalc_rate = &omap2_clksel_recalc,
600 .get_parent = &omap2_clksel_find_parent_index,
601 .set_parent = &omap2_clksel_set_parent,
602};
603
604static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
605 { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
606 { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
607 { .parent = NULL },
608};
609
610static const char *cpsw_cpts_rft_ck_parents[] = {
611 "dpll_core_m5_ck", "dpll_core_m4_ck",
612};
613
614static struct clk cpsw_cpts_rft_clk;
615
616static struct clk_hw_omap cpsw_cpts_rft_clk_hw = {
617 .hw = {
618 .clk = &cpsw_cpts_rft_clk,
619 },
620 .clkdm_name = "cpsw_125mhz_clkdm",
621 .clksel = cpsw_cpts_rft_clkmux_sel,
622 .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
623 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
624};
625
626DEFINE_STRUCT_CLK(cpsw_cpts_rft_clk, cpsw_cpts_rft_ck_parents, cpsw_fck_ops);
627
628
629/* gpio */
630static const char *gpio0_ck_parents[] = {
631 "clk_rc32k_ck", "clk_32768_ck", "clkdiv32k_ick",
632};
633
634static const struct clksel gpio0_dbclk_mux_sel[] = {
635 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
636 { .parent = &clk_32768_ck, .rates = div_1_1_rates },
637 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
638 { .parent = NULL },
639};
640
641static const struct clk_ops gpio_fck_ops = {
642 .recalc_rate = &omap2_clksel_recalc,
643 .get_parent = &omap2_clksel_find_parent_index,
644 .set_parent = &omap2_clksel_set_parent,
645 .init = &omap2_init_clk_clkdm,
646};
647
648static struct clk gpio0_dbclk_mux_ck;
649
650static struct clk_hw_omap gpio0_dbclk_mux_ck_hw = {
651 .hw = {
652 .clk = &gpio0_dbclk_mux_ck,
653 },
654 .clkdm_name = "l4_wkup_clkdm",
655 .clksel = gpio0_dbclk_mux_sel,
656 .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
657 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
658};
659
660DEFINE_STRUCT_CLK(gpio0_dbclk_mux_ck, gpio0_ck_parents, gpio_fck_ops);
661
662DEFINE_CLK_GATE(gpio0_dbclk, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, 0x0,
663 AM33XX_CM_WKUP_GPIO0_CLKCTRL,
664 AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT, 0x0, NULL);
665
666DEFINE_CLK_GATE(gpio1_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
667 AM33XX_CM_PER_GPIO1_CLKCTRL,
668 AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT, 0x0, NULL);
669
670DEFINE_CLK_GATE(gpio2_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
671 AM33XX_CM_PER_GPIO2_CLKCTRL,
672 AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT, 0x0, NULL);
673
674DEFINE_CLK_GATE(gpio3_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
675 AM33XX_CM_PER_GPIO3_CLKCTRL,
676 AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT, 0x0, NULL);
677
678
679static const char *pruss_ck_parents[] = {
680 "l3_gclk", "dpll_disp_m2_ck",
681};
682
683static const struct clksel pruss_ocp_clk_mux_sel[] = {
684 { .parent = &l3_gclk, .rates = div_1_0_rates },
685 { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
686 { .parent = NULL },
687};
688
689static struct clk pruss_ocp_gclk;
690
691static struct clk_hw_omap pruss_ocp_gclk_hw = {
692 .hw = {
693 .clk = &pruss_ocp_gclk,
694 },
695 .clkdm_name = "pruss_ocp_clkdm",
696 .clksel = pruss_ocp_clk_mux_sel,
697 .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
698 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
699};
700
701DEFINE_STRUCT_CLK(pruss_ocp_gclk, pruss_ck_parents, gpio_fck_ops);
702
703static const char *lcd_ck_parents[] = {
704 "dpll_disp_m2_ck", "dpll_core_m5_ck", "dpll_per_m2_ck",
705};
706
707static const struct clksel lcd_clk_mux_sel[] = {
708 { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
709 { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
710 { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
711 { .parent = NULL },
712};
713
714static struct clk lcd_gclk;
715
716static struct clk_hw_omap lcd_gclk_hw = {
717 .hw = {
718 .clk = &lcd_gclk,
719 },
720 .clkdm_name = "lcdc_clkdm",
721 .clksel = lcd_clk_mux_sel,
722 .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
723 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
724};
725
726DEFINE_STRUCT_CLK(lcd_gclk, lcd_ck_parents, gpio_fck_ops);
727
728DEFINE_CLK_FIXED_FACTOR(mmc_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1, 2);
729
730static const char *gfx_ck_parents[] = {
731 "dpll_core_m4_ck", "dpll_per_m2_ck",
732};
733
734static const struct clksel gfx_clksel_sel[] = {
735 { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
736 { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
737 { .parent = NULL },
738};
739
740static struct clk gfx_fclk_clksel_ck;
741
742static struct clk_hw_omap gfx_fclk_clksel_ck_hw = {
743 .hw = {
744 .clk = &gfx_fclk_clksel_ck,
745 },
746 .clksel = gfx_clksel_sel,
747 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
748 .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
749};
750
751DEFINE_STRUCT_CLK(gfx_fclk_clksel_ck, gfx_ck_parents, gpio_fck_ops);
752
753static const struct clk_div_table div_1_0_2_1_rates[] = {
754 { .div = 1, .val = 0, },
755 { .div = 2, .val = 1, },
756 { .div = 0 },
757};
758
759DEFINE_CLK_DIVIDER_TABLE(gfx_fck_div_ck, "gfx_fclk_clksel_ck",
760 &gfx_fclk_clksel_ck, 0x0, AM33XX_CLKSEL_GFX_FCLK,
761 AM33XX_CLKSEL_0_0_SHIFT, AM33XX_CLKSEL_0_0_WIDTH,
762 0x0, div_1_0_2_1_rates, NULL);
763
764static const char *sysclkout_ck_parents[] = {
765 "clk_32768_ck", "l3_gclk", "dpll_ddr_m2_ck", "dpll_per_m2_ck",
766 "lcd_gclk",
767};
768
769static const struct clksel sysclkout_pre_sel[] = {
770 { .parent = &clk_32768_ck, .rates = div_1_0_rates },
771 { .parent = &l3_gclk, .rates = div_1_1_rates },
772 { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
773 { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
774 { .parent = &lcd_gclk, .rates = div_1_4_rates },
775 { .parent = NULL },
776};
777
778static struct clk sysclkout_pre_ck;
779
780static struct clk_hw_omap sysclkout_pre_ck_hw = {
781 .hw = {
782 .clk = &sysclkout_pre_ck,
783 },
784 .clksel = sysclkout_pre_sel,
785 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
786 .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
787};
788
789DEFINE_STRUCT_CLK(sysclkout_pre_ck, sysclkout_ck_parents, gpio_fck_ops);
790
791/* Divide by 8 clock rates with default clock is 1/1*/
792static const struct clk_div_table div8_rates[] = {
793 { .div = 1, .val = 0, },
794 { .div = 2, .val = 1, },
795 { .div = 3, .val = 2, },
796 { .div = 4, .val = 3, },
797 { .div = 5, .val = 4, },
798 { .div = 6, .val = 5, },
799 { .div = 7, .val = 6, },
800 { .div = 8, .val = 7, },
801 { .div = 0 },
802};
803
804DEFINE_CLK_DIVIDER_TABLE(clkout2_div_ck, "sysclkout_pre_ck", &sysclkout_pre_ck,
805 0x0, AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2DIV_SHIFT,
806 AM33XX_CLKOUT2DIV_WIDTH, 0x0, div8_rates, NULL);
807
808DEFINE_CLK_GATE(clkout2_ck, "clkout2_div_ck", &clkout2_div_ck, 0x0,
809 AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2EN_SHIFT, 0x0, NULL);
810
811static const char *wdt_ck_parents[] = {
812 "clk_rc32k_ck", "clkdiv32k_ick",
813};
814
815static const struct clksel wdt_clkmux_sel[] = {
816 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
817 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
818 { .parent = NULL },
819};
820
821static struct clk wdt1_fck;
822
823static struct clk_hw_omap wdt1_fck_hw = {
824 .hw = {
825 .clk = &wdt1_fck,
826 },
827 .clkdm_name = "l4_wkup_clkdm",
828 .clksel = wdt_clkmux_sel,
829 .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
830 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
831};
832
833DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
834
835/*
836 * clkdev
837 */
838static struct omap_clk am33xx_clks[] = {
839 CLK(NULL, "clk_32768_ck", &clk_32768_ck, CK_AM33XX),
840 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck, CK_AM33XX),
841 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_AM33XX),
842 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck, CK_AM33XX),
843 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck, CK_AM33XX),
844 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_AM33XX),
845 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_AM33XX),
846 CLK(NULL, "tclkin_ck", &tclkin_ck, CK_AM33XX),
847 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_AM33XX),
848 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_AM33XX),
849 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_AM33XX),
850 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
851 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
852 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
853 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
854 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
855 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
856 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
857 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX),
858 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX),
859 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX),
860 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX),
861 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX),
862 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX),
863 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
864 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
865 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
866 CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck, CK_AM33XX),
867 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
868 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
869 CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX),
870 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
871 CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX),
872 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
873 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
874 CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX),
875 CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX),
876 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
877 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
878 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
879 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
880 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
881 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
882 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX),
883 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX),
884 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX),
885 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX),
886 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
887 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
888 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
889 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX),
890 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX),
891 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX),
892 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX),
893 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX),
894 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX),
895 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX),
896 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX),
897 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX),
898 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX),
899 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX),
900 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX),
901 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX),
902 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX),
903 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX),
904 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX),
905 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX),
906 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX),
907 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
908 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
909 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
910 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck, CK_AM33XX),
911 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
912 CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX),
913};
914
915
916static const char *enable_init_clks[] = {
917 "dpll_ddr_m2_ck",
918 "dpll_mpu_m2_ck",
919 "l3_gclk",
920 "l4hs_gclk",
921 "l4fw_gclk",
922 "l4ls_gclk",
923};
924
925int __init am33xx_clk_init(void)
926{
927 struct omap_clk *c;
928 u32 cpu_clkflg;
929
930 if (soc_is_am33xx()) {
931 cpu_mask = RATE_IN_AM33XX;
932 cpu_clkflg = CK_AM33XX;
933 }
934
935 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
936 if (c->cpu & cpu_clkflg) {
937 clkdev_add(&c->lk);
938 if (!__clk_init(NULL, c->lk.clk))
939 omap2_init_clk_hw_omap_clocks(c->lk.clk);
940 }
941 }
942
943 omap2_clk_disable_autoidle_all();
944
945 omap2_clk_enable_init_clocks(enable_init_clks,
946 ARRAY_SIZE(enable_init_clks));
947
948 /* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
949 * physically present, in such a case HWMOD enabling of
950 * clock would be failure with default parent. And timer
951 * probe thinks clock is already enabled, this leads to
952 * crash upon accessing timer 3 & 6 registers in probe.
953 * Fix by setting parent of both these timers to master
954 * oscillator clock.
955 */
956
957 clk_set_parent(&timer3_fck, &sys_clkin_ck);
958 clk_set_parent(&timer6_fck, &sys_clkin_ck);
959
960 return 0;
961}
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
new file mode 100644
index 00000000000..bdf39481fbd
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -0,0 +1,3595 @@
1/*
2 * OMAP3 clock data
3 *
4 * Copyright (C) 2007-2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * Updated to COMMON clk data format by Rajendra Nayak <rnayak@ti.com>
9 * With many device clock fixes by Kevin Hilman and Jouni Högander
10 * DPLL bypass clock support added by Roman Tereshonkov
11 *
12 */
13
14/*
15 * Virtual clocks are introduced as convenient tools.
16 * They are sources for other clocks and not supposed
17 * to be requested from drivers directly.
18 */
19
20#include <linux/kernel.h>
21#include <linux/clk.h>
22#include <linux/clk-private.h>
23#include <linux/list.h>
24#include <linux/io.h>
25
26#include "soc.h"
27#include "iomap.h"
28#include "clock.h"
29#include "clock3xxx.h"
30#include "clock34xx.h"
31#include "clock36xx.h"
32#include "clock3517.h"
33#include "cm3xxx.h"
34#include "cm-regbits-34xx.h"
35#include "prm3xxx.h"
36#include "prm-regbits-34xx.h"
37#include "control.h"
38
39/*
40 * clocks
41 */
42
43#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
44
45/* Maximum DPLL multiplier, divider values for OMAP3 */
46#define OMAP3_MAX_DPLL_MULT 2047
47#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095
48#define OMAP3_MAX_DPLL_DIV 128
49
50DEFINE_CLK_FIXED_RATE(dummy_apb_pclk, CLK_IS_ROOT, 0x0, 0x0);
51
52DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
53
54DEFINE_CLK_FIXED_RATE(omap_32k_fck, CLK_IS_ROOT, 32768, 0x0);
55
56DEFINE_CLK_FIXED_RATE(pclk_ck, CLK_IS_ROOT, 27000000, 0x0);
57
58DEFINE_CLK_FIXED_RATE(rmii_ck, CLK_IS_ROOT, 50000000, 0x0);
59
60DEFINE_CLK_FIXED_RATE(secure_32k_fck, CLK_IS_ROOT, 32768, 0x0);
61
62DEFINE_CLK_FIXED_RATE(sys_altclk, CLK_IS_ROOT, 0x0, 0x0);
63
64DEFINE_CLK_FIXED_RATE(virt_12m_ck, CLK_IS_ROOT, 12000000, 0x0);
65
66DEFINE_CLK_FIXED_RATE(virt_13m_ck, CLK_IS_ROOT, 13000000, 0x0);
67
68DEFINE_CLK_FIXED_RATE(virt_16_8m_ck, CLK_IS_ROOT, 16800000, 0x0);
69
70DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
71
72DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
73
74DEFINE_CLK_FIXED_RATE(virt_38_4m_ck, CLK_IS_ROOT, 38400000, 0x0);
75
76static const char *osc_sys_ck_parent_names[] = {
77 "virt_12m_ck", "virt_13m_ck", "virt_19200000_ck", "virt_26000000_ck",
78 "virt_38_4m_ck", "virt_16_8m_ck",
79};
80
81DEFINE_CLK_MUX(osc_sys_ck, osc_sys_ck_parent_names, NULL, 0x0,
82 OMAP3430_PRM_CLKSEL, OMAP3430_SYS_CLKIN_SEL_SHIFT,
83 OMAP3430_SYS_CLKIN_SEL_WIDTH, 0x0, NULL);
84
85DEFINE_CLK_DIVIDER(sys_ck, "osc_sys_ck", &osc_sys_ck, 0x0,
86 OMAP3430_PRM_CLKSRC_CTRL, OMAP_SYSCLKDIV_SHIFT,
87 OMAP_SYSCLKDIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
88
89static struct dpll_data dpll3_dd = {
90 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
91 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
92 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
93 .clk_bypass = &sys_ck,
94 .clk_ref = &sys_ck,
95 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
96 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
97 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
98 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
99 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
100 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
101 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
102 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
103 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
104 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
105 .max_multiplier = OMAP3_MAX_DPLL_MULT,
106 .min_divider = 1,
107 .max_divider = OMAP3_MAX_DPLL_DIV,
108};
109
110static struct clk dpll3_ck;
111
112static const char *dpll3_ck_parent_names[] = {
113 "sys_ck",
114};
115
116static const struct clk_ops dpll3_ck_ops = {
117 .init = &omap2_init_clk_clkdm,
118 .get_parent = &omap2_init_dpll_parent,
119 .recalc_rate = &omap3_dpll_recalc,
120 .round_rate = &omap2_dpll_round_rate,
121};
122
123static struct clk_hw_omap dpll3_ck_hw = {
124 .hw = {
125 .clk = &dpll3_ck,
126 },
127 .ops = &clkhwops_omap3_dpll,
128 .dpll_data = &dpll3_dd,
129 .clkdm_name = "dpll3_clkdm",
130};
131
132DEFINE_STRUCT_CLK(dpll3_ck, dpll3_ck_parent_names, dpll3_ck_ops);
133
134DEFINE_CLK_DIVIDER(dpll3_m2_ck, "dpll3_ck", &dpll3_ck, 0x0,
135 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
136 OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT,
137 OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH,
138 CLK_DIVIDER_ONE_BASED, NULL);
139
140static struct clk core_ck;
141
142static const char *core_ck_parent_names[] = {
143 "dpll3_m2_ck",
144};
145
146static const struct clk_ops core_ck_ops = {};
147
148DEFINE_STRUCT_CLK_HW_OMAP(core_ck, NULL);
149DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
150
151DEFINE_CLK_DIVIDER(l3_ick, "core_ck", &core_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
153 OMAP3430_CLKSEL_L3_SHIFT, OMAP3430_CLKSEL_L3_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156DEFINE_CLK_DIVIDER(l4_ick, "l3_ick", &l3_ick, 0x0,
157 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
158 OMAP3430_CLKSEL_L4_SHIFT, OMAP3430_CLKSEL_L4_WIDTH,
159 CLK_DIVIDER_ONE_BASED, NULL);
160
161static struct clk security_l4_ick2;
162
163static const char *security_l4_ick2_parent_names[] = {
164 "l4_ick",
165};
166
167DEFINE_STRUCT_CLK_HW_OMAP(security_l4_ick2, NULL);
168DEFINE_STRUCT_CLK(security_l4_ick2, security_l4_ick2_parent_names, core_ck_ops);
169
170static struct clk aes1_ick;
171
172static const char *aes1_ick_parent_names[] = {
173 "security_l4_ick2",
174};
175
176static const struct clk_ops aes1_ick_ops = {
177 .enable = &omap2_dflt_clk_enable,
178 .disable = &omap2_dflt_clk_disable,
179 .is_enabled = &omap2_dflt_clk_is_enabled,
180};
181
182static struct clk_hw_omap aes1_ick_hw = {
183 .hw = {
184 .clk = &aes1_ick,
185 },
186 .ops = &clkhwops_iclk_wait,
187 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
188 .enable_bit = OMAP3430_EN_AES1_SHIFT,
189};
190
191DEFINE_STRUCT_CLK(aes1_ick, aes1_ick_parent_names, aes1_ick_ops);
192
193static struct clk core_l4_ick;
194
195static const struct clk_ops core_l4_ick_ops = {
196 .init = &omap2_init_clk_clkdm,
197};
198
199DEFINE_STRUCT_CLK_HW_OMAP(core_l4_ick, "core_l4_clkdm");
200DEFINE_STRUCT_CLK(core_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
201
202static struct clk aes2_ick;
203
204static const char *aes2_ick_parent_names[] = {
205 "core_l4_ick",
206};
207
208static const struct clk_ops aes2_ick_ops = {
209 .init = &omap2_init_clk_clkdm,
210 .enable = &omap2_dflt_clk_enable,
211 .disable = &omap2_dflt_clk_disable,
212 .is_enabled = &omap2_dflt_clk_is_enabled,
213};
214
215static struct clk_hw_omap aes2_ick_hw = {
216 .hw = {
217 .clk = &aes2_ick,
218 },
219 .ops = &clkhwops_iclk_wait,
220 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
221 .enable_bit = OMAP3430_EN_AES2_SHIFT,
222 .clkdm_name = "core_l4_clkdm",
223};
224
225DEFINE_STRUCT_CLK(aes2_ick, aes2_ick_parent_names, aes2_ick_ops);
226
227static struct clk dpll1_fck;
228
229static struct dpll_data dpll1_dd = {
230 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
231 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
232 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
233 .clk_bypass = &dpll1_fck,
234 .clk_ref = &sys_ck,
235 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
236 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
237 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
238 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
239 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
240 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
241 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
242 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
243 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
244 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
245 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
246 .max_multiplier = OMAP3_MAX_DPLL_MULT,
247 .min_divider = 1,
248 .max_divider = OMAP3_MAX_DPLL_DIV,
249};
250
251static struct clk dpll1_ck;
252
253static const struct clk_ops dpll1_ck_ops = {
254 .init = &omap2_init_clk_clkdm,
255 .enable = &omap3_noncore_dpll_enable,
256 .disable = &omap3_noncore_dpll_disable,
257 .get_parent = &omap2_init_dpll_parent,
258 .recalc_rate = &omap3_dpll_recalc,
259 .set_rate = &omap3_noncore_dpll_set_rate,
260 .round_rate = &omap2_dpll_round_rate,
261};
262
263static struct clk_hw_omap dpll1_ck_hw = {
264 .hw = {
265 .clk = &dpll1_ck,
266 },
267 .ops = &clkhwops_omap3_dpll,
268 .dpll_data = &dpll1_dd,
269 .clkdm_name = "dpll1_clkdm",
270};
271
272DEFINE_STRUCT_CLK(dpll1_ck, dpll3_ck_parent_names, dpll1_ck_ops);
273
274DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, "dpll1_ck", &dpll1_ck, 0x0, 2, 1);
275
276DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, "dpll1_x2_ck", &dpll1_x2_ck, 0x0,
277 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
278 OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT,
279 OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH,
280 CLK_DIVIDER_ONE_BASED, NULL);
281
282static struct clk mpu_ck;
283
284static const char *mpu_ck_parent_names[] = {
285 "dpll1_x2m2_ck",
286};
287
288DEFINE_STRUCT_CLK_HW_OMAP(mpu_ck, "mpu_clkdm");
289DEFINE_STRUCT_CLK(mpu_ck, mpu_ck_parent_names, core_l4_ick_ops);
290
291DEFINE_CLK_DIVIDER(arm_fck, "mpu_ck", &mpu_ck, 0x0,
292 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
293 OMAP3430_ST_MPU_CLK_SHIFT, OMAP3430_ST_MPU_CLK_WIDTH,
294 0x0, NULL);
295
296static struct clk cam_ick;
297
298static struct clk_hw_omap cam_ick_hw = {
299 .hw = {
300 .clk = &cam_ick,
301 },
302 .ops = &clkhwops_iclk,
303 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
304 .enable_bit = OMAP3430_EN_CAM_SHIFT,
305 .clkdm_name = "cam_clkdm",
306};
307
308DEFINE_STRUCT_CLK(cam_ick, security_l4_ick2_parent_names, aes2_ick_ops);
309
310/* DPLL4 */
311/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
312/* Type: DPLL */
313static struct dpll_data dpll4_dd;
314
315static struct dpll_data dpll4_dd_34xx __initdata = {
316 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
317 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
318 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
319 .clk_bypass = &sys_ck,
320 .clk_ref = &sys_ck,
321 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
322 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
323 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
324 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
325 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
326 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
327 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
328 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
329 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
330 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
331 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
332 .max_multiplier = OMAP3_MAX_DPLL_MULT,
333 .min_divider = 1,
334 .max_divider = OMAP3_MAX_DPLL_DIV,
335};
336
337static struct dpll_data dpll4_dd_3630 __initdata = {
338 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
339 .mult_mask = OMAP3630_PERIPH_DPLL_MULT_MASK,
340 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
341 .clk_bypass = &sys_ck,
342 .clk_ref = &sys_ck,
343 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
344 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
345 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
346 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
347 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
348 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
349 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
350 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
351 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
352 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
353 .dco_mask = OMAP3630_PERIPH_DPLL_DCO_SEL_MASK,
354 .sddiv_mask = OMAP3630_PERIPH_DPLL_SD_DIV_MASK,
355 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT,
356 .min_divider = 1,
357 .max_divider = OMAP3_MAX_DPLL_DIV,
358 .flags = DPLL_J_TYPE
359};
360
361static struct clk dpll4_ck;
362
363static const struct clk_ops dpll4_ck_ops = {
364 .init = &omap2_init_clk_clkdm,
365 .enable = &omap3_noncore_dpll_enable,
366 .disable = &omap3_noncore_dpll_disable,
367 .get_parent = &omap2_init_dpll_parent,
368 .recalc_rate = &omap3_dpll_recalc,
369 .set_rate = &omap3_dpll4_set_rate,
370 .round_rate = &omap2_dpll_round_rate,
371};
372
373static struct clk_hw_omap dpll4_ck_hw = {
374 .hw = {
375 .clk = &dpll4_ck,
376 },
377 .dpll_data = &dpll4_dd,
378 .ops = &clkhwops_omap3_dpll,
379 .clkdm_name = "dpll4_clkdm",
380};
381
382DEFINE_STRUCT_CLK(dpll4_ck, dpll3_ck_parent_names, dpll4_ck_ops);
383
384DEFINE_CLK_DIVIDER(dpll4_m5_ck, "dpll4_ck", &dpll4_ck, 0x0,
385 OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
386 OMAP3430_CLKSEL_CAM_SHIFT, OMAP3630_CLKSEL_CAM_WIDTH,
387 CLK_DIVIDER_ONE_BASED, NULL);
388
389static struct clk dpll4_m5x2_ck;
390
391static const char *dpll4_m5x2_ck_parent_names[] = {
392 "dpll4_m5_ck",
393};
394
395static const struct clk_ops dpll4_m5x2_ck_ops = {
396 .init = &omap2_init_clk_clkdm,
397 .enable = &omap2_dflt_clk_enable,
398 .disable = &omap2_dflt_clk_disable,
399 .is_enabled = &omap2_dflt_clk_is_enabled,
400 .recalc_rate = &omap3_clkoutx2_recalc,
401};
402
403static const struct clk_ops dpll4_m5x2_ck_3630_ops = {
404 .init = &omap2_init_clk_clkdm,
405 .enable = &omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
406 .disable = &omap2_dflt_clk_disable,
407 .recalc_rate = &omap3_clkoutx2_recalc,
408};
409
410static struct clk_hw_omap dpll4_m5x2_ck_hw = {
411 .hw = {
412 .clk = &dpll4_m5x2_ck,
413 },
414 .ops = &clkhwops_wait,
415 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
416 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
417 .flags = INVERT_ENABLE,
418 .clkdm_name = "dpll4_clkdm",
419};
420
421DEFINE_STRUCT_CLK(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, dpll4_m5x2_ck_ops);
422
423static struct clk dpll4_m5x2_ck_3630 = {
424 .name = "dpll4_m5x2_ck",
425 .hw = &dpll4_m5x2_ck_hw.hw,
426 .parent_names = dpll4_m5x2_ck_parent_names,
427 .num_parents = ARRAY_SIZE(dpll4_m5x2_ck_parent_names),
428 .ops = &dpll4_m5x2_ck_3630_ops,
429};
430
431static struct clk cam_mclk;
432
433static const char *cam_mclk_parent_names[] = {
434 "dpll4_m5x2_ck",
435};
436
437static struct clk_hw_omap cam_mclk_hw = {
438 .hw = {
439 .clk = &cam_mclk,
440 },
441 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
442 .enable_bit = OMAP3430_EN_CAM_SHIFT,
443 .clkdm_name = "cam_clkdm",
444};
445
446DEFINE_STRUCT_CLK(cam_mclk, cam_mclk_parent_names, aes2_ick_ops);
447
448static const struct clksel_rate clkout2_src_core_rates[] = {
449 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
450 { .div = 0 }
451};
452
453static const struct clksel_rate clkout2_src_sys_rates[] = {
454 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
455 { .div = 0 }
456};
457
458static const struct clksel_rate clkout2_src_96m_rates[] = {
459 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
460 { .div = 0 }
461};
462
463DEFINE_CLK_DIVIDER(dpll4_m2_ck, "dpll4_ck", &dpll4_ck, 0x0,
464 OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
465 OMAP3430_DIV_96M_SHIFT, OMAP3630_DIV_96M_WIDTH,
466 CLK_DIVIDER_ONE_BASED, NULL);
467
468static struct clk dpll4_m2x2_ck;
469
470static const char *dpll4_m2x2_ck_parent_names[] = {
471 "dpll4_m2_ck",
472};
473
474static struct clk_hw_omap dpll4_m2x2_ck_hw = {
475 .hw = {
476 .clk = &dpll4_m2x2_ck,
477 },
478 .ops = &clkhwops_wait,
479 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
480 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
481 .flags = INVERT_ENABLE,
482 .clkdm_name = "dpll4_clkdm",
483};
484
485DEFINE_STRUCT_CLK(dpll4_m2x2_ck, dpll4_m2x2_ck_parent_names, dpll4_m5x2_ck_ops);
486
487static struct clk dpll4_m2x2_ck_3630 = {
488 .name = "dpll4_m2x2_ck",
489 .hw = &dpll4_m2x2_ck_hw.hw,
490 .parent_names = dpll4_m2x2_ck_parent_names,
491 .num_parents = ARRAY_SIZE(dpll4_m2x2_ck_parent_names),
492 .ops = &dpll4_m5x2_ck_3630_ops,
493};
494
495static struct clk omap_96m_alwon_fck;
496
497static const char *omap_96m_alwon_fck_parent_names[] = {
498 "dpll4_m2x2_ck",
499};
500
501DEFINE_STRUCT_CLK_HW_OMAP(omap_96m_alwon_fck, NULL);
502DEFINE_STRUCT_CLK(omap_96m_alwon_fck, omap_96m_alwon_fck_parent_names,
503 core_ck_ops);
504
505static struct clk cm_96m_fck;
506
507static const char *cm_96m_fck_parent_names[] = {
508 "omap_96m_alwon_fck",
509};
510
511DEFINE_STRUCT_CLK_HW_OMAP(cm_96m_fck, NULL);
512DEFINE_STRUCT_CLK(cm_96m_fck, cm_96m_fck_parent_names, core_ck_ops);
513
514static const struct clksel_rate clkout2_src_54m_rates[] = {
515 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
516 { .div = 0 }
517};
518
519DEFINE_CLK_DIVIDER(dpll4_m3_ck, "dpll4_ck", &dpll4_ck, 0x0,
520 OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
521 OMAP3430_CLKSEL_TV_SHIFT, OMAP3630_CLKSEL_TV_WIDTH,
522 CLK_DIVIDER_ONE_BASED, NULL);
523
524static struct clk dpll4_m3x2_ck;
525
526static const char *dpll4_m3x2_ck_parent_names[] = {
527 "dpll4_m3_ck",
528};
529
530static struct clk_hw_omap dpll4_m3x2_ck_hw = {
531 .hw = {
532 .clk = &dpll4_m3x2_ck,
533 },
534 .ops = &clkhwops_wait,
535 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
536 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
537 .flags = INVERT_ENABLE,
538 .clkdm_name = "dpll4_clkdm",
539};
540
541DEFINE_STRUCT_CLK(dpll4_m3x2_ck, dpll4_m3x2_ck_parent_names, dpll4_m5x2_ck_ops);
542
543static struct clk dpll4_m3x2_ck_3630 = {
544 .name = "dpll4_m3x2_ck",
545 .hw = &dpll4_m3x2_ck_hw.hw,
546 .parent_names = dpll4_m3x2_ck_parent_names,
547 .num_parents = ARRAY_SIZE(dpll4_m3x2_ck_parent_names),
548 .ops = &dpll4_m5x2_ck_3630_ops,
549};
550
551static const char *omap_54m_fck_parent_names[] = {
552 "dpll4_m3x2_ck", "sys_altclk",
553};
554
555DEFINE_CLK_MUX(omap_54m_fck, omap_54m_fck_parent_names, NULL, 0x0,
556 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP3430_SOURCE_54M_SHIFT,
557 OMAP3430_SOURCE_54M_WIDTH, 0x0, NULL);
558
559static const struct clksel clkout2_src_clksel[] = {
560 { .parent = &core_ck, .rates = clkout2_src_core_rates },
561 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
562 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
563 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
564 { .parent = NULL },
565};
566
567static const char *clkout2_src_ck_parent_names[] = {
568 "core_ck", "sys_ck", "cm_96m_fck", "omap_54m_fck",
569};
570
571static const struct clk_ops clkout2_src_ck_ops = {
572 .init = &omap2_init_clk_clkdm,
573 .enable = &omap2_dflt_clk_enable,
574 .disable = &omap2_dflt_clk_disable,
575 .is_enabled = &omap2_dflt_clk_is_enabled,
576 .recalc_rate = &omap2_clksel_recalc,
577 .get_parent = &omap2_clksel_find_parent_index,
578 .set_parent = &omap2_clksel_set_parent,
579};
580
581DEFINE_CLK_OMAP_MUX_GATE(clkout2_src_ck, "core_clkdm",
582 clkout2_src_clksel, OMAP3430_CM_CLKOUT_CTRL,
583 OMAP3430_CLKOUT2SOURCE_MASK,
584 OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_EN_SHIFT,
585 NULL, clkout2_src_ck_parent_names, clkout2_src_ck_ops);
586
587static const struct clksel_rate omap_48m_cm96m_rates[] = {
588 { .div = 2, .val = 0, .flags = RATE_IN_3XXX },
589 { .div = 0 }
590};
591
592static const struct clksel_rate omap_48m_alt_rates[] = {
593 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
594 { .div = 0 }
595};
596
597static const struct clksel omap_48m_clksel[] = {
598 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
599 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
600 { .parent = NULL },
601};
602
603static const char *omap_48m_fck_parent_names[] = {
604 "cm_96m_fck", "sys_altclk",
605};
606
607static struct clk omap_48m_fck;
608
609static const struct clk_ops omap_48m_fck_ops = {
610 .recalc_rate = &omap2_clksel_recalc,
611 .get_parent = &omap2_clksel_find_parent_index,
612 .set_parent = &omap2_clksel_set_parent,
613};
614
615static struct clk_hw_omap omap_48m_fck_hw = {
616 .hw = {
617 .clk = &omap_48m_fck,
618 },
619 .clksel = omap_48m_clksel,
620 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
621 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
622};
623
624DEFINE_STRUCT_CLK(omap_48m_fck, omap_48m_fck_parent_names, omap_48m_fck_ops);
625
626DEFINE_CLK_FIXED_FACTOR(omap_12m_fck, "omap_48m_fck", &omap_48m_fck, 0x0, 1, 4);
627
628static struct clk core_12m_fck;
629
630static const char *core_12m_fck_parent_names[] = {
631 "omap_12m_fck",
632};
633
634DEFINE_STRUCT_CLK_HW_OMAP(core_12m_fck, "core_l4_clkdm");
635DEFINE_STRUCT_CLK(core_12m_fck, core_12m_fck_parent_names, core_l4_ick_ops);
636
637static struct clk core_48m_fck;
638
639static const char *core_48m_fck_parent_names[] = {
640 "omap_48m_fck",
641};
642
643DEFINE_STRUCT_CLK_HW_OMAP(core_48m_fck, "core_l4_clkdm");
644DEFINE_STRUCT_CLK(core_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops);
645
646static const char *omap_96m_fck_parent_names[] = {
647 "cm_96m_fck", "sys_ck",
648};
649
650DEFINE_CLK_MUX(omap_96m_fck, omap_96m_fck_parent_names, NULL, 0x0,
651 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
652 OMAP3430_SOURCE_96M_SHIFT, OMAP3430_SOURCE_96M_WIDTH, 0x0, NULL);
653
654static struct clk core_96m_fck;
655
656static const char *core_96m_fck_parent_names[] = {
657 "omap_96m_fck",
658};
659
660DEFINE_STRUCT_CLK_HW_OMAP(core_96m_fck, "core_l4_clkdm");
661DEFINE_STRUCT_CLK(core_96m_fck, core_96m_fck_parent_names, core_l4_ick_ops);
662
663static struct clk core_l3_ick;
664
665static const char *core_l3_ick_parent_names[] = {
666 "l3_ick",
667};
668
669DEFINE_STRUCT_CLK_HW_OMAP(core_l3_ick, "core_l3_clkdm");
670DEFINE_STRUCT_CLK(core_l3_ick, core_l3_ick_parent_names, core_l4_ick_ops);
671
672DEFINE_CLK_FIXED_FACTOR(dpll3_m2x2_ck, "dpll3_m2_ck", &dpll3_m2_ck, 0x0, 2, 1);
673
674static struct clk corex2_fck;
675
676static const char *corex2_fck_parent_names[] = {
677 "dpll3_m2x2_ck",
678};
679
680DEFINE_STRUCT_CLK_HW_OMAP(corex2_fck, NULL);
681DEFINE_STRUCT_CLK(corex2_fck, corex2_fck_parent_names, core_ck_ops);
682
683static struct clk cpefuse_fck;
684
685static struct clk_hw_omap cpefuse_fck_hw = {
686 .hw = {
687 .clk = &cpefuse_fck,
688 },
689 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
690 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
691 .clkdm_name = "core_l4_clkdm",
692};
693
694DEFINE_STRUCT_CLK(cpefuse_fck, dpll3_ck_parent_names, aes2_ick_ops);
695
696static struct clk csi2_96m_fck;
697
698static const char *csi2_96m_fck_parent_names[] = {
699 "core_96m_fck",
700};
701
702static struct clk_hw_omap csi2_96m_fck_hw = {
703 .hw = {
704 .clk = &csi2_96m_fck,
705 },
706 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
707 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
708 .clkdm_name = "cam_clkdm",
709};
710
711DEFINE_STRUCT_CLK(csi2_96m_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
712
713static struct clk d2d_26m_fck;
714
715static struct clk_hw_omap d2d_26m_fck_hw = {
716 .hw = {
717 .clk = &d2d_26m_fck,
718 },
719 .ops = &clkhwops_wait,
720 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
721 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
722 .clkdm_name = "d2d_clkdm",
723};
724
725DEFINE_STRUCT_CLK(d2d_26m_fck, dpll3_ck_parent_names, aes2_ick_ops);
726
727static struct clk des1_ick;
728
729static struct clk_hw_omap des1_ick_hw = {
730 .hw = {
731 .clk = &des1_ick,
732 },
733 .ops = &clkhwops_iclk_wait,
734 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
735 .enable_bit = OMAP3430_EN_DES1_SHIFT,
736};
737
738DEFINE_STRUCT_CLK(des1_ick, aes1_ick_parent_names, aes1_ick_ops);
739
740static struct clk des2_ick;
741
742static struct clk_hw_omap des2_ick_hw = {
743 .hw = {
744 .clk = &des2_ick,
745 },
746 .ops = &clkhwops_iclk_wait,
747 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
748 .enable_bit = OMAP3430_EN_DES2_SHIFT,
749 .clkdm_name = "core_l4_clkdm",
750};
751
752DEFINE_STRUCT_CLK(des2_ick, aes2_ick_parent_names, aes2_ick_ops);
753
754DEFINE_CLK_DIVIDER(dpll1_fck, "core_ck", &core_ck, 0x0,
755 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
756 OMAP3430_MPU_CLK_SRC_SHIFT, OMAP3430_MPU_CLK_SRC_WIDTH,
757 CLK_DIVIDER_ONE_BASED, NULL);
758
759static struct clk dpll2_fck;
760
761static struct dpll_data dpll2_dd = {
762 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
763 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
764 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
765 .clk_bypass = &dpll2_fck,
766 .clk_ref = &sys_ck,
767 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
768 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
769 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
770 .modes = ((1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
771 (1 << DPLL_LOW_POWER_BYPASS)),
772 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
773 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
774 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
775 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
776 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
777 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
778 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
779 .max_multiplier = OMAP3_MAX_DPLL_MULT,
780 .min_divider = 1,
781 .max_divider = OMAP3_MAX_DPLL_DIV,
782};
783
784static struct clk dpll2_ck;
785
786static struct clk_hw_omap dpll2_ck_hw = {
787 .hw = {
788 .clk = &dpll2_ck,
789 },
790 .ops = &clkhwops_omap3_dpll,
791 .dpll_data = &dpll2_dd,
792 .clkdm_name = "dpll2_clkdm",
793};
794
795DEFINE_STRUCT_CLK(dpll2_ck, dpll3_ck_parent_names, dpll1_ck_ops);
796
797DEFINE_CLK_DIVIDER(dpll2_fck, "core_ck", &core_ck, 0x0,
798 OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
799 OMAP3430_IVA2_CLK_SRC_SHIFT, OMAP3430_IVA2_CLK_SRC_WIDTH,
800 CLK_DIVIDER_ONE_BASED, NULL);
801
802DEFINE_CLK_DIVIDER(dpll2_m2_ck, "dpll2_ck", &dpll2_ck, 0x0,
803 OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL2_PLL),
804 OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT,
805 OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH,
806 CLK_DIVIDER_ONE_BASED, NULL);
807
808DEFINE_CLK_DIVIDER(dpll3_m3_ck, "dpll3_ck", &dpll3_ck, 0x0,
809 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
810 OMAP3430_DIV_DPLL3_SHIFT, OMAP3430_DIV_DPLL3_WIDTH,
811 CLK_DIVIDER_ONE_BASED, NULL);
812
813static struct clk dpll3_m3x2_ck;
814
815static const char *dpll3_m3x2_ck_parent_names[] = {
816 "dpll3_m3_ck",
817};
818
819static struct clk_hw_omap dpll3_m3x2_ck_hw = {
820 .hw = {
821 .clk = &dpll3_m3x2_ck,
822 },
823 .ops = &clkhwops_wait,
824 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
825 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
826 .flags = INVERT_ENABLE,
827 .clkdm_name = "dpll3_clkdm",
828};
829
830DEFINE_STRUCT_CLK(dpll3_m3x2_ck, dpll3_m3x2_ck_parent_names, dpll4_m5x2_ck_ops);
831
832static struct clk dpll3_m3x2_ck_3630 = {
833 .name = "dpll3_m3x2_ck",
834 .hw = &dpll3_m3x2_ck_hw.hw,
835 .parent_names = dpll3_m3x2_ck_parent_names,
836 .num_parents = ARRAY_SIZE(dpll3_m3x2_ck_parent_names),
837 .ops = &dpll4_m5x2_ck_3630_ops,
838};
839
840DEFINE_CLK_FIXED_FACTOR(dpll3_x2_ck, "dpll3_ck", &dpll3_ck, 0x0, 2, 1);
841
842DEFINE_CLK_DIVIDER(dpll4_m4_ck, "dpll4_ck", &dpll4_ck, 0x0,
843 OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
844 OMAP3430_CLKSEL_DSS1_SHIFT, OMAP3630_CLKSEL_DSS1_WIDTH,
845 CLK_DIVIDER_ONE_BASED, NULL);
846
847static struct clk dpll4_m4x2_ck;
848
849static const char *dpll4_m4x2_ck_parent_names[] = {
850 "dpll4_m4_ck",
851};
852
853static struct clk_hw_omap dpll4_m4x2_ck_hw = {
854 .hw = {
855 .clk = &dpll4_m4x2_ck,
856 },
857 .ops = &clkhwops_wait,
858 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
859 .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT,
860 .flags = INVERT_ENABLE,
861 .clkdm_name = "dpll4_clkdm",
862};
863
864DEFINE_STRUCT_CLK(dpll4_m4x2_ck, dpll4_m4x2_ck_parent_names, dpll4_m5x2_ck_ops);
865
866static struct clk dpll4_m4x2_ck_3630 = {
867 .name = "dpll4_m4x2_ck",
868 .hw = &dpll4_m4x2_ck_hw.hw,
869 .parent_names = dpll4_m4x2_ck_parent_names,
870 .num_parents = ARRAY_SIZE(dpll4_m4x2_ck_parent_names),
871 .ops = &dpll4_m5x2_ck_3630_ops,
872};
873
874DEFINE_CLK_DIVIDER(dpll4_m6_ck, "dpll4_ck", &dpll4_ck, 0x0,
875 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
876 OMAP3430_DIV_DPLL4_SHIFT, OMAP3630_DIV_DPLL4_WIDTH,
877 CLK_DIVIDER_ONE_BASED, NULL);
878
879static struct clk dpll4_m6x2_ck;
880
881static const char *dpll4_m6x2_ck_parent_names[] = {
882 "dpll4_m6_ck",
883};
884
885static struct clk_hw_omap dpll4_m6x2_ck_hw = {
886 .hw = {
887 .clk = &dpll4_m6x2_ck,
888 },
889 .ops = &clkhwops_wait,
890 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
891 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
892 .flags = INVERT_ENABLE,
893 .clkdm_name = "dpll4_clkdm",
894};
895
896DEFINE_STRUCT_CLK(dpll4_m6x2_ck, dpll4_m6x2_ck_parent_names, dpll4_m5x2_ck_ops);
897
898static struct clk dpll4_m6x2_ck_3630 = {
899 .name = "dpll4_m6x2_ck",
900 .hw = &dpll4_m6x2_ck_hw.hw,
901 .parent_names = dpll4_m6x2_ck_parent_names,
902 .num_parents = ARRAY_SIZE(dpll4_m6x2_ck_parent_names),
903 .ops = &dpll4_m5x2_ck_3630_ops,
904};
905
906DEFINE_CLK_FIXED_FACTOR(dpll4_x2_ck, "dpll4_ck", &dpll4_ck, 0x0, 2, 1);
907
908static struct dpll_data dpll5_dd = {
909 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
910 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
911 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
912 .clk_bypass = &sys_ck,
913 .clk_ref = &sys_ck,
914 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
915 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
916 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
917 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
918 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
919 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
920 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
921 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
922 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
923 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
924 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
925 .max_multiplier = OMAP3_MAX_DPLL_MULT,
926 .min_divider = 1,
927 .max_divider = OMAP3_MAX_DPLL_DIV,
928};
929
930static struct clk dpll5_ck;
931
932static struct clk_hw_omap dpll5_ck_hw = {
933 .hw = {
934 .clk = &dpll5_ck,
935 },
936 .ops = &clkhwops_omap3_dpll,
937 .dpll_data = &dpll5_dd,
938 .clkdm_name = "dpll5_clkdm",
939};
940
941DEFINE_STRUCT_CLK(dpll5_ck, dpll3_ck_parent_names, dpll1_ck_ops);
942
943DEFINE_CLK_DIVIDER(dpll5_m2_ck, "dpll5_ck", &dpll5_ck, 0x0,
944 OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
945 OMAP3430ES2_DIV_120M_SHIFT, OMAP3430ES2_DIV_120M_WIDTH,
946 CLK_DIVIDER_ONE_BASED, NULL);
947
948static struct clk dss1_alwon_fck_3430es1;
949
950static const char *dss1_alwon_fck_3430es1_parent_names[] = {
951 "dpll4_m4x2_ck",
952};
953
954static struct clk_hw_omap dss1_alwon_fck_3430es1_hw = {
955 .hw = {
956 .clk = &dss1_alwon_fck_3430es1,
957 },
958 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
959 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
960 .clkdm_name = "dss_clkdm",
961};
962
963DEFINE_STRUCT_CLK(dss1_alwon_fck_3430es1, dss1_alwon_fck_3430es1_parent_names,
964 aes2_ick_ops);
965
966static struct clk dss1_alwon_fck_3430es2;
967
968static struct clk_hw_omap dss1_alwon_fck_3430es2_hw = {
969 .hw = {
970 .clk = &dss1_alwon_fck_3430es2,
971 },
972 .ops = &clkhwops_omap3430es2_dss_usbhost_wait,
973 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
974 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
975 .clkdm_name = "dss_clkdm",
976};
977
978DEFINE_STRUCT_CLK(dss1_alwon_fck_3430es2, dss1_alwon_fck_3430es1_parent_names,
979 aes2_ick_ops);
980
981static struct clk dss2_alwon_fck;
982
983static struct clk_hw_omap dss2_alwon_fck_hw = {
984 .hw = {
985 .clk = &dss2_alwon_fck,
986 },
987 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
988 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
989 .clkdm_name = "dss_clkdm",
990};
991
992DEFINE_STRUCT_CLK(dss2_alwon_fck, dpll3_ck_parent_names, aes2_ick_ops);
993
994static struct clk dss_96m_fck;
995
996static struct clk_hw_omap dss_96m_fck_hw = {
997 .hw = {
998 .clk = &dss_96m_fck,
999 },
1000 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1001 .enable_bit = OMAP3430_EN_TV_SHIFT,
1002 .clkdm_name = "dss_clkdm",
1003};
1004
1005DEFINE_STRUCT_CLK(dss_96m_fck, core_96m_fck_parent_names, aes2_ick_ops);
1006
1007static struct clk dss_ick_3430es1;
1008
1009static struct clk_hw_omap dss_ick_3430es1_hw = {
1010 .hw = {
1011 .clk = &dss_ick_3430es1,
1012 },
1013 .ops = &clkhwops_iclk,
1014 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
1015 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
1016 .clkdm_name = "dss_clkdm",
1017};
1018
1019DEFINE_STRUCT_CLK(dss_ick_3430es1, security_l4_ick2_parent_names, aes2_ick_ops);
1020
1021static struct clk dss_ick_3430es2;
1022
1023static struct clk_hw_omap dss_ick_3430es2_hw = {
1024 .hw = {
1025 .clk = &dss_ick_3430es2,
1026 },
1027 .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait,
1028 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
1029 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
1030 .clkdm_name = "dss_clkdm",
1031};
1032
1033DEFINE_STRUCT_CLK(dss_ick_3430es2, security_l4_ick2_parent_names, aes2_ick_ops);
1034
1035static struct clk dss_tv_fck;
1036
1037static const char *dss_tv_fck_parent_names[] = {
1038 "omap_54m_fck",
1039};
1040
1041static struct clk_hw_omap dss_tv_fck_hw = {
1042 .hw = {
1043 .clk = &dss_tv_fck,
1044 },
1045 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1046 .enable_bit = OMAP3430_EN_TV_SHIFT,
1047 .clkdm_name = "dss_clkdm",
1048};
1049
1050DEFINE_STRUCT_CLK(dss_tv_fck, dss_tv_fck_parent_names, aes2_ick_ops);
1051
1052static struct clk emac_fck;
1053
1054static const char *emac_fck_parent_names[] = {
1055 "rmii_ck",
1056};
1057
1058static struct clk_hw_omap emac_fck_hw = {
1059 .hw = {
1060 .clk = &emac_fck,
1061 },
1062 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1063 .enable_bit = AM35XX_CPGMAC_FCLK_SHIFT,
1064};
1065
1066DEFINE_STRUCT_CLK(emac_fck, emac_fck_parent_names, aes1_ick_ops);
1067
1068static struct clk ipss_ick;
1069
1070static const char *ipss_ick_parent_names[] = {
1071 "core_l3_ick",
1072};
1073
1074static struct clk_hw_omap ipss_ick_hw = {
1075 .hw = {
1076 .clk = &ipss_ick,
1077 },
1078 .ops = &clkhwops_am35xx_ipss_wait,
1079 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1080 .enable_bit = AM35XX_EN_IPSS_SHIFT,
1081 .clkdm_name = "core_l3_clkdm",
1082};
1083
1084DEFINE_STRUCT_CLK(ipss_ick, ipss_ick_parent_names, aes2_ick_ops);
1085
1086static struct clk emac_ick;
1087
1088static const char *emac_ick_parent_names[] = {
1089 "ipss_ick",
1090};
1091
1092static struct clk_hw_omap emac_ick_hw = {
1093 .hw = {
1094 .clk = &emac_ick,
1095 },
1096 .ops = &clkhwops_am35xx_ipss_module_wait,
1097 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1098 .enable_bit = AM35XX_CPGMAC_VBUSP_CLK_SHIFT,
1099 .clkdm_name = "core_l3_clkdm",
1100};
1101
1102DEFINE_STRUCT_CLK(emac_ick, emac_ick_parent_names, aes2_ick_ops);
1103
1104static struct clk emu_core_alwon_ck;
1105
1106static const char *emu_core_alwon_ck_parent_names[] = {
1107 "dpll3_m3x2_ck",
1108};
1109
1110DEFINE_STRUCT_CLK_HW_OMAP(emu_core_alwon_ck, "dpll3_clkdm");
1111DEFINE_STRUCT_CLK(emu_core_alwon_ck, emu_core_alwon_ck_parent_names,
1112 core_l4_ick_ops);
1113
1114static struct clk emu_mpu_alwon_ck;
1115
1116static const char *emu_mpu_alwon_ck_parent_names[] = {
1117 "mpu_ck",
1118};
1119
1120DEFINE_STRUCT_CLK_HW_OMAP(emu_mpu_alwon_ck, NULL);
1121DEFINE_STRUCT_CLK(emu_mpu_alwon_ck, emu_mpu_alwon_ck_parent_names, core_ck_ops);
1122
1123static struct clk emu_per_alwon_ck;
1124
1125static const char *emu_per_alwon_ck_parent_names[] = {
1126 "dpll4_m6x2_ck",
1127};
1128
1129DEFINE_STRUCT_CLK_HW_OMAP(emu_per_alwon_ck, "dpll4_clkdm");
1130DEFINE_STRUCT_CLK(emu_per_alwon_ck, emu_per_alwon_ck_parent_names,
1131 core_l4_ick_ops);
1132
1133static const char *emu_src_ck_parent_names[] = {
1134 "sys_ck", "emu_core_alwon_ck", "emu_per_alwon_ck", "emu_mpu_alwon_ck",
1135};
1136
1137static const struct clksel_rate emu_src_sys_rates[] = {
1138 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1139 { .div = 0 },
1140};
1141
1142static const struct clksel_rate emu_src_core_rates[] = {
1143 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1144 { .div = 0 },
1145};
1146
1147static const struct clksel_rate emu_src_per_rates[] = {
1148 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
1149 { .div = 0 },
1150};
1151
1152static const struct clksel_rate emu_src_mpu_rates[] = {
1153 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
1154 { .div = 0 },
1155};
1156
1157static const struct clksel emu_src_clksel[] = {
1158 { .parent = &sys_ck, .rates = emu_src_sys_rates },
1159 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
1160 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
1161 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
1162 { .parent = NULL },
1163};
1164
1165static const struct clk_ops emu_src_ck_ops = {
1166 .init = &omap2_init_clk_clkdm,
1167 .recalc_rate = &omap2_clksel_recalc,
1168 .get_parent = &omap2_clksel_find_parent_index,
1169 .set_parent = &omap2_clksel_set_parent,
1170};
1171
1172static struct clk emu_src_ck;
1173
1174static struct clk_hw_omap emu_src_ck_hw = {
1175 .hw = {
1176 .clk = &emu_src_ck,
1177 },
1178 .clksel = emu_src_clksel,
1179 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
1180 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
1181 .clkdm_name = "emu_clkdm",
1182};
1183
1184DEFINE_STRUCT_CLK(emu_src_ck, emu_src_ck_parent_names, emu_src_ck_ops);
1185
1186DEFINE_CLK_DIVIDER(atclk_fck, "emu_src_ck", &emu_src_ck, 0x0,
1187 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
1188 OMAP3430_CLKSEL_ATCLK_SHIFT, OMAP3430_CLKSEL_ATCLK_WIDTH,
1189 CLK_DIVIDER_ONE_BASED, NULL);
1190
1191static struct clk fac_ick;
1192
1193static struct clk_hw_omap fac_ick_hw = {
1194 .hw = {
1195 .clk = &fac_ick,
1196 },
1197 .ops = &clkhwops_iclk_wait,
1198 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1199 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
1200 .clkdm_name = "core_l4_clkdm",
1201};
1202
1203DEFINE_STRUCT_CLK(fac_ick, aes2_ick_parent_names, aes2_ick_ops);
1204
1205static struct clk fshostusb_fck;
1206
1207static const char *fshostusb_fck_parent_names[] = {
1208 "core_48m_fck",
1209};
1210
1211static struct clk_hw_omap fshostusb_fck_hw = {
1212 .hw = {
1213 .clk = &fshostusb_fck,
1214 },
1215 .ops = &clkhwops_wait,
1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1217 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1218 .clkdm_name = "core_l4_clkdm",
1219};
1220
1221DEFINE_STRUCT_CLK(fshostusb_fck, fshostusb_fck_parent_names, aes2_ick_ops);
1222
1223static struct clk gfx_l3_ck;
1224
1225static struct clk_hw_omap gfx_l3_ck_hw = {
1226 .hw = {
1227 .clk = &gfx_l3_ck,
1228 },
1229 .ops = &clkhwops_wait,
1230 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1231 .enable_bit = OMAP_EN_GFX_SHIFT,
1232 .clkdm_name = "gfx_3430es1_clkdm",
1233};
1234
1235DEFINE_STRUCT_CLK(gfx_l3_ck, core_l3_ick_parent_names, aes1_ick_ops);
1236
1237DEFINE_CLK_DIVIDER(gfx_l3_fck, "l3_ick", &l3_ick, 0x0,
1238 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1239 OMAP_CLKSEL_GFX_SHIFT, OMAP_CLKSEL_GFX_WIDTH,
1240 CLK_DIVIDER_ONE_BASED, NULL);
1241
1242static struct clk gfx_cg1_ck;
1243
1244static const char *gfx_cg1_ck_parent_names[] = {
1245 "gfx_l3_fck",
1246};
1247
1248static struct clk_hw_omap gfx_cg1_ck_hw = {
1249 .hw = {
1250 .clk = &gfx_cg1_ck,
1251 },
1252 .ops = &clkhwops_wait,
1253 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1254 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1255 .clkdm_name = "gfx_3430es1_clkdm",
1256};
1257
1258DEFINE_STRUCT_CLK(gfx_cg1_ck, gfx_cg1_ck_parent_names, aes2_ick_ops);
1259
1260static struct clk gfx_cg2_ck;
1261
1262static struct clk_hw_omap gfx_cg2_ck_hw = {
1263 .hw = {
1264 .clk = &gfx_cg2_ck,
1265 },
1266 .ops = &clkhwops_wait,
1267 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1268 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1269 .clkdm_name = "gfx_3430es1_clkdm",
1270};
1271
1272DEFINE_STRUCT_CLK(gfx_cg2_ck, gfx_cg1_ck_parent_names, aes2_ick_ops);
1273
1274static struct clk gfx_l3_ick;
1275
1276static const char *gfx_l3_ick_parent_names[] = {
1277 "gfx_l3_ck",
1278};
1279
1280DEFINE_STRUCT_CLK_HW_OMAP(gfx_l3_ick, "gfx_3430es1_clkdm");
1281DEFINE_STRUCT_CLK(gfx_l3_ick, gfx_l3_ick_parent_names, core_l4_ick_ops);
1282
1283static struct clk wkup_32k_fck;
1284
1285static const char *wkup_32k_fck_parent_names[] = {
1286 "omap_32k_fck",
1287};
1288
1289DEFINE_STRUCT_CLK_HW_OMAP(wkup_32k_fck, "wkup_clkdm");
1290DEFINE_STRUCT_CLK(wkup_32k_fck, wkup_32k_fck_parent_names, core_l4_ick_ops);
1291
1292static struct clk gpio1_dbck;
1293
1294static const char *gpio1_dbck_parent_names[] = {
1295 "wkup_32k_fck",
1296};
1297
1298static struct clk_hw_omap gpio1_dbck_hw = {
1299 .hw = {
1300 .clk = &gpio1_dbck,
1301 },
1302 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1303 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
1304 .clkdm_name = "wkup_clkdm",
1305};
1306
1307DEFINE_STRUCT_CLK(gpio1_dbck, gpio1_dbck_parent_names, aes2_ick_ops);
1308
1309static struct clk wkup_l4_ick;
1310
1311DEFINE_STRUCT_CLK_HW_OMAP(wkup_l4_ick, "wkup_clkdm");
1312DEFINE_STRUCT_CLK(wkup_l4_ick, dpll3_ck_parent_names, core_l4_ick_ops);
1313
1314static struct clk gpio1_ick;
1315
1316static const char *gpio1_ick_parent_names[] = {
1317 "wkup_l4_ick",
1318};
1319
1320static struct clk_hw_omap gpio1_ick_hw = {
1321 .hw = {
1322 .clk = &gpio1_ick,
1323 },
1324 .ops = &clkhwops_iclk_wait,
1325 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1326 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
1327 .clkdm_name = "wkup_clkdm",
1328};
1329
1330DEFINE_STRUCT_CLK(gpio1_ick, gpio1_ick_parent_names, aes2_ick_ops);
1331
1332static struct clk per_32k_alwon_fck;
1333
1334DEFINE_STRUCT_CLK_HW_OMAP(per_32k_alwon_fck, "per_clkdm");
1335DEFINE_STRUCT_CLK(per_32k_alwon_fck, wkup_32k_fck_parent_names,
1336 core_l4_ick_ops);
1337
1338static struct clk gpio2_dbck;
1339
1340static const char *gpio2_dbck_parent_names[] = {
1341 "per_32k_alwon_fck",
1342};
1343
1344static struct clk_hw_omap gpio2_dbck_hw = {
1345 .hw = {
1346 .clk = &gpio2_dbck,
1347 },
1348 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1349 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
1350 .clkdm_name = "per_clkdm",
1351};
1352
1353DEFINE_STRUCT_CLK(gpio2_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1354
1355static struct clk per_l4_ick;
1356
1357DEFINE_STRUCT_CLK_HW_OMAP(per_l4_ick, "per_clkdm");
1358DEFINE_STRUCT_CLK(per_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
1359
1360static struct clk gpio2_ick;
1361
1362static const char *gpio2_ick_parent_names[] = {
1363 "per_l4_ick",
1364};
1365
1366static struct clk_hw_omap gpio2_ick_hw = {
1367 .hw = {
1368 .clk = &gpio2_ick,
1369 },
1370 .ops = &clkhwops_iclk_wait,
1371 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1372 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
1373 .clkdm_name = "per_clkdm",
1374};
1375
1376DEFINE_STRUCT_CLK(gpio2_ick, gpio2_ick_parent_names, aes2_ick_ops);
1377
1378static struct clk gpio3_dbck;
1379
1380static struct clk_hw_omap gpio3_dbck_hw = {
1381 .hw = {
1382 .clk = &gpio3_dbck,
1383 },
1384 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1385 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
1386 .clkdm_name = "per_clkdm",
1387};
1388
1389DEFINE_STRUCT_CLK(gpio3_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1390
1391static struct clk gpio3_ick;
1392
1393static struct clk_hw_omap gpio3_ick_hw = {
1394 .hw = {
1395 .clk = &gpio3_ick,
1396 },
1397 .ops = &clkhwops_iclk_wait,
1398 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1399 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
1400 .clkdm_name = "per_clkdm",
1401};
1402
1403DEFINE_STRUCT_CLK(gpio3_ick, gpio2_ick_parent_names, aes2_ick_ops);
1404
1405static struct clk gpio4_dbck;
1406
1407static struct clk_hw_omap gpio4_dbck_hw = {
1408 .hw = {
1409 .clk = &gpio4_dbck,
1410 },
1411 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1412 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
1413 .clkdm_name = "per_clkdm",
1414};
1415
1416DEFINE_STRUCT_CLK(gpio4_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1417
1418static struct clk gpio4_ick;
1419
1420static struct clk_hw_omap gpio4_ick_hw = {
1421 .hw = {
1422 .clk = &gpio4_ick,
1423 },
1424 .ops = &clkhwops_iclk_wait,
1425 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1426 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
1427 .clkdm_name = "per_clkdm",
1428};
1429
1430DEFINE_STRUCT_CLK(gpio4_ick, gpio2_ick_parent_names, aes2_ick_ops);
1431
1432static struct clk gpio5_dbck;
1433
1434static struct clk_hw_omap gpio5_dbck_hw = {
1435 .hw = {
1436 .clk = &gpio5_dbck,
1437 },
1438 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1439 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
1440 .clkdm_name = "per_clkdm",
1441};
1442
1443DEFINE_STRUCT_CLK(gpio5_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1444
1445static struct clk gpio5_ick;
1446
1447static struct clk_hw_omap gpio5_ick_hw = {
1448 .hw = {
1449 .clk = &gpio5_ick,
1450 },
1451 .ops = &clkhwops_iclk_wait,
1452 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1453 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
1454 .clkdm_name = "per_clkdm",
1455};
1456
1457DEFINE_STRUCT_CLK(gpio5_ick, gpio2_ick_parent_names, aes2_ick_ops);
1458
1459static struct clk gpio6_dbck;
1460
1461static struct clk_hw_omap gpio6_dbck_hw = {
1462 .hw = {
1463 .clk = &gpio6_dbck,
1464 },
1465 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1466 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
1467 .clkdm_name = "per_clkdm",
1468};
1469
1470DEFINE_STRUCT_CLK(gpio6_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1471
1472static struct clk gpio6_ick;
1473
1474static struct clk_hw_omap gpio6_ick_hw = {
1475 .hw = {
1476 .clk = &gpio6_ick,
1477 },
1478 .ops = &clkhwops_iclk_wait,
1479 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1480 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
1481 .clkdm_name = "per_clkdm",
1482};
1483
1484DEFINE_STRUCT_CLK(gpio6_ick, gpio2_ick_parent_names, aes2_ick_ops);
1485
1486static struct clk gpmc_fck;
1487
1488static struct clk_hw_omap gpmc_fck_hw = {
1489 .hw = {
1490 .clk = &gpmc_fck,
1491 },
1492 .flags = ENABLE_ON_INIT,
1493 .clkdm_name = "core_l3_clkdm",
1494};
1495
1496DEFINE_STRUCT_CLK(gpmc_fck, ipss_ick_parent_names, core_l4_ick_ops);
1497
1498static const struct clksel omap343x_gpt_clksel[] = {
1499 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1500 { .parent = &sys_ck, .rates = gpt_sys_rates },
1501 { .parent = NULL },
1502};
1503
1504static const char *gpt10_fck_parent_names[] = {
1505 "omap_32k_fck", "sys_ck",
1506};
1507
1508DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap343x_gpt_clksel,
1509 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1510 OMAP3430_CLKSEL_GPT10_MASK,
1511 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1512 OMAP3430_EN_GPT10_SHIFT, &clkhwops_wait,
1513 gpt10_fck_parent_names, clkout2_src_ck_ops);
1514
1515static struct clk gpt10_ick;
1516
1517static struct clk_hw_omap gpt10_ick_hw = {
1518 .hw = {
1519 .clk = &gpt10_ick,
1520 },
1521 .ops = &clkhwops_iclk_wait,
1522 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1523 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1524 .clkdm_name = "core_l4_clkdm",
1525};
1526
1527DEFINE_STRUCT_CLK(gpt10_ick, aes2_ick_parent_names, aes2_ick_ops);
1528
1529DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap343x_gpt_clksel,
1530 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1531 OMAP3430_CLKSEL_GPT11_MASK,
1532 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1533 OMAP3430_EN_GPT11_SHIFT, &clkhwops_wait,
1534 gpt10_fck_parent_names, clkout2_src_ck_ops);
1535
1536static struct clk gpt11_ick;
1537
1538static struct clk_hw_omap gpt11_ick_hw = {
1539 .hw = {
1540 .clk = &gpt11_ick,
1541 },
1542 .ops = &clkhwops_iclk_wait,
1543 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1544 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1545 .clkdm_name = "core_l4_clkdm",
1546};
1547
1548DEFINE_STRUCT_CLK(gpt11_ick, aes2_ick_parent_names, aes2_ick_ops);
1549
1550static struct clk gpt12_fck;
1551
1552static const char *gpt12_fck_parent_names[] = {
1553 "secure_32k_fck",
1554};
1555
1556DEFINE_STRUCT_CLK_HW_OMAP(gpt12_fck, "wkup_clkdm");
1557DEFINE_STRUCT_CLK(gpt12_fck, gpt12_fck_parent_names, core_l4_ick_ops);
1558
1559static struct clk gpt12_ick;
1560
1561static struct clk_hw_omap gpt12_ick_hw = {
1562 .hw = {
1563 .clk = &gpt12_ick,
1564 },
1565 .ops = &clkhwops_iclk_wait,
1566 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1567 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
1568 .clkdm_name = "wkup_clkdm",
1569};
1570
1571DEFINE_STRUCT_CLK(gpt12_ick, gpio1_ick_parent_names, aes2_ick_ops);
1572
1573DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "wkup_clkdm", omap343x_gpt_clksel,
1574 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1575 OMAP3430_CLKSEL_GPT1_MASK,
1576 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1577 OMAP3430_EN_GPT1_SHIFT, &clkhwops_wait,
1578 gpt10_fck_parent_names, clkout2_src_ck_ops);
1579
1580static struct clk gpt1_ick;
1581
1582static struct clk_hw_omap gpt1_ick_hw = {
1583 .hw = {
1584 .clk = &gpt1_ick,
1585 },
1586 .ops = &clkhwops_iclk_wait,
1587 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1588 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
1589 .clkdm_name = "wkup_clkdm",
1590};
1591
1592DEFINE_STRUCT_CLK(gpt1_ick, gpio1_ick_parent_names, aes2_ick_ops);
1593
1594DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "per_clkdm", omap343x_gpt_clksel,
1595 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1596 OMAP3430_CLKSEL_GPT2_MASK,
1597 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1598 OMAP3430_EN_GPT2_SHIFT, &clkhwops_wait,
1599 gpt10_fck_parent_names, clkout2_src_ck_ops);
1600
1601static struct clk gpt2_ick;
1602
1603static struct clk_hw_omap gpt2_ick_hw = {
1604 .hw = {
1605 .clk = &gpt2_ick,
1606 },
1607 .ops = &clkhwops_iclk_wait,
1608 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1609 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
1610 .clkdm_name = "per_clkdm",
1611};
1612
1613DEFINE_STRUCT_CLK(gpt2_ick, gpio2_ick_parent_names, aes2_ick_ops);
1614
1615DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "per_clkdm", omap343x_gpt_clksel,
1616 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1617 OMAP3430_CLKSEL_GPT3_MASK,
1618 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1619 OMAP3430_EN_GPT3_SHIFT, &clkhwops_wait,
1620 gpt10_fck_parent_names, clkout2_src_ck_ops);
1621
1622static struct clk gpt3_ick;
1623
1624static struct clk_hw_omap gpt3_ick_hw = {
1625 .hw = {
1626 .clk = &gpt3_ick,
1627 },
1628 .ops = &clkhwops_iclk_wait,
1629 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1630 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
1631 .clkdm_name = "per_clkdm",
1632};
1633
1634DEFINE_STRUCT_CLK(gpt3_ick, gpio2_ick_parent_names, aes2_ick_ops);
1635
1636DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "per_clkdm", omap343x_gpt_clksel,
1637 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1638 OMAP3430_CLKSEL_GPT4_MASK,
1639 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1640 OMAP3430_EN_GPT4_SHIFT, &clkhwops_wait,
1641 gpt10_fck_parent_names, clkout2_src_ck_ops);
1642
1643static struct clk gpt4_ick;
1644
1645static struct clk_hw_omap gpt4_ick_hw = {
1646 .hw = {
1647 .clk = &gpt4_ick,
1648 },
1649 .ops = &clkhwops_iclk_wait,
1650 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1651 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
1652 .clkdm_name = "per_clkdm",
1653};
1654
1655DEFINE_STRUCT_CLK(gpt4_ick, gpio2_ick_parent_names, aes2_ick_ops);
1656
1657DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "per_clkdm", omap343x_gpt_clksel,
1658 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1659 OMAP3430_CLKSEL_GPT5_MASK,
1660 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1661 OMAP3430_EN_GPT5_SHIFT, &clkhwops_wait,
1662 gpt10_fck_parent_names, clkout2_src_ck_ops);
1663
1664static struct clk gpt5_ick;
1665
1666static struct clk_hw_omap gpt5_ick_hw = {
1667 .hw = {
1668 .clk = &gpt5_ick,
1669 },
1670 .ops = &clkhwops_iclk_wait,
1671 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1672 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
1673 .clkdm_name = "per_clkdm",
1674};
1675
1676DEFINE_STRUCT_CLK(gpt5_ick, gpio2_ick_parent_names, aes2_ick_ops);
1677
1678DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "per_clkdm", omap343x_gpt_clksel,
1679 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1680 OMAP3430_CLKSEL_GPT6_MASK,
1681 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1682 OMAP3430_EN_GPT6_SHIFT, &clkhwops_wait,
1683 gpt10_fck_parent_names, clkout2_src_ck_ops);
1684
1685static struct clk gpt6_ick;
1686
1687static struct clk_hw_omap gpt6_ick_hw = {
1688 .hw = {
1689 .clk = &gpt6_ick,
1690 },
1691 .ops = &clkhwops_iclk_wait,
1692 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1693 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
1694 .clkdm_name = "per_clkdm",
1695};
1696
1697DEFINE_STRUCT_CLK(gpt6_ick, gpio2_ick_parent_names, aes2_ick_ops);
1698
1699DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "per_clkdm", omap343x_gpt_clksel,
1700 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1701 OMAP3430_CLKSEL_GPT7_MASK,
1702 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1703 OMAP3430_EN_GPT7_SHIFT, &clkhwops_wait,
1704 gpt10_fck_parent_names, clkout2_src_ck_ops);
1705
1706static struct clk gpt7_ick;
1707
1708static struct clk_hw_omap gpt7_ick_hw = {
1709 .hw = {
1710 .clk = &gpt7_ick,
1711 },
1712 .ops = &clkhwops_iclk_wait,
1713 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1714 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
1715 .clkdm_name = "per_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(gpt7_ick, gpio2_ick_parent_names, aes2_ick_ops);
1719
1720DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "per_clkdm", omap343x_gpt_clksel,
1721 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1722 OMAP3430_CLKSEL_GPT8_MASK,
1723 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1724 OMAP3430_EN_GPT8_SHIFT, &clkhwops_wait,
1725 gpt10_fck_parent_names, clkout2_src_ck_ops);
1726
1727static struct clk gpt8_ick;
1728
1729static struct clk_hw_omap gpt8_ick_hw = {
1730 .hw = {
1731 .clk = &gpt8_ick,
1732 },
1733 .ops = &clkhwops_iclk_wait,
1734 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1735 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
1736 .clkdm_name = "per_clkdm",
1737};
1738
1739DEFINE_STRUCT_CLK(gpt8_ick, gpio2_ick_parent_names, aes2_ick_ops);
1740
1741DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "per_clkdm", omap343x_gpt_clksel,
1742 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1743 OMAP3430_CLKSEL_GPT9_MASK,
1744 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1745 OMAP3430_EN_GPT9_SHIFT, &clkhwops_wait,
1746 gpt10_fck_parent_names, clkout2_src_ck_ops);
1747
1748static struct clk gpt9_ick;
1749
1750static struct clk_hw_omap gpt9_ick_hw = {
1751 .hw = {
1752 .clk = &gpt9_ick,
1753 },
1754 .ops = &clkhwops_iclk_wait,
1755 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1756 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
1757 .clkdm_name = "per_clkdm",
1758};
1759
1760DEFINE_STRUCT_CLK(gpt9_ick, gpio2_ick_parent_names, aes2_ick_ops);
1761
1762static struct clk hdq_fck;
1763
1764static const char *hdq_fck_parent_names[] = {
1765 "core_12m_fck",
1766};
1767
1768static struct clk_hw_omap hdq_fck_hw = {
1769 .hw = {
1770 .clk = &hdq_fck,
1771 },
1772 .ops = &clkhwops_wait,
1773 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1774 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1775 .clkdm_name = "core_l4_clkdm",
1776};
1777
1778DEFINE_STRUCT_CLK(hdq_fck, hdq_fck_parent_names, aes2_ick_ops);
1779
1780static struct clk hdq_ick;
1781
1782static struct clk_hw_omap hdq_ick_hw = {
1783 .hw = {
1784 .clk = &hdq_ick,
1785 },
1786 .ops = &clkhwops_iclk_wait,
1787 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1788 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1789 .clkdm_name = "core_l4_clkdm",
1790};
1791
1792DEFINE_STRUCT_CLK(hdq_ick, aes2_ick_parent_names, aes2_ick_ops);
1793
1794static struct clk hecc_ck;
1795
1796static struct clk_hw_omap hecc_ck_hw = {
1797 .hw = {
1798 .clk = &hecc_ck,
1799 },
1800 .ops = &clkhwops_am35xx_ipss_module_wait,
1801 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1802 .enable_bit = AM35XX_HECC_VBUSP_CLK_SHIFT,
1803 .clkdm_name = "core_l3_clkdm",
1804};
1805
1806DEFINE_STRUCT_CLK(hecc_ck, dpll3_ck_parent_names, aes2_ick_ops);
1807
1808static struct clk hsotgusb_fck_am35xx;
1809
1810static struct clk_hw_omap hsotgusb_fck_am35xx_hw = {
1811 .hw = {
1812 .clk = &hsotgusb_fck_am35xx,
1813 },
1814 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1815 .enable_bit = AM35XX_USBOTG_FCLK_SHIFT,
1816 .clkdm_name = "core_l3_clkdm",
1817};
1818
1819DEFINE_STRUCT_CLK(hsotgusb_fck_am35xx, dpll3_ck_parent_names, aes2_ick_ops);
1820
1821static struct clk hsotgusb_ick_3430es1;
1822
1823static struct clk_hw_omap hsotgusb_ick_3430es1_hw = {
1824 .hw = {
1825 .clk = &hsotgusb_ick_3430es1,
1826 },
1827 .ops = &clkhwops_iclk,
1828 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1829 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1830 .clkdm_name = "core_l3_clkdm",
1831};
1832
1833DEFINE_STRUCT_CLK(hsotgusb_ick_3430es1, ipss_ick_parent_names, aes2_ick_ops);
1834
1835static struct clk hsotgusb_ick_3430es2;
1836
1837static struct clk_hw_omap hsotgusb_ick_3430es2_hw = {
1838 .hw = {
1839 .clk = &hsotgusb_ick_3430es2,
1840 },
1841 .ops = &clkhwops_omap3430es2_iclk_hsotgusb_wait,
1842 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1843 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1844 .clkdm_name = "core_l3_clkdm",
1845};
1846
1847DEFINE_STRUCT_CLK(hsotgusb_ick_3430es2, ipss_ick_parent_names, aes2_ick_ops);
1848
1849static struct clk hsotgusb_ick_am35xx;
1850
1851static struct clk_hw_omap hsotgusb_ick_am35xx_hw = {
1852 .hw = {
1853 .clk = &hsotgusb_ick_am35xx,
1854 },
1855 .ops = &clkhwops_am35xx_ipss_module_wait,
1856 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1857 .enable_bit = AM35XX_USBOTG_VBUSP_CLK_SHIFT,
1858 .clkdm_name = "core_l3_clkdm",
1859};
1860
1861DEFINE_STRUCT_CLK(hsotgusb_ick_am35xx, emac_ick_parent_names, aes2_ick_ops);
1862
1863static struct clk i2c1_fck;
1864
1865static struct clk_hw_omap i2c1_fck_hw = {
1866 .hw = {
1867 .clk = &i2c1_fck,
1868 },
1869 .ops = &clkhwops_wait,
1870 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1871 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1872 .clkdm_name = "core_l4_clkdm",
1873};
1874
1875DEFINE_STRUCT_CLK(i2c1_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1876
1877static struct clk i2c1_ick;
1878
1879static struct clk_hw_omap i2c1_ick_hw = {
1880 .hw = {
1881 .clk = &i2c1_ick,
1882 },
1883 .ops = &clkhwops_iclk_wait,
1884 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1885 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1886 .clkdm_name = "core_l4_clkdm",
1887};
1888
1889DEFINE_STRUCT_CLK(i2c1_ick, aes2_ick_parent_names, aes2_ick_ops);
1890
1891static struct clk i2c2_fck;
1892
1893static struct clk_hw_omap i2c2_fck_hw = {
1894 .hw = {
1895 .clk = &i2c2_fck,
1896 },
1897 .ops = &clkhwops_wait,
1898 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1899 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1900 .clkdm_name = "core_l4_clkdm",
1901};
1902
1903DEFINE_STRUCT_CLK(i2c2_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1904
1905static struct clk i2c2_ick;
1906
1907static struct clk_hw_omap i2c2_ick_hw = {
1908 .hw = {
1909 .clk = &i2c2_ick,
1910 },
1911 .ops = &clkhwops_iclk_wait,
1912 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1913 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1914 .clkdm_name = "core_l4_clkdm",
1915};
1916
1917DEFINE_STRUCT_CLK(i2c2_ick, aes2_ick_parent_names, aes2_ick_ops);
1918
1919static struct clk i2c3_fck;
1920
1921static struct clk_hw_omap i2c3_fck_hw = {
1922 .hw = {
1923 .clk = &i2c3_fck,
1924 },
1925 .ops = &clkhwops_wait,
1926 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1927 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1928 .clkdm_name = "core_l4_clkdm",
1929};
1930
1931DEFINE_STRUCT_CLK(i2c3_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1932
1933static struct clk i2c3_ick;
1934
1935static struct clk_hw_omap i2c3_ick_hw = {
1936 .hw = {
1937 .clk = &i2c3_ick,
1938 },
1939 .ops = &clkhwops_iclk_wait,
1940 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1941 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1942 .clkdm_name = "core_l4_clkdm",
1943};
1944
1945DEFINE_STRUCT_CLK(i2c3_ick, aes2_ick_parent_names, aes2_ick_ops);
1946
1947static struct clk icr_ick;
1948
1949static struct clk_hw_omap icr_ick_hw = {
1950 .hw = {
1951 .clk = &icr_ick,
1952 },
1953 .ops = &clkhwops_iclk_wait,
1954 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1955 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1956 .clkdm_name = "core_l4_clkdm",
1957};
1958
1959DEFINE_STRUCT_CLK(icr_ick, aes2_ick_parent_names, aes2_ick_ops);
1960
1961static struct clk iva2_ck;
1962
1963static const char *iva2_ck_parent_names[] = {
1964 "dpll2_m2_ck",
1965};
1966
1967static struct clk_hw_omap iva2_ck_hw = {
1968 .hw = {
1969 .clk = &iva2_ck,
1970 },
1971 .ops = &clkhwops_wait,
1972 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1973 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1974 .clkdm_name = "iva2_clkdm",
1975};
1976
1977DEFINE_STRUCT_CLK(iva2_ck, iva2_ck_parent_names, aes2_ick_ops);
1978
1979static struct clk mad2d_ick;
1980
1981static struct clk_hw_omap mad2d_ick_hw = {
1982 .hw = {
1983 .clk = &mad2d_ick,
1984 },
1985 .ops = &clkhwops_iclk_wait,
1986 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1987 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1988 .clkdm_name = "d2d_clkdm",
1989};
1990
1991DEFINE_STRUCT_CLK(mad2d_ick, core_l3_ick_parent_names, aes2_ick_ops);
1992
1993static struct clk mailboxes_ick;
1994
1995static struct clk_hw_omap mailboxes_ick_hw = {
1996 .hw = {
1997 .clk = &mailboxes_ick,
1998 },
1999 .ops = &clkhwops_iclk_wait,
2000 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2001 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
2002 .clkdm_name = "core_l4_clkdm",
2003};
2004
2005DEFINE_STRUCT_CLK(mailboxes_ick, aes2_ick_parent_names, aes2_ick_ops);
2006
2007static const struct clksel_rate common_mcbsp_96m_rates[] = {
2008 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
2009 { .div = 0 }
2010};
2011
2012static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
2013 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2014 { .div = 0 }
2015};
2016
2017static const struct clksel mcbsp_15_clksel[] = {
2018 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
2019 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2020 { .parent = NULL },
2021};
2022
2023static const char *mcbsp1_fck_parent_names[] = {
2024 "core_96m_fck", "mcbsp_clks",
2025};
2026
2027DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_15_clksel,
2028 OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2029 OMAP2_MCBSP1_CLKS_MASK,
2030 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2031 OMAP3430_EN_MCBSP1_SHIFT, &clkhwops_wait,
2032 mcbsp1_fck_parent_names, clkout2_src_ck_ops);
2033
2034static struct clk mcbsp1_ick;
2035
2036static struct clk_hw_omap mcbsp1_ick_hw = {
2037 .hw = {
2038 .clk = &mcbsp1_ick,
2039 },
2040 .ops = &clkhwops_iclk_wait,
2041 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2042 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
2043 .clkdm_name = "core_l4_clkdm",
2044};
2045
2046DEFINE_STRUCT_CLK(mcbsp1_ick, aes2_ick_parent_names, aes2_ick_ops);
2047
2048static struct clk per_96m_fck;
2049
2050DEFINE_STRUCT_CLK_HW_OMAP(per_96m_fck, "per_clkdm");
2051DEFINE_STRUCT_CLK(per_96m_fck, cm_96m_fck_parent_names, core_l4_ick_ops);
2052
2053static const struct clksel mcbsp_234_clksel[] = {
2054 { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates },
2055 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2056 { .parent = NULL },
2057};
2058
2059static const char *mcbsp2_fck_parent_names[] = {
2060 "per_96m_fck", "mcbsp_clks",
2061};
2062
2063DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "per_clkdm", mcbsp_234_clksel,
2064 OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2065 OMAP2_MCBSP2_CLKS_MASK,
2066 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2067 OMAP3430_EN_MCBSP2_SHIFT, &clkhwops_wait,
2068 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2069
2070static struct clk mcbsp2_ick;
2071
2072static struct clk_hw_omap mcbsp2_ick_hw = {
2073 .hw = {
2074 .clk = &mcbsp2_ick,
2075 },
2076 .ops = &clkhwops_iclk_wait,
2077 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2078 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2079 .clkdm_name = "per_clkdm",
2080};
2081
2082DEFINE_STRUCT_CLK(mcbsp2_ick, gpio2_ick_parent_names, aes2_ick_ops);
2083
2084DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "per_clkdm", mcbsp_234_clksel,
2085 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2086 OMAP2_MCBSP3_CLKS_MASK,
2087 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2088 OMAP3430_EN_MCBSP3_SHIFT, &clkhwops_wait,
2089 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2090
2091static struct clk mcbsp3_ick;
2092
2093static struct clk_hw_omap mcbsp3_ick_hw = {
2094 .hw = {
2095 .clk = &mcbsp3_ick,
2096 },
2097 .ops = &clkhwops_iclk_wait,
2098 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2099 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2100 .clkdm_name = "per_clkdm",
2101};
2102
2103DEFINE_STRUCT_CLK(mcbsp3_ick, gpio2_ick_parent_names, aes2_ick_ops);
2104
2105DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "per_clkdm", mcbsp_234_clksel,
2106 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2107 OMAP2_MCBSP4_CLKS_MASK,
2108 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2109 OMAP3430_EN_MCBSP4_SHIFT, &clkhwops_wait,
2110 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2111
2112static struct clk mcbsp4_ick;
2113
2114static struct clk_hw_omap mcbsp4_ick_hw = {
2115 .hw = {
2116 .clk = &mcbsp4_ick,
2117 },
2118 .ops = &clkhwops_iclk_wait,
2119 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2120 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2121 .clkdm_name = "per_clkdm",
2122};
2123
2124DEFINE_STRUCT_CLK(mcbsp4_ick, gpio2_ick_parent_names, aes2_ick_ops);
2125
2126DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_15_clksel,
2127 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2128 OMAP2_MCBSP5_CLKS_MASK,
2129 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2130 OMAP3430_EN_MCBSP5_SHIFT, &clkhwops_wait,
2131 mcbsp1_fck_parent_names, clkout2_src_ck_ops);
2132
2133static struct clk mcbsp5_ick;
2134
2135static struct clk_hw_omap mcbsp5_ick_hw = {
2136 .hw = {
2137 .clk = &mcbsp5_ick,
2138 },
2139 .ops = &clkhwops_iclk_wait,
2140 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2141 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
2142 .clkdm_name = "core_l4_clkdm",
2143};
2144
2145DEFINE_STRUCT_CLK(mcbsp5_ick, aes2_ick_parent_names, aes2_ick_ops);
2146
2147static struct clk mcspi1_fck;
2148
2149static struct clk_hw_omap mcspi1_fck_hw = {
2150 .hw = {
2151 .clk = &mcspi1_fck,
2152 },
2153 .ops = &clkhwops_wait,
2154 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2155 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
2156 .clkdm_name = "core_l4_clkdm",
2157};
2158
2159DEFINE_STRUCT_CLK(mcspi1_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2160
2161static struct clk mcspi1_ick;
2162
2163static struct clk_hw_omap mcspi1_ick_hw = {
2164 .hw = {
2165 .clk = &mcspi1_ick,
2166 },
2167 .ops = &clkhwops_iclk_wait,
2168 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2169 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
2170 .clkdm_name = "core_l4_clkdm",
2171};
2172
2173DEFINE_STRUCT_CLK(mcspi1_ick, aes2_ick_parent_names, aes2_ick_ops);
2174
2175static struct clk mcspi2_fck;
2176
2177static struct clk_hw_omap mcspi2_fck_hw = {
2178 .hw = {
2179 .clk = &mcspi2_fck,
2180 },
2181 .ops = &clkhwops_wait,
2182 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2183 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
2184 .clkdm_name = "core_l4_clkdm",
2185};
2186
2187DEFINE_STRUCT_CLK(mcspi2_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2188
2189static struct clk mcspi2_ick;
2190
2191static struct clk_hw_omap mcspi2_ick_hw = {
2192 .hw = {
2193 .clk = &mcspi2_ick,
2194 },
2195 .ops = &clkhwops_iclk_wait,
2196 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2197 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
2198 .clkdm_name = "core_l4_clkdm",
2199};
2200
2201DEFINE_STRUCT_CLK(mcspi2_ick, aes2_ick_parent_names, aes2_ick_ops);
2202
2203static struct clk mcspi3_fck;
2204
2205static struct clk_hw_omap mcspi3_fck_hw = {
2206 .hw = {
2207 .clk = &mcspi3_fck,
2208 },
2209 .ops = &clkhwops_wait,
2210 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2211 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
2212 .clkdm_name = "core_l4_clkdm",
2213};
2214
2215DEFINE_STRUCT_CLK(mcspi3_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2216
2217static struct clk mcspi3_ick;
2218
2219static struct clk_hw_omap mcspi3_ick_hw = {
2220 .hw = {
2221 .clk = &mcspi3_ick,
2222 },
2223 .ops = &clkhwops_iclk_wait,
2224 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2225 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
2226 .clkdm_name = "core_l4_clkdm",
2227};
2228
2229DEFINE_STRUCT_CLK(mcspi3_ick, aes2_ick_parent_names, aes2_ick_ops);
2230
2231static struct clk mcspi4_fck;
2232
2233static struct clk_hw_omap mcspi4_fck_hw = {
2234 .hw = {
2235 .clk = &mcspi4_fck,
2236 },
2237 .ops = &clkhwops_wait,
2238 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2239 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
2240 .clkdm_name = "core_l4_clkdm",
2241};
2242
2243DEFINE_STRUCT_CLK(mcspi4_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2244
2245static struct clk mcspi4_ick;
2246
2247static struct clk_hw_omap mcspi4_ick_hw = {
2248 .hw = {
2249 .clk = &mcspi4_ick,
2250 },
2251 .ops = &clkhwops_iclk_wait,
2252 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2253 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
2254 .clkdm_name = "core_l4_clkdm",
2255};
2256
2257DEFINE_STRUCT_CLK(mcspi4_ick, aes2_ick_parent_names, aes2_ick_ops);
2258
2259static struct clk mmchs1_fck;
2260
2261static struct clk_hw_omap mmchs1_fck_hw = {
2262 .hw = {
2263 .clk = &mmchs1_fck,
2264 },
2265 .ops = &clkhwops_wait,
2266 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2267 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
2268 .clkdm_name = "core_l4_clkdm",
2269};
2270
2271DEFINE_STRUCT_CLK(mmchs1_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2272
2273static struct clk mmchs1_ick;
2274
2275static struct clk_hw_omap mmchs1_ick_hw = {
2276 .hw = {
2277 .clk = &mmchs1_ick,
2278 },
2279 .ops = &clkhwops_iclk_wait,
2280 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2281 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
2282 .clkdm_name = "core_l4_clkdm",
2283};
2284
2285DEFINE_STRUCT_CLK(mmchs1_ick, aes2_ick_parent_names, aes2_ick_ops);
2286
2287static struct clk mmchs2_fck;
2288
2289static struct clk_hw_omap mmchs2_fck_hw = {
2290 .hw = {
2291 .clk = &mmchs2_fck,
2292 },
2293 .ops = &clkhwops_wait,
2294 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2295 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
2296 .clkdm_name = "core_l4_clkdm",
2297};
2298
2299DEFINE_STRUCT_CLK(mmchs2_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2300
2301static struct clk mmchs2_ick;
2302
2303static struct clk_hw_omap mmchs2_ick_hw = {
2304 .hw = {
2305 .clk = &mmchs2_ick,
2306 },
2307 .ops = &clkhwops_iclk_wait,
2308 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2309 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
2310 .clkdm_name = "core_l4_clkdm",
2311};
2312
2313DEFINE_STRUCT_CLK(mmchs2_ick, aes2_ick_parent_names, aes2_ick_ops);
2314
2315static struct clk mmchs3_fck;
2316
2317static struct clk_hw_omap mmchs3_fck_hw = {
2318 .hw = {
2319 .clk = &mmchs3_fck,
2320 },
2321 .ops = &clkhwops_wait,
2322 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2323 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
2324 .clkdm_name = "core_l4_clkdm",
2325};
2326
2327DEFINE_STRUCT_CLK(mmchs3_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2328
2329static struct clk mmchs3_ick;
2330
2331static struct clk_hw_omap mmchs3_ick_hw = {
2332 .hw = {
2333 .clk = &mmchs3_ick,
2334 },
2335 .ops = &clkhwops_iclk_wait,
2336 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2337 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
2338 .clkdm_name = "core_l4_clkdm",
2339};
2340
2341DEFINE_STRUCT_CLK(mmchs3_ick, aes2_ick_parent_names, aes2_ick_ops);
2342
2343static struct clk modem_fck;
2344
2345static struct clk_hw_omap modem_fck_hw = {
2346 .hw = {
2347 .clk = &modem_fck,
2348 },
2349 .ops = &clkhwops_iclk_wait,
2350 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2351 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
2352 .clkdm_name = "d2d_clkdm",
2353};
2354
2355DEFINE_STRUCT_CLK(modem_fck, dpll3_ck_parent_names, aes2_ick_ops);
2356
2357static struct clk mspro_fck;
2358
2359static struct clk_hw_omap mspro_fck_hw = {
2360 .hw = {
2361 .clk = &mspro_fck,
2362 },
2363 .ops = &clkhwops_wait,
2364 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2365 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
2366 .clkdm_name = "core_l4_clkdm",
2367};
2368
2369DEFINE_STRUCT_CLK(mspro_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2370
2371static struct clk mspro_ick;
2372
2373static struct clk_hw_omap mspro_ick_hw = {
2374 .hw = {
2375 .clk = &mspro_ick,
2376 },
2377 .ops = &clkhwops_iclk_wait,
2378 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2379 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
2380 .clkdm_name = "core_l4_clkdm",
2381};
2382
2383DEFINE_STRUCT_CLK(mspro_ick, aes2_ick_parent_names, aes2_ick_ops);
2384
2385static struct clk omap_192m_alwon_fck;
2386
2387DEFINE_STRUCT_CLK_HW_OMAP(omap_192m_alwon_fck, NULL);
2388DEFINE_STRUCT_CLK(omap_192m_alwon_fck, omap_96m_alwon_fck_parent_names,
2389 core_ck_ops);
2390
2391static struct clk omap_32ksync_ick;
2392
2393static struct clk_hw_omap omap_32ksync_ick_hw = {
2394 .hw = {
2395 .clk = &omap_32ksync_ick,
2396 },
2397 .ops = &clkhwops_iclk_wait,
2398 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2399 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2400 .clkdm_name = "wkup_clkdm",
2401};
2402
2403DEFINE_STRUCT_CLK(omap_32ksync_ick, gpio1_ick_parent_names, aes2_ick_ops);
2404
2405static const struct clksel_rate omap_96m_alwon_fck_rates[] = {
2406 { .div = 1, .val = 1, .flags = RATE_IN_36XX },
2407 { .div = 2, .val = 2, .flags = RATE_IN_36XX },
2408 { .div = 0 }
2409};
2410
2411static const struct clksel omap_96m_alwon_fck_clksel[] = {
2412 { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates },
2413 { .parent = NULL }
2414};
2415
2416static struct clk omap_96m_alwon_fck_3630;
2417
2418static const char *omap_96m_alwon_fck_3630_parent_names[] = {
2419 "omap_192m_alwon_fck",
2420};
2421
2422static const struct clk_ops omap_96m_alwon_fck_3630_ops = {
2423 .set_rate = &omap2_clksel_set_rate,
2424 .recalc_rate = &omap2_clksel_recalc,
2425 .round_rate = &omap2_clksel_round_rate,
2426};
2427
2428static struct clk_hw_omap omap_96m_alwon_fck_3630_hw = {
2429 .hw = {
2430 .clk = &omap_96m_alwon_fck_3630,
2431 },
2432 .clksel = omap_96m_alwon_fck_clksel,
2433 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2434 .clksel_mask = OMAP3630_CLKSEL_96M_MASK,
2435};
2436
2437static struct clk omap_96m_alwon_fck_3630 = {
2438 .name = "omap_96m_alwon_fck",
2439 .hw = &omap_96m_alwon_fck_3630_hw.hw,
2440 .parent_names = omap_96m_alwon_fck_3630_parent_names,
2441 .num_parents = ARRAY_SIZE(omap_96m_alwon_fck_3630_parent_names),
2442 .ops = &omap_96m_alwon_fck_3630_ops,
2443};
2444
2445static struct clk omapctrl_ick;
2446
2447static struct clk_hw_omap omapctrl_ick_hw = {
2448 .hw = {
2449 .clk = &omapctrl_ick,
2450 },
2451 .ops = &clkhwops_iclk_wait,
2452 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2453 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
2454 .flags = ENABLE_ON_INIT,
2455 .clkdm_name = "core_l4_clkdm",
2456};
2457
2458DEFINE_STRUCT_CLK(omapctrl_ick, aes2_ick_parent_names, aes2_ick_ops);
2459
2460DEFINE_CLK_DIVIDER(pclk_fck, "emu_src_ck", &emu_src_ck, 0x0,
2461 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2462 OMAP3430_CLKSEL_PCLK_SHIFT, OMAP3430_CLKSEL_PCLK_WIDTH,
2463 CLK_DIVIDER_ONE_BASED, NULL);
2464
2465DEFINE_CLK_DIVIDER(pclkx2_fck, "emu_src_ck", &emu_src_ck, 0x0,
2466 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2467 OMAP3430_CLKSEL_PCLKX2_SHIFT, OMAP3430_CLKSEL_PCLKX2_WIDTH,
2468 CLK_DIVIDER_ONE_BASED, NULL);
2469
2470static struct clk per_48m_fck;
2471
2472DEFINE_STRUCT_CLK_HW_OMAP(per_48m_fck, "per_clkdm");
2473DEFINE_STRUCT_CLK(per_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops);
2474
2475static struct clk security_l3_ick;
2476
2477DEFINE_STRUCT_CLK_HW_OMAP(security_l3_ick, NULL);
2478DEFINE_STRUCT_CLK(security_l3_ick, core_l3_ick_parent_names, core_ck_ops);
2479
2480static struct clk pka_ick;
2481
2482static const char *pka_ick_parent_names[] = {
2483 "security_l3_ick",
2484};
2485
2486static struct clk_hw_omap pka_ick_hw = {
2487 .hw = {
2488 .clk = &pka_ick,
2489 },
2490 .ops = &clkhwops_iclk_wait,
2491 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2492 .enable_bit = OMAP3430_EN_PKA_SHIFT,
2493};
2494
2495DEFINE_STRUCT_CLK(pka_ick, pka_ick_parent_names, aes1_ick_ops);
2496
2497DEFINE_CLK_DIVIDER(rm_ick, "l4_ick", &l4_ick, 0x0,
2498 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2499 OMAP3430_CLKSEL_RM_SHIFT, OMAP3430_CLKSEL_RM_WIDTH,
2500 CLK_DIVIDER_ONE_BASED, NULL);
2501
2502static struct clk rng_ick;
2503
2504static struct clk_hw_omap rng_ick_hw = {
2505 .hw = {
2506 .clk = &rng_ick,
2507 },
2508 .ops = &clkhwops_iclk_wait,
2509 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2510 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2511};
2512
2513DEFINE_STRUCT_CLK(rng_ick, aes1_ick_parent_names, aes1_ick_ops);
2514
2515static struct clk sad2d_ick;
2516
2517static struct clk_hw_omap sad2d_ick_hw = {
2518 .hw = {
2519 .clk = &sad2d_ick,
2520 },
2521 .ops = &clkhwops_iclk_wait,
2522 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2523 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
2524 .clkdm_name = "d2d_clkdm",
2525};
2526
2527DEFINE_STRUCT_CLK(sad2d_ick, core_l3_ick_parent_names, aes2_ick_ops);
2528
2529static struct clk sdrc_ick;
2530
2531static struct clk_hw_omap sdrc_ick_hw = {
2532 .hw = {
2533 .clk = &sdrc_ick,
2534 },
2535 .ops = &clkhwops_wait,
2536 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2537 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
2538 .flags = ENABLE_ON_INIT,
2539 .clkdm_name = "core_l3_clkdm",
2540};
2541
2542DEFINE_STRUCT_CLK(sdrc_ick, ipss_ick_parent_names, aes2_ick_ops);
2543
2544static const struct clksel_rate sgx_core_rates[] = {
2545 { .div = 2, .val = 5, .flags = RATE_IN_36XX },
2546 { .div = 3, .val = 0, .flags = RATE_IN_3XXX },
2547 { .div = 4, .val = 1, .flags = RATE_IN_3XXX },
2548 { .div = 6, .val = 2, .flags = RATE_IN_3XXX },
2549 { .div = 0 }
2550};
2551
2552static const struct clksel_rate sgx_96m_rates[] = {
2553 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
2554 { .div = 0 }
2555};
2556
2557static const struct clksel_rate sgx_192m_rates[] = {
2558 { .div = 1, .val = 4, .flags = RATE_IN_36XX },
2559 { .div = 0 }
2560};
2561
2562static const struct clksel_rate sgx_corex2_rates[] = {
2563 { .div = 3, .val = 6, .flags = RATE_IN_36XX },
2564 { .div = 5, .val = 7, .flags = RATE_IN_36XX },
2565 { .div = 0 }
2566};
2567
2568static const struct clksel sgx_clksel[] = {
2569 { .parent = &core_ck, .rates = sgx_core_rates },
2570 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
2571 { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates },
2572 { .parent = &corex2_fck, .rates = sgx_corex2_rates },
2573 { .parent = NULL },
2574};
2575
2576static const char *sgx_fck_parent_names[] = {
2577 "core_ck", "cm_96m_fck", "omap_192m_alwon_fck", "corex2_fck",
2578};
2579
2580static struct clk sgx_fck;
2581
2582static const struct clk_ops sgx_fck_ops = {
2583 .init = &omap2_init_clk_clkdm,
2584 .enable = &omap2_dflt_clk_enable,
2585 .disable = &omap2_dflt_clk_disable,
2586 .is_enabled = &omap2_dflt_clk_is_enabled,
2587 .recalc_rate = &omap2_clksel_recalc,
2588 .set_rate = &omap2_clksel_set_rate,
2589 .round_rate = &omap2_clksel_round_rate,
2590 .get_parent = &omap2_clksel_find_parent_index,
2591 .set_parent = &omap2_clksel_set_parent,
2592};
2593
2594DEFINE_CLK_OMAP_MUX_GATE(sgx_fck, "sgx_clkdm", sgx_clksel,
2595 OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
2596 OMAP3430ES2_CLKSEL_SGX_MASK,
2597 OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
2598 OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
2599 &clkhwops_wait, sgx_fck_parent_names, sgx_fck_ops);
2600
2601static struct clk sgx_ick;
2602
2603static struct clk_hw_omap sgx_ick_hw = {
2604 .hw = {
2605 .clk = &sgx_ick,
2606 },
2607 .ops = &clkhwops_wait,
2608 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
2609 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
2610 .clkdm_name = "sgx_clkdm",
2611};
2612
2613DEFINE_STRUCT_CLK(sgx_ick, core_l3_ick_parent_names, aes2_ick_ops);
2614
2615static struct clk sha11_ick;
2616
2617static struct clk_hw_omap sha11_ick_hw = {
2618 .hw = {
2619 .clk = &sha11_ick,
2620 },
2621 .ops = &clkhwops_iclk_wait,
2622 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2623 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2624};
2625
2626DEFINE_STRUCT_CLK(sha11_ick, aes1_ick_parent_names, aes1_ick_ops);
2627
2628static struct clk sha12_ick;
2629
2630static struct clk_hw_omap sha12_ick_hw = {
2631 .hw = {
2632 .clk = &sha12_ick,
2633 },
2634 .ops = &clkhwops_iclk_wait,
2635 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2636 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
2637 .clkdm_name = "core_l4_clkdm",
2638};
2639
2640DEFINE_STRUCT_CLK(sha12_ick, aes2_ick_parent_names, aes2_ick_ops);
2641
2642static struct clk sr1_fck;
2643
2644static struct clk_hw_omap sr1_fck_hw = {
2645 .hw = {
2646 .clk = &sr1_fck,
2647 },
2648 .ops = &clkhwops_wait,
2649 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2650 .enable_bit = OMAP3430_EN_SR1_SHIFT,
2651 .clkdm_name = "wkup_clkdm",
2652};
2653
2654DEFINE_STRUCT_CLK(sr1_fck, dpll3_ck_parent_names, aes2_ick_ops);
2655
2656static struct clk sr2_fck;
2657
2658static struct clk_hw_omap sr2_fck_hw = {
2659 .hw = {
2660 .clk = &sr2_fck,
2661 },
2662 .ops = &clkhwops_wait,
2663 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2664 .enable_bit = OMAP3430_EN_SR2_SHIFT,
2665 .clkdm_name = "wkup_clkdm",
2666};
2667
2668DEFINE_STRUCT_CLK(sr2_fck, dpll3_ck_parent_names, aes2_ick_ops);
2669
2670static struct clk sr_l4_ick;
2671
2672DEFINE_STRUCT_CLK_HW_OMAP(sr_l4_ick, "core_l4_clkdm");
2673DEFINE_STRUCT_CLK(sr_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
2674
2675static struct clk ssi_l4_ick;
2676
2677DEFINE_STRUCT_CLK_HW_OMAP(ssi_l4_ick, "core_l4_clkdm");
2678DEFINE_STRUCT_CLK(ssi_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
2679
2680static struct clk ssi_ick_3430es1;
2681
2682static const char *ssi_ick_3430es1_parent_names[] = {
2683 "ssi_l4_ick",
2684};
2685
2686static struct clk_hw_omap ssi_ick_3430es1_hw = {
2687 .hw = {
2688 .clk = &ssi_ick_3430es1,
2689 },
2690 .ops = &clkhwops_iclk,
2691 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2692 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2693 .clkdm_name = "core_l4_clkdm",
2694};
2695
2696DEFINE_STRUCT_CLK(ssi_ick_3430es1, ssi_ick_3430es1_parent_names, aes2_ick_ops);
2697
2698static struct clk ssi_ick_3430es2;
2699
2700static struct clk_hw_omap ssi_ick_3430es2_hw = {
2701 .hw = {
2702 .clk = &ssi_ick_3430es2,
2703 },
2704 .ops = &clkhwops_omap3430es2_iclk_ssi_wait,
2705 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2706 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2707 .clkdm_name = "core_l4_clkdm",
2708};
2709
2710DEFINE_STRUCT_CLK(ssi_ick_3430es2, ssi_ick_3430es1_parent_names, aes2_ick_ops);
2711
2712static const struct clksel_rate ssi_ssr_corex2_rates[] = {
2713 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2714 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2715 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2716 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2717 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
2718 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
2719 { .div = 0 }
2720};
2721
2722static const struct clksel ssi_ssr_clksel[] = {
2723 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
2724 { .parent = NULL },
2725};
2726
2727static const char *ssi_ssr_fck_3430es1_parent_names[] = {
2728 "corex2_fck",
2729};
2730
2731static const struct clk_ops ssi_ssr_fck_3430es1_ops = {
2732 .init = &omap2_init_clk_clkdm,
2733 .enable = &omap2_dflt_clk_enable,
2734 .disable = &omap2_dflt_clk_disable,
2735 .is_enabled = &omap2_dflt_clk_is_enabled,
2736 .recalc_rate = &omap2_clksel_recalc,
2737 .set_rate = &omap2_clksel_set_rate,
2738 .round_rate = &omap2_clksel_round_rate,
2739};
2740
2741DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es1, "core_l4_clkdm",
2742 ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2743 OMAP3430_CLKSEL_SSI_MASK,
2744 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2745 OMAP3430_EN_SSI_SHIFT,
2746 NULL, ssi_ssr_fck_3430es1_parent_names,
2747 ssi_ssr_fck_3430es1_ops);
2748
2749DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es2, "core_l4_clkdm",
2750 ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2751 OMAP3430_CLKSEL_SSI_MASK,
2752 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2753 OMAP3430_EN_SSI_SHIFT,
2754 NULL, ssi_ssr_fck_3430es1_parent_names,
2755 ssi_ssr_fck_3430es1_ops);
2756
2757DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es1, "ssi_ssr_fck_3430es1",
2758 &ssi_ssr_fck_3430es1, 0x0, 1, 2);
2759
2760DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es2, "ssi_ssr_fck_3430es2",
2761 &ssi_ssr_fck_3430es2, 0x0, 1, 2);
2762
2763static struct clk sys_clkout1;
2764
2765static const char *sys_clkout1_parent_names[] = {
2766 "osc_sys_ck",
2767};
2768
2769static struct clk_hw_omap sys_clkout1_hw = {
2770 .hw = {
2771 .clk = &sys_clkout1,
2772 },
2773 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
2774 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
2775};
2776
2777DEFINE_STRUCT_CLK(sys_clkout1, sys_clkout1_parent_names, aes1_ick_ops);
2778
2779DEFINE_CLK_DIVIDER(sys_clkout2, "clkout2_src_ck", &clkout2_src_ck, 0x0,
2780 OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_DIV_SHIFT,
2781 OMAP3430_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
2782
2783DEFINE_CLK_MUX(traceclk_src_fck, emu_src_ck_parent_names, NULL, 0x0,
2784 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2785 OMAP3430_TRACE_MUX_CTRL_SHIFT, OMAP3430_TRACE_MUX_CTRL_WIDTH,
2786 0x0, NULL);
2787
2788DEFINE_CLK_DIVIDER(traceclk_fck, "traceclk_src_fck", &traceclk_src_fck, 0x0,
2789 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2790 OMAP3430_CLKSEL_TRACECLK_SHIFT,
2791 OMAP3430_CLKSEL_TRACECLK_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
2792
2793static struct clk ts_fck;
2794
2795static struct clk_hw_omap ts_fck_hw = {
2796 .hw = {
2797 .clk = &ts_fck,
2798 },
2799 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
2800 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
2801 .clkdm_name = "core_l4_clkdm",
2802};
2803
2804DEFINE_STRUCT_CLK(ts_fck, wkup_32k_fck_parent_names, aes2_ick_ops);
2805
2806static struct clk uart1_fck;
2807
2808static struct clk_hw_omap uart1_fck_hw = {
2809 .hw = {
2810 .clk = &uart1_fck,
2811 },
2812 .ops = &clkhwops_wait,
2813 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2814 .enable_bit = OMAP3430_EN_UART1_SHIFT,
2815 .clkdm_name = "core_l4_clkdm",
2816};
2817
2818DEFINE_STRUCT_CLK(uart1_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2819
2820static struct clk uart1_ick;
2821
2822static struct clk_hw_omap uart1_ick_hw = {
2823 .hw = {
2824 .clk = &uart1_ick,
2825 },
2826 .ops = &clkhwops_iclk_wait,
2827 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2828 .enable_bit = OMAP3430_EN_UART1_SHIFT,
2829 .clkdm_name = "core_l4_clkdm",
2830};
2831
2832DEFINE_STRUCT_CLK(uart1_ick, aes2_ick_parent_names, aes2_ick_ops);
2833
2834static struct clk uart2_fck;
2835
2836static struct clk_hw_omap uart2_fck_hw = {
2837 .hw = {
2838 .clk = &uart2_fck,
2839 },
2840 .ops = &clkhwops_wait,
2841 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2842 .enable_bit = OMAP3430_EN_UART2_SHIFT,
2843 .clkdm_name = "core_l4_clkdm",
2844};
2845
2846DEFINE_STRUCT_CLK(uart2_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2847
2848static struct clk uart2_ick;
2849
2850static struct clk_hw_omap uart2_ick_hw = {
2851 .hw = {
2852 .clk = &uart2_ick,
2853 },
2854 .ops = &clkhwops_iclk_wait,
2855 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2856 .enable_bit = OMAP3430_EN_UART2_SHIFT,
2857 .clkdm_name = "core_l4_clkdm",
2858};
2859
2860DEFINE_STRUCT_CLK(uart2_ick, aes2_ick_parent_names, aes2_ick_ops);
2861
2862static struct clk uart3_fck;
2863
2864static const char *uart3_fck_parent_names[] = {
2865 "per_48m_fck",
2866};
2867
2868static struct clk_hw_omap uart3_fck_hw = {
2869 .hw = {
2870 .clk = &uart3_fck,
2871 },
2872 .ops = &clkhwops_wait,
2873 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2874 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2875 .clkdm_name = "per_clkdm",
2876};
2877
2878DEFINE_STRUCT_CLK(uart3_fck, uart3_fck_parent_names, aes2_ick_ops);
2879
2880static struct clk uart3_ick;
2881
2882static struct clk_hw_omap uart3_ick_hw = {
2883 .hw = {
2884 .clk = &uart3_ick,
2885 },
2886 .ops = &clkhwops_iclk_wait,
2887 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2888 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2889 .clkdm_name = "per_clkdm",
2890};
2891
2892DEFINE_STRUCT_CLK(uart3_ick, gpio2_ick_parent_names, aes2_ick_ops);
2893
2894static struct clk uart4_fck;
2895
2896static struct clk_hw_omap uart4_fck_hw = {
2897 .hw = {
2898 .clk = &uart4_fck,
2899 },
2900 .ops = &clkhwops_wait,
2901 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2902 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2903 .clkdm_name = "per_clkdm",
2904};
2905
2906DEFINE_STRUCT_CLK(uart4_fck, uart3_fck_parent_names, aes2_ick_ops);
2907
2908static struct clk uart4_fck_am35xx;
2909
2910static struct clk_hw_omap uart4_fck_am35xx_hw = {
2911 .hw = {
2912 .clk = &uart4_fck_am35xx,
2913 },
2914 .ops = &clkhwops_wait,
2915 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2916 .enable_bit = AM35XX_EN_UART4_SHIFT,
2917 .clkdm_name = "core_l4_clkdm",
2918};
2919
2920DEFINE_STRUCT_CLK(uart4_fck_am35xx, fshostusb_fck_parent_names, aes2_ick_ops);
2921
2922static struct clk uart4_ick;
2923
2924static struct clk_hw_omap uart4_ick_hw = {
2925 .hw = {
2926 .clk = &uart4_ick,
2927 },
2928 .ops = &clkhwops_iclk_wait,
2929 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2930 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2931 .clkdm_name = "per_clkdm",
2932};
2933
2934DEFINE_STRUCT_CLK(uart4_ick, gpio2_ick_parent_names, aes2_ick_ops);
2935
2936static struct clk uart4_ick_am35xx;
2937
2938static struct clk_hw_omap uart4_ick_am35xx_hw = {
2939 .hw = {
2940 .clk = &uart4_ick_am35xx,
2941 },
2942 .ops = &clkhwops_iclk_wait,
2943 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2944 .enable_bit = AM35XX_EN_UART4_SHIFT,
2945 .clkdm_name = "core_l4_clkdm",
2946};
2947
2948DEFINE_STRUCT_CLK(uart4_ick_am35xx, aes2_ick_parent_names, aes2_ick_ops);
2949
2950static const struct clksel_rate div2_rates[] = {
2951 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2952 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2953 { .div = 0 }
2954};
2955
2956static const struct clksel usb_l4_clksel[] = {
2957 { .parent = &l4_ick, .rates = div2_rates },
2958 { .parent = NULL },
2959};
2960
2961static const char *usb_l4_ick_parent_names[] = {
2962 "l4_ick",
2963};
2964
2965DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_clksel,
2966 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2967 OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2968 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2969 OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2970 &clkhwops_iclk_wait, usb_l4_ick_parent_names,
2971 ssi_ssr_fck_3430es1_ops);
2972
2973static struct clk usbhost_120m_fck;
2974
2975static const char *usbhost_120m_fck_parent_names[] = {
2976 "dpll5_m2_ck",
2977};
2978
2979static struct clk_hw_omap usbhost_120m_fck_hw = {
2980 .hw = {
2981 .clk = &usbhost_120m_fck,
2982 },
2983 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2984 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2985 .clkdm_name = "usbhost_clkdm",
2986};
2987
2988DEFINE_STRUCT_CLK(usbhost_120m_fck, usbhost_120m_fck_parent_names,
2989 aes2_ick_ops);
2990
2991static struct clk usbhost_48m_fck;
2992
2993static struct clk_hw_omap usbhost_48m_fck_hw = {
2994 .hw = {
2995 .clk = &usbhost_48m_fck,
2996 },
2997 .ops = &clkhwops_omap3430es2_dss_usbhost_wait,
2998 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2999 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
3000 .clkdm_name = "usbhost_clkdm",
3001};
3002
3003DEFINE_STRUCT_CLK(usbhost_48m_fck, core_48m_fck_parent_names, aes2_ick_ops);
3004
3005static struct clk usbhost_ick;
3006
3007static struct clk_hw_omap usbhost_ick_hw = {
3008 .hw = {
3009 .clk = &usbhost_ick,
3010 },
3011 .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait,
3012 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
3013 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
3014 .clkdm_name = "usbhost_clkdm",
3015};
3016
3017DEFINE_STRUCT_CLK(usbhost_ick, security_l4_ick2_parent_names, aes2_ick_ops);
3018
3019static struct clk usbtll_fck;
3020
3021static struct clk_hw_omap usbtll_fck_hw = {
3022 .hw = {
3023 .clk = &usbtll_fck,
3024 },
3025 .ops = &clkhwops_wait,
3026 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
3027 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3028 .clkdm_name = "core_l4_clkdm",
3029};
3030
3031DEFINE_STRUCT_CLK(usbtll_fck, usbhost_120m_fck_parent_names, aes2_ick_ops);
3032
3033static struct clk usbtll_ick;
3034
3035static struct clk_hw_omap usbtll_ick_hw = {
3036 .hw = {
3037 .clk = &usbtll_ick,
3038 },
3039 .ops = &clkhwops_iclk_wait,
3040 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
3041 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3042 .clkdm_name = "core_l4_clkdm",
3043};
3044
3045DEFINE_STRUCT_CLK(usbtll_ick, aes2_ick_parent_names, aes2_ick_ops);
3046
3047static const struct clksel_rate usim_96m_rates[] = {
3048 { .div = 2, .val = 3, .flags = RATE_IN_3XXX },
3049 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
3050 { .div = 8, .val = 5, .flags = RATE_IN_3XXX },
3051 { .div = 10, .val = 6, .flags = RATE_IN_3XXX },
3052 { .div = 0 }
3053};
3054
3055static const struct clksel_rate usim_120m_rates[] = {
3056 { .div = 4, .val = 7, .flags = RATE_IN_3XXX },
3057 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
3058 { .div = 16, .val = 9, .flags = RATE_IN_3XXX },
3059 { .div = 20, .val = 10, .flags = RATE_IN_3XXX },
3060 { .div = 0 }
3061};
3062
3063static const struct clksel usim_clksel[] = {
3064 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
3065 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
3066 { .parent = &sys_ck, .rates = div2_rates },
3067 { .parent = NULL },
3068};
3069
3070static const char *usim_fck_parent_names[] = {
3071 "omap_96m_fck", "dpll5_m2_ck", "sys_ck",
3072};
3073
3074static struct clk usim_fck;
3075
3076static const struct clk_ops usim_fck_ops = {
3077 .enable = &omap2_dflt_clk_enable,
3078 .disable = &omap2_dflt_clk_disable,
3079 .is_enabled = &omap2_dflt_clk_is_enabled,
3080 .recalc_rate = &omap2_clksel_recalc,
3081 .get_parent = &omap2_clksel_find_parent_index,
3082 .set_parent = &omap2_clksel_set_parent,
3083};
3084
3085DEFINE_CLK_OMAP_MUX_GATE(usim_fck, NULL, usim_clksel,
3086 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
3087 OMAP3430ES2_CLKSEL_USIMOCP_MASK,
3088 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3089 OMAP3430ES2_EN_USIMOCP_SHIFT, &clkhwops_wait,
3090 usim_fck_parent_names, usim_fck_ops);
3091
3092static struct clk usim_ick;
3093
3094static struct clk_hw_omap usim_ick_hw = {
3095 .hw = {
3096 .clk = &usim_ick,
3097 },
3098 .ops = &clkhwops_iclk_wait,
3099 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3100 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
3101 .clkdm_name = "wkup_clkdm",
3102};
3103
3104DEFINE_STRUCT_CLK(usim_ick, gpio1_ick_parent_names, aes2_ick_ops);
3105
3106static struct clk vpfe_fck;
3107
3108static const char *vpfe_fck_parent_names[] = {
3109 "pclk_ck",
3110};
3111
3112static struct clk_hw_omap vpfe_fck_hw = {
3113 .hw = {
3114 .clk = &vpfe_fck,
3115 },
3116 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3117 .enable_bit = AM35XX_VPFE_FCLK_SHIFT,
3118};
3119
3120DEFINE_STRUCT_CLK(vpfe_fck, vpfe_fck_parent_names, aes1_ick_ops);
3121
3122static struct clk vpfe_ick;
3123
3124static struct clk_hw_omap vpfe_ick_hw = {
3125 .hw = {
3126 .clk = &vpfe_ick,
3127 },
3128 .ops = &clkhwops_am35xx_ipss_module_wait,
3129 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3130 .enable_bit = AM35XX_VPFE_VBUSP_CLK_SHIFT,
3131 .clkdm_name = "core_l3_clkdm",
3132};
3133
3134DEFINE_STRUCT_CLK(vpfe_ick, emac_ick_parent_names, aes2_ick_ops);
3135
3136static struct clk wdt1_fck;
3137
3138DEFINE_STRUCT_CLK_HW_OMAP(wdt1_fck, "wkup_clkdm");
3139DEFINE_STRUCT_CLK(wdt1_fck, gpt12_fck_parent_names, core_l4_ick_ops);
3140
3141static struct clk wdt1_ick;
3142
3143static struct clk_hw_omap wdt1_ick_hw = {
3144 .hw = {
3145 .clk = &wdt1_ick,
3146 },
3147 .ops = &clkhwops_iclk_wait,
3148 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3149 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
3150 .clkdm_name = "wkup_clkdm",
3151};
3152
3153DEFINE_STRUCT_CLK(wdt1_ick, gpio1_ick_parent_names, aes2_ick_ops);
3154
3155static struct clk wdt2_fck;
3156
3157static struct clk_hw_omap wdt2_fck_hw = {
3158 .hw = {
3159 .clk = &wdt2_fck,
3160 },
3161 .ops = &clkhwops_wait,
3162 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3163 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
3164 .clkdm_name = "wkup_clkdm",
3165};
3166
3167DEFINE_STRUCT_CLK(wdt2_fck, gpio1_dbck_parent_names, aes2_ick_ops);
3168
3169static struct clk wdt2_ick;
3170
3171static struct clk_hw_omap wdt2_ick_hw = {
3172 .hw = {
3173 .clk = &wdt2_ick,
3174 },
3175 .ops = &clkhwops_iclk_wait,
3176 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3177 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
3178 .clkdm_name = "wkup_clkdm",
3179};
3180
3181DEFINE_STRUCT_CLK(wdt2_ick, gpio1_ick_parent_names, aes2_ick_ops);
3182
3183static struct clk wdt3_fck;
3184
3185static struct clk_hw_omap wdt3_fck_hw = {
3186 .hw = {
3187 .clk = &wdt3_fck,
3188 },
3189 .ops = &clkhwops_wait,
3190 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
3191 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
3192 .clkdm_name = "per_clkdm",
3193};
3194
3195DEFINE_STRUCT_CLK(wdt3_fck, gpio2_dbck_parent_names, aes2_ick_ops);
3196
3197static struct clk wdt3_ick;
3198
3199static struct clk_hw_omap wdt3_ick_hw = {
3200 .hw = {
3201 .clk = &wdt3_ick,
3202 },
3203 .ops = &clkhwops_iclk_wait,
3204 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
3205 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
3206 .clkdm_name = "per_clkdm",
3207};
3208
3209DEFINE_STRUCT_CLK(wdt3_ick, gpio2_ick_parent_names, aes2_ick_ops);
3210
3211/*
3212 * clkdev
3213 */
3214static struct omap_clk omap3xxx_clks[] = {
3215 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3216 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3217 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3218 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
3219 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3220 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
3221 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
3222 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
3223 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
3224 CLK("twl", "fck", &osc_sys_ck, CK_3XXX),
3225 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
3226 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
3227 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
3228 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
3229 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
3230 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_3XXX),
3231 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_3XXX),
3232 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_34XX | CK_36XX),
3233 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_34XX | CK_36XX),
3234 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_3XXX),
3235 CLK(NULL, "core_ck", &core_ck, CK_3XXX),
3236 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_3XXX),
3237 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_3XXX),
3238 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX),
3239 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX),
3240 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX),
3241 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3242 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX),
3243 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX),
3244 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX),
3245 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX),
3246 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX),
3247 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
3248 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX),
3249 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_3XXX),
3250 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_3XXX),
3251 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_3XXX),
3252 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_3XXX),
3253 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_3XXX),
3254 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_3XXX),
3255 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_3XXX),
3256 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_3XXX),
3257 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_3XXX),
3258 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX),
3259 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX),
3260 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX),
3261 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3262 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3263 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3264 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_3XXX),
3265 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_3XXX),
3266 CLK(NULL, "corex2_fck", &corex2_fck, CK_3XXX),
3267 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX),
3268 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX),
3269 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX),
3270 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3271 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX),
3272 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX),
3273 CLK(NULL, "l3_ick", &l3_ick, CK_3XXX),
3274 CLK(NULL, "l4_ick", &l4_ick, CK_3XXX),
3275 CLK(NULL, "rm_ick", &rm_ick, CK_3XXX),
3276 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
3277 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
3278 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3279 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3280 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3281 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3282 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3283 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3284 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX),
3285 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX),
3286 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_34XX | CK_36XX),
3287 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_3XXX),
3288 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_3XXX),
3289 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3290 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3291 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3292 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3293 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3294 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3295 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3296 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
3297 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX),
3298 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX),
3299 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX),
3300 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX),
3301 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX),
3302 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX),
3303 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX),
3304 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX),
3305 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX),
3306 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX),
3307 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX),
3308 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX),
3309 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX),
3310 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX),
3311 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3312 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3313 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3314 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX),
3315 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3316 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3317 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
3318 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3319 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
3320 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3321 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3322 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3323 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3324 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
3325 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
3326 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX),
3327 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX),
3328 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3329 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3330 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3331 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3332 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3333 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3334 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3335 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
3336 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX),
3337 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX),
3338 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX),
3339 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX),
3340 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX),
3341 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX),
3342 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX),
3343 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX),
3344 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX),
3345 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX),
3346 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX),
3347 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX),
3348 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX),
3349 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX),
3350 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX),
3351 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX),
3352 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX),
3353 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX),
3354 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX),
3355 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX),
3356 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX),
3357 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX),
3358 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX),
3359 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX),
3360 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX),
3361 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX),
3362 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX),
3363 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX),
3364 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX),
3365 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX),
3366 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX),
3367 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3368 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX),
3369 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX),
3370 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_34XX | CK_36XX),
3371 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
3372 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3373 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
3374 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_34XX | CK_36XX),
3375 CLK(NULL, "aes1_ick", &aes1_ick, CK_34XX | CK_36XX),
3376 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX),
3377 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX),
3378 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX),
3379 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3380 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3381 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX),
3382 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3383 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3384 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3385 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1),
3386 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3387 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3388 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
3389 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3390 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
3391 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3392 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3393 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3394 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3395 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3396 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3397 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3398 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3399 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3400 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3401 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3402 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3403 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3404 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3405 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3406 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3407 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3408 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3409 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3410 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3411 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3412 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3413 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3414 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3415 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3416 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3417 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3418 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3419 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3420 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3421 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3422 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3423 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3424 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3425 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3426 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3427 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
3428 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_3XXX),
3429 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_3XXX),
3430 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_3XXX),
3431 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_3XXX),
3432 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_3XXX),
3433 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
3434 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_3XXX),
3435 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_3XXX),
3436 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_3XXX),
3437 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_3XXX),
3438 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_3XXX),
3439 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_3XXX),
3440 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_3XXX),
3441 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_3XXX),
3442 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_3XXX),
3443 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_3XXX),
3444 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_3XXX),
3445 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3446 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3447 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3448 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3449 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3450 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3451 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
3452 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_3XXX),
3453 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_3XXX),
3454 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_3XXX),
3455 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_3XXX),
3456 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_3XXX),
3457 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3458 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3459 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3460 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3461 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3462 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3463 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3464 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3465 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3466 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3467 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3468 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3469 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
3470 CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX),
3471 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
3472 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX),
3473 CLK(NULL, "sr1_fck", &sr1_fck, CK_34XX | CK_36XX),
3474 CLK(NULL, "sr2_fck", &sr2_fck, CK_34XX | CK_36XX),
3475 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX),
3476 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX),
3477 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX),
3478 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_3XXX),
3479 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3480 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3481 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3482 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3483 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3484 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3485 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3486 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3487 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3488 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3489 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3490 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3491 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3492 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3493 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3494 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3495};
3496
3497static const char *enable_init_clks[] = {
3498 "sdrc_ick",
3499 "gpmc_fck",
3500 "omapctrl_ick",
3501};
3502
3503int __init omap3xxx_clk_init(void)
3504{
3505 struct omap_clk *c;
3506 u32 cpu_clkflg = 0;
3507
3508 /*
3509 * 3505 must be tested before 3517, since 3517 returns true
3510 * for both AM3517 chips and AM3517 family chips, which
3511 * includes 3505. Unfortunately there's no obvious family
3512 * test for 3517/3505 :-(
3513 */
3514 if (soc_is_am35xx()) {
3515 cpu_mask = RATE_IN_34XX;
3516 cpu_clkflg = CK_AM35XX;
3517 } else if (cpu_is_omap3630()) {
3518 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3519 cpu_clkflg = CK_36XX;
3520 } else if (cpu_is_ti816x()) {
3521 cpu_mask = RATE_IN_TI816X;
3522 cpu_clkflg = CK_TI816X;
3523 } else if (soc_is_am33xx()) {
3524 cpu_mask = RATE_IN_AM33XX;
3525 } else if (cpu_is_ti814x()) {
3526 cpu_mask = RATE_IN_TI814X;
3527 } else if (cpu_is_omap34xx()) {
3528 if (omap_rev() == OMAP3430_REV_ES1_0) {
3529 cpu_mask = RATE_IN_3430ES1;
3530 cpu_clkflg = CK_3430ES1;
3531 } else {
3532 /*
3533 * Assume that anything that we haven't matched yet
3534 * has 3430ES2-type clocks.
3535 */
3536 cpu_mask = RATE_IN_3430ES2PLUS;
3537 cpu_clkflg = CK_3430ES2PLUS;
3538 }
3539 } else {
3540 WARN(1, "clock: could not identify OMAP3 variant\n");
3541 }
3542
3543 if (omap3_has_192mhz_clk())
3544 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3545
3546 if (cpu_is_omap3630()) {
3547 dpll3_m3x2_ck = dpll3_m3x2_ck_3630;
3548 dpll4_m2x2_ck = dpll4_m2x2_ck_3630;
3549 dpll4_m3x2_ck = dpll4_m3x2_ck_3630;
3550 dpll4_m4x2_ck = dpll4_m4x2_ck_3630;
3551 dpll4_m5x2_ck = dpll4_m5x2_ck_3630;
3552 dpll4_m6x2_ck = dpll4_m6x2_ck_3630;
3553 }
3554
3555 /*
3556 * XXX This type of dynamic rewriting of the clock tree is
3557 * deprecated and should be revised soon.
3558 */
3559 if (cpu_is_omap3630())
3560 dpll4_dd = dpll4_dd_3630;
3561 else
3562 dpll4_dd = dpll4_dd_34xx;
3563
3564 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3565 c++)
3566 if (c->cpu & cpu_clkflg) {
3567 clkdev_add(&c->lk);
3568 if (!__clk_init(NULL, c->lk.clk))
3569 omap2_init_clk_hw_omap_clocks(c->lk.clk);
3570 }
3571
3572 omap2_clk_disable_autoidle_all();
3573
3574 omap2_clk_enable_init_clocks(enable_init_clks,
3575 ARRAY_SIZE(enable_init_clks));
3576
3577 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
3578 (clk_get_rate(&osc_sys_ck) / 1000000),
3579 (clk_get_rate(&osc_sys_ck) / 100000) % 10,
3580 (clk_get_rate(&core_ck) / 1000000),
3581 (clk_get_rate(&arm_fck) / 1000000));
3582
3583 /*
3584 * Lock DPLL5 -- here only until other device init code can
3585 * handle this
3586 */
3587 if (!cpu_is_ti81xx() && (omap_rev() >= OMAP3430_REV_ES2_0))
3588 omap3_clk_lock_dpll5();
3589
3590 /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
3591 sdrc_ick_p = clk_get(NULL, "sdrc_ick");
3592 arm_fck_p = clk_get(NULL, "arm_fck");
3593
3594 return 0;
3595}
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
new file mode 100644
index 00000000000..aa56c3e5bb3
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -0,0 +1,1987 @@
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
21#include <linux/kernel.h>
22#include <linux/list.h>
23#include <linux/clk-private.h>
24#include <linux/clkdev.h>
25#include <linux/io.h>
26
27#include "soc.h"
28#include "iomap.h"
29#include "clock.h"
30#include "clock44xx.h"
31#include "cm1_44xx.h"
32#include "cm2_44xx.h"
33#include "cm-regbits-44xx.h"
34#include "prm44xx.h"
35#include "prm-regbits-44xx.h"
36#include "control.h"
37#include "scrm44xx.h"
38
39/* OMAP4 modulemode control */
40#define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0
41#define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1
42
43/* Root clocks */
44
45DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
46
47DEFINE_CLK_FIXED_RATE(pad_clks_src_ck, CLK_IS_ROOT, 12000000, 0x0);
48
49DEFINE_CLK_GATE(pad_clks_ck, "pad_clks_src_ck", &pad_clks_src_ck, 0x0,
50 OMAP4430_CM_CLKSEL_ABE, OMAP4430_PAD_CLKS_GATE_SHIFT,
51 0x0, NULL);
52
53DEFINE_CLK_FIXED_RATE(pad_slimbus_core_clks_ck, CLK_IS_ROOT, 12000000, 0x0);
54
55DEFINE_CLK_FIXED_RATE(secure_32k_clk_src_ck, CLK_IS_ROOT, 32768, 0x0);
56
57DEFINE_CLK_FIXED_RATE(slimbus_src_clk, CLK_IS_ROOT, 12000000, 0x0);
58
59DEFINE_CLK_GATE(slimbus_clk, "slimbus_src_clk", &slimbus_src_clk, 0x0,
60 OMAP4430_CM_CLKSEL_ABE, OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
61 0x0, NULL);
62
63DEFINE_CLK_FIXED_RATE(sys_32k_ck, CLK_IS_ROOT, 32768, 0x0);
64
65DEFINE_CLK_FIXED_RATE(virt_12000000_ck, CLK_IS_ROOT, 12000000, 0x0);
66
67DEFINE_CLK_FIXED_RATE(virt_13000000_ck, CLK_IS_ROOT, 13000000, 0x0);
68
69DEFINE_CLK_FIXED_RATE(virt_16800000_ck, CLK_IS_ROOT, 16800000, 0x0);
70
71DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
72
73DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
74
75DEFINE_CLK_FIXED_RATE(virt_27000000_ck, CLK_IS_ROOT, 27000000, 0x0);
76
77DEFINE_CLK_FIXED_RATE(virt_38400000_ck, CLK_IS_ROOT, 38400000, 0x0);
78
79static const char *sys_clkin_ck_parents[] = {
80 "virt_12000000_ck", "virt_13000000_ck", "virt_16800000_ck",
81 "virt_19200000_ck", "virt_26000000_ck", "virt_27000000_ck",
82 "virt_38400000_ck",
83};
84
85DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
86 OMAP4430_CM_SYS_CLKSEL, OMAP4430_SYS_CLKSEL_SHIFT,
87 OMAP4430_SYS_CLKSEL_WIDTH, CLK_MUX_INDEX_ONE, NULL);
88
89DEFINE_CLK_FIXED_RATE(tie_low_clock_ck, CLK_IS_ROOT, 0, 0x0);
90
91DEFINE_CLK_FIXED_RATE(utmi_phy_clkout_ck, CLK_IS_ROOT, 60000000, 0x0);
92
93DEFINE_CLK_FIXED_RATE(xclk60mhsp1_ck, CLK_IS_ROOT, 60000000, 0x0);
94
95DEFINE_CLK_FIXED_RATE(xclk60mhsp2_ck, CLK_IS_ROOT, 60000000, 0x0);
96
97DEFINE_CLK_FIXED_RATE(xclk60motg_ck, CLK_IS_ROOT, 60000000, 0x0);
98
99/* Module clocks and DPLL outputs */
100
101static const char *abe_dpll_bypass_clk_mux_ck_parents[] = {
102 "sys_clkin_ck", "sys_32k_ck",
103};
104
105DEFINE_CLK_MUX(abe_dpll_bypass_clk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents,
106 NULL, 0x0, OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_SHIFT,
107 OMAP4430_CLKSEL_WIDTH, 0x0, NULL);
108
109DEFINE_CLK_MUX(abe_dpll_refclk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents, NULL,
110 0x0, OMAP4430_CM_ABE_PLL_REF_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
111 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
112
113/* DPLL_ABE */
114static struct dpll_data dpll_abe_dd = {
115 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
116 .clk_bypass = &abe_dpll_bypass_clk_mux_ck,
117 .clk_ref = &abe_dpll_refclk_mux_ck,
118 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
119 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
120 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
121 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
122 .mult_mask = OMAP4430_DPLL_MULT_MASK,
123 .div1_mask = OMAP4430_DPLL_DIV_MASK,
124 .enable_mask = OMAP4430_DPLL_EN_MASK,
125 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
126 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
127 .max_multiplier = 2047,
128 .max_divider = 128,
129 .min_divider = 1,
130};
131
132
133static const char *dpll_abe_ck_parents[] = {
134 "abe_dpll_refclk_mux_ck",
135};
136
137static struct clk dpll_abe_ck;
138
139static const struct clk_ops dpll_abe_ck_ops = {
140 .enable = &omap3_noncore_dpll_enable,
141 .disable = &omap3_noncore_dpll_disable,
142 .recalc_rate = &omap4_dpll_regm4xen_recalc,
143 .round_rate = &omap4_dpll_regm4xen_round_rate,
144 .set_rate = &omap3_noncore_dpll_set_rate,
145 .get_parent = &omap2_init_dpll_parent,
146};
147
148static struct clk_hw_omap dpll_abe_ck_hw = {
149 .hw = {
150 .clk = &dpll_abe_ck,
151 },
152 .dpll_data = &dpll_abe_dd,
153 .ops = &clkhwops_omap3_dpll,
154};
155
156DEFINE_STRUCT_CLK(dpll_abe_ck, dpll_abe_ck_parents, dpll_abe_ck_ops);
157
158static const char *dpll_abe_x2_ck_parents[] = {
159 "dpll_abe_ck",
160};
161
162static struct clk dpll_abe_x2_ck;
163
164static const struct clk_ops dpll_abe_x2_ck_ops = {
165 .recalc_rate = &omap3_clkoutx2_recalc,
166};
167
168static struct clk_hw_omap dpll_abe_x2_ck_hw = {
169 .hw = {
170 .clk = &dpll_abe_x2_ck,
171 },
172 .flags = CLOCK_CLKOUTX2,
173 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
174 .ops = &clkhwops_omap4_dpllmx,
175};
176
177DEFINE_STRUCT_CLK(dpll_abe_x2_ck, dpll_abe_x2_ck_parents, dpll_abe_x2_ck_ops);
178
179static const struct clk_ops omap_hsdivider_ops = {
180 .set_rate = &omap2_clksel_set_rate,
181 .recalc_rate = &omap2_clksel_recalc,
182 .round_rate = &omap2_clksel_round_rate,
183};
184
185DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m2x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
186 0x0, OMAP4430_CM_DIV_M2_DPLL_ABE,
187 OMAP4430_DPLL_CLKOUT_DIV_MASK);
188
189DEFINE_CLK_FIXED_FACTOR(abe_24m_fclk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
190 0x0, 1, 8);
191
192DEFINE_CLK_DIVIDER(abe_clk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, 0x0,
193 OMAP4430_CM_CLKSEL_ABE, OMAP4430_CLKSEL_OPP_SHIFT,
194 OMAP4430_CLKSEL_OPP_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
195
196DEFINE_CLK_DIVIDER(aess_fclk, "abe_clk", &abe_clk, 0x0,
197 OMAP4430_CM1_ABE_AESS_CLKCTRL,
198 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
199 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
200 0x0, NULL);
201
202DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m3x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
203 0x0, OMAP4430_CM_DIV_M3_DPLL_ABE,
204 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK);
205
206static const char *core_hsd_byp_clk_mux_ck_parents[] = {
207 "sys_clkin_ck", "dpll_abe_m3x2_ck",
208};
209
210DEFINE_CLK_MUX(core_hsd_byp_clk_mux_ck, core_hsd_byp_clk_mux_ck_parents, NULL,
211 0x0, OMAP4430_CM_CLKSEL_DPLL_CORE,
212 OMAP4430_DPLL_BYP_CLKSEL_SHIFT, OMAP4430_DPLL_BYP_CLKSEL_WIDTH,
213 0x0, NULL);
214
215/* DPLL_CORE */
216static struct dpll_data dpll_core_dd = {
217 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
218 .clk_bypass = &core_hsd_byp_clk_mux_ck,
219 .clk_ref = &sys_clkin_ck,
220 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
221 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
222 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
223 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
224 .mult_mask = OMAP4430_DPLL_MULT_MASK,
225 .div1_mask = OMAP4430_DPLL_DIV_MASK,
226 .enable_mask = OMAP4430_DPLL_EN_MASK,
227 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
228 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
229 .max_multiplier = 2047,
230 .max_divider = 128,
231 .min_divider = 1,
232};
233
234
235static const char *dpll_core_ck_parents[] = {
236 "sys_clkin_ck",
237};
238
239static struct clk dpll_core_ck;
240
241static const struct clk_ops dpll_core_ck_ops = {
242 .recalc_rate = &omap3_dpll_recalc,
243 .get_parent = &omap2_init_dpll_parent,
244};
245
246static struct clk_hw_omap dpll_core_ck_hw = {
247 .hw = {
248 .clk = &dpll_core_ck,
249 },
250 .dpll_data = &dpll_core_dd,
251 .ops = &clkhwops_omap3_dpll,
252};
253
254DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
255
256static const char *dpll_core_x2_ck_parents[] = {
257 "dpll_core_ck",
258};
259
260static struct clk dpll_core_x2_ck;
261
262static struct clk_hw_omap dpll_core_x2_ck_hw = {
263 .hw = {
264 .clk = &dpll_core_x2_ck,
265 },
266};
267
268DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_abe_x2_ck_ops);
269
270DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m6x2_ck, "dpll_core_x2_ck",
271 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M6_DPLL_CORE,
272 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
273
274DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m2_ck, "dpll_core_ck", &dpll_core_ck, 0x0,
275 OMAP4430_CM_DIV_M2_DPLL_CORE,
276 OMAP4430_DPLL_CLKOUT_DIV_MASK);
277
278DEFINE_CLK_FIXED_FACTOR(ddrphy_ck, "dpll_core_m2_ck", &dpll_core_m2_ck, 0x0, 1,
279 2);
280
281DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m5x2_ck, "dpll_core_x2_ck",
282 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M5_DPLL_CORE,
283 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
284
285DEFINE_CLK_DIVIDER(div_core_ck, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, 0x0,
286 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT,
287 OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL);
288
289DEFINE_CLK_OMAP_HSDIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck",
290 &dpll_core_m5x2_ck, 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA,
291 OMAP4430_CLKSEL_0_1_MASK);
292
293DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck,
294 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT,
295 OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
296
297DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m4x2_ck, "dpll_core_x2_ck",
298 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M4_DPLL_CORE,
299 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
300
301DEFINE_CLK_FIXED_FACTOR(dll_clk_div_ck, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck,
302 0x0, 1, 2);
303
304DEFINE_CLK_DIVIDER(dpll_abe_m2_ck, "dpll_abe_ck", &dpll_abe_ck, 0x0,
305 OMAP4430_CM_DIV_M2_DPLL_ABE, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
306 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
307
308static const struct clk_ops dmic_fck_ops = {
309 .enable = &omap2_dflt_clk_enable,
310 .disable = &omap2_dflt_clk_disable,
311 .is_enabled = &omap2_dflt_clk_is_enabled,
312 .recalc_rate = &omap2_clksel_recalc,
313 .get_parent = &omap2_clksel_find_parent_index,
314 .set_parent = &omap2_clksel_set_parent,
315 .init = &omap2_init_clk_clkdm,
316};
317
318static const char *dpll_core_m3x2_ck_parents[] = {
319 "dpll_core_x2_ck",
320};
321
322static const struct clksel dpll_core_m3x2_div[] = {
323 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
324 { .parent = NULL },
325};
326
327/* XXX Missing round_rate, set_rate in ops */
328DEFINE_CLK_OMAP_MUX_GATE(dpll_core_m3x2_ck, NULL, dpll_core_m3x2_div,
329 OMAP4430_CM_DIV_M3_DPLL_CORE,
330 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
331 OMAP4430_CM_DIV_M3_DPLL_CORE,
332 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
333 dpll_core_m3x2_ck_parents, dmic_fck_ops);
334
335DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m7x2_ck, "dpll_core_x2_ck",
336 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M7_DPLL_CORE,
337 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
338
339static const char *iva_hsd_byp_clk_mux_ck_parents[] = {
340 "sys_clkin_ck", "div_iva_hs_clk",
341};
342
343DEFINE_CLK_MUX(iva_hsd_byp_clk_mux_ck, iva_hsd_byp_clk_mux_ck_parents, NULL,
344 0x0, OMAP4430_CM_CLKSEL_DPLL_IVA, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
345 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
346
347/* DPLL_IVA */
348static struct dpll_data dpll_iva_dd = {
349 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
350 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
351 .clk_ref = &sys_clkin_ck,
352 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
353 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
354 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
355 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
356 .mult_mask = OMAP4430_DPLL_MULT_MASK,
357 .div1_mask = OMAP4430_DPLL_DIV_MASK,
358 .enable_mask = OMAP4430_DPLL_EN_MASK,
359 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
360 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
361 .max_multiplier = 2047,
362 .max_divider = 128,
363 .min_divider = 1,
364};
365
366static struct clk dpll_iva_ck;
367
368static struct clk_hw_omap dpll_iva_ck_hw = {
369 .hw = {
370 .clk = &dpll_iva_ck,
371 },
372 .dpll_data = &dpll_iva_dd,
373 .ops = &clkhwops_omap3_dpll,
374};
375
376DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
377
378static const char *dpll_iva_x2_ck_parents[] = {
379 "dpll_iva_ck",
380};
381
382static struct clk dpll_iva_x2_ck;
383
384static struct clk_hw_omap dpll_iva_x2_ck_hw = {
385 .hw = {
386 .clk = &dpll_iva_x2_ck,
387 },
388};
389
390DEFINE_STRUCT_CLK(dpll_iva_x2_ck, dpll_iva_x2_ck_parents, dpll_abe_x2_ck_ops);
391
392DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m4x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
393 0x0, OMAP4430_CM_DIV_M4_DPLL_IVA,
394 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
395
396DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m5x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
397 0x0, OMAP4430_CM_DIV_M5_DPLL_IVA,
398 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
399
400/* DPLL_MPU */
401static struct dpll_data dpll_mpu_dd = {
402 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
403 .clk_bypass = &div_mpu_hs_clk,
404 .clk_ref = &sys_clkin_ck,
405 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
406 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
407 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
408 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
409 .mult_mask = OMAP4430_DPLL_MULT_MASK,
410 .div1_mask = OMAP4430_DPLL_DIV_MASK,
411 .enable_mask = OMAP4430_DPLL_EN_MASK,
412 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
413 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
414 .max_multiplier = 2047,
415 .max_divider = 128,
416 .min_divider = 1,
417};
418
419static struct clk dpll_mpu_ck;
420
421static struct clk_hw_omap dpll_mpu_ck_hw = {
422 .hw = {
423 .clk = &dpll_mpu_ck,
424 },
425 .dpll_data = &dpll_mpu_dd,
426 .ops = &clkhwops_omap3_dpll,
427};
428
429DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
430
431DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2);
432
433DEFINE_CLK_OMAP_HSDIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck, 0x0,
434 OMAP4430_CM_DIV_M2_DPLL_MPU,
435 OMAP4430_DPLL_CLKOUT_DIV_MASK);
436
437DEFINE_CLK_FIXED_FACTOR(per_hs_clk_div_ck, "dpll_abe_m3x2_ck",
438 &dpll_abe_m3x2_ck, 0x0, 1, 2);
439
440static const char *per_hsd_byp_clk_mux_ck_parents[] = {
441 "sys_clkin_ck", "per_hs_clk_div_ck",
442};
443
444DEFINE_CLK_MUX(per_hsd_byp_clk_mux_ck, per_hsd_byp_clk_mux_ck_parents, NULL,
445 0x0, OMAP4430_CM_CLKSEL_DPLL_PER, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
446 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
447
448/* DPLL_PER */
449static struct dpll_data dpll_per_dd = {
450 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
451 .clk_bypass = &per_hsd_byp_clk_mux_ck,
452 .clk_ref = &sys_clkin_ck,
453 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
454 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
455 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
456 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
457 .mult_mask = OMAP4430_DPLL_MULT_MASK,
458 .div1_mask = OMAP4430_DPLL_DIV_MASK,
459 .enable_mask = OMAP4430_DPLL_EN_MASK,
460 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
461 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
462 .max_multiplier = 2047,
463 .max_divider = 128,
464 .min_divider = 1,
465};
466
467
468static struct clk dpll_per_ck;
469
470static struct clk_hw_omap dpll_per_ck_hw = {
471 .hw = {
472 .clk = &dpll_per_ck,
473 },
474 .dpll_data = &dpll_per_dd,
475 .ops = &clkhwops_omap3_dpll,
476};
477
478DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
479
480DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
481 OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
482 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
483
484static const char *dpll_per_x2_ck_parents[] = {
485 "dpll_per_ck",
486};
487
488static struct clk dpll_per_x2_ck;
489
490static struct clk_hw_omap dpll_per_x2_ck_hw = {
491 .hw = {
492 .clk = &dpll_per_x2_ck,
493 },
494 .flags = CLOCK_CLKOUTX2,
495 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
496 .ops = &clkhwops_omap4_dpllmx,
497};
498
499DEFINE_STRUCT_CLK(dpll_per_x2_ck, dpll_per_x2_ck_parents, dpll_abe_x2_ck_ops);
500
501DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m2x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
502 0x0, OMAP4430_CM_DIV_M2_DPLL_PER,
503 OMAP4430_DPLL_CLKOUT_DIV_MASK);
504
505static const char *dpll_per_m3x2_ck_parents[] = {
506 "dpll_per_x2_ck",
507};
508
509static const struct clksel dpll_per_m3x2_div[] = {
510 { .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
511 { .parent = NULL },
512};
513
514/* XXX Missing round_rate, set_rate in ops */
515DEFINE_CLK_OMAP_MUX_GATE(dpll_per_m3x2_ck, NULL, dpll_per_m3x2_div,
516 OMAP4430_CM_DIV_M3_DPLL_PER,
517 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
518 OMAP4430_CM_DIV_M3_DPLL_PER,
519 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
520 dpll_per_m3x2_ck_parents, dmic_fck_ops);
521
522DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m4x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
523 0x0, OMAP4430_CM_DIV_M4_DPLL_PER,
524 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
525
526DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m5x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
527 0x0, OMAP4430_CM_DIV_M5_DPLL_PER,
528 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
529
530DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m6x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
531 0x0, OMAP4430_CM_DIV_M6_DPLL_PER,
532 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
533
534DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m7x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
535 0x0, OMAP4430_CM_DIV_M7_DPLL_PER,
536 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
537
538DEFINE_CLK_FIXED_FACTOR(usb_hs_clk_div_ck, "dpll_abe_m3x2_ck",
539 &dpll_abe_m3x2_ck, 0x0, 1, 3);
540
541/* DPLL_USB */
542static struct dpll_data dpll_usb_dd = {
543 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
544 .clk_bypass = &usb_hs_clk_div_ck,
545 .flags = DPLL_J_TYPE,
546 .clk_ref = &sys_clkin_ck,
547 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
548 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
549 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
550 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
551 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
552 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
553 .enable_mask = OMAP4430_DPLL_EN_MASK,
554 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
555 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
556 .sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
557 .max_multiplier = 4095,
558 .max_divider = 256,
559 .min_divider = 1,
560};
561
562static struct clk dpll_usb_ck;
563
564static struct clk_hw_omap dpll_usb_ck_hw = {
565 .hw = {
566 .clk = &dpll_usb_ck,
567 },
568 .dpll_data = &dpll_usb_dd,
569 .ops = &clkhwops_omap3_dpll,
570};
571
572DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
573
574static const char *dpll_usb_clkdcoldo_ck_parents[] = {
575 "dpll_usb_ck",
576};
577
578static struct clk dpll_usb_clkdcoldo_ck;
579
580static const struct clk_ops dpll_usb_clkdcoldo_ck_ops = {
581};
582
583static struct clk_hw_omap dpll_usb_clkdcoldo_ck_hw = {
584 .hw = {
585 .clk = &dpll_usb_clkdcoldo_ck,
586 },
587 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
588 .ops = &clkhwops_omap4_dpllmx,
589};
590
591DEFINE_STRUCT_CLK(dpll_usb_clkdcoldo_ck, dpll_usb_clkdcoldo_ck_parents,
592 dpll_usb_clkdcoldo_ck_ops);
593
594DEFINE_CLK_OMAP_HSDIVIDER(dpll_usb_m2_ck, "dpll_usb_ck", &dpll_usb_ck, 0x0,
595 OMAP4430_CM_DIV_M2_DPLL_USB,
596 OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK);
597
598static const char *ducati_clk_mux_ck_parents[] = {
599 "div_core_ck", "dpll_per_m6x2_ck",
600};
601
602DEFINE_CLK_MUX(ducati_clk_mux_ck, ducati_clk_mux_ck_parents, NULL, 0x0,
603 OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT, OMAP4430_CLKSEL_0_0_SHIFT,
604 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
605
606DEFINE_CLK_FIXED_FACTOR(func_12m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
607 0x0, 1, 16);
608
609DEFINE_CLK_FIXED_FACTOR(func_24m_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0,
610 1, 4);
611
612DEFINE_CLK_FIXED_FACTOR(func_24mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
613 0x0, 1, 8);
614
615static const struct clk_div_table func_48m_fclk_rates[] = {
616 { .div = 4, .val = 0 },
617 { .div = 8, .val = 1 },
618 { .div = 0 },
619};
620DEFINE_CLK_DIVIDER_TABLE(func_48m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
621 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
622 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_48m_fclk_rates,
623 NULL);
624
625DEFINE_CLK_FIXED_FACTOR(func_48mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
626 0x0, 1, 4);
627
628static const struct clk_div_table func_64m_fclk_rates[] = {
629 { .div = 2, .val = 0 },
630 { .div = 4, .val = 1 },
631 { .div = 0 },
632};
633DEFINE_CLK_DIVIDER_TABLE(func_64m_fclk, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck,
634 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
635 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_64m_fclk_rates,
636 NULL);
637
638static const struct clk_div_table func_96m_fclk_rates[] = {
639 { .div = 2, .val = 0 },
640 { .div = 4, .val = 1 },
641 { .div = 0 },
642};
643DEFINE_CLK_DIVIDER_TABLE(func_96m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
644 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
645 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_96m_fclk_rates,
646 NULL);
647
648static const struct clk_div_table init_60m_fclk_rates[] = {
649 { .div = 1, .val = 0 },
650 { .div = 8, .val = 1 },
651 { .div = 0 },
652};
653DEFINE_CLK_DIVIDER_TABLE(init_60m_fclk, "dpll_usb_m2_ck", &dpll_usb_m2_ck,
654 0x0, OMAP4430_CM_CLKSEL_USB_60MHZ,
655 OMAP4430_CLKSEL_0_0_SHIFT, OMAP4430_CLKSEL_0_0_WIDTH,
656 0x0, init_60m_fclk_rates, NULL);
657
658DEFINE_CLK_DIVIDER(l3_div_ck, "div_core_ck", &div_core_ck, 0x0,
659 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L3_SHIFT,
660 OMAP4430_CLKSEL_L3_WIDTH, 0x0, NULL);
661
662DEFINE_CLK_DIVIDER(l4_div_ck, "l3_div_ck", &l3_div_ck, 0x0,
663 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L4_SHIFT,
664 OMAP4430_CLKSEL_L4_WIDTH, 0x0, NULL);
665
666DEFINE_CLK_FIXED_FACTOR(lp_clk_div_ck, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
667 0x0, 1, 16);
668
669static const char *l4_wkup_clk_mux_ck_parents[] = {
670 "sys_clkin_ck", "lp_clk_div_ck",
671};
672
673DEFINE_CLK_MUX(l4_wkup_clk_mux_ck, l4_wkup_clk_mux_ck_parents, NULL, 0x0,
674 OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
675 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
676
677static const struct clk_div_table ocp_abe_iclk_rates[] = {
678 { .div = 2, .val = 0 },
679 { .div = 1, .val = 1 },
680 { .div = 0 },
681};
682DEFINE_CLK_DIVIDER_TABLE(ocp_abe_iclk, "aess_fclk", &aess_fclk, 0x0,
683 OMAP4430_CM1_ABE_AESS_CLKCTRL,
684 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
685 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
686 0x0, ocp_abe_iclk_rates, NULL);
687
688DEFINE_CLK_FIXED_FACTOR(per_abe_24m_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck,
689 0x0, 1, 4);
690
691DEFINE_CLK_DIVIDER(per_abe_nc_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck, 0x0,
692 OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
693 OMAP4430_SCALE_FCLK_WIDTH, 0x0, NULL);
694
695DEFINE_CLK_DIVIDER(syc_clk_div_ck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
696 OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
697 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
698
699static struct clk dbgclk_mux_ck;
700DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL);
701DEFINE_STRUCT_CLK(dbgclk_mux_ck, dpll_core_ck_parents,
702 dpll_usb_clkdcoldo_ck_ops);
703
704/* Leaf clocks controlled by modules */
705
706DEFINE_CLK_GATE(aes1_fck, "l3_div_ck", &l3_div_ck, 0x0,
707 OMAP4430_CM_L4SEC_AES1_CLKCTRL,
708 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
709
710DEFINE_CLK_GATE(aes2_fck, "l3_div_ck", &l3_div_ck, 0x0,
711 OMAP4430_CM_L4SEC_AES2_CLKCTRL,
712 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
713
714DEFINE_CLK_GATE(aess_fck, "aess_fclk", &aess_fclk, 0x0,
715 OMAP4430_CM1_ABE_AESS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
716 0x0, NULL);
717
718DEFINE_CLK_GATE(bandgap_fclk, "sys_32k_ck", &sys_32k_ck, 0x0,
719 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
720 OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT, 0x0, NULL);
721
722static const struct clk_div_table div_ts_ck_rates[] = {
723 { .div = 8, .val = 0 },
724 { .div = 16, .val = 1 },
725 { .div = 32, .val = 2 },
726 { .div = 0 },
727};
728DEFINE_CLK_DIVIDER_TABLE(div_ts_ck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
729 0x0, OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
730 OMAP4430_CLKSEL_24_25_SHIFT,
731 OMAP4430_CLKSEL_24_25_WIDTH, 0x0, div_ts_ck_rates,
732 NULL);
733
734DEFINE_CLK_GATE(bandgap_ts_fclk, "div_ts_ck", &div_ts_ck, 0x0,
735 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
736 OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
737 0x0, NULL);
738
739DEFINE_CLK_GATE(des3des_fck, "l4_div_ck", &l4_div_ck, 0x0,
740 OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
741 OMAP4430_MODULEMODE_SWCTRL_SHIFT,
742 0x0, NULL);
743
744static const char *dmic_sync_mux_ck_parents[] = {
745 "abe_24m_fclk", "syc_clk_div_ck", "func_24m_clk",
746};
747
748DEFINE_CLK_MUX(dmic_sync_mux_ck, dmic_sync_mux_ck_parents, NULL,
749 0x0, OMAP4430_CM1_ABE_DMIC_CLKCTRL,
750 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
751 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
752
753static const struct clksel func_dmic_abe_gfclk_sel[] = {
754 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
755 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
756 { .parent = &slimbus_clk, .rates = div_1_2_rates },
757 { .parent = NULL },
758};
759
760static const char *dmic_fck_parents[] = {
761 "dmic_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
762};
763
764/* Merged func_dmic_abe_gfclk into dmic */
765static struct clk dmic_fck;
766
767DEFINE_CLK_OMAP_MUX_GATE(dmic_fck, "abe_clkdm", func_dmic_abe_gfclk_sel,
768 OMAP4430_CM1_ABE_DMIC_CLKCTRL,
769 OMAP4430_CLKSEL_SOURCE_MASK,
770 OMAP4430_CM1_ABE_DMIC_CLKCTRL,
771 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
772 dmic_fck_parents, dmic_fck_ops);
773
774DEFINE_CLK_GATE(dsp_fck, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, 0x0,
775 OMAP4430_CM_TESLA_TESLA_CLKCTRL,
776 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
777
778DEFINE_CLK_GATE(dss_sys_clk, "syc_clk_div_ck", &syc_clk_div_ck, 0x0,
779 OMAP4430_CM_DSS_DSS_CLKCTRL,
780 OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT, 0x0, NULL);
781
782DEFINE_CLK_GATE(dss_tv_clk, "extalt_clkin_ck", &extalt_clkin_ck, 0x0,
783 OMAP4430_CM_DSS_DSS_CLKCTRL,
784 OMAP4430_OPTFCLKEN_TV_CLK_SHIFT, 0x0, NULL);
785
786DEFINE_CLK_GATE(dss_dss_clk, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, 0x0,
787 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
788 0x0, NULL);
789
790DEFINE_CLK_GATE(dss_48mhz_clk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
791 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
792 0x0, NULL);
793
794DEFINE_CLK_GATE(dss_fck, "l3_div_ck", &l3_div_ck, 0x0,
795 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
796 0x0, NULL);
797
798DEFINE_CLK_GATE(efuse_ctrl_cust_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
799 OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
800 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
801
802DEFINE_CLK_GATE(emif1_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
803 OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
804 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
805
806DEFINE_CLK_GATE(emif2_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
807 OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
808 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
809
810DEFINE_CLK_DIVIDER(fdif_fck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
811 OMAP4430_CM_CAM_FDIF_CLKCTRL, OMAP4430_CLKSEL_FCLK_SHIFT,
812 OMAP4430_CLKSEL_FCLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
813
814DEFINE_CLK_GATE(fpka_fck, "l4_div_ck", &l4_div_ck, 0x0,
815 OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
816 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
817
818DEFINE_CLK_GATE(gpio1_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
819 OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
820 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
821
822DEFINE_CLK_GATE(gpio1_ick, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, 0x0,
823 OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
824 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
825
826DEFINE_CLK_GATE(gpio2_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
827 OMAP4430_CM_L4PER_GPIO2_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
828 0x0, NULL);
829
830DEFINE_CLK_GATE(gpio2_ick, "l4_div_ck", &l4_div_ck, 0x0,
831 OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
832 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
833
834DEFINE_CLK_GATE(gpio3_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
835 OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
836 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
837
838DEFINE_CLK_GATE(gpio3_ick, "l4_div_ck", &l4_div_ck, 0x0,
839 OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
840 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
841
842DEFINE_CLK_GATE(gpio4_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
843 OMAP4430_CM_L4PER_GPIO4_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
844 0x0, NULL);
845
846DEFINE_CLK_GATE(gpio4_ick, "l4_div_ck", &l4_div_ck, 0x0,
847 OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
848 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
849
850DEFINE_CLK_GATE(gpio5_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
851 OMAP4430_CM_L4PER_GPIO5_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
852 0x0, NULL);
853
854DEFINE_CLK_GATE(gpio5_ick, "l4_div_ck", &l4_div_ck, 0x0,
855 OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
856 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
857
858DEFINE_CLK_GATE(gpio6_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
859 OMAP4430_CM_L4PER_GPIO6_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
860 0x0, NULL);
861
862DEFINE_CLK_GATE(gpio6_ick, "l4_div_ck", &l4_div_ck, 0x0,
863 OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
864 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
865
866DEFINE_CLK_GATE(gpmc_ick, "l3_div_ck", &l3_div_ck, 0x0,
867 OMAP4430_CM_L3_2_GPMC_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
868 0x0, NULL);
869
870static const struct clksel sgx_clk_mux_sel[] = {
871 { .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
872 { .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
873 { .parent = NULL },
874};
875
876static const char *gpu_fck_parents[] = {
877 "dpll_core_m7x2_ck", "dpll_per_m7x2_ck",
878};
879
880/* Merged sgx_clk_mux into gpu */
881DEFINE_CLK_OMAP_MUX_GATE(gpu_fck, "l3_gfx_clkdm", sgx_clk_mux_sel,
882 OMAP4430_CM_GFX_GFX_CLKCTRL,
883 OMAP4430_CLKSEL_SGX_FCLK_MASK,
884 OMAP4430_CM_GFX_GFX_CLKCTRL,
885 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
886 gpu_fck_parents, dmic_fck_ops);
887
888DEFINE_CLK_GATE(hdq1w_fck, "func_12m_fclk", &func_12m_fclk, 0x0,
889 OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
890 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
891
892DEFINE_CLK_DIVIDER(hsi_fck, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, 0x0,
893 OMAP4430_CM_L3INIT_HSI_CLKCTRL, OMAP4430_CLKSEL_24_25_SHIFT,
894 OMAP4430_CLKSEL_24_25_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
895 NULL);
896
897DEFINE_CLK_GATE(i2c1_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
898 OMAP4430_CM_L4PER_I2C1_CLKCTRL,
899 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
900
901DEFINE_CLK_GATE(i2c2_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
902 OMAP4430_CM_L4PER_I2C2_CLKCTRL,
903 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
904
905DEFINE_CLK_GATE(i2c3_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
906 OMAP4430_CM_L4PER_I2C3_CLKCTRL,
907 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
908
909DEFINE_CLK_GATE(i2c4_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
910 OMAP4430_CM_L4PER_I2C4_CLKCTRL,
911 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
912
913DEFINE_CLK_GATE(ipu_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
914 OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
915 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
916
917DEFINE_CLK_GATE(iss_ctrlclk, "func_96m_fclk", &func_96m_fclk, 0x0,
918 OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
919 0x0, NULL);
920
921DEFINE_CLK_GATE(iss_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
922 OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
923 0x0, NULL);
924
925DEFINE_CLK_GATE(iva_fck, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
926 OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
927 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
928
929DEFINE_CLK_GATE(kbd_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
930 OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
931 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
932
933static struct clk l3_instr_ick;
934
935static const char *l3_instr_ick_parent_names[] = {
936 "l3_div_ck",
937};
938
939static const struct clk_ops l3_instr_ick_ops = {
940 .enable = &omap2_dflt_clk_enable,
941 .disable = &omap2_dflt_clk_disable,
942 .is_enabled = &omap2_dflt_clk_is_enabled,
943 .init = &omap2_init_clk_clkdm,
944};
945
946static struct clk_hw_omap l3_instr_ick_hw = {
947 .hw = {
948 .clk = &l3_instr_ick,
949 },
950 .enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
951 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
952 .clkdm_name = "l3_instr_clkdm",
953};
954
955DEFINE_STRUCT_CLK(l3_instr_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
956
957static struct clk l3_main_3_ick;
958static struct clk_hw_omap l3_main_3_ick_hw = {
959 .hw = {
960 .clk = &l3_main_3_ick,
961 },
962 .enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
963 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
964 .clkdm_name = "l3_instr_clkdm",
965};
966
967DEFINE_STRUCT_CLK(l3_main_3_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
968
969DEFINE_CLK_MUX(mcasp_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
970 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
971 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
972 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
973
974static const struct clksel func_mcasp_abe_gfclk_sel[] = {
975 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
976 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
977 { .parent = &slimbus_clk, .rates = div_1_2_rates },
978 { .parent = NULL },
979};
980
981static const char *mcasp_fck_parents[] = {
982 "mcasp_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
983};
984
985/* Merged func_mcasp_abe_gfclk into mcasp */
986DEFINE_CLK_OMAP_MUX_GATE(mcasp_fck, "abe_clkdm", func_mcasp_abe_gfclk_sel,
987 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
988 OMAP4430_CLKSEL_SOURCE_MASK,
989 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
990 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
991 mcasp_fck_parents, dmic_fck_ops);
992
993DEFINE_CLK_MUX(mcbsp1_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
994 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
995 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
996 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
997
998static const struct clksel func_mcbsp1_gfclk_sel[] = {
999 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
1000 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1001 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1002 { .parent = NULL },
1003};
1004
1005static const char *mcbsp1_fck_parents[] = {
1006 "mcbsp1_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1007};
1008
1009/* Merged func_mcbsp1_gfclk into mcbsp1 */
1010DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "abe_clkdm", func_mcbsp1_gfclk_sel,
1011 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1012 OMAP4430_CLKSEL_SOURCE_MASK,
1013 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1014 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1015 mcbsp1_fck_parents, dmic_fck_ops);
1016
1017DEFINE_CLK_MUX(mcbsp2_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
1018 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1019 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1020 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1021
1022static const struct clksel func_mcbsp2_gfclk_sel[] = {
1023 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
1024 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1025 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1026 { .parent = NULL },
1027};
1028
1029static const char *mcbsp2_fck_parents[] = {
1030 "mcbsp2_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1031};
1032
1033/* Merged func_mcbsp2_gfclk into mcbsp2 */
1034DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "abe_clkdm", func_mcbsp2_gfclk_sel,
1035 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1036 OMAP4430_CLKSEL_SOURCE_MASK,
1037 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1038 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1039 mcbsp2_fck_parents, dmic_fck_ops);
1040
1041DEFINE_CLK_MUX(mcbsp3_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
1042 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1043 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1044 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1045
1046static const struct clksel func_mcbsp3_gfclk_sel[] = {
1047 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
1048 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1049 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1050 { .parent = NULL },
1051};
1052
1053static const char *mcbsp3_fck_parents[] = {
1054 "mcbsp3_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1055};
1056
1057/* Merged func_mcbsp3_gfclk into mcbsp3 */
1058DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "abe_clkdm", func_mcbsp3_gfclk_sel,
1059 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1060 OMAP4430_CLKSEL_SOURCE_MASK,
1061 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1062 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1063 mcbsp3_fck_parents, dmic_fck_ops);
1064
1065static const char *mcbsp4_sync_mux_ck_parents[] = {
1066 "func_96m_fclk", "per_abe_nc_fclk",
1067};
1068
1069DEFINE_CLK_MUX(mcbsp4_sync_mux_ck, mcbsp4_sync_mux_ck_parents, NULL, 0x0,
1070 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1071 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1072 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1073
1074static const struct clksel per_mcbsp4_gfclk_sel[] = {
1075 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
1076 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1077 { .parent = NULL },
1078};
1079
1080static const char *mcbsp4_fck_parents[] = {
1081 "mcbsp4_sync_mux_ck", "pad_clks_ck",
1082};
1083
1084/* Merged per_mcbsp4_gfclk into mcbsp4 */
1085DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "l4_per_clkdm", per_mcbsp4_gfclk_sel,
1086 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1087 OMAP4430_CLKSEL_SOURCE_24_24_MASK,
1088 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1089 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1090 mcbsp4_fck_parents, dmic_fck_ops);
1091
1092DEFINE_CLK_GATE(mcpdm_fck, "pad_clks_ck", &pad_clks_ck, 0x0,
1093 OMAP4430_CM1_ABE_PDM_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1094 0x0, NULL);
1095
1096DEFINE_CLK_GATE(mcspi1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1097 OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
1098 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1099
1100DEFINE_CLK_GATE(mcspi2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1101 OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
1102 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1103
1104DEFINE_CLK_GATE(mcspi3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1105 OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
1106 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1107
1108DEFINE_CLK_GATE(mcspi4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1109 OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
1110 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1111
1112static const struct clksel hsmmc1_fclk_sel[] = {
1113 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1114 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1115 { .parent = NULL },
1116};
1117
1118static const char *mmc1_fck_parents[] = {
1119 "func_64m_fclk", "func_96m_fclk",
1120};
1121
1122/* Merged hsmmc1_fclk into mmc1 */
1123DEFINE_CLK_OMAP_MUX_GATE(mmc1_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
1124 OMAP4430_CM_L3INIT_MMC1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1125 OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
1126 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1127 mmc1_fck_parents, dmic_fck_ops);
1128
1129/* Merged hsmmc2_fclk into mmc2 */
1130DEFINE_CLK_OMAP_MUX_GATE(mmc2_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
1131 OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
1132 OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
1133 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1134 mmc1_fck_parents, dmic_fck_ops);
1135
1136DEFINE_CLK_GATE(mmc3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1137 OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
1138 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1139
1140DEFINE_CLK_GATE(mmc4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1141 OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
1142 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1143
1144DEFINE_CLK_GATE(mmc5_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1145 OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
1146 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1147
1148DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0,
1149 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1150 OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL);
1151
1152DEFINE_CLK_GATE(ocp2scp_usb_phy_ick, "l4_div_ck", &l4_div_ck, 0x0,
1153 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1154 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1155
1156static struct clk ocp_wp_noc_ick;
1157
1158static struct clk_hw_omap ocp_wp_noc_ick_hw = {
1159 .hw = {
1160 .clk = &ocp_wp_noc_ick,
1161 },
1162 .enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
1163 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1164 .clkdm_name = "l3_instr_clkdm",
1165};
1166
1167DEFINE_STRUCT_CLK(ocp_wp_noc_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
1168
1169DEFINE_CLK_GATE(rng_ick, "l4_div_ck", &l4_div_ck, 0x0,
1170 OMAP4430_CM_L4SEC_RNG_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1171 0x0, NULL);
1172
1173DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
1174 OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
1175 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1176
1177DEFINE_CLK_GATE(sl2if_ick, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
1178 OMAP4430_CM_IVAHD_SL2_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1179 0x0, NULL);
1180
1181DEFINE_CLK_GATE(slimbus1_fclk_1, "func_24m_clk", &func_24m_clk, 0x0,
1182 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1183 OMAP4430_OPTFCLKEN_FCLK1_SHIFT, 0x0, NULL);
1184
1185DEFINE_CLK_GATE(slimbus1_fclk_0, "abe_24m_fclk", &abe_24m_fclk, 0x0,
1186 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1187 OMAP4430_OPTFCLKEN_FCLK0_SHIFT, 0x0, NULL);
1188
1189DEFINE_CLK_GATE(slimbus1_fclk_2, "pad_clks_ck", &pad_clks_ck, 0x0,
1190 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1191 OMAP4430_OPTFCLKEN_FCLK2_SHIFT, 0x0, NULL);
1192
1193DEFINE_CLK_GATE(slimbus1_slimbus_clk, "slimbus_clk", &slimbus_clk, 0x0,
1194 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1195 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT, 0x0, NULL);
1196
1197DEFINE_CLK_GATE(slimbus1_fck, "ocp_abe_iclk", &ocp_abe_iclk, 0x0,
1198 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1199 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1200
1201DEFINE_CLK_GATE(slimbus2_fclk_1, "per_abe_24m_fclk", &per_abe_24m_fclk, 0x0,
1202 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1203 OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT, 0x0, NULL);
1204
1205DEFINE_CLK_GATE(slimbus2_fclk_0, "func_24mc_fclk", &func_24mc_fclk, 0x0,
1206 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1207 OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT, 0x0, NULL);
1208
1209DEFINE_CLK_GATE(slimbus2_slimbus_clk, "pad_slimbus_core_clks_ck",
1210 &pad_slimbus_core_clks_ck, 0x0,
1211 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1212 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT, 0x0, NULL);
1213
1214DEFINE_CLK_GATE(slimbus2_fck, "l4_div_ck", &l4_div_ck, 0x0,
1215 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1216 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1217
1218DEFINE_CLK_GATE(smartreflex_core_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1219 0x0, OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
1220 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1221
1222DEFINE_CLK_GATE(smartreflex_iva_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1223 0x0, OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
1224 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1225
1226DEFINE_CLK_GATE(smartreflex_mpu_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1227 0x0, OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
1228 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1229
1230static const struct clksel dmt1_clk_mux_sel[] = {
1231 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1232 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1233 { .parent = NULL },
1234};
1235
1236/* Merged dmt1_clk_mux into timer1 */
1237DEFINE_CLK_OMAP_MUX_GATE(timer1_fck, "l4_wkup_clkdm", dmt1_clk_mux_sel,
1238 OMAP4430_CM_WKUP_TIMER1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1239 OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
1240 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1241 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1242
1243/* Merged cm2_dm10_mux into timer10 */
1244DEFINE_CLK_OMAP_MUX_GATE(timer10_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1245 OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1246 OMAP4430_CLKSEL_MASK,
1247 OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1248 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1249 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1250
1251/* Merged cm2_dm11_mux into timer11 */
1252DEFINE_CLK_OMAP_MUX_GATE(timer11_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1253 OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1254 OMAP4430_CLKSEL_MASK,
1255 OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1256 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1257 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1258
1259/* Merged cm2_dm2_mux into timer2 */
1260DEFINE_CLK_OMAP_MUX_GATE(timer2_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1261 OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1262 OMAP4430_CLKSEL_MASK,
1263 OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1264 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1265 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1266
1267/* Merged cm2_dm3_mux into timer3 */
1268DEFINE_CLK_OMAP_MUX_GATE(timer3_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1269 OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1270 OMAP4430_CLKSEL_MASK,
1271 OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1272 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1273 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1274
1275/* Merged cm2_dm4_mux into timer4 */
1276DEFINE_CLK_OMAP_MUX_GATE(timer4_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1277 OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1278 OMAP4430_CLKSEL_MASK,
1279 OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1280 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1281 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1282
1283static const struct clksel timer5_sync_mux_sel[] = {
1284 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
1285 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1286 { .parent = NULL },
1287};
1288
1289static const char *timer5_fck_parents[] = {
1290 "syc_clk_div_ck", "sys_32k_ck",
1291};
1292
1293/* Merged timer5_sync_mux into timer5 */
1294DEFINE_CLK_OMAP_MUX_GATE(timer5_fck, "abe_clkdm", timer5_sync_mux_sel,
1295 OMAP4430_CM1_ABE_TIMER5_CLKCTRL, OMAP4430_CLKSEL_MASK,
1296 OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
1297 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1298 timer5_fck_parents, dmic_fck_ops);
1299
1300/* Merged timer6_sync_mux into timer6 */
1301DEFINE_CLK_OMAP_MUX_GATE(timer6_fck, "abe_clkdm", timer5_sync_mux_sel,
1302 OMAP4430_CM1_ABE_TIMER6_CLKCTRL, OMAP4430_CLKSEL_MASK,
1303 OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
1304 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1305 timer5_fck_parents, dmic_fck_ops);
1306
1307/* Merged timer7_sync_mux into timer7 */
1308DEFINE_CLK_OMAP_MUX_GATE(timer7_fck, "abe_clkdm", timer5_sync_mux_sel,
1309 OMAP4430_CM1_ABE_TIMER7_CLKCTRL, OMAP4430_CLKSEL_MASK,
1310 OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
1311 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1312 timer5_fck_parents, dmic_fck_ops);
1313
1314/* Merged timer8_sync_mux into timer8 */
1315DEFINE_CLK_OMAP_MUX_GATE(timer8_fck, "abe_clkdm", timer5_sync_mux_sel,
1316 OMAP4430_CM1_ABE_TIMER8_CLKCTRL, OMAP4430_CLKSEL_MASK,
1317 OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
1318 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1319 timer5_fck_parents, dmic_fck_ops);
1320
1321/* Merged cm2_dm9_mux into timer9 */
1322DEFINE_CLK_OMAP_MUX_GATE(timer9_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1323 OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1324 OMAP4430_CLKSEL_MASK,
1325 OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1326 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1327 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1328
1329DEFINE_CLK_GATE(uart1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1330 OMAP4430_CM_L4PER_UART1_CLKCTRL,
1331 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1332
1333DEFINE_CLK_GATE(uart2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1334 OMAP4430_CM_L4PER_UART2_CLKCTRL,
1335 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1336
1337DEFINE_CLK_GATE(uart3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1338 OMAP4430_CM_L4PER_UART3_CLKCTRL,
1339 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1340
1341DEFINE_CLK_GATE(uart4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1342 OMAP4430_CM_L4PER_UART4_CLKCTRL,
1343 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1344
1345static struct clk usb_host_fs_fck;
1346
1347static const char *usb_host_fs_fck_parent_names[] = {
1348 "func_48mc_fclk",
1349};
1350
1351static const struct clk_ops usb_host_fs_fck_ops = {
1352 .enable = &omap2_dflt_clk_enable,
1353 .disable = &omap2_dflt_clk_disable,
1354 .is_enabled = &omap2_dflt_clk_is_enabled,
1355};
1356
1357static struct clk_hw_omap usb_host_fs_fck_hw = {
1358 .hw = {
1359 .clk = &usb_host_fs_fck,
1360 },
1361 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
1362 .enable_bit = OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1363 .clkdm_name = "l3_init_clkdm",
1364};
1365
1366DEFINE_STRUCT_CLK(usb_host_fs_fck, usb_host_fs_fck_parent_names,
1367 usb_host_fs_fck_ops);
1368
1369static const char *utmi_p1_gfclk_parents[] = {
1370 "init_60m_fclk", "xclk60mhsp1_ck",
1371};
1372
1373DEFINE_CLK_MUX(utmi_p1_gfclk, utmi_p1_gfclk_parents, NULL, 0x0,
1374 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1375 OMAP4430_CLKSEL_UTMI_P1_SHIFT, OMAP4430_CLKSEL_UTMI_P1_WIDTH,
1376 0x0, NULL);
1377
1378DEFINE_CLK_GATE(usb_host_hs_utmi_p1_clk, "utmi_p1_gfclk", &utmi_p1_gfclk, 0x0,
1379 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1380 OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, 0x0, NULL);
1381
1382static const char *utmi_p2_gfclk_parents[] = {
1383 "init_60m_fclk", "xclk60mhsp2_ck",
1384};
1385
1386DEFINE_CLK_MUX(utmi_p2_gfclk, utmi_p2_gfclk_parents, NULL, 0x0,
1387 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1388 OMAP4430_CLKSEL_UTMI_P2_SHIFT, OMAP4430_CLKSEL_UTMI_P2_WIDTH,
1389 0x0, NULL);
1390
1391DEFINE_CLK_GATE(usb_host_hs_utmi_p2_clk, "utmi_p2_gfclk", &utmi_p2_gfclk, 0x0,
1392 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1393 OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, 0x0, NULL);
1394
1395DEFINE_CLK_GATE(usb_host_hs_utmi_p3_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1396 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1397 OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT, 0x0, NULL);
1398
1399DEFINE_CLK_GATE(usb_host_hs_hsic480m_p1_clk, "dpll_usb_m2_ck",
1400 &dpll_usb_m2_ck, 0x0,
1401 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1402 OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT, 0x0, NULL);
1403
1404DEFINE_CLK_GATE(usb_host_hs_hsic60m_p1_clk, "init_60m_fclk",
1405 &init_60m_fclk, 0x0,
1406 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1407 OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT, 0x0, NULL);
1408
1409DEFINE_CLK_GATE(usb_host_hs_hsic60m_p2_clk, "init_60m_fclk",
1410 &init_60m_fclk, 0x0,
1411 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1412 OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT, 0x0, NULL);
1413
1414DEFINE_CLK_GATE(usb_host_hs_hsic480m_p2_clk, "dpll_usb_m2_ck",
1415 &dpll_usb_m2_ck, 0x0,
1416 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1417 OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT, 0x0, NULL);
1418
1419DEFINE_CLK_GATE(usb_host_hs_func48mclk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
1420 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1421 OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT, 0x0, NULL);
1422
1423DEFINE_CLK_GATE(usb_host_hs_fck, "init_60m_fclk", &init_60m_fclk, 0x0,
1424 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1425 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1426
1427static const char *otg_60m_gfclk_parents[] = {
1428 "utmi_phy_clkout_ck", "xclk60motg_ck",
1429};
1430
1431DEFINE_CLK_MUX(otg_60m_gfclk, otg_60m_gfclk_parents, NULL, 0x0,
1432 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL, OMAP4430_CLKSEL_60M_SHIFT,
1433 OMAP4430_CLKSEL_60M_WIDTH, 0x0, NULL);
1434
1435DEFINE_CLK_GATE(usb_otg_hs_xclk, "otg_60m_gfclk", &otg_60m_gfclk, 0x0,
1436 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1437 OMAP4430_OPTFCLKEN_XCLK_SHIFT, 0x0, NULL);
1438
1439DEFINE_CLK_GATE(usb_otg_hs_ick, "l3_div_ck", &l3_div_ck, 0x0,
1440 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1441 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1442
1443DEFINE_CLK_GATE(usb_phy_cm_clk32k, "sys_32k_ck", &sys_32k_ck, 0x0,
1444 OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
1445 OMAP4430_OPTFCLKEN_CLK32K_SHIFT, 0x0, NULL);
1446
1447DEFINE_CLK_GATE(usb_tll_hs_usb_ch2_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1448 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1449 OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT, 0x0, NULL);
1450
1451DEFINE_CLK_GATE(usb_tll_hs_usb_ch0_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1452 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1453 OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT, 0x0, NULL);
1454
1455DEFINE_CLK_GATE(usb_tll_hs_usb_ch1_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1456 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1457 OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT, 0x0, NULL);
1458
1459DEFINE_CLK_GATE(usb_tll_hs_ick, "l4_div_ck", &l4_div_ck, 0x0,
1460 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1461 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1462
1463static const struct clk_div_table usim_ck_rates[] = {
1464 { .div = 14, .val = 0 },
1465 { .div = 18, .val = 1 },
1466 { .div = 0 },
1467};
1468DEFINE_CLK_DIVIDER_TABLE(usim_ck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
1469 OMAP4430_CM_WKUP_USIM_CLKCTRL,
1470 OMAP4430_CLKSEL_DIV_SHIFT, OMAP4430_CLKSEL_DIV_WIDTH,
1471 0x0, usim_ck_rates, NULL);
1472
1473DEFINE_CLK_GATE(usim_fclk, "usim_ck", &usim_ck, 0x0,
1474 OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_OPTFCLKEN_FCLK_SHIFT,
1475 0x0, NULL);
1476
1477DEFINE_CLK_GATE(usim_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1478 OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1479 0x0, NULL);
1480
1481DEFINE_CLK_GATE(wd_timer2_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1482 OMAP4430_CM_WKUP_WDT2_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1483 0x0, NULL);
1484
1485DEFINE_CLK_GATE(wd_timer3_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1486 OMAP4430_CM1_ABE_WDT3_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1487 0x0, NULL);
1488
1489/* Remaining optional clocks */
1490static const char *pmd_stm_clock_mux_ck_parents[] = {
1491 "sys_clkin_ck", "dpll_core_m6x2_ck", "tie_low_clock_ck",
1492};
1493
1494DEFINE_CLK_MUX(pmd_stm_clock_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1495 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL, OMAP4430_PMD_STM_MUX_CTRL_SHIFT,
1496 OMAP4430_PMD_STM_MUX_CTRL_WIDTH, 0x0, NULL);
1497
1498DEFINE_CLK_MUX(pmd_trace_clk_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1499 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1500 OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT,
1501 OMAP4430_PMD_TRACE_MUX_CTRL_WIDTH, 0x0, NULL);
1502
1503DEFINE_CLK_DIVIDER(stm_clk_div_ck, "pmd_stm_clock_mux_ck",
1504 &pmd_stm_clock_mux_ck, 0x0, OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1505 OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT,
1506 OMAP4430_CLKSEL_PMD_STM_CLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
1507 NULL);
1508
1509static const char *trace_clk_div_ck_parents[] = {
1510 "pmd_trace_clk_mux_ck",
1511};
1512
1513static const struct clksel trace_clk_div_div[] = {
1514 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
1515 { .parent = NULL },
1516};
1517
1518static struct clk trace_clk_div_ck;
1519
1520static const struct clk_ops trace_clk_div_ck_ops = {
1521 .recalc_rate = &omap2_clksel_recalc,
1522 .set_rate = &omap2_clksel_set_rate,
1523 .round_rate = &omap2_clksel_round_rate,
1524 .init = &omap2_init_clk_clkdm,
1525 .enable = &omap2_clkops_enable_clkdm,
1526 .disable = &omap2_clkops_disable_clkdm,
1527};
1528
1529static struct clk_hw_omap trace_clk_div_ck_hw = {
1530 .hw = {
1531 .clk = &trace_clk_div_ck,
1532 },
1533 .clkdm_name = "emu_sys_clkdm",
1534 .clksel = trace_clk_div_div,
1535 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1536 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
1537};
1538
1539DEFINE_STRUCT_CLK(trace_clk_div_ck, trace_clk_div_ck_parents,
1540 trace_clk_div_ck_ops);
1541
1542/* SCRM aux clk nodes */
1543
1544static const struct clksel auxclk_src_sel[] = {
1545 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1546 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
1547 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
1548 { .parent = NULL },
1549};
1550
1551static const char *auxclk_src_ck_parents[] = {
1552 "sys_clkin_ck", "dpll_core_m3x2_ck", "dpll_per_m3x2_ck",
1553};
1554
1555static const struct clk_ops auxclk_src_ck_ops = {
1556 .enable = &omap2_dflt_clk_enable,
1557 .disable = &omap2_dflt_clk_disable,
1558 .is_enabled = &omap2_dflt_clk_is_enabled,
1559 .recalc_rate = &omap2_clksel_recalc,
1560 .get_parent = &omap2_clksel_find_parent_index,
1561};
1562
1563DEFINE_CLK_OMAP_MUX_GATE(auxclk0_src_ck, NULL, auxclk_src_sel,
1564 OMAP4_SCRM_AUXCLK0, OMAP4_SRCSELECT_MASK,
1565 OMAP4_SCRM_AUXCLK0, OMAP4_ENABLE_SHIFT, NULL,
1566 auxclk_src_ck_parents, auxclk_src_ck_ops);
1567
1568DEFINE_CLK_DIVIDER(auxclk0_ck, "auxclk0_src_ck", &auxclk0_src_ck, 0x0,
1569 OMAP4_SCRM_AUXCLK0, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1570 0x0, NULL);
1571
1572DEFINE_CLK_OMAP_MUX_GATE(auxclk1_src_ck, NULL, auxclk_src_sel,
1573 OMAP4_SCRM_AUXCLK1, OMAP4_SRCSELECT_MASK,
1574 OMAP4_SCRM_AUXCLK1, OMAP4_ENABLE_SHIFT, NULL,
1575 auxclk_src_ck_parents, auxclk_src_ck_ops);
1576
1577DEFINE_CLK_DIVIDER(auxclk1_ck, "auxclk1_src_ck", &auxclk1_src_ck, 0x0,
1578 OMAP4_SCRM_AUXCLK1, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1579 0x0, NULL);
1580
1581DEFINE_CLK_OMAP_MUX_GATE(auxclk2_src_ck, NULL, auxclk_src_sel,
1582 OMAP4_SCRM_AUXCLK2, OMAP4_SRCSELECT_MASK,
1583 OMAP4_SCRM_AUXCLK2, OMAP4_ENABLE_SHIFT, NULL,
1584 auxclk_src_ck_parents, auxclk_src_ck_ops);
1585
1586DEFINE_CLK_DIVIDER(auxclk2_ck, "auxclk2_src_ck", &auxclk2_src_ck, 0x0,
1587 OMAP4_SCRM_AUXCLK2, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1588 0x0, NULL);
1589
1590DEFINE_CLK_OMAP_MUX_GATE(auxclk3_src_ck, NULL, auxclk_src_sel,
1591 OMAP4_SCRM_AUXCLK3, OMAP4_SRCSELECT_MASK,
1592 OMAP4_SCRM_AUXCLK3, OMAP4_ENABLE_SHIFT, NULL,
1593 auxclk_src_ck_parents, auxclk_src_ck_ops);
1594
1595DEFINE_CLK_DIVIDER(auxclk3_ck, "auxclk3_src_ck", &auxclk3_src_ck, 0x0,
1596 OMAP4_SCRM_AUXCLK3, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1597 0x0, NULL);
1598
1599DEFINE_CLK_OMAP_MUX_GATE(auxclk4_src_ck, NULL, auxclk_src_sel,
1600 OMAP4_SCRM_AUXCLK4, OMAP4_SRCSELECT_MASK,
1601 OMAP4_SCRM_AUXCLK4, OMAP4_ENABLE_SHIFT, NULL,
1602 auxclk_src_ck_parents, auxclk_src_ck_ops);
1603
1604DEFINE_CLK_DIVIDER(auxclk4_ck, "auxclk4_src_ck", &auxclk4_src_ck, 0x0,
1605 OMAP4_SCRM_AUXCLK4, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1606 0x0, NULL);
1607
1608DEFINE_CLK_OMAP_MUX_GATE(auxclk5_src_ck, NULL, auxclk_src_sel,
1609 OMAP4_SCRM_AUXCLK5, OMAP4_SRCSELECT_MASK,
1610 OMAP4_SCRM_AUXCLK5, OMAP4_ENABLE_SHIFT, NULL,
1611 auxclk_src_ck_parents, auxclk_src_ck_ops);
1612
1613DEFINE_CLK_DIVIDER(auxclk5_ck, "auxclk5_src_ck", &auxclk5_src_ck, 0x0,
1614 OMAP4_SCRM_AUXCLK5, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1615 0x0, NULL);
1616
1617static const char *auxclkreq_ck_parents[] = {
1618 "auxclk0_ck", "auxclk1_ck", "auxclk2_ck", "auxclk3_ck", "auxclk4_ck",
1619 "auxclk5_ck",
1620};
1621
1622DEFINE_CLK_MUX(auxclkreq0_ck, auxclkreq_ck_parents, NULL, 0x0,
1623 OMAP4_SCRM_AUXCLKREQ0, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1624 0x0, NULL);
1625
1626DEFINE_CLK_MUX(auxclkreq1_ck, auxclkreq_ck_parents, NULL, 0x0,
1627 OMAP4_SCRM_AUXCLKREQ1, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1628 0x0, NULL);
1629
1630DEFINE_CLK_MUX(auxclkreq2_ck, auxclkreq_ck_parents, NULL, 0x0,
1631 OMAP4_SCRM_AUXCLKREQ2, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1632 0x0, NULL);
1633
1634DEFINE_CLK_MUX(auxclkreq3_ck, auxclkreq_ck_parents, NULL, 0x0,
1635 OMAP4_SCRM_AUXCLKREQ3, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1636 0x0, NULL);
1637
1638DEFINE_CLK_MUX(auxclkreq4_ck, auxclkreq_ck_parents, NULL, 0x0,
1639 OMAP4_SCRM_AUXCLKREQ4, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1640 0x0, NULL);
1641
1642DEFINE_CLK_MUX(auxclkreq5_ck, auxclkreq_ck_parents, NULL, 0x0,
1643 OMAP4_SCRM_AUXCLKREQ5, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1644 0x0, NULL);
1645
1646/*
1647 * clkdev
1648 */
1649
1650static struct omap_clk omap44xx_clks[] = {
1651 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
1652 CLK(NULL, "pad_clks_src_ck", &pad_clks_src_ck, CK_443X),
1653 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
1654 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
1655 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
1656 CLK(NULL, "slimbus_src_clk", &slimbus_src_clk, CK_443X),
1657 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
1658 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
1659 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
1660 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
1661 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
1662 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
1663 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
1664 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
1665 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
1666 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
1667 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X),
1668 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
1669 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
1670 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
1671 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
1672 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X),
1673 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
1674 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
1675 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X),
1676 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
1677 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
1678 CLK(NULL, "abe_clk", &abe_clk, CK_443X),
1679 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
1680 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X),
1681 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
1682 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
1683 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X),
1684 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X),
1685 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
1686 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
1687 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
1688 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X),
1689 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
1690 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
1691 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
1692 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X),
1693 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
1694 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
1695 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X),
1696 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X),
1697 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
1698 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
1699 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X),
1700 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X),
1701 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X),
1702 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
1703 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
1704 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
1705 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
1706 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
1707 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
1708 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X),
1709 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
1710 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X),
1711 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X),
1712 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X),
1713 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X),
1714 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X),
1715 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
1716 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
1717 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
1718 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
1719 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
1720 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
1721 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
1722 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
1723 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
1724 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
1725 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
1726 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
1727 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
1728 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
1729 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
1730 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
1731 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
1732 CLK("smp_twd", NULL, &mpu_periphclk, CK_443X),
1733 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
1734 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
1735 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
1736 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
1737 CLK(NULL, "aes1_fck", &aes1_fck, CK_443X),
1738 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
1739 CLK(NULL, "aess_fck", &aess_fck, CK_443X),
1740 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
1741 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
1742 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
1743 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
1744 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
1745 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
1746 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
1747 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
1748 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
1749 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
1750 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
1751 CLK(NULL, "dss_fck", &dss_fck, CK_443X),
1752 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
1753 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
1754 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
1755 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
1756 CLK(NULL, "fdif_fck", &fdif_fck, CK_443X),
1757 CLK(NULL, "fpka_fck", &fpka_fck, CK_443X),
1758 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X),
1759 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_443X),
1760 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X),
1761 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_443X),
1762 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X),
1763 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_443X),
1764 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X),
1765 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_443X),
1766 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X),
1767 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_443X),
1768 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X),
1769 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
1770 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
1771 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
1772 CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
1773 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
1774 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
1775 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
1776 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
1777 CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
1778 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
1779 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
1780 CLK(NULL, "iss_fck", &iss_fck, CK_443X),
1781 CLK(NULL, "iva_fck", &iva_fck, CK_443X),
1782 CLK(NULL, "kbd_fck", &kbd_fck, CK_443X),
1783 CLK(NULL, "l3_instr_ick", &l3_instr_ick, CK_443X),
1784 CLK(NULL, "l3_main_3_ick", &l3_main_3_ick, CK_443X),
1785 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
1786 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
1787 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
1788 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
1789 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
1790 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
1791 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
1792 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
1793 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
1794 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
1795 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
1796 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
1797 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
1798 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
1799 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
1800 CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
1801 CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
1802 CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
1803 CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
1804 CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
1805 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
1806 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
1807 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
1808 CLK(NULL, "rng_ick", &rng_ick, CK_443X),
1809 CLK("omap_rng", "ick", &rng_ick, CK_443X),
1810 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
1811 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
1812 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
1813 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
1814 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X),
1815 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X),
1816 CLK(NULL, "slimbus1_fck", &slimbus1_fck, CK_443X),
1817 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X),
1818 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X),
1819 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X),
1820 CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X),
1821 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
1822 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
1823 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
1824 CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
1825 CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
1826 CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
1827 CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
1828 CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
1829 CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
1830 CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
1831 CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
1832 CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
1833 CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
1834 CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
1835 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
1836 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
1837 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
1838 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
1839 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
1840 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
1841 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
1842 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
1843 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
1844 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X),
1845 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X),
1846 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X),
1847 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X),
1848 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
1849 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
1850 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
1851 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
1852 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
1853 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
1854 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
1855 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
1856 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
1857 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
1858 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
1859 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
1860 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
1861 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
1862 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
1863 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
1864 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
1865 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
1866 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
1867 CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
1868 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
1869 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
1870 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
1871 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
1872 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
1873 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
1874 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
1875 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
1876 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
1877 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
1878 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
1879 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
1880 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
1881 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
1882 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
1883 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
1884 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
1885 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
1886 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
1887 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
1888 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
1889 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
1890 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
1891 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
1892 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
1893 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
1894 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
1895 CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X),
1896 CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X),
1897 CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X),
1898 CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X),
1899 CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X),
1900 CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X),
1901 CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X),
1902 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X),
1903 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X),
1904 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X),
1905 CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X),
1906 CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X),
1907 CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X),
1908 CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X),
1909 CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X),
1910 CLK(NULL, "uart1_ick", &dummy_ck, CK_443X),
1911 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
1912 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
1913 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
1914 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
1915 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
1916 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
1917 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
1918 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
1919 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
1920 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1921 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1922 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1923 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1924 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1925 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1926 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1927 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1928 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1929 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1930 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1931 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1932 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1933 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1934 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1935 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1936 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1937 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1938 CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1939 CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1940 CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1941 CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1942 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
1943};
1944
1945static const char *enable_init_clks[] = {
1946 "emif1_fck",
1947 "emif2_fck",
1948 "gpmc_ick",
1949 "l3_instr_ick",
1950 "l3_main_3_ick",
1951 "ocp_wp_noc_ick",
1952};
1953
1954int __init omap4xxx_clk_init(void)
1955{
1956 u32 cpu_clkflg;
1957 struct omap_clk *c;
1958
1959 if (cpu_is_omap443x()) {
1960 cpu_mask = RATE_IN_4430;
1961 cpu_clkflg = CK_443X;
1962 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
1963 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
1964 cpu_clkflg = CK_446X | CK_443X;
1965
1966 if (cpu_is_omap447x())
1967 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
1968 } else {
1969 return 0;
1970 }
1971
1972 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
1973 c++) {
1974 if (c->cpu & cpu_clkflg) {
1975 clkdev_add(&c->lk);
1976 if (!__clk_init(NULL, c->lk.clk))
1977 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1978 }
1979 }
1980
1981 omap2_clk_disable_autoidle_all();
1982
1983 omap2_clk_enable_init_clocks(enable_init_clks,
1984 ARRAY_SIZE(enable_init_clks));
1985
1986 return 0;
1987}
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index c2d15212d64..25b1feed480 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -21,12 +21,10 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25#include <plat/prcm.h>
26 24
27#include "clock.h" 25#include "clock.h"
28#include "clock2xxx.h" 26#include "clock2xxx.h"
29#include "cm2xxx_3xxx.h" 27#include "cm2xxx.h"
30#include "cm-regbits-24xx.h" 28#include "cm-regbits-24xx.h"
31 29
32/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ 30/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
@@ -38,92 +36,90 @@
38#define APLLS_CLKIN_13MHZ 2 36#define APLLS_CLKIN_13MHZ 2
39#define APLLS_CLKIN_12MHZ 3 37#define APLLS_CLKIN_12MHZ 3
40 38
41void __iomem *cm_idlest_pll;
42
43/* Private functions */ 39/* Private functions */
44 40
45/* Enable an APLL if off */ 41/**
46static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask) 42 * omap2xxx_clk_apll_locked - is the APLL locked?
43 * @hw: struct clk_hw * of the APLL to check
44 *
45 * If the APLL IP block referred to by @hw indicates that it's locked,
46 * return true; otherwise, return false.
47 */
48static bool omap2xxx_clk_apll_locked(struct clk_hw *hw)
47{ 49{
48 u32 cval, apll_mask; 50 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
51 u32 r, apll_mask;
49 52
50 apll_mask = EN_APLL_LOCKED << clk->enable_bit; 53 apll_mask = EN_APLL_LOCKED << clk->enable_bit;
51 54
52 cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 55 r = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
53
54 if ((cval & apll_mask) == apll_mask)
55 return 0; /* apll already enabled */
56
57 cval &= ~apll_mask;
58 cval |= apll_mask;
59 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
60
61 omap2_cm_wait_idlest(cm_idlest_pll, status_mask,
62 OMAP24XX_CM_IDLEST_VAL, __clk_get_name(clk));
63 56
64 /* 57 return ((r & apll_mask) == apll_mask) ? true : false;
65 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
66 * fails?
67 */
68 return 0;
69} 58}
70 59
71static int omap2_clk_apll96_enable(struct clk *clk) 60int omap2_clk_apll96_enable(struct clk_hw *hw)
72{ 61{
73 return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL_MASK); 62 return omap2xxx_cm_apll96_enable();
74} 63}
75 64
76static int omap2_clk_apll54_enable(struct clk *clk) 65int omap2_clk_apll54_enable(struct clk_hw *hw)
77{ 66{
78 return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL_MASK); 67 return omap2xxx_cm_apll54_enable();
79} 68}
80 69
81static void _apll96_allow_idle(struct clk *clk) 70static void _apll96_allow_idle(struct clk_hw_omap *clk)
82{ 71{
83 omap2xxx_cm_set_apll96_auto_low_power_stop(); 72 omap2xxx_cm_set_apll96_auto_low_power_stop();
84} 73}
85 74
86static void _apll96_deny_idle(struct clk *clk) 75static void _apll96_deny_idle(struct clk_hw_omap *clk)
87{ 76{
88 omap2xxx_cm_set_apll96_disable_autoidle(); 77 omap2xxx_cm_set_apll96_disable_autoidle();
89} 78}
90 79
91static void _apll54_allow_idle(struct clk *clk) 80static void _apll54_allow_idle(struct clk_hw_omap *clk)
92{ 81{
93 omap2xxx_cm_set_apll54_auto_low_power_stop(); 82 omap2xxx_cm_set_apll54_auto_low_power_stop();
94} 83}
95 84
96static void _apll54_deny_idle(struct clk *clk) 85static void _apll54_deny_idle(struct clk_hw_omap *clk)
97{ 86{
98 omap2xxx_cm_set_apll54_disable_autoidle(); 87 omap2xxx_cm_set_apll54_disable_autoidle();
99} 88}
100 89
101/* Stop APLL */ 90void omap2_clk_apll96_disable(struct clk_hw *hw)
102static void omap2_clk_apll_disable(struct clk *clk)
103{ 91{
104 u32 cval; 92 omap2xxx_cm_apll96_disable();
93}
105 94
106 cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 95void omap2_clk_apll54_disable(struct clk_hw *hw)
107 cval &= ~(EN_APLL_LOCKED << clk->enable_bit); 96{
108 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); 97 omap2xxx_cm_apll54_disable();
109} 98}
110 99
111/* Public data */ 100unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
101 unsigned long parent_rate)
102{
103 return (omap2xxx_clk_apll_locked(hw)) ? 54000000 : 0;
104}
112 105
113const struct clkops clkops_apll96 = { 106unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
114 .enable = omap2_clk_apll96_enable, 107 unsigned long parent_rate)
115 .disable = omap2_clk_apll_disable, 108{
116 .allow_idle = _apll96_allow_idle, 109 return (omap2xxx_clk_apll_locked(hw)) ? 96000000 : 0;
117 .deny_idle = _apll96_deny_idle, 110}
118};
119 111
120const struct clkops clkops_apll54 = { 112/* Public data */
121 .enable = omap2_clk_apll54_enable, 113const struct clk_hw_omap_ops clkhwops_apll54 = {
122 .disable = omap2_clk_apll_disable,
123 .allow_idle = _apll54_allow_idle, 114 .allow_idle = _apll54_allow_idle,
124 .deny_idle = _apll54_deny_idle, 115 .deny_idle = _apll54_deny_idle,
125}; 116};
126 117
118const struct clk_hw_omap_ops clkhwops_apll96 = {
119 .allow_idle = _apll96_allow_idle,
120 .deny_idle = _apll96_deny_idle,
121};
122
127/* Public functions */ 123/* Public functions */
128 124
129u32 omap2xxx_get_apll_clkin(void) 125u32 omap2xxx_get_apll_clkin(void)
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpll.c b/arch/arm/mach-omap2/clkt2xxx_dpll.c
index 1502a7bc20b..82572e277b9 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpll.c
@@ -14,10 +14,8 @@
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17#include <plat/clock.h>
18
19#include "clock.h" 17#include "clock.h"
20#include "cm2xxx_3xxx.h" 18#include "cm2xxx.h"
21#include "cm-regbits-24xx.h" 19#include "cm-regbits-24xx.h"
22 20
23/* Private functions */ 21/* Private functions */
@@ -31,7 +29,7 @@
31 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1 29 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
32 * instead. Add some mechanism to optionally enter this mode. 30 * instead. Add some mechanism to optionally enter this mode.
33 */ 31 */
34static void _allow_idle(struct clk *clk) 32static void _allow_idle(struct clk_hw_omap *clk)
35{ 33{
36 if (!clk || !clk->dpll_data) 34 if (!clk || !clk->dpll_data)
37 return; 35 return;
@@ -45,7 +43,7 @@ static void _allow_idle(struct clk *clk)
45 * 43 *
46 * Disable DPLL automatic idle control. No return value. 44 * Disable DPLL automatic idle control. No return value.
47 */ 45 */
48static void _deny_idle(struct clk *clk) 46static void _deny_idle(struct clk_hw_omap *clk)
49{ 47{
50 if (!clk || !clk->dpll_data) 48 if (!clk || !clk->dpll_data)
51 return; 49 return;
@@ -55,9 +53,7 @@ static void _deny_idle(struct clk *clk)
55 53
56 54
57/* Public data */ 55/* Public data */
58 56const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll = {
59const struct clkops clkops_omap2xxx_dpll_ops = {
60 .allow_idle = _allow_idle, 57 .allow_idle = _allow_idle,
61 .deny_idle = _deny_idle, 58 .deny_idle = _deny_idle,
62}; 59};
63
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 4ae43922208..d8620105c42 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -25,21 +25,25 @@
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/io.h> 26#include <linux/io.h>
27 27
28#include <plat/clock.h>
29#include <plat/sram.h>
30#include <plat/sdrc.h>
31
32#include "clock.h" 28#include "clock.h"
33#include "clock2xxx.h" 29#include "clock2xxx.h"
34#include "opp2xxx.h" 30#include "opp2xxx.h"
35#include "cm2xxx_3xxx.h" 31#include "cm2xxx.h"
36#include "cm-regbits-24xx.h" 32#include "cm-regbits-24xx.h"
33#include "sdrc.h"
34#include "sram.h"
37 35
38/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ 36/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
39 37
38/*
39 * dpll_core_ck: pointer to the combined dpll_ck + core_ck on OMAP2xxx
40 * (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set
41 * during dpll_ck init and used later by omap2xxx_clk_get_core_rate().
42 */
43static struct clk_hw_omap *dpll_core_ck;
44
40/** 45/**
41 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate 46 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
42 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
43 * 47 *
44 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate 48 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate
45 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz 49 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
@@ -47,12 +51,14 @@
47 * struct clk *dpll_ck, which is a composite clock of dpll_ck and 51 * struct clk *dpll_ck, which is a composite clock of dpll_ck and
48 * core_ck. 52 * core_ck.
49 */ 53 */
50unsigned long omap2xxx_clk_get_core_rate(struct clk *clk) 54unsigned long omap2xxx_clk_get_core_rate(void)
51{ 55{
52 long long core_clk; 56 long long core_clk;
53 u32 v; 57 u32 v;
54 58
55 core_clk = omap2_get_dpll_rate(clk); 59 WARN_ON(!dpll_core_ck);
60
61 core_clk = omap2_get_dpll_rate(dpll_core_ck);
56 62
57 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 63 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
58 v &= OMAP24XX_CORE_CLK_SRC_MASK; 64 v &= OMAP24XX_CORE_CLK_SRC_MASK;
@@ -98,19 +104,22 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
98 104
99} 105}
100 106
101unsigned long omap2_dpllcore_recalc(struct clk *clk) 107unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
108 unsigned long parent_rate)
102{ 109{
103 return omap2xxx_clk_get_core_rate(clk); 110 return omap2xxx_clk_get_core_rate();
104} 111}
105 112
106int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) 113int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
114 unsigned long parent_rate)
107{ 115{
116 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
108 u32 cur_rate, low, mult, div, valid_rate, done_rate; 117 u32 cur_rate, low, mult, div, valid_rate, done_rate;
109 u32 bypass = 0; 118 u32 bypass = 0;
110 struct prcm_config tmpset; 119 struct prcm_config tmpset;
111 const struct dpll_data *dd; 120 const struct dpll_data *dd;
112 121
113 cur_rate = omap2xxx_clk_get_core_rate(dclk); 122 cur_rate = omap2xxx_clk_get_core_rate();
114 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 123 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
115 mult &= OMAP24XX_CORE_CLK_SRC_MASK; 124 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
116 125
@@ -171,3 +180,19 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
171 return 0; 180 return 0;
172} 181}
173 182
183/**
184 * omap2xxx_clkt_dpllcore_init - clk init function for dpll_ck
185 * @clk: struct clk *dpll_ck
186 *
187 * Store a local copy of @clk in dpll_core_ck so other code can query
188 * the core rate without having to clk_get(), which can sleep. Must
189 * only be called once. No return value. XXX If the clock
190 * registration process is ever changed such that dpll_ck is no longer
191 * statically defined, this code may need to change to increment some
192 * kind of use count on dpll_ck.
193 */
194void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw)
195{
196 WARN(dpll_core_ck, "dpll_core_ck already set - should never happen");
197 dpll_core_ck = to_clk_hw_omap(hw);
198}
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
index c3460928b5e..19f54d43349 100644
--- a/arch/arm/mach-omap2/clkt2xxx_osc.c
+++ b/arch/arm/mach-omap2/clkt2xxx_osc.c
@@ -23,8 +23,6 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <plat/clock.h>
27
28#include "clock.h" 26#include "clock.h"
29#include "clock2xxx.h" 27#include "clock2xxx.h"
30#include "prm2xxx_3xxx.h" 28#include "prm2xxx_3xxx.h"
@@ -37,7 +35,7 @@
37 * clk_enable/clk_disable()-based usecounting for osc_ck should be 35 * clk_enable/clk_disable()-based usecounting for osc_ck should be
38 * replaced with autoidle-based usecounting. 36 * replaced with autoidle-based usecounting.
39 */ 37 */
40static int omap2_enable_osc_ck(struct clk *clk) 38int omap2_enable_osc_ck(struct clk_hw *clk)
41{ 39{
42 u32 pcc; 40 u32 pcc;
43 41
@@ -55,7 +53,7 @@ static int omap2_enable_osc_ck(struct clk *clk)
55 * clk_enable/clk_disable()-based usecounting for osc_ck should be 53 * clk_enable/clk_disable()-based usecounting for osc_ck should be
56 * replaced with autoidle-based usecounting. 54 * replaced with autoidle-based usecounting.
57 */ 55 */
58static void omap2_disable_osc_ck(struct clk *clk) 56void omap2_disable_osc_ck(struct clk_hw *clk)
59{ 57{
60 u32 pcc; 58 u32 pcc;
61 59
@@ -64,13 +62,8 @@ static void omap2_disable_osc_ck(struct clk *clk)
64 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); 62 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
65} 63}
66 64
67const struct clkops clkops_oscck = { 65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
68 .enable = omap2_enable_osc_ck, 66 unsigned long parent_rate)
69 .disable = omap2_disable_osc_ck,
70};
71
72unsigned long omap2_osc_clk_recalc(struct clk *clk)
73{ 67{
74 return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv(); 68 return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv();
75} 69}
76
diff --git a/arch/arm/mach-omap2/clkt2xxx_sys.c b/arch/arm/mach-omap2/clkt2xxx_sys.c
index 8693cfdac49..f467d072cd0 100644
--- a/arch/arm/mach-omap2/clkt2xxx_sys.c
+++ b/arch/arm/mach-omap2/clkt2xxx_sys.c
@@ -22,8 +22,6 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/clock.h>
26
27#include "clock.h" 25#include "clock.h"
28#include "clock2xxx.h" 26#include "clock2xxx.h"
29#include "prm2xxx_3xxx.h" 27#include "prm2xxx_3xxx.h"
@@ -42,9 +40,8 @@ u32 omap2xxx_get_sysclkdiv(void)
42 return div; 40 return div;
43} 41}
44 42
45unsigned long omap2xxx_sys_clk_recalc(struct clk *clk) 43unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
44 unsigned long parent_rate)
46{ 45{
47 return clk->parent->rate / omap2xxx_get_sysclkdiv(); 46 return parent_rate / omap2xxx_get_sysclkdiv();
48} 47}
49
50
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index 3524f0e7b6d..ae2b35e76dc 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2xxx DVFS virtual clock functions 2 * OMAP2xxx DVFS virtual clock functions
3 * 3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc. 4 * Copyright (C) 2005-2008, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 Nokia Corporation 5 * Copyright (C) 2004-2010 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
@@ -33,27 +33,33 @@
33#include <linux/cpufreq.h> 33#include <linux/cpufreq.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35 35
36#include <plat/clock.h>
37#include <plat/sram.h>
38#include <plat/sdrc.h>
39
40#include "soc.h" 36#include "soc.h"
41#include "clock.h" 37#include "clock.h"
42#include "clock2xxx.h" 38#include "clock2xxx.h"
43#include "opp2xxx.h" 39#include "opp2xxx.h"
44#include "cm2xxx_3xxx.h" 40#include "cm2xxx.h"
45#include "cm-regbits-24xx.h" 41#include "cm-regbits-24xx.h"
42#include "sdrc.h"
43#include "sram.h"
46 44
47const struct prcm_config *curr_prcm_set; 45const struct prcm_config *curr_prcm_set;
48const struct prcm_config *rate_table; 46const struct prcm_config *rate_table;
49 47
48/*
49 * sys_ck_rate: the rate of the external high-frequency clock
50 * oscillator on the board. Set by the SoC-specific clock init code.
51 * Once set during a boot, will not change.
52 */
53static unsigned long sys_ck_rate;
54
50/** 55/**
51 * omap2_table_mpu_recalc - just return the MPU speed 56 * omap2_table_mpu_recalc - just return the MPU speed
52 * @clk: virt_prcm_set struct clk 57 * @clk: virt_prcm_set struct clk
53 * 58 *
54 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. 59 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
55 */ 60 */
56unsigned long omap2_table_mpu_recalc(struct clk *clk) 61unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
62 unsigned long parent_rate)
57{ 63{
58 return curr_prcm_set->mpu_speed; 64 return curr_prcm_set->mpu_speed;
59} 65}
@@ -65,18 +71,18 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
65 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and 71 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and
66 * just uses the ARM rates. 72 * just uses the ARM rates.
67 */ 73 */
68long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) 74long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
75 unsigned long *parent_rate)
69{ 76{
70 const struct prcm_config *ptr; 77 const struct prcm_config *ptr;
71 long highest_rate, sys_clk_rate; 78 long highest_rate;
72 79
73 highest_rate = -EINVAL; 80 highest_rate = -EINVAL;
74 sys_clk_rate = __clk_get_rate(sclk);
75 81
76 for (ptr = rate_table; ptr->mpu_speed; ptr++) { 82 for (ptr = rate_table; ptr->mpu_speed; ptr++) {
77 if (!(ptr->flags & cpu_mask)) 83 if (!(ptr->flags & cpu_mask))
78 continue; 84 continue;
79 if (ptr->xtal_speed != sys_clk_rate) 85 if (ptr->xtal_speed != sys_ck_rate)
80 continue; 86 continue;
81 87
82 highest_rate = ptr->mpu_speed; 88 highest_rate = ptr->mpu_speed;
@@ -89,21 +95,19 @@ long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
89} 95}
90 96
91/* Sets basic clocks based on the specified rate */ 97/* Sets basic clocks based on the specified rate */
92int omap2_select_table_rate(struct clk *clk, unsigned long rate) 98int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
99 unsigned long parent_rate)
93{ 100{
94 u32 cur_rate, done_rate, bypass = 0, tmp; 101 u32 cur_rate, done_rate, bypass = 0, tmp;
95 const struct prcm_config *prcm; 102 const struct prcm_config *prcm;
96 unsigned long found_speed = 0; 103 unsigned long found_speed = 0;
97 unsigned long flags; 104 unsigned long flags;
98 long sys_clk_rate;
99
100 sys_clk_rate = __clk_get_rate(sclk);
101 105
102 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 106 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
103 if (!(prcm->flags & cpu_mask)) 107 if (!(prcm->flags & cpu_mask))
104 continue; 108 continue;
105 109
106 if (prcm->xtal_speed != sys_clk_rate) 110 if (prcm->xtal_speed != sys_ck_rate)
107 continue; 111 continue;
108 112
109 if (prcm->mpu_speed <= rate) { 113 if (prcm->mpu_speed <= rate) {
@@ -119,7 +123,7 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
119 } 123 }
120 124
121 curr_prcm_set = prcm; 125 curr_prcm_set = prcm;
122 cur_rate = omap2xxx_clk_get_core_rate(dclk); 126 cur_rate = omap2xxx_clk_get_core_rate();
123 127
124 if (prcm->dpll_speed == cur_rate / 2) { 128 if (prcm->dpll_speed == cur_rate / 2) {
125 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1); 129 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
@@ -169,3 +173,50 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
169 173
170 return 0; 174 return 0;
171} 175}
176
177/**
178 * omap2xxx_clkt_vps_check_bootloader_rate - determine which of the rate
179 * table sets matches the current CORE DPLL hardware rate
180 *
181 * Check the MPU rate set by bootloader. Sets the 'curr_prcm_set'
182 * global to point to the active rate set when found; otherwise, sets
183 * it to NULL. No return value;
184 */
185void omap2xxx_clkt_vps_check_bootloader_rates(void)
186{
187 const struct prcm_config *prcm = NULL;
188 unsigned long rate;
189
190 rate = omap2xxx_clk_get_core_rate();
191 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
192 if (!(prcm->flags & cpu_mask))
193 continue;
194 if (prcm->xtal_speed != sys_ck_rate)
195 continue;
196 if (prcm->dpll_speed <= rate)
197 break;
198 }
199 curr_prcm_set = prcm;
200}
201
202/**
203 * omap2xxx_clkt_vps_late_init - store a copy of the sys_ck rate
204 *
205 * Store a copy of the sys_ck rate for later use by the OMAP2xxx DVFS
206 * code. (The sys_ck rate does not -- or rather, must not -- change
207 * during kernel runtime.) Must be called after we have a valid
208 * sys_ck rate, but before the virt_prcm_set clock rate is
209 * recalculated. No return value.
210 */
211void omap2xxx_clkt_vps_late_init(void)
212{
213 struct clk *c;
214
215 c = clk_get(NULL, "sys_ck");
216 if (IS_ERR(c)) {
217 WARN(1, "could not locate sys_ck\n");
218 } else {
219 sys_ck_rate = clk_get_rate(c);
220 clk_put(c);
221 }
222}
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index 7c6da2f731d..eb69acf2101 100644
--- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
+++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
@@ -21,14 +21,11 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25#include <plat/sram.h>
26#include <plat/sdrc.h>
27
28#include "clock.h" 24#include "clock.h"
29#include "clock3xxx.h" 25#include "clock3xxx.h"
30#include "clock34xx.h" 26#include "clock34xx.h"
31#include "sdrc.h" 27#include "sdrc.h"
28#include "sram.h"
32 29
33#define CYCLES_PER_MHZ 1000000 30#define CYCLES_PER_MHZ 1000000
34 31
@@ -47,8 +44,10 @@
47 * Program the DPLL M2 divider with the rounded target rate. Returns 44 * Program the DPLL M2 divider with the rounded target rate. Returns
48 * -EINVAL upon error, or 0 upon success. 45 * -EINVAL upon error, or 0 upon success.
49 */ 46 */
50int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) 47int omap3_core_dpll_m2_set_rate(struct clk_hw *hw, unsigned long rate,
48 unsigned long parent_rate)
51{ 49{
50 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
52 u32 new_div = 0; 51 u32 new_div = 0;
53 u32 unlock_dll = 0; 52 u32 unlock_dll = 0;
54 u32 c; 53 u32 c;
@@ -66,7 +65,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
66 return -EINVAL; 65 return -EINVAL;
67 66
68 sdrcrate = __clk_get_rate(sdrc_ick_p); 67 sdrcrate = __clk_get_rate(sdrc_ick_p);
69 clkrate = __clk_get_rate(clk); 68 clkrate = __clk_get_rate(hw->clk);
70 if (rate > clkrate) 69 if (rate > clkrate)
71 sdrcrate <<= ((rate / clkrate) >> 1); 70 sdrcrate <<= ((rate / clkrate) >> 1);
72 else 71 else
@@ -115,8 +114,6 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
115 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 114 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
116 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, 115 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
117 0, 0, 0, 0); 116 0, 0, 0, 0);
118 clk->rate = rate;
119
120 return 0; 117 return 0;
121} 118}
122 119
diff --git a/arch/arm/mach-omap2/clkt_clksel.c b/arch/arm/mach-omap2/clkt_clksel.c
index 3ff22114d70..0ec9f6fdf04 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -41,12 +41,10 @@
41 41
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/errno.h> 43#include <linux/errno.h>
44#include <linux/clk.h> 44#include <linux/clk-provider.h>
45#include <linux/io.h> 45#include <linux/io.h>
46#include <linux/bug.h> 46#include <linux/bug.h>
47 47
48#include <plat/clock.h>
49
50#include "clock.h" 48#include "clock.h"
51 49
52/* Private functions */ 50/* Private functions */
@@ -60,11 +58,14 @@
60 * the element associated with the supplied parent clock address. 58 * the element associated with the supplied parent clock address.
61 * Returns a pointer to the struct clksel on success or NULL on error. 59 * Returns a pointer to the struct clksel on success or NULL on error.
62 */ 60 */
63static const struct clksel *_get_clksel_by_parent(struct clk *clk, 61static const struct clksel *_get_clksel_by_parent(struct clk_hw_omap *clk,
64 struct clk *src_clk) 62 struct clk *src_clk)
65{ 63{
66 const struct clksel *clks; 64 const struct clksel *clks;
67 65
66 if (!src_clk)
67 return NULL;
68
68 for (clks = clk->clksel; clks->parent; clks++) 69 for (clks = clk->clksel; clks->parent; clks++)
69 if (clks->parent == src_clk) 70 if (clks->parent == src_clk)
70 break; /* Found the requested parent */ 71 break; /* Found the requested parent */
@@ -72,7 +73,7 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
72 if (!clks->parent) { 73 if (!clks->parent) {
73 /* This indicates a data problem */ 74 /* This indicates a data problem */
74 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n", 75 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n",
75 __clk_get_name(clk), __clk_get_name(src_clk)); 76 __clk_get_name(clk->hw.clk), __clk_get_name(src_clk));
76 return NULL; 77 return NULL;
77 } 78 }
78 79
@@ -80,64 +81,6 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
80} 81}
81 82
82/** 83/**
83 * _get_div_and_fieldval() - find the new clksel divisor and field value to use
84 * @src_clk: planned new parent struct clk *
85 * @clk: struct clk * that is being reparented
86 * @field_val: pointer to a u32 to contain the register data for the divisor
87 *
88 * Given an intended new parent struct clk * @src_clk, and the struct
89 * clk * @clk to the clock that is being reparented, find the
90 * appropriate rate divisor for the new clock (returned as the return
91 * value), and the corresponding register bitfield data to program to
92 * reach that divisor (returned in the u32 pointed to by @field_val).
93 * Returns 0 on error, or returns the newly-selected divisor upon
94 * success (in this latter case, the corresponding register bitfield
95 * value is passed back in the variable pointed to by @field_val)
96 */
97static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
98 u32 *field_val)
99{
100 const struct clksel *clks;
101 const struct clksel_rate *clkr, *max_clkr = NULL;
102 u8 max_div = 0;
103
104 clks = _get_clksel_by_parent(clk, src_clk);
105 if (!clks)
106 return 0;
107
108 /*
109 * Find the highest divisor (e.g., the one resulting in the
110 * lowest rate) to use as the default. This should avoid
111 * clock rates that are too high for the device. XXX A better
112 * solution here would be to try to determine if there is a
113 * divisor matching the original clock rate before the parent
114 * switch, and if it cannot be found, to fall back to the
115 * highest divisor.
116 */
117 for (clkr = clks->rates; clkr->div; clkr++) {
118 if (!(clkr->flags & cpu_mask))
119 continue;
120
121 if (clkr->div > max_div) {
122 max_div = clkr->div;
123 max_clkr = clkr;
124 }
125 }
126
127 if (max_div == 0) {
128 /* This indicates an error in the clksel data */
129 WARN(1, "clock: %s: could not find divisor for parent %s\n",
130 __clk_get_name(clk),
131 __clk_get_name(__clk_get_parent(src_clk)));
132 return 0;
133 }
134
135 *field_val = max_clkr->val;
136
137 return max_div;
138}
139
140/**
141 * _write_clksel_reg() - program a clock's clksel register in hardware 84 * _write_clksel_reg() - program a clock's clksel register in hardware
142 * @clk: struct clk * to program 85 * @clk: struct clk * to program
143 * @v: clksel bitfield value to program (with LSB at bit 0) 86 * @v: clksel bitfield value to program (with LSB at bit 0)
@@ -150,7 +93,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
150 * take into account any time the hardware might take to switch the 93 * take into account any time the hardware might take to switch the
151 * clock source. 94 * clock source.
152 */ 95 */
153static void _write_clksel_reg(struct clk *clk, u32 field_val) 96static void _write_clksel_reg(struct clk_hw_omap *clk, u32 field_val)
154{ 97{
155 u32 v; 98 u32 v;
156 99
@@ -173,13 +116,14 @@ static void _write_clksel_reg(struct clk *clk, u32 field_val)
173 * before calling. Returns 0 on error or returns the actual integer divisor 116 * before calling. Returns 0 on error or returns the actual integer divisor
174 * upon success. 117 * upon success.
175 */ 118 */
176static u32 _clksel_to_divisor(struct clk *clk, u32 field_val) 119static u32 _clksel_to_divisor(struct clk_hw_omap *clk, u32 field_val)
177{ 120{
178 const struct clksel *clks; 121 const struct clksel *clks;
179 const struct clksel_rate *clkr; 122 const struct clksel_rate *clkr;
180 struct clk *parent; 123 struct clk *parent;
181 124
182 parent = __clk_get_parent(clk); 125 parent = __clk_get_parent(clk->hw.clk);
126
183 clks = _get_clksel_by_parent(clk, parent); 127 clks = _get_clksel_by_parent(clk, parent);
184 if (!clks) 128 if (!clks)
185 return 0; 129 return 0;
@@ -195,7 +139,8 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
195 if (!clkr->div) { 139 if (!clkr->div) {
196 /* This indicates a data error */ 140 /* This indicates a data error */
197 WARN(1, "clock: %s: could not find fieldval %d for parent %s\n", 141 WARN(1, "clock: %s: could not find fieldval %d for parent %s\n",
198 __clk_get_name(clk), field_val, __clk_get_name(parent)); 142 __clk_get_name(clk->hw.clk), field_val,
143 __clk_get_name(parent));
199 return 0; 144 return 0;
200 } 145 }
201 146
@@ -212,7 +157,7 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
212 * register field value _before_ left-shifting (i.e., LSB is at bit 157 * register field value _before_ left-shifting (i.e., LSB is at bit
213 * 0); or returns 0xFFFFFFFF (~0) upon error. 158 * 0); or returns 0xFFFFFFFF (~0) upon error.
214 */ 159 */
215static u32 _divisor_to_clksel(struct clk *clk, u32 div) 160static u32 _divisor_to_clksel(struct clk_hw_omap *clk, u32 div)
216{ 161{
217 const struct clksel *clks; 162 const struct clksel *clks;
218 const struct clksel_rate *clkr; 163 const struct clksel_rate *clkr;
@@ -221,7 +166,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
221 /* should never happen */ 166 /* should never happen */
222 WARN_ON(div == 0); 167 WARN_ON(div == 0);
223 168
224 parent = __clk_get_parent(clk); 169 parent = __clk_get_parent(clk->hw.clk);
225 clks = _get_clksel_by_parent(clk, parent); 170 clks = _get_clksel_by_parent(clk, parent);
226 if (!clks) 171 if (!clks)
227 return ~0; 172 return ~0;
@@ -236,7 +181,8 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
236 181
237 if (!clkr->div) { 182 if (!clkr->div) {
238 pr_err("clock: %s: could not find divisor %d for parent %s\n", 183 pr_err("clock: %s: could not find divisor %d for parent %s\n",
239 __clk_get_name(clk), div, __clk_get_name(parent)); 184 __clk_get_name(clk->hw.clk), div,
185 __clk_get_name(parent));
240 return ~0; 186 return ~0;
241 } 187 }
242 188
@@ -251,7 +197,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
251 * into the hardware, convert it into the actual divisor value, and 197 * into the hardware, convert it into the actual divisor value, and
252 * return it; or return 0 on error. 198 * return it; or return 0 on error.
253 */ 199 */
254static u32 _read_divisor(struct clk *clk) 200static u32 _read_divisor(struct clk_hw_omap *clk)
255{ 201{
256 u32 v; 202 u32 v;
257 203
@@ -279,7 +225,8 @@ static u32 _read_divisor(struct clk *clk)
279 * 225 *
280 * Returns the rounded clock rate or returns 0xffffffff on error. 226 * Returns the rounded clock rate or returns 0xffffffff on error.
281 */ 227 */
282u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 228u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
229 unsigned long target_rate,
283 u32 *new_div) 230 u32 *new_div)
284{ 231{
285 unsigned long test_rate; 232 unsigned long test_rate;
@@ -290,9 +237,9 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
290 unsigned long parent_rate; 237 unsigned long parent_rate;
291 const char *clk_name; 238 const char *clk_name;
292 239
293 parent = __clk_get_parent(clk); 240 parent = __clk_get_parent(clk->hw.clk);
241 clk_name = __clk_get_name(clk->hw.clk);
294 parent_rate = __clk_get_rate(parent); 242 parent_rate = __clk_get_rate(parent);
295 clk_name = __clk_get_name(clk);
296 243
297 if (!clk->clksel || !clk->clksel_mask) 244 if (!clk->clksel || !clk->clksel_mask)
298 return ~0; 245 return ~0;
@@ -343,27 +290,35 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
343 */ 290 */
344 291
345/** 292/**
346 * omap2_init_clksel_parent() - set a clksel clk's parent field from the hdwr 293 * omap2_clksel_find_parent_index() - return the array index of the current
347 * @clk: OMAP clock struct ptr to use 294 * hardware parent of @hw
295 * @hw: struct clk_hw * to find the current hardware parent of
348 * 296 *
349 * Given a pointer @clk to a source-selectable struct clk, read the 297 * Given a struct clk_hw pointer @hw to the 'hw' member of a struct
350 * hardware register and determine what its parent is currently set 298 * clk_hw_omap record representing a source-selectable hardware clock,
351 * to. Update @clk's .parent field with the appropriate clk ptr. No 299 * read the hardware register and determine what its parent is
352 * return value. 300 * currently set to. Intended to be called only by the common clock
301 * framework struct clk_hw_ops.get_parent function pointer. Return
302 * the array index of this parent clock upon success -- there is no
303 * way to return an error, so if we encounter an error, just WARN()
304 * and pretend that we know that we're doing.
353 */ 305 */
354void omap2_init_clksel_parent(struct clk *clk) 306u8 omap2_clksel_find_parent_index(struct clk_hw *hw)
355{ 307{
308 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
356 const struct clksel *clks; 309 const struct clksel *clks;
357 const struct clksel_rate *clkr; 310 const struct clksel_rate *clkr;
358 u32 r, found = 0; 311 u32 r, found = 0;
359 struct clk *parent; 312 struct clk *parent;
360 const char *clk_name; 313 const char *clk_name;
314 int ret = 0, f = 0;
361 315
362 if (!clk->clksel || !clk->clksel_mask) 316 parent = __clk_get_parent(hw->clk);
363 return; 317 clk_name = __clk_get_name(hw->clk);
364 318
365 parent = __clk_get_parent(clk); 319 /* XXX should be able to return an error */
366 clk_name = __clk_get_name(clk); 320 WARN((!clk->clksel || !clk->clksel_mask),
321 "clock: %s: attempt to call on a non-clksel clock", clk_name);
367 322
368 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask; 323 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask;
369 r >>= __ffs(clk->clksel_mask); 324 r >>= __ffs(clk->clksel_mask);
@@ -374,27 +329,21 @@ void omap2_init_clksel_parent(struct clk *clk)
374 continue; 329 continue;
375 330
376 if (clkr->val == r) { 331 if (clkr->val == r) {
377 if (parent != clks->parent) {
378 pr_debug("clock: %s: inited parent to %s (was %s)\n",
379 clk_name,
380 __clk_get_name(clks->parent),
381 ((parent) ?
382 __clk_get_name(parent) :
383 "NULL"));
384 clk_reparent(clk, clks->parent);
385 }
386 found = 1; 332 found = 1;
333 ret = f;
387 } 334 }
388 } 335 }
336 f++;
389 } 337 }
390 338
391 /* This indicates a data error */ 339 /* This indicates a data error */
392 WARN(!found, "clock: %s: init parent: could not find regval %0x\n", 340 WARN(!found, "clock: %s: init parent: could not find regval %0x\n",
393 clk_name, r); 341 clk_name, r);
394 342
395 return; 343 return ret;
396} 344}
397 345
346
398/** 347/**
399 * omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field 348 * omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field
400 * @clk: struct clk * 349 * @clk: struct clk *
@@ -404,21 +353,23 @@ void omap2_init_clksel_parent(struct clk *clk)
404 * function. Returns the clock's current rate, based on its parent's rate 353 * function. Returns the clock's current rate, based on its parent's rate
405 * and its current divisor setting in the hardware. 354 * and its current divisor setting in the hardware.
406 */ 355 */
407unsigned long omap2_clksel_recalc(struct clk *clk) 356unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate)
408{ 357{
409 unsigned long rate; 358 unsigned long rate;
410 u32 div = 0; 359 u32 div = 0;
411 struct clk *parent; 360 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
412 361
413 div = _read_divisor(clk); 362 if (!parent_rate)
414 if (div == 0) 363 return 0;
415 return __clk_get_rate(clk);
416 364
417 parent = __clk_get_parent(clk); 365 div = _read_divisor(clk);
418 rate = __clk_get_rate(parent) / div; 366 if (!div)
367 rate = parent_rate;
368 else
369 rate = parent_rate / div;
419 370
420 pr_debug("clock: %s: recalc'd rate is %ld (div %d)\n", 371 pr_debug("%s: recalc'd %s's rate to %lu (div %d)\n", __func__,
421 __clk_get_name(clk), rate, div); 372 __clk_get_name(hw->clk), rate, div);
422 373
423 return rate; 374 return rate;
424} 375}
@@ -434,8 +385,10 @@ unsigned long omap2_clksel_recalc(struct clk *clk)
434 * 385 *
435 * Returns the rounded clock rate or returns 0xffffffff on error. 386 * Returns the rounded clock rate or returns 0xffffffff on error.
436 */ 387 */
437long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate) 388long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
389 unsigned long *parent_rate)
438{ 390{
391 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
439 u32 new_div; 392 u32 new_div;
440 393
441 return omap2_clksel_round_rate_div(clk, target_rate, &new_div); 394 return omap2_clksel_round_rate_div(clk, target_rate, &new_div);
@@ -456,8 +409,10 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate)
456 * is changed, they will all be affected without any notification. 409 * is changed, they will all be affected without any notification.
457 * Returns -EINVAL upon error, or 0 upon success. 410 * Returns -EINVAL upon error, or 0 upon success.
458 */ 411 */
459int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) 412int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
413 unsigned long parent_rate)
460{ 414{
415 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
461 u32 field_val, validrate, new_div = 0; 416 u32 field_val, validrate, new_div = 0;
462 417
463 if (!clk->clksel || !clk->clksel_mask) 418 if (!clk->clksel || !clk->clksel_mask)
@@ -473,10 +428,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
473 428
474 _write_clksel_reg(clk, field_val); 429 _write_clksel_reg(clk, field_val);
475 430
476 clk->rate = __clk_get_rate(__clk_get_parent(clk)) / new_div; 431 pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(hw->clk),
477 432 __clk_get_rate(hw->clk));
478 pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(clk),
479 __clk_get_rate(clk));
480 433
481 return 0; 434 return 0;
482} 435}
@@ -501,32 +454,13 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
501 * affected without any notification. Returns -EINVAL upon error, or 454 * affected without any notification. Returns -EINVAL upon error, or
502 * 0 upon success. 455 * 0 upon success.
503 */ 456 */
504int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent) 457int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val)
505{ 458{
506 u32 field_val = 0; 459 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
507 u32 parent_div;
508 460
509 if (!clk->clksel || !clk->clksel_mask) 461 if (!clk->clksel || !clk->clksel_mask)
510 return -EINVAL; 462 return -EINVAL;
511 463
512 parent_div = _get_div_and_fieldval(new_parent, clk, &field_val);
513 if (!parent_div)
514 return -EINVAL;
515
516 _write_clksel_reg(clk, field_val); 464 _write_clksel_reg(clk, field_val);
517
518 clk_reparent(clk, new_parent);
519
520 /* CLKSEL clocks follow their parents' rates, divided by a divisor */
521 clk->rate = __clk_get_rate(new_parent);
522
523 if (parent_div > 0)
524 __clk_get_rate(clk) /= parent_div;
525
526 pr_debug("clock: %s: set parent to %s (new rate %ld)\n",
527 __clk_get_name(clk),
528 __clk_get_name(__clk_get_parent(clk)),
529 __clk_get_rate(clk));
530
531 return 0; 465 return 0;
532} 466}
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 80411142f48..924c230f894 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -16,13 +16,11 @@
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/clk.h> 19#include <linux/clk-provider.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <asm/div64.h> 22#include <asm/div64.h>
23 23
24#include <plat/clock.h>
25
26#include "soc.h" 24#include "soc.h"
27#include "clock.h" 25#include "clock.h"
28#include "cm-regbits-24xx.h" 26#include "cm-regbits-24xx.h"
@@ -78,7 +76,7 @@
78 * (assuming that it is counting N upwards), or -2 if the enclosing loop 76 * (assuming that it is counting N upwards), or -2 if the enclosing loop
79 * should skip to the next iteration (again assuming N is increasing). 77 * should skip to the next iteration (again assuming N is increasing).
80 */ 78 */
81static int _dpll_test_fint(struct clk *clk, u8 n) 79static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n)
82{ 80{
83 struct dpll_data *dd; 81 struct dpll_data *dd;
84 long fint, fint_min, fint_max; 82 long fint, fint_min, fint_max;
@@ -87,7 +85,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n)
87 dd = clk->dpll_data; 85 dd = clk->dpll_data;
88 86
89 /* DPLL divider must result in a valid jitter correction val */ 87 /* DPLL divider must result in a valid jitter correction val */
90 fint = __clk_get_rate(__clk_get_parent(clk)) / n; 88 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n;
91 89
92 if (cpu_is_omap24xx()) { 90 if (cpu_is_omap24xx()) {
93 /* Should not be called for OMAP2, so warn if it is called */ 91 /* Should not be called for OMAP2, so warn if it is called */
@@ -188,15 +186,15 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
188} 186}
189 187
190/* Public functions */ 188/* Public functions */
191 189u8 omap2_init_dpll_parent(struct clk_hw *hw)
192void omap2_init_dpll_parent(struct clk *clk)
193{ 190{
191 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
194 u32 v; 192 u32 v;
195 struct dpll_data *dd; 193 struct dpll_data *dd;
196 194
197 dd = clk->dpll_data; 195 dd = clk->dpll_data;
198 if (!dd) 196 if (!dd)
199 return; 197 return -EINVAL;
200 198
201 v = __raw_readl(dd->control_reg); 199 v = __raw_readl(dd->control_reg);
202 v &= dd->enable_mask; 200 v &= dd->enable_mask;
@@ -206,18 +204,18 @@ void omap2_init_dpll_parent(struct clk *clk)
206 if (cpu_is_omap24xx()) { 204 if (cpu_is_omap24xx()) {
207 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 205 if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
208 v == OMAP2XXX_EN_DPLL_FRBYPASS) 206 v == OMAP2XXX_EN_DPLL_FRBYPASS)
209 clk_reparent(clk, dd->clk_bypass); 207 return 1;
210 } else if (cpu_is_omap34xx()) { 208 } else if (cpu_is_omap34xx()) {
211 if (v == OMAP3XXX_EN_DPLL_LPBYPASS || 209 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
212 v == OMAP3XXX_EN_DPLL_FRBYPASS) 210 v == OMAP3XXX_EN_DPLL_FRBYPASS)
213 clk_reparent(clk, dd->clk_bypass); 211 return 1;
214 } else if (soc_is_am33xx() || cpu_is_omap44xx()) { 212 } else if (soc_is_am33xx() || cpu_is_omap44xx()) {
215 if (v == OMAP4XXX_EN_DPLL_LPBYPASS || 213 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
216 v == OMAP4XXX_EN_DPLL_FRBYPASS || 214 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
217 v == OMAP4XXX_EN_DPLL_MNBYPASS) 215 v == OMAP4XXX_EN_DPLL_MNBYPASS)
218 clk_reparent(clk, dd->clk_bypass); 216 return 1;
219 } 217 }
220 return; 218 return 0;
221} 219}
222 220
223/** 221/**
@@ -234,7 +232,7 @@ void omap2_init_dpll_parent(struct clk *clk)
234 * locked, or the appropriate bypass rate if the DPLL is bypassed, or 0 232 * locked, or the appropriate bypass rate if the DPLL is bypassed, or 0
235 * if the clock @clk is not a DPLL. 233 * if the clock @clk is not a DPLL.
236 */ 234 */
237u32 omap2_get_dpll_rate(struct clk *clk) 235unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
238{ 236{
239 long long dpll_clk; 237 long long dpll_clk;
240 u32 dpll_mult, dpll_div, v; 238 u32 dpll_mult, dpll_div, v;
@@ -290,8 +288,10 @@ u32 omap2_get_dpll_rate(struct clk *clk)
290 * (expensive) function again. Returns ~0 if the target rate cannot 288 * (expensive) function again. Returns ~0 if the target rate cannot
291 * be rounded, or the rounded rate upon success. 289 * be rounded, or the rounded rate upon success.
292 */ 290 */
293long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) 291long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
292 unsigned long *parent_rate)
294{ 293{
294 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
295 int m, n, r, scaled_max_m; 295 int m, n, r, scaled_max_m;
296 unsigned long scaled_rt_rp; 296 unsigned long scaled_rt_rp;
297 unsigned long new_rate = 0; 297 unsigned long new_rate = 0;
@@ -305,7 +305,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
305 dd = clk->dpll_data; 305 dd = clk->dpll_data;
306 306
307 ref_rate = __clk_get_rate(dd->clk_ref); 307 ref_rate = __clk_get_rate(dd->clk_ref);
308 clk_name = __clk_get_name(clk); 308 clk_name = __clk_get_name(hw->clk);
309 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n", 309 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n",
310 clk_name, target_rate); 310 clk_name, target_rate);
311 311
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index 3d43fba2542..f10eb03ce3e 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -11,11 +11,9 @@
11#undef DEBUG 11#undef DEBUG
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/clk.h> 14#include <linux/clk-provider.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17#include <plat/clock.h>
18#include <plat/prcm.h>
19 17
20#include "clock.h" 18#include "clock.h"
21#include "clock2xxx.h" 19#include "clock2xxx.h"
@@ -25,7 +23,7 @@
25/* Private functions */ 23/* Private functions */
26 24
27/* XXX */ 25/* XXX */
28void omap2_clkt_iclk_allow_idle(struct clk *clk) 26void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
29{ 27{
30 u32 v, r; 28 u32 v, r;
31 29
@@ -37,7 +35,7 @@ void omap2_clkt_iclk_allow_idle(struct clk *clk)
37} 35}
38 36
39/* XXX */ 37/* XXX */
40void omap2_clkt_iclk_deny_idle(struct clk *clk) 38void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
41{ 39{
42 u32 v, r; 40 u32 v, r;
43 41
@@ -50,33 +48,17 @@ void omap2_clkt_iclk_deny_idle(struct clk *clk)
50 48
51/* Public data */ 49/* Public data */
52 50
53const struct clkops clkops_omap2_iclk_dflt_wait = { 51const struct clk_hw_omap_ops clkhwops_iclk = {
54 .enable = omap2_dflt_clk_enable,
55 .disable = omap2_dflt_clk_disable,
56 .find_companion = omap2_clk_dflt_find_companion,
57 .find_idlest = omap2_clk_dflt_find_idlest,
58 .allow_idle = omap2_clkt_iclk_allow_idle, 52 .allow_idle = omap2_clkt_iclk_allow_idle,
59 .deny_idle = omap2_clkt_iclk_deny_idle, 53 .deny_idle = omap2_clkt_iclk_deny_idle,
60}; 54};
61 55
62const struct clkops clkops_omap2_iclk_dflt = { 56const struct clk_hw_omap_ops clkhwops_iclk_wait = {
63 .enable = omap2_dflt_clk_enable,
64 .disable = omap2_dflt_clk_disable,
65 .allow_idle = omap2_clkt_iclk_allow_idle, 57 .allow_idle = omap2_clkt_iclk_allow_idle,
66 .deny_idle = omap2_clkt_iclk_deny_idle, 58 .deny_idle = omap2_clkt_iclk_deny_idle,
59 .find_idlest = omap2_clk_dflt_find_idlest,
60 .find_companion = omap2_clk_dflt_find_companion,
67}; 61};
68 62
69const struct clkops clkops_omap2_iclk_idle_only = {
70 .allow_idle = omap2_clkt_iclk_allow_idle,
71 .deny_idle = omap2_clkt_iclk_deny_idle,
72};
73 63
74const struct clkops clkops_omap2_mdmclk_dflt_wait = {
75 .enable = omap2_dflt_clk_enable,
76 .disable = omap2_dflt_clk_disable,
77 .find_companion = omap2_clk_dflt_find_companion,
78 .find_idlest = omap2_clk_dflt_find_idlest,
79 .allow_idle = omap2_clkt_iclk_allow_idle,
80 .deny_idle = omap2_clkt_iclk_deny_idle,
81};
82 64
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 961ac8f7e13..e4ec3a69ee2 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -15,27 +15,35 @@
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/export.h>
18#include <linux/list.h> 19#include <linux/list.h>
19#include <linux/errno.h> 20#include <linux/errno.h>
20#include <linux/err.h> 21#include <linux/err.h>
21#include <linux/delay.h> 22#include <linux/delay.h>
22#include <linux/clk.h> 23#include <linux/clk-provider.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/bitops.h> 25#include <linux/bitops.h>
25 26
26#include <asm/cpu.h> 27#include <asm/cpu.h>
27 28
28#include <plat/clock.h>
29#include <plat/prcm.h>
30 29
31#include <trace/events/power.h> 30#include <trace/events/power.h>
32 31
33#include "soc.h" 32#include "soc.h"
34#include "clockdomain.h" 33#include "clockdomain.h"
35#include "clock.h" 34#include "clock.h"
36#include "cm2xxx_3xxx.h" 35#include "cm.h"
36#include "cm2xxx.h"
37#include "cm3xxx.h"
37#include "cm-regbits-24xx.h" 38#include "cm-regbits-24xx.h"
38#include "cm-regbits-34xx.h" 39#include "cm-regbits-34xx.h"
40#include "common.h"
41
42/*
43 * MAX_MODULE_ENABLE_WAIT: maximum of number of microseconds to wait
44 * for a module to indicate that it is no longer in idle
45 */
46#define MAX_MODULE_ENABLE_WAIT 100000
39 47
40u16 cpu_mask; 48u16 cpu_mask;
41 49
@@ -47,12 +55,69 @@ u16 cpu_mask;
47 */ 55 */
48static bool clkdm_control = true; 56static bool clkdm_control = true;
49 57
58static LIST_HEAD(clk_hw_omap_clocks);
59
60/*
61 * Used for clocks that have the same value as the parent clock,
62 * divided by some factor
63 */
64unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
65 unsigned long parent_rate)
66{
67 struct clk_hw_omap *oclk;
68
69 if (!hw) {
70 pr_warn("%s: hw is NULL\n", __func__);
71 return -EINVAL;
72 }
73
74 oclk = to_clk_hw_omap(hw);
75
76 WARN_ON(!oclk->fixed_div);
77
78 return parent_rate / oclk->fixed_div;
79}
80
50/* 81/*
51 * OMAP2+ specific clock functions 82 * OMAP2+ specific clock functions
52 */ 83 */
53 84
54/* Private functions */ 85/* Private functions */
55 86
87
88/**
89 * _wait_idlest_generic - wait for a module to leave the idle state
90 * @reg: virtual address of module IDLEST register
91 * @mask: value to mask against to determine if the module is active
92 * @idlest: idle state indicator (0 or 1) for the clock
93 * @name: name of the clock (for printk)
94 *
95 * Wait for a module to leave idle, where its idle-status register is
96 * not inside the CM module. Returns 1 if the module left idle
97 * promptly, or 0 if the module did not leave idle before the timeout
98 * elapsed. XXX Deprecated - should be moved into drivers for the
99 * individual IP block that the IDLEST register exists in.
100 */
101static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest,
102 const char *name)
103{
104 int i = 0, ena = 0;
105
106 ena = (idlest) ? 0 : mask;
107
108 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
109 MAX_MODULE_ENABLE_WAIT, i);
110
111 if (i < MAX_MODULE_ENABLE_WAIT)
112 pr_debug("omap clock: module associated with clock %s ready after %d loops\n",
113 name, i);
114 else
115 pr_err("omap clock: module associated with clock %s didn't enable in %d tries\n",
116 name, MAX_MODULE_ENABLE_WAIT);
117
118 return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
119};
120
56/** 121/**
57 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE 122 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE
58 * @clk: struct clk * belonging to the module 123 * @clk: struct clk * belonging to the module
@@ -63,10 +128,12 @@ static bool clkdm_control = true;
63 * belong in the clock code and will be moved in the medium term to 128 * belong in the clock code and will be moved in the medium term to
64 * module-dependent code. No return value. 129 * module-dependent code. No return value.
65 */ 130 */
66static void _omap2_module_wait_ready(struct clk *clk) 131static void _omap2_module_wait_ready(struct clk_hw_omap *clk)
67{ 132{
68 void __iomem *companion_reg, *idlest_reg; 133 void __iomem *companion_reg, *idlest_reg;
69 u8 other_bit, idlest_bit, idlest_val; 134 u8 other_bit, idlest_bit, idlest_val, idlest_reg_id;
135 s16 prcm_mod;
136 int r;
70 137
71 /* Not all modules have multiple clocks that their IDLEST depends on */ 138 /* Not all modules have multiple clocks that their IDLEST depends on */
72 if (clk->ops->find_companion) { 139 if (clk->ops->find_companion) {
@@ -76,9 +143,14 @@ static void _omap2_module_wait_ready(struct clk *clk)
76 } 143 }
77 144
78 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); 145 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
79 146 r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id);
80 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val, 147 if (r) {
81 __clk_get_name(clk)); 148 /* IDLEST register not in the CM module */
149 _wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val,
150 __clk_get_name(clk->hw.clk));
151 } else {
152 cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit);
153 };
82} 154}
83 155
84/* Public functions */ 156/* Public functions */
@@ -91,15 +163,16 @@ static void _omap2_module_wait_ready(struct clk *clk)
91 * clockdomain pointer, and save it into the struct clk. Intended to be 163 * clockdomain pointer, and save it into the struct clk. Intended to be
92 * called during clk_register(). No return value. 164 * called during clk_register(). No return value.
93 */ 165 */
94void omap2_init_clk_clkdm(struct clk *clk) 166void omap2_init_clk_clkdm(struct clk_hw *hw)
95{ 167{
168 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
96 struct clockdomain *clkdm; 169 struct clockdomain *clkdm;
97 const char *clk_name; 170 const char *clk_name;
98 171
99 if (!clk->clkdm_name) 172 if (!clk->clkdm_name)
100 return; 173 return;
101 174
102 clk_name = __clk_get_name(clk); 175 clk_name = __clk_get_name(hw->clk);
103 176
104 clkdm = clkdm_lookup(clk->clkdm_name); 177 clkdm = clkdm_lookup(clk->clkdm_name);
105 if (clkdm) { 178 if (clkdm) {
@@ -146,8 +219,8 @@ void __init omap2_clk_disable_clkdm_control(void)
146 * associate this type of code with per-module data structures to 219 * associate this type of code with per-module data structures to
147 * avoid this issue, and remove the casts. No return value. 220 * avoid this issue, and remove the casts. No return value.
148 */ 221 */
149void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, 222void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
150 u8 *other_bit) 223 void __iomem **other_reg, u8 *other_bit)
151{ 224{
152 u32 r; 225 u32 r;
153 226
@@ -175,8 +248,8 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
175 * register address ID (e.g., that CM_FCLKEN2 corresponds to 248 * register address ID (e.g., that CM_FCLKEN2 corresponds to
176 * CM_IDLEST2). This is not true for all modules. No return value. 249 * CM_IDLEST2). This is not true for all modules. No return value.
177 */ 250 */
178void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 251void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
179 u8 *idlest_bit, u8 *idlest_val) 252 void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val)
180{ 253{
181 u32 r; 254 u32 r;
182 255
@@ -198,16 +271,44 @@ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
198 271
199} 272}
200 273
201int omap2_dflt_clk_enable(struct clk *clk) 274/**
275 * omap2_dflt_clk_enable - enable a clock in the hardware
276 * @hw: struct clk_hw * of the clock to enable
277 *
278 * Enable the clock @hw in the hardware. We first call into the OMAP
279 * clockdomain code to "enable" the corresponding clockdomain if this
280 * is the first enabled user of the clockdomain. Then program the
281 * hardware to enable the clock. Then wait for the IP block that uses
282 * this clock to leave idle (if applicable). Returns the error value
283 * from clkdm_clk_enable() if it terminated with an error, or -EINVAL
284 * if @hw has a null clock enable_reg, or zero upon success.
285 */
286int omap2_dflt_clk_enable(struct clk_hw *hw)
202{ 287{
288 struct clk_hw_omap *clk;
203 u32 v; 289 u32 v;
290 int ret = 0;
291
292 clk = to_clk_hw_omap(hw);
293
294 if (clkdm_control && clk->clkdm) {
295 ret = clkdm_clk_enable(clk->clkdm, hw->clk);
296 if (ret) {
297 WARN(1, "%s: could not enable %s's clockdomain %s: %d\n",
298 __func__, __clk_get_name(hw->clk),
299 clk->clkdm->name, ret);
300 return ret;
301 }
302 }
204 303
205 if (unlikely(clk->enable_reg == NULL)) { 304 if (unlikely(clk->enable_reg == NULL)) {
206 pr_err("clock.c: Enable for %s without enable code\n", 305 pr_err("%s: %s missing enable_reg\n", __func__,
207 clk->name); 306 __clk_get_name(hw->clk));
208 return 0; /* REVISIT: -EINVAL */ 307 ret = -EINVAL;
308 goto err;
209 } 309 }
210 310
311 /* FIXME should not have INVERT_ENABLE bit here */
211 v = __raw_readl(clk->enable_reg); 312 v = __raw_readl(clk->enable_reg);
212 if (clk->flags & INVERT_ENABLE) 313 if (clk->flags & INVERT_ENABLE)
213 v &= ~(1 << clk->enable_bit); 314 v &= ~(1 << clk->enable_bit);
@@ -216,22 +317,39 @@ int omap2_dflt_clk_enable(struct clk *clk)
216 __raw_writel(v, clk->enable_reg); 317 __raw_writel(v, clk->enable_reg);
217 v = __raw_readl(clk->enable_reg); /* OCP barrier */ 318 v = __raw_readl(clk->enable_reg); /* OCP barrier */
218 319
219 if (clk->ops->find_idlest) 320 if (clk->ops && clk->ops->find_idlest)
220 _omap2_module_wait_ready(clk); 321 _omap2_module_wait_ready(clk);
221 322
222 return 0; 323 return 0;
324
325err:
326 if (clkdm_control && clk->clkdm)
327 clkdm_clk_disable(clk->clkdm, hw->clk);
328 return ret;
223} 329}
224 330
225void omap2_dflt_clk_disable(struct clk *clk) 331/**
332 * omap2_dflt_clk_disable - disable a clock in the hardware
333 * @hw: struct clk_hw * of the clock to disable
334 *
335 * Disable the clock @hw in the hardware, and call into the OMAP
336 * clockdomain code to "disable" the corresponding clockdomain if all
337 * clocks/hwmods in that clockdomain are now disabled. No return
338 * value.
339 */
340void omap2_dflt_clk_disable(struct clk_hw *hw)
226{ 341{
342 struct clk_hw_omap *clk;
227 u32 v; 343 u32 v;
228 344
345 clk = to_clk_hw_omap(hw);
229 if (!clk->enable_reg) { 346 if (!clk->enable_reg) {
230 /* 347 /*
231 * 'Independent' here refers to a clock which is not 348 * 'independent' here refers to a clock which is not
232 * controlled by its parent. 349 * controlled by its parent.
233 */ 350 */
234 pr_err("clock: clk_disable called on independent clock %s which has no enable_reg\n", clk->name); 351 pr_err("%s: independent clock %s has no enable_reg\n",
352 __func__, __clk_get_name(hw->clk));
235 return; 353 return;
236 } 354 }
237 355
@@ -242,191 +360,213 @@ void omap2_dflt_clk_disable(struct clk *clk)
242 v &= ~(1 << clk->enable_bit); 360 v &= ~(1 << clk->enable_bit);
243 __raw_writel(v, clk->enable_reg); 361 __raw_writel(v, clk->enable_reg);
244 /* No OCP barrier needed here since it is a disable operation */ 362 /* No OCP barrier needed here since it is a disable operation */
245}
246
247const struct clkops clkops_omap2_dflt_wait = {
248 .enable = omap2_dflt_clk_enable,
249 .disable = omap2_dflt_clk_disable,
250 .find_companion = omap2_clk_dflt_find_companion,
251 .find_idlest = omap2_clk_dflt_find_idlest,
252};
253 363
254const struct clkops clkops_omap2_dflt = { 364 if (clkdm_control && clk->clkdm)
255 .enable = omap2_dflt_clk_enable, 365 clkdm_clk_disable(clk->clkdm, hw->clk);
256 .disable = omap2_dflt_clk_disable, 366}
257};
258 367
259/** 368/**
260 * omap2_clk_disable - disable a clock, if the system is not using it 369 * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw
261 * @clk: struct clk * to disable 370 * @hw: struct clk_hw * of the clock being enabled
262 * 371 *
263 * Decrements the usecount on struct clk @clk. If there are no users 372 * Increment the usecount of the clockdomain of the clock pointed to
264 * left, call the clkops-specific clock disable function to disable it 373 * by @hw; if the usecount is 1, the clockdomain will be "enabled."
265 * in hardware. If the clock is part of a clockdomain (which they all 374 * Only needed for clocks that don't use omap2_dflt_clk_enable() as
266 * should be), request that the clockdomain be disabled. (It too has 375 * their enable function pointer. Passes along the return value of
267 * a usecount, and so will not be disabled in the hardware until it no 376 * clkdm_clk_enable(), -EINVAL if @hw is not associated with a
268 * longer has any users.) If the clock has a parent clock (most of 377 * clockdomain, or 0 if clock framework-based clockdomain control is
269 * them do), then call ourselves, recursing on the parent clock. This 378 * not implemented.
270 * can cause an entire branch of the clock tree to be powered off by
271 * simply disabling one clock. Intended to be called with the clockfw_lock
272 * spinlock held. No return value.
273 */ 379 */
274void omap2_clk_disable(struct clk *clk) 380int omap2_clkops_enable_clkdm(struct clk_hw *hw)
275{ 381{
276 if (clk->usecount == 0) { 382 struct clk_hw_omap *clk;
277 WARN(1, "clock: %s: omap2_clk_disable() called, but usecount already 0?", clk->name); 383 int ret = 0;
278 return;
279 }
280 384
281 pr_debug("clock: %s: decrementing usecount\n", clk->name); 385 clk = to_clk_hw_omap(hw);
282 386
283 clk->usecount--; 387 if (unlikely(!clk->clkdm)) {
284 388 pr_err("%s: %s: no clkdm set ?!\n", __func__,
285 if (clk->usecount > 0) 389 __clk_get_name(hw->clk));
286 return; 390 return -EINVAL;
391 }
287 392
288 pr_debug("clock: %s: disabling in hardware\n", clk->name); 393 if (unlikely(clk->enable_reg))
394 pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
395 __clk_get_name(hw->clk));
289 396
290 if (clk->ops && clk->ops->disable) { 397 if (!clkdm_control) {
291 trace_clock_disable(clk->name, 0, smp_processor_id()); 398 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
292 clk->ops->disable(clk); 399 __func__, __clk_get_name(hw->clk));
400 return 0;
293 } 401 }
294 402
295 if (clkdm_control && clk->clkdm) 403 ret = clkdm_clk_enable(clk->clkdm, hw->clk);
296 clkdm_clk_disable(clk->clkdm, clk); 404 WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n",
405 __func__, __clk_get_name(hw->clk), clk->clkdm->name, ret);
297 406
298 if (clk->parent) 407 return ret;
299 omap2_clk_disable(clk->parent);
300} 408}
301 409
302/** 410/**
303 * omap2_clk_enable - request that the system enable a clock 411 * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw
304 * @clk: struct clk * to enable 412 * @hw: struct clk_hw * of the clock being disabled
305 * 413 *
306 * Increments the usecount on struct clk @clk. If there were no users 414 * Decrement the usecount of the clockdomain of the clock pointed to
307 * previously, then recurse up the clock tree, enabling all of the 415 * by @hw; if the usecount is 0, the clockdomain will be "disabled."
308 * clock's parents and all of the parent clockdomains, and finally, 416 * Only needed for clocks that don't use omap2_dflt_clk_disable() as their
309 * enabling @clk's clockdomain, and @clk itself. Intended to be 417 * disable function pointer. No return value.
310 * called with the clockfw_lock spinlock held. Returns 0 upon success
311 * or a negative error code upon failure.
312 */ 418 */
313int omap2_clk_enable(struct clk *clk) 419void omap2_clkops_disable_clkdm(struct clk_hw *hw)
314{ 420{
315 int ret; 421 struct clk_hw_omap *clk;
316
317 pr_debug("clock: %s: incrementing usecount\n", clk->name);
318
319 clk->usecount++;
320
321 if (clk->usecount > 1)
322 return 0;
323 422
324 pr_debug("clock: %s: enabling in hardware\n", clk->name); 423 clk = to_clk_hw_omap(hw);
325 424
326 if (clk->parent) { 425 if (unlikely(!clk->clkdm)) {
327 ret = omap2_clk_enable(clk->parent); 426 pr_err("%s: %s: no clkdm set ?!\n", __func__,
328 if (ret) { 427 __clk_get_name(hw->clk));
329 WARN(1, "clock: %s: could not enable parent %s: %d\n", 428 return;
330 clk->name, clk->parent->name, ret);
331 goto oce_err1;
332 }
333 } 429 }
334 430
335 if (clkdm_control && clk->clkdm) { 431 if (unlikely(clk->enable_reg))
336 ret = clkdm_clk_enable(clk->clkdm, clk); 432 pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
337 if (ret) { 433 __clk_get_name(hw->clk));
338 WARN(1, "clock: %s: could not enable clockdomain %s: %d\n",
339 clk->name, clk->clkdm->name, ret);
340 goto oce_err2;
341 }
342 }
343 434
344 if (clk->ops && clk->ops->enable) { 435 if (!clkdm_control) {
345 trace_clock_enable(clk->name, 1, smp_processor_id()); 436 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
346 ret = clk->ops->enable(clk); 437 __func__, __clk_get_name(hw->clk));
347 if (ret) { 438 return;
348 WARN(1, "clock: %s: could not enable: %d\n",
349 clk->name, ret);
350 goto oce_err3;
351 }
352 } 439 }
353 440
354 return 0; 441 clkdm_clk_disable(clk->clkdm, hw->clk);
355
356oce_err3:
357 if (clkdm_control && clk->clkdm)
358 clkdm_clk_disable(clk->clkdm, clk);
359oce_err2:
360 if (clk->parent)
361 omap2_clk_disable(clk->parent);
362oce_err1:
363 clk->usecount--;
364
365 return ret;
366} 442}
367 443
368/* Given a clock and a rate apply a clock specific rounding function */ 444/**
369long omap2_clk_round_rate(struct clk *clk, unsigned long rate) 445 * omap2_dflt_clk_is_enabled - is clock enabled in the hardware?
446 * @hw: struct clk_hw * to check
447 *
448 * Return 1 if the clock represented by @hw is enabled in the
449 * hardware, or 0 otherwise. Intended for use in the struct
450 * clk_ops.is_enabled function pointer.
451 */
452int omap2_dflt_clk_is_enabled(struct clk_hw *hw)
370{ 453{
371 if (clk->round_rate) 454 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
372 return clk->round_rate(clk, rate); 455 u32 v;
456
457 v = __raw_readl(clk->enable_reg);
458
459 if (clk->flags & INVERT_ENABLE)
460 v ^= BIT(clk->enable_bit);
461
462 v &= BIT(clk->enable_bit);
373 463
374 return clk->rate; 464 return v ? 1 : 0;
375} 465}
376 466
377/* Set the clock rate for a clock source */ 467static int __initdata mpurate;
378int omap2_clk_set_rate(struct clk *clk, unsigned long rate) 468
469/*
470 * By default we use the rate set by the bootloader.
471 * You can override this with mpurate= cmdline option.
472 */
473static int __init omap_clk_setup(char *str)
379{ 474{
380 int ret = -EINVAL; 475 get_option(&str, &mpurate);
381 476
382 pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate); 477 if (!mpurate)
478 return 1;
383 479
384 /* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ 480 if (mpurate < 1000)
385 if (clk->set_rate) { 481 mpurate *= 1000000;
386 trace_clock_set_rate(clk->name, rate, smp_processor_id());
387 ret = clk->set_rate(clk, rate);
388 }
389 482
390 return ret; 483 return 1;
391} 484}
485__setup("mpurate=", omap_clk_setup);
392 486
393int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) 487/**
488 * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
489 * @clk: struct clk * to initialize
490 *
491 * Add an OMAP clock @clk to the internal list of OMAP clocks. Used
492 * temporarily for autoidle handling, until this support can be
493 * integrated into the common clock framework code in some way. No
494 * return value.
495 */
496void omap2_init_clk_hw_omap_clocks(struct clk *clk)
394{ 497{
395 if (!clk->clksel) 498 struct clk_hw_omap *c;
396 return -EINVAL;
397 499
398 if (clk->parent == new_parent) 500 if (__clk_get_flags(clk) & CLK_IS_BASIC)
399 return 0; 501 return;
400 502
401 return omap2_clksel_set_parent(clk, new_parent); 503 c = to_clk_hw_omap(__clk_get_hw(clk));
504 list_add(&c->node, &clk_hw_omap_clocks);
402} 505}
403 506
404/* 507/**
405 * OMAP2+ clock reset and init functions 508 * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
509 * support it
510 *
511 * Enable clock autoidle on all OMAP clocks that have allow_idle
512 * function pointers associated with them. This function is intended
513 * to be temporary until support for this is added to the common clock
514 * code. Returns 0.
406 */ 515 */
516int omap2_clk_enable_autoidle_all(void)
517{
518 struct clk_hw_omap *c;
519
520 list_for_each_entry(c, &clk_hw_omap_clocks, node)
521 if (c->ops && c->ops->allow_idle)
522 c->ops->allow_idle(c);
523 return 0;
524}
407 525
408#ifdef CONFIG_OMAP_RESET_CLOCKS 526/**
409void omap2_clk_disable_unused(struct clk *clk) 527 * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that
528 * support it
529 *
530 * Disable clock autoidle on all OMAP clocks that have allow_idle
531 * function pointers associated with them. This function is intended
532 * to be temporary until support for this is added to the common clock
533 * code. Returns 0.
534 */
535int omap2_clk_disable_autoidle_all(void)
410{ 536{
411 u32 regval32, v; 537 struct clk_hw_omap *c;
412 538
413 v = (clk->flags & INVERT_ENABLE) ? (1 << clk->enable_bit) : 0; 539 list_for_each_entry(c, &clk_hw_omap_clocks, node)
540 if (c->ops && c->ops->deny_idle)
541 c->ops->deny_idle(c);
542 return 0;
543}
414 544
415 regval32 = __raw_readl(clk->enable_reg); 545/**
416 if ((regval32 & (1 << clk->enable_bit)) == v) 546 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
417 return; 547 * @clk_names: ptr to an array of strings of clock names to enable
548 * @num_clocks: number of clock names in @clk_names
549 *
550 * Prepare and enable a list of clocks, named by @clk_names. No
551 * return value. XXX Deprecated; only needed until these clocks are
552 * properly claimed and enabled by the drivers or core code that uses
553 * them. XXX What code disables & calls clk_put on these clocks?
554 */
555void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
556{
557 struct clk *init_clk;
558 int i;
418 559
419 pr_debug("Disabling unused clock \"%s\"\n", clk->name); 560 for (i = 0; i < num_clocks; i++) {
420 if (cpu_is_omap34xx()) { 561 init_clk = clk_get(NULL, clk_names[i]);
421 omap2_clk_enable(clk); 562 clk_prepare_enable(init_clk);
422 omap2_clk_disable(clk);
423 } else {
424 clk->ops->disable(clk);
425 } 563 }
426 if (clk->clkdm != NULL)
427 pwrdm_state_switch(clk->clkdm->pwrdm.ptr);
428} 564}
429#endif 565
566const struct clk_hw_omap_ops clkhwops_wait = {
567 .find_idlest = omap2_clk_dflt_find_idlest,
568 .find_companion = omap2_clk_dflt_find_companion,
569};
430 570
431/** 571/**
432 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument 572 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument
@@ -458,14 +598,12 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name)
458 r = clk_set_rate(mpurate_ck, mpurate); 598 r = clk_set_rate(mpurate_ck, mpurate);
459 if (IS_ERR_VALUE(r)) { 599 if (IS_ERR_VALUE(r)) {
460 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", 600 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n",
461 mpurate_ck->name, mpurate, r); 601 mpurate_ck_name, mpurate, r);
462 clk_put(mpurate_ck); 602 clk_put(mpurate_ck);
463 return -EINVAL; 603 return -EINVAL;
464 } 604 }
465 605
466 calibrate_delay(); 606 calibrate_delay();
467 recalculate_root_clocks();
468
469 clk_put(mpurate_ck); 607 clk_put(mpurate_ck);
470 608
471 return 0; 609 return 0;
@@ -509,15 +647,3 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
509 (clk_get_rate(core_ck) / 1000000), 647 (clk_get_rate(core_ck) / 1000000),
510 (clk_get_rate(mpu_ck) / 1000000)); 648 (clk_get_rate(mpu_ck) / 1000000));
511} 649}
512
513/* Common data */
514
515struct clk_functions omap2_clk_functions = {
516 .clk_enable = omap2_clk_enable,
517 .clk_disable = omap2_clk_disable,
518 .clk_round_rate = omap2_clk_round_rate,
519 .clk_set_rate = omap2_clk_set_rate,
520 .clk_set_parent = omap2_clk_set_parent,
521 .clk_disable_unused = omap2_clk_disable_unused,
522};
523
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 35ec5f3d9a7..9917f793c3b 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -17,8 +17,311 @@
17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H 17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/list.h>
20 21
21#include <plat/clock.h> 22#include <linux/clkdev.h>
23#include <linux/clk-provider.h>
24
25struct omap_clk {
26 u16 cpu;
27 struct clk_lookup lk;
28};
29
30#define CLK(dev, con, ck, cp) \
31 { \
32 .cpu = cp, \
33 .lk = { \
34 .dev_id = dev, \
35 .con_id = con, \
36 .clk = ck, \
37 }, \
38 }
39
40/* Platform flags for the clkdev-OMAP integration code */
41#define CK_242X (1 << 0)
42#define CK_243X (1 << 1) /* 243x, 253x */
43#define CK_3430ES1 (1 << 2) /* 34xxES1 only */
44#define CK_3430ES2PLUS (1 << 3) /* 34xxES2, ES3, non-Sitara 35xx only */
45#define CK_AM35XX (1 << 4) /* Sitara AM35xx */
46#define CK_36XX (1 << 5) /* 36xx/37xx-specific clocks */
47#define CK_443X (1 << 6)
48#define CK_TI816X (1 << 7)
49#define CK_446X (1 << 8)
50#define CK_AM33XX (1 << 9) /* AM33xx specific clocks */
51
52
53#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
54#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
55
56struct clockdomain;
57#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
58
59#define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \
60 static struct clk _name = { \
61 .name = #_name, \
62 .hw = &_name##_hw.hw, \
63 .parent_names = _parent_array_name, \
64 .num_parents = ARRAY_SIZE(_parent_array_name), \
65 .ops = &_clkops_name, \
66 };
67
68#define DEFINE_STRUCT_CLK_HW_OMAP(_name, _clkdm_name) \
69 static struct clk_hw_omap _name##_hw = { \
70 .hw = { \
71 .clk = &_name, \
72 }, \
73 .clkdm_name = _clkdm_name, \
74 };
75
76#define DEFINE_CLK_OMAP_MUX(_name, _clkdm_name, _clksel, \
77 _clksel_reg, _clksel_mask, \
78 _parent_names, _ops) \
79 static struct clk _name; \
80 static struct clk_hw_omap _name##_hw = { \
81 .hw = { \
82 .clk = &_name, \
83 }, \
84 .clksel = _clksel, \
85 .clksel_reg = _clksel_reg, \
86 .clksel_mask = _clksel_mask, \
87 .clkdm_name = _clkdm_name, \
88 }; \
89 DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
90
91#define DEFINE_CLK_OMAP_MUX_GATE(_name, _clkdm_name, _clksel, \
92 _clksel_reg, _clksel_mask, \
93 _enable_reg, _enable_bit, \
94 _hwops, _parent_names, _ops) \
95 static struct clk _name; \
96 static struct clk_hw_omap _name##_hw = { \
97 .hw = { \
98 .clk = &_name, \
99 }, \
100 .ops = _hwops, \
101 .enable_reg = _enable_reg, \
102 .enable_bit = _enable_bit, \
103 .clksel = _clksel, \
104 .clksel_reg = _clksel_reg, \
105 .clksel_mask = _clksel_mask, \
106 .clkdm_name = _clkdm_name, \
107 }; \
108 DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
109
110#define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name, \
111 _parent_ptr, _flags, \
112 _clksel_reg, _clksel_mask) \
113 static const struct clksel _name##_div[] = { \
114 { \
115 .parent = _parent_ptr, \
116 .rates = div31_1to31_rates \
117 }, \
118 { .parent = NULL }, \
119 }; \
120 static struct clk _name; \
121 static const char *_name##_parent_names[] = { \
122 _parent_name, \
123 }; \
124 static struct clk_hw_omap _name##_hw = { \
125 .hw = { \
126 .clk = &_name, \
127 }, \
128 .clksel = _name##_div, \
129 .clksel_reg = _clksel_reg, \
130 .clksel_mask = _clksel_mask, \
131 .ops = &clkhwops_omap4_dpllmx, \
132 }; \
133 DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops);
134
135/* struct clksel_rate.flags possibilities */
136#define RATE_IN_242X (1 << 0)
137#define RATE_IN_243X (1 << 1)
138#define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */
139#define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */
140#define RATE_IN_36XX (1 << 4)
141#define RATE_IN_4430 (1 << 5)
142#define RATE_IN_TI816X (1 << 6)
143#define RATE_IN_4460 (1 << 7)
144#define RATE_IN_AM33XX (1 << 8)
145#define RATE_IN_TI814X (1 << 9)
146
147#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
148#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
149#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
150#define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
151
152/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
153#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
154
155
156/**
157 * struct clksel_rate - register bitfield values corresponding to clk divisors
158 * @val: register bitfield value (shifted to bit 0)
159 * @div: clock divisor corresponding to @val
160 * @flags: (see "struct clksel_rate.flags possibilities" above)
161 *
162 * @val should match the value of a read from struct clk.clksel_reg
163 * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
164 *
165 * @div is the divisor that should be applied to the parent clock's rate
166 * to produce the current clock's rate.
167 */
168struct clksel_rate {
169 u32 val;
170 u8 div;
171 u16 flags;
172};
173
174/**
175 * struct clksel - available parent clocks, and a pointer to their divisors
176 * @parent: struct clk * to a possible parent clock
177 * @rates: available divisors for this parent clock
178 *
179 * A struct clksel is always associated with one or more struct clks
180 * and one or more struct clksel_rates.
181 */
182struct clksel {
183 struct clk *parent;
184 const struct clksel_rate *rates;
185};
186
187/**
188 * struct dpll_data - DPLL registers and integration data
189 * @mult_div1_reg: register containing the DPLL M and N bitfields
190 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
191 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
192 * @clk_bypass: struct clk pointer to the clock's bypass clock input
193 * @clk_ref: struct clk pointer to the clock's reference clock input
194 * @control_reg: register containing the DPLL mode bitfield
195 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
196 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
197 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
198 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
199 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
200 * @min_divider: minimum valid non-bypass divider value (actual)
201 * @max_divider: maximum valid non-bypass divider value (actual)
202 * @modes: possible values of @enable_mask
203 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
204 * @idlest_reg: register containing the DPLL idle status bitfield
205 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
206 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
207 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_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 u16 max_multiplier;
237 u8 last_rounded_n;
238 u8 min_divider;
239 u16 max_divider;
240 u8 modes;
241 void __iomem *autoidle_reg;
242 void __iomem *idlest_reg;
243 u32 autoidle_mask;
244 u32 freqsel_mask;
245 u32 idlest_mask;
246 u32 dco_mask;
247 u32 sddiv_mask;
248 u8 auto_recal_bit;
249 u8 recal_en_bit;
250 u8 recal_st_bit;
251 u8 flags;
252};
253
254/*
255 * struct clk.flags possibilities
256 *
257 * XXX document the rest of the clock flags here
258 *
259 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
260 * bits share the same register. This flag allows the
261 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
262 * should be used. This is a temporary solution - a better approach
263 * would be to associate clock type-specific data with the clock,
264 * similar to the struct dpll_data approach.
265 */
266#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
267#define CLOCK_IDLE_CONTROL (1 << 1)
268#define CLOCK_NO_IDLE_PARENT (1 << 2)
269#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
270#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
271#define CLOCK_CLKOUTX2 (1 << 5)
272
273/**
274 * struct clk_hw_omap - OMAP struct clk
275 * @node: list_head connecting this clock into the full clock list
276 * @enable_reg: register to write to enable the clock (see @enable_bit)
277 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
278 * @flags: see "struct clk.flags possibilities" above
279 * @clksel_reg: for clksel clks, register va containing src/divisor select
280 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
281 * @clksel: for clksel clks, pointer to struct clksel for this clock
282 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
283 * @clkdm_name: clockdomain name that this clock is contained in
284 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
285 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
286 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
287 *
288 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
289 * clock code converted to use clksel.
290 *
291 */
292
293struct clk_hw_omap_ops;
294
295struct clk_hw_omap {
296 struct clk_hw hw;
297 struct list_head node;
298 unsigned long fixed_rate;
299 u8 fixed_div;
300 void __iomem *enable_reg;
301 u8 enable_bit;
302 u8 flags;
303 void __iomem *clksel_reg;
304 u32 clksel_mask;
305 const struct clksel *clksel;
306 struct dpll_data *dpll_data;
307 const char *clkdm_name;
308 struct clockdomain *clkdm;
309 const struct clk_hw_omap_ops *ops;
310};
311
312struct clk_hw_omap_ops {
313 void (*find_idlest)(struct clk_hw_omap *oclk,
314 void __iomem **idlest_reg,
315 u8 *idlest_bit, u8 *idlest_val);
316 void (*find_companion)(struct clk_hw_omap *oclk,
317 void __iomem **other_reg,
318 u8 *other_bit);
319 void (*allow_idle)(struct clk_hw_omap *oclk);
320 void (*deny_idle)(struct clk_hw_omap *oclk);
321};
322
323unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
324 unsigned long parent_rate);
22 325
23/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 326/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
24#define CORE_CLK_SRC_32K 0x0 327#define CORE_CLK_SRC_32K 0x0
@@ -49,84 +352,62 @@
49/* DPLL Type and DCO Selection Flags */ 352/* DPLL Type and DCO Selection Flags */
50#define DPLL_J_TYPE 0x1 353#define DPLL_J_TYPE 0x1
51 354
52int omap2_clk_enable(struct clk *clk); 355long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
53void omap2_clk_disable(struct clk *clk); 356 unsigned long *parent_rate);
54long omap2_clk_round_rate(struct clk *clk, unsigned long rate); 357unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate);
55int omap2_clk_set_rate(struct clk *clk, unsigned long rate); 358int omap3_noncore_dpll_enable(struct clk_hw *hw);
56int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); 359void omap3_noncore_dpll_disable(struct clk_hw *hw);
57long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); 360int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
58unsigned long omap3_dpll_recalc(struct clk *clk); 361 unsigned long parent_rate);
59unsigned long omap3_clkoutx2_recalc(struct clk *clk); 362u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk);
60void omap3_dpll_allow_idle(struct clk *clk); 363void omap3_dpll_allow_idle(struct clk_hw_omap *clk);
61void omap3_dpll_deny_idle(struct clk *clk); 364void omap3_dpll_deny_idle(struct clk_hw_omap *clk);
62u32 omap3_dpll_autoidle_read(struct clk *clk); 365unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
63int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); 366 unsigned long parent_rate);
64int omap3_noncore_dpll_enable(struct clk *clk); 367int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk);
65void omap3_noncore_dpll_disable(struct clk *clk); 368void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk);
66int omap4_dpllmx_gatectrl_read(struct clk *clk); 369void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk);
67void omap4_dpllmx_allow_gatectrl(struct clk *clk); 370unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
68void omap4_dpllmx_deny_gatectrl(struct clk *clk); 371 unsigned long parent_rate);
69long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate); 372long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
70unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk); 373 unsigned long target_rate,
71 374 unsigned long *parent_rate);
72#ifdef CONFIG_OMAP_RESET_CLOCKS
73void omap2_clk_disable_unused(struct clk *clk);
74#else
75#define omap2_clk_disable_unused NULL
76#endif
77 375
78void omap2_init_clk_clkdm(struct clk *clk); 376void omap2_init_clk_clkdm(struct clk_hw *clk);
79void __init omap2_clk_disable_clkdm_control(void); 377void __init omap2_clk_disable_clkdm_control(void);
80 378
81/* clkt_clksel.c public functions */ 379/* clkt_clksel.c public functions */
82u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 380u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
381 unsigned long target_rate,
83 u32 *new_div); 382 u32 *new_div);
84void omap2_init_clksel_parent(struct clk *clk); 383u8 omap2_clksel_find_parent_index(struct clk_hw *hw);
85unsigned long omap2_clksel_recalc(struct clk *clk); 384unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate);
86long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); 385long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
87int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 386 unsigned long *parent_rate);
88int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); 387int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
388 unsigned long parent_rate);
389int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val);
89 390
90/* clkt_iclk.c public functions */ 391/* clkt_iclk.c public functions */
91extern void omap2_clkt_iclk_allow_idle(struct clk *clk); 392extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk);
92extern void omap2_clkt_iclk_deny_idle(struct clk *clk); 393extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk);
93
94u32 omap2_get_dpll_rate(struct clk *clk);
95void omap2_init_dpll_parent(struct clk *clk);
96 394
97int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); 395u8 omap2_init_dpll_parent(struct clk_hw *hw);
98 396unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk);
99
100#ifdef CONFIG_ARCH_OMAP2
101void omap2xxx_clk_prepare_for_reboot(void);
102#else
103static inline void omap2xxx_clk_prepare_for_reboot(void)
104{
105}
106#endif
107 397
108#ifdef CONFIG_ARCH_OMAP3 398int omap2_dflt_clk_enable(struct clk_hw *hw);
109void omap3_clk_prepare_for_reboot(void); 399void omap2_dflt_clk_disable(struct clk_hw *hw);
110#else 400int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
111static inline void omap3_clk_prepare_for_reboot(void) 401void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
112{ 402 void __iomem **other_reg,
113}
114#endif
115
116#ifdef CONFIG_ARCH_OMAP4
117void omap4_clk_prepare_for_reboot(void);
118#else
119static inline void omap4_clk_prepare_for_reboot(void)
120{
121}
122#endif
123
124int omap2_dflt_clk_enable(struct clk *clk);
125void omap2_dflt_clk_disable(struct clk *clk);
126void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
127 u8 *other_bit); 403 u8 *other_bit);
128void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 404void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
405 void __iomem **idlest_reg,
129 u8 *idlest_bit, u8 *idlest_val); 406 u8 *idlest_bit, u8 *idlest_val);
407void omap2_init_clk_hw_omap_clocks(struct clk *clk);
408int omap2_clk_enable_autoidle_all(void);
409int omap2_clk_disable_autoidle_all(void);
410void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
130int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); 411int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name);
131void omap2_clk_print_new_rates(const char *hfclkin_ck_name, 412void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
132 const char *core_ck_name, 413 const char *core_ck_name,
@@ -139,34 +420,43 @@ extern const struct clkops clkops_dummy;
139extern const struct clkops clkops_omap2_dflt; 420extern const struct clkops clkops_omap2_dflt;
140 421
141extern struct clk_functions omap2_clk_functions; 422extern struct clk_functions omap2_clk_functions;
142extern struct clk *vclk, *sclk;
143 423
144extern const struct clksel_rate gpt_32k_rates[]; 424extern const struct clksel_rate gpt_32k_rates[];
145extern const struct clksel_rate gpt_sys_rates[]; 425extern const struct clksel_rate gpt_sys_rates[];
146extern const struct clksel_rate gfx_l3_rates[]; 426extern const struct clksel_rate gfx_l3_rates[];
147extern const struct clksel_rate dsp_ick_rates[]; 427extern const struct clksel_rate dsp_ick_rates[];
428extern struct clk dummy_ck;
148 429
149extern const struct clkops clkops_omap2_iclk_dflt_wait; 430extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
150extern const struct clkops clkops_omap2_iclk_dflt; 431extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
151extern const struct clkops clkops_omap2_iclk_idle_only; 432extern const struct clk_hw_omap_ops clkhwops_wait;
152extern const struct clkops clkops_omap2_mdmclk_dflt_wait; 433extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
153extern const struct clkops clkops_omap2xxx_dpll_ops; 434extern const struct clk_hw_omap_ops clkhwops_iclk;
154extern const struct clkops clkops_omap3_noncore_dpll_ops; 435extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait;
155extern const struct clkops clkops_omap3_core_dpll_ops; 436extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait;
156extern const struct clkops clkops_omap4_dpllmx_ops; 437extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait;
438extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait;
439extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait;
440extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait;
441extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait;
442extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait;
443extern const struct clk_hw_omap_ops clkhwops_apll54;
444extern const struct clk_hw_omap_ops clkhwops_apll96;
445extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
446extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
157 447
158/* clksel_rate blocks shared between OMAP44xx and AM33xx */ 448/* clksel_rate blocks shared between OMAP44xx and AM33xx */
159extern const struct clksel_rate div_1_0_rates[]; 449extern const struct clksel_rate div_1_0_rates[];
450extern const struct clksel_rate div3_1to4_rates[];
160extern const struct clksel_rate div_1_1_rates[]; 451extern const struct clksel_rate div_1_1_rates[];
161extern const struct clksel_rate div_1_2_rates[]; 452extern const struct clksel_rate div_1_2_rates[];
162extern const struct clksel_rate div_1_3_rates[]; 453extern const struct clksel_rate div_1_3_rates[];
163extern const struct clksel_rate div_1_4_rates[]; 454extern const struct clksel_rate div_1_4_rates[];
164extern const struct clksel_rate div31_1to31_rates[]; 455extern const struct clksel_rate div31_1to31_rates[];
165 456
166/* clocks shared between various OMAP SoCs */
167extern struct clk virt_19200000_ck;
168extern struct clk virt_26000000_ck;
169
170extern int am33xx_clk_init(void); 457extern int am33xx_clk_init(void);
171 458
459extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
460extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);
461
172#endif 462#endif
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
deleted file mode 100644
index c3cde1a2b6d..00000000000
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ /dev/null
@@ -1,1990 +0,0 @@
1/*
2 * OMAP2420 clock data
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/clk.h>
19#include <linux/list.h>
20
21#include <plat/clkdev_omap.h>
22
23#include "soc.h"
24#include "iomap.h"
25#include "clock.h"
26#include "clock2xxx.h"
27#include "opp2xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm2xxx_3xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm-regbits-24xx.h"
32#include "sdrc.h"
33#include "control.h"
34
35#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
36
37/*
38 * 2420 clock tree.
39 *
40 * NOTE:In many cases here we are assigning a 'default' parent. In
41 * many cases the parent is selectable. The set parent calls will
42 * also switch sources.
43 *
44 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func.
46 *
47 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived
51 * clocks.
52 */
53
54/* Base external input clocks */
55static struct clk func_32k_ck = {
56 .name = "func_32k_ck",
57 .ops = &clkops_null,
58 .rate = 32768,
59 .clkdm_name = "wkup_clkdm",
60};
61
62static struct clk secure_32k_ck = {
63 .name = "secure_32k_ck",
64 .ops = &clkops_null,
65 .rate = 32768,
66 .clkdm_name = "wkup_clkdm",
67};
68
69/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
70static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
71 .name = "osc_ck",
72 .ops = &clkops_oscck,
73 .clkdm_name = "wkup_clkdm",
74 .recalc = &omap2_osc_clk_recalc,
75};
76
77/* Without modem likely 12MHz, with modem likely 13MHz */
78static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
79 .name = "sys_ck", /* ~ ref_clk also */
80 .ops = &clkops_null,
81 .parent = &osc_ck,
82 .clkdm_name = "wkup_clkdm",
83 .recalc = &omap2xxx_sys_clk_recalc,
84};
85
86static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
87 .name = "alt_ck",
88 .ops = &clkops_null,
89 .rate = 54000000,
90 .clkdm_name = "wkup_clkdm",
91};
92
93/* Optional external clock input for McBSP CLKS */
94static struct clk mcbsp_clks = {
95 .name = "mcbsp_clks",
96 .ops = &clkops_null,
97};
98
99/*
100 * Analog domain root source clocks
101 */
102
103/* dpll_ck, is broken out in to special cases through clksel */
104/* REVISIT: Rate changes on dpll_ck trigger a full set change. ...
105 * deal with this
106 */
107
108static struct dpll_data dpll_dd = {
109 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
110 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
111 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
112 .clk_bypass = &sys_ck,
113 .clk_ref = &sys_ck,
114 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
115 .enable_mask = OMAP24XX_EN_DPLL_MASK,
116 .max_multiplier = 1023,
117 .min_divider = 1,
118 .max_divider = 16,
119};
120
121/*
122 * XXX Cannot add round_rate here yet, as this is still a composite clock,
123 * not just a DPLL
124 */
125static struct clk dpll_ck = {
126 .name = "dpll_ck",
127 .ops = &clkops_omap2xxx_dpll_ops,
128 .parent = &sys_ck, /* Can be func_32k also */
129 .dpll_data = &dpll_dd,
130 .clkdm_name = "wkup_clkdm",
131 .recalc = &omap2_dpllcore_recalc,
132 .set_rate = &omap2_reprogram_dpllcore,
133};
134
135static struct clk apll96_ck = {
136 .name = "apll96_ck",
137 .ops = &clkops_apll96,
138 .parent = &sys_ck,
139 .rate = 96000000,
140 .flags = ENABLE_ON_INIT,
141 .clkdm_name = "wkup_clkdm",
142 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
143 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
144};
145
146static struct clk apll54_ck = {
147 .name = "apll54_ck",
148 .ops = &clkops_apll54,
149 .parent = &sys_ck,
150 .rate = 54000000,
151 .flags = ENABLE_ON_INIT,
152 .clkdm_name = "wkup_clkdm",
153 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
154 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
155};
156
157/*
158 * PRCM digital base sources
159 */
160
161/* func_54m_ck */
162
163static const struct clksel_rate func_54m_apll54_rates[] = {
164 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
165 { .div = 0 },
166};
167
168static const struct clksel_rate func_54m_alt_rates[] = {
169 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
170 { .div = 0 },
171};
172
173static const struct clksel func_54m_clksel[] = {
174 { .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
175 { .parent = &alt_ck, .rates = func_54m_alt_rates, },
176 { .parent = NULL },
177};
178
179static struct clk func_54m_ck = {
180 .name = "func_54m_ck",
181 .ops = &clkops_null,
182 .parent = &apll54_ck, /* can also be alt_clk */
183 .clkdm_name = "wkup_clkdm",
184 .init = &omap2_init_clksel_parent,
185 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
186 .clksel_mask = OMAP24XX_54M_SOURCE_MASK,
187 .clksel = func_54m_clksel,
188 .recalc = &omap2_clksel_recalc,
189};
190
191static struct clk core_ck = {
192 .name = "core_ck",
193 .ops = &clkops_null,
194 .parent = &dpll_ck, /* can also be 32k */
195 .clkdm_name = "wkup_clkdm",
196 .recalc = &followparent_recalc,
197};
198
199static struct clk func_96m_ck = {
200 .name = "func_96m_ck",
201 .ops = &clkops_null,
202 .parent = &apll96_ck,
203 .clkdm_name = "wkup_clkdm",
204 .recalc = &followparent_recalc,
205};
206
207/* func_48m_ck */
208
209static const struct clksel_rate func_48m_apll96_rates[] = {
210 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
211 { .div = 0 },
212};
213
214static const struct clksel_rate func_48m_alt_rates[] = {
215 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
216 { .div = 0 },
217};
218
219static const struct clksel func_48m_clksel[] = {
220 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
221 { .parent = &alt_ck, .rates = func_48m_alt_rates },
222 { .parent = NULL }
223};
224
225static struct clk func_48m_ck = {
226 .name = "func_48m_ck",
227 .ops = &clkops_null,
228 .parent = &apll96_ck, /* 96M or Alt */
229 .clkdm_name = "wkup_clkdm",
230 .init = &omap2_init_clksel_parent,
231 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
232 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
233 .clksel = func_48m_clksel,
234 .recalc = &omap2_clksel_recalc,
235 .round_rate = &omap2_clksel_round_rate,
236 .set_rate = &omap2_clksel_set_rate
237};
238
239static struct clk func_12m_ck = {
240 .name = "func_12m_ck",
241 .ops = &clkops_null,
242 .parent = &func_48m_ck,
243 .fixed_div = 4,
244 .clkdm_name = "wkup_clkdm",
245 .recalc = &omap_fixed_divisor_recalc,
246};
247
248/* Secure timer, only available in secure mode */
249static struct clk wdt1_osc_ck = {
250 .name = "ck_wdt1_osc",
251 .ops = &clkops_null, /* RMK: missing? */
252 .parent = &osc_ck,
253 .recalc = &followparent_recalc,
254};
255
256/*
257 * The common_clkout* clksel_rate structs are common to
258 * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src.
259 * sys_clkout2_* are 2420-only, so the
260 * clksel_rate flags fields are inaccurate for those clocks. This is
261 * harmless since access to those clocks are gated by the struct clk
262 * flags fields, which mark them as 2420-only.
263 */
264static const struct clksel_rate common_clkout_src_core_rates[] = {
265 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
266 { .div = 0 }
267};
268
269static const struct clksel_rate common_clkout_src_sys_rates[] = {
270 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
271 { .div = 0 }
272};
273
274static const struct clksel_rate common_clkout_src_96m_rates[] = {
275 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
276 { .div = 0 }
277};
278
279static const struct clksel_rate common_clkout_src_54m_rates[] = {
280 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
281 { .div = 0 }
282};
283
284static const struct clksel common_clkout_src_clksel[] = {
285 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
286 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
287 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
288 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
289 { .parent = NULL }
290};
291
292static struct clk sys_clkout_src = {
293 .name = "sys_clkout_src",
294 .ops = &clkops_omap2_dflt,
295 .parent = &func_54m_ck,
296 .clkdm_name = "wkup_clkdm",
297 .enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
298 .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
299 .init = &omap2_init_clksel_parent,
300 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
301 .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
302 .clksel = common_clkout_src_clksel,
303 .recalc = &omap2_clksel_recalc,
304 .round_rate = &omap2_clksel_round_rate,
305 .set_rate = &omap2_clksel_set_rate
306};
307
308static const struct clksel_rate common_clkout_rates[] = {
309 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
310 { .div = 2, .val = 1, .flags = RATE_IN_24XX },
311 { .div = 4, .val = 2, .flags = RATE_IN_24XX },
312 { .div = 8, .val = 3, .flags = RATE_IN_24XX },
313 { .div = 16, .val = 4, .flags = RATE_IN_24XX },
314 { .div = 0 },
315};
316
317static const struct clksel sys_clkout_clksel[] = {
318 { .parent = &sys_clkout_src, .rates = common_clkout_rates },
319 { .parent = NULL }
320};
321
322static struct clk sys_clkout = {
323 .name = "sys_clkout",
324 .ops = &clkops_null,
325 .parent = &sys_clkout_src,
326 .clkdm_name = "wkup_clkdm",
327 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
328 .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
329 .clksel = sys_clkout_clksel,
330 .recalc = &omap2_clksel_recalc,
331 .round_rate = &omap2_clksel_round_rate,
332 .set_rate = &omap2_clksel_set_rate
333};
334
335/* In 2430, new in 2420 ES2 */
336static struct clk sys_clkout2_src = {
337 .name = "sys_clkout2_src",
338 .ops = &clkops_omap2_dflt,
339 .parent = &func_54m_ck,
340 .clkdm_name = "wkup_clkdm",
341 .enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
342 .enable_bit = OMAP2420_CLKOUT2_EN_SHIFT,
343 .init = &omap2_init_clksel_parent,
344 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
345 .clksel_mask = OMAP2420_CLKOUT2_SOURCE_MASK,
346 .clksel = common_clkout_src_clksel,
347 .recalc = &omap2_clksel_recalc,
348 .round_rate = &omap2_clksel_round_rate,
349 .set_rate = &omap2_clksel_set_rate
350};
351
352static const struct clksel sys_clkout2_clksel[] = {
353 { .parent = &sys_clkout2_src, .rates = common_clkout_rates },
354 { .parent = NULL }
355};
356
357/* In 2430, new in 2420 ES2 */
358static struct clk sys_clkout2 = {
359 .name = "sys_clkout2",
360 .ops = &clkops_null,
361 .parent = &sys_clkout2_src,
362 .clkdm_name = "wkup_clkdm",
363 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
364 .clksel_mask = OMAP2420_CLKOUT2_DIV_MASK,
365 .clksel = sys_clkout2_clksel,
366 .recalc = &omap2_clksel_recalc,
367 .round_rate = &omap2_clksel_round_rate,
368 .set_rate = &omap2_clksel_set_rate
369};
370
371static struct clk emul_ck = {
372 .name = "emul_ck",
373 .ops = &clkops_omap2_dflt,
374 .parent = &func_54m_ck,
375 .clkdm_name = "wkup_clkdm",
376 .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
377 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
378 .recalc = &followparent_recalc,
379
380};
381
382/*
383 * MPU clock domain
384 * Clocks:
385 * MPU_FCLK, MPU_ICLK
386 * INT_M_FCLK, INT_M_I_CLK
387 *
388 * - Individual clocks are hardware managed.
389 * - Base divider comes from: CM_CLKSEL_MPU
390 *
391 */
392static const struct clksel_rate mpu_core_rates[] = {
393 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
394 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
395 { .div = 4, .val = 4, .flags = RATE_IN_242X },
396 { .div = 6, .val = 6, .flags = RATE_IN_242X },
397 { .div = 8, .val = 8, .flags = RATE_IN_242X },
398 { .div = 0 },
399};
400
401static const struct clksel mpu_clksel[] = {
402 { .parent = &core_ck, .rates = mpu_core_rates },
403 { .parent = NULL }
404};
405
406static struct clk mpu_ck = { /* Control cpu */
407 .name = "mpu_ck",
408 .ops = &clkops_null,
409 .parent = &core_ck,
410 .clkdm_name = "mpu_clkdm",
411 .init = &omap2_init_clksel_parent,
412 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
413 .clksel_mask = OMAP24XX_CLKSEL_MPU_MASK,
414 .clksel = mpu_clksel,
415 .recalc = &omap2_clksel_recalc,
416};
417
418/*
419 * DSP (2420-UMA+IVA1) clock domain
420 * Clocks:
421 * 2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP
422 *
423 * Won't be too specific here. The core clock comes into this block
424 * it is divided then tee'ed. One branch goes directly to xyz enable
425 * controls. The other branch gets further divided by 2 then possibly
426 * routed into a synchronizer and out of clocks abc.
427 */
428static const struct clksel_rate dsp_fck_core_rates[] = {
429 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
430 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
431 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
432 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
433 { .div = 6, .val = 6, .flags = RATE_IN_242X },
434 { .div = 8, .val = 8, .flags = RATE_IN_242X },
435 { .div = 12, .val = 12, .flags = RATE_IN_242X },
436 { .div = 0 },
437};
438
439static const struct clksel dsp_fck_clksel[] = {
440 { .parent = &core_ck, .rates = dsp_fck_core_rates },
441 { .parent = NULL }
442};
443
444static struct clk dsp_fck = {
445 .name = "dsp_fck",
446 .ops = &clkops_omap2_dflt_wait,
447 .parent = &core_ck,
448 .clkdm_name = "dsp_clkdm",
449 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
450 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
451 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
452 .clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
453 .clksel = dsp_fck_clksel,
454 .recalc = &omap2_clksel_recalc,
455};
456
457static const struct clksel dsp_ick_clksel[] = {
458 { .parent = &dsp_fck, .rates = dsp_ick_rates },
459 { .parent = NULL }
460};
461
462static struct clk dsp_ick = {
463 .name = "dsp_ick", /* apparently ipi and isp */
464 .ops = &clkops_omap2_iclk_dflt_wait,
465 .parent = &dsp_fck,
466 .clkdm_name = "dsp_clkdm",
467 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
468 .enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */
469 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
470 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
471 .clksel = dsp_ick_clksel,
472 .recalc = &omap2_clksel_recalc,
473};
474
475/*
476 * The IVA1 is an ARM7 core on the 2420 that has nothing to do with
477 * the C54x, but which is contained in the DSP powerdomain. Does not
478 * exist on later OMAPs.
479 */
480static struct clk iva1_ifck = {
481 .name = "iva1_ifck",
482 .ops = &clkops_omap2_dflt_wait,
483 .parent = &core_ck,
484 .clkdm_name = "iva1_clkdm",
485 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
486 .enable_bit = OMAP2420_EN_IVA_COP_SHIFT,
487 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
488 .clksel_mask = OMAP2420_CLKSEL_IVA_MASK,
489 .clksel = dsp_fck_clksel,
490 .recalc = &omap2_clksel_recalc,
491};
492
493/* IVA1 mpu/int/i/f clocks are /2 of parent */
494static struct clk iva1_mpu_int_ifck = {
495 .name = "iva1_mpu_int_ifck",
496 .ops = &clkops_omap2_dflt_wait,
497 .parent = &iva1_ifck,
498 .clkdm_name = "iva1_clkdm",
499 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
500 .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
501 .fixed_div = 2,
502 .recalc = &omap_fixed_divisor_recalc,
503};
504
505/*
506 * L3 clock domain
507 * L3 clocks are used for both interface and functional clocks to
508 * multiple entities. Some of these clocks are completely managed
509 * by hardware, and some others allow software control. Hardware
510 * managed ones general are based on directly CLK_REQ signals and
511 * various auto idle settings. The functional spec sets many of these
512 * as 'tie-high' for their enables.
513 *
514 * I-CLOCKS:
515 * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
516 * CAM, HS-USB.
517 * F-CLOCK
518 * SSI.
519 *
520 * GPMC memories and SDRC have timing and clock sensitive registers which
521 * may very well need notification when the clock changes. Currently for low
522 * operating points, these are taken care of in sleep.S.
523 */
524static const struct clksel_rate core_l3_core_rates[] = {
525 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
526 { .div = 2, .val = 2, .flags = RATE_IN_242X },
527 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
528 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
529 { .div = 8, .val = 8, .flags = RATE_IN_242X },
530 { .div = 12, .val = 12, .flags = RATE_IN_242X },
531 { .div = 16, .val = 16, .flags = RATE_IN_242X },
532 { .div = 0 }
533};
534
535static const struct clksel core_l3_clksel[] = {
536 { .parent = &core_ck, .rates = core_l3_core_rates },
537 { .parent = NULL }
538};
539
540static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
541 .name = "core_l3_ck",
542 .ops = &clkops_null,
543 .parent = &core_ck,
544 .clkdm_name = "core_l3_clkdm",
545 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
546 .clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
547 .clksel = core_l3_clksel,
548 .recalc = &omap2_clksel_recalc,
549};
550
551/* usb_l4_ick */
552static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
553 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
554 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
555 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
556 { .div = 0 }
557};
558
559static const struct clksel usb_l4_ick_clksel[] = {
560 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
561 { .parent = NULL },
562};
563
564/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
565static struct clk usb_l4_ick = { /* FS-USB interface clock */
566 .name = "usb_l4_ick",
567 .ops = &clkops_omap2_iclk_dflt_wait,
568 .parent = &core_l3_ck,
569 .clkdm_name = "core_l4_clkdm",
570 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
571 .enable_bit = OMAP24XX_EN_USB_SHIFT,
572 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
573 .clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
574 .clksel = usb_l4_ick_clksel,
575 .recalc = &omap2_clksel_recalc,
576};
577
578/*
579 * L4 clock management domain
580 *
581 * This domain contains lots of interface clocks from the L4 interface, some
582 * functional clocks. Fixed APLL functional source clocks are managed in
583 * this domain.
584 */
585static const struct clksel_rate l4_core_l3_rates[] = {
586 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
587 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
588 { .div = 0 }
589};
590
591static const struct clksel l4_clksel[] = {
592 { .parent = &core_l3_ck, .rates = l4_core_l3_rates },
593 { .parent = NULL }
594};
595
596static struct clk l4_ck = { /* used both as an ick and fck */
597 .name = "l4_ck",
598 .ops = &clkops_null,
599 .parent = &core_l3_ck,
600 .clkdm_name = "core_l4_clkdm",
601 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
602 .clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
603 .clksel = l4_clksel,
604 .recalc = &omap2_clksel_recalc,
605};
606
607/*
608 * SSI is in L3 management domain, its direct parent is core not l3,
609 * many core power domain entities are grouped into the L3 clock
610 * domain.
611 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
612 *
613 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
614 */
615static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
616 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
617 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
618 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
619 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
620 { .div = 6, .val = 6, .flags = RATE_IN_242X },
621 { .div = 8, .val = 8, .flags = RATE_IN_242X },
622 { .div = 0 }
623};
624
625static const struct clksel ssi_ssr_sst_fck_clksel[] = {
626 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
627 { .parent = NULL }
628};
629
630static struct clk ssi_ssr_sst_fck = {
631 .name = "ssi_fck",
632 .ops = &clkops_omap2_dflt_wait,
633 .parent = &core_ck,
634 .clkdm_name = "core_l3_clkdm",
635 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
636 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
637 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
638 .clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
639 .clksel = ssi_ssr_sst_fck_clksel,
640 .recalc = &omap2_clksel_recalc,
641};
642
643/*
644 * Presumably this is the same as SSI_ICLK.
645 * TRM contradicts itself on what clockdomain SSI_ICLK is in
646 */
647static struct clk ssi_l4_ick = {
648 .name = "ssi_l4_ick",
649 .ops = &clkops_omap2_iclk_dflt_wait,
650 .parent = &l4_ck,
651 .clkdm_name = "core_l4_clkdm",
652 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
653 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
654 .recalc = &followparent_recalc,
655};
656
657
658/*
659 * GFX clock domain
660 * Clocks:
661 * GFX_FCLK, GFX_ICLK
662 * GFX_CG1(2d), GFX_CG2(3d)
663 *
664 * GFX_FCLK runs from L3, and is divided by (1,2,3,4)
665 * The 2d and 3d clocks run at a hardware determined
666 * divided value of fclk.
667 *
668 */
669
670/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
671static const struct clksel gfx_fck_clksel[] = {
672 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
673 { .parent = NULL },
674};
675
676static struct clk gfx_3d_fck = {
677 .name = "gfx_3d_fck",
678 .ops = &clkops_omap2_dflt_wait,
679 .parent = &core_l3_ck,
680 .clkdm_name = "gfx_clkdm",
681 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
682 .enable_bit = OMAP24XX_EN_3D_SHIFT,
683 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
684 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
685 .clksel = gfx_fck_clksel,
686 .recalc = &omap2_clksel_recalc,
687 .round_rate = &omap2_clksel_round_rate,
688 .set_rate = &omap2_clksel_set_rate
689};
690
691static struct clk gfx_2d_fck = {
692 .name = "gfx_2d_fck",
693 .ops = &clkops_omap2_dflt_wait,
694 .parent = &core_l3_ck,
695 .clkdm_name = "gfx_clkdm",
696 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
697 .enable_bit = OMAP24XX_EN_2D_SHIFT,
698 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
699 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
700 .clksel = gfx_fck_clksel,
701 .recalc = &omap2_clksel_recalc,
702};
703
704/* This interface clock does not have a CM_AUTOIDLE bit */
705static struct clk gfx_ick = {
706 .name = "gfx_ick", /* From l3 */
707 .ops = &clkops_omap2_dflt_wait,
708 .parent = &core_l3_ck,
709 .clkdm_name = "gfx_clkdm",
710 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
711 .enable_bit = OMAP_EN_GFX_SHIFT,
712 .recalc = &followparent_recalc,
713};
714
715/*
716 * DSS clock domain
717 * CLOCKs:
718 * DSS_L4_ICLK, DSS_L3_ICLK,
719 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
720 *
721 * DSS is both initiator and target.
722 */
723/* XXX Add RATE_NOT_VALIDATED */
724
725static const struct clksel_rate dss1_fck_sys_rates[] = {
726 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
727 { .div = 0 }
728};
729
730static const struct clksel_rate dss1_fck_core_rates[] = {
731 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
732 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
733 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
734 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
735 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
736 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
737 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
738 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
739 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
740 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
741 { .div = 0 }
742};
743
744static const struct clksel dss1_fck_clksel[] = {
745 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
746 { .parent = &core_ck, .rates = dss1_fck_core_rates },
747 { .parent = NULL },
748};
749
750static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
751 .name = "dss_ick",
752 .ops = &clkops_omap2_iclk_dflt,
753 .parent = &l4_ck, /* really both l3 and l4 */
754 .clkdm_name = "dss_clkdm",
755 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
756 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
757 .recalc = &followparent_recalc,
758};
759
760static struct clk dss1_fck = {
761 .name = "dss1_fck",
762 .ops = &clkops_omap2_dflt,
763 .parent = &core_ck, /* Core or sys */
764 .clkdm_name = "dss_clkdm",
765 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
766 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
767 .init = &omap2_init_clksel_parent,
768 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
769 .clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK,
770 .clksel = dss1_fck_clksel,
771 .recalc = &omap2_clksel_recalc,
772};
773
774static const struct clksel_rate dss2_fck_sys_rates[] = {
775 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
776 { .div = 0 }
777};
778
779static const struct clksel_rate dss2_fck_48m_rates[] = {
780 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
781 { .div = 0 }
782};
783
784static const struct clksel dss2_fck_clksel[] = {
785 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
786 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
787 { .parent = NULL }
788};
789
790static struct clk dss2_fck = { /* Alt clk used in power management */
791 .name = "dss2_fck",
792 .ops = &clkops_omap2_dflt,
793 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
794 .clkdm_name = "dss_clkdm",
795 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
796 .enable_bit = OMAP24XX_EN_DSS2_SHIFT,
797 .init = &omap2_init_clksel_parent,
798 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
799 .clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK,
800 .clksel = dss2_fck_clksel,
801 .recalc = &omap2_clksel_recalc,
802};
803
804static struct clk dss_54m_fck = { /* Alt clk used in power management */
805 .name = "dss_54m_fck", /* 54m tv clk */
806 .ops = &clkops_omap2_dflt_wait,
807 .parent = &func_54m_ck,
808 .clkdm_name = "dss_clkdm",
809 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
810 .enable_bit = OMAP24XX_EN_TV_SHIFT,
811 .recalc = &followparent_recalc,
812};
813
814static struct clk wu_l4_ick = {
815 .name = "wu_l4_ick",
816 .ops = &clkops_null,
817 .parent = &sys_ck,
818 .clkdm_name = "wkup_clkdm",
819 .recalc = &followparent_recalc,
820};
821
822/*
823 * CORE power domain ICLK & FCLK defines.
824 * Many of the these can have more than one possible parent. Entries
825 * here will likely have an L4 interface parent, and may have multiple
826 * functional clock parents.
827 */
828static const struct clksel_rate gpt_alt_rates[] = {
829 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
830 { .div = 0 }
831};
832
833static const struct clksel omap24xx_gpt_clksel[] = {
834 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
835 { .parent = &sys_ck, .rates = gpt_sys_rates },
836 { .parent = &alt_ck, .rates = gpt_alt_rates },
837 { .parent = NULL },
838};
839
840static struct clk gpt1_ick = {
841 .name = "gpt1_ick",
842 .ops = &clkops_omap2_iclk_dflt_wait,
843 .parent = &wu_l4_ick,
844 .clkdm_name = "wkup_clkdm",
845 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
846 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
847 .recalc = &followparent_recalc,
848};
849
850static struct clk gpt1_fck = {
851 .name = "gpt1_fck",
852 .ops = &clkops_omap2_dflt_wait,
853 .parent = &func_32k_ck,
854 .clkdm_name = "core_l4_clkdm",
855 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
856 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
857 .init = &omap2_init_clksel_parent,
858 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
859 .clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
860 .clksel = omap24xx_gpt_clksel,
861 .recalc = &omap2_clksel_recalc,
862 .round_rate = &omap2_clksel_round_rate,
863 .set_rate = &omap2_clksel_set_rate
864};
865
866static struct clk gpt2_ick = {
867 .name = "gpt2_ick",
868 .ops = &clkops_omap2_iclk_dflt_wait,
869 .parent = &l4_ck,
870 .clkdm_name = "core_l4_clkdm",
871 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
872 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
873 .recalc = &followparent_recalc,
874};
875
876static struct clk gpt2_fck = {
877 .name = "gpt2_fck",
878 .ops = &clkops_omap2_dflt_wait,
879 .parent = &func_32k_ck,
880 .clkdm_name = "core_l4_clkdm",
881 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
882 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
883 .init = &omap2_init_clksel_parent,
884 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
885 .clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
886 .clksel = omap24xx_gpt_clksel,
887 .recalc = &omap2_clksel_recalc,
888};
889
890static struct clk gpt3_ick = {
891 .name = "gpt3_ick",
892 .ops = &clkops_omap2_iclk_dflt_wait,
893 .parent = &l4_ck,
894 .clkdm_name = "core_l4_clkdm",
895 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
896 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
897 .recalc = &followparent_recalc,
898};
899
900static struct clk gpt3_fck = {
901 .name = "gpt3_fck",
902 .ops = &clkops_omap2_dflt_wait,
903 .parent = &func_32k_ck,
904 .clkdm_name = "core_l4_clkdm",
905 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
906 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
907 .init = &omap2_init_clksel_parent,
908 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
909 .clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK,
910 .clksel = omap24xx_gpt_clksel,
911 .recalc = &omap2_clksel_recalc,
912};
913
914static struct clk gpt4_ick = {
915 .name = "gpt4_ick",
916 .ops = &clkops_omap2_iclk_dflt_wait,
917 .parent = &l4_ck,
918 .clkdm_name = "core_l4_clkdm",
919 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
920 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
921 .recalc = &followparent_recalc,
922};
923
924static struct clk gpt4_fck = {
925 .name = "gpt4_fck",
926 .ops = &clkops_omap2_dflt_wait,
927 .parent = &func_32k_ck,
928 .clkdm_name = "core_l4_clkdm",
929 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
930 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
931 .init = &omap2_init_clksel_parent,
932 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
933 .clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
934 .clksel = omap24xx_gpt_clksel,
935 .recalc = &omap2_clksel_recalc,
936};
937
938static struct clk gpt5_ick = {
939 .name = "gpt5_ick",
940 .ops = &clkops_omap2_iclk_dflt_wait,
941 .parent = &l4_ck,
942 .clkdm_name = "core_l4_clkdm",
943 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
944 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
945 .recalc = &followparent_recalc,
946};
947
948static struct clk gpt5_fck = {
949 .name = "gpt5_fck",
950 .ops = &clkops_omap2_dflt_wait,
951 .parent = &func_32k_ck,
952 .clkdm_name = "core_l4_clkdm",
953 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
954 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
955 .init = &omap2_init_clksel_parent,
956 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
957 .clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
958 .clksel = omap24xx_gpt_clksel,
959 .recalc = &omap2_clksel_recalc,
960};
961
962static struct clk gpt6_ick = {
963 .name = "gpt6_ick",
964 .ops = &clkops_omap2_iclk_dflt_wait,
965 .parent = &l4_ck,
966 .clkdm_name = "core_l4_clkdm",
967 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
968 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
969 .recalc = &followparent_recalc,
970};
971
972static struct clk gpt6_fck = {
973 .name = "gpt6_fck",
974 .ops = &clkops_omap2_dflt_wait,
975 .parent = &func_32k_ck,
976 .clkdm_name = "core_l4_clkdm",
977 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
978 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
979 .init = &omap2_init_clksel_parent,
980 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
981 .clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
982 .clksel = omap24xx_gpt_clksel,
983 .recalc = &omap2_clksel_recalc,
984};
985
986static struct clk gpt7_ick = {
987 .name = "gpt7_ick",
988 .ops = &clkops_omap2_iclk_dflt_wait,
989 .parent = &l4_ck,
990 .clkdm_name = "core_l4_clkdm",
991 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
992 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
993 .recalc = &followparent_recalc,
994};
995
996static struct clk gpt7_fck = {
997 .name = "gpt7_fck",
998 .ops = &clkops_omap2_dflt_wait,
999 .parent = &func_32k_ck,
1000 .clkdm_name = "core_l4_clkdm",
1001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1002 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
1003 .init = &omap2_init_clksel_parent,
1004 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1005 .clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
1006 .clksel = omap24xx_gpt_clksel,
1007 .recalc = &omap2_clksel_recalc,
1008};
1009
1010static struct clk gpt8_ick = {
1011 .name = "gpt8_ick",
1012 .ops = &clkops_omap2_iclk_dflt_wait,
1013 .parent = &l4_ck,
1014 .clkdm_name = "core_l4_clkdm",
1015 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1016 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1017 .recalc = &followparent_recalc,
1018};
1019
1020static struct clk gpt8_fck = {
1021 .name = "gpt8_fck",
1022 .ops = &clkops_omap2_dflt_wait,
1023 .parent = &func_32k_ck,
1024 .clkdm_name = "core_l4_clkdm",
1025 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1026 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1027 .init = &omap2_init_clksel_parent,
1028 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1029 .clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
1030 .clksel = omap24xx_gpt_clksel,
1031 .recalc = &omap2_clksel_recalc,
1032};
1033
1034static struct clk gpt9_ick = {
1035 .name = "gpt9_ick",
1036 .ops = &clkops_omap2_iclk_dflt_wait,
1037 .parent = &l4_ck,
1038 .clkdm_name = "core_l4_clkdm",
1039 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1040 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1041 .recalc = &followparent_recalc,
1042};
1043
1044static struct clk gpt9_fck = {
1045 .name = "gpt9_fck",
1046 .ops = &clkops_omap2_dflt_wait,
1047 .parent = &func_32k_ck,
1048 .clkdm_name = "core_l4_clkdm",
1049 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1050 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1051 .init = &omap2_init_clksel_parent,
1052 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1053 .clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
1054 .clksel = omap24xx_gpt_clksel,
1055 .recalc = &omap2_clksel_recalc,
1056};
1057
1058static struct clk gpt10_ick = {
1059 .name = "gpt10_ick",
1060 .ops = &clkops_omap2_iclk_dflt_wait,
1061 .parent = &l4_ck,
1062 .clkdm_name = "core_l4_clkdm",
1063 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1064 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1065 .recalc = &followparent_recalc,
1066};
1067
1068static struct clk gpt10_fck = {
1069 .name = "gpt10_fck",
1070 .ops = &clkops_omap2_dflt_wait,
1071 .parent = &func_32k_ck,
1072 .clkdm_name = "core_l4_clkdm",
1073 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1074 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1075 .init = &omap2_init_clksel_parent,
1076 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1077 .clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
1078 .clksel = omap24xx_gpt_clksel,
1079 .recalc = &omap2_clksel_recalc,
1080};
1081
1082static struct clk gpt11_ick = {
1083 .name = "gpt11_ick",
1084 .ops = &clkops_omap2_iclk_dflt_wait,
1085 .parent = &l4_ck,
1086 .clkdm_name = "core_l4_clkdm",
1087 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1088 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1089 .recalc = &followparent_recalc,
1090};
1091
1092static struct clk gpt11_fck = {
1093 .name = "gpt11_fck",
1094 .ops = &clkops_omap2_dflt_wait,
1095 .parent = &func_32k_ck,
1096 .clkdm_name = "core_l4_clkdm",
1097 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1098 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1099 .init = &omap2_init_clksel_parent,
1100 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1101 .clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
1102 .clksel = omap24xx_gpt_clksel,
1103 .recalc = &omap2_clksel_recalc,
1104};
1105
1106static struct clk gpt12_ick = {
1107 .name = "gpt12_ick",
1108 .ops = &clkops_omap2_iclk_dflt_wait,
1109 .parent = &l4_ck,
1110 .clkdm_name = "core_l4_clkdm",
1111 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1112 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1113 .recalc = &followparent_recalc,
1114};
1115
1116static struct clk gpt12_fck = {
1117 .name = "gpt12_fck",
1118 .ops = &clkops_omap2_dflt_wait,
1119 .parent = &secure_32k_ck,
1120 .clkdm_name = "core_l4_clkdm",
1121 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1122 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1123 .init = &omap2_init_clksel_parent,
1124 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1125 .clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK,
1126 .clksel = omap24xx_gpt_clksel,
1127 .recalc = &omap2_clksel_recalc,
1128};
1129
1130static struct clk mcbsp1_ick = {
1131 .name = "mcbsp1_ick",
1132 .ops = &clkops_omap2_iclk_dflt_wait,
1133 .parent = &l4_ck,
1134 .clkdm_name = "core_l4_clkdm",
1135 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1136 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1137 .recalc = &followparent_recalc,
1138};
1139
1140static const struct clksel_rate common_mcbsp_96m_rates[] = {
1141 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1142 { .div = 0 }
1143};
1144
1145static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1146 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1147 { .div = 0 }
1148};
1149
1150static const struct clksel mcbsp_fck_clksel[] = {
1151 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1152 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1153 { .parent = NULL }
1154};
1155
1156static struct clk mcbsp1_fck = {
1157 .name = "mcbsp1_fck",
1158 .ops = &clkops_omap2_dflt_wait,
1159 .parent = &func_96m_ck,
1160 .init = &omap2_init_clksel_parent,
1161 .clkdm_name = "core_l4_clkdm",
1162 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1163 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1164 .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1165 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1166 .clksel = mcbsp_fck_clksel,
1167 .recalc = &omap2_clksel_recalc,
1168};
1169
1170static struct clk mcbsp2_ick = {
1171 .name = "mcbsp2_ick",
1172 .ops = &clkops_omap2_iclk_dflt_wait,
1173 .parent = &l4_ck,
1174 .clkdm_name = "core_l4_clkdm",
1175 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1176 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1177 .recalc = &followparent_recalc,
1178};
1179
1180static struct clk mcbsp2_fck = {
1181 .name = "mcbsp2_fck",
1182 .ops = &clkops_omap2_dflt_wait,
1183 .parent = &func_96m_ck,
1184 .init = &omap2_init_clksel_parent,
1185 .clkdm_name = "core_l4_clkdm",
1186 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1187 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1188 .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1189 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
1190 .clksel = mcbsp_fck_clksel,
1191 .recalc = &omap2_clksel_recalc,
1192};
1193
1194static struct clk mcspi1_ick = {
1195 .name = "mcspi1_ick",
1196 .ops = &clkops_omap2_iclk_dflt_wait,
1197 .parent = &l4_ck,
1198 .clkdm_name = "core_l4_clkdm",
1199 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1200 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1201 .recalc = &followparent_recalc,
1202};
1203
1204static struct clk mcspi1_fck = {
1205 .name = "mcspi1_fck",
1206 .ops = &clkops_omap2_dflt_wait,
1207 .parent = &func_48m_ck,
1208 .clkdm_name = "core_l4_clkdm",
1209 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1210 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1211 .recalc = &followparent_recalc,
1212};
1213
1214static struct clk mcspi2_ick = {
1215 .name = "mcspi2_ick",
1216 .ops = &clkops_omap2_iclk_dflt_wait,
1217 .parent = &l4_ck,
1218 .clkdm_name = "core_l4_clkdm",
1219 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1220 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1221 .recalc = &followparent_recalc,
1222};
1223
1224static struct clk mcspi2_fck = {
1225 .name = "mcspi2_fck",
1226 .ops = &clkops_omap2_dflt_wait,
1227 .parent = &func_48m_ck,
1228 .clkdm_name = "core_l4_clkdm",
1229 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1230 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1231 .recalc = &followparent_recalc,
1232};
1233
1234static struct clk uart1_ick = {
1235 .name = "uart1_ick",
1236 .ops = &clkops_omap2_iclk_dflt_wait,
1237 .parent = &l4_ck,
1238 .clkdm_name = "core_l4_clkdm",
1239 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1240 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1241 .recalc = &followparent_recalc,
1242};
1243
1244static struct clk uart1_fck = {
1245 .name = "uart1_fck",
1246 .ops = &clkops_omap2_dflt_wait,
1247 .parent = &func_48m_ck,
1248 .clkdm_name = "core_l4_clkdm",
1249 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1250 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1251 .recalc = &followparent_recalc,
1252};
1253
1254static struct clk uart2_ick = {
1255 .name = "uart2_ick",
1256 .ops = &clkops_omap2_iclk_dflt_wait,
1257 .parent = &l4_ck,
1258 .clkdm_name = "core_l4_clkdm",
1259 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1260 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1261 .recalc = &followparent_recalc,
1262};
1263
1264static struct clk uart2_fck = {
1265 .name = "uart2_fck",
1266 .ops = &clkops_omap2_dflt_wait,
1267 .parent = &func_48m_ck,
1268 .clkdm_name = "core_l4_clkdm",
1269 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1270 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1271 .recalc = &followparent_recalc,
1272};
1273
1274static struct clk uart3_ick = {
1275 .name = "uart3_ick",
1276 .ops = &clkops_omap2_iclk_dflt_wait,
1277 .parent = &l4_ck,
1278 .clkdm_name = "core_l4_clkdm",
1279 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1280 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1281 .recalc = &followparent_recalc,
1282};
1283
1284static struct clk uart3_fck = {
1285 .name = "uart3_fck",
1286 .ops = &clkops_omap2_dflt_wait,
1287 .parent = &func_48m_ck,
1288 .clkdm_name = "core_l4_clkdm",
1289 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1290 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1291 .recalc = &followparent_recalc,
1292};
1293
1294static struct clk gpios_ick = {
1295 .name = "gpios_ick",
1296 .ops = &clkops_omap2_iclk_dflt_wait,
1297 .parent = &wu_l4_ick,
1298 .clkdm_name = "wkup_clkdm",
1299 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1300 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1301 .recalc = &followparent_recalc,
1302};
1303
1304static struct clk gpios_fck = {
1305 .name = "gpios_fck",
1306 .ops = &clkops_omap2_dflt_wait,
1307 .parent = &func_32k_ck,
1308 .clkdm_name = "wkup_clkdm",
1309 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1310 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1311 .recalc = &followparent_recalc,
1312};
1313
1314static struct clk mpu_wdt_ick = {
1315 .name = "mpu_wdt_ick",
1316 .ops = &clkops_omap2_iclk_dflt_wait,
1317 .parent = &wu_l4_ick,
1318 .clkdm_name = "wkup_clkdm",
1319 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1320 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1321 .recalc = &followparent_recalc,
1322};
1323
1324static struct clk mpu_wdt_fck = {
1325 .name = "mpu_wdt_fck",
1326 .ops = &clkops_omap2_dflt_wait,
1327 .parent = &func_32k_ck,
1328 .clkdm_name = "wkup_clkdm",
1329 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1330 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1331 .recalc = &followparent_recalc,
1332};
1333
1334static struct clk sync_32k_ick = {
1335 .name = "sync_32k_ick",
1336 .ops = &clkops_omap2_iclk_dflt_wait,
1337 .parent = &wu_l4_ick,
1338 .clkdm_name = "wkup_clkdm",
1339 .flags = ENABLE_ON_INIT,
1340 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1341 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1342 .recalc = &followparent_recalc,
1343};
1344
1345static struct clk wdt1_ick = {
1346 .name = "wdt1_ick",
1347 .ops = &clkops_omap2_iclk_dflt_wait,
1348 .parent = &wu_l4_ick,
1349 .clkdm_name = "wkup_clkdm",
1350 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1351 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1352 .recalc = &followparent_recalc,
1353};
1354
1355static struct clk omapctrl_ick = {
1356 .name = "omapctrl_ick",
1357 .ops = &clkops_omap2_iclk_dflt_wait,
1358 .parent = &wu_l4_ick,
1359 .clkdm_name = "wkup_clkdm",
1360 .flags = ENABLE_ON_INIT,
1361 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1362 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1363 .recalc = &followparent_recalc,
1364};
1365
1366static struct clk cam_ick = {
1367 .name = "cam_ick",
1368 .ops = &clkops_omap2_iclk_dflt,
1369 .parent = &l4_ck,
1370 .clkdm_name = "core_l4_clkdm",
1371 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1372 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1373 .recalc = &followparent_recalc,
1374};
1375
1376/*
1377 * cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be
1378 * split into two separate clocks, since the parent clocks are different
1379 * and the clockdomains are also different.
1380 */
1381static struct clk cam_fck = {
1382 .name = "cam_fck",
1383 .ops = &clkops_omap2_dflt,
1384 .parent = &func_96m_ck,
1385 .clkdm_name = "core_l3_clkdm",
1386 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1387 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1388 .recalc = &followparent_recalc,
1389};
1390
1391static struct clk mailboxes_ick = {
1392 .name = "mailboxes_ick",
1393 .ops = &clkops_omap2_iclk_dflt_wait,
1394 .parent = &l4_ck,
1395 .clkdm_name = "core_l4_clkdm",
1396 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1397 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1398 .recalc = &followparent_recalc,
1399};
1400
1401static struct clk wdt4_ick = {
1402 .name = "wdt4_ick",
1403 .ops = &clkops_omap2_iclk_dflt_wait,
1404 .parent = &l4_ck,
1405 .clkdm_name = "core_l4_clkdm",
1406 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1407 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1408 .recalc = &followparent_recalc,
1409};
1410
1411static struct clk wdt4_fck = {
1412 .name = "wdt4_fck",
1413 .ops = &clkops_omap2_dflt_wait,
1414 .parent = &func_32k_ck,
1415 .clkdm_name = "core_l4_clkdm",
1416 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1417 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1418 .recalc = &followparent_recalc,
1419};
1420
1421static struct clk wdt3_ick = {
1422 .name = "wdt3_ick",
1423 .ops = &clkops_omap2_iclk_dflt_wait,
1424 .parent = &l4_ck,
1425 .clkdm_name = "core_l4_clkdm",
1426 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1427 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1428 .recalc = &followparent_recalc,
1429};
1430
1431static struct clk wdt3_fck = {
1432 .name = "wdt3_fck",
1433 .ops = &clkops_omap2_dflt_wait,
1434 .parent = &func_32k_ck,
1435 .clkdm_name = "core_l4_clkdm",
1436 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1437 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1438 .recalc = &followparent_recalc,
1439};
1440
1441static struct clk mspro_ick = {
1442 .name = "mspro_ick",
1443 .ops = &clkops_omap2_iclk_dflt_wait,
1444 .parent = &l4_ck,
1445 .clkdm_name = "core_l4_clkdm",
1446 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1447 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1448 .recalc = &followparent_recalc,
1449};
1450
1451static struct clk mspro_fck = {
1452 .name = "mspro_fck",
1453 .ops = &clkops_omap2_dflt_wait,
1454 .parent = &func_96m_ck,
1455 .clkdm_name = "core_l4_clkdm",
1456 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1457 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1458 .recalc = &followparent_recalc,
1459};
1460
1461static struct clk mmc_ick = {
1462 .name = "mmc_ick",
1463 .ops = &clkops_omap2_iclk_dflt_wait,
1464 .parent = &l4_ck,
1465 .clkdm_name = "core_l4_clkdm",
1466 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1467 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1468 .recalc = &followparent_recalc,
1469};
1470
1471static struct clk mmc_fck = {
1472 .name = "mmc_fck",
1473 .ops = &clkops_omap2_dflt_wait,
1474 .parent = &func_96m_ck,
1475 .clkdm_name = "core_l4_clkdm",
1476 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1477 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1478 .recalc = &followparent_recalc,
1479};
1480
1481static struct clk fac_ick = {
1482 .name = "fac_ick",
1483 .ops = &clkops_omap2_iclk_dflt_wait,
1484 .parent = &l4_ck,
1485 .clkdm_name = "core_l4_clkdm",
1486 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1487 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1488 .recalc = &followparent_recalc,
1489};
1490
1491static struct clk fac_fck = {
1492 .name = "fac_fck",
1493 .ops = &clkops_omap2_dflt_wait,
1494 .parent = &func_12m_ck,
1495 .clkdm_name = "core_l4_clkdm",
1496 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1497 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1498 .recalc = &followparent_recalc,
1499};
1500
1501static struct clk eac_ick = {
1502 .name = "eac_ick",
1503 .ops = &clkops_omap2_iclk_dflt_wait,
1504 .parent = &l4_ck,
1505 .clkdm_name = "core_l4_clkdm",
1506 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1507 .enable_bit = OMAP2420_EN_EAC_SHIFT,
1508 .recalc = &followparent_recalc,
1509};
1510
1511static struct clk eac_fck = {
1512 .name = "eac_fck",
1513 .ops = &clkops_omap2_dflt_wait,
1514 .parent = &func_96m_ck,
1515 .clkdm_name = "core_l4_clkdm",
1516 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1517 .enable_bit = OMAP2420_EN_EAC_SHIFT,
1518 .recalc = &followparent_recalc,
1519};
1520
1521static struct clk hdq_ick = {
1522 .name = "hdq_ick",
1523 .ops = &clkops_omap2_iclk_dflt_wait,
1524 .parent = &l4_ck,
1525 .clkdm_name = "core_l4_clkdm",
1526 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1527 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1528 .recalc = &followparent_recalc,
1529};
1530
1531static struct clk hdq_fck = {
1532 .name = "hdq_fck",
1533 .ops = &clkops_omap2_dflt_wait,
1534 .parent = &func_12m_ck,
1535 .clkdm_name = "core_l4_clkdm",
1536 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1537 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1538 .recalc = &followparent_recalc,
1539};
1540
1541static struct clk i2c2_ick = {
1542 .name = "i2c2_ick",
1543 .ops = &clkops_omap2_iclk_dflt_wait,
1544 .parent = &l4_ck,
1545 .clkdm_name = "core_l4_clkdm",
1546 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1547 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1548 .recalc = &followparent_recalc,
1549};
1550
1551static struct clk i2c2_fck = {
1552 .name = "i2c2_fck",
1553 .ops = &clkops_omap2_dflt_wait,
1554 .parent = &func_12m_ck,
1555 .clkdm_name = "core_l4_clkdm",
1556 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1557 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1558 .recalc = &followparent_recalc,
1559};
1560
1561static struct clk i2c1_ick = {
1562 .name = "i2c1_ick",
1563 .ops = &clkops_omap2_iclk_dflt_wait,
1564 .parent = &l4_ck,
1565 .clkdm_name = "core_l4_clkdm",
1566 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1567 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1568 .recalc = &followparent_recalc,
1569};
1570
1571static struct clk i2c1_fck = {
1572 .name = "i2c1_fck",
1573 .ops = &clkops_omap2_dflt_wait,
1574 .parent = &func_12m_ck,
1575 .clkdm_name = "core_l4_clkdm",
1576 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1577 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1578 .recalc = &followparent_recalc,
1579};
1580
1581/*
1582 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1583 * accesses derived from this data.
1584 */
1585static struct clk gpmc_fck = {
1586 .name = "gpmc_fck",
1587 .ops = &clkops_omap2_iclk_idle_only,
1588 .parent = &core_l3_ck,
1589 .flags = ENABLE_ON_INIT,
1590 .clkdm_name = "core_l3_clkdm",
1591 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1592 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1593 .recalc = &followparent_recalc,
1594};
1595
1596static struct clk sdma_fck = {
1597 .name = "sdma_fck",
1598 .ops = &clkops_null, /* RMK: missing? */
1599 .parent = &core_l3_ck,
1600 .clkdm_name = "core_l3_clkdm",
1601 .recalc = &followparent_recalc,
1602};
1603
1604/*
1605 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1606 * accesses derived from this data.
1607 */
1608static struct clk sdma_ick = {
1609 .name = "sdma_ick",
1610 .ops = &clkops_omap2_iclk_idle_only,
1611 .parent = &core_l3_ck,
1612 .clkdm_name = "core_l3_clkdm",
1613 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1614 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1615 .recalc = &followparent_recalc,
1616};
1617
1618/*
1619 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1620 * accesses derived from this data.
1621 */
1622static struct clk sdrc_ick = {
1623 .name = "sdrc_ick",
1624 .ops = &clkops_omap2_iclk_idle_only,
1625 .parent = &core_l3_ck,
1626 .flags = ENABLE_ON_INIT,
1627 .clkdm_name = "core_l3_clkdm",
1628 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1629 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1630 .recalc = &followparent_recalc,
1631};
1632
1633static struct clk vlynq_ick = {
1634 .name = "vlynq_ick",
1635 .ops = &clkops_omap2_iclk_dflt_wait,
1636 .parent = &core_l3_ck,
1637 .clkdm_name = "core_l3_clkdm",
1638 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1639 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1640 .recalc = &followparent_recalc,
1641};
1642
1643static const struct clksel_rate vlynq_fck_96m_rates[] = {
1644 { .div = 1, .val = 0, .flags = RATE_IN_242X },
1645 { .div = 0 }
1646};
1647
1648static const struct clksel_rate vlynq_fck_core_rates[] = {
1649 { .div = 1, .val = 1, .flags = RATE_IN_242X },
1650 { .div = 2, .val = 2, .flags = RATE_IN_242X },
1651 { .div = 3, .val = 3, .flags = RATE_IN_242X },
1652 { .div = 4, .val = 4, .flags = RATE_IN_242X },
1653 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1654 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1655 { .div = 9, .val = 9, .flags = RATE_IN_242X },
1656 { .div = 12, .val = 12, .flags = RATE_IN_242X },
1657 { .div = 16, .val = 16, .flags = RATE_IN_242X },
1658 { .div = 18, .val = 18, .flags = RATE_IN_242X },
1659 { .div = 0 }
1660};
1661
1662static const struct clksel vlynq_fck_clksel[] = {
1663 { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
1664 { .parent = &core_ck, .rates = vlynq_fck_core_rates },
1665 { .parent = NULL }
1666};
1667
1668static struct clk vlynq_fck = {
1669 .name = "vlynq_fck",
1670 .ops = &clkops_omap2_dflt_wait,
1671 .parent = &func_96m_ck,
1672 .clkdm_name = "core_l3_clkdm",
1673 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1674 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1675 .init = &omap2_init_clksel_parent,
1676 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1677 .clksel_mask = OMAP2420_CLKSEL_VLYNQ_MASK,
1678 .clksel = vlynq_fck_clksel,
1679 .recalc = &omap2_clksel_recalc,
1680};
1681
1682static struct clk des_ick = {
1683 .name = "des_ick",
1684 .ops = &clkops_omap2_iclk_dflt_wait,
1685 .parent = &l4_ck,
1686 .clkdm_name = "core_l4_clkdm",
1687 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1688 .enable_bit = OMAP24XX_EN_DES_SHIFT,
1689 .recalc = &followparent_recalc,
1690};
1691
1692static struct clk sha_ick = {
1693 .name = "sha_ick",
1694 .ops = &clkops_omap2_iclk_dflt_wait,
1695 .parent = &l4_ck,
1696 .clkdm_name = "core_l4_clkdm",
1697 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1698 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1699 .recalc = &followparent_recalc,
1700};
1701
1702static struct clk rng_ick = {
1703 .name = "rng_ick",
1704 .ops = &clkops_omap2_iclk_dflt_wait,
1705 .parent = &l4_ck,
1706 .clkdm_name = "core_l4_clkdm",
1707 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1708 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1709 .recalc = &followparent_recalc,
1710};
1711
1712static struct clk aes_ick = {
1713 .name = "aes_ick",
1714 .ops = &clkops_omap2_iclk_dflt_wait,
1715 .parent = &l4_ck,
1716 .clkdm_name = "core_l4_clkdm",
1717 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1718 .enable_bit = OMAP24XX_EN_AES_SHIFT,
1719 .recalc = &followparent_recalc,
1720};
1721
1722static struct clk pka_ick = {
1723 .name = "pka_ick",
1724 .ops = &clkops_omap2_iclk_dflt_wait,
1725 .parent = &l4_ck,
1726 .clkdm_name = "core_l4_clkdm",
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1728 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1729 .recalc = &followparent_recalc,
1730};
1731
1732static struct clk usb_fck = {
1733 .name = "usb_fck",
1734 .ops = &clkops_omap2_dflt_wait,
1735 .parent = &func_48m_ck,
1736 .clkdm_name = "core_l3_clkdm",
1737 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1738 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1739 .recalc = &followparent_recalc,
1740};
1741
1742/*
1743 * This clock is a composite clock which does entire set changes then
1744 * forces a rebalance. It keys on the MPU speed, but it really could
1745 * be any key speed part of a set in the rate table.
1746 *
1747 * to really change a set, you need memory table sets which get changed
1748 * in sram, pre-notifiers & post notifiers, changing the top set, without
1749 * having low level display recalc's won't work... this is why dpm notifiers
1750 * work, isr's off, walk a list of clocks already _off_ and not messing with
1751 * the bus.
1752 *
1753 * This clock should have no parent. It embodies the entire upper level
1754 * active set. A parent will mess up some of the init also.
1755 */
1756static struct clk virt_prcm_set = {
1757 .name = "virt_prcm_set",
1758 .ops = &clkops_null,
1759 .parent = &mpu_ck, /* Indexed by mpu speed, no parent */
1760 .recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
1761 .set_rate = &omap2_select_table_rate,
1762 .round_rate = &omap2_round_to_table_rate,
1763};
1764
1765
1766/*
1767 * clkdev integration
1768 */
1769
1770static struct omap_clk omap2420_clks[] = {
1771 /* external root sources */
1772 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_242X),
1773 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_242X),
1774 CLK(NULL, "osc_ck", &osc_ck, CK_242X),
1775 CLK(NULL, "sys_ck", &sys_ck, CK_242X),
1776 CLK(NULL, "alt_ck", &alt_ck, CK_242X),
1777 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
1778 /* internal analog sources */
1779 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
1780 CLK(NULL, "apll96_ck", &apll96_ck, CK_242X),
1781 CLK(NULL, "apll54_ck", &apll54_ck, CK_242X),
1782 /* internal prcm root sources */
1783 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
1784 CLK(NULL, "core_ck", &core_ck, CK_242X),
1785 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
1786 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
1787 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
1788 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_242X),
1789 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_242X),
1790 CLK(NULL, "sys_clkout", &sys_clkout, CK_242X),
1791 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
1792 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
1793 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
1794 /* mpu domain clocks */
1795 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X),
1796 /* dsp domain clocks */
1797 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X),
1798 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
1799 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
1800 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
1801 /* GFX domain clocks */
1802 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_242X),
1803 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_242X),
1804 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1805 /* DSS domain clocks */
1806 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1807 CLK(NULL, "dss_ick", &dss_ick, CK_242X),
1808 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1809 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1810 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
1811 /* L3 domain clocks */
1812 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X),
1813 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X),
1814 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_242X),
1815 /* L4 domain clocks */
1816 CLK(NULL, "l4_ck", &l4_ck, CK_242X),
1817 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X),
1818 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_242X),
1819 /* virtual meta-group clock */
1820 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X),
1821 /* general l4 interface ck, multi-parent functional clk */
1822 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_242X),
1823 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_242X),
1824 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_242X),
1825 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_242X),
1826 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_242X),
1827 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_242X),
1828 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_242X),
1829 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_242X),
1830 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_242X),
1831 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_242X),
1832 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_242X),
1833 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_242X),
1834 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_242X),
1835 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_242X),
1836 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_242X),
1837 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_242X),
1838 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_242X),
1839 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_242X),
1840 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_242X),
1841 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_242X),
1842 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_242X),
1843 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_242X),
1844 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1845 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1846 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1847 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X),
1848 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1849 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1850 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X),
1851 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1852 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1853 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X),
1854 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1855 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1856 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X),
1857 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1858 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1859 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
1860 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X),
1861 CLK(NULL, "uart2_fck", &uart2_fck, CK_242X),
1862 CLK(NULL, "uart3_ick", &uart3_ick, CK_242X),
1863 CLK(NULL, "uart3_fck", &uart3_fck, CK_242X),
1864 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1865 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1866 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1867 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X),
1868 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1869 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1870 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1871 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
1872 CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
1873 CLK(NULL, "cam_fck", &cam_fck, CK_242X),
1874 CLK("omap24xxcam", "ick", &cam_ick, CK_242X),
1875 CLK(NULL, "cam_ick", &cam_ick, CK_242X),
1876 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X),
1877 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X),
1878 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X),
1879 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
1880 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
1881 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X),
1882 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X),
1883 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
1884 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X),
1885 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
1886 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X),
1887 CLK(NULL, "fac_ick", &fac_ick, CK_242X),
1888 CLK(NULL, "fac_fck", &fac_fck, CK_242X),
1889 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1890 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1891 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1892 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X),
1893 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1894 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X),
1895 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1896 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X),
1897 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1898 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1899 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X),
1900 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1901 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1902 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1903 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
1904 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X),
1905 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
1906 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1907 CLK(NULL, "des_ick", &des_ick, CK_242X),
1908 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1909 CLK(NULL, "sha_ick", &sha_ick, CK_242X),
1910 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1911 CLK(NULL, "rng_ick", &rng_ick, CK_242X),
1912 CLK("omap-aes", "ick", &aes_ick, CK_242X),
1913 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1914 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1915 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1916 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1917 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X),
1918 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X),
1919 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X),
1920 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
1921};
1922
1923/*
1924 * init code
1925 */
1926
1927int __init omap2420_clk_init(void)
1928{
1929 const struct prcm_config *prcm;
1930 struct omap_clk *c;
1931 u32 clkrate;
1932
1933 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1934 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
1935 cpu_mask = RATE_IN_242X;
1936 rate_table = omap2420_rate_table;
1937
1938 clk_init(&omap2_clk_functions);
1939
1940 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1941 c++)
1942 clk_preinit(c->lk.clk);
1943
1944 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
1945 propagate_rate(&osc_ck);
1946 sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
1947 propagate_rate(&sys_ck);
1948
1949 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1950 c++) {
1951 clkdev_add(&c->lk);
1952 clk_register(c->lk.clk);
1953 omap2_init_clk_clkdm(c->lk.clk);
1954 }
1955
1956 /* Disable autoidle on all clocks; let the PM code enable it later */
1957 omap_clk_disable_autoidle_all();
1958
1959 /* Check the MPU rate set by bootloader */
1960 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
1961 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
1962 if (!(prcm->flags & cpu_mask))
1963 continue;
1964 if (prcm->xtal_speed != sys_ck.rate)
1965 continue;
1966 if (prcm->dpll_speed <= clkrate)
1967 break;
1968 }
1969 curr_prcm_set = prcm;
1970
1971 recalculate_root_clocks();
1972
1973 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
1974 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
1975 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
1976
1977 /*
1978 * Only enable those clocks we will need, let the drivers
1979 * enable other clocks as necessary
1980 */
1981 clk_enable_init_clocks();
1982
1983 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
1984 vclk = clk_get(NULL, "virt_prcm_set");
1985 sclk = clk_get(NULL, "sys_ck");
1986 dclk = clk_get(NULL, "dpll_ck");
1987
1988 return 0;
1989}
1990
diff --git a/arch/arm/mach-omap2/clock2430.c b/arch/arm/mach-omap2/clock2430.c
index a8e32617746..cef0c8d1de5 100644
--- a/arch/arm/mach-omap2/clock2430.c
+++ b/arch/arm/mach-omap2/clock2430.c
@@ -21,13 +21,11 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "soc.h" 24#include "soc.h"
27#include "iomap.h" 25#include "iomap.h"
28#include "clock.h" 26#include "clock.h"
29#include "clock2xxx.h" 27#include "clock2xxx.h"
30#include "cm2xxx_3xxx.h" 28#include "cm2xxx.h"
31#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
32 30
33/** 31/**
@@ -42,7 +40,7 @@
42 * passes back the correct CM_IDLEST register address for I2CHS 40 * passes back the correct CM_IDLEST register address for I2CHS
43 * modules. No return value. 41 * modules. No return value.
44 */ 42 */
45static void omap2430_clk_i2chs_find_idlest(struct clk *clk, 43static void omap2430_clk_i2chs_find_idlest(struct clk_hw_omap *clk,
46 void __iomem **idlest_reg, 44 void __iomem **idlest_reg,
47 u8 *idlest_bit, 45 u8 *idlest_bit,
48 u8 *idlest_val) 46 u8 *idlest_val)
@@ -53,9 +51,7 @@ static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
53} 51}
54 52
55/* 2430 I2CHS has non-standard IDLEST register */ 53/* 2430 I2CHS has non-standard IDLEST register */
56const struct clkops clkops_omap2430_i2chs_wait = { 54const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait = {
57 .enable = omap2_dflt_clk_enable,
58 .disable = omap2_dflt_clk_disable,
59 .find_idlest = omap2430_clk_i2chs_find_idlest, 55 .find_idlest = omap2430_clk_i2chs_find_idlest,
60 .find_companion = omap2_clk_dflt_find_companion, 56 .find_companion = omap2_clk_dflt_find_companion,
61}; 57};
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
deleted file mode 100644
index 22404fe435e..00000000000
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ /dev/null
@@ -1,2089 +0,0 @@
1/*
2 * OMAP2430 clock data
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/clk.h>
18#include <linux/list.h>
19
20#include <plat/clkdev_omap.h>
21
22#include "soc.h"
23#include "iomap.h"
24#include "clock.h"
25#include "clock2xxx.h"
26#include "opp2xxx.h"
27#include "cm2xxx_3xxx.h"
28#include "prm2xxx_3xxx.h"
29#include "prm-regbits-24xx.h"
30#include "cm-regbits-24xx.h"
31#include "sdrc.h"
32#include "control.h"
33
34#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
35
36/*
37 * 2430 clock tree.
38 *
39 * NOTE:In many cases here we are assigning a 'default' parent. In
40 * many cases the parent is selectable. The set parent calls will
41 * also switch sources.
42 *
43 * Several sources are given initial rates which may be wrong, this will
44 * be fixed up in the init func.
45 *
46 * Things are broadly separated below by clock domains. It is
47 * noteworthy that most peripherals have dependencies on multiple clock
48 * domains. Many get their interface clocks from the L4 domain, but get
49 * functional clocks from fixed sources or other core domain derived
50 * clocks.
51 */
52
53/* Base external input clocks */
54static struct clk func_32k_ck = {
55 .name = "func_32k_ck",
56 .ops = &clkops_null,
57 .rate = 32768,
58 .clkdm_name = "wkup_clkdm",
59};
60
61static struct clk secure_32k_ck = {
62 .name = "secure_32k_ck",
63 .ops = &clkops_null,
64 .rate = 32768,
65 .clkdm_name = "wkup_clkdm",
66};
67
68/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
69static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
70 .name = "osc_ck",
71 .ops = &clkops_oscck,
72 .clkdm_name = "wkup_clkdm",
73 .recalc = &omap2_osc_clk_recalc,
74};
75
76/* Without modem likely 12MHz, with modem likely 13MHz */
77static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
78 .name = "sys_ck", /* ~ ref_clk also */
79 .ops = &clkops_null,
80 .parent = &osc_ck,
81 .clkdm_name = "wkup_clkdm",
82 .recalc = &omap2xxx_sys_clk_recalc,
83};
84
85static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
86 .name = "alt_ck",
87 .ops = &clkops_null,
88 .rate = 54000000,
89 .clkdm_name = "wkup_clkdm",
90};
91
92/* Optional external clock input for McBSP CLKS */
93static struct clk mcbsp_clks = {
94 .name = "mcbsp_clks",
95 .ops = &clkops_null,
96};
97
98/*
99 * Analog domain root source clocks
100 */
101
102/* dpll_ck, is broken out in to special cases through clksel */
103/* REVISIT: Rate changes on dpll_ck trigger a full set change. ...
104 * deal with this
105 */
106
107static struct dpll_data dpll_dd = {
108 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
109 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
110 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
111 .clk_bypass = &sys_ck,
112 .clk_ref = &sys_ck,
113 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
114 .enable_mask = OMAP24XX_EN_DPLL_MASK,
115 .max_multiplier = 1023,
116 .min_divider = 1,
117 .max_divider = 16,
118};
119
120/*
121 * XXX Cannot add round_rate here yet, as this is still a composite clock,
122 * not just a DPLL
123 */
124static struct clk dpll_ck = {
125 .name = "dpll_ck",
126 .ops = &clkops_omap2xxx_dpll_ops,
127 .parent = &sys_ck, /* Can be func_32k also */
128 .dpll_data = &dpll_dd,
129 .clkdm_name = "wkup_clkdm",
130 .recalc = &omap2_dpllcore_recalc,
131 .set_rate = &omap2_reprogram_dpllcore,
132};
133
134static struct clk apll96_ck = {
135 .name = "apll96_ck",
136 .ops = &clkops_apll96,
137 .parent = &sys_ck,
138 .rate = 96000000,
139 .flags = ENABLE_ON_INIT,
140 .clkdm_name = "wkup_clkdm",
141 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
142 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
143};
144
145static struct clk apll54_ck = {
146 .name = "apll54_ck",
147 .ops = &clkops_apll54,
148 .parent = &sys_ck,
149 .rate = 54000000,
150 .flags = ENABLE_ON_INIT,
151 .clkdm_name = "wkup_clkdm",
152 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
153 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
154};
155
156/*
157 * PRCM digital base sources
158 */
159
160/* func_54m_ck */
161
162static const struct clksel_rate func_54m_apll54_rates[] = {
163 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
164 { .div = 0 },
165};
166
167static const struct clksel_rate func_54m_alt_rates[] = {
168 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
169 { .div = 0 },
170};
171
172static const struct clksel func_54m_clksel[] = {
173 { .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
174 { .parent = &alt_ck, .rates = func_54m_alt_rates, },
175 { .parent = NULL },
176};
177
178static struct clk func_54m_ck = {
179 .name = "func_54m_ck",
180 .ops = &clkops_null,
181 .parent = &apll54_ck, /* can also be alt_clk */
182 .clkdm_name = "wkup_clkdm",
183 .init = &omap2_init_clksel_parent,
184 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
185 .clksel_mask = OMAP24XX_54M_SOURCE_MASK,
186 .clksel = func_54m_clksel,
187 .recalc = &omap2_clksel_recalc,
188};
189
190static struct clk core_ck = {
191 .name = "core_ck",
192 .ops = &clkops_null,
193 .parent = &dpll_ck, /* can also be 32k */
194 .clkdm_name = "wkup_clkdm",
195 .recalc = &followparent_recalc,
196};
197
198/* func_96m_ck */
199static const struct clksel_rate func_96m_apll96_rates[] = {
200 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
201 { .div = 0 },
202};
203
204static const struct clksel_rate func_96m_alt_rates[] = {
205 { .div = 1, .val = 1, .flags = RATE_IN_243X },
206 { .div = 0 },
207};
208
209static const struct clksel func_96m_clksel[] = {
210 { .parent = &apll96_ck, .rates = func_96m_apll96_rates },
211 { .parent = &alt_ck, .rates = func_96m_alt_rates },
212 { .parent = NULL }
213};
214
215static struct clk func_96m_ck = {
216 .name = "func_96m_ck",
217 .ops = &clkops_null,
218 .parent = &apll96_ck,
219 .clkdm_name = "wkup_clkdm",
220 .init = &omap2_init_clksel_parent,
221 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
222 .clksel_mask = OMAP2430_96M_SOURCE_MASK,
223 .clksel = func_96m_clksel,
224 .recalc = &omap2_clksel_recalc,
225};
226
227/* func_48m_ck */
228
229static const struct clksel_rate func_48m_apll96_rates[] = {
230 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
231 { .div = 0 },
232};
233
234static const struct clksel_rate func_48m_alt_rates[] = {
235 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
236 { .div = 0 },
237};
238
239static const struct clksel func_48m_clksel[] = {
240 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
241 { .parent = &alt_ck, .rates = func_48m_alt_rates },
242 { .parent = NULL }
243};
244
245static struct clk func_48m_ck = {
246 .name = "func_48m_ck",
247 .ops = &clkops_null,
248 .parent = &apll96_ck, /* 96M or Alt */
249 .clkdm_name = "wkup_clkdm",
250 .init = &omap2_init_clksel_parent,
251 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
252 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
253 .clksel = func_48m_clksel,
254 .recalc = &omap2_clksel_recalc,
255 .round_rate = &omap2_clksel_round_rate,
256 .set_rate = &omap2_clksel_set_rate
257};
258
259static struct clk func_12m_ck = {
260 .name = "func_12m_ck",
261 .ops = &clkops_null,
262 .parent = &func_48m_ck,
263 .fixed_div = 4,
264 .clkdm_name = "wkup_clkdm",
265 .recalc = &omap_fixed_divisor_recalc,
266};
267
268/* Secure timer, only available in secure mode */
269static struct clk wdt1_osc_ck = {
270 .name = "ck_wdt1_osc",
271 .ops = &clkops_null, /* RMK: missing? */
272 .parent = &osc_ck,
273 .recalc = &followparent_recalc,
274};
275
276/*
277 * The common_clkout* clksel_rate structs are common to
278 * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src.
279 * sys_clkout2_* are 2420-only, so the
280 * clksel_rate flags fields are inaccurate for those clocks. This is
281 * harmless since access to those clocks are gated by the struct clk
282 * flags fields, which mark them as 2420-only.
283 */
284static const struct clksel_rate common_clkout_src_core_rates[] = {
285 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
286 { .div = 0 }
287};
288
289static const struct clksel_rate common_clkout_src_sys_rates[] = {
290 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
291 { .div = 0 }
292};
293
294static const struct clksel_rate common_clkout_src_96m_rates[] = {
295 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
296 { .div = 0 }
297};
298
299static const struct clksel_rate common_clkout_src_54m_rates[] = {
300 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
301 { .div = 0 }
302};
303
304static const struct clksel common_clkout_src_clksel[] = {
305 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
306 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
307 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
308 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
309 { .parent = NULL }
310};
311
312static struct clk sys_clkout_src = {
313 .name = "sys_clkout_src",
314 .ops = &clkops_omap2_dflt,
315 .parent = &func_54m_ck,
316 .clkdm_name = "wkup_clkdm",
317 .enable_reg = OMAP2430_PRCM_CLKOUT_CTRL,
318 .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
319 .init = &omap2_init_clksel_parent,
320 .clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
321 .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
322 .clksel = common_clkout_src_clksel,
323 .recalc = &omap2_clksel_recalc,
324 .round_rate = &omap2_clksel_round_rate,
325 .set_rate = &omap2_clksel_set_rate
326};
327
328static const struct clksel_rate common_clkout_rates[] = {
329 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
330 { .div = 2, .val = 1, .flags = RATE_IN_24XX },
331 { .div = 4, .val = 2, .flags = RATE_IN_24XX },
332 { .div = 8, .val = 3, .flags = RATE_IN_24XX },
333 { .div = 16, .val = 4, .flags = RATE_IN_24XX },
334 { .div = 0 },
335};
336
337static const struct clksel sys_clkout_clksel[] = {
338 { .parent = &sys_clkout_src, .rates = common_clkout_rates },
339 { .parent = NULL }
340};
341
342static struct clk sys_clkout = {
343 .name = "sys_clkout",
344 .ops = &clkops_null,
345 .parent = &sys_clkout_src,
346 .clkdm_name = "wkup_clkdm",
347 .clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
348 .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
349 .clksel = sys_clkout_clksel,
350 .recalc = &omap2_clksel_recalc,
351 .round_rate = &omap2_clksel_round_rate,
352 .set_rate = &omap2_clksel_set_rate
353};
354
355static struct clk emul_ck = {
356 .name = "emul_ck",
357 .ops = &clkops_omap2_dflt,
358 .parent = &func_54m_ck,
359 .clkdm_name = "wkup_clkdm",
360 .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
361 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
362 .recalc = &followparent_recalc,
363
364};
365
366/*
367 * MPU clock domain
368 * Clocks:
369 * MPU_FCLK, MPU_ICLK
370 * INT_M_FCLK, INT_M_I_CLK
371 *
372 * - Individual clocks are hardware managed.
373 * - Base divider comes from: CM_CLKSEL_MPU
374 *
375 */
376static const struct clksel_rate mpu_core_rates[] = {
377 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
378 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
379 { .div = 0 },
380};
381
382static const struct clksel mpu_clksel[] = {
383 { .parent = &core_ck, .rates = mpu_core_rates },
384 { .parent = NULL }
385};
386
387static struct clk mpu_ck = { /* Control cpu */
388 .name = "mpu_ck",
389 .ops = &clkops_null,
390 .parent = &core_ck,
391 .clkdm_name = "mpu_clkdm",
392 .init = &omap2_init_clksel_parent,
393 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
394 .clksel_mask = OMAP24XX_CLKSEL_MPU_MASK,
395 .clksel = mpu_clksel,
396 .recalc = &omap2_clksel_recalc,
397};
398
399/*
400 * DSP (2430-IVA2.1) clock domain
401 * Clocks:
402 * 2430: IVA2.1_FCLK (really just DSP_FCLK), IVA2.1_ICLK
403 *
404 * Won't be too specific here. The core clock comes into this block
405 * it is divided then tee'ed. One branch goes directly to xyz enable
406 * controls. The other branch gets further divided by 2 then possibly
407 * routed into a synchronizer and out of clocks abc.
408 */
409static const struct clksel_rate dsp_fck_core_rates[] = {
410 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
411 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
412 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
413 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
414 { .div = 0 },
415};
416
417static const struct clksel dsp_fck_clksel[] = {
418 { .parent = &core_ck, .rates = dsp_fck_core_rates },
419 { .parent = NULL }
420};
421
422static struct clk dsp_fck = {
423 .name = "dsp_fck",
424 .ops = &clkops_omap2_dflt_wait,
425 .parent = &core_ck,
426 .clkdm_name = "dsp_clkdm",
427 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
428 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
429 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
430 .clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
431 .clksel = dsp_fck_clksel,
432 .recalc = &omap2_clksel_recalc,
433};
434
435static const struct clksel dsp_ick_clksel[] = {
436 { .parent = &dsp_fck, .rates = dsp_ick_rates },
437 { .parent = NULL }
438};
439
440/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */
441static struct clk iva2_1_ick = {
442 .name = "iva2_1_ick",
443 .ops = &clkops_omap2_dflt_wait,
444 .parent = &dsp_fck,
445 .clkdm_name = "dsp_clkdm",
446 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
447 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
448 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
449 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
450 .clksel = dsp_ick_clksel,
451 .recalc = &omap2_clksel_recalc,
452};
453
454/*
455 * L3 clock domain
456 * L3 clocks are used for both interface and functional clocks to
457 * multiple entities. Some of these clocks are completely managed
458 * by hardware, and some others allow software control. Hardware
459 * managed ones general are based on directly CLK_REQ signals and
460 * various auto idle settings. The functional spec sets many of these
461 * as 'tie-high' for their enables.
462 *
463 * I-CLOCKS:
464 * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
465 * CAM, HS-USB.
466 * F-CLOCK
467 * SSI.
468 *
469 * GPMC memories and SDRC have timing and clock sensitive registers which
470 * may very well need notification when the clock changes. Currently for low
471 * operating points, these are taken care of in sleep.S.
472 */
473static const struct clksel_rate core_l3_core_rates[] = {
474 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
475 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
476 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
477 { .div = 0 }
478};
479
480static const struct clksel core_l3_clksel[] = {
481 { .parent = &core_ck, .rates = core_l3_core_rates },
482 { .parent = NULL }
483};
484
485static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
486 .name = "core_l3_ck",
487 .ops = &clkops_null,
488 .parent = &core_ck,
489 .clkdm_name = "core_l3_clkdm",
490 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
491 .clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
492 .clksel = core_l3_clksel,
493 .recalc = &omap2_clksel_recalc,
494};
495
496/* usb_l4_ick */
497static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
498 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
499 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
500 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
501 { .div = 0 }
502};
503
504static const struct clksel usb_l4_ick_clksel[] = {
505 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
506 { .parent = NULL },
507};
508
509/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
510static struct clk usb_l4_ick = { /* FS-USB interface clock */
511 .name = "usb_l4_ick",
512 .ops = &clkops_omap2_iclk_dflt_wait,
513 .parent = &core_l3_ck,
514 .clkdm_name = "core_l4_clkdm",
515 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
516 .enable_bit = OMAP24XX_EN_USB_SHIFT,
517 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
518 .clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
519 .clksel = usb_l4_ick_clksel,
520 .recalc = &omap2_clksel_recalc,
521};
522
523/*
524 * L4 clock management domain
525 *
526 * This domain contains lots of interface clocks from the L4 interface, some
527 * functional clocks. Fixed APLL functional source clocks are managed in
528 * this domain.
529 */
530static const struct clksel_rate l4_core_l3_rates[] = {
531 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
532 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
533 { .div = 0 }
534};
535
536static const struct clksel l4_clksel[] = {
537 { .parent = &core_l3_ck, .rates = l4_core_l3_rates },
538 { .parent = NULL }
539};
540
541static struct clk l4_ck = { /* used both as an ick and fck */
542 .name = "l4_ck",
543 .ops = &clkops_null,
544 .parent = &core_l3_ck,
545 .clkdm_name = "core_l4_clkdm",
546 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
547 .clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
548 .clksel = l4_clksel,
549 .recalc = &omap2_clksel_recalc,
550};
551
552/*
553 * SSI is in L3 management domain, its direct parent is core not l3,
554 * many core power domain entities are grouped into the L3 clock
555 * domain.
556 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
557 *
558 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
559 */
560static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
561 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
562 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
563 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
564 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
565 { .div = 5, .val = 5, .flags = RATE_IN_243X },
566 { .div = 0 }
567};
568
569static const struct clksel ssi_ssr_sst_fck_clksel[] = {
570 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
571 { .parent = NULL }
572};
573
574static struct clk ssi_ssr_sst_fck = {
575 .name = "ssi_fck",
576 .ops = &clkops_omap2_dflt_wait,
577 .parent = &core_ck,
578 .clkdm_name = "core_l3_clkdm",
579 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
580 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
581 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
582 .clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
583 .clksel = ssi_ssr_sst_fck_clksel,
584 .recalc = &omap2_clksel_recalc,
585};
586
587/*
588 * Presumably this is the same as SSI_ICLK.
589 * TRM contradicts itself on what clockdomain SSI_ICLK is in
590 */
591static struct clk ssi_l4_ick = {
592 .name = "ssi_l4_ick",
593 .ops = &clkops_omap2_iclk_dflt_wait,
594 .parent = &l4_ck,
595 .clkdm_name = "core_l4_clkdm",
596 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
597 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
598 .recalc = &followparent_recalc,
599};
600
601
602/*
603 * GFX clock domain
604 * Clocks:
605 * GFX_FCLK, GFX_ICLK
606 * GFX_CG1(2d), GFX_CG2(3d)
607 *
608 * GFX_FCLK runs from L3, and is divided by (1,2,3,4)
609 * The 2d and 3d clocks run at a hardware determined
610 * divided value of fclk.
611 *
612 */
613
614/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
615static const struct clksel gfx_fck_clksel[] = {
616 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
617 { .parent = NULL },
618};
619
620static struct clk gfx_3d_fck = {
621 .name = "gfx_3d_fck",
622 .ops = &clkops_omap2_dflt_wait,
623 .parent = &core_l3_ck,
624 .clkdm_name = "gfx_clkdm",
625 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
626 .enable_bit = OMAP24XX_EN_3D_SHIFT,
627 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
628 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
629 .clksel = gfx_fck_clksel,
630 .recalc = &omap2_clksel_recalc,
631 .round_rate = &omap2_clksel_round_rate,
632 .set_rate = &omap2_clksel_set_rate
633};
634
635static struct clk gfx_2d_fck = {
636 .name = "gfx_2d_fck",
637 .ops = &clkops_omap2_dflt_wait,
638 .parent = &core_l3_ck,
639 .clkdm_name = "gfx_clkdm",
640 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
641 .enable_bit = OMAP24XX_EN_2D_SHIFT,
642 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
643 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
644 .clksel = gfx_fck_clksel,
645 .recalc = &omap2_clksel_recalc,
646};
647
648/* This interface clock does not have a CM_AUTOIDLE bit */
649static struct clk gfx_ick = {
650 .name = "gfx_ick", /* From l3 */
651 .ops = &clkops_omap2_dflt_wait,
652 .parent = &core_l3_ck,
653 .clkdm_name = "gfx_clkdm",
654 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
655 .enable_bit = OMAP_EN_GFX_SHIFT,
656 .recalc = &followparent_recalc,
657};
658
659/*
660 * Modem clock domain (2430)
661 * CLOCKS:
662 * MDM_OSC_CLK
663 * MDM_ICLK
664 * These clocks are usable in chassis mode only.
665 */
666static const struct clksel_rate mdm_ick_core_rates[] = {
667 { .div = 1, .val = 1, .flags = RATE_IN_243X },
668 { .div = 4, .val = 4, .flags = RATE_IN_243X },
669 { .div = 6, .val = 6, .flags = RATE_IN_243X },
670 { .div = 9, .val = 9, .flags = RATE_IN_243X },
671 { .div = 0 }
672};
673
674static const struct clksel mdm_ick_clksel[] = {
675 { .parent = &core_ck, .rates = mdm_ick_core_rates },
676 { .parent = NULL }
677};
678
679static struct clk mdm_ick = { /* used both as a ick and fck */
680 .name = "mdm_ick",
681 .ops = &clkops_omap2_iclk_dflt_wait,
682 .parent = &core_ck,
683 .clkdm_name = "mdm_clkdm",
684 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
685 .enable_bit = OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
686 .clksel_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
687 .clksel_mask = OMAP2430_CLKSEL_MDM_MASK,
688 .clksel = mdm_ick_clksel,
689 .recalc = &omap2_clksel_recalc,
690};
691
692static struct clk mdm_osc_ck = {
693 .name = "mdm_osc_ck",
694 .ops = &clkops_omap2_mdmclk_dflt_wait,
695 .parent = &osc_ck,
696 .clkdm_name = "mdm_clkdm",
697 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
698 .enable_bit = OMAP2430_EN_OSC_SHIFT,
699 .recalc = &followparent_recalc,
700};
701
702/*
703 * DSS clock domain
704 * CLOCKs:
705 * DSS_L4_ICLK, DSS_L3_ICLK,
706 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
707 *
708 * DSS is both initiator and target.
709 */
710/* XXX Add RATE_NOT_VALIDATED */
711
712static const struct clksel_rate dss1_fck_sys_rates[] = {
713 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
714 { .div = 0 }
715};
716
717static const struct clksel_rate dss1_fck_core_rates[] = {
718 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
719 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
720 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
721 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
722 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
723 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
724 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
725 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
726 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
727 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
728 { .div = 0 }
729};
730
731static const struct clksel dss1_fck_clksel[] = {
732 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
733 { .parent = &core_ck, .rates = dss1_fck_core_rates },
734 { .parent = NULL },
735};
736
737static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
738 .name = "dss_ick",
739 .ops = &clkops_omap2_iclk_dflt,
740 .parent = &l4_ck, /* really both l3 and l4 */
741 .clkdm_name = "dss_clkdm",
742 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
743 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
744 .recalc = &followparent_recalc,
745};
746
747static struct clk dss1_fck = {
748 .name = "dss1_fck",
749 .ops = &clkops_omap2_dflt,
750 .parent = &core_ck, /* Core or sys */
751 .clkdm_name = "dss_clkdm",
752 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
753 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
754 .init = &omap2_init_clksel_parent,
755 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
756 .clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK,
757 .clksel = dss1_fck_clksel,
758 .recalc = &omap2_clksel_recalc,
759};
760
761static const struct clksel_rate dss2_fck_sys_rates[] = {
762 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
763 { .div = 0 }
764};
765
766static const struct clksel_rate dss2_fck_48m_rates[] = {
767 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
768 { .div = 0 }
769};
770
771static const struct clksel dss2_fck_clksel[] = {
772 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
773 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
774 { .parent = NULL }
775};
776
777static struct clk dss2_fck = { /* Alt clk used in power management */
778 .name = "dss2_fck",
779 .ops = &clkops_omap2_dflt,
780 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
781 .clkdm_name = "dss_clkdm",
782 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
783 .enable_bit = OMAP24XX_EN_DSS2_SHIFT,
784 .init = &omap2_init_clksel_parent,
785 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
786 .clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK,
787 .clksel = dss2_fck_clksel,
788 .recalc = &omap2_clksel_recalc,
789};
790
791static struct clk dss_54m_fck = { /* Alt clk used in power management */
792 .name = "dss_54m_fck", /* 54m tv clk */
793 .ops = &clkops_omap2_dflt_wait,
794 .parent = &func_54m_ck,
795 .clkdm_name = "dss_clkdm",
796 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
797 .enable_bit = OMAP24XX_EN_TV_SHIFT,
798 .recalc = &followparent_recalc,
799};
800
801static struct clk wu_l4_ick = {
802 .name = "wu_l4_ick",
803 .ops = &clkops_null,
804 .parent = &sys_ck,
805 .clkdm_name = "wkup_clkdm",
806 .recalc = &followparent_recalc,
807};
808
809/*
810 * CORE power domain ICLK & FCLK defines.
811 * Many of the these can have more than one possible parent. Entries
812 * here will likely have an L4 interface parent, and may have multiple
813 * functional clock parents.
814 */
815static const struct clksel_rate gpt_alt_rates[] = {
816 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
817 { .div = 0 }
818};
819
820static const struct clksel omap24xx_gpt_clksel[] = {
821 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
822 { .parent = &sys_ck, .rates = gpt_sys_rates },
823 { .parent = &alt_ck, .rates = gpt_alt_rates },
824 { .parent = NULL },
825};
826
827static struct clk gpt1_ick = {
828 .name = "gpt1_ick",
829 .ops = &clkops_omap2_iclk_dflt_wait,
830 .parent = &wu_l4_ick,
831 .clkdm_name = "wkup_clkdm",
832 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
833 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
834 .recalc = &followparent_recalc,
835};
836
837static struct clk gpt1_fck = {
838 .name = "gpt1_fck",
839 .ops = &clkops_omap2_dflt_wait,
840 .parent = &func_32k_ck,
841 .clkdm_name = "core_l4_clkdm",
842 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
843 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
844 .init = &omap2_init_clksel_parent,
845 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
846 .clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
847 .clksel = omap24xx_gpt_clksel,
848 .recalc = &omap2_clksel_recalc,
849 .round_rate = &omap2_clksel_round_rate,
850 .set_rate = &omap2_clksel_set_rate
851};
852
853static struct clk gpt2_ick = {
854 .name = "gpt2_ick",
855 .ops = &clkops_omap2_iclk_dflt_wait,
856 .parent = &l4_ck,
857 .clkdm_name = "core_l4_clkdm",
858 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
859 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
860 .recalc = &followparent_recalc,
861};
862
863static struct clk gpt2_fck = {
864 .name = "gpt2_fck",
865 .ops = &clkops_omap2_dflt_wait,
866 .parent = &func_32k_ck,
867 .clkdm_name = "core_l4_clkdm",
868 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
869 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
870 .init = &omap2_init_clksel_parent,
871 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
872 .clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
873 .clksel = omap24xx_gpt_clksel,
874 .recalc = &omap2_clksel_recalc,
875};
876
877static struct clk gpt3_ick = {
878 .name = "gpt3_ick",
879 .ops = &clkops_omap2_iclk_dflt_wait,
880 .parent = &l4_ck,
881 .clkdm_name = "core_l4_clkdm",
882 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
883 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
884 .recalc = &followparent_recalc,
885};
886
887static struct clk gpt3_fck = {
888 .name = "gpt3_fck",
889 .ops = &clkops_omap2_dflt_wait,
890 .parent = &func_32k_ck,
891 .clkdm_name = "core_l4_clkdm",
892 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
893 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
894 .init = &omap2_init_clksel_parent,
895 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
896 .clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK,
897 .clksel = omap24xx_gpt_clksel,
898 .recalc = &omap2_clksel_recalc,
899};
900
901static struct clk gpt4_ick = {
902 .name = "gpt4_ick",
903 .ops = &clkops_omap2_iclk_dflt_wait,
904 .parent = &l4_ck,
905 .clkdm_name = "core_l4_clkdm",
906 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
907 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
908 .recalc = &followparent_recalc,
909};
910
911static struct clk gpt4_fck = {
912 .name = "gpt4_fck",
913 .ops = &clkops_omap2_dflt_wait,
914 .parent = &func_32k_ck,
915 .clkdm_name = "core_l4_clkdm",
916 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
917 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
918 .init = &omap2_init_clksel_parent,
919 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
920 .clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
921 .clksel = omap24xx_gpt_clksel,
922 .recalc = &omap2_clksel_recalc,
923};
924
925static struct clk gpt5_ick = {
926 .name = "gpt5_ick",
927 .ops = &clkops_omap2_iclk_dflt_wait,
928 .parent = &l4_ck,
929 .clkdm_name = "core_l4_clkdm",
930 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
931 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
932 .recalc = &followparent_recalc,
933};
934
935static struct clk gpt5_fck = {
936 .name = "gpt5_fck",
937 .ops = &clkops_omap2_dflt_wait,
938 .parent = &func_32k_ck,
939 .clkdm_name = "core_l4_clkdm",
940 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
941 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
942 .init = &omap2_init_clksel_parent,
943 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
944 .clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
945 .clksel = omap24xx_gpt_clksel,
946 .recalc = &omap2_clksel_recalc,
947};
948
949static struct clk gpt6_ick = {
950 .name = "gpt6_ick",
951 .ops = &clkops_omap2_iclk_dflt_wait,
952 .parent = &l4_ck,
953 .clkdm_name = "core_l4_clkdm",
954 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
955 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
956 .recalc = &followparent_recalc,
957};
958
959static struct clk gpt6_fck = {
960 .name = "gpt6_fck",
961 .ops = &clkops_omap2_dflt_wait,
962 .parent = &func_32k_ck,
963 .clkdm_name = "core_l4_clkdm",
964 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
965 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
966 .init = &omap2_init_clksel_parent,
967 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
968 .clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
969 .clksel = omap24xx_gpt_clksel,
970 .recalc = &omap2_clksel_recalc,
971};
972
973static struct clk gpt7_ick = {
974 .name = "gpt7_ick",
975 .ops = &clkops_omap2_iclk_dflt_wait,
976 .parent = &l4_ck,
977 .clkdm_name = "core_l4_clkdm",
978 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
979 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
980 .recalc = &followparent_recalc,
981};
982
983static struct clk gpt7_fck = {
984 .name = "gpt7_fck",
985 .ops = &clkops_omap2_dflt_wait,
986 .parent = &func_32k_ck,
987 .clkdm_name = "core_l4_clkdm",
988 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
989 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
990 .init = &omap2_init_clksel_parent,
991 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
992 .clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
993 .clksel = omap24xx_gpt_clksel,
994 .recalc = &omap2_clksel_recalc,
995};
996
997static struct clk gpt8_ick = {
998 .name = "gpt8_ick",
999 .ops = &clkops_omap2_iclk_dflt_wait,
1000 .parent = &l4_ck,
1001 .clkdm_name = "core_l4_clkdm",
1002 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1003 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1004 .recalc = &followparent_recalc,
1005};
1006
1007static struct clk gpt8_fck = {
1008 .name = "gpt8_fck",
1009 .ops = &clkops_omap2_dflt_wait,
1010 .parent = &func_32k_ck,
1011 .clkdm_name = "core_l4_clkdm",
1012 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1013 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1014 .init = &omap2_init_clksel_parent,
1015 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1016 .clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
1017 .clksel = omap24xx_gpt_clksel,
1018 .recalc = &omap2_clksel_recalc,
1019};
1020
1021static struct clk gpt9_ick = {
1022 .name = "gpt9_ick",
1023 .ops = &clkops_omap2_iclk_dflt_wait,
1024 .parent = &l4_ck,
1025 .clkdm_name = "core_l4_clkdm",
1026 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1027 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1028 .recalc = &followparent_recalc,
1029};
1030
1031static struct clk gpt9_fck = {
1032 .name = "gpt9_fck",
1033 .ops = &clkops_omap2_dflt_wait,
1034 .parent = &func_32k_ck,
1035 .clkdm_name = "core_l4_clkdm",
1036 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1037 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1038 .init = &omap2_init_clksel_parent,
1039 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1040 .clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
1041 .clksel = omap24xx_gpt_clksel,
1042 .recalc = &omap2_clksel_recalc,
1043};
1044
1045static struct clk gpt10_ick = {
1046 .name = "gpt10_ick",
1047 .ops = &clkops_omap2_iclk_dflt_wait,
1048 .parent = &l4_ck,
1049 .clkdm_name = "core_l4_clkdm",
1050 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1051 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1052 .recalc = &followparent_recalc,
1053};
1054
1055static struct clk gpt10_fck = {
1056 .name = "gpt10_fck",
1057 .ops = &clkops_omap2_dflt_wait,
1058 .parent = &func_32k_ck,
1059 .clkdm_name = "core_l4_clkdm",
1060 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1061 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1062 .init = &omap2_init_clksel_parent,
1063 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1064 .clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
1065 .clksel = omap24xx_gpt_clksel,
1066 .recalc = &omap2_clksel_recalc,
1067};
1068
1069static struct clk gpt11_ick = {
1070 .name = "gpt11_ick",
1071 .ops = &clkops_omap2_iclk_dflt_wait,
1072 .parent = &l4_ck,
1073 .clkdm_name = "core_l4_clkdm",
1074 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1075 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1076 .recalc = &followparent_recalc,
1077};
1078
1079static struct clk gpt11_fck = {
1080 .name = "gpt11_fck",
1081 .ops = &clkops_omap2_dflt_wait,
1082 .parent = &func_32k_ck,
1083 .clkdm_name = "core_l4_clkdm",
1084 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1085 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1086 .init = &omap2_init_clksel_parent,
1087 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1088 .clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
1089 .clksel = omap24xx_gpt_clksel,
1090 .recalc = &omap2_clksel_recalc,
1091};
1092
1093static struct clk gpt12_ick = {
1094 .name = "gpt12_ick",
1095 .ops = &clkops_omap2_iclk_dflt_wait,
1096 .parent = &l4_ck,
1097 .clkdm_name = "core_l4_clkdm",
1098 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1099 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1100 .recalc = &followparent_recalc,
1101};
1102
1103static struct clk gpt12_fck = {
1104 .name = "gpt12_fck",
1105 .ops = &clkops_omap2_dflt_wait,
1106 .parent = &secure_32k_ck,
1107 .clkdm_name = "core_l4_clkdm",
1108 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1109 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1110 .init = &omap2_init_clksel_parent,
1111 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1112 .clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK,
1113 .clksel = omap24xx_gpt_clksel,
1114 .recalc = &omap2_clksel_recalc,
1115};
1116
1117static struct clk mcbsp1_ick = {
1118 .name = "mcbsp1_ick",
1119 .ops = &clkops_omap2_iclk_dflt_wait,
1120 .parent = &l4_ck,
1121 .clkdm_name = "core_l4_clkdm",
1122 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1123 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1124 .recalc = &followparent_recalc,
1125};
1126
1127static const struct clksel_rate common_mcbsp_96m_rates[] = {
1128 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1129 { .div = 0 }
1130};
1131
1132static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1133 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1134 { .div = 0 }
1135};
1136
1137static const struct clksel mcbsp_fck_clksel[] = {
1138 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1139 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1140 { .parent = NULL }
1141};
1142
1143static struct clk mcbsp1_fck = {
1144 .name = "mcbsp1_fck",
1145 .ops = &clkops_omap2_dflt_wait,
1146 .parent = &func_96m_ck,
1147 .init = &omap2_init_clksel_parent,
1148 .clkdm_name = "core_l4_clkdm",
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1150 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1151 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1152 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1153 .clksel = mcbsp_fck_clksel,
1154 .recalc = &omap2_clksel_recalc,
1155};
1156
1157static struct clk mcbsp2_ick = {
1158 .name = "mcbsp2_ick",
1159 .ops = &clkops_omap2_iclk_dflt_wait,
1160 .parent = &l4_ck,
1161 .clkdm_name = "core_l4_clkdm",
1162 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1163 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1164 .recalc = &followparent_recalc,
1165};
1166
1167static struct clk mcbsp2_fck = {
1168 .name = "mcbsp2_fck",
1169 .ops = &clkops_omap2_dflt_wait,
1170 .parent = &func_96m_ck,
1171 .init = &omap2_init_clksel_parent,
1172 .clkdm_name = "core_l4_clkdm",
1173 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1174 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1175 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1176 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
1177 .clksel = mcbsp_fck_clksel,
1178 .recalc = &omap2_clksel_recalc,
1179};
1180
1181static struct clk mcbsp3_ick = {
1182 .name = "mcbsp3_ick",
1183 .ops = &clkops_omap2_iclk_dflt_wait,
1184 .parent = &l4_ck,
1185 .clkdm_name = "core_l4_clkdm",
1186 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1187 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1188 .recalc = &followparent_recalc,
1189};
1190
1191static struct clk mcbsp3_fck = {
1192 .name = "mcbsp3_fck",
1193 .ops = &clkops_omap2_dflt_wait,
1194 .parent = &func_96m_ck,
1195 .init = &omap2_init_clksel_parent,
1196 .clkdm_name = "core_l4_clkdm",
1197 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1198 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1199 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1200 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
1201 .clksel = mcbsp_fck_clksel,
1202 .recalc = &omap2_clksel_recalc,
1203};
1204
1205static struct clk mcbsp4_ick = {
1206 .name = "mcbsp4_ick",
1207 .ops = &clkops_omap2_iclk_dflt_wait,
1208 .parent = &l4_ck,
1209 .clkdm_name = "core_l4_clkdm",
1210 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1211 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1212 .recalc = &followparent_recalc,
1213};
1214
1215static struct clk mcbsp4_fck = {
1216 .name = "mcbsp4_fck",
1217 .ops = &clkops_omap2_dflt_wait,
1218 .parent = &func_96m_ck,
1219 .init = &omap2_init_clksel_parent,
1220 .clkdm_name = "core_l4_clkdm",
1221 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1222 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1223 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1224 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
1225 .clksel = mcbsp_fck_clksel,
1226 .recalc = &omap2_clksel_recalc,
1227};
1228
1229static struct clk mcbsp5_ick = {
1230 .name = "mcbsp5_ick",
1231 .ops = &clkops_omap2_iclk_dflt_wait,
1232 .parent = &l4_ck,
1233 .clkdm_name = "core_l4_clkdm",
1234 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1235 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1236 .recalc = &followparent_recalc,
1237};
1238
1239static struct clk mcbsp5_fck = {
1240 .name = "mcbsp5_fck",
1241 .ops = &clkops_omap2_dflt_wait,
1242 .parent = &func_96m_ck,
1243 .init = &omap2_init_clksel_parent,
1244 .clkdm_name = "core_l4_clkdm",
1245 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1246 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1247 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1248 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1249 .clksel = mcbsp_fck_clksel,
1250 .recalc = &omap2_clksel_recalc,
1251};
1252
1253static struct clk mcspi1_ick = {
1254 .name = "mcspi1_ick",
1255 .ops = &clkops_omap2_iclk_dflt_wait,
1256 .parent = &l4_ck,
1257 .clkdm_name = "core_l4_clkdm",
1258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1259 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1260 .recalc = &followparent_recalc,
1261};
1262
1263static struct clk mcspi1_fck = {
1264 .name = "mcspi1_fck",
1265 .ops = &clkops_omap2_dflt_wait,
1266 .parent = &func_48m_ck,
1267 .clkdm_name = "core_l4_clkdm",
1268 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1269 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1270 .recalc = &followparent_recalc,
1271};
1272
1273static struct clk mcspi2_ick = {
1274 .name = "mcspi2_ick",
1275 .ops = &clkops_omap2_iclk_dflt_wait,
1276 .parent = &l4_ck,
1277 .clkdm_name = "core_l4_clkdm",
1278 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1279 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1280 .recalc = &followparent_recalc,
1281};
1282
1283static struct clk mcspi2_fck = {
1284 .name = "mcspi2_fck",
1285 .ops = &clkops_omap2_dflt_wait,
1286 .parent = &func_48m_ck,
1287 .clkdm_name = "core_l4_clkdm",
1288 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1289 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1290 .recalc = &followparent_recalc,
1291};
1292
1293static struct clk mcspi3_ick = {
1294 .name = "mcspi3_ick",
1295 .ops = &clkops_omap2_iclk_dflt_wait,
1296 .parent = &l4_ck,
1297 .clkdm_name = "core_l4_clkdm",
1298 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1299 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1300 .recalc = &followparent_recalc,
1301};
1302
1303static struct clk mcspi3_fck = {
1304 .name = "mcspi3_fck",
1305 .ops = &clkops_omap2_dflt_wait,
1306 .parent = &func_48m_ck,
1307 .clkdm_name = "core_l4_clkdm",
1308 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1309 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1310 .recalc = &followparent_recalc,
1311};
1312
1313static struct clk uart1_ick = {
1314 .name = "uart1_ick",
1315 .ops = &clkops_omap2_iclk_dflt_wait,
1316 .parent = &l4_ck,
1317 .clkdm_name = "core_l4_clkdm",
1318 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1319 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1320 .recalc = &followparent_recalc,
1321};
1322
1323static struct clk uart1_fck = {
1324 .name = "uart1_fck",
1325 .ops = &clkops_omap2_dflt_wait,
1326 .parent = &func_48m_ck,
1327 .clkdm_name = "core_l4_clkdm",
1328 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1329 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1330 .recalc = &followparent_recalc,
1331};
1332
1333static struct clk uart2_ick = {
1334 .name = "uart2_ick",
1335 .ops = &clkops_omap2_iclk_dflt_wait,
1336 .parent = &l4_ck,
1337 .clkdm_name = "core_l4_clkdm",
1338 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1339 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1340 .recalc = &followparent_recalc,
1341};
1342
1343static struct clk uart2_fck = {
1344 .name = "uart2_fck",
1345 .ops = &clkops_omap2_dflt_wait,
1346 .parent = &func_48m_ck,
1347 .clkdm_name = "core_l4_clkdm",
1348 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1349 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1350 .recalc = &followparent_recalc,
1351};
1352
1353static struct clk uart3_ick = {
1354 .name = "uart3_ick",
1355 .ops = &clkops_omap2_iclk_dflt_wait,
1356 .parent = &l4_ck,
1357 .clkdm_name = "core_l4_clkdm",
1358 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1359 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1360 .recalc = &followparent_recalc,
1361};
1362
1363static struct clk uart3_fck = {
1364 .name = "uart3_fck",
1365 .ops = &clkops_omap2_dflt_wait,
1366 .parent = &func_48m_ck,
1367 .clkdm_name = "core_l4_clkdm",
1368 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1369 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1370 .recalc = &followparent_recalc,
1371};
1372
1373static struct clk gpios_ick = {
1374 .name = "gpios_ick",
1375 .ops = &clkops_omap2_iclk_dflt_wait,
1376 .parent = &wu_l4_ick,
1377 .clkdm_name = "wkup_clkdm",
1378 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1379 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1380 .recalc = &followparent_recalc,
1381};
1382
1383static struct clk gpios_fck = {
1384 .name = "gpios_fck",
1385 .ops = &clkops_omap2_dflt_wait,
1386 .parent = &func_32k_ck,
1387 .clkdm_name = "wkup_clkdm",
1388 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1389 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1390 .recalc = &followparent_recalc,
1391};
1392
1393static struct clk mpu_wdt_ick = {
1394 .name = "mpu_wdt_ick",
1395 .ops = &clkops_omap2_iclk_dflt_wait,
1396 .parent = &wu_l4_ick,
1397 .clkdm_name = "wkup_clkdm",
1398 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1399 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1400 .recalc = &followparent_recalc,
1401};
1402
1403static struct clk mpu_wdt_fck = {
1404 .name = "mpu_wdt_fck",
1405 .ops = &clkops_omap2_dflt_wait,
1406 .parent = &func_32k_ck,
1407 .clkdm_name = "wkup_clkdm",
1408 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1409 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1410 .recalc = &followparent_recalc,
1411};
1412
1413static struct clk sync_32k_ick = {
1414 .name = "sync_32k_ick",
1415 .ops = &clkops_omap2_iclk_dflt_wait,
1416 .flags = ENABLE_ON_INIT,
1417 .parent = &wu_l4_ick,
1418 .clkdm_name = "wkup_clkdm",
1419 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1420 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1421 .recalc = &followparent_recalc,
1422};
1423
1424static struct clk wdt1_ick = {
1425 .name = "wdt1_ick",
1426 .ops = &clkops_omap2_iclk_dflt_wait,
1427 .parent = &wu_l4_ick,
1428 .clkdm_name = "wkup_clkdm",
1429 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1430 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1431 .recalc = &followparent_recalc,
1432};
1433
1434static struct clk omapctrl_ick = {
1435 .name = "omapctrl_ick",
1436 .ops = &clkops_omap2_iclk_dflt_wait,
1437 .flags = ENABLE_ON_INIT,
1438 .parent = &wu_l4_ick,
1439 .clkdm_name = "wkup_clkdm",
1440 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1441 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1442 .recalc = &followparent_recalc,
1443};
1444
1445static struct clk icr_ick = {
1446 .name = "icr_ick",
1447 .ops = &clkops_omap2_iclk_dflt_wait,
1448 .parent = &wu_l4_ick,
1449 .clkdm_name = "wkup_clkdm",
1450 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1451 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1452 .recalc = &followparent_recalc,
1453};
1454
1455static struct clk cam_ick = {
1456 .name = "cam_ick",
1457 .ops = &clkops_omap2_iclk_dflt,
1458 .parent = &l4_ck,
1459 .clkdm_name = "core_l4_clkdm",
1460 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1461 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1462 .recalc = &followparent_recalc,
1463};
1464
1465/*
1466 * cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be
1467 * split into two separate clocks, since the parent clocks are different
1468 * and the clockdomains are also different.
1469 */
1470static struct clk cam_fck = {
1471 .name = "cam_fck",
1472 .ops = &clkops_omap2_dflt,
1473 .parent = &func_96m_ck,
1474 .clkdm_name = "core_l3_clkdm",
1475 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1476 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1477 .recalc = &followparent_recalc,
1478};
1479
1480static struct clk mailboxes_ick = {
1481 .name = "mailboxes_ick",
1482 .ops = &clkops_omap2_iclk_dflt_wait,
1483 .parent = &l4_ck,
1484 .clkdm_name = "core_l4_clkdm",
1485 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1486 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1487 .recalc = &followparent_recalc,
1488};
1489
1490static struct clk wdt4_ick = {
1491 .name = "wdt4_ick",
1492 .ops = &clkops_omap2_iclk_dflt_wait,
1493 .parent = &l4_ck,
1494 .clkdm_name = "core_l4_clkdm",
1495 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1496 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1497 .recalc = &followparent_recalc,
1498};
1499
1500static struct clk wdt4_fck = {
1501 .name = "wdt4_fck",
1502 .ops = &clkops_omap2_dflt_wait,
1503 .parent = &func_32k_ck,
1504 .clkdm_name = "core_l4_clkdm",
1505 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1506 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1507 .recalc = &followparent_recalc,
1508};
1509
1510static struct clk mspro_ick = {
1511 .name = "mspro_ick",
1512 .ops = &clkops_omap2_iclk_dflt_wait,
1513 .parent = &l4_ck,
1514 .clkdm_name = "core_l4_clkdm",
1515 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1516 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1517 .recalc = &followparent_recalc,
1518};
1519
1520static struct clk mspro_fck = {
1521 .name = "mspro_fck",
1522 .ops = &clkops_omap2_dflt_wait,
1523 .parent = &func_96m_ck,
1524 .clkdm_name = "core_l4_clkdm",
1525 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1526 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1527 .recalc = &followparent_recalc,
1528};
1529
1530static struct clk fac_ick = {
1531 .name = "fac_ick",
1532 .ops = &clkops_omap2_iclk_dflt_wait,
1533 .parent = &l4_ck,
1534 .clkdm_name = "core_l4_clkdm",
1535 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1536 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1537 .recalc = &followparent_recalc,
1538};
1539
1540static struct clk fac_fck = {
1541 .name = "fac_fck",
1542 .ops = &clkops_omap2_dflt_wait,
1543 .parent = &func_12m_ck,
1544 .clkdm_name = "core_l4_clkdm",
1545 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1546 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1547 .recalc = &followparent_recalc,
1548};
1549
1550static struct clk hdq_ick = {
1551 .name = "hdq_ick",
1552 .ops = &clkops_omap2_iclk_dflt_wait,
1553 .parent = &l4_ck,
1554 .clkdm_name = "core_l4_clkdm",
1555 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1556 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1557 .recalc = &followparent_recalc,
1558};
1559
1560static struct clk hdq_fck = {
1561 .name = "hdq_fck",
1562 .ops = &clkops_omap2_dflt_wait,
1563 .parent = &func_12m_ck,
1564 .clkdm_name = "core_l4_clkdm",
1565 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1566 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1567 .recalc = &followparent_recalc,
1568};
1569
1570/*
1571 * XXX This is marked as a 2420-only define, but it claims to be present
1572 * on 2430 also. Double-check.
1573 */
1574static struct clk i2c2_ick = {
1575 .name = "i2c2_ick",
1576 .ops = &clkops_omap2_iclk_dflt_wait,
1577 .parent = &l4_ck,
1578 .clkdm_name = "core_l4_clkdm",
1579 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1580 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1581 .recalc = &followparent_recalc,
1582};
1583
1584static struct clk i2chs2_fck = {
1585 .name = "i2chs2_fck",
1586 .ops = &clkops_omap2430_i2chs_wait,
1587 .parent = &func_96m_ck,
1588 .clkdm_name = "core_l4_clkdm",
1589 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1590 .enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
1591 .recalc = &followparent_recalc,
1592};
1593
1594/*
1595 * XXX This is marked as a 2420-only define, but it claims to be present
1596 * on 2430 also. Double-check.
1597 */
1598static struct clk i2c1_ick = {
1599 .name = "i2c1_ick",
1600 .ops = &clkops_omap2_iclk_dflt_wait,
1601 .parent = &l4_ck,
1602 .clkdm_name = "core_l4_clkdm",
1603 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1604 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1605 .recalc = &followparent_recalc,
1606};
1607
1608static struct clk i2chs1_fck = {
1609 .name = "i2chs1_fck",
1610 .ops = &clkops_omap2430_i2chs_wait,
1611 .parent = &func_96m_ck,
1612 .clkdm_name = "core_l4_clkdm",
1613 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1614 .enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
1615 .recalc = &followparent_recalc,
1616};
1617
1618/*
1619 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1620 * accesses derived from this data.
1621 */
1622static struct clk gpmc_fck = {
1623 .name = "gpmc_fck",
1624 .ops = &clkops_omap2_iclk_idle_only,
1625 .parent = &core_l3_ck,
1626 .flags = ENABLE_ON_INIT,
1627 .clkdm_name = "core_l3_clkdm",
1628 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1629 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1630 .recalc = &followparent_recalc,
1631};
1632
1633static struct clk sdma_fck = {
1634 .name = "sdma_fck",
1635 .ops = &clkops_null, /* RMK: missing? */
1636 .parent = &core_l3_ck,
1637 .clkdm_name = "core_l3_clkdm",
1638 .recalc = &followparent_recalc,
1639};
1640
1641/*
1642 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1643 * accesses derived from this data.
1644 */
1645static struct clk sdma_ick = {
1646 .name = "sdma_ick",
1647 .ops = &clkops_omap2_iclk_idle_only,
1648 .parent = &core_l3_ck,
1649 .clkdm_name = "core_l3_clkdm",
1650 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1651 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1652 .recalc = &followparent_recalc,
1653};
1654
1655static struct clk sdrc_ick = {
1656 .name = "sdrc_ick",
1657 .ops = &clkops_omap2_iclk_idle_only,
1658 .parent = &core_l3_ck,
1659 .flags = ENABLE_ON_INIT,
1660 .clkdm_name = "core_l3_clkdm",
1661 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1662 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1663 .recalc = &followparent_recalc,
1664};
1665
1666static struct clk des_ick = {
1667 .name = "des_ick",
1668 .ops = &clkops_omap2_iclk_dflt_wait,
1669 .parent = &l4_ck,
1670 .clkdm_name = "core_l4_clkdm",
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1672 .enable_bit = OMAP24XX_EN_DES_SHIFT,
1673 .recalc = &followparent_recalc,
1674};
1675
1676static struct clk sha_ick = {
1677 .name = "sha_ick",
1678 .ops = &clkops_omap2_iclk_dflt_wait,
1679 .parent = &l4_ck,
1680 .clkdm_name = "core_l4_clkdm",
1681 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1682 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1683 .recalc = &followparent_recalc,
1684};
1685
1686static struct clk rng_ick = {
1687 .name = "rng_ick",
1688 .ops = &clkops_omap2_iclk_dflt_wait,
1689 .parent = &l4_ck,
1690 .clkdm_name = "core_l4_clkdm",
1691 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1692 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1693 .recalc = &followparent_recalc,
1694};
1695
1696static struct clk aes_ick = {
1697 .name = "aes_ick",
1698 .ops = &clkops_omap2_iclk_dflt_wait,
1699 .parent = &l4_ck,
1700 .clkdm_name = "core_l4_clkdm",
1701 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1702 .enable_bit = OMAP24XX_EN_AES_SHIFT,
1703 .recalc = &followparent_recalc,
1704};
1705
1706static struct clk pka_ick = {
1707 .name = "pka_ick",
1708 .ops = &clkops_omap2_iclk_dflt_wait,
1709 .parent = &l4_ck,
1710 .clkdm_name = "core_l4_clkdm",
1711 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1712 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1713 .recalc = &followparent_recalc,
1714};
1715
1716static struct clk usb_fck = {
1717 .name = "usb_fck",
1718 .ops = &clkops_omap2_dflt_wait,
1719 .parent = &func_48m_ck,
1720 .clkdm_name = "core_l3_clkdm",
1721 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1722 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1723 .recalc = &followparent_recalc,
1724};
1725
1726static struct clk usbhs_ick = {
1727 .name = "usbhs_ick",
1728 .ops = &clkops_omap2_iclk_dflt_wait,
1729 .parent = &core_l3_ck,
1730 .clkdm_name = "core_l3_clkdm",
1731 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1732 .enable_bit = OMAP2430_EN_USBHS_SHIFT,
1733 .recalc = &followparent_recalc,
1734};
1735
1736static struct clk mmchs1_ick = {
1737 .name = "mmchs1_ick",
1738 .ops = &clkops_omap2_iclk_dflt_wait,
1739 .parent = &l4_ck,
1740 .clkdm_name = "core_l4_clkdm",
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1742 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1743 .recalc = &followparent_recalc,
1744};
1745
1746static struct clk mmchs1_fck = {
1747 .name = "mmchs1_fck",
1748 .ops = &clkops_omap2_dflt_wait,
1749 .parent = &func_96m_ck,
1750 .clkdm_name = "core_l4_clkdm",
1751 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1752 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1753 .recalc = &followparent_recalc,
1754};
1755
1756static struct clk mmchs2_ick = {
1757 .name = "mmchs2_ick",
1758 .ops = &clkops_omap2_iclk_dflt_wait,
1759 .parent = &l4_ck,
1760 .clkdm_name = "core_l4_clkdm",
1761 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1762 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1763 .recalc = &followparent_recalc,
1764};
1765
1766static struct clk mmchs2_fck = {
1767 .name = "mmchs2_fck",
1768 .ops = &clkops_omap2_dflt_wait,
1769 .parent = &func_96m_ck,
1770 .clkdm_name = "core_l4_clkdm",
1771 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1772 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1773 .recalc = &followparent_recalc,
1774};
1775
1776static struct clk gpio5_ick = {
1777 .name = "gpio5_ick",
1778 .ops = &clkops_omap2_iclk_dflt_wait,
1779 .parent = &l4_ck,
1780 .clkdm_name = "core_l4_clkdm",
1781 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1782 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
1783 .recalc = &followparent_recalc,
1784};
1785
1786static struct clk gpio5_fck = {
1787 .name = "gpio5_fck",
1788 .ops = &clkops_omap2_dflt_wait,
1789 .parent = &func_32k_ck,
1790 .clkdm_name = "core_l4_clkdm",
1791 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1792 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
1793 .recalc = &followparent_recalc,
1794};
1795
1796static struct clk mdm_intc_ick = {
1797 .name = "mdm_intc_ick",
1798 .ops = &clkops_omap2_iclk_dflt_wait,
1799 .parent = &l4_ck,
1800 .clkdm_name = "core_l4_clkdm",
1801 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1802 .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
1803 .recalc = &followparent_recalc,
1804};
1805
1806static struct clk mmchsdb1_fck = {
1807 .name = "mmchsdb1_fck",
1808 .ops = &clkops_omap2_dflt_wait,
1809 .parent = &func_32k_ck,
1810 .clkdm_name = "core_l4_clkdm",
1811 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1812 .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
1813 .recalc = &followparent_recalc,
1814};
1815
1816static struct clk mmchsdb2_fck = {
1817 .name = "mmchsdb2_fck",
1818 .ops = &clkops_omap2_dflt_wait,
1819 .parent = &func_32k_ck,
1820 .clkdm_name = "core_l4_clkdm",
1821 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1822 .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
1823 .recalc = &followparent_recalc,
1824};
1825
1826/*
1827 * This clock is a composite clock which does entire set changes then
1828 * forces a rebalance. It keys on the MPU speed, but it really could
1829 * be any key speed part of a set in the rate table.
1830 *
1831 * to really change a set, you need memory table sets which get changed
1832 * in sram, pre-notifiers & post notifiers, changing the top set, without
1833 * having low level display recalc's won't work... this is why dpm notifiers
1834 * work, isr's off, walk a list of clocks already _off_ and not messing with
1835 * the bus.
1836 *
1837 * This clock should have no parent. It embodies the entire upper level
1838 * active set. A parent will mess up some of the init also.
1839 */
1840static struct clk virt_prcm_set = {
1841 .name = "virt_prcm_set",
1842 .ops = &clkops_null,
1843 .parent = &mpu_ck, /* Indexed by mpu speed, no parent */
1844 .recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
1845 .set_rate = &omap2_select_table_rate,
1846 .round_rate = &omap2_round_to_table_rate,
1847};
1848
1849
1850/*
1851 * clkdev integration
1852 */
1853
1854static struct omap_clk omap2430_clks[] = {
1855 /* external root sources */
1856 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X),
1857 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X),
1858 CLK(NULL, "osc_ck", &osc_ck, CK_243X),
1859 CLK("twl", "fck", &osc_ck, CK_243X),
1860 CLK(NULL, "sys_ck", &sys_ck, CK_243X),
1861 CLK(NULL, "alt_ck", &alt_ck, CK_243X),
1862 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
1863 /* internal analog sources */
1864 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
1865 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X),
1866 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X),
1867 /* internal prcm root sources */
1868 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
1869 CLK(NULL, "core_ck", &core_ck, CK_243X),
1870 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
1871 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
1872 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
1873 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X),
1874 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X),
1875 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X),
1876 CLK(NULL, "emul_ck", &emul_ck, CK_243X),
1877 /* mpu domain clocks */
1878 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X),
1879 /* dsp domain clocks */
1880 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X),
1881 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
1882 /* GFX domain clocks */
1883 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X),
1884 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X),
1885 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X),
1886 /* Modem domain clocks */
1887 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
1888 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1889 /* DSS domain clocks */
1890 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1891 CLK(NULL, "dss_ick", &dss_ick, CK_243X),
1892 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1893 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1894 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
1895 /* L3 domain clocks */
1896 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X),
1897 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X),
1898 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X),
1899 /* L4 domain clocks */
1900 CLK(NULL, "l4_ck", &l4_ck, CK_243X),
1901 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X),
1902 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_243X),
1903 /* virtual meta-group clock */
1904 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X),
1905 /* general l4 interface ck, multi-parent functional clk */
1906 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X),
1907 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X),
1908 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X),
1909 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X),
1910 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X),
1911 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X),
1912 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X),
1913 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X),
1914 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X),
1915 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X),
1916 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X),
1917 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X),
1918 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X),
1919 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X),
1920 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X),
1921 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X),
1922 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X),
1923 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X),
1924 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X),
1925 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X),
1926 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X),
1927 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X),
1928 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1929 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1930 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1931 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X),
1932 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1933 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1934 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X),
1935 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1936 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1937 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X),
1938 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1939 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1940 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X),
1941 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1942 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1943 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X),
1944 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1945 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1946 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X),
1947 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1948 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1949 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X),
1950 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1951 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1952 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X),
1953 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1954 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1955 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
1956 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X),
1957 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X),
1958 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X),
1959 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X),
1960 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1961 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1962 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1963 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X),
1964 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1965 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1966 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1967 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
1968 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
1969 CLK("omap24xxcam", "fck", &cam_fck, CK_243X),
1970 CLK(NULL, "cam_fck", &cam_fck, CK_243X),
1971 CLK("omap24xxcam", "ick", &cam_ick, CK_243X),
1972 CLK(NULL, "cam_ick", &cam_ick, CK_243X),
1973 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X),
1974 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X),
1975 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X),
1976 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X),
1977 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X),
1978 CLK(NULL, "fac_ick", &fac_ick, CK_243X),
1979 CLK(NULL, "fac_fck", &fac_fck, CK_243X),
1980 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1981 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X),
1982 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1983 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X),
1984 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1985 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X),
1986 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1987 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1988 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X),
1989 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1990 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1991 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
1992 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X),
1993 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
1994 CLK(NULL, "des_ick", &des_ick, CK_243X),
1995 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1996 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1997 CLK(NULL, "rng_ick", &rng_ick, CK_243X),
1998 CLK("omap-aes", "ick", &aes_ick, CK_243X),
1999 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
2000 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
2001 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
2002 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
2003 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
2004 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X),
2005 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
2006 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
2007 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X),
2008 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
2009 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
2010 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
2011 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2012 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2013 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X),
2014 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2015 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X),
2016 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
2017 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
2018 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2019 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
2020};
2021
2022/*
2023 * init code
2024 */
2025
2026int __init omap2430_clk_init(void)
2027{
2028 const struct prcm_config *prcm;
2029 struct omap_clk *c;
2030 u32 clkrate;
2031
2032 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2033 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
2034 cpu_mask = RATE_IN_243X;
2035 rate_table = omap2430_rate_table;
2036
2037 clk_init(&omap2_clk_functions);
2038
2039 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2040 c++)
2041 clk_preinit(c->lk.clk);
2042
2043 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
2044 propagate_rate(&osc_ck);
2045 sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
2046 propagate_rate(&sys_ck);
2047
2048 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2049 c++) {
2050 clkdev_add(&c->lk);
2051 clk_register(c->lk.clk);
2052 omap2_init_clk_clkdm(c->lk.clk);
2053 }
2054
2055 /* Disable autoidle on all clocks; let the PM code enable it later */
2056 omap_clk_disable_autoidle_all();
2057
2058 /* Check the MPU rate set by bootloader */
2059 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
2060 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
2061 if (!(prcm->flags & cpu_mask))
2062 continue;
2063 if (prcm->xtal_speed != sys_ck.rate)
2064 continue;
2065 if (prcm->dpll_speed <= clkrate)
2066 break;
2067 }
2068 curr_prcm_set = prcm;
2069
2070 recalculate_root_clocks();
2071
2072 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
2073 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
2074 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
2075
2076 /*
2077 * Only enable those clocks we will need, let the drivers
2078 * enable other clocks as necessary
2079 */
2080 clk_enable_init_clocks();
2081
2082 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
2083 vclk = clk_get(NULL, "virt_prcm_set");
2084 sclk = clk_get(NULL, "sys_ck");
2085 dclk = clk_get(NULL, "dpll_ck");
2086
2087 return 0;
2088}
2089
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index e92be1fc1a0..1ff64690862 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -22,35 +22,18 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/clock.h>
26
27#include "soc.h" 25#include "soc.h"
28#include "clock.h" 26#include "clock.h"
29#include "clock2xxx.h" 27#include "clock2xxx.h"
30#include "cm.h" 28#include "cm.h"
31#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
32 30
33struct clk *vclk, *sclk, *dclk; 31struct clk_hw *dclk_hw;
34
35/* 32/*
36 * Omap24xx specific clock functions 33 * Omap24xx specific clock functions
37 */ 34 */
38 35
39/* 36/*
40 * Set clocks for bypass mode for reboot to work.
41 */
42void omap2xxx_clk_prepare_for_reboot(void)
43{
44 u32 rate;
45
46 if (vclk == NULL || sclk == NULL)
47 return;
48
49 rate = clk_get_rate(sclk);
50 clk_set_rate(vclk, rate);
51}
52
53/*
54 * Switch the MPU rate if specified on cmdline. We cannot do this 37 * Switch the MPU rate if specified on cmdline. We cannot do this
55 * early until cmdline is parsed. XXX This should be removed from the 38 * early until cmdline is parsed. XXX This should be removed from the
56 * clock code and handled by the OPP layer code in the near future. 39 * clock code and handled by the OPP layer code in the near future.
diff --git a/arch/arm/mach-omap2/clock2xxx.h b/arch/arm/mach-omap2/clock2xxx.h
index cb6df8ca9e4..539dc08afbb 100644
--- a/arch/arm/mach-omap2/clock2xxx.h
+++ b/arch/arm/mach-omap2/clock2xxx.h
@@ -8,17 +8,34 @@
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
10 10
11unsigned long omap2_table_mpu_recalc(struct clk *clk); 11#include <linux/clk-provider.h>
12int omap2_select_table_rate(struct clk *clk, unsigned long rate); 12#include "clock.h"
13long omap2_round_to_table_rate(struct clk *clk, unsigned long rate); 13
14unsigned long omap2xxx_sys_clk_recalc(struct clk *clk); 14unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
15unsigned long omap2_osc_clk_recalc(struct clk *clk); 15 unsigned long parent_rate);
16unsigned long omap2_dpllcore_recalc(struct clk *clk); 16int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
17int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); 17 unsigned long parent_rate);
18unsigned long omap2xxx_clk_get_core_rate(struct clk *clk); 18long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
19 unsigned long *parent_rate);
20unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
21 unsigned long parent_rate);
22unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
23 unsigned long parent_rate);
24unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
25 unsigned long parent_rate);
26int omap2_reprogram_dpllcore(struct clk_hw *clk, unsigned long rate,
27 unsigned long parent_rate);
28void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw);
29unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
30 unsigned long parent_rate);
31unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
32 unsigned long parent_rate);
33unsigned long omap2xxx_clk_get_core_rate(void);
19u32 omap2xxx_get_apll_clkin(void); 34u32 omap2xxx_get_apll_clkin(void);
20u32 omap2xxx_get_sysclkdiv(void); 35u32 omap2xxx_get_sysclkdiv(void);
21void omap2xxx_clk_prepare_for_reboot(void); 36void omap2xxx_clk_prepare_for_reboot(void);
37void omap2xxx_clkt_vps_check_bootloader_rates(void);
38void omap2xxx_clkt_vps_late_init(void);
22 39
23#ifdef CONFIG_SOC_OMAP2420 40#ifdef CONFIG_SOC_OMAP2420
24int omap2420_clk_init(void); 41int omap2420_clk_init(void);
@@ -32,13 +49,14 @@ int omap2430_clk_init(void);
32#define omap2430_clk_init() do { } while(0) 49#define omap2430_clk_init() do { } while(0)
33#endif 50#endif
34 51
35extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll; 52extern void __iomem *prcm_clksrc_ctrl;
36 53
37extern struct clk *dclk; 54extern struct clk_hw *dclk_hw;
38 55int omap2_enable_osc_ck(struct clk_hw *hw);
39extern const struct clkops clkops_omap2430_i2chs_wait; 56void omap2_disable_osc_ck(struct clk_hw *hw);
40extern const struct clkops clkops_oscck; 57int omap2_clk_apll96_enable(struct clk_hw *hw);
41extern const struct clkops clkops_apll96; 58int omap2_clk_apll54_enable(struct clk_hw *hw);
42extern const struct clkops clkops_apll54; 59void omap2_clk_apll96_disable(struct clk_hw *hw);
60void omap2_clk_apll54_disable(struct clk_hw *hw);
43 61
44#endif 62#endif
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
deleted file mode 100644
index 1a45d6bd253..00000000000
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ /dev/null
@@ -1,1112 +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.h>
20#include <plat/clkdev_omap.h>
21
22#include "am33xx.h"
23#include "iomap.h"
24#include "control.h"
25#include "clock.h"
26#include "cm.h"
27#include "cm33xx.h"
28#include "cm-regbits-33xx.h"
29#include "prm.h"
30
31/* Maximum DPLL multiplier, divider values for AM33XX */
32#define AM33XX_MAX_DPLL_MULT 2047
33#define AM33XX_MAX_DPLL_DIV 128
34
35/* Modulemode control */
36#define AM33XX_MODULEMODE_HWCTRL 0
37#define AM33XX_MODULEMODE_SWCTRL 1
38
39/* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
40 * physically present, in such a case HWMOD enabling of
41 * clock would be failure with default parent. And timer
42 * probe thinks clock is already enabled, this leads to
43 * crash upon accessing timer 3 & 6 registers in probe.
44 * Fix by setting parent of both these timers to master
45 * oscillator clock.
46 */
47static inline void am33xx_init_timer_parent(struct clk *clk)
48{
49 omap2_clksel_set_parent(clk, clk->parent);
50}
51
52/* Root clocks */
53
54/* RTC 32k */
55static struct clk clk_32768_ck = {
56 .name = "clk_32768_ck",
57 .clkdm_name = "l4_rtc_clkdm",
58 .rate = 32768,
59 .ops = &clkops_null,
60};
61
62/* On-Chip 32KHz RC OSC */
63static struct clk clk_rc32k_ck = {
64 .name = "clk_rc32k_ck",
65 .rate = 32000,
66 .ops = &clkops_null,
67};
68
69/* Crystal input clks */
70static struct clk virt_24000000_ck = {
71 .name = "virt_24000000_ck",
72 .rate = 24000000,
73 .ops = &clkops_null,
74};
75
76static struct clk virt_25000000_ck = {
77 .name = "virt_25000000_ck",
78 .rate = 25000000,
79 .ops = &clkops_null,
80};
81
82/* Oscillator clock */
83/* 19.2, 24, 25 or 26 MHz */
84static const struct clksel sys_clkin_sel[] = {
85 { .parent = &virt_19200000_ck, .rates = div_1_0_rates },
86 { .parent = &virt_24000000_ck, .rates = div_1_1_rates },
87 { .parent = &virt_25000000_ck, .rates = div_1_2_rates },
88 { .parent = &virt_26000000_ck, .rates = div_1_3_rates },
89 { .parent = NULL },
90};
91
92/* External clock - 12 MHz */
93static struct clk tclkin_ck = {
94 .name = "tclkin_ck",
95 .rate = 12000000,
96 .ops = &clkops_null,
97};
98
99/*
100 * sys_clk in: input to the dpll and also used as funtional clock for,
101 * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
102 *
103 */
104static struct clk sys_clkin_ck = {
105 .name = "sys_clkin_ck",
106 .parent = &virt_24000000_ck,
107 .init = &omap2_init_clksel_parent,
108 .clksel_reg = AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
109 .clksel_mask = AM33XX_CONTROL_STATUS_SYSBOOT1_MASK,
110 .clksel = sys_clkin_sel,
111 .ops = &clkops_null,
112 .recalc = &omap2_clksel_recalc,
113};
114
115/* DPLL_CORE */
116static struct dpll_data dpll_core_dd = {
117 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_CORE,
118 .clk_bypass = &sys_clkin_ck,
119 .clk_ref = &sys_clkin_ck,
120 .control_reg = AM33XX_CM_CLKMODE_DPLL_CORE,
121 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
122 .idlest_reg = AM33XX_CM_IDLEST_DPLL_CORE,
123 .mult_mask = AM33XX_DPLL_MULT_MASK,
124 .div1_mask = AM33XX_DPLL_DIV_MASK,
125 .enable_mask = AM33XX_DPLL_EN_MASK,
126 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
127 .max_multiplier = AM33XX_MAX_DPLL_MULT,
128 .max_divider = AM33XX_MAX_DPLL_DIV,
129 .min_divider = 1,
130};
131
132/* CLKDCOLDO output */
133static struct clk dpll_core_ck = {
134 .name = "dpll_core_ck",
135 .parent = &sys_clkin_ck,
136 .dpll_data = &dpll_core_dd,
137 .init = &omap2_init_dpll_parent,
138 .ops = &clkops_omap3_core_dpll_ops,
139 .recalc = &omap3_dpll_recalc,
140};
141
142static struct clk dpll_core_x2_ck = {
143 .name = "dpll_core_x2_ck",
144 .parent = &dpll_core_ck,
145 .flags = CLOCK_CLKOUTX2,
146 .ops = &clkops_null,
147 .recalc = &omap3_clkoutx2_recalc,
148};
149
150
151static const struct clksel dpll_core_m4_div[] = {
152 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
153 { .parent = NULL },
154};
155
156static struct clk dpll_core_m4_ck = {
157 .name = "dpll_core_m4_ck",
158 .parent = &dpll_core_x2_ck,
159 .init = &omap2_init_clksel_parent,
160 .clksel = dpll_core_m4_div,
161 .clksel_reg = AM33XX_CM_DIV_M4_DPLL_CORE,
162 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT1_DIV_MASK,
163 .ops = &clkops_null,
164 .recalc = &omap2_clksel_recalc,
165 .round_rate = &omap2_clksel_round_rate,
166 .set_rate = &omap2_clksel_set_rate,
167};
168
169static const struct clksel dpll_core_m5_div[] = {
170 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
171 { .parent = NULL },
172};
173
174static struct clk dpll_core_m5_ck = {
175 .name = "dpll_core_m5_ck",
176 .parent = &dpll_core_x2_ck,
177 .init = &omap2_init_clksel_parent,
178 .clksel = dpll_core_m5_div,
179 .clksel_reg = AM33XX_CM_DIV_M5_DPLL_CORE,
180 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT2_DIV_MASK,
181 .ops = &clkops_null,
182 .recalc = &omap2_clksel_recalc,
183 .round_rate = &omap2_clksel_round_rate,
184 .set_rate = &omap2_clksel_set_rate,
185};
186
187static const struct clksel dpll_core_m6_div[] = {
188 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
189 { .parent = NULL },
190};
191
192static struct clk dpll_core_m6_ck = {
193 .name = "dpll_core_m6_ck",
194 .parent = &dpll_core_x2_ck,
195 .init = &omap2_init_clksel_parent,
196 .clksel = dpll_core_m6_div,
197 .clksel_reg = AM33XX_CM_DIV_M6_DPLL_CORE,
198 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT3_DIV_MASK,
199 .ops = &clkops_null,
200 .recalc = &omap2_clksel_recalc,
201 .round_rate = &omap2_clksel_round_rate,
202 .set_rate = &omap2_clksel_set_rate,
203};
204
205/* DPLL_MPU */
206static struct dpll_data dpll_mpu_dd = {
207 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
208 .clk_bypass = &sys_clkin_ck,
209 .clk_ref = &sys_clkin_ck,
210 .control_reg = AM33XX_CM_CLKMODE_DPLL_MPU,
211 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
212 .idlest_reg = AM33XX_CM_IDLEST_DPLL_MPU,
213 .mult_mask = AM33XX_DPLL_MULT_MASK,
214 .div1_mask = AM33XX_DPLL_DIV_MASK,
215 .enable_mask = AM33XX_DPLL_EN_MASK,
216 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
217 .max_multiplier = AM33XX_MAX_DPLL_MULT,
218 .max_divider = AM33XX_MAX_DPLL_DIV,
219 .min_divider = 1,
220};
221
222/* CLKOUT: fdpll/M2 */
223static struct clk dpll_mpu_ck = {
224 .name = "dpll_mpu_ck",
225 .parent = &sys_clkin_ck,
226 .dpll_data = &dpll_mpu_dd,
227 .init = &omap2_init_dpll_parent,
228 .ops = &clkops_omap3_noncore_dpll_ops,
229 .recalc = &omap3_dpll_recalc,
230 .round_rate = &omap2_dpll_round_rate,
231 .set_rate = &omap3_noncore_dpll_set_rate,
232};
233
234/*
235 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
236 * and ALT_CLK1/2)
237 */
238static const struct clksel dpll_mpu_m2_div[] = {
239 { .parent = &dpll_mpu_ck, .rates = div31_1to31_rates },
240 { .parent = NULL },
241};
242
243static struct clk dpll_mpu_m2_ck = {
244 .name = "dpll_mpu_m2_ck",
245 .clkdm_name = "mpu_clkdm",
246 .parent = &dpll_mpu_ck,
247 .clksel = dpll_mpu_m2_div,
248 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_MPU,
249 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
250 .ops = &clkops_null,
251 .recalc = &omap2_clksel_recalc,
252 .round_rate = &omap2_clksel_round_rate,
253 .set_rate = &omap2_clksel_set_rate,
254};
255
256/* DPLL_DDR */
257static struct dpll_data dpll_ddr_dd = {
258 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DDR,
259 .clk_bypass = &sys_clkin_ck,
260 .clk_ref = &sys_clkin_ck,
261 .control_reg = AM33XX_CM_CLKMODE_DPLL_DDR,
262 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
263 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DDR,
264 .mult_mask = AM33XX_DPLL_MULT_MASK,
265 .div1_mask = AM33XX_DPLL_DIV_MASK,
266 .enable_mask = AM33XX_DPLL_EN_MASK,
267 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
268 .max_multiplier = AM33XX_MAX_DPLL_MULT,
269 .max_divider = AM33XX_MAX_DPLL_DIV,
270 .min_divider = 1,
271};
272
273/* CLKOUT: fdpll/M2 */
274static struct clk dpll_ddr_ck = {
275 .name = "dpll_ddr_ck",
276 .parent = &sys_clkin_ck,
277 .dpll_data = &dpll_ddr_dd,
278 .init = &omap2_init_dpll_parent,
279 .ops = &clkops_null,
280 .recalc = &omap3_dpll_recalc,
281};
282
283/*
284 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
285 * and ALT_CLK1/2)
286 */
287static const struct clksel dpll_ddr_m2_div[] = {
288 { .parent = &dpll_ddr_ck, .rates = div31_1to31_rates },
289 { .parent = NULL },
290};
291
292static struct clk dpll_ddr_m2_ck = {
293 .name = "dpll_ddr_m2_ck",
294 .parent = &dpll_ddr_ck,
295 .clksel = dpll_ddr_m2_div,
296 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_DDR,
297 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
298 .ops = &clkops_null,
299 .recalc = &omap2_clksel_recalc,
300 .round_rate = &omap2_clksel_round_rate,
301 .set_rate = &omap2_clksel_set_rate,
302};
303
304/* emif_fck functional clock */
305static struct clk dpll_ddr_m2_div2_ck = {
306 .name = "dpll_ddr_m2_div2_ck",
307 .clkdm_name = "l3_clkdm",
308 .parent = &dpll_ddr_m2_ck,
309 .ops = &clkops_null,
310 .fixed_div = 2,
311 .recalc = &omap_fixed_divisor_recalc,
312};
313
314/* DPLL_DISP */
315static struct dpll_data dpll_disp_dd = {
316 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DISP,
317 .clk_bypass = &sys_clkin_ck,
318 .clk_ref = &sys_clkin_ck,
319 .control_reg = AM33XX_CM_CLKMODE_DPLL_DISP,
320 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
321 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DISP,
322 .mult_mask = AM33XX_DPLL_MULT_MASK,
323 .div1_mask = AM33XX_DPLL_DIV_MASK,
324 .enable_mask = AM33XX_DPLL_EN_MASK,
325 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
326 .max_multiplier = AM33XX_MAX_DPLL_MULT,
327 .max_divider = AM33XX_MAX_DPLL_DIV,
328 .min_divider = 1,
329};
330
331/* CLKOUT: fdpll/M2 */
332static struct clk dpll_disp_ck = {
333 .name = "dpll_disp_ck",
334 .parent = &sys_clkin_ck,
335 .dpll_data = &dpll_disp_dd,
336 .init = &omap2_init_dpll_parent,
337 .ops = &clkops_null,
338 .recalc = &omap3_dpll_recalc,
339 .round_rate = &omap2_dpll_round_rate,
340 .set_rate = &omap3_noncore_dpll_set_rate,
341};
342
343/*
344 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
345 * and ALT_CLK1/2)
346 */
347static const struct clksel dpll_disp_m2_div[] = {
348 { .parent = &dpll_disp_ck, .rates = div31_1to31_rates },
349 { .parent = NULL },
350};
351
352static struct clk dpll_disp_m2_ck = {
353 .name = "dpll_disp_m2_ck",
354 .parent = &dpll_disp_ck,
355 .clksel = dpll_disp_m2_div,
356 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_DISP,
357 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
358 .ops = &clkops_null,
359 .recalc = &omap2_clksel_recalc,
360 .round_rate = &omap2_clksel_round_rate,
361 .set_rate = &omap2_clksel_set_rate,
362};
363
364/* DPLL_PER */
365static struct dpll_data dpll_per_dd = {
366 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
367 .clk_bypass = &sys_clkin_ck,
368 .clk_ref = &sys_clkin_ck,
369 .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
370 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
371 .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
372 .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
373 .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
374 .enable_mask = AM33XX_DPLL_EN_MASK,
375 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
376 .max_multiplier = AM33XX_MAX_DPLL_MULT,
377 .max_divider = AM33XX_MAX_DPLL_DIV,
378 .min_divider = 1,
379 .flags = DPLL_J_TYPE,
380};
381
382/* CLKDCOLDO */
383static struct clk dpll_per_ck = {
384 .name = "dpll_per_ck",
385 .parent = &sys_clkin_ck,
386 .dpll_data = &dpll_per_dd,
387 .init = &omap2_init_dpll_parent,
388 .ops = &clkops_null,
389 .recalc = &omap3_dpll_recalc,
390 .round_rate = &omap2_dpll_round_rate,
391 .set_rate = &omap3_noncore_dpll_set_rate,
392};
393
394/* CLKOUT: fdpll/M2 */
395static const struct clksel dpll_per_m2_div[] = {
396 { .parent = &dpll_per_ck, .rates = div31_1to31_rates },
397 { .parent = NULL },
398};
399
400static struct clk dpll_per_m2_ck = {
401 .name = "dpll_per_m2_ck",
402 .parent = &dpll_per_ck,
403 .clksel = dpll_per_m2_div,
404 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_PER,
405 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
406 .ops = &clkops_null,
407 .recalc = &omap2_clksel_recalc,
408 .round_rate = &omap2_clksel_round_rate,
409 .set_rate = &omap2_clksel_set_rate,
410};
411
412static struct clk dpll_per_m2_div4_wkupdm_ck = {
413 .name = "dpll_per_m2_div4_wkupdm_ck",
414 .clkdm_name = "l4_wkup_clkdm",
415 .parent = &dpll_per_m2_ck,
416 .fixed_div = 4,
417 .ops = &clkops_null,
418 .recalc = &omap_fixed_divisor_recalc,
419};
420
421static struct clk dpll_per_m2_div4_ck = {
422 .name = "dpll_per_m2_div4_ck",
423 .clkdm_name = "l4ls_clkdm",
424 .parent = &dpll_per_m2_ck,
425 .fixed_div = 4,
426 .ops = &clkops_null,
427 .recalc = &omap_fixed_divisor_recalc,
428};
429
430static struct clk l3_gclk = {
431 .name = "l3_gclk",
432 .clkdm_name = "l3_clkdm",
433 .parent = &dpll_core_m4_ck,
434 .ops = &clkops_null,
435 .recalc = &followparent_recalc,
436};
437
438static struct clk dpll_core_m4_div2_ck = {
439 .name = "dpll_core_m4_div2_ck",
440 .clkdm_name = "l4_wkup_clkdm",
441 .parent = &dpll_core_m4_ck,
442 .ops = &clkops_null,
443 .fixed_div = 2,
444 .recalc = &omap_fixed_divisor_recalc,
445};
446
447static struct clk l4_rtc_gclk = {
448 .name = "l4_rtc_gclk",
449 .parent = &dpll_core_m4_ck,
450 .ops = &clkops_null,
451 .fixed_div = 2,
452 .recalc = &omap_fixed_divisor_recalc,
453};
454
455static struct clk clk_24mhz = {
456 .name = "clk_24mhz",
457 .parent = &dpll_per_m2_ck,
458 .fixed_div = 8,
459 .ops = &clkops_null,
460 .recalc = &omap_fixed_divisor_recalc,
461};
462
463/*
464 * Below clock nodes describes clockdomains derived out
465 * of core clock.
466 */
467static struct clk l4hs_gclk = {
468 .name = "l4hs_gclk",
469 .clkdm_name = "l4hs_clkdm",
470 .parent = &dpll_core_m4_ck,
471 .ops = &clkops_null,
472 .recalc = &followparent_recalc,
473};
474
475static struct clk l3s_gclk = {
476 .name = "l3s_gclk",
477 .clkdm_name = "l3s_clkdm",
478 .parent = &dpll_core_m4_div2_ck,
479 .ops = &clkops_null,
480 .recalc = &followparent_recalc,
481};
482
483static struct clk l4fw_gclk = {
484 .name = "l4fw_gclk",
485 .clkdm_name = "l4fw_clkdm",
486 .parent = &dpll_core_m4_div2_ck,
487 .ops = &clkops_null,
488 .recalc = &followparent_recalc,
489};
490
491static struct clk l4ls_gclk = {
492 .name = "l4ls_gclk",
493 .clkdm_name = "l4ls_clkdm",
494 .parent = &dpll_core_m4_div2_ck,
495 .ops = &clkops_null,
496 .recalc = &followparent_recalc,
497};
498
499static struct clk sysclk_div_ck = {
500 .name = "sysclk_div_ck",
501 .parent = &dpll_core_m4_ck,
502 .ops = &clkops_null,
503 .recalc = &followparent_recalc,
504};
505
506/*
507 * In order to match the clock domain with hwmod clockdomain entry,
508 * separate clock nodes is required for the modules which are
509 * directly getting their funtioncal clock from sys_clkin.
510 */
511static struct clk adc_tsc_fck = {
512 .name = "adc_tsc_fck",
513 .clkdm_name = "l4_wkup_clkdm",
514 .parent = &sys_clkin_ck,
515 .ops = &clkops_null,
516 .recalc = &followparent_recalc,
517};
518
519static struct clk dcan0_fck = {
520 .name = "dcan0_fck",
521 .clkdm_name = "l4ls_clkdm",
522 .parent = &sys_clkin_ck,
523 .ops = &clkops_null,
524 .recalc = &followparent_recalc,
525};
526
527static struct clk dcan1_fck = {
528 .name = "dcan1_fck",
529 .clkdm_name = "l4ls_clkdm",
530 .parent = &sys_clkin_ck,
531 .ops = &clkops_null,
532 .recalc = &followparent_recalc,
533};
534
535static struct clk mcasp0_fck = {
536 .name = "mcasp0_fck",
537 .clkdm_name = "l3s_clkdm",
538 .parent = &sys_clkin_ck,
539 .ops = &clkops_null,
540 .recalc = &followparent_recalc,
541};
542
543static struct clk mcasp1_fck = {
544 .name = "mcasp1_fck",
545 .clkdm_name = "l3s_clkdm",
546 .parent = &sys_clkin_ck,
547 .ops = &clkops_null,
548 .recalc = &followparent_recalc,
549};
550
551static struct clk smartreflex0_fck = {
552 .name = "smartreflex0_fck",
553 .clkdm_name = "l4_wkup_clkdm",
554 .parent = &sys_clkin_ck,
555 .ops = &clkops_null,
556 .recalc = &followparent_recalc,
557};
558
559static struct clk smartreflex1_fck = {
560 .name = "smartreflex1_fck",
561 .clkdm_name = "l4_wkup_clkdm",
562 .parent = &sys_clkin_ck,
563 .ops = &clkops_null,
564 .recalc = &followparent_recalc,
565};
566
567/*
568 * Modules clock nodes
569 *
570 * The following clock leaf nodes are added for the moment because:
571 *
572 * - hwmod data is not present for these modules, either hwmod
573 * control is not required or its not populated.
574 * - Driver code is not yet migrated to use hwmod/runtime pm
575 * - Modules outside kernel access (to disable them by default)
576 *
577 * - debugss
578 * - mmu (gfx domain)
579 * - cefuse
580 * - usbotg_fck (its additional clock and not really a modulemode)
581 * - ieee5000
582 */
583static struct clk debugss_ick = {
584 .name = "debugss_ick",
585 .clkdm_name = "l3_aon_clkdm",
586 .parent = &dpll_core_m4_ck,
587 .ops = &clkops_omap2_dflt,
588 .enable_reg = AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
589 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
590 .recalc = &followparent_recalc,
591};
592
593static struct clk mmu_fck = {
594 .name = "mmu_fck",
595 .clkdm_name = "gfx_l3_clkdm",
596 .parent = &dpll_core_m4_ck,
597 .ops = &clkops_omap2_dflt,
598 .enable_reg = AM33XX_CM_GFX_MMUDATA_CLKCTRL,
599 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
600 .recalc = &followparent_recalc,
601};
602
603static struct clk cefuse_fck = {
604 .name = "cefuse_fck",
605 .clkdm_name = "l4_cefuse_clkdm",
606 .parent = &sys_clkin_ck,
607 .enable_reg = AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL,
608 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
609 .ops = &clkops_omap2_dflt,
610 .recalc = &followparent_recalc,
611};
612
613/*
614 * clkdiv32 is generated from fixed division of 732.4219
615 */
616static struct clk clkdiv32k_ick = {
617 .name = "clkdiv32k_ick",
618 .clkdm_name = "clk_24mhz_clkdm",
619 .rate = 32768,
620 .parent = &clk_24mhz,
621 .enable_reg = AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
622 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
623 .ops = &clkops_omap2_dflt,
624};
625
626static struct clk usbotg_fck = {
627 .name = "usbotg_fck",
628 .clkdm_name = "l3s_clkdm",
629 .parent = &dpll_per_ck,
630 .enable_reg = AM33XX_CM_CLKDCOLDO_DPLL_PER,
631 .enable_bit = AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
632 .ops = &clkops_omap2_dflt,
633 .recalc = &followparent_recalc,
634};
635
636static struct clk ieee5000_fck = {
637 .name = "ieee5000_fck",
638 .clkdm_name = "l3s_clkdm",
639 .parent = &dpll_core_m4_div2_ck,
640 .enable_reg = AM33XX_CM_PER_IEEE5000_CLKCTRL,
641 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
642 .ops = &clkops_omap2_dflt,
643 .recalc = &followparent_recalc,
644};
645
646/* Timers */
647static const struct clksel timer1_clkmux_sel[] = {
648 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
649 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
650 { .parent = &tclkin_ck, .rates = div_1_2_rates },
651 { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
652 { .parent = &clk_32768_ck, .rates = div_1_4_rates },
653 { .parent = NULL },
654};
655
656static struct clk timer1_fck = {
657 .name = "timer1_fck",
658 .clkdm_name = "l4ls_clkdm",
659 .parent = &sys_clkin_ck,
660 .init = &omap2_init_clksel_parent,
661 .clksel = timer1_clkmux_sel,
662 .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
663 .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
664 .ops = &clkops_null,
665 .recalc = &omap2_clksel_recalc,
666};
667
668static const struct clksel timer2_to_7_clk_sel[] = {
669 { .parent = &tclkin_ck, .rates = div_1_0_rates },
670 { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
671 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
672 { .parent = NULL },
673};
674
675static struct clk timer2_fck = {
676 .name = "timer2_fck",
677 .clkdm_name = "l4ls_clkdm",
678 .parent = &sys_clkin_ck,
679 .init = &omap2_init_clksel_parent,
680 .clksel = timer2_to_7_clk_sel,
681 .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
682 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
683 .ops = &clkops_null,
684 .recalc = &omap2_clksel_recalc,
685};
686
687static struct clk timer3_fck = {
688 .name = "timer3_fck",
689 .clkdm_name = "l4ls_clkdm",
690 .parent = &sys_clkin_ck,
691 .init = &am33xx_init_timer_parent,
692 .clksel = timer2_to_7_clk_sel,
693 .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
694 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
695 .ops = &clkops_null,
696 .recalc = &omap2_clksel_recalc,
697};
698
699static struct clk timer4_fck = {
700 .name = "timer4_fck",
701 .clkdm_name = "l4ls_clkdm",
702 .parent = &sys_clkin_ck,
703 .init = &omap2_init_clksel_parent,
704 .clksel = timer2_to_7_clk_sel,
705 .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
706 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
707 .ops = &clkops_null,
708 .recalc = &omap2_clksel_recalc,
709};
710
711static struct clk timer5_fck = {
712 .name = "timer5_fck",
713 .clkdm_name = "l4ls_clkdm",
714 .parent = &sys_clkin_ck,
715 .init = &omap2_init_clksel_parent,
716 .clksel = timer2_to_7_clk_sel,
717 .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
718 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
719 .ops = &clkops_null,
720 .recalc = &omap2_clksel_recalc,
721};
722
723static struct clk timer6_fck = {
724 .name = "timer6_fck",
725 .clkdm_name = "l4ls_clkdm",
726 .parent = &sys_clkin_ck,
727 .init = &am33xx_init_timer_parent,
728 .clksel = timer2_to_7_clk_sel,
729 .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
730 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
731 .ops = &clkops_null,
732 .recalc = &omap2_clksel_recalc,
733};
734
735static struct clk timer7_fck = {
736 .name = "timer7_fck",
737 .clkdm_name = "l4ls_clkdm",
738 .parent = &sys_clkin_ck,
739 .init = &omap2_init_clksel_parent,
740 .clksel = timer2_to_7_clk_sel,
741 .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
742 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
743 .ops = &clkops_null,
744 .recalc = &omap2_clksel_recalc,
745};
746
747static struct clk cpsw_125mhz_gclk = {
748 .name = "cpsw_125mhz_gclk",
749 .clkdm_name = "cpsw_125mhz_clkdm",
750 .parent = &dpll_core_m5_ck,
751 .ops = &clkops_null,
752 .fixed_div = 2,
753 .recalc = &omap_fixed_divisor_recalc,
754};
755
756static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
757 { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
758 { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
759 { .parent = NULL },
760};
761
762static struct clk cpsw_cpts_rft_clk = {
763 .name = "cpsw_cpts_rft_clk",
764 .clkdm_name = "cpsw_125mhz_clkdm",
765 .parent = &dpll_core_m5_ck,
766 .clksel = cpsw_cpts_rft_clkmux_sel,
767 .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
768 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
769 .ops = &clkops_null,
770 .recalc = &followparent_recalc,
771};
772
773/* gpio */
774static const struct clksel gpio0_dbclk_mux_sel[] = {
775 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
776 { .parent = &clk_32768_ck, .rates = div_1_1_rates },
777 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
778 { .parent = NULL },
779};
780
781static struct clk gpio0_dbclk_mux_ck = {
782 .name = "gpio0_dbclk_mux_ck",
783 .clkdm_name = "l4_wkup_clkdm",
784 .parent = &clk_rc32k_ck,
785 .init = &omap2_init_clksel_parent,
786 .clksel = gpio0_dbclk_mux_sel,
787 .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
788 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
789 .ops = &clkops_null,
790 .recalc = &omap2_clksel_recalc,
791};
792
793static struct clk gpio0_dbclk = {
794 .name = "gpio0_dbclk",
795 .clkdm_name = "l4_wkup_clkdm",
796 .parent = &gpio0_dbclk_mux_ck,
797 .enable_reg = AM33XX_CM_WKUP_GPIO0_CLKCTRL,
798 .enable_bit = AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT,
799 .ops = &clkops_omap2_dflt,
800 .recalc = &followparent_recalc,
801};
802
803static struct clk gpio1_dbclk = {
804 .name = "gpio1_dbclk",
805 .clkdm_name = "l4ls_clkdm",
806 .parent = &clkdiv32k_ick,
807 .enable_reg = AM33XX_CM_PER_GPIO1_CLKCTRL,
808 .enable_bit = AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT,
809 .ops = &clkops_omap2_dflt,
810 .recalc = &followparent_recalc,
811};
812
813static struct clk gpio2_dbclk = {
814 .name = "gpio2_dbclk",
815 .clkdm_name = "l4ls_clkdm",
816 .parent = &clkdiv32k_ick,
817 .enable_reg = AM33XX_CM_PER_GPIO2_CLKCTRL,
818 .enable_bit = AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT,
819 .ops = &clkops_omap2_dflt,
820 .recalc = &followparent_recalc,
821};
822
823static struct clk gpio3_dbclk = {
824 .name = "gpio3_dbclk",
825 .clkdm_name = "l4ls_clkdm",
826 .parent = &clkdiv32k_ick,
827 .enable_reg = AM33XX_CM_PER_GPIO3_CLKCTRL,
828 .enable_bit = AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT,
829 .ops = &clkops_omap2_dflt,
830 .recalc = &followparent_recalc,
831};
832
833static const struct clksel pruss_ocp_clk_mux_sel[] = {
834 { .parent = &l3_gclk, .rates = div_1_0_rates },
835 { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
836 { .parent = NULL },
837};
838
839static struct clk pruss_ocp_gclk = {
840 .name = "pruss_ocp_gclk",
841 .clkdm_name = "pruss_ocp_clkdm",
842 .parent = &l3_gclk,
843 .init = &omap2_init_clksel_parent,
844 .clksel = pruss_ocp_clk_mux_sel,
845 .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
846 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
847 .ops = &clkops_null,
848 .recalc = &followparent_recalc,
849};
850
851static const struct clksel lcd_clk_mux_sel[] = {
852 { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
853 { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
854 { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
855 { .parent = NULL },
856};
857
858static struct clk lcd_gclk = {
859 .name = "lcd_gclk",
860 .clkdm_name = "lcdc_clkdm",
861 .parent = &dpll_disp_m2_ck,
862 .init = &omap2_init_clksel_parent,
863 .clksel = lcd_clk_mux_sel,
864 .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
865 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
866 .ops = &clkops_null,
867 .recalc = &followparent_recalc,
868};
869
870static struct clk mmc_clk = {
871 .name = "mmc_clk",
872 .clkdm_name = "l4ls_clkdm",
873 .parent = &dpll_per_m2_ck,
874 .ops = &clkops_null,
875 .fixed_div = 2,
876 .recalc = &omap_fixed_divisor_recalc,
877};
878
879static struct clk mmc2_fck = {
880 .name = "mmc2_fck",
881 .clkdm_name = "l3s_clkdm",
882 .parent = &mmc_clk,
883 .ops = &clkops_null,
884 .recalc = &followparent_recalc,
885};
886
887static const struct clksel gfx_clksel_sel[] = {
888 { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
889 { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
890 { .parent = NULL },
891};
892
893static struct clk gfx_fclk_clksel_ck = {
894 .name = "gfx_fclk_clksel_ck",
895 .parent = &dpll_core_m4_ck,
896 .clksel = gfx_clksel_sel,
897 .ops = &clkops_null,
898 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
899 .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
900 .recalc = &omap2_clksel_recalc,
901};
902
903static const struct clksel_rate div_1_0_2_1_rates[] = {
904 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
905 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
906 { .div = 0 },
907};
908
909static const struct clksel gfx_div_sel[] = {
910 { .parent = &gfx_fclk_clksel_ck, .rates = div_1_0_2_1_rates },
911 { .parent = NULL },
912};
913
914static struct clk gfx_fck_div_ck = {
915 .name = "gfx_fck_div_ck",
916 .clkdm_name = "gfx_l3_clkdm",
917 .parent = &gfx_fclk_clksel_ck,
918 .init = &omap2_init_clksel_parent,
919 .clksel = gfx_div_sel,
920 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
921 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
922 .recalc = &omap2_clksel_recalc,
923 .round_rate = &omap2_clksel_round_rate,
924 .set_rate = &omap2_clksel_set_rate,
925 .ops = &clkops_null,
926};
927
928static const struct clksel sysclkout_pre_sel[] = {
929 { .parent = &clk_32768_ck, .rates = div_1_0_rates },
930 { .parent = &l3_gclk, .rates = div_1_1_rates },
931 { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
932 { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
933 { .parent = &lcd_gclk, .rates = div_1_4_rates },
934 { .parent = NULL },
935};
936
937static struct clk sysclkout_pre_ck = {
938 .name = "sysclkout_pre_ck",
939 .parent = &clk_32768_ck,
940 .init = &omap2_init_clksel_parent,
941 .clksel = sysclkout_pre_sel,
942 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
943 .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
944 .ops = &clkops_null,
945 .recalc = &omap2_clksel_recalc,
946};
947
948/* Divide by 8 clock rates with default clock is 1/1*/
949static const struct clksel_rate div8_rates[] = {
950 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
951 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
952 { .div = 3, .val = 2, .flags = RATE_IN_AM33XX },
953 { .div = 4, .val = 3, .flags = RATE_IN_AM33XX },
954 { .div = 5, .val = 4, .flags = RATE_IN_AM33XX },
955 { .div = 6, .val = 5, .flags = RATE_IN_AM33XX },
956 { .div = 7, .val = 6, .flags = RATE_IN_AM33XX },
957 { .div = 8, .val = 7, .flags = RATE_IN_AM33XX },
958 { .div = 0 },
959};
960
961static const struct clksel clkout2_div[] = {
962 { .parent = &sysclkout_pre_ck, .rates = div8_rates },
963 { .parent = NULL },
964};
965
966static struct clk clkout2_ck = {
967 .name = "clkout2_ck",
968 .parent = &sysclkout_pre_ck,
969 .ops = &clkops_omap2_dflt,
970 .clksel = clkout2_div,
971 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
972 .clksel_mask = AM33XX_CLKOUT2DIV_MASK,
973 .enable_reg = AM33XX_CM_CLKOUT_CTRL,
974 .enable_bit = AM33XX_CLKOUT2EN_SHIFT,
975 .recalc = &omap2_clksel_recalc,
976 .round_rate = &omap2_clksel_round_rate,
977 .set_rate = &omap2_clksel_set_rate,
978};
979
980static const struct clksel wdt_clkmux_sel[] = {
981 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
982 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
983 { .parent = NULL },
984};
985
986static struct clk wdt1_fck = {
987 .name = "wdt1_fck",
988 .clkdm_name = "l4_wkup_clkdm",
989 .parent = &clk_rc32k_ck,
990 .init = &omap2_init_clksel_parent,
991 .clksel = wdt_clkmux_sel,
992 .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
993 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
994 .ops = &clkops_null,
995 .recalc = &omap2_clksel_recalc,
996};
997
998/*
999 * clkdev
1000 */
1001static struct omap_clk am33xx_clks[] = {
1002 CLK(NULL, "clk_32768_ck", &clk_32768_ck, CK_AM33XX),
1003 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck, CK_AM33XX),
1004 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_AM33XX),
1005 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck, CK_AM33XX),
1006 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck, CK_AM33XX),
1007 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_AM33XX),
1008 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_AM33XX),
1009 CLK(NULL, "tclkin_ck", &tclkin_ck, CK_AM33XX),
1010 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_AM33XX),
1011 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_AM33XX),
1012 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_AM33XX),
1013 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
1014 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
1015 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
1016 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
1017 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
1018 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
1019 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
1020 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX),
1021 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX),
1022 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX),
1023 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX),
1024 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX),
1025 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX),
1026 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
1027 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
1028 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
1029 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
1030 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
1031 CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX),
1032 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
1033 CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX),
1034 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
1035 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
1036 CLK("davinci-mcasp.0", NULL, &mcasp0_fck, CK_AM33XX),
1037 CLK("davinci-mcasp.1", NULL, &mcasp1_fck, CK_AM33XX),
1038 CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX),
1039 CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX),
1040 CLK("NULL", "mmc2_fck", &mmc2_fck, CK_AM33XX),
1041 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
1042 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
1043 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
1044 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
1045 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
1046 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
1047 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX),
1048 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX),
1049 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX),
1050 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX),
1051 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
1052 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
1053 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
1054 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX),
1055 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX),
1056 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX),
1057 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX),
1058 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX),
1059 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX),
1060 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX),
1061 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX),
1062 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX),
1063 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX),
1064 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX),
1065 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX),
1066 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX),
1067 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX),
1068 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX),
1069 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX),
1070 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX),
1071 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX),
1072 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
1073 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
1074 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
1075 CLK(NULL, "clkout2_ck", &clkout2_ck, CK_AM33XX),
1076 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
1077 CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX),
1078};
1079
1080int __init am33xx_clk_init(void)
1081{
1082 struct omap_clk *c;
1083 u32 cpu_clkflg;
1084
1085 if (soc_is_am33xx()) {
1086 cpu_mask = RATE_IN_AM33XX;
1087 cpu_clkflg = CK_AM33XX;
1088 }
1089
1090 clk_init(&omap2_clk_functions);
1091
1092 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
1093 clk_preinit(c->lk.clk);
1094
1095 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
1096 if (c->cpu & cpu_clkflg) {
1097 clkdev_add(&c->lk);
1098 clk_register(c->lk.clk);
1099 omap2_init_clk_clkdm(c->lk.clk);
1100 }
1101 }
1102
1103 recalculate_root_clocks();
1104
1105 /*
1106 * Only enable those clocks we will need, let the drivers
1107 * enable other clocks as necessary
1108 */
1109 clk_enable_init_clocks();
1110
1111 return 0;
1112}
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 1fc96b9ee33..4596468e50a 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -21,11 +21,9 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "clock.h" 24#include "clock.h"
27#include "clock34xx.h" 25#include "clock34xx.h"
28#include "cm2xxx_3xxx.h" 26#include "cm3xxx.h"
29#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
30 28
31/** 29/**
@@ -39,7 +37,7 @@
39 * from the CM_{I,F}CLKEN bit. Pass back the correct info via 37 * from the CM_{I,F}CLKEN bit. Pass back the correct info via
40 * @idlest_reg and @idlest_bit. No return value. 38 * @idlest_reg and @idlest_bit. No return value.
41 */ 39 */
42static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, 40static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
43 void __iomem **idlest_reg, 41 void __iomem **idlest_reg,
44 u8 *idlest_bit, 42 u8 *idlest_bit,
45 u8 *idlest_val) 43 u8 *idlest_val)
@@ -51,21 +49,16 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
51 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT; 49 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
52 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 50 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
53} 51}
54 52const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
55const struct clkops clkops_omap3430es2_ssi_wait = {
56 .enable = omap2_dflt_clk_enable,
57 .disable = omap2_dflt_clk_disable,
58 .find_idlest = omap3430es2_clk_ssi_find_idlest, 53 .find_idlest = omap3430es2_clk_ssi_find_idlest,
59 .find_companion = omap2_clk_dflt_find_companion, 54 .find_companion = omap2_clk_dflt_find_companion,
60}; 55};
61 56
62const struct clkops clkops_omap3430es2_iclk_ssi_wait = { 57const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
63 .enable = omap2_dflt_clk_enable,
64 .disable = omap2_dflt_clk_disable,
65 .find_idlest = omap3430es2_clk_ssi_find_idlest,
66 .find_companion = omap2_clk_dflt_find_companion,
67 .allow_idle = omap2_clkt_iclk_allow_idle, 58 .allow_idle = omap2_clkt_iclk_allow_idle,
68 .deny_idle = omap2_clkt_iclk_deny_idle, 59 .deny_idle = omap2_clkt_iclk_deny_idle,
60 .find_idlest = omap3430es2_clk_ssi_find_idlest,
61 .find_companion = omap2_clk_dflt_find_companion,
69}; 62};
70 63
71/** 64/**
@@ -82,7 +75,7 @@ const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
82 * default find_idlest code assumes that they are at the same 75 * default find_idlest code assumes that they are at the same
83 * position.) No return value. 76 * position.) No return value.
84 */ 77 */
85static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, 78static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
86 void __iomem **idlest_reg, 79 void __iomem **idlest_reg,
87 u8 *idlest_bit, 80 u8 *idlest_bit,
88 u8 *idlest_val) 81 u8 *idlest_val)
@@ -96,20 +89,16 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
96 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 89 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
97} 90}
98 91
99const struct clkops clkops_omap3430es2_dss_usbhost_wait = { 92const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
100 .enable = omap2_dflt_clk_enable,
101 .disable = omap2_dflt_clk_disable,
102 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest, 93 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
103 .find_companion = omap2_clk_dflt_find_companion, 94 .find_companion = omap2_clk_dflt_find_companion,
104}; 95};
105 96
106const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = { 97const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
107 .enable = omap2_dflt_clk_enable,
108 .disable = omap2_dflt_clk_disable,
109 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
110 .find_companion = omap2_clk_dflt_find_companion,
111 .allow_idle = omap2_clkt_iclk_allow_idle, 98 .allow_idle = omap2_clkt_iclk_allow_idle,
112 .deny_idle = omap2_clkt_iclk_deny_idle, 99 .deny_idle = omap2_clkt_iclk_deny_idle,
100 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
101 .find_companion = omap2_clk_dflt_find_companion,
113}; 102};
114 103
115/** 104/**
@@ -123,7 +112,7 @@ const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
123 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via 112 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
124 * @idlest_reg and @idlest_bit. No return value. 113 * @idlest_reg and @idlest_bit. No return value.
125 */ 114 */
126static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, 115static void omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
127 void __iomem **idlest_reg, 116 void __iomem **idlest_reg,
128 u8 *idlest_bit, 117 u8 *idlest_bit,
129 u8 *idlest_val) 118 u8 *idlest_val)
@@ -136,18 +125,14 @@ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
136 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 125 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
137} 126}
138 127
139const struct clkops clkops_omap3430es2_hsotgusb_wait = { 128const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
140 .enable = omap2_dflt_clk_enable, 129 .allow_idle = omap2_clkt_iclk_allow_idle,
141 .disable = omap2_dflt_clk_disable, 130 .deny_idle = omap2_clkt_iclk_deny_idle,
142 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, 131 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
143 .find_companion = omap2_clk_dflt_find_companion, 132 .find_companion = omap2_clk_dflt_find_companion,
144}; 133};
145 134
146const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait = { 135const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
147 .enable = omap2_dflt_clk_enable,
148 .disable = omap2_dflt_clk_disable,
149 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, 136 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
150 .find_companion = omap2_clk_dflt_find_companion, 137 .find_companion = omap2_clk_dflt_find_companion,
151 .allow_idle = omap2_clkt_iclk_allow_idle,
152 .deny_idle = omap2_clkt_iclk_deny_idle,
153}; 138};
diff --git a/arch/arm/mach-omap2/clock3517.c b/arch/arm/mach-omap2/clock3517.c
index 2e97d08f0e5..4d79ae2c024 100644
--- a/arch/arm/mach-omap2/clock3517.c
+++ b/arch/arm/mach-omap2/clock3517.c
@@ -21,11 +21,9 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "clock.h" 24#include "clock.h"
27#include "clock3517.h" 25#include "clock3517.h"
28#include "cm2xxx_3xxx.h" 26#include "cm3xxx.h"
29#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
30 28
31/* 29/*
@@ -49,7 +47,7 @@
49 * in the enable register itsel at a bit offset of 4 from the enable 47 * in the enable register itsel at a bit offset of 4 from the enable
50 * bit. A value of 1 indicates that clock is enabled. 48 * bit. A value of 1 indicates that clock is enabled.
51 */ 49 */
52static void am35xx_clk_find_idlest(struct clk *clk, 50static void am35xx_clk_find_idlest(struct clk_hw_omap *clk,
53 void __iomem **idlest_reg, 51 void __iomem **idlest_reg,
54 u8 *idlest_bit, 52 u8 *idlest_bit,
55 u8 *idlest_val) 53 u8 *idlest_val)
@@ -73,8 +71,9 @@ static void am35xx_clk_find_idlest(struct clk *clk,
73 * associate this type of code with per-module data structures to 71 * associate this type of code with per-module data structures to
74 * avoid this issue, and remove the casts. No return value. 72 * avoid this issue, and remove the casts. No return value.
75 */ 73 */
76static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg, 74static void am35xx_clk_find_companion(struct clk_hw_omap *clk,
77 u8 *other_bit) 75 void __iomem **other_reg,
76 u8 *other_bit)
78{ 77{
79 *other_reg = (__force void __iomem *)(clk->enable_reg); 78 *other_reg = (__force void __iomem *)(clk->enable_reg);
80 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK) 79 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK)
@@ -82,10 +81,7 @@ static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg,
82 else 81 else
83 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET; 82 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET;
84} 83}
85 84const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait = {
86const struct clkops clkops_am35xx_ipss_module_wait = {
87 .enable = omap2_dflt_clk_enable,
88 .disable = omap2_dflt_clk_disable,
89 .find_idlest = am35xx_clk_find_idlest, 85 .find_idlest = am35xx_clk_find_idlest,
90 .find_companion = am35xx_clk_find_companion, 86 .find_companion = am35xx_clk_find_companion,
91}; 87};
@@ -101,7 +97,7 @@ const struct clkops clkops_am35xx_ipss_module_wait = {
101 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg 97 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg
102 * and @idlest_bit. No return value. 98 * and @idlest_bit. No return value.
103 */ 99 */
104static void am35xx_clk_ipss_find_idlest(struct clk *clk, 100static void am35xx_clk_ipss_find_idlest(struct clk_hw_omap *clk,
105 void __iomem **idlest_reg, 101 void __iomem **idlest_reg,
106 u8 *idlest_bit, 102 u8 *idlest_bit,
107 u8 *idlest_val) 103 u8 *idlest_val)
@@ -114,13 +110,9 @@ static void am35xx_clk_ipss_find_idlest(struct clk *clk,
114 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 110 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
115} 111}
116 112
117const struct clkops clkops_am35xx_ipss_wait = { 113const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait = {
118 .enable = omap2_dflt_clk_enable,
119 .disable = omap2_dflt_clk_disable,
120 .find_idlest = am35xx_clk_ipss_find_idlest,
121 .find_companion = omap2_clk_dflt_find_companion,
122 .allow_idle = omap2_clkt_iclk_allow_idle, 114 .allow_idle = omap2_clkt_iclk_allow_idle,
123 .deny_idle = omap2_clkt_iclk_deny_idle, 115 .deny_idle = omap2_clkt_iclk_deny_idle,
116 .find_idlest = am35xx_clk_ipss_find_idlest,
117 .find_companion = omap2_clk_dflt_find_companion,
124}; 118};
125
126
diff --git a/arch/arm/mach-omap2/clock36xx.c b/arch/arm/mach-omap2/clock36xx.c
index 0c5e25ed887..8f3bf4e5090 100644
--- a/arch/arm/mach-omap2/clock36xx.c
+++ b/arch/arm/mach-omap2/clock36xx.c
@@ -22,8 +22,6 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/clock.h>
26
27#include "clock.h" 25#include "clock.h"
28#include "clock36xx.h" 26#include "clock36xx.h"
29 27
@@ -39,34 +37,32 @@
39 * (Any other value different from the Read value) to the 37 * (Any other value different from the Read value) to the
40 * corresponding CM_CLKSEL register will refresh the dividers. 38 * corresponding CM_CLKSEL register will refresh the dividers.
41 */ 39 */
42static int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk *clk) 40int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
43{ 41{
42 struct clk_hw_omap *parent;
43 struct clk_hw *parent_hw;
44 u32 dummy_v, orig_v, clksel_shift; 44 u32 dummy_v, orig_v, clksel_shift;
45 int ret; 45 int ret;
46 46
47 /* Clear PWRDN bit of HSDIVIDER */ 47 /* Clear PWRDN bit of HSDIVIDER */
48 ret = omap2_dflt_clk_enable(clk); 48 ret = omap2_dflt_clk_enable(clk);
49 49
50 parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
51 parent = to_clk_hw_omap(parent_hw);
52
50 /* Restore the dividers */ 53 /* Restore the dividers */
51 if (!ret) { 54 if (!ret) {
52 clksel_shift = __ffs(clk->parent->clksel_mask); 55 clksel_shift = __ffs(parent->clksel_mask);
53 orig_v = __raw_readl(clk->parent->clksel_reg); 56 orig_v = __raw_readl(parent->clksel_reg);
54 dummy_v = orig_v; 57 dummy_v = orig_v;
55 58
56 /* Write any other value different from the Read value */ 59 /* Write any other value different from the Read value */
57 dummy_v ^= (1 << clksel_shift); 60 dummy_v ^= (1 << clksel_shift);
58 __raw_writel(dummy_v, clk->parent->clksel_reg); 61 __raw_writel(dummy_v, parent->clksel_reg);
59 62
60 /* Write the original divider */ 63 /* Write the original divider */
61 __raw_writel(orig_v, clk->parent->clksel_reg); 64 __raw_writel(orig_v, parent->clksel_reg);
62 } 65 }
63 66
64 return ret; 67 return ret;
65} 68}
66
67const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore = {
68 .enable = omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
69 .disable = omap2_dflt_clk_disable,
70 .find_companion = omap2_clk_dflt_find_companion,
71 .find_idlest = omap2_clk_dflt_find_idlest,
72};
diff --git a/arch/arm/mach-omap2/clock36xx.h b/arch/arm/mach-omap2/clock36xx.h
index a7dee5bc636..945bb7f083e 100644
--- a/arch/arm/mach-omap2/clock36xx.h
+++ b/arch/arm/mach-omap2/clock36xx.h
@@ -8,6 +8,6 @@
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
10 10
11extern const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; 11extern int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *hw);
12 12
13#endif 13#endif
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 83bb01427d4..4eacab8f117 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -21,8 +21,6 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "soc.h" 24#include "soc.h"
27#include "clock.h" 25#include "clock.h"
28#include "clock3xxx.h" 26#include "clock3xxx.h"
@@ -40,8 +38,8 @@
40 38
41/* needed by omap3_core_dpll_m2_set_rate() */ 39/* needed by omap3_core_dpll_m2_set_rate() */
42struct clk *sdrc_ick_p, *arm_fck_p; 40struct clk *sdrc_ick_p, *arm_fck_p;
43 41int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
44int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) 42 unsigned long parent_rate)
45{ 43{
46 /* 44 /*
47 * According to the 12-5 CDP code from TI, "Limitation 2.5" 45 * According to the 12-5 CDP code from TI, "Limitation 2.5"
@@ -53,7 +51,7 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
53 return -EINVAL; 51 return -EINVAL;
54 } 52 }
55 53
56 return omap3_noncore_dpll_set_rate(clk, rate); 54 return omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
57} 55}
58 56
59void __init omap3_clk_lock_dpll5(void) 57void __init omap3_clk_lock_dpll5(void)
diff --git a/arch/arm/mach-omap2/clock3xxx.h b/arch/arm/mach-omap2/clock3xxx.h
index 8bbeeaf399e..8cd4b0a882a 100644
--- a/arch/arm/mach-omap2/clock3xxx.h
+++ b/arch/arm/mach-omap2/clock3xxx.h
@@ -9,8 +9,10 @@
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 *clk, unsigned long rate); 12int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
13int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate); 13 unsigned long parent_rate);
14int omap3_core_dpll_m2_set_rate(struct clk_hw *clk, unsigned long rate,
15 unsigned long parent_rate);
14void omap3_clk_lock_dpll5(void); 16void omap3_clk_lock_dpll5(void);
15 17
16extern struct clk *sdrc_ick_p; 18extern struct clk *sdrc_ick_p;
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
deleted file mode 100644
index 1f42c9d5ecf..00000000000
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ /dev/null
@@ -1,3617 +0,0 @@
1/*
2 * OMAP3 clock data
3 *
4 * Copyright (C) 2007-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander
9 * DPLL bypass clock support added by Roman Tereshonkov
10 *
11 */
12
13/*
14 * Virtual clocks are introduced as convenient tools.
15 * They are sources for other clocks and not supposed
16 * to be requested from drivers directly.
17 */
18
19#include <linux/kernel.h>
20#include <linux/clk.h>
21#include <linux/list.h>
22#include <linux/io.h>
23
24#include <plat/clkdev_omap.h>
25
26#include "soc.h"
27#include "iomap.h"
28#include "clock.h"
29#include "clock3xxx.h"
30#include "clock34xx.h"
31#include "clock36xx.h"
32#include "clock3517.h"
33#include "cm2xxx_3xxx.h"
34#include "cm-regbits-34xx.h"
35#include "prm2xxx_3xxx.h"
36#include "prm-regbits-34xx.h"
37#include "control.h"
38
39/*
40 * clocks
41 */
42
43#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
44
45/* Maximum DPLL multiplier, divider values for OMAP3 */
46#define OMAP3_MAX_DPLL_MULT 2047
47#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095
48#define OMAP3_MAX_DPLL_DIV 128
49
50/*
51 * DPLL1 supplies clock to the MPU.
52 * DPLL2 supplies clock to the IVA2.
53 * DPLL3 supplies CORE domain clocks.
54 * DPLL4 supplies peripheral clocks.
55 * DPLL5 supplies other peripheral clocks (USBHOST, USIM).
56 */
57
58/* Forward declarations for DPLL bypass clocks */
59static struct clk dpll1_fck;
60static struct clk dpll2_fck;
61
62/* PRM CLOCKS */
63
64/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */
65static struct clk omap_32k_fck = {
66 .name = "omap_32k_fck",
67 .ops = &clkops_null,
68 .rate = 32768,
69};
70
71static struct clk secure_32k_fck = {
72 .name = "secure_32k_fck",
73 .ops = &clkops_null,
74 .rate = 32768,
75};
76
77/* Virtual source clocks for osc_sys_ck */
78static struct clk virt_12m_ck = {
79 .name = "virt_12m_ck",
80 .ops = &clkops_null,
81 .rate = 12000000,
82};
83
84static struct clk virt_13m_ck = {
85 .name = "virt_13m_ck",
86 .ops = &clkops_null,
87 .rate = 13000000,
88};
89
90static struct clk virt_16_8m_ck = {
91 .name = "virt_16_8m_ck",
92 .ops = &clkops_null,
93 .rate = 16800000,
94};
95
96static struct clk virt_38_4m_ck = {
97 .name = "virt_38_4m_ck",
98 .ops = &clkops_null,
99 .rate = 38400000,
100};
101
102static const struct clksel_rate osc_sys_12m_rates[] = {
103 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
104 { .div = 0 }
105};
106
107static const struct clksel_rate osc_sys_13m_rates[] = {
108 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
109 { .div = 0 }
110};
111
112static const struct clksel_rate osc_sys_16_8m_rates[] = {
113 { .div = 1, .val = 5, .flags = RATE_IN_3430ES2PLUS_36XX },
114 { .div = 0 }
115};
116
117static const struct clksel_rate osc_sys_19_2m_rates[] = {
118 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
119 { .div = 0 }
120};
121
122static const struct clksel_rate osc_sys_26m_rates[] = {
123 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
124 { .div = 0 }
125};
126
127static const struct clksel_rate osc_sys_38_4m_rates[] = {
128 { .div = 1, .val = 4, .flags = RATE_IN_3XXX },
129 { .div = 0 }
130};
131
132static const struct clksel osc_sys_clksel[] = {
133 { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates },
134 { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates },
135 { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates },
136 { .parent = &virt_19200000_ck, .rates = osc_sys_19_2m_rates },
137 { .parent = &virt_26000000_ck, .rates = osc_sys_26m_rates },
138 { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates },
139 { .parent = NULL },
140};
141
142/* Oscillator clock */
143/* 12, 13, 16.8, 19.2, 26, or 38.4 MHz */
144static struct clk osc_sys_ck = {
145 .name = "osc_sys_ck",
146 .ops = &clkops_null,
147 .init = &omap2_init_clksel_parent,
148 .clksel_reg = OMAP3430_PRM_CLKSEL,
149 .clksel_mask = OMAP3430_SYS_CLKIN_SEL_MASK,
150 .clksel = osc_sys_clksel,
151 /* REVISIT: deal with autoextclkmode? */
152 .recalc = &omap2_clksel_recalc,
153};
154
155static const struct clksel_rate div2_rates[] = {
156 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
157 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
158 { .div = 0 }
159};
160
161static const struct clksel sys_clksel[] = {
162 { .parent = &osc_sys_ck, .rates = div2_rates },
163 { .parent = NULL }
164};
165
166/* Latency: this clock is only enabled after PRM_CLKSETUP.SETUP_TIME */
167/* Feeds DPLLs - divided first by PRM_CLKSRC_CTRL.SYSCLKDIV? */
168static struct clk sys_ck = {
169 .name = "sys_ck",
170 .ops = &clkops_null,
171 .parent = &osc_sys_ck,
172 .init = &omap2_init_clksel_parent,
173 .clksel_reg = OMAP3430_PRM_CLKSRC_CTRL,
174 .clksel_mask = OMAP_SYSCLKDIV_MASK,
175 .clksel = sys_clksel,
176 .recalc = &omap2_clksel_recalc,
177};
178
179static struct clk sys_altclk = {
180 .name = "sys_altclk",
181 .ops = &clkops_null,
182};
183
184/* Optional external clock input for some McBSPs */
185static struct clk mcbsp_clks = {
186 .name = "mcbsp_clks",
187 .ops = &clkops_null,
188};
189
190/* PRM EXTERNAL CLOCK OUTPUT */
191
192static struct clk sys_clkout1 = {
193 .name = "sys_clkout1",
194 .ops = &clkops_omap2_dflt,
195 .parent = &osc_sys_ck,
196 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
197 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
198 .recalc = &followparent_recalc,
199};
200
201/* DPLLS */
202
203/* CM CLOCKS */
204
205static const struct clksel_rate div16_dpll_rates[] = {
206 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
207 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
208 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
209 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
210 { .div = 5, .val = 5, .flags = RATE_IN_3XXX },
211 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
212 { .div = 7, .val = 7, .flags = RATE_IN_3XXX },
213 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
214 { .div = 9, .val = 9, .flags = RATE_IN_3XXX },
215 { .div = 10, .val = 10, .flags = RATE_IN_3XXX },
216 { .div = 11, .val = 11, .flags = RATE_IN_3XXX },
217 { .div = 12, .val = 12, .flags = RATE_IN_3XXX },
218 { .div = 13, .val = 13, .flags = RATE_IN_3XXX },
219 { .div = 14, .val = 14, .flags = RATE_IN_3XXX },
220 { .div = 15, .val = 15, .flags = RATE_IN_3XXX },
221 { .div = 16, .val = 16, .flags = RATE_IN_3XXX },
222 { .div = 0 }
223};
224
225static const struct clksel_rate dpll4_rates[] = {
226 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
227 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
228 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
229 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
230 { .div = 5, .val = 5, .flags = RATE_IN_3XXX },
231 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
232 { .div = 7, .val = 7, .flags = RATE_IN_3XXX },
233 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
234 { .div = 9, .val = 9, .flags = RATE_IN_3XXX },
235 { .div = 10, .val = 10, .flags = RATE_IN_3XXX },
236 { .div = 11, .val = 11, .flags = RATE_IN_3XXX },
237 { .div = 12, .val = 12, .flags = RATE_IN_3XXX },
238 { .div = 13, .val = 13, .flags = RATE_IN_3XXX },
239 { .div = 14, .val = 14, .flags = RATE_IN_3XXX },
240 { .div = 15, .val = 15, .flags = RATE_IN_3XXX },
241 { .div = 16, .val = 16, .flags = RATE_IN_3XXX },
242 { .div = 17, .val = 17, .flags = RATE_IN_36XX },
243 { .div = 18, .val = 18, .flags = RATE_IN_36XX },
244 { .div = 19, .val = 19, .flags = RATE_IN_36XX },
245 { .div = 20, .val = 20, .flags = RATE_IN_36XX },
246 { .div = 21, .val = 21, .flags = RATE_IN_36XX },
247 { .div = 22, .val = 22, .flags = RATE_IN_36XX },
248 { .div = 23, .val = 23, .flags = RATE_IN_36XX },
249 { .div = 24, .val = 24, .flags = RATE_IN_36XX },
250 { .div = 25, .val = 25, .flags = RATE_IN_36XX },
251 { .div = 26, .val = 26, .flags = RATE_IN_36XX },
252 { .div = 27, .val = 27, .flags = RATE_IN_36XX },
253 { .div = 28, .val = 28, .flags = RATE_IN_36XX },
254 { .div = 29, .val = 29, .flags = RATE_IN_36XX },
255 { .div = 30, .val = 30, .flags = RATE_IN_36XX },
256 { .div = 31, .val = 31, .flags = RATE_IN_36XX },
257 { .div = 32, .val = 32, .flags = RATE_IN_36XX },
258 { .div = 0 }
259};
260
261/* DPLL1 */
262/* MPU clock source */
263/* Type: DPLL */
264static struct dpll_data dpll1_dd = {
265 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
266 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
267 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
268 .clk_bypass = &dpll1_fck,
269 .clk_ref = &sys_ck,
270 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
271 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
272 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
273 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
274 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
275 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
276 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
277 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
278 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
279 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
280 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
281 .max_multiplier = OMAP3_MAX_DPLL_MULT,
282 .min_divider = 1,
283 .max_divider = OMAP3_MAX_DPLL_DIV,
284};
285
286static struct clk dpll1_ck = {
287 .name = "dpll1_ck",
288 .ops = &clkops_omap3_noncore_dpll_ops,
289 .parent = &sys_ck,
290 .dpll_data = &dpll1_dd,
291 .round_rate = &omap2_dpll_round_rate,
292 .set_rate = &omap3_noncore_dpll_set_rate,
293 .clkdm_name = "dpll1_clkdm",
294 .recalc = &omap3_dpll_recalc,
295};
296
297/*
298 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
299 * DPLL isn't bypassed.
300 */
301static struct clk dpll1_x2_ck = {
302 .name = "dpll1_x2_ck",
303 .ops = &clkops_null,
304 .parent = &dpll1_ck,
305 .clkdm_name = "dpll1_clkdm",
306 .recalc = &omap3_clkoutx2_recalc,
307};
308
309/* On DPLL1, unlike other DPLLs, the divider is downstream from CLKOUTX2 */
310static const struct clksel div16_dpll1_x2m2_clksel[] = {
311 { .parent = &dpll1_x2_ck, .rates = div16_dpll_rates },
312 { .parent = NULL }
313};
314
315/*
316 * Does not exist in the TRM - needed to separate the M2 divider from
317 * bypass selection in mpu_ck
318 */
319static struct clk dpll1_x2m2_ck = {
320 .name = "dpll1_x2m2_ck",
321 .ops = &clkops_null,
322 .parent = &dpll1_x2_ck,
323 .init = &omap2_init_clksel_parent,
324 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
325 .clksel_mask = OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK,
326 .clksel = div16_dpll1_x2m2_clksel,
327 .clkdm_name = "dpll1_clkdm",
328 .recalc = &omap2_clksel_recalc,
329};
330
331/* DPLL2 */
332/* IVA2 clock source */
333/* Type: DPLL */
334
335static struct dpll_data dpll2_dd = {
336 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
337 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
338 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
339 .clk_bypass = &dpll2_fck,
340 .clk_ref = &sys_ck,
341 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
342 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
343 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
344 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
345 (1 << DPLL_LOW_POWER_BYPASS),
346 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
347 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
348 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
349 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
350 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
351 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
352 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
353 .max_multiplier = OMAP3_MAX_DPLL_MULT,
354 .min_divider = 1,
355 .max_divider = OMAP3_MAX_DPLL_DIV,
356};
357
358static struct clk dpll2_ck = {
359 .name = "dpll2_ck",
360 .ops = &clkops_omap3_noncore_dpll_ops,
361 .parent = &sys_ck,
362 .dpll_data = &dpll2_dd,
363 .round_rate = &omap2_dpll_round_rate,
364 .set_rate = &omap3_noncore_dpll_set_rate,
365 .clkdm_name = "dpll2_clkdm",
366 .recalc = &omap3_dpll_recalc,
367};
368
369static const struct clksel div16_dpll2_m2x2_clksel[] = {
370 { .parent = &dpll2_ck, .rates = div16_dpll_rates },
371 { .parent = NULL }
372};
373
374/*
375 * The TRM is conflicted on whether IVA2 clock comes from DPLL2 CLKOUT
376 * or CLKOUTX2. CLKOUT seems most plausible.
377 */
378static struct clk dpll2_m2_ck = {
379 .name = "dpll2_m2_ck",
380 .ops = &clkops_null,
381 .parent = &dpll2_ck,
382 .init = &omap2_init_clksel_parent,
383 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD,
384 OMAP3430_CM_CLKSEL2_PLL),
385 .clksel_mask = OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK,
386 .clksel = div16_dpll2_m2x2_clksel,
387 .clkdm_name = "dpll2_clkdm",
388 .recalc = &omap2_clksel_recalc,
389};
390
391/*
392 * DPLL3
393 * Source clock for all interfaces and for some device fclks
394 * REVISIT: Also supports fast relock bypass - not included below
395 */
396static struct dpll_data dpll3_dd = {
397 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
398 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
399 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
400 .clk_bypass = &sys_ck,
401 .clk_ref = &sys_ck,
402 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
403 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
404 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
405 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
406 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
407 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
408 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
409 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
410 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
411 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
412 .max_multiplier = OMAP3_MAX_DPLL_MULT,
413 .min_divider = 1,
414 .max_divider = OMAP3_MAX_DPLL_DIV,
415};
416
417static struct clk dpll3_ck = {
418 .name = "dpll3_ck",
419 .ops = &clkops_omap3_core_dpll_ops,
420 .parent = &sys_ck,
421 .dpll_data = &dpll3_dd,
422 .round_rate = &omap2_dpll_round_rate,
423 .clkdm_name = "dpll3_clkdm",
424 .recalc = &omap3_dpll_recalc,
425};
426
427/*
428 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
429 * DPLL isn't bypassed
430 */
431static struct clk dpll3_x2_ck = {
432 .name = "dpll3_x2_ck",
433 .ops = &clkops_null,
434 .parent = &dpll3_ck,
435 .clkdm_name = "dpll3_clkdm",
436 .recalc = &omap3_clkoutx2_recalc,
437};
438
439static const struct clksel_rate div31_dpll3_rates[] = {
440 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
441 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
442 { .div = 3, .val = 3, .flags = RATE_IN_3430ES2PLUS_36XX },
443 { .div = 4, .val = 4, .flags = RATE_IN_3430ES2PLUS_36XX },
444 { .div = 5, .val = 5, .flags = RATE_IN_3430ES2PLUS_36XX },
445 { .div = 6, .val = 6, .flags = RATE_IN_3430ES2PLUS_36XX },
446 { .div = 7, .val = 7, .flags = RATE_IN_3430ES2PLUS_36XX },
447 { .div = 8, .val = 8, .flags = RATE_IN_3430ES2PLUS_36XX },
448 { .div = 9, .val = 9, .flags = RATE_IN_3430ES2PLUS_36XX },
449 { .div = 10, .val = 10, .flags = RATE_IN_3430ES2PLUS_36XX },
450 { .div = 11, .val = 11, .flags = RATE_IN_3430ES2PLUS_36XX },
451 { .div = 12, .val = 12, .flags = RATE_IN_3430ES2PLUS_36XX },
452 { .div = 13, .val = 13, .flags = RATE_IN_3430ES2PLUS_36XX },
453 { .div = 14, .val = 14, .flags = RATE_IN_3430ES2PLUS_36XX },
454 { .div = 15, .val = 15, .flags = RATE_IN_3430ES2PLUS_36XX },
455 { .div = 16, .val = 16, .flags = RATE_IN_3430ES2PLUS_36XX },
456 { .div = 17, .val = 17, .flags = RATE_IN_3430ES2PLUS_36XX },
457 { .div = 18, .val = 18, .flags = RATE_IN_3430ES2PLUS_36XX },
458 { .div = 19, .val = 19, .flags = RATE_IN_3430ES2PLUS_36XX },
459 { .div = 20, .val = 20, .flags = RATE_IN_3430ES2PLUS_36XX },
460 { .div = 21, .val = 21, .flags = RATE_IN_3430ES2PLUS_36XX },
461 { .div = 22, .val = 22, .flags = RATE_IN_3430ES2PLUS_36XX },
462 { .div = 23, .val = 23, .flags = RATE_IN_3430ES2PLUS_36XX },
463 { .div = 24, .val = 24, .flags = RATE_IN_3430ES2PLUS_36XX },
464 { .div = 25, .val = 25, .flags = RATE_IN_3430ES2PLUS_36XX },
465 { .div = 26, .val = 26, .flags = RATE_IN_3430ES2PLUS_36XX },
466 { .div = 27, .val = 27, .flags = RATE_IN_3430ES2PLUS_36XX },
467 { .div = 28, .val = 28, .flags = RATE_IN_3430ES2PLUS_36XX },
468 { .div = 29, .val = 29, .flags = RATE_IN_3430ES2PLUS_36XX },
469 { .div = 30, .val = 30, .flags = RATE_IN_3430ES2PLUS_36XX },
470 { .div = 31, .val = 31, .flags = RATE_IN_3430ES2PLUS_36XX },
471 { .div = 0 },
472};
473
474static const struct clksel div31_dpll3m2_clksel[] = {
475 { .parent = &dpll3_ck, .rates = div31_dpll3_rates },
476 { .parent = NULL }
477};
478
479/* DPLL3 output M2 - primary control point for CORE speed */
480static struct clk dpll3_m2_ck = {
481 .name = "dpll3_m2_ck",
482 .ops = &clkops_null,
483 .parent = &dpll3_ck,
484 .init = &omap2_init_clksel_parent,
485 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
486 .clksel_mask = OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK,
487 .clksel = div31_dpll3m2_clksel,
488 .clkdm_name = "dpll3_clkdm",
489 .round_rate = &omap2_clksel_round_rate,
490 .set_rate = &omap3_core_dpll_m2_set_rate,
491 .recalc = &omap2_clksel_recalc,
492};
493
494static struct clk core_ck = {
495 .name = "core_ck",
496 .ops = &clkops_null,
497 .parent = &dpll3_m2_ck,
498 .recalc = &followparent_recalc,
499};
500
501static struct clk dpll3_m2x2_ck = {
502 .name = "dpll3_m2x2_ck",
503 .ops = &clkops_null,
504 .parent = &dpll3_m2_ck,
505 .clkdm_name = "dpll3_clkdm",
506 .recalc = &omap3_clkoutx2_recalc,
507};
508
509/* The PWRDN bit is apparently only available on 3430ES2 and above */
510static const struct clksel div16_dpll3_clksel[] = {
511 { .parent = &dpll3_ck, .rates = div16_dpll_rates },
512 { .parent = NULL }
513};
514
515/* This virtual clock is the source for dpll3_m3x2_ck */
516static struct clk dpll3_m3_ck = {
517 .name = "dpll3_m3_ck",
518 .ops = &clkops_null,
519 .parent = &dpll3_ck,
520 .init = &omap2_init_clksel_parent,
521 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
522 .clksel_mask = OMAP3430_DIV_DPLL3_MASK,
523 .clksel = div16_dpll3_clksel,
524 .clkdm_name = "dpll3_clkdm",
525 .recalc = &omap2_clksel_recalc,
526};
527
528/* The PWRDN bit is apparently only available on 3430ES2 and above */
529static struct clk dpll3_m3x2_ck = {
530 .name = "dpll3_m3x2_ck",
531 .ops = &clkops_omap2_dflt_wait,
532 .parent = &dpll3_m3_ck,
533 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
534 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
535 .flags = INVERT_ENABLE,
536 .clkdm_name = "dpll3_clkdm",
537 .recalc = &omap3_clkoutx2_recalc,
538};
539
540static struct clk emu_core_alwon_ck = {
541 .name = "emu_core_alwon_ck",
542 .ops = &clkops_null,
543 .parent = &dpll3_m3x2_ck,
544 .clkdm_name = "dpll3_clkdm",
545 .recalc = &followparent_recalc,
546};
547
548/* DPLL4 */
549/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
550/* Type: DPLL */
551static struct dpll_data dpll4_dd;
552
553static struct dpll_data dpll4_dd_34xx __initdata = {
554 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
555 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
556 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
557 .clk_bypass = &sys_ck,
558 .clk_ref = &sys_ck,
559 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
560 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
561 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
562 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
563 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
564 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
565 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
566 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
567 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
568 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
569 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
570 .max_multiplier = OMAP3_MAX_DPLL_MULT,
571 .min_divider = 1,
572 .max_divider = OMAP3_MAX_DPLL_DIV,
573};
574
575static struct dpll_data dpll4_dd_3630 __initdata = {
576 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
577 .mult_mask = OMAP3630_PERIPH_DPLL_MULT_MASK,
578 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
579 .clk_bypass = &sys_ck,
580 .clk_ref = &sys_ck,
581 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
582 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
583 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
584 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
585 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
586 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
587 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
588 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
589 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
590 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
591 .dco_mask = OMAP3630_PERIPH_DPLL_DCO_SEL_MASK,
592 .sddiv_mask = OMAP3630_PERIPH_DPLL_SD_DIV_MASK,
593 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT,
594 .min_divider = 1,
595 .max_divider = OMAP3_MAX_DPLL_DIV,
596 .flags = DPLL_J_TYPE
597};
598
599static struct clk dpll4_ck = {
600 .name = "dpll4_ck",
601 .ops = &clkops_omap3_noncore_dpll_ops,
602 .parent = &sys_ck,
603 .dpll_data = &dpll4_dd,
604 .round_rate = &omap2_dpll_round_rate,
605 .set_rate = &omap3_dpll4_set_rate,
606 .clkdm_name = "dpll4_clkdm",
607 .recalc = &omap3_dpll_recalc,
608};
609
610/*
611 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
612 * DPLL isn't bypassed --
613 * XXX does this serve any downstream clocks?
614 */
615static struct clk dpll4_x2_ck = {
616 .name = "dpll4_x2_ck",
617 .ops = &clkops_null,
618 .parent = &dpll4_ck,
619 .clkdm_name = "dpll4_clkdm",
620 .recalc = &omap3_clkoutx2_recalc,
621};
622
623static const struct clksel dpll4_clksel[] = {
624 { .parent = &dpll4_ck, .rates = dpll4_rates },
625 { .parent = NULL }
626};
627
628/* This virtual clock is the source for dpll4_m2x2_ck */
629static struct clk dpll4_m2_ck = {
630 .name = "dpll4_m2_ck",
631 .ops = &clkops_null,
632 .parent = &dpll4_ck,
633 .init = &omap2_init_clksel_parent,
634 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
635 .clksel_mask = OMAP3630_DIV_96M_MASK,
636 .clksel = dpll4_clksel,
637 .clkdm_name = "dpll4_clkdm",
638 .recalc = &omap2_clksel_recalc,
639};
640
641/* The PWRDN bit is apparently only available on 3430ES2 and above */
642static struct clk dpll4_m2x2_ck = {
643 .name = "dpll4_m2x2_ck",
644 .ops = &clkops_omap2_dflt_wait,
645 .parent = &dpll4_m2_ck,
646 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
647 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
648 .flags = INVERT_ENABLE,
649 .clkdm_name = "dpll4_clkdm",
650 .recalc = &omap3_clkoutx2_recalc,
651};
652
653/*
654 * DPLL4 generates DPLL4_M2X2_CLK which is then routed into the PRM as
655 * PRM_96M_ALWON_(F)CLK. Two clocks then emerge from the PRM:
656 * 96M_ALWON_FCLK (called "omap_96m_alwon_fck" below) and
657 * CM_96K_(F)CLK.
658 */
659
660/* Adding 192MHz Clock node needed by SGX */
661static struct clk omap_192m_alwon_fck = {
662 .name = "omap_192m_alwon_fck",
663 .ops = &clkops_null,
664 .parent = &dpll4_m2x2_ck,
665 .recalc = &followparent_recalc,
666};
667
668static const struct clksel_rate omap_96m_alwon_fck_rates[] = {
669 { .div = 1, .val = 1, .flags = RATE_IN_36XX },
670 { .div = 2, .val = 2, .flags = RATE_IN_36XX },
671 { .div = 0 }
672};
673
674static const struct clksel omap_96m_alwon_fck_clksel[] = {
675 { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates },
676 { .parent = NULL }
677};
678
679static const struct clksel_rate omap_96m_dpll_rates[] = {
680 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
681 { .div = 0 }
682};
683
684static const struct clksel_rate omap_96m_sys_rates[] = {
685 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
686 { .div = 0 }
687};
688
689static struct clk omap_96m_alwon_fck = {
690 .name = "omap_96m_alwon_fck",
691 .ops = &clkops_null,
692 .parent = &dpll4_m2x2_ck,
693 .recalc = &followparent_recalc,
694};
695
696static struct clk omap_96m_alwon_fck_3630 = {
697 .name = "omap_96m_alwon_fck",
698 .parent = &omap_192m_alwon_fck,
699 .init = &omap2_init_clksel_parent,
700 .ops = &clkops_null,
701 .recalc = &omap2_clksel_recalc,
702 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
703 .clksel_mask = OMAP3630_CLKSEL_96M_MASK,
704 .clksel = omap_96m_alwon_fck_clksel
705};
706
707static struct clk cm_96m_fck = {
708 .name = "cm_96m_fck",
709 .ops = &clkops_null,
710 .parent = &omap_96m_alwon_fck,
711 .recalc = &followparent_recalc,
712};
713
714static const struct clksel omap_96m_fck_clksel[] = {
715 { .parent = &cm_96m_fck, .rates = omap_96m_dpll_rates },
716 { .parent = &sys_ck, .rates = omap_96m_sys_rates },
717 { .parent = NULL }
718};
719
720static struct clk omap_96m_fck = {
721 .name = "omap_96m_fck",
722 .ops = &clkops_null,
723 .parent = &sys_ck,
724 .init = &omap2_init_clksel_parent,
725 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
726 .clksel_mask = OMAP3430_SOURCE_96M_MASK,
727 .clksel = omap_96m_fck_clksel,
728 .recalc = &omap2_clksel_recalc,
729};
730
731/* This virtual clock is the source for dpll4_m3x2_ck */
732static struct clk dpll4_m3_ck = {
733 .name = "dpll4_m3_ck",
734 .ops = &clkops_null,
735 .parent = &dpll4_ck,
736 .init = &omap2_init_clksel_parent,
737 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
738 .clksel_mask = OMAP3630_CLKSEL_TV_MASK,
739 .clksel = dpll4_clksel,
740 .clkdm_name = "dpll4_clkdm",
741 .recalc = &omap2_clksel_recalc,
742};
743
744/* The PWRDN bit is apparently only available on 3430ES2 and above */
745static struct clk dpll4_m3x2_ck = {
746 .name = "dpll4_m3x2_ck",
747 .ops = &clkops_omap2_dflt_wait,
748 .parent = &dpll4_m3_ck,
749 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
750 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
751 .flags = INVERT_ENABLE,
752 .clkdm_name = "dpll4_clkdm",
753 .recalc = &omap3_clkoutx2_recalc,
754};
755
756static const struct clksel_rate omap_54m_d4m3x2_rates[] = {
757 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
758 { .div = 0 }
759};
760
761static const struct clksel_rate omap_54m_alt_rates[] = {
762 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
763 { .div = 0 }
764};
765
766static const struct clksel omap_54m_clksel[] = {
767 { .parent = &dpll4_m3x2_ck, .rates = omap_54m_d4m3x2_rates },
768 { .parent = &sys_altclk, .rates = omap_54m_alt_rates },
769 { .parent = NULL }
770};
771
772static struct clk omap_54m_fck = {
773 .name = "omap_54m_fck",
774 .ops = &clkops_null,
775 .init = &omap2_init_clksel_parent,
776 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
777 .clksel_mask = OMAP3430_SOURCE_54M_MASK,
778 .clksel = omap_54m_clksel,
779 .recalc = &omap2_clksel_recalc,
780};
781
782static const struct clksel_rate omap_48m_cm96m_rates[] = {
783 { .div = 2, .val = 0, .flags = RATE_IN_3XXX },
784 { .div = 0 }
785};
786
787static const struct clksel_rate omap_48m_alt_rates[] = {
788 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
789 { .div = 0 }
790};
791
792static const struct clksel omap_48m_clksel[] = {
793 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
794 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
795 { .parent = NULL }
796};
797
798static struct clk omap_48m_fck = {
799 .name = "omap_48m_fck",
800 .ops = &clkops_null,
801 .init = &omap2_init_clksel_parent,
802 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
803 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
804 .clksel = omap_48m_clksel,
805 .recalc = &omap2_clksel_recalc,
806};
807
808static struct clk omap_12m_fck = {
809 .name = "omap_12m_fck",
810 .ops = &clkops_null,
811 .parent = &omap_48m_fck,
812 .fixed_div = 4,
813 .recalc = &omap_fixed_divisor_recalc,
814};
815
816/* This virtual clock is the source for dpll4_m4x2_ck */
817static struct clk dpll4_m4_ck = {
818 .name = "dpll4_m4_ck",
819 .ops = &clkops_null,
820 .parent = &dpll4_ck,
821 .init = &omap2_init_clksel_parent,
822 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
823 .clksel_mask = OMAP3630_CLKSEL_DSS1_MASK,
824 .clksel = dpll4_clksel,
825 .clkdm_name = "dpll4_clkdm",
826 .recalc = &omap2_clksel_recalc,
827 .set_rate = &omap2_clksel_set_rate,
828 .round_rate = &omap2_clksel_round_rate,
829};
830
831/* The PWRDN bit is apparently only available on 3430ES2 and above */
832static struct clk dpll4_m4x2_ck = {
833 .name = "dpll4_m4x2_ck",
834 .ops = &clkops_omap2_dflt_wait,
835 .parent = &dpll4_m4_ck,
836 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
837 .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT,
838 .flags = INVERT_ENABLE,
839 .clkdm_name = "dpll4_clkdm",
840 .recalc = &omap3_clkoutx2_recalc,
841};
842
843/* This virtual clock is the source for dpll4_m5x2_ck */
844static struct clk dpll4_m5_ck = {
845 .name = "dpll4_m5_ck",
846 .ops = &clkops_null,
847 .parent = &dpll4_ck,
848 .init = &omap2_init_clksel_parent,
849 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
850 .clksel_mask = OMAP3630_CLKSEL_CAM_MASK,
851 .clksel = dpll4_clksel,
852 .clkdm_name = "dpll4_clkdm",
853 .set_rate = &omap2_clksel_set_rate,
854 .round_rate = &omap2_clksel_round_rate,
855 .recalc = &omap2_clksel_recalc,
856};
857
858/* The PWRDN bit is apparently only available on 3430ES2 and above */
859static struct clk dpll4_m5x2_ck = {
860 .name = "dpll4_m5x2_ck",
861 .ops = &clkops_omap2_dflt_wait,
862 .parent = &dpll4_m5_ck,
863 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
864 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
865 .flags = INVERT_ENABLE,
866 .clkdm_name = "dpll4_clkdm",
867 .recalc = &omap3_clkoutx2_recalc,
868};
869
870/* This virtual clock is the source for dpll4_m6x2_ck */
871static struct clk dpll4_m6_ck = {
872 .name = "dpll4_m6_ck",
873 .ops = &clkops_null,
874 .parent = &dpll4_ck,
875 .init = &omap2_init_clksel_parent,
876 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
877 .clksel_mask = OMAP3630_DIV_DPLL4_MASK,
878 .clksel = dpll4_clksel,
879 .clkdm_name = "dpll4_clkdm",
880 .recalc = &omap2_clksel_recalc,
881};
882
883/* The PWRDN bit is apparently only available on 3430ES2 and above */
884static struct clk dpll4_m6x2_ck = {
885 .name = "dpll4_m6x2_ck",
886 .ops = &clkops_omap2_dflt_wait,
887 .parent = &dpll4_m6_ck,
888 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
889 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
890 .flags = INVERT_ENABLE,
891 .clkdm_name = "dpll4_clkdm",
892 .recalc = &omap3_clkoutx2_recalc,
893};
894
895static struct clk emu_per_alwon_ck = {
896 .name = "emu_per_alwon_ck",
897 .ops = &clkops_null,
898 .parent = &dpll4_m6x2_ck,
899 .clkdm_name = "dpll4_clkdm",
900 .recalc = &followparent_recalc,
901};
902
903/* DPLL5 */
904/* Supplies 120MHz clock, USIM source clock */
905/* Type: DPLL */
906/* 3430ES2 only */
907static struct dpll_data dpll5_dd = {
908 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
909 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
910 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
911 .clk_bypass = &sys_ck,
912 .clk_ref = &sys_ck,
913 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
914 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
915 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
916 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
917 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
918 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
919 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
920 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
921 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
922 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
923 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
924 .max_multiplier = OMAP3_MAX_DPLL_MULT,
925 .min_divider = 1,
926 .max_divider = OMAP3_MAX_DPLL_DIV,
927};
928
929static struct clk dpll5_ck = {
930 .name = "dpll5_ck",
931 .ops = &clkops_omap3_noncore_dpll_ops,
932 .parent = &sys_ck,
933 .dpll_data = &dpll5_dd,
934 .round_rate = &omap2_dpll_round_rate,
935 .set_rate = &omap3_noncore_dpll_set_rate,
936 .clkdm_name = "dpll5_clkdm",
937 .recalc = &omap3_dpll_recalc,
938};
939
940static const struct clksel div16_dpll5_clksel[] = {
941 { .parent = &dpll5_ck, .rates = div16_dpll_rates },
942 { .parent = NULL }
943};
944
945static struct clk dpll5_m2_ck = {
946 .name = "dpll5_m2_ck",
947 .ops = &clkops_null,
948 .parent = &dpll5_ck,
949 .init = &omap2_init_clksel_parent,
950 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
951 .clksel_mask = OMAP3430ES2_DIV_120M_MASK,
952 .clksel = div16_dpll5_clksel,
953 .clkdm_name = "dpll5_clkdm",
954 .recalc = &omap2_clksel_recalc,
955};
956
957/* CM EXTERNAL CLOCK OUTPUTS */
958
959static const struct clksel_rate clkout2_src_core_rates[] = {
960 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
961 { .div = 0 }
962};
963
964static const struct clksel_rate clkout2_src_sys_rates[] = {
965 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
966 { .div = 0 }
967};
968
969static const struct clksel_rate clkout2_src_96m_rates[] = {
970 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
971 { .div = 0 }
972};
973
974static const struct clksel_rate clkout2_src_54m_rates[] = {
975 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
976 { .div = 0 }
977};
978
979static const struct clksel clkout2_src_clksel[] = {
980 { .parent = &core_ck, .rates = clkout2_src_core_rates },
981 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
982 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
983 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
984 { .parent = NULL }
985};
986
987static struct clk clkout2_src_ck = {
988 .name = "clkout2_src_ck",
989 .ops = &clkops_omap2_dflt,
990 .init = &omap2_init_clksel_parent,
991 .enable_reg = OMAP3430_CM_CLKOUT_CTRL,
992 .enable_bit = OMAP3430_CLKOUT2_EN_SHIFT,
993 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
994 .clksel_mask = OMAP3430_CLKOUT2SOURCE_MASK,
995 .clksel = clkout2_src_clksel,
996 .clkdm_name = "core_clkdm",
997 .recalc = &omap2_clksel_recalc,
998};
999
1000static const struct clksel_rate sys_clkout2_rates[] = {
1001 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1002 { .div = 2, .val = 1, .flags = RATE_IN_3XXX },
1003 { .div = 4, .val = 2, .flags = RATE_IN_3XXX },
1004 { .div = 8, .val = 3, .flags = RATE_IN_3XXX },
1005 { .div = 16, .val = 4, .flags = RATE_IN_3XXX },
1006 { .div = 0 },
1007};
1008
1009static const struct clksel sys_clkout2_clksel[] = {
1010 { .parent = &clkout2_src_ck, .rates = sys_clkout2_rates },
1011 { .parent = NULL },
1012};
1013
1014static struct clk sys_clkout2 = {
1015 .name = "sys_clkout2",
1016 .ops = &clkops_null,
1017 .init = &omap2_init_clksel_parent,
1018 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
1019 .clksel_mask = OMAP3430_CLKOUT2_DIV_MASK,
1020 .clksel = sys_clkout2_clksel,
1021 .recalc = &omap2_clksel_recalc,
1022 .round_rate = &omap2_clksel_round_rate,
1023 .set_rate = &omap2_clksel_set_rate
1024};
1025
1026/* CM OUTPUT CLOCKS */
1027
1028static struct clk corex2_fck = {
1029 .name = "corex2_fck",
1030 .ops = &clkops_null,
1031 .parent = &dpll3_m2x2_ck,
1032 .recalc = &followparent_recalc,
1033};
1034
1035/* DPLL power domain clock controls */
1036
1037static const struct clksel_rate div4_rates[] = {
1038 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1039 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
1040 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
1041 { .div = 0 }
1042};
1043
1044static const struct clksel div4_core_clksel[] = {
1045 { .parent = &core_ck, .rates = div4_rates },
1046 { .parent = NULL }
1047};
1048
1049/*
1050 * REVISIT: Are these in DPLL power domain or CM power domain? docs
1051 * may be inconsistent here?
1052 */
1053static struct clk dpll1_fck = {
1054 .name = "dpll1_fck",
1055 .ops = &clkops_null,
1056 .parent = &core_ck,
1057 .init = &omap2_init_clksel_parent,
1058 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
1059 .clksel_mask = OMAP3430_MPU_CLK_SRC_MASK,
1060 .clksel = div4_core_clksel,
1061 .recalc = &omap2_clksel_recalc,
1062};
1063
1064static struct clk mpu_ck = {
1065 .name = "mpu_ck",
1066 .ops = &clkops_null,
1067 .parent = &dpll1_x2m2_ck,
1068 .clkdm_name = "mpu_clkdm",
1069 .recalc = &followparent_recalc,
1070};
1071
1072/* arm_fck is divided by two when DPLL1 locked; otherwise, passthrough mpu_ck */
1073static const struct clksel_rate arm_fck_rates[] = {
1074 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1075 { .div = 2, .val = 1, .flags = RATE_IN_3XXX },
1076 { .div = 0 },
1077};
1078
1079static const struct clksel arm_fck_clksel[] = {
1080 { .parent = &mpu_ck, .rates = arm_fck_rates },
1081 { .parent = NULL }
1082};
1083
1084static struct clk arm_fck = {
1085 .name = "arm_fck",
1086 .ops = &clkops_null,
1087 .parent = &mpu_ck,
1088 .init = &omap2_init_clksel_parent,
1089 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
1090 .clksel_mask = OMAP3430_ST_MPU_CLK_MASK,
1091 .clksel = arm_fck_clksel,
1092 .clkdm_name = "mpu_clkdm",
1093 .recalc = &omap2_clksel_recalc,
1094};
1095
1096/* XXX What about neon_clkdm ? */
1097
1098/*
1099 * REVISIT: This clock is never specifically defined in the 3430 TRM,
1100 * although it is referenced - so this is a guess
1101 */
1102static struct clk emu_mpu_alwon_ck = {
1103 .name = "emu_mpu_alwon_ck",
1104 .ops = &clkops_null,
1105 .parent = &mpu_ck,
1106 .recalc = &followparent_recalc,
1107};
1108
1109static struct clk dpll2_fck = {
1110 .name = "dpll2_fck",
1111 .ops = &clkops_null,
1112 .parent = &core_ck,
1113 .init = &omap2_init_clksel_parent,
1114 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
1115 .clksel_mask = OMAP3430_IVA2_CLK_SRC_MASK,
1116 .clksel = div4_core_clksel,
1117 .recalc = &omap2_clksel_recalc,
1118};
1119
1120static struct clk iva2_ck = {
1121 .name = "iva2_ck",
1122 .ops = &clkops_omap2_dflt_wait,
1123 .parent = &dpll2_m2_ck,
1124 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1125 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1126 .clkdm_name = "iva2_clkdm",
1127 .recalc = &followparent_recalc,
1128};
1129
1130/* Common interface clocks */
1131
1132static const struct clksel div2_core_clksel[] = {
1133 { .parent = &core_ck, .rates = div2_rates },
1134 { .parent = NULL }
1135};
1136
1137static struct clk l3_ick = {
1138 .name = "l3_ick",
1139 .ops = &clkops_null,
1140 .parent = &core_ck,
1141 .init = &omap2_init_clksel_parent,
1142 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1143 .clksel_mask = OMAP3430_CLKSEL_L3_MASK,
1144 .clksel = div2_core_clksel,
1145 .clkdm_name = "core_l3_clkdm",
1146 .recalc = &omap2_clksel_recalc,
1147};
1148
1149static const struct clksel div2_l3_clksel[] = {
1150 { .parent = &l3_ick, .rates = div2_rates },
1151 { .parent = NULL }
1152};
1153
1154static struct clk l4_ick = {
1155 .name = "l4_ick",
1156 .ops = &clkops_null,
1157 .parent = &l3_ick,
1158 .init = &omap2_init_clksel_parent,
1159 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1160 .clksel_mask = OMAP3430_CLKSEL_L4_MASK,
1161 .clksel = div2_l3_clksel,
1162 .clkdm_name = "core_l4_clkdm",
1163 .recalc = &omap2_clksel_recalc,
1164
1165};
1166
1167static const struct clksel div2_l4_clksel[] = {
1168 { .parent = &l4_ick, .rates = div2_rates },
1169 { .parent = NULL }
1170};
1171
1172static struct clk rm_ick = {
1173 .name = "rm_ick",
1174 .ops = &clkops_null,
1175 .parent = &l4_ick,
1176 .init = &omap2_init_clksel_parent,
1177 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1178 .clksel_mask = OMAP3430_CLKSEL_RM_MASK,
1179 .clksel = div2_l4_clksel,
1180 .recalc = &omap2_clksel_recalc,
1181};
1182
1183/* GFX power domain */
1184
1185/* GFX clocks are in 3430ES1 only. 3430ES2 and later uses the SGX instead */
1186
1187static const struct clksel gfx_l3_clksel[] = {
1188 { .parent = &l3_ick, .rates = gfx_l3_rates },
1189 { .parent = NULL }
1190};
1191
1192/*
1193 * Virtual parent clock for gfx_l3_ick and gfx_l3_fck
1194 * This interface clock does not have a CM_AUTOIDLE bit
1195 */
1196static struct clk gfx_l3_ck = {
1197 .name = "gfx_l3_ck",
1198 .ops = &clkops_omap2_dflt_wait,
1199 .parent = &l3_ick,
1200 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1201 .enable_bit = OMAP_EN_GFX_SHIFT,
1202 .recalc = &followparent_recalc,
1203};
1204
1205static struct clk gfx_l3_fck = {
1206 .name = "gfx_l3_fck",
1207 .ops = &clkops_null,
1208 .parent = &gfx_l3_ck,
1209 .init = &omap2_init_clksel_parent,
1210 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1211 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
1212 .clksel = gfx_l3_clksel,
1213 .clkdm_name = "gfx_3430es1_clkdm",
1214 .recalc = &omap2_clksel_recalc,
1215};
1216
1217static struct clk gfx_l3_ick = {
1218 .name = "gfx_l3_ick",
1219 .ops = &clkops_null,
1220 .parent = &gfx_l3_ck,
1221 .clkdm_name = "gfx_3430es1_clkdm",
1222 .recalc = &followparent_recalc,
1223};
1224
1225static struct clk gfx_cg1_ck = {
1226 .name = "gfx_cg1_ck",
1227 .ops = &clkops_omap2_dflt_wait,
1228 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1229 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1230 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1231 .clkdm_name = "gfx_3430es1_clkdm",
1232 .recalc = &followparent_recalc,
1233};
1234
1235static struct clk gfx_cg2_ck = {
1236 .name = "gfx_cg2_ck",
1237 .ops = &clkops_omap2_dflt_wait,
1238 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1239 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1240 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1241 .clkdm_name = "gfx_3430es1_clkdm",
1242 .recalc = &followparent_recalc,
1243};
1244
1245/* SGX power domain - 3430ES2 only */
1246
1247static const struct clksel_rate sgx_core_rates[] = {
1248 { .div = 2, .val = 5, .flags = RATE_IN_36XX },
1249 { .div = 3, .val = 0, .flags = RATE_IN_3XXX },
1250 { .div = 4, .val = 1, .flags = RATE_IN_3XXX },
1251 { .div = 6, .val = 2, .flags = RATE_IN_3XXX },
1252 { .div = 0 },
1253};
1254
1255static const struct clksel_rate sgx_192m_rates[] = {
1256 { .div = 1, .val = 4, .flags = RATE_IN_36XX },
1257 { .div = 0 },
1258};
1259
1260static const struct clksel_rate sgx_corex2_rates[] = {
1261 { .div = 3, .val = 6, .flags = RATE_IN_36XX },
1262 { .div = 5, .val = 7, .flags = RATE_IN_36XX },
1263 { .div = 0 },
1264};
1265
1266static const struct clksel_rate sgx_96m_rates[] = {
1267 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
1268 { .div = 0 },
1269};
1270
1271static const struct clksel sgx_clksel[] = {
1272 { .parent = &core_ck, .rates = sgx_core_rates },
1273 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
1274 { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates },
1275 { .parent = &corex2_fck, .rates = sgx_corex2_rates },
1276 { .parent = NULL }
1277};
1278
1279static struct clk sgx_fck = {
1280 .name = "sgx_fck",
1281 .ops = &clkops_omap2_dflt_wait,
1282 .init = &omap2_init_clksel_parent,
1283 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
1284 .enable_bit = OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
1285 .clksel_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
1286 .clksel_mask = OMAP3430ES2_CLKSEL_SGX_MASK,
1287 .clksel = sgx_clksel,
1288 .clkdm_name = "sgx_clkdm",
1289 .recalc = &omap2_clksel_recalc,
1290 .set_rate = &omap2_clksel_set_rate,
1291 .round_rate = &omap2_clksel_round_rate
1292};
1293
1294/* This interface clock does not have a CM_AUTOIDLE bit */
1295static struct clk sgx_ick = {
1296 .name = "sgx_ick",
1297 .ops = &clkops_omap2_dflt_wait,
1298 .parent = &l3_ick,
1299 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
1300 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
1301 .clkdm_name = "sgx_clkdm",
1302 .recalc = &followparent_recalc,
1303};
1304
1305/* CORE power domain */
1306
1307static struct clk d2d_26m_fck = {
1308 .name = "d2d_26m_fck",
1309 .ops = &clkops_omap2_dflt_wait,
1310 .parent = &sys_ck,
1311 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1312 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
1313 .clkdm_name = "d2d_clkdm",
1314 .recalc = &followparent_recalc,
1315};
1316
1317static struct clk modem_fck = {
1318 .name = "modem_fck",
1319 .ops = &clkops_omap2_mdmclk_dflt_wait,
1320 .parent = &sys_ck,
1321 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1322 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
1323 .clkdm_name = "d2d_clkdm",
1324 .recalc = &followparent_recalc,
1325};
1326
1327static struct clk sad2d_ick = {
1328 .name = "sad2d_ick",
1329 .ops = &clkops_omap2_iclk_dflt_wait,
1330 .parent = &l3_ick,
1331 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1332 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
1333 .clkdm_name = "d2d_clkdm",
1334 .recalc = &followparent_recalc,
1335};
1336
1337static struct clk mad2d_ick = {
1338 .name = "mad2d_ick",
1339 .ops = &clkops_omap2_iclk_dflt_wait,
1340 .parent = &l3_ick,
1341 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1342 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1343 .clkdm_name = "d2d_clkdm",
1344 .recalc = &followparent_recalc,
1345};
1346
1347static const struct clksel omap343x_gpt_clksel[] = {
1348 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1349 { .parent = &sys_ck, .rates = gpt_sys_rates },
1350 { .parent = NULL}
1351};
1352
1353static struct clk gpt10_fck = {
1354 .name = "gpt10_fck",
1355 .ops = &clkops_omap2_dflt_wait,
1356 .parent = &sys_ck,
1357 .init = &omap2_init_clksel_parent,
1358 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1359 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1360 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1361 .clksel_mask = OMAP3430_CLKSEL_GPT10_MASK,
1362 .clksel = omap343x_gpt_clksel,
1363 .clkdm_name = "core_l4_clkdm",
1364 .recalc = &omap2_clksel_recalc,
1365};
1366
1367static struct clk gpt11_fck = {
1368 .name = "gpt11_fck",
1369 .ops = &clkops_omap2_dflt_wait,
1370 .parent = &sys_ck,
1371 .init = &omap2_init_clksel_parent,
1372 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1373 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1374 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1375 .clksel_mask = OMAP3430_CLKSEL_GPT11_MASK,
1376 .clksel = omap343x_gpt_clksel,
1377 .clkdm_name = "core_l4_clkdm",
1378 .recalc = &omap2_clksel_recalc,
1379};
1380
1381static struct clk cpefuse_fck = {
1382 .name = "cpefuse_fck",
1383 .ops = &clkops_omap2_dflt,
1384 .parent = &sys_ck,
1385 .clkdm_name = "core_l4_clkdm",
1386 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1387 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
1388 .recalc = &followparent_recalc,
1389};
1390
1391static struct clk ts_fck = {
1392 .name = "ts_fck",
1393 .ops = &clkops_omap2_dflt,
1394 .parent = &omap_32k_fck,
1395 .clkdm_name = "core_l4_clkdm",
1396 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1397 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
1398 .recalc = &followparent_recalc,
1399};
1400
1401static struct clk usbtll_fck = {
1402 .name = "usbtll_fck",
1403 .ops = &clkops_omap2_dflt_wait,
1404 .parent = &dpll5_m2_ck,
1405 .clkdm_name = "core_l4_clkdm",
1406 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1407 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1408 .recalc = &followparent_recalc,
1409};
1410
1411/* CORE 96M FCLK-derived clocks */
1412
1413static struct clk core_96m_fck = {
1414 .name = "core_96m_fck",
1415 .ops = &clkops_null,
1416 .parent = &omap_96m_fck,
1417 .clkdm_name = "core_l4_clkdm",
1418 .recalc = &followparent_recalc,
1419};
1420
1421static struct clk mmchs3_fck = {
1422 .name = "mmchs3_fck",
1423 .ops = &clkops_omap2_dflt_wait,
1424 .parent = &core_96m_fck,
1425 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1426 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1427 .clkdm_name = "core_l4_clkdm",
1428 .recalc = &followparent_recalc,
1429};
1430
1431static struct clk mmchs2_fck = {
1432 .name = "mmchs2_fck",
1433 .ops = &clkops_omap2_dflt_wait,
1434 .parent = &core_96m_fck,
1435 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1436 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1437 .clkdm_name = "core_l4_clkdm",
1438 .recalc = &followparent_recalc,
1439};
1440
1441static struct clk mspro_fck = {
1442 .name = "mspro_fck",
1443 .ops = &clkops_omap2_dflt_wait,
1444 .parent = &core_96m_fck,
1445 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1446 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1447 .clkdm_name = "core_l4_clkdm",
1448 .recalc = &followparent_recalc,
1449};
1450
1451static struct clk mmchs1_fck = {
1452 .name = "mmchs1_fck",
1453 .ops = &clkops_omap2_dflt_wait,
1454 .parent = &core_96m_fck,
1455 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1456 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1457 .clkdm_name = "core_l4_clkdm",
1458 .recalc = &followparent_recalc,
1459};
1460
1461static struct clk i2c3_fck = {
1462 .name = "i2c3_fck",
1463 .ops = &clkops_omap2_dflt_wait,
1464 .parent = &core_96m_fck,
1465 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1466 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1467 .clkdm_name = "core_l4_clkdm",
1468 .recalc = &followparent_recalc,
1469};
1470
1471static struct clk i2c2_fck = {
1472 .name = "i2c2_fck",
1473 .ops = &clkops_omap2_dflt_wait,
1474 .parent = &core_96m_fck,
1475 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1476 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1477 .clkdm_name = "core_l4_clkdm",
1478 .recalc = &followparent_recalc,
1479};
1480
1481static struct clk i2c1_fck = {
1482 .name = "i2c1_fck",
1483 .ops = &clkops_omap2_dflt_wait,
1484 .parent = &core_96m_fck,
1485 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1486 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1487 .clkdm_name = "core_l4_clkdm",
1488 .recalc = &followparent_recalc,
1489};
1490
1491/*
1492 * MCBSP 1 & 5 get their 96MHz clock from core_96m_fck;
1493 * MCBSP 2, 3, 4 get their 96MHz clock from per_96m_fck.
1494 */
1495static const struct clksel_rate common_mcbsp_96m_rates[] = {
1496 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1497 { .div = 0 }
1498};
1499
1500static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1501 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1502 { .div = 0 }
1503};
1504
1505static const struct clksel mcbsp_15_clksel[] = {
1506 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
1507 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1508 { .parent = NULL }
1509};
1510
1511static struct clk mcbsp5_fck = {
1512 .name = "mcbsp5_fck",
1513 .ops = &clkops_omap2_dflt_wait,
1514 .init = &omap2_init_clksel_parent,
1515 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1516 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1517 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
1518 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1519 .clksel = mcbsp_15_clksel,
1520 .clkdm_name = "core_l4_clkdm",
1521 .recalc = &omap2_clksel_recalc,
1522};
1523
1524static struct clk mcbsp1_fck = {
1525 .name = "mcbsp1_fck",
1526 .ops = &clkops_omap2_dflt_wait,
1527 .init = &omap2_init_clksel_parent,
1528 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1529 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
1530 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1531 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1532 .clksel = mcbsp_15_clksel,
1533 .clkdm_name = "core_l4_clkdm",
1534 .recalc = &omap2_clksel_recalc,
1535};
1536
1537/* CORE_48M_FCK-derived clocks */
1538
1539static struct clk core_48m_fck = {
1540 .name = "core_48m_fck",
1541 .ops = &clkops_null,
1542 .parent = &omap_48m_fck,
1543 .clkdm_name = "core_l4_clkdm",
1544 .recalc = &followparent_recalc,
1545};
1546
1547static struct clk mcspi4_fck = {
1548 .name = "mcspi4_fck",
1549 .ops = &clkops_omap2_dflt_wait,
1550 .parent = &core_48m_fck,
1551 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1552 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1553 .recalc = &followparent_recalc,
1554 .clkdm_name = "core_l4_clkdm",
1555};
1556
1557static struct clk mcspi3_fck = {
1558 .name = "mcspi3_fck",
1559 .ops = &clkops_omap2_dflt_wait,
1560 .parent = &core_48m_fck,
1561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1562 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1563 .recalc = &followparent_recalc,
1564 .clkdm_name = "core_l4_clkdm",
1565};
1566
1567static struct clk mcspi2_fck = {
1568 .name = "mcspi2_fck",
1569 .ops = &clkops_omap2_dflt_wait,
1570 .parent = &core_48m_fck,
1571 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1572 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1573 .recalc = &followparent_recalc,
1574 .clkdm_name = "core_l4_clkdm",
1575};
1576
1577static struct clk mcspi1_fck = {
1578 .name = "mcspi1_fck",
1579 .ops = &clkops_omap2_dflt_wait,
1580 .parent = &core_48m_fck,
1581 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1582 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1583 .recalc = &followparent_recalc,
1584 .clkdm_name = "core_l4_clkdm",
1585};
1586
1587static struct clk uart2_fck = {
1588 .name = "uart2_fck",
1589 .ops = &clkops_omap2_dflt_wait,
1590 .parent = &core_48m_fck,
1591 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1592 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1593 .clkdm_name = "core_l4_clkdm",
1594 .recalc = &followparent_recalc,
1595};
1596
1597static struct clk uart1_fck = {
1598 .name = "uart1_fck",
1599 .ops = &clkops_omap2_dflt_wait,
1600 .parent = &core_48m_fck,
1601 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1602 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1603 .clkdm_name = "core_l4_clkdm",
1604 .recalc = &followparent_recalc,
1605};
1606
1607static struct clk fshostusb_fck = {
1608 .name = "fshostusb_fck",
1609 .ops = &clkops_omap2_dflt_wait,
1610 .parent = &core_48m_fck,
1611 .clkdm_name = "core_l4_clkdm",
1612 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1613 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1614 .recalc = &followparent_recalc,
1615};
1616
1617/* CORE_12M_FCK based clocks */
1618
1619static struct clk core_12m_fck = {
1620 .name = "core_12m_fck",
1621 .ops = &clkops_null,
1622 .parent = &omap_12m_fck,
1623 .clkdm_name = "core_l4_clkdm",
1624 .recalc = &followparent_recalc,
1625};
1626
1627static struct clk hdq_fck = {
1628 .name = "hdq_fck",
1629 .ops = &clkops_omap2_dflt_wait,
1630 .parent = &core_12m_fck,
1631 .clkdm_name = "core_l4_clkdm",
1632 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1633 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1634 .recalc = &followparent_recalc,
1635};
1636
1637/* DPLL3-derived clock */
1638
1639static const struct clksel_rate ssi_ssr_corex2_rates[] = {
1640 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1641 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
1642 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
1643 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
1644 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
1645 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
1646 { .div = 0 }
1647};
1648
1649static const struct clksel ssi_ssr_clksel[] = {
1650 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
1651 { .parent = NULL }
1652};
1653
1654static struct clk ssi_ssr_fck_3430es1 = {
1655 .name = "ssi_ssr_fck",
1656 .ops = &clkops_omap2_dflt,
1657 .init = &omap2_init_clksel_parent,
1658 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1659 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1660 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1661 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1662 .clksel = ssi_ssr_clksel,
1663 .clkdm_name = "core_l4_clkdm",
1664 .recalc = &omap2_clksel_recalc,
1665};
1666
1667static struct clk ssi_ssr_fck_3430es2 = {
1668 .name = "ssi_ssr_fck",
1669 .ops = &clkops_omap3430es2_ssi_wait,
1670 .init = &omap2_init_clksel_parent,
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1672 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1673 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1674 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1675 .clksel = ssi_ssr_clksel,
1676 .clkdm_name = "core_l4_clkdm",
1677 .recalc = &omap2_clksel_recalc,
1678};
1679
1680static struct clk ssi_sst_fck_3430es1 = {
1681 .name = "ssi_sst_fck",
1682 .ops = &clkops_null,
1683 .parent = &ssi_ssr_fck_3430es1,
1684 .fixed_div = 2,
1685 .recalc = &omap_fixed_divisor_recalc,
1686};
1687
1688static struct clk ssi_sst_fck_3430es2 = {
1689 .name = "ssi_sst_fck",
1690 .ops = &clkops_null,
1691 .parent = &ssi_ssr_fck_3430es2,
1692 .fixed_div = 2,
1693 .recalc = &omap_fixed_divisor_recalc,
1694};
1695
1696
1697
1698/* CORE_L3_ICK based clocks */
1699
1700/*
1701 * XXX must add clk_enable/clk_disable for these if standard code won't
1702 * handle it
1703 */
1704static struct clk core_l3_ick = {
1705 .name = "core_l3_ick",
1706 .ops = &clkops_null,
1707 .parent = &l3_ick,
1708 .clkdm_name = "core_l3_clkdm",
1709 .recalc = &followparent_recalc,
1710};
1711
1712static struct clk hsotgusb_ick_3430es1 = {
1713 .name = "hsotgusb_ick",
1714 .ops = &clkops_omap2_iclk_dflt,
1715 .parent = &core_l3_ick,
1716 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1717 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1718 .clkdm_name = "core_l3_clkdm",
1719 .recalc = &followparent_recalc,
1720};
1721
1722static struct clk hsotgusb_ick_3430es2 = {
1723 .name = "hsotgusb_ick",
1724 .ops = &clkops_omap3430es2_iclk_hsotgusb_wait,
1725 .parent = &core_l3_ick,
1726 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1727 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1728 .clkdm_name = "core_l3_clkdm",
1729 .recalc = &followparent_recalc,
1730};
1731
1732/* This interface clock does not have a CM_AUTOIDLE bit */
1733static struct clk sdrc_ick = {
1734 .name = "sdrc_ick",
1735 .ops = &clkops_omap2_dflt_wait,
1736 .parent = &core_l3_ick,
1737 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1738 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
1739 .flags = ENABLE_ON_INIT,
1740 .clkdm_name = "core_l3_clkdm",
1741 .recalc = &followparent_recalc,
1742};
1743
1744static struct clk gpmc_fck = {
1745 .name = "gpmc_fck",
1746 .ops = &clkops_null,
1747 .parent = &core_l3_ick,
1748 .flags = ENABLE_ON_INIT, /* huh? */
1749 .clkdm_name = "core_l3_clkdm",
1750 .recalc = &followparent_recalc,
1751};
1752
1753/* SECURITY_L3_ICK based clocks */
1754
1755static struct clk security_l3_ick = {
1756 .name = "security_l3_ick",
1757 .ops = &clkops_null,
1758 .parent = &l3_ick,
1759 .recalc = &followparent_recalc,
1760};
1761
1762static struct clk pka_ick = {
1763 .name = "pka_ick",
1764 .ops = &clkops_omap2_iclk_dflt_wait,
1765 .parent = &security_l3_ick,
1766 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1767 .enable_bit = OMAP3430_EN_PKA_SHIFT,
1768 .recalc = &followparent_recalc,
1769};
1770
1771/* CORE_L4_ICK based clocks */
1772
1773static struct clk core_l4_ick = {
1774 .name = "core_l4_ick",
1775 .ops = &clkops_null,
1776 .parent = &l4_ick,
1777 .clkdm_name = "core_l4_clkdm",
1778 .recalc = &followparent_recalc,
1779};
1780
1781static struct clk usbtll_ick = {
1782 .name = "usbtll_ick",
1783 .ops = &clkops_omap2_iclk_dflt_wait,
1784 .parent = &core_l4_ick,
1785 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1786 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1787 .clkdm_name = "core_l4_clkdm",
1788 .recalc = &followparent_recalc,
1789};
1790
1791static struct clk mmchs3_ick = {
1792 .name = "mmchs3_ick",
1793 .ops = &clkops_omap2_iclk_dflt_wait,
1794 .parent = &core_l4_ick,
1795 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1796 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1797 .clkdm_name = "core_l4_clkdm",
1798 .recalc = &followparent_recalc,
1799};
1800
1801/* Intersystem Communication Registers - chassis mode only */
1802static struct clk icr_ick = {
1803 .name = "icr_ick",
1804 .ops = &clkops_omap2_iclk_dflt_wait,
1805 .parent = &core_l4_ick,
1806 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1807 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1808 .clkdm_name = "core_l4_clkdm",
1809 .recalc = &followparent_recalc,
1810};
1811
1812static struct clk aes2_ick = {
1813 .name = "aes2_ick",
1814 .ops = &clkops_omap2_iclk_dflt_wait,
1815 .parent = &core_l4_ick,
1816 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1817 .enable_bit = OMAP3430_EN_AES2_SHIFT,
1818 .clkdm_name = "core_l4_clkdm",
1819 .recalc = &followparent_recalc,
1820};
1821
1822static struct clk sha12_ick = {
1823 .name = "sha12_ick",
1824 .ops = &clkops_omap2_iclk_dflt_wait,
1825 .parent = &core_l4_ick,
1826 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1827 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
1828 .clkdm_name = "core_l4_clkdm",
1829 .recalc = &followparent_recalc,
1830};
1831
1832static struct clk des2_ick = {
1833 .name = "des2_ick",
1834 .ops = &clkops_omap2_iclk_dflt_wait,
1835 .parent = &core_l4_ick,
1836 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1837 .enable_bit = OMAP3430_EN_DES2_SHIFT,
1838 .clkdm_name = "core_l4_clkdm",
1839 .recalc = &followparent_recalc,
1840};
1841
1842static struct clk mmchs2_ick = {
1843 .name = "mmchs2_ick",
1844 .ops = &clkops_omap2_iclk_dflt_wait,
1845 .parent = &core_l4_ick,
1846 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1847 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1848 .clkdm_name = "core_l4_clkdm",
1849 .recalc = &followparent_recalc,
1850};
1851
1852static struct clk mmchs1_ick = {
1853 .name = "mmchs1_ick",
1854 .ops = &clkops_omap2_iclk_dflt_wait,
1855 .parent = &core_l4_ick,
1856 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1857 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1858 .clkdm_name = "core_l4_clkdm",
1859 .recalc = &followparent_recalc,
1860};
1861
1862static struct clk mspro_ick = {
1863 .name = "mspro_ick",
1864 .ops = &clkops_omap2_iclk_dflt_wait,
1865 .parent = &core_l4_ick,
1866 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1867 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1868 .clkdm_name = "core_l4_clkdm",
1869 .recalc = &followparent_recalc,
1870};
1871
1872static struct clk hdq_ick = {
1873 .name = "hdq_ick",
1874 .ops = &clkops_omap2_iclk_dflt_wait,
1875 .parent = &core_l4_ick,
1876 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1877 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1878 .clkdm_name = "core_l4_clkdm",
1879 .recalc = &followparent_recalc,
1880};
1881
1882static struct clk mcspi4_ick = {
1883 .name = "mcspi4_ick",
1884 .ops = &clkops_omap2_iclk_dflt_wait,
1885 .parent = &core_l4_ick,
1886 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1887 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1888 .clkdm_name = "core_l4_clkdm",
1889 .recalc = &followparent_recalc,
1890};
1891
1892static struct clk mcspi3_ick = {
1893 .name = "mcspi3_ick",
1894 .ops = &clkops_omap2_iclk_dflt_wait,
1895 .parent = &core_l4_ick,
1896 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1897 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1898 .clkdm_name = "core_l4_clkdm",
1899 .recalc = &followparent_recalc,
1900};
1901
1902static struct clk mcspi2_ick = {
1903 .name = "mcspi2_ick",
1904 .ops = &clkops_omap2_iclk_dflt_wait,
1905 .parent = &core_l4_ick,
1906 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1907 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1908 .clkdm_name = "core_l4_clkdm",
1909 .recalc = &followparent_recalc,
1910};
1911
1912static struct clk mcspi1_ick = {
1913 .name = "mcspi1_ick",
1914 .ops = &clkops_omap2_iclk_dflt_wait,
1915 .parent = &core_l4_ick,
1916 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1917 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1918 .clkdm_name = "core_l4_clkdm",
1919 .recalc = &followparent_recalc,
1920};
1921
1922static struct clk i2c3_ick = {
1923 .name = "i2c3_ick",
1924 .ops = &clkops_omap2_iclk_dflt_wait,
1925 .parent = &core_l4_ick,
1926 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1927 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1928 .clkdm_name = "core_l4_clkdm",
1929 .recalc = &followparent_recalc,
1930};
1931
1932static struct clk i2c2_ick = {
1933 .name = "i2c2_ick",
1934 .ops = &clkops_omap2_iclk_dflt_wait,
1935 .parent = &core_l4_ick,
1936 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1937 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1938 .clkdm_name = "core_l4_clkdm",
1939 .recalc = &followparent_recalc,
1940};
1941
1942static struct clk i2c1_ick = {
1943 .name = "i2c1_ick",
1944 .ops = &clkops_omap2_iclk_dflt_wait,
1945 .parent = &core_l4_ick,
1946 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1947 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1948 .clkdm_name = "core_l4_clkdm",
1949 .recalc = &followparent_recalc,
1950};
1951
1952static struct clk uart2_ick = {
1953 .name = "uart2_ick",
1954 .ops = &clkops_omap2_iclk_dflt_wait,
1955 .parent = &core_l4_ick,
1956 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1957 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1958 .clkdm_name = "core_l4_clkdm",
1959 .recalc = &followparent_recalc,
1960};
1961
1962static struct clk uart1_ick = {
1963 .name = "uart1_ick",
1964 .ops = &clkops_omap2_iclk_dflt_wait,
1965 .parent = &core_l4_ick,
1966 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1967 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1968 .clkdm_name = "core_l4_clkdm",
1969 .recalc = &followparent_recalc,
1970};
1971
1972static struct clk gpt11_ick = {
1973 .name = "gpt11_ick",
1974 .ops = &clkops_omap2_iclk_dflt_wait,
1975 .parent = &core_l4_ick,
1976 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1977 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1978 .clkdm_name = "core_l4_clkdm",
1979 .recalc = &followparent_recalc,
1980};
1981
1982static struct clk gpt10_ick = {
1983 .name = "gpt10_ick",
1984 .ops = &clkops_omap2_iclk_dflt_wait,
1985 .parent = &core_l4_ick,
1986 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1987 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1988 .clkdm_name = "core_l4_clkdm",
1989 .recalc = &followparent_recalc,
1990};
1991
1992static struct clk mcbsp5_ick = {
1993 .name = "mcbsp5_ick",
1994 .ops = &clkops_omap2_iclk_dflt_wait,
1995 .parent = &core_l4_ick,
1996 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1997 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1998 .clkdm_name = "core_l4_clkdm",
1999 .recalc = &followparent_recalc,
2000};
2001
2002static struct clk mcbsp1_ick = {
2003 .name = "mcbsp1_ick",
2004 .ops = &clkops_omap2_iclk_dflt_wait,
2005 .parent = &core_l4_ick,
2006 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2007 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
2008 .clkdm_name = "core_l4_clkdm",
2009 .recalc = &followparent_recalc,
2010};
2011
2012static struct clk fac_ick = {
2013 .name = "fac_ick",
2014 .ops = &clkops_omap2_iclk_dflt_wait,
2015 .parent = &core_l4_ick,
2016 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2017 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
2018 .clkdm_name = "core_l4_clkdm",
2019 .recalc = &followparent_recalc,
2020};
2021
2022static struct clk mailboxes_ick = {
2023 .name = "mailboxes_ick",
2024 .ops = &clkops_omap2_iclk_dflt_wait,
2025 .parent = &core_l4_ick,
2026 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2027 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
2028 .clkdm_name = "core_l4_clkdm",
2029 .recalc = &followparent_recalc,
2030};
2031
2032static struct clk omapctrl_ick = {
2033 .name = "omapctrl_ick",
2034 .ops = &clkops_omap2_iclk_dflt_wait,
2035 .parent = &core_l4_ick,
2036 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2037 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
2038 .flags = ENABLE_ON_INIT,
2039 .clkdm_name = "core_l4_clkdm",
2040 .recalc = &followparent_recalc,
2041};
2042
2043/* SSI_L4_ICK based clocks */
2044
2045static struct clk ssi_l4_ick = {
2046 .name = "ssi_l4_ick",
2047 .ops = &clkops_null,
2048 .parent = &l4_ick,
2049 .clkdm_name = "core_l4_clkdm",
2050 .recalc = &followparent_recalc,
2051};
2052
2053static struct clk ssi_ick_3430es1 = {
2054 .name = "ssi_ick",
2055 .ops = &clkops_omap2_iclk_dflt,
2056 .parent = &ssi_l4_ick,
2057 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2058 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2059 .clkdm_name = "core_l4_clkdm",
2060 .recalc = &followparent_recalc,
2061};
2062
2063static struct clk ssi_ick_3430es2 = {
2064 .name = "ssi_ick",
2065 .ops = &clkops_omap3430es2_iclk_ssi_wait,
2066 .parent = &ssi_l4_ick,
2067 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2068 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2069 .clkdm_name = "core_l4_clkdm",
2070 .recalc = &followparent_recalc,
2071};
2072
2073/* REVISIT: Technically the TRM claims that this is CORE_CLK based,
2074 * but l4_ick makes more sense to me */
2075
2076static const struct clksel usb_l4_clksel[] = {
2077 { .parent = &l4_ick, .rates = div2_rates },
2078 { .parent = NULL },
2079};
2080
2081static struct clk usb_l4_ick = {
2082 .name = "usb_l4_ick",
2083 .ops = &clkops_omap2_iclk_dflt_wait,
2084 .parent = &l4_ick,
2085 .init = &omap2_init_clksel_parent,
2086 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2087 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2088 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2089 .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2090 .clksel = usb_l4_clksel,
2091 .clkdm_name = "core_l4_clkdm",
2092 .recalc = &omap2_clksel_recalc,
2093};
2094
2095/* SECURITY_L4_ICK2 based clocks */
2096
2097static struct clk security_l4_ick2 = {
2098 .name = "security_l4_ick2",
2099 .ops = &clkops_null,
2100 .parent = &l4_ick,
2101 .recalc = &followparent_recalc,
2102};
2103
2104static struct clk aes1_ick = {
2105 .name = "aes1_ick",
2106 .ops = &clkops_omap2_iclk_dflt_wait,
2107 .parent = &security_l4_ick2,
2108 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2109 .enable_bit = OMAP3430_EN_AES1_SHIFT,
2110 .recalc = &followparent_recalc,
2111};
2112
2113static struct clk rng_ick = {
2114 .name = "rng_ick",
2115 .ops = &clkops_omap2_iclk_dflt_wait,
2116 .parent = &security_l4_ick2,
2117 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2118 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2119 .recalc = &followparent_recalc,
2120};
2121
2122static struct clk sha11_ick = {
2123 .name = "sha11_ick",
2124 .ops = &clkops_omap2_iclk_dflt_wait,
2125 .parent = &security_l4_ick2,
2126 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2127 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2128 .recalc = &followparent_recalc,
2129};
2130
2131static struct clk des1_ick = {
2132 .name = "des1_ick",
2133 .ops = &clkops_omap2_iclk_dflt_wait,
2134 .parent = &security_l4_ick2,
2135 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2136 .enable_bit = OMAP3430_EN_DES1_SHIFT,
2137 .recalc = &followparent_recalc,
2138};
2139
2140/* DSS */
2141static struct clk dss1_alwon_fck_3430es1 = {
2142 .name = "dss1_alwon_fck",
2143 .ops = &clkops_omap2_dflt,
2144 .parent = &dpll4_m4x2_ck,
2145 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2146 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2147 .clkdm_name = "dss_clkdm",
2148 .recalc = &followparent_recalc,
2149};
2150
2151static struct clk dss1_alwon_fck_3430es2 = {
2152 .name = "dss1_alwon_fck",
2153 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2154 .parent = &dpll4_m4x2_ck,
2155 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2156 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2157 .clkdm_name = "dss_clkdm",
2158 .recalc = &followparent_recalc,
2159};
2160
2161static struct clk dss_tv_fck = {
2162 .name = "dss_tv_fck",
2163 .ops = &clkops_omap2_dflt,
2164 .parent = &omap_54m_fck,
2165 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2166 .enable_bit = OMAP3430_EN_TV_SHIFT,
2167 .clkdm_name = "dss_clkdm",
2168 .recalc = &followparent_recalc,
2169};
2170
2171static struct clk dss_96m_fck = {
2172 .name = "dss_96m_fck",
2173 .ops = &clkops_omap2_dflt,
2174 .parent = &omap_96m_fck,
2175 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2176 .enable_bit = OMAP3430_EN_TV_SHIFT,
2177 .clkdm_name = "dss_clkdm",
2178 .recalc = &followparent_recalc,
2179};
2180
2181static struct clk dss2_alwon_fck = {
2182 .name = "dss2_alwon_fck",
2183 .ops = &clkops_omap2_dflt,
2184 .parent = &sys_ck,
2185 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2186 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
2187 .clkdm_name = "dss_clkdm",
2188 .recalc = &followparent_recalc,
2189};
2190
2191static struct clk dss_ick_3430es1 = {
2192 /* Handles both L3 and L4 clocks */
2193 .name = "dss_ick",
2194 .ops = &clkops_omap2_iclk_dflt,
2195 .parent = &l4_ick,
2196 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2197 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2198 .clkdm_name = "dss_clkdm",
2199 .recalc = &followparent_recalc,
2200};
2201
2202static struct clk dss_ick_3430es2 = {
2203 /* Handles both L3 and L4 clocks */
2204 .name = "dss_ick",
2205 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2206 .parent = &l4_ick,
2207 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2208 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2209 .clkdm_name = "dss_clkdm",
2210 .recalc = &followparent_recalc,
2211};
2212
2213/* CAM */
2214
2215static struct clk cam_mclk = {
2216 .name = "cam_mclk",
2217 .ops = &clkops_omap2_dflt,
2218 .parent = &dpll4_m5x2_ck,
2219 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2220 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2221 .clkdm_name = "cam_clkdm",
2222 .recalc = &followparent_recalc,
2223};
2224
2225static struct clk cam_ick = {
2226 /* Handles both L3 and L4 clocks */
2227 .name = "cam_ick",
2228 .ops = &clkops_omap2_iclk_dflt,
2229 .parent = &l4_ick,
2230 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
2231 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2232 .clkdm_name = "cam_clkdm",
2233 .recalc = &followparent_recalc,
2234};
2235
2236static struct clk csi2_96m_fck = {
2237 .name = "csi2_96m_fck",
2238 .ops = &clkops_omap2_dflt,
2239 .parent = &core_96m_fck,
2240 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2241 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
2242 .clkdm_name = "cam_clkdm",
2243 .recalc = &followparent_recalc,
2244};
2245
2246/* USBHOST - 3430ES2 only */
2247
2248static struct clk usbhost_120m_fck = {
2249 .name = "usbhost_120m_fck",
2250 .ops = &clkops_omap2_dflt,
2251 .parent = &dpll5_m2_ck,
2252 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2253 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2254 .clkdm_name = "usbhost_clkdm",
2255 .recalc = &followparent_recalc,
2256};
2257
2258static struct clk usbhost_48m_fck = {
2259 .name = "usbhost_48m_fck",
2260 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2261 .parent = &omap_48m_fck,
2262 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2263 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
2264 .clkdm_name = "usbhost_clkdm",
2265 .recalc = &followparent_recalc,
2266};
2267
2268static struct clk usbhost_ick = {
2269 /* Handles both L3 and L4 clocks */
2270 .name = "usbhost_ick",
2271 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2272 .parent = &l4_ick,
2273 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
2274 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
2275 .clkdm_name = "usbhost_clkdm",
2276 .recalc = &followparent_recalc,
2277};
2278
2279/* WKUP */
2280
2281static const struct clksel_rate usim_96m_rates[] = {
2282 { .div = 2, .val = 3, .flags = RATE_IN_3XXX },
2283 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2284 { .div = 8, .val = 5, .flags = RATE_IN_3XXX },
2285 { .div = 10, .val = 6, .flags = RATE_IN_3XXX },
2286 { .div = 0 },
2287};
2288
2289static const struct clksel_rate usim_120m_rates[] = {
2290 { .div = 4, .val = 7, .flags = RATE_IN_3XXX },
2291 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
2292 { .div = 16, .val = 9, .flags = RATE_IN_3XXX },
2293 { .div = 20, .val = 10, .flags = RATE_IN_3XXX },
2294 { .div = 0 },
2295};
2296
2297static const struct clksel usim_clksel[] = {
2298 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
2299 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
2300 { .parent = &sys_ck, .rates = div2_rates },
2301 { .parent = NULL },
2302};
2303
2304/* 3430ES2 only */
2305static struct clk usim_fck = {
2306 .name = "usim_fck",
2307 .ops = &clkops_omap2_dflt_wait,
2308 .init = &omap2_init_clksel_parent,
2309 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2310 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2311 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2312 .clksel_mask = OMAP3430ES2_CLKSEL_USIMOCP_MASK,
2313 .clksel = usim_clksel,
2314 .recalc = &omap2_clksel_recalc,
2315};
2316
2317/* XXX should gpt1's clksel have wkup_32k_fck as the 32k opt? */
2318static struct clk gpt1_fck = {
2319 .name = "gpt1_fck",
2320 .ops = &clkops_omap2_dflt_wait,
2321 .init = &omap2_init_clksel_parent,
2322 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2323 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2324 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2325 .clksel_mask = OMAP3430_CLKSEL_GPT1_MASK,
2326 .clksel = omap343x_gpt_clksel,
2327 .clkdm_name = "wkup_clkdm",
2328 .recalc = &omap2_clksel_recalc,
2329};
2330
2331static struct clk wkup_32k_fck = {
2332 .name = "wkup_32k_fck",
2333 .ops = &clkops_null,
2334 .parent = &omap_32k_fck,
2335 .clkdm_name = "wkup_clkdm",
2336 .recalc = &followparent_recalc,
2337};
2338
2339static struct clk gpio1_dbck = {
2340 .name = "gpio1_dbck",
2341 .ops = &clkops_omap2_dflt,
2342 .parent = &wkup_32k_fck,
2343 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2344 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2345 .clkdm_name = "wkup_clkdm",
2346 .recalc = &followparent_recalc,
2347};
2348
2349static struct clk wdt2_fck = {
2350 .name = "wdt2_fck",
2351 .ops = &clkops_omap2_dflt_wait,
2352 .parent = &wkup_32k_fck,
2353 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2354 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2355 .clkdm_name = "wkup_clkdm",
2356 .recalc = &followparent_recalc,
2357};
2358
2359static struct clk wkup_l4_ick = {
2360 .name = "wkup_l4_ick",
2361 .ops = &clkops_null,
2362 .parent = &sys_ck,
2363 .clkdm_name = "wkup_clkdm",
2364 .recalc = &followparent_recalc,
2365};
2366
2367/* 3430ES2 only */
2368/* Never specifically named in the TRM, so we have to infer a likely name */
2369static struct clk usim_ick = {
2370 .name = "usim_ick",
2371 .ops = &clkops_omap2_iclk_dflt_wait,
2372 .parent = &wkup_l4_ick,
2373 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2374 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2375 .clkdm_name = "wkup_clkdm",
2376 .recalc = &followparent_recalc,
2377};
2378
2379static struct clk wdt2_ick = {
2380 .name = "wdt2_ick",
2381 .ops = &clkops_omap2_iclk_dflt_wait,
2382 .parent = &wkup_l4_ick,
2383 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2384 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2385 .clkdm_name = "wkup_clkdm",
2386 .recalc = &followparent_recalc,
2387};
2388
2389static struct clk wdt1_ick = {
2390 .name = "wdt1_ick",
2391 .ops = &clkops_omap2_iclk_dflt_wait,
2392 .parent = &wkup_l4_ick,
2393 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2394 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
2395 .clkdm_name = "wkup_clkdm",
2396 .recalc = &followparent_recalc,
2397};
2398
2399static struct clk gpio1_ick = {
2400 .name = "gpio1_ick",
2401 .ops = &clkops_omap2_iclk_dflt_wait,
2402 .parent = &wkup_l4_ick,
2403 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2404 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2405 .clkdm_name = "wkup_clkdm",
2406 .recalc = &followparent_recalc,
2407};
2408
2409static struct clk omap_32ksync_ick = {
2410 .name = "omap_32ksync_ick",
2411 .ops = &clkops_omap2_iclk_dflt_wait,
2412 .parent = &wkup_l4_ick,
2413 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2414 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2415 .clkdm_name = "wkup_clkdm",
2416 .recalc = &followparent_recalc,
2417};
2418
2419/* XXX This clock no longer exists in 3430 TRM rev F */
2420static struct clk gpt12_ick = {
2421 .name = "gpt12_ick",
2422 .ops = &clkops_omap2_iclk_dflt_wait,
2423 .parent = &wkup_l4_ick,
2424 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2425 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
2426 .clkdm_name = "wkup_clkdm",
2427 .recalc = &followparent_recalc,
2428};
2429
2430static struct clk gpt1_ick = {
2431 .name = "gpt1_ick",
2432 .ops = &clkops_omap2_iclk_dflt_wait,
2433 .parent = &wkup_l4_ick,
2434 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2435 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2436 .clkdm_name = "wkup_clkdm",
2437 .recalc = &followparent_recalc,
2438};
2439
2440
2441
2442/* PER clock domain */
2443
2444static struct clk per_96m_fck = {
2445 .name = "per_96m_fck",
2446 .ops = &clkops_null,
2447 .parent = &omap_96m_alwon_fck,
2448 .clkdm_name = "per_clkdm",
2449 .recalc = &followparent_recalc,
2450};
2451
2452static struct clk per_48m_fck = {
2453 .name = "per_48m_fck",
2454 .ops = &clkops_null,
2455 .parent = &omap_48m_fck,
2456 .clkdm_name = "per_clkdm",
2457 .recalc = &followparent_recalc,
2458};
2459
2460static struct clk uart3_fck = {
2461 .name = "uart3_fck",
2462 .ops = &clkops_omap2_dflt_wait,
2463 .parent = &per_48m_fck,
2464 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2465 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2466 .clkdm_name = "per_clkdm",
2467 .recalc = &followparent_recalc,
2468};
2469
2470static struct clk uart4_fck = {
2471 .name = "uart4_fck",
2472 .ops = &clkops_omap2_dflt_wait,
2473 .parent = &per_48m_fck,
2474 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2475 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2476 .clkdm_name = "per_clkdm",
2477 .recalc = &followparent_recalc,
2478};
2479
2480static struct clk uart4_fck_am35xx = {
2481 .name = "uart4_fck",
2482 .ops = &clkops_omap2_dflt_wait,
2483 .parent = &core_48m_fck,
2484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2485 .enable_bit = AM35XX_EN_UART4_SHIFT,
2486 .clkdm_name = "core_l4_clkdm",
2487 .recalc = &followparent_recalc,
2488};
2489
2490static struct clk gpt2_fck = {
2491 .name = "gpt2_fck",
2492 .ops = &clkops_omap2_dflt_wait,
2493 .init = &omap2_init_clksel_parent,
2494 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2495 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2496 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2497 .clksel_mask = OMAP3430_CLKSEL_GPT2_MASK,
2498 .clksel = omap343x_gpt_clksel,
2499 .clkdm_name = "per_clkdm",
2500 .recalc = &omap2_clksel_recalc,
2501};
2502
2503static struct clk gpt3_fck = {
2504 .name = "gpt3_fck",
2505 .ops = &clkops_omap2_dflt_wait,
2506 .init = &omap2_init_clksel_parent,
2507 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2508 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2509 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2510 .clksel_mask = OMAP3430_CLKSEL_GPT3_MASK,
2511 .clksel = omap343x_gpt_clksel,
2512 .clkdm_name = "per_clkdm",
2513 .recalc = &omap2_clksel_recalc,
2514};
2515
2516static struct clk gpt4_fck = {
2517 .name = "gpt4_fck",
2518 .ops = &clkops_omap2_dflt_wait,
2519 .init = &omap2_init_clksel_parent,
2520 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2521 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2522 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2523 .clksel_mask = OMAP3430_CLKSEL_GPT4_MASK,
2524 .clksel = omap343x_gpt_clksel,
2525 .clkdm_name = "per_clkdm",
2526 .recalc = &omap2_clksel_recalc,
2527};
2528
2529static struct clk gpt5_fck = {
2530 .name = "gpt5_fck",
2531 .ops = &clkops_omap2_dflt_wait,
2532 .init = &omap2_init_clksel_parent,
2533 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2534 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2535 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2536 .clksel_mask = OMAP3430_CLKSEL_GPT5_MASK,
2537 .clksel = omap343x_gpt_clksel,
2538 .clkdm_name = "per_clkdm",
2539 .recalc = &omap2_clksel_recalc,
2540};
2541
2542static struct clk gpt6_fck = {
2543 .name = "gpt6_fck",
2544 .ops = &clkops_omap2_dflt_wait,
2545 .init = &omap2_init_clksel_parent,
2546 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2547 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2548 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2549 .clksel_mask = OMAP3430_CLKSEL_GPT6_MASK,
2550 .clksel = omap343x_gpt_clksel,
2551 .clkdm_name = "per_clkdm",
2552 .recalc = &omap2_clksel_recalc,
2553};
2554
2555static struct clk gpt7_fck = {
2556 .name = "gpt7_fck",
2557 .ops = &clkops_omap2_dflt_wait,
2558 .init = &omap2_init_clksel_parent,
2559 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2560 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2561 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2562 .clksel_mask = OMAP3430_CLKSEL_GPT7_MASK,
2563 .clksel = omap343x_gpt_clksel,
2564 .clkdm_name = "per_clkdm",
2565 .recalc = &omap2_clksel_recalc,
2566};
2567
2568static struct clk gpt8_fck = {
2569 .name = "gpt8_fck",
2570 .ops = &clkops_omap2_dflt_wait,
2571 .init = &omap2_init_clksel_parent,
2572 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2573 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2574 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2575 .clksel_mask = OMAP3430_CLKSEL_GPT8_MASK,
2576 .clksel = omap343x_gpt_clksel,
2577 .clkdm_name = "per_clkdm",
2578 .recalc = &omap2_clksel_recalc,
2579};
2580
2581static struct clk gpt9_fck = {
2582 .name = "gpt9_fck",
2583 .ops = &clkops_omap2_dflt_wait,
2584 .init = &omap2_init_clksel_parent,
2585 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2586 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2587 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2588 .clksel_mask = OMAP3430_CLKSEL_GPT9_MASK,
2589 .clksel = omap343x_gpt_clksel,
2590 .clkdm_name = "per_clkdm",
2591 .recalc = &omap2_clksel_recalc,
2592};
2593
2594static struct clk per_32k_alwon_fck = {
2595 .name = "per_32k_alwon_fck",
2596 .ops = &clkops_null,
2597 .parent = &omap_32k_fck,
2598 .clkdm_name = "per_clkdm",
2599 .recalc = &followparent_recalc,
2600};
2601
2602static struct clk gpio6_dbck = {
2603 .name = "gpio6_dbck",
2604 .ops = &clkops_omap2_dflt,
2605 .parent = &per_32k_alwon_fck,
2606 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2607 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2608 .clkdm_name = "per_clkdm",
2609 .recalc = &followparent_recalc,
2610};
2611
2612static struct clk gpio5_dbck = {
2613 .name = "gpio5_dbck",
2614 .ops = &clkops_omap2_dflt,
2615 .parent = &per_32k_alwon_fck,
2616 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2617 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2618 .clkdm_name = "per_clkdm",
2619 .recalc = &followparent_recalc,
2620};
2621
2622static struct clk gpio4_dbck = {
2623 .name = "gpio4_dbck",
2624 .ops = &clkops_omap2_dflt,
2625 .parent = &per_32k_alwon_fck,
2626 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2627 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2628 .clkdm_name = "per_clkdm",
2629 .recalc = &followparent_recalc,
2630};
2631
2632static struct clk gpio3_dbck = {
2633 .name = "gpio3_dbck",
2634 .ops = &clkops_omap2_dflt,
2635 .parent = &per_32k_alwon_fck,
2636 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2637 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2638 .clkdm_name = "per_clkdm",
2639 .recalc = &followparent_recalc,
2640};
2641
2642static struct clk gpio2_dbck = {
2643 .name = "gpio2_dbck",
2644 .ops = &clkops_omap2_dflt,
2645 .parent = &per_32k_alwon_fck,
2646 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2647 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2648 .clkdm_name = "per_clkdm",
2649 .recalc = &followparent_recalc,
2650};
2651
2652static struct clk wdt3_fck = {
2653 .name = "wdt3_fck",
2654 .ops = &clkops_omap2_dflt_wait,
2655 .parent = &per_32k_alwon_fck,
2656 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2657 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2658 .clkdm_name = "per_clkdm",
2659 .recalc = &followparent_recalc,
2660};
2661
2662static struct clk per_l4_ick = {
2663 .name = "per_l4_ick",
2664 .ops = &clkops_null,
2665 .parent = &l4_ick,
2666 .clkdm_name = "per_clkdm",
2667 .recalc = &followparent_recalc,
2668};
2669
2670static struct clk gpio6_ick = {
2671 .name = "gpio6_ick",
2672 .ops = &clkops_omap2_iclk_dflt_wait,
2673 .parent = &per_l4_ick,
2674 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2675 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2676 .clkdm_name = "per_clkdm",
2677 .recalc = &followparent_recalc,
2678};
2679
2680static struct clk gpio5_ick = {
2681 .name = "gpio5_ick",
2682 .ops = &clkops_omap2_iclk_dflt_wait,
2683 .parent = &per_l4_ick,
2684 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2685 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2686 .clkdm_name = "per_clkdm",
2687 .recalc = &followparent_recalc,
2688};
2689
2690static struct clk gpio4_ick = {
2691 .name = "gpio4_ick",
2692 .ops = &clkops_omap2_iclk_dflt_wait,
2693 .parent = &per_l4_ick,
2694 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2695 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2696 .clkdm_name = "per_clkdm",
2697 .recalc = &followparent_recalc,
2698};
2699
2700static struct clk gpio3_ick = {
2701 .name = "gpio3_ick",
2702 .ops = &clkops_omap2_iclk_dflt_wait,
2703 .parent = &per_l4_ick,
2704 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2705 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2706 .clkdm_name = "per_clkdm",
2707 .recalc = &followparent_recalc,
2708};
2709
2710static struct clk gpio2_ick = {
2711 .name = "gpio2_ick",
2712 .ops = &clkops_omap2_iclk_dflt_wait,
2713 .parent = &per_l4_ick,
2714 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2715 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2716 .clkdm_name = "per_clkdm",
2717 .recalc = &followparent_recalc,
2718};
2719
2720static struct clk wdt3_ick = {
2721 .name = "wdt3_ick",
2722 .ops = &clkops_omap2_iclk_dflt_wait,
2723 .parent = &per_l4_ick,
2724 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2725 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2726 .clkdm_name = "per_clkdm",
2727 .recalc = &followparent_recalc,
2728};
2729
2730static struct clk uart3_ick = {
2731 .name = "uart3_ick",
2732 .ops = &clkops_omap2_iclk_dflt_wait,
2733 .parent = &per_l4_ick,
2734 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2735 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2736 .clkdm_name = "per_clkdm",
2737 .recalc = &followparent_recalc,
2738};
2739
2740static struct clk uart4_ick = {
2741 .name = "uart4_ick",
2742 .ops = &clkops_omap2_iclk_dflt_wait,
2743 .parent = &per_l4_ick,
2744 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2745 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2746 .clkdm_name = "per_clkdm",
2747 .recalc = &followparent_recalc,
2748};
2749
2750static struct clk gpt9_ick = {
2751 .name = "gpt9_ick",
2752 .ops = &clkops_omap2_iclk_dflt_wait,
2753 .parent = &per_l4_ick,
2754 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2755 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2756 .clkdm_name = "per_clkdm",
2757 .recalc = &followparent_recalc,
2758};
2759
2760static struct clk gpt8_ick = {
2761 .name = "gpt8_ick",
2762 .ops = &clkops_omap2_iclk_dflt_wait,
2763 .parent = &per_l4_ick,
2764 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2765 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2766 .clkdm_name = "per_clkdm",
2767 .recalc = &followparent_recalc,
2768};
2769
2770static struct clk gpt7_ick = {
2771 .name = "gpt7_ick",
2772 .ops = &clkops_omap2_iclk_dflt_wait,
2773 .parent = &per_l4_ick,
2774 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2775 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2776 .clkdm_name = "per_clkdm",
2777 .recalc = &followparent_recalc,
2778};
2779
2780static struct clk gpt6_ick = {
2781 .name = "gpt6_ick",
2782 .ops = &clkops_omap2_iclk_dflt_wait,
2783 .parent = &per_l4_ick,
2784 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2785 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2786 .clkdm_name = "per_clkdm",
2787 .recalc = &followparent_recalc,
2788};
2789
2790static struct clk gpt5_ick = {
2791 .name = "gpt5_ick",
2792 .ops = &clkops_omap2_iclk_dflt_wait,
2793 .parent = &per_l4_ick,
2794 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2795 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2796 .clkdm_name = "per_clkdm",
2797 .recalc = &followparent_recalc,
2798};
2799
2800static struct clk gpt4_ick = {
2801 .name = "gpt4_ick",
2802 .ops = &clkops_omap2_iclk_dflt_wait,
2803 .parent = &per_l4_ick,
2804 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2805 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2806 .clkdm_name = "per_clkdm",
2807 .recalc = &followparent_recalc,
2808};
2809
2810static struct clk gpt3_ick = {
2811 .name = "gpt3_ick",
2812 .ops = &clkops_omap2_iclk_dflt_wait,
2813 .parent = &per_l4_ick,
2814 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2815 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2816 .clkdm_name = "per_clkdm",
2817 .recalc = &followparent_recalc,
2818};
2819
2820static struct clk gpt2_ick = {
2821 .name = "gpt2_ick",
2822 .ops = &clkops_omap2_iclk_dflt_wait,
2823 .parent = &per_l4_ick,
2824 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2825 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2826 .clkdm_name = "per_clkdm",
2827 .recalc = &followparent_recalc,
2828};
2829
2830static struct clk mcbsp2_ick = {
2831 .name = "mcbsp2_ick",
2832 .ops = &clkops_omap2_iclk_dflt_wait,
2833 .parent = &per_l4_ick,
2834 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2835 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2836 .clkdm_name = "per_clkdm",
2837 .recalc = &followparent_recalc,
2838};
2839
2840static struct clk mcbsp3_ick = {
2841 .name = "mcbsp3_ick",
2842 .ops = &clkops_omap2_iclk_dflt_wait,
2843 .parent = &per_l4_ick,
2844 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2845 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2846 .clkdm_name = "per_clkdm",
2847 .recalc = &followparent_recalc,
2848};
2849
2850static struct clk mcbsp4_ick = {
2851 .name = "mcbsp4_ick",
2852 .ops = &clkops_omap2_iclk_dflt_wait,
2853 .parent = &per_l4_ick,
2854 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2855 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2856 .clkdm_name = "per_clkdm",
2857 .recalc = &followparent_recalc,
2858};
2859
2860static const struct clksel mcbsp_234_clksel[] = {
2861 { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates },
2862 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2863 { .parent = NULL }
2864};
2865
2866static struct clk mcbsp2_fck = {
2867 .name = "mcbsp2_fck",
2868 .ops = &clkops_omap2_dflt_wait,
2869 .init = &omap2_init_clksel_parent,
2870 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2871 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2872 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2873 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
2874 .clksel = mcbsp_234_clksel,
2875 .clkdm_name = "per_clkdm",
2876 .recalc = &omap2_clksel_recalc,
2877};
2878
2879static struct clk mcbsp3_fck = {
2880 .name = "mcbsp3_fck",
2881 .ops = &clkops_omap2_dflt_wait,
2882 .init = &omap2_init_clksel_parent,
2883 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2884 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2885 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2886 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
2887 .clksel = mcbsp_234_clksel,
2888 .clkdm_name = "per_clkdm",
2889 .recalc = &omap2_clksel_recalc,
2890};
2891
2892static struct clk mcbsp4_fck = {
2893 .name = "mcbsp4_fck",
2894 .ops = &clkops_omap2_dflt_wait,
2895 .init = &omap2_init_clksel_parent,
2896 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2897 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2898 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2899 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
2900 .clksel = mcbsp_234_clksel,
2901 .clkdm_name = "per_clkdm",
2902 .recalc = &omap2_clksel_recalc,
2903};
2904
2905/* EMU clocks */
2906
2907/* More information: ARM Cortex-A8 Technical Reference Manual, sect 10.1 */
2908
2909static const struct clksel_rate emu_src_sys_rates[] = {
2910 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
2911 { .div = 0 },
2912};
2913
2914static const struct clksel_rate emu_src_core_rates[] = {
2915 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2916 { .div = 0 },
2917};
2918
2919static const struct clksel_rate emu_src_per_rates[] = {
2920 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
2921 { .div = 0 },
2922};
2923
2924static const struct clksel_rate emu_src_mpu_rates[] = {
2925 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
2926 { .div = 0 },
2927};
2928
2929static const struct clksel emu_src_clksel[] = {
2930 { .parent = &sys_ck, .rates = emu_src_sys_rates },
2931 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
2932 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
2933 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
2934 { .parent = NULL },
2935};
2936
2937/*
2938 * Like the clkout_src clocks, emu_src_clk is a virtual clock, existing only
2939 * to switch the source of some of the EMU clocks.
2940 * XXX Are there CLKEN bits for these EMU clks?
2941 */
2942static struct clk emu_src_ck = {
2943 .name = "emu_src_ck",
2944 .ops = &clkops_null,
2945 .init = &omap2_init_clksel_parent,
2946 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2947 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
2948 .clksel = emu_src_clksel,
2949 .clkdm_name = "emu_clkdm",
2950 .recalc = &omap2_clksel_recalc,
2951};
2952
2953static const struct clksel_rate pclk_emu_rates[] = {
2954 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2955 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2956 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2957 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
2958 { .div = 0 },
2959};
2960
2961static const struct clksel pclk_emu_clksel[] = {
2962 { .parent = &emu_src_ck, .rates = pclk_emu_rates },
2963 { .parent = NULL },
2964};
2965
2966static struct clk pclk_fck = {
2967 .name = "pclk_fck",
2968 .ops = &clkops_null,
2969 .init = &omap2_init_clksel_parent,
2970 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2971 .clksel_mask = OMAP3430_CLKSEL_PCLK_MASK,
2972 .clksel = pclk_emu_clksel,
2973 .clkdm_name = "emu_clkdm",
2974 .recalc = &omap2_clksel_recalc,
2975};
2976
2977static const struct clksel_rate pclkx2_emu_rates[] = {
2978 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2979 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2980 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2981 { .div = 0 },
2982};
2983
2984static const struct clksel pclkx2_emu_clksel[] = {
2985 { .parent = &emu_src_ck, .rates = pclkx2_emu_rates },
2986 { .parent = NULL },
2987};
2988
2989static struct clk pclkx2_fck = {
2990 .name = "pclkx2_fck",
2991 .ops = &clkops_null,
2992 .init = &omap2_init_clksel_parent,
2993 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2994 .clksel_mask = OMAP3430_CLKSEL_PCLKX2_MASK,
2995 .clksel = pclkx2_emu_clksel,
2996 .clkdm_name = "emu_clkdm",
2997 .recalc = &omap2_clksel_recalc,
2998};
2999
3000static const struct clksel atclk_emu_clksel[] = {
3001 { .parent = &emu_src_ck, .rates = div2_rates },
3002 { .parent = NULL },
3003};
3004
3005static struct clk atclk_fck = {
3006 .name = "atclk_fck",
3007 .ops = &clkops_null,
3008 .init = &omap2_init_clksel_parent,
3009 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3010 .clksel_mask = OMAP3430_CLKSEL_ATCLK_MASK,
3011 .clksel = atclk_emu_clksel,
3012 .clkdm_name = "emu_clkdm",
3013 .recalc = &omap2_clksel_recalc,
3014};
3015
3016static struct clk traceclk_src_fck = {
3017 .name = "traceclk_src_fck",
3018 .ops = &clkops_null,
3019 .init = &omap2_init_clksel_parent,
3020 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3021 .clksel_mask = OMAP3430_TRACE_MUX_CTRL_MASK,
3022 .clksel = emu_src_clksel,
3023 .clkdm_name = "emu_clkdm",
3024 .recalc = &omap2_clksel_recalc,
3025};
3026
3027static const struct clksel_rate traceclk_rates[] = {
3028 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
3029 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
3030 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
3031 { .div = 0 },
3032};
3033
3034static const struct clksel traceclk_clksel[] = {
3035 { .parent = &traceclk_src_fck, .rates = traceclk_rates },
3036 { .parent = NULL },
3037};
3038
3039static struct clk traceclk_fck = {
3040 .name = "traceclk_fck",
3041 .ops = &clkops_null,
3042 .init = &omap2_init_clksel_parent,
3043 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3044 .clksel_mask = OMAP3430_CLKSEL_TRACECLK_MASK,
3045 .clksel = traceclk_clksel,
3046 .clkdm_name = "emu_clkdm",
3047 .recalc = &omap2_clksel_recalc,
3048};
3049
3050/* SR clocks */
3051
3052/* SmartReflex fclk (VDD1) */
3053static struct clk sr1_fck = {
3054 .name = "sr1_fck",
3055 .ops = &clkops_omap2_dflt_wait,
3056 .parent = &sys_ck,
3057 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3058 .enable_bit = OMAP3430_EN_SR1_SHIFT,
3059 .clkdm_name = "wkup_clkdm",
3060 .recalc = &followparent_recalc,
3061};
3062
3063/* SmartReflex fclk (VDD2) */
3064static struct clk sr2_fck = {
3065 .name = "sr2_fck",
3066 .ops = &clkops_omap2_dflt_wait,
3067 .parent = &sys_ck,
3068 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3069 .enable_bit = OMAP3430_EN_SR2_SHIFT,
3070 .clkdm_name = "wkup_clkdm",
3071 .recalc = &followparent_recalc,
3072};
3073
3074static struct clk sr_l4_ick = {
3075 .name = "sr_l4_ick",
3076 .ops = &clkops_null, /* RMK: missing? */
3077 .parent = &l4_ick,
3078 .clkdm_name = "core_l4_clkdm",
3079 .recalc = &followparent_recalc,
3080};
3081
3082/* SECURE_32K_FCK clocks */
3083
3084static struct clk gpt12_fck = {
3085 .name = "gpt12_fck",
3086 .ops = &clkops_null,
3087 .parent = &secure_32k_fck,
3088 .clkdm_name = "wkup_clkdm",
3089 .recalc = &followparent_recalc,
3090};
3091
3092static struct clk wdt1_fck = {
3093 .name = "wdt1_fck",
3094 .ops = &clkops_null,
3095 .parent = &secure_32k_fck,
3096 .clkdm_name = "wkup_clkdm",
3097 .recalc = &followparent_recalc,
3098};
3099
3100/* Clocks for AM35XX */
3101static struct clk ipss_ick = {
3102 .name = "ipss_ick",
3103 .ops = &clkops_am35xx_ipss_wait,
3104 .parent = &core_l3_ick,
3105 .clkdm_name = "core_l3_clkdm",
3106 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
3107 .enable_bit = AM35XX_EN_IPSS_SHIFT,
3108 .recalc = &followparent_recalc,
3109};
3110
3111static struct clk emac_ick = {
3112 .name = "emac_ick",
3113 .ops = &clkops_am35xx_ipss_module_wait,
3114 .parent = &ipss_ick,
3115 .clkdm_name = "core_l3_clkdm",
3116 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3117 .enable_bit = AM35XX_CPGMAC_VBUSP_CLK_SHIFT,
3118 .recalc = &followparent_recalc,
3119};
3120
3121static struct clk rmii_ck = {
3122 .name = "rmii_ck",
3123 .ops = &clkops_null,
3124 .rate = 50000000,
3125};
3126
3127static struct clk emac_fck = {
3128 .name = "emac_fck",
3129 .ops = &clkops_omap2_dflt,
3130 .parent = &rmii_ck,
3131 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3132 .enable_bit = AM35XX_CPGMAC_FCLK_SHIFT,
3133 .recalc = &followparent_recalc,
3134};
3135
3136static struct clk hsotgusb_ick_am35xx = {
3137 .name = "hsotgusb_ick",
3138 .ops = &clkops_am35xx_ipss_module_wait,
3139 .parent = &ipss_ick,
3140 .clkdm_name = "core_l3_clkdm",
3141 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3142 .enable_bit = AM35XX_USBOTG_VBUSP_CLK_SHIFT,
3143 .recalc = &followparent_recalc,
3144};
3145
3146static struct clk hsotgusb_fck_am35xx = {
3147 .name = "hsotgusb_fck",
3148 .ops = &clkops_omap2_dflt,
3149 .parent = &sys_ck,
3150 .clkdm_name = "core_l3_clkdm",
3151 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3152 .enable_bit = AM35XX_USBOTG_FCLK_SHIFT,
3153 .recalc = &followparent_recalc,
3154};
3155
3156static struct clk hecc_ck = {
3157 .name = "hecc_ck",
3158 .ops = &clkops_am35xx_ipss_module_wait,
3159 .parent = &sys_ck,
3160 .clkdm_name = "core_l3_clkdm",
3161 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3162 .enable_bit = AM35XX_HECC_VBUSP_CLK_SHIFT,
3163 .recalc = &followparent_recalc,
3164};
3165
3166static struct clk vpfe_ick = {
3167 .name = "vpfe_ick",
3168 .ops = &clkops_am35xx_ipss_module_wait,
3169 .parent = &ipss_ick,
3170 .clkdm_name = "core_l3_clkdm",
3171 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3172 .enable_bit = AM35XX_VPFE_VBUSP_CLK_SHIFT,
3173 .recalc = &followparent_recalc,
3174};
3175
3176static struct clk pclk_ck = {
3177 .name = "pclk_ck",
3178 .ops = &clkops_null,
3179 .rate = 27000000,
3180};
3181
3182static struct clk vpfe_fck = {
3183 .name = "vpfe_fck",
3184 .ops = &clkops_omap2_dflt,
3185 .parent = &pclk_ck,
3186 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3187 .enable_bit = AM35XX_VPFE_FCLK_SHIFT,
3188 .recalc = &followparent_recalc,
3189};
3190
3191/*
3192 * The UART1/2 functional clock acts as the functional clock for
3193 * UART4. No separate fclk control available. XXX Well now we have a
3194 * uart4_fck that is apparently used as the UART4 functional clock,
3195 * but it also seems that uart1_fck or uart2_fck are still needed, at
3196 * least for UART4 softresets to complete. This really needs
3197 * clarification.
3198 */
3199static struct clk uart4_ick_am35xx = {
3200 .name = "uart4_ick",
3201 .ops = &clkops_omap2_iclk_dflt_wait,
3202 .parent = &core_l4_ick,
3203 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
3204 .enable_bit = AM35XX_EN_UART4_SHIFT,
3205 .clkdm_name = "core_l4_clkdm",
3206 .recalc = &followparent_recalc,
3207};
3208
3209static struct clk dummy_apb_pclk = {
3210 .name = "apb_pclk",
3211 .ops = &clkops_null,
3212};
3213
3214/*
3215 * clkdev
3216 */
3217
3218static struct omap_clk omap3xxx_clks[] = {
3219 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3220 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3221 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3222 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
3223 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3224 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
3225 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
3226 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
3227 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
3228 CLK("twl", "fck", &osc_sys_ck, CK_3XXX),
3229 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
3230 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
3231 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
3232 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
3233 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
3234 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_3XXX),
3235 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_3XXX),
3236 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_34XX | CK_36XX),
3237 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_34XX | CK_36XX),
3238 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_3XXX),
3239 CLK(NULL, "core_ck", &core_ck, CK_3XXX),
3240 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_3XXX),
3241 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_3XXX),
3242 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX),
3243 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX),
3244 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX),
3245 CLK(NULL, "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3246 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3247 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX),
3248 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX),
3249 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX),
3250 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX),
3251 CLK(NULL, "omap_96m_alwon_fck_3630", &omap_96m_alwon_fck_3630, CK_36XX),
3252 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX),
3253 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
3254 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX),
3255 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_3XXX),
3256 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_3XXX),
3257 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_3XXX),
3258 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_3XXX),
3259 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_3XXX),
3260 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_3XXX),
3261 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_3XXX),
3262 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_3XXX),
3263 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_3XXX),
3264 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX),
3265 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX),
3266 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX),
3267 CLK(NULL, "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3268 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3269 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3270 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3271 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_3XXX),
3272 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_3XXX),
3273 CLK(NULL, "corex2_fck", &corex2_fck, CK_3XXX),
3274 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX),
3275 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX),
3276 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX),
3277 CLK(NULL, "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3278 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3279 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX),
3280 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX),
3281 CLK(NULL, "l3_ick", &l3_ick, CK_3XXX),
3282 CLK(NULL, "l4_ick", &l4_ick, CK_3XXX),
3283 CLK(NULL, "rm_ick", &rm_ick, CK_3XXX),
3284 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
3285 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
3286 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3287 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3288 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3289 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3290 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3291 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3292 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX),
3293 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX),
3294 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_34XX | CK_36XX),
3295 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_3XXX),
3296 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_3XXX),
3297 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3298 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3299 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3300 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3301 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3302 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3303 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3304 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
3305 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX),
3306 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX),
3307 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX),
3308 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX),
3309 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX),
3310 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX),
3311 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX),
3312 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX),
3313 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX),
3314 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX),
3315 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX),
3316 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX),
3317 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX),
3318 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX),
3319 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3320 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3321 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3322 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX),
3323 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3324 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3325 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
3326 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3327 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
3328 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3329 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3330 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3331 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3332 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
3333 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
3334 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX),
3335 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX),
3336 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3337 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3338 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3339 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3340 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3341 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3342 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3343 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
3344 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX),
3345 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX),
3346 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX),
3347 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX),
3348 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX),
3349 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX),
3350 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX),
3351 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX),
3352 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX),
3353 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX),
3354 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX),
3355 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX),
3356 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX),
3357 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX),
3358 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX),
3359 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX),
3360 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX),
3361 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX),
3362 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX),
3363 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX),
3364 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX),
3365 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX),
3366 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX),
3367 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX),
3368 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX),
3369 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX),
3370 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX),
3371 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX),
3372 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX),
3373 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX),
3374 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX),
3375 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3376 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX),
3377 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX),
3378 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_34XX | CK_36XX),
3379 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
3380 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3381 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
3382 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_34XX | CK_36XX),
3383 CLK(NULL, "aes1_ick", &aes1_ick, CK_34XX | CK_36XX),
3384 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX),
3385 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX),
3386 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX),
3387 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3388 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3389 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX),
3390 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3391 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3392 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3393 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1),
3394 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3395 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3396 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
3397 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3398 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
3399 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3400 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3401 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3402 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3403 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3404 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3405 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3406 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3407 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3408 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3409 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3410 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3411 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3412 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3413 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3414 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3415 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3416 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3417 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3418 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3419 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3420 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3421 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3422 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3423 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3424 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3425 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3426 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3427 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3428 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3429 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3430 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3431 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3432 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3433 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3434 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3435 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
3436 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_3XXX),
3437 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_3XXX),
3438 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_3XXX),
3439 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_3XXX),
3440 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_3XXX),
3441 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
3442 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_3XXX),
3443 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_3XXX),
3444 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_3XXX),
3445 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_3XXX),
3446 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_3XXX),
3447 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_3XXX),
3448 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_3XXX),
3449 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_3XXX),
3450 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_3XXX),
3451 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_3XXX),
3452 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_3XXX),
3453 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3454 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3455 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3456 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3457 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3458 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3459 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
3460 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_3XXX),
3461 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_3XXX),
3462 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_3XXX),
3463 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_3XXX),
3464 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_3XXX),
3465 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3466 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3467 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3468 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3469 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3470 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3471 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3472 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3473 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3474 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3475 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3476 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3477 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
3478 CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX),
3479 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
3480 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX),
3481 CLK(NULL, "sr1_fck", &sr1_fck, CK_34XX | CK_36XX),
3482 CLK(NULL, "sr2_fck", &sr2_fck, CK_34XX | CK_36XX),
3483 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX),
3484 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX),
3485 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX),
3486 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_3XXX),
3487 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3488 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3489 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3490 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3491 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3492 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3493 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3494 CLK(NULL, "vpfe_ick", &emac_ick, CK_AM35XX),
3495 CLK(NULL, "vpfe_fck", &emac_fck, CK_AM35XX),
3496 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3497 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3498 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3499 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3500 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3501 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3502 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3503 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3504 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3505};
3506
3507
3508int __init omap3xxx_clk_init(void)
3509{
3510 struct omap_clk *c;
3511 u32 cpu_clkflg = 0;
3512
3513 if (soc_is_am35xx()) {
3514 cpu_mask = RATE_IN_34XX;
3515 cpu_clkflg = CK_AM35XX;
3516 } else if (cpu_is_omap3630()) {
3517 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3518 cpu_clkflg = CK_36XX;
3519 } else if (cpu_is_ti816x()) {
3520 cpu_mask = RATE_IN_TI816X;
3521 cpu_clkflg = CK_TI816X;
3522 } else if (soc_is_am33xx()) {
3523 cpu_mask = RATE_IN_AM33XX;
3524 } else if (cpu_is_ti814x()) {
3525 cpu_mask = RATE_IN_TI814X;
3526 } else if (cpu_is_omap34xx()) {
3527 if (omap_rev() == OMAP3430_REV_ES1_0) {
3528 cpu_mask = RATE_IN_3430ES1;
3529 cpu_clkflg = CK_3430ES1;
3530 } else {
3531 /*
3532 * Assume that anything that we haven't matched yet
3533 * has 3430ES2-type clocks.
3534 */
3535 cpu_mask = RATE_IN_3430ES2PLUS;
3536 cpu_clkflg = CK_3430ES2PLUS;
3537 }
3538 } else {
3539 WARN(1, "clock: could not identify OMAP3 variant\n");
3540 }
3541
3542 if (omap3_has_192mhz_clk())
3543 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3544
3545 if (cpu_is_omap3630()) {
3546 /*
3547 * XXX This type of dynamic rewriting of the clock tree is
3548 * deprecated and should be revised soon.
3549 *
3550 * For 3630: override clkops_omap2_dflt_wait for the
3551 * clocks affected from PWRDN reset Limitation
3552 */
3553 dpll3_m3x2_ck.ops =
3554 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3555 dpll4_m2x2_ck.ops =
3556 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3557 dpll4_m3x2_ck.ops =
3558 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3559 dpll4_m4x2_ck.ops =
3560 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3561 dpll4_m5x2_ck.ops =
3562 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3563 dpll4_m6x2_ck.ops =
3564 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3565 }
3566
3567 /*
3568 * XXX This type of dynamic rewriting of the clock tree is
3569 * deprecated and should be revised soon.
3570 */
3571 if (cpu_is_omap3630())
3572 dpll4_dd = dpll4_dd_3630;
3573 else
3574 dpll4_dd = dpll4_dd_34xx;
3575
3576 clk_init(&omap2_clk_functions);
3577
3578 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3579 c++)
3580 clk_preinit(c->lk.clk);
3581
3582 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3583 c++)
3584 if (c->cpu & cpu_clkflg) {
3585 clkdev_add(&c->lk);
3586 clk_register(c->lk.clk);
3587 omap2_init_clk_clkdm(c->lk.clk);
3588 }
3589
3590 /* Disable autoidle on all clocks; let the PM code enable it later */
3591 omap_clk_disable_autoidle_all();
3592
3593 recalculate_root_clocks();
3594
3595 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
3596 (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
3597 (core_ck.rate / 1000000), (arm_fck.rate / 1000000));
3598
3599 /*
3600 * Only enable those clocks we will need, let the drivers
3601 * enable other clocks as necessary
3602 */
3603 clk_enable_init_clocks();
3604
3605 /*
3606 * Lock DPLL5 -- here only until other device init code can
3607 * handle this
3608 */
3609 if (!cpu_is_ti81xx() && (omap_rev() >= OMAP3430_REV_ES2_0))
3610 omap3_clk_lock_dpll5();
3611
3612 /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
3613 sdrc_ick_p = clk_get(NULL, "sdrc_ick");
3614 arm_fck_p = clk_get(NULL, "arm_fck");
3615
3616 return 0;
3617}
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
deleted file mode 100644
index 6efc30c961a..00000000000
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ /dev/null
@@ -1,3402 +0,0 @@
1/*
2 * OMAP4 Clock data
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 * XXX Some of the ES1 clocks have been removed/changed; once support
22 * is added for discriminating clocks by ES level, these should be added back
23 * in.
24 */
25
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/clk.h>
29#include <linux/io.h>
30
31#include <plat/clkdev_omap.h>
32
33#include "soc.h"
34#include "iomap.h"
35#include "clock.h"
36#include "clock44xx.h"
37#include "cm1_44xx.h"
38#include "cm2_44xx.h"
39#include "cm-regbits-44xx.h"
40#include "prm44xx.h"
41#include "prm-regbits-44xx.h"
42#include "control.h"
43#include "scrm44xx.h"
44
45/* OMAP4 modulemode control */
46#define OMAP4430_MODULEMODE_HWCTRL 0
47#define OMAP4430_MODULEMODE_SWCTRL 1
48
49/* Root clocks */
50
51static struct clk extalt_clkin_ck = {
52 .name = "extalt_clkin_ck",
53 .rate = 59000000,
54 .ops = &clkops_null,
55};
56
57static struct clk pad_clks_ck = {
58 .name = "pad_clks_ck",
59 .rate = 12000000,
60 .ops = &clkops_omap2_dflt,
61 .enable_reg = OMAP4430_CM_CLKSEL_ABE,
62 .enable_bit = OMAP4430_PAD_CLKS_GATE_SHIFT,
63};
64
65static struct clk pad_slimbus_core_clks_ck = {
66 .name = "pad_slimbus_core_clks_ck",
67 .rate = 12000000,
68 .ops = &clkops_null,
69};
70
71static struct clk secure_32k_clk_src_ck = {
72 .name = "secure_32k_clk_src_ck",
73 .rate = 32768,
74 .ops = &clkops_null,
75};
76
77static struct clk slimbus_clk = {
78 .name = "slimbus_clk",
79 .rate = 12000000,
80 .ops = &clkops_omap2_dflt,
81 .enable_reg = OMAP4430_CM_CLKSEL_ABE,
82 .enable_bit = OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
83};
84
85static struct clk sys_32k_ck = {
86 .name = "sys_32k_ck",
87 .clkdm_name = "prm_clkdm",
88 .rate = 32768,
89 .ops = &clkops_null,
90};
91
92static struct clk virt_12000000_ck = {
93 .name = "virt_12000000_ck",
94 .ops = &clkops_null,
95 .rate = 12000000,
96};
97
98static struct clk virt_13000000_ck = {
99 .name = "virt_13000000_ck",
100 .ops = &clkops_null,
101 .rate = 13000000,
102};
103
104static struct clk virt_16800000_ck = {
105 .name = "virt_16800000_ck",
106 .ops = &clkops_null,
107 .rate = 16800000,
108};
109
110static struct clk virt_27000000_ck = {
111 .name = "virt_27000000_ck",
112 .ops = &clkops_null,
113 .rate = 27000000,
114};
115
116static struct clk virt_38400000_ck = {
117 .name = "virt_38400000_ck",
118 .ops = &clkops_null,
119 .rate = 38400000,
120};
121
122static const struct clksel_rate div_1_5_rates[] = {
123 { .div = 1, .val = 5, .flags = RATE_IN_4430 },
124 { .div = 0 },
125};
126
127static const struct clksel_rate div_1_6_rates[] = {
128 { .div = 1, .val = 6, .flags = RATE_IN_4430 },
129 { .div = 0 },
130};
131
132static const struct clksel_rate div_1_7_rates[] = {
133 { .div = 1, .val = 7, .flags = RATE_IN_4430 },
134 { .div = 0 },
135};
136
137static const struct clksel sys_clkin_sel[] = {
138 { .parent = &virt_12000000_ck, .rates = div_1_1_rates },
139 { .parent = &virt_13000000_ck, .rates = div_1_2_rates },
140 { .parent = &virt_16800000_ck, .rates = div_1_3_rates },
141 { .parent = &virt_19200000_ck, .rates = div_1_4_rates },
142 { .parent = &virt_26000000_ck, .rates = div_1_5_rates },
143 { .parent = &virt_27000000_ck, .rates = div_1_6_rates },
144 { .parent = &virt_38400000_ck, .rates = div_1_7_rates },
145 { .parent = NULL },
146};
147
148static struct clk sys_clkin_ck = {
149 .name = "sys_clkin_ck",
150 .rate = 38400000,
151 .clksel = sys_clkin_sel,
152 .init = &omap2_init_clksel_parent,
153 .clksel_reg = OMAP4430_CM_SYS_CLKSEL,
154 .clksel_mask = OMAP4430_SYS_CLKSEL_MASK,
155 .ops = &clkops_null,
156 .recalc = &omap2_clksel_recalc,
157};
158
159static struct clk tie_low_clock_ck = {
160 .name = "tie_low_clock_ck",
161 .rate = 0,
162 .ops = &clkops_null,
163};
164
165static struct clk utmi_phy_clkout_ck = {
166 .name = "utmi_phy_clkout_ck",
167 .rate = 60000000,
168 .ops = &clkops_null,
169};
170
171static struct clk xclk60mhsp1_ck = {
172 .name = "xclk60mhsp1_ck",
173 .rate = 60000000,
174 .ops = &clkops_null,
175};
176
177static struct clk xclk60mhsp2_ck = {
178 .name = "xclk60mhsp2_ck",
179 .rate = 60000000,
180 .ops = &clkops_null,
181};
182
183static struct clk xclk60motg_ck = {
184 .name = "xclk60motg_ck",
185 .rate = 60000000,
186 .ops = &clkops_null,
187};
188
189/* Module clocks and DPLL outputs */
190
191static const struct clksel abe_dpll_bypass_clk_mux_sel[] = {
192 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
193 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
194 { .parent = NULL },
195};
196
197static struct clk abe_dpll_bypass_clk_mux_ck = {
198 .name = "abe_dpll_bypass_clk_mux_ck",
199 .parent = &sys_clkin_ck,
200 .ops = &clkops_null,
201 .recalc = &followparent_recalc,
202};
203
204static struct clk abe_dpll_refclk_mux_ck = {
205 .name = "abe_dpll_refclk_mux_ck",
206 .parent = &sys_clkin_ck,
207 .clksel = abe_dpll_bypass_clk_mux_sel,
208 .init = &omap2_init_clksel_parent,
209 .clksel_reg = OMAP4430_CM_ABE_PLL_REF_CLKSEL,
210 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
211 .ops = &clkops_null,
212 .recalc = &omap2_clksel_recalc,
213};
214
215/* DPLL_ABE */
216static struct dpll_data dpll_abe_dd = {
217 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
218 .clk_bypass = &abe_dpll_bypass_clk_mux_ck,
219 .clk_ref = &abe_dpll_refclk_mux_ck,
220 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
221 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
222 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
223 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
224 .mult_mask = OMAP4430_DPLL_MULT_MASK,
225 .div1_mask = OMAP4430_DPLL_DIV_MASK,
226 .enable_mask = OMAP4430_DPLL_EN_MASK,
227 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
228 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
229 .max_multiplier = 2047,
230 .max_divider = 128,
231 .min_divider = 1,
232};
233
234
235static struct clk dpll_abe_ck = {
236 .name = "dpll_abe_ck",
237 .parent = &abe_dpll_refclk_mux_ck,
238 .dpll_data = &dpll_abe_dd,
239 .init = &omap2_init_dpll_parent,
240 .ops = &clkops_omap3_noncore_dpll_ops,
241 .recalc = &omap4_dpll_regm4xen_recalc,
242 .round_rate = &omap4_dpll_regm4xen_round_rate,
243 .set_rate = &omap3_noncore_dpll_set_rate,
244};
245
246static struct clk dpll_abe_x2_ck = {
247 .name = "dpll_abe_x2_ck",
248 .parent = &dpll_abe_ck,
249 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
250 .flags = CLOCK_CLKOUTX2,
251 .ops = &clkops_omap4_dpllmx_ops,
252 .recalc = &omap3_clkoutx2_recalc,
253};
254
255static const struct clksel dpll_abe_m2x2_div[] = {
256 { .parent = &dpll_abe_x2_ck, .rates = div31_1to31_rates },
257 { .parent = NULL },
258};
259
260static struct clk dpll_abe_m2x2_ck = {
261 .name = "dpll_abe_m2x2_ck",
262 .parent = &dpll_abe_x2_ck,
263 .clksel = dpll_abe_m2x2_div,
264 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
265 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
266 .ops = &clkops_omap4_dpllmx_ops,
267 .recalc = &omap2_clksel_recalc,
268 .round_rate = &omap2_clksel_round_rate,
269 .set_rate = &omap2_clksel_set_rate,
270};
271
272static struct clk abe_24m_fclk = {
273 .name = "abe_24m_fclk",
274 .parent = &dpll_abe_m2x2_ck,
275 .ops = &clkops_null,
276 .fixed_div = 8,
277 .recalc = &omap_fixed_divisor_recalc,
278};
279
280static const struct clksel_rate div3_1to4_rates[] = {
281 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
282 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
283 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
284 { .div = 0 },
285};
286
287static const struct clksel abe_clk_div[] = {
288 { .parent = &dpll_abe_m2x2_ck, .rates = div3_1to4_rates },
289 { .parent = NULL },
290};
291
292static struct clk abe_clk = {
293 .name = "abe_clk",
294 .parent = &dpll_abe_m2x2_ck,
295 .clksel = abe_clk_div,
296 .clksel_reg = OMAP4430_CM_CLKSEL_ABE,
297 .clksel_mask = OMAP4430_CLKSEL_OPP_MASK,
298 .ops = &clkops_null,
299 .recalc = &omap2_clksel_recalc,
300 .round_rate = &omap2_clksel_round_rate,
301 .set_rate = &omap2_clksel_set_rate,
302};
303
304static const struct clksel_rate div2_1to2_rates[] = {
305 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
306 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
307 { .div = 0 },
308};
309
310static const struct clksel aess_fclk_div[] = {
311 { .parent = &abe_clk, .rates = div2_1to2_rates },
312 { .parent = NULL },
313};
314
315static struct clk aess_fclk = {
316 .name = "aess_fclk",
317 .parent = &abe_clk,
318 .clksel = aess_fclk_div,
319 .clksel_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
320 .clksel_mask = OMAP4430_CLKSEL_AESS_FCLK_MASK,
321 .ops = &clkops_null,
322 .recalc = &omap2_clksel_recalc,
323 .round_rate = &omap2_clksel_round_rate,
324 .set_rate = &omap2_clksel_set_rate,
325};
326
327static struct clk dpll_abe_m3x2_ck = {
328 .name = "dpll_abe_m3x2_ck",
329 .parent = &dpll_abe_x2_ck,
330 .clksel = dpll_abe_m2x2_div,
331 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_ABE,
332 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
333 .ops = &clkops_omap4_dpllmx_ops,
334 .recalc = &omap2_clksel_recalc,
335 .round_rate = &omap2_clksel_round_rate,
336 .set_rate = &omap2_clksel_set_rate,
337};
338
339static const struct clksel core_hsd_byp_clk_mux_sel[] = {
340 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
341 { .parent = &dpll_abe_m3x2_ck, .rates = div_1_1_rates },
342 { .parent = NULL },
343};
344
345static struct clk core_hsd_byp_clk_mux_ck = {
346 .name = "core_hsd_byp_clk_mux_ck",
347 .parent = &sys_clkin_ck,
348 .clksel = core_hsd_byp_clk_mux_sel,
349 .init = &omap2_init_clksel_parent,
350 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
351 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
352 .ops = &clkops_null,
353 .recalc = &omap2_clksel_recalc,
354};
355
356/* DPLL_CORE */
357static struct dpll_data dpll_core_dd = {
358 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
359 .clk_bypass = &core_hsd_byp_clk_mux_ck,
360 .clk_ref = &sys_clkin_ck,
361 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
362 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
363 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
364 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
365 .mult_mask = OMAP4430_DPLL_MULT_MASK,
366 .div1_mask = OMAP4430_DPLL_DIV_MASK,
367 .enable_mask = OMAP4430_DPLL_EN_MASK,
368 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
369 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
370 .max_multiplier = 2047,
371 .max_divider = 128,
372 .min_divider = 1,
373};
374
375
376static struct clk dpll_core_ck = {
377 .name = "dpll_core_ck",
378 .parent = &sys_clkin_ck,
379 .dpll_data = &dpll_core_dd,
380 .init = &omap2_init_dpll_parent,
381 .ops = &clkops_omap3_core_dpll_ops,
382 .recalc = &omap3_dpll_recalc,
383};
384
385static struct clk dpll_core_x2_ck = {
386 .name = "dpll_core_x2_ck",
387 .parent = &dpll_core_ck,
388 .flags = CLOCK_CLKOUTX2,
389 .ops = &clkops_null,
390 .recalc = &omap3_clkoutx2_recalc,
391};
392
393static const struct clksel dpll_core_m6x2_div[] = {
394 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
395 { .parent = NULL },
396};
397
398static struct clk dpll_core_m6x2_ck = {
399 .name = "dpll_core_m6x2_ck",
400 .parent = &dpll_core_x2_ck,
401 .clksel = dpll_core_m6x2_div,
402 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_CORE,
403 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
404 .ops = &clkops_omap4_dpllmx_ops,
405 .recalc = &omap2_clksel_recalc,
406 .round_rate = &omap2_clksel_round_rate,
407 .set_rate = &omap2_clksel_set_rate,
408};
409
410static const struct clksel dbgclk_mux_sel[] = {
411 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
412 { .parent = &dpll_core_m6x2_ck, .rates = div_1_1_rates },
413 { .parent = NULL },
414};
415
416static struct clk dbgclk_mux_ck = {
417 .name = "dbgclk_mux_ck",
418 .parent = &sys_clkin_ck,
419 .ops = &clkops_null,
420 .recalc = &followparent_recalc,
421};
422
423static const struct clksel dpll_core_m2_div[] = {
424 { .parent = &dpll_core_ck, .rates = div31_1to31_rates },
425 { .parent = NULL },
426};
427
428static struct clk dpll_core_m2_ck = {
429 .name = "dpll_core_m2_ck",
430 .parent = &dpll_core_ck,
431 .clksel = dpll_core_m2_div,
432 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_CORE,
433 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
434 .ops = &clkops_omap4_dpllmx_ops,
435 .recalc = &omap2_clksel_recalc,
436 .round_rate = &omap2_clksel_round_rate,
437 .set_rate = &omap2_clksel_set_rate,
438};
439
440static struct clk ddrphy_ck = {
441 .name = "ddrphy_ck",
442 .parent = &dpll_core_m2_ck,
443 .ops = &clkops_null,
444 .clkdm_name = "l3_emif_clkdm",
445 .fixed_div = 2,
446 .recalc = &omap_fixed_divisor_recalc,
447};
448
449static struct clk dpll_core_m5x2_ck = {
450 .name = "dpll_core_m5x2_ck",
451 .parent = &dpll_core_x2_ck,
452 .clksel = dpll_core_m6x2_div,
453 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_CORE,
454 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
455 .ops = &clkops_omap4_dpllmx_ops,
456 .recalc = &omap2_clksel_recalc,
457 .round_rate = &omap2_clksel_round_rate,
458 .set_rate = &omap2_clksel_set_rate,
459};
460
461static const struct clksel div_core_div[] = {
462 { .parent = &dpll_core_m5x2_ck, .rates = div2_1to2_rates },
463 { .parent = NULL },
464};
465
466static struct clk div_core_ck = {
467 .name = "div_core_ck",
468 .parent = &dpll_core_m5x2_ck,
469 .clksel = div_core_div,
470 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
471 .clksel_mask = OMAP4430_CLKSEL_CORE_MASK,
472 .ops = &clkops_null,
473 .recalc = &omap2_clksel_recalc,
474 .round_rate = &omap2_clksel_round_rate,
475 .set_rate = &omap2_clksel_set_rate,
476};
477
478static const struct clksel_rate div4_1to8_rates[] = {
479 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
480 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
481 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
482 { .div = 8, .val = 3, .flags = RATE_IN_4430 },
483 { .div = 0 },
484};
485
486static const struct clksel div_iva_hs_clk_div[] = {
487 { .parent = &dpll_core_m5x2_ck, .rates = div4_1to8_rates },
488 { .parent = NULL },
489};
490
491static struct clk div_iva_hs_clk = {
492 .name = "div_iva_hs_clk",
493 .parent = &dpll_core_m5x2_ck,
494 .clksel = div_iva_hs_clk_div,
495 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_IVA,
496 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
497 .ops = &clkops_null,
498 .recalc = &omap2_clksel_recalc,
499 .round_rate = &omap2_clksel_round_rate,
500 .set_rate = &omap2_clksel_set_rate,
501};
502
503static struct clk div_mpu_hs_clk = {
504 .name = "div_mpu_hs_clk",
505 .parent = &dpll_core_m5x2_ck,
506 .clksel = div_iva_hs_clk_div,
507 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_MPU,
508 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
509 .ops = &clkops_null,
510 .recalc = &omap2_clksel_recalc,
511 .round_rate = &omap2_clksel_round_rate,
512 .set_rate = &omap2_clksel_set_rate,
513};
514
515static struct clk dpll_core_m4x2_ck = {
516 .name = "dpll_core_m4x2_ck",
517 .parent = &dpll_core_x2_ck,
518 .clksel = dpll_core_m6x2_div,
519 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_CORE,
520 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
521 .ops = &clkops_omap4_dpllmx_ops,
522 .recalc = &omap2_clksel_recalc,
523 .round_rate = &omap2_clksel_round_rate,
524 .set_rate = &omap2_clksel_set_rate,
525};
526
527static struct clk dll_clk_div_ck = {
528 .name = "dll_clk_div_ck",
529 .parent = &dpll_core_m4x2_ck,
530 .ops = &clkops_null,
531 .fixed_div = 2,
532 .recalc = &omap_fixed_divisor_recalc,
533};
534
535static const struct clksel dpll_abe_m2_div[] = {
536 { .parent = &dpll_abe_ck, .rates = div31_1to31_rates },
537 { .parent = NULL },
538};
539
540static struct clk dpll_abe_m2_ck = {
541 .name = "dpll_abe_m2_ck",
542 .parent = &dpll_abe_ck,
543 .clksel = dpll_abe_m2_div,
544 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
545 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
546 .ops = &clkops_omap4_dpllmx_ops,
547 .recalc = &omap2_clksel_recalc,
548 .round_rate = &omap2_clksel_round_rate,
549 .set_rate = &omap2_clksel_set_rate,
550};
551
552static struct clk dpll_core_m3x2_ck = {
553 .name = "dpll_core_m3x2_ck",
554 .parent = &dpll_core_x2_ck,
555 .clksel = dpll_core_m6x2_div,
556 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_CORE,
557 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
558 .ops = &clkops_omap2_dflt,
559 .recalc = &omap2_clksel_recalc,
560 .round_rate = &omap2_clksel_round_rate,
561 .set_rate = &omap2_clksel_set_rate,
562 .enable_reg = OMAP4430_CM_DIV_M3_DPLL_CORE,
563 .enable_bit = OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT,
564};
565
566static struct clk dpll_core_m7x2_ck = {
567 .name = "dpll_core_m7x2_ck",
568 .parent = &dpll_core_x2_ck,
569 .clksel = dpll_core_m6x2_div,
570 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_CORE,
571 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
572 .ops = &clkops_omap4_dpllmx_ops,
573 .recalc = &omap2_clksel_recalc,
574 .round_rate = &omap2_clksel_round_rate,
575 .set_rate = &omap2_clksel_set_rate,
576};
577
578static const struct clksel iva_hsd_byp_clk_mux_sel[] = {
579 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
580 { .parent = &div_iva_hs_clk, .rates = div_1_1_rates },
581 { .parent = NULL },
582};
583
584static struct clk iva_hsd_byp_clk_mux_ck = {
585 .name = "iva_hsd_byp_clk_mux_ck",
586 .parent = &sys_clkin_ck,
587 .clksel = iva_hsd_byp_clk_mux_sel,
588 .init = &omap2_init_clksel_parent,
589 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
590 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
591 .ops = &clkops_null,
592 .recalc = &omap2_clksel_recalc,
593};
594
595/* DPLL_IVA */
596static struct dpll_data dpll_iva_dd = {
597 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
598 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
599 .clk_ref = &sys_clkin_ck,
600 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
601 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
602 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
603 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
604 .mult_mask = OMAP4430_DPLL_MULT_MASK,
605 .div1_mask = OMAP4430_DPLL_DIV_MASK,
606 .enable_mask = OMAP4430_DPLL_EN_MASK,
607 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
608 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
609 .max_multiplier = 2047,
610 .max_divider = 128,
611 .min_divider = 1,
612};
613
614
615static struct clk dpll_iva_ck = {
616 .name = "dpll_iva_ck",
617 .parent = &sys_clkin_ck,
618 .dpll_data = &dpll_iva_dd,
619 .init = &omap2_init_dpll_parent,
620 .ops = &clkops_omap3_noncore_dpll_ops,
621 .recalc = &omap3_dpll_recalc,
622 .round_rate = &omap2_dpll_round_rate,
623 .set_rate = &omap3_noncore_dpll_set_rate,
624};
625
626static struct clk dpll_iva_x2_ck = {
627 .name = "dpll_iva_x2_ck",
628 .parent = &dpll_iva_ck,
629 .flags = CLOCK_CLKOUTX2,
630 .ops = &clkops_null,
631 .recalc = &omap3_clkoutx2_recalc,
632};
633
634static const struct clksel dpll_iva_m4x2_div[] = {
635 { .parent = &dpll_iva_x2_ck, .rates = div31_1to31_rates },
636 { .parent = NULL },
637};
638
639static struct clk dpll_iva_m4x2_ck = {
640 .name = "dpll_iva_m4x2_ck",
641 .parent = &dpll_iva_x2_ck,
642 .clksel = dpll_iva_m4x2_div,
643 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_IVA,
644 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
645 .ops = &clkops_omap4_dpllmx_ops,
646 .recalc = &omap2_clksel_recalc,
647 .round_rate = &omap2_clksel_round_rate,
648 .set_rate = &omap2_clksel_set_rate,
649};
650
651static struct clk dpll_iva_m5x2_ck = {
652 .name = "dpll_iva_m5x2_ck",
653 .parent = &dpll_iva_x2_ck,
654 .clksel = dpll_iva_m4x2_div,
655 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_IVA,
656 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
657 .ops = &clkops_omap4_dpllmx_ops,
658 .recalc = &omap2_clksel_recalc,
659 .round_rate = &omap2_clksel_round_rate,
660 .set_rate = &omap2_clksel_set_rate,
661};
662
663/* DPLL_MPU */
664static struct dpll_data dpll_mpu_dd = {
665 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
666 .clk_bypass = &div_mpu_hs_clk,
667 .clk_ref = &sys_clkin_ck,
668 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
669 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
670 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
671 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
672 .mult_mask = OMAP4430_DPLL_MULT_MASK,
673 .div1_mask = OMAP4430_DPLL_DIV_MASK,
674 .enable_mask = OMAP4430_DPLL_EN_MASK,
675 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
676 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
677 .max_multiplier = 2047,
678 .max_divider = 128,
679 .min_divider = 1,
680};
681
682
683static struct clk dpll_mpu_ck = {
684 .name = "dpll_mpu_ck",
685 .parent = &sys_clkin_ck,
686 .dpll_data = &dpll_mpu_dd,
687 .init = &omap2_init_dpll_parent,
688 .ops = &clkops_omap3_noncore_dpll_ops,
689 .recalc = &omap3_dpll_recalc,
690 .round_rate = &omap2_dpll_round_rate,
691 .set_rate = &omap3_noncore_dpll_set_rate,
692};
693
694static const struct clksel dpll_mpu_m2_div[] = {
695 { .parent = &dpll_mpu_ck, .rates = div31_1to31_rates },
696 { .parent = NULL },
697};
698
699static struct clk dpll_mpu_m2_ck = {
700 .name = "dpll_mpu_m2_ck",
701 .parent = &dpll_mpu_ck,
702 .clkdm_name = "cm_clkdm",
703 .clksel = dpll_mpu_m2_div,
704 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU,
705 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
706 .ops = &clkops_omap4_dpllmx_ops,
707 .recalc = &omap2_clksel_recalc,
708 .round_rate = &omap2_clksel_round_rate,
709 .set_rate = &omap2_clksel_set_rate,
710};
711
712static struct clk per_hs_clk_div_ck = {
713 .name = "per_hs_clk_div_ck",
714 .parent = &dpll_abe_m3x2_ck,
715 .ops = &clkops_null,
716 .fixed_div = 2,
717 .recalc = &omap_fixed_divisor_recalc,
718};
719
720static const struct clksel per_hsd_byp_clk_mux_sel[] = {
721 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
722 { .parent = &per_hs_clk_div_ck, .rates = div_1_1_rates },
723 { .parent = NULL },
724};
725
726static struct clk per_hsd_byp_clk_mux_ck = {
727 .name = "per_hsd_byp_clk_mux_ck",
728 .parent = &sys_clkin_ck,
729 .clksel = per_hsd_byp_clk_mux_sel,
730 .init = &omap2_init_clksel_parent,
731 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
732 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
733 .ops = &clkops_null,
734 .recalc = &omap2_clksel_recalc,
735};
736
737/* DPLL_PER */
738static struct dpll_data dpll_per_dd = {
739 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
740 .clk_bypass = &per_hsd_byp_clk_mux_ck,
741 .clk_ref = &sys_clkin_ck,
742 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
743 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
744 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
745 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
746 .mult_mask = OMAP4430_DPLL_MULT_MASK,
747 .div1_mask = OMAP4430_DPLL_DIV_MASK,
748 .enable_mask = OMAP4430_DPLL_EN_MASK,
749 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
750 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
751 .max_multiplier = 2047,
752 .max_divider = 128,
753 .min_divider = 1,
754};
755
756
757static struct clk dpll_per_ck = {
758 .name = "dpll_per_ck",
759 .parent = &sys_clkin_ck,
760 .dpll_data = &dpll_per_dd,
761 .init = &omap2_init_dpll_parent,
762 .ops = &clkops_omap3_noncore_dpll_ops,
763 .recalc = &omap3_dpll_recalc,
764 .round_rate = &omap2_dpll_round_rate,
765 .set_rate = &omap3_noncore_dpll_set_rate,
766};
767
768static const struct clksel dpll_per_m2_div[] = {
769 { .parent = &dpll_per_ck, .rates = div31_1to31_rates },
770 { .parent = NULL },
771};
772
773static struct clk dpll_per_m2_ck = {
774 .name = "dpll_per_m2_ck",
775 .parent = &dpll_per_ck,
776 .clksel = dpll_per_m2_div,
777 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
778 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
779 .ops = &clkops_omap4_dpllmx_ops,
780 .recalc = &omap2_clksel_recalc,
781 .round_rate = &omap2_clksel_round_rate,
782 .set_rate = &omap2_clksel_set_rate,
783};
784
785static struct clk dpll_per_x2_ck = {
786 .name = "dpll_per_x2_ck",
787 .parent = &dpll_per_ck,
788 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
789 .flags = CLOCK_CLKOUTX2,
790 .ops = &clkops_omap4_dpllmx_ops,
791 .recalc = &omap3_clkoutx2_recalc,
792};
793
794static const struct clksel dpll_per_m2x2_div[] = {
795 { .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
796 { .parent = NULL },
797};
798
799static struct clk dpll_per_m2x2_ck = {
800 .name = "dpll_per_m2x2_ck",
801 .parent = &dpll_per_x2_ck,
802 .clksel = dpll_per_m2x2_div,
803 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
804 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
805 .ops = &clkops_omap4_dpllmx_ops,
806 .recalc = &omap2_clksel_recalc,
807 .round_rate = &omap2_clksel_round_rate,
808 .set_rate = &omap2_clksel_set_rate,
809};
810
811static struct clk dpll_per_m3x2_ck = {
812 .name = "dpll_per_m3x2_ck",
813 .parent = &dpll_per_x2_ck,
814 .clksel = dpll_per_m2x2_div,
815 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_PER,
816 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
817 .ops = &clkops_omap2_dflt,
818 .recalc = &omap2_clksel_recalc,
819 .round_rate = &omap2_clksel_round_rate,
820 .set_rate = &omap2_clksel_set_rate,
821 .enable_reg = OMAP4430_CM_DIV_M3_DPLL_PER,
822 .enable_bit = OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT,
823};
824
825static struct clk dpll_per_m4x2_ck = {
826 .name = "dpll_per_m4x2_ck",
827 .parent = &dpll_per_x2_ck,
828 .clksel = dpll_per_m2x2_div,
829 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_PER,
830 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
831 .ops = &clkops_omap4_dpllmx_ops,
832 .recalc = &omap2_clksel_recalc,
833 .round_rate = &omap2_clksel_round_rate,
834 .set_rate = &omap2_clksel_set_rate,
835};
836
837static struct clk dpll_per_m5x2_ck = {
838 .name = "dpll_per_m5x2_ck",
839 .parent = &dpll_per_x2_ck,
840 .clksel = dpll_per_m2x2_div,
841 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_PER,
842 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
843 .ops = &clkops_omap4_dpllmx_ops,
844 .recalc = &omap2_clksel_recalc,
845 .round_rate = &omap2_clksel_round_rate,
846 .set_rate = &omap2_clksel_set_rate,
847};
848
849static struct clk dpll_per_m6x2_ck = {
850 .name = "dpll_per_m6x2_ck",
851 .parent = &dpll_per_x2_ck,
852 .clksel = dpll_per_m2x2_div,
853 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_PER,
854 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
855 .ops = &clkops_omap4_dpllmx_ops,
856 .recalc = &omap2_clksel_recalc,
857 .round_rate = &omap2_clksel_round_rate,
858 .set_rate = &omap2_clksel_set_rate,
859};
860
861static struct clk dpll_per_m7x2_ck = {
862 .name = "dpll_per_m7x2_ck",
863 .parent = &dpll_per_x2_ck,
864 .clksel = dpll_per_m2x2_div,
865 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_PER,
866 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
867 .ops = &clkops_omap4_dpllmx_ops,
868 .recalc = &omap2_clksel_recalc,
869 .round_rate = &omap2_clksel_round_rate,
870 .set_rate = &omap2_clksel_set_rate,
871};
872
873static struct clk usb_hs_clk_div_ck = {
874 .name = "usb_hs_clk_div_ck",
875 .parent = &dpll_abe_m3x2_ck,
876 .ops = &clkops_null,
877 .fixed_div = 3,
878 .recalc = &omap_fixed_divisor_recalc,
879};
880
881/* DPLL_USB */
882static struct dpll_data dpll_usb_dd = {
883 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
884 .clk_bypass = &usb_hs_clk_div_ck,
885 .flags = DPLL_J_TYPE,
886 .clk_ref = &sys_clkin_ck,
887 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
888 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
889 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
890 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
891 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
892 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
893 .enable_mask = OMAP4430_DPLL_EN_MASK,
894 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
895 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
896 .sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
897 .max_multiplier = 4095,
898 .max_divider = 256,
899 .min_divider = 1,
900};
901
902
903static struct clk dpll_usb_ck = {
904 .name = "dpll_usb_ck",
905 .parent = &sys_clkin_ck,
906 .dpll_data = &dpll_usb_dd,
907 .init = &omap2_init_dpll_parent,
908 .ops = &clkops_omap3_noncore_dpll_ops,
909 .recalc = &omap3_dpll_recalc,
910 .round_rate = &omap2_dpll_round_rate,
911 .set_rate = &omap3_noncore_dpll_set_rate,
912 .clkdm_name = "l3_init_clkdm",
913};
914
915static struct clk dpll_usb_clkdcoldo_ck = {
916 .name = "dpll_usb_clkdcoldo_ck",
917 .parent = &dpll_usb_ck,
918 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
919 .ops = &clkops_omap4_dpllmx_ops,
920 .recalc = &followparent_recalc,
921};
922
923static const struct clksel dpll_usb_m2_div[] = {
924 { .parent = &dpll_usb_ck, .rates = div31_1to31_rates },
925 { .parent = NULL },
926};
927
928static struct clk dpll_usb_m2_ck = {
929 .name = "dpll_usb_m2_ck",
930 .parent = &dpll_usb_ck,
931 .clksel = dpll_usb_m2_div,
932 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_USB,
933 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK,
934 .ops = &clkops_omap4_dpllmx_ops,
935 .recalc = &omap2_clksel_recalc,
936 .round_rate = &omap2_clksel_round_rate,
937 .set_rate = &omap2_clksel_set_rate,
938};
939
940static const struct clksel ducati_clk_mux_sel[] = {
941 { .parent = &div_core_ck, .rates = div_1_0_rates },
942 { .parent = &dpll_per_m6x2_ck, .rates = div_1_1_rates },
943 { .parent = NULL },
944};
945
946static struct clk ducati_clk_mux_ck = {
947 .name = "ducati_clk_mux_ck",
948 .parent = &div_core_ck,
949 .clksel = ducati_clk_mux_sel,
950 .init = &omap2_init_clksel_parent,
951 .clksel_reg = OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT,
952 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
953 .ops = &clkops_null,
954 .recalc = &omap2_clksel_recalc,
955};
956
957static struct clk func_12m_fclk = {
958 .name = "func_12m_fclk",
959 .parent = &dpll_per_m2x2_ck,
960 .ops = &clkops_null,
961 .fixed_div = 16,
962 .recalc = &omap_fixed_divisor_recalc,
963};
964
965static struct clk func_24m_clk = {
966 .name = "func_24m_clk",
967 .parent = &dpll_per_m2_ck,
968 .ops = &clkops_null,
969 .fixed_div = 4,
970 .recalc = &omap_fixed_divisor_recalc,
971};
972
973static struct clk func_24mc_fclk = {
974 .name = "func_24mc_fclk",
975 .parent = &dpll_per_m2x2_ck,
976 .ops = &clkops_null,
977 .fixed_div = 8,
978 .recalc = &omap_fixed_divisor_recalc,
979};
980
981static const struct clksel_rate div2_4to8_rates[] = {
982 { .div = 4, .val = 0, .flags = RATE_IN_4430 },
983 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
984 { .div = 0 },
985};
986
987static const struct clksel func_48m_fclk_div[] = {
988 { .parent = &dpll_per_m2x2_ck, .rates = div2_4to8_rates },
989 { .parent = NULL },
990};
991
992static struct clk func_48m_fclk = {
993 .name = "func_48m_fclk",
994 .parent = &dpll_per_m2x2_ck,
995 .clksel = func_48m_fclk_div,
996 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
997 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
998 .ops = &clkops_null,
999 .recalc = &omap2_clksel_recalc,
1000 .round_rate = &omap2_clksel_round_rate,
1001 .set_rate = &omap2_clksel_set_rate,
1002};
1003
1004static struct clk func_48mc_fclk = {
1005 .name = "func_48mc_fclk",
1006 .parent = &dpll_per_m2x2_ck,
1007 .ops = &clkops_null,
1008 .fixed_div = 4,
1009 .recalc = &omap_fixed_divisor_recalc,
1010};
1011
1012static const struct clksel_rate div2_2to4_rates[] = {
1013 { .div = 2, .val = 0, .flags = RATE_IN_4430 },
1014 { .div = 4, .val = 1, .flags = RATE_IN_4430 },
1015 { .div = 0 },
1016};
1017
1018static const struct clksel func_64m_fclk_div[] = {
1019 { .parent = &dpll_per_m4x2_ck, .rates = div2_2to4_rates },
1020 { .parent = NULL },
1021};
1022
1023static struct clk func_64m_fclk = {
1024 .name = "func_64m_fclk",
1025 .parent = &dpll_per_m4x2_ck,
1026 .clksel = func_64m_fclk_div,
1027 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1028 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1029 .ops = &clkops_null,
1030 .recalc = &omap2_clksel_recalc,
1031 .round_rate = &omap2_clksel_round_rate,
1032 .set_rate = &omap2_clksel_set_rate,
1033};
1034
1035static const struct clksel func_96m_fclk_div[] = {
1036 { .parent = &dpll_per_m2x2_ck, .rates = div2_2to4_rates },
1037 { .parent = NULL },
1038};
1039
1040static struct clk func_96m_fclk = {
1041 .name = "func_96m_fclk",
1042 .parent = &dpll_per_m2x2_ck,
1043 .clksel = func_96m_fclk_div,
1044 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1045 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1046 .ops = &clkops_null,
1047 .recalc = &omap2_clksel_recalc,
1048 .round_rate = &omap2_clksel_round_rate,
1049 .set_rate = &omap2_clksel_set_rate,
1050};
1051
1052static const struct clksel_rate div2_1to8_rates[] = {
1053 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
1054 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
1055 { .div = 0 },
1056};
1057
1058static const struct clksel init_60m_fclk_div[] = {
1059 { .parent = &dpll_usb_m2_ck, .rates = div2_1to8_rates },
1060 { .parent = NULL },
1061};
1062
1063static struct clk init_60m_fclk = {
1064 .name = "init_60m_fclk",
1065 .parent = &dpll_usb_m2_ck,
1066 .clksel = init_60m_fclk_div,
1067 .clksel_reg = OMAP4430_CM_CLKSEL_USB_60MHZ,
1068 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1069 .ops = &clkops_null,
1070 .recalc = &omap2_clksel_recalc,
1071 .round_rate = &omap2_clksel_round_rate,
1072 .set_rate = &omap2_clksel_set_rate,
1073};
1074
1075static const struct clksel l3_div_div[] = {
1076 { .parent = &div_core_ck, .rates = div2_1to2_rates },
1077 { .parent = NULL },
1078};
1079
1080static struct clk l3_div_ck = {
1081 .name = "l3_div_ck",
1082 .parent = &div_core_ck,
1083 .clkdm_name = "cm_clkdm",
1084 .clksel = l3_div_div,
1085 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1086 .clksel_mask = OMAP4430_CLKSEL_L3_MASK,
1087 .ops = &clkops_null,
1088 .recalc = &omap2_clksel_recalc,
1089 .round_rate = &omap2_clksel_round_rate,
1090 .set_rate = &omap2_clksel_set_rate,
1091};
1092
1093static const struct clksel l4_div_div[] = {
1094 { .parent = &l3_div_ck, .rates = div2_1to2_rates },
1095 { .parent = NULL },
1096};
1097
1098static struct clk l4_div_ck = {
1099 .name = "l4_div_ck",
1100 .parent = &l3_div_ck,
1101 .clksel = l4_div_div,
1102 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1103 .clksel_mask = OMAP4430_CLKSEL_L4_MASK,
1104 .ops = &clkops_null,
1105 .recalc = &omap2_clksel_recalc,
1106 .round_rate = &omap2_clksel_round_rate,
1107 .set_rate = &omap2_clksel_set_rate,
1108};
1109
1110static struct clk lp_clk_div_ck = {
1111 .name = "lp_clk_div_ck",
1112 .parent = &dpll_abe_m2x2_ck,
1113 .ops = &clkops_null,
1114 .fixed_div = 16,
1115 .recalc = &omap_fixed_divisor_recalc,
1116};
1117
1118static const struct clksel l4_wkup_clk_mux_sel[] = {
1119 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1120 { .parent = &lp_clk_div_ck, .rates = div_1_1_rates },
1121 { .parent = NULL },
1122};
1123
1124static struct clk l4_wkup_clk_mux_ck = {
1125 .name = "l4_wkup_clk_mux_ck",
1126 .parent = &sys_clkin_ck,
1127 .clksel = l4_wkup_clk_mux_sel,
1128 .init = &omap2_init_clksel_parent,
1129 .clksel_reg = OMAP4430_CM_L4_WKUP_CLKSEL,
1130 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1131 .ops = &clkops_null,
1132 .recalc = &omap2_clksel_recalc,
1133};
1134
1135static const struct clksel_rate div2_2to1_rates[] = {
1136 { .div = 1, .val = 1, .flags = RATE_IN_4430 },
1137 { .div = 2, .val = 0, .flags = RATE_IN_4430 },
1138 { .div = 0 },
1139};
1140
1141static const struct clksel ocp_abe_iclk_div[] = {
1142 { .parent = &aess_fclk, .rates = div2_2to1_rates },
1143 { .parent = NULL },
1144};
1145
1146static struct clk mpu_periphclk = {
1147 .name = "mpu_periphclk",
1148 .parent = &dpll_mpu_ck,
1149 .ops = &clkops_null,
1150 .fixed_div = 2,
1151 .recalc = &omap_fixed_divisor_recalc,
1152};
1153
1154static struct clk ocp_abe_iclk = {
1155 .name = "ocp_abe_iclk",
1156 .parent = &aess_fclk,
1157 .clksel = ocp_abe_iclk_div,
1158 .clksel_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
1159 .clksel_mask = OMAP4430_CLKSEL_AESS_FCLK_MASK,
1160 .ops = &clkops_null,
1161 .recalc = &omap2_clksel_recalc,
1162};
1163
1164static struct clk per_abe_24m_fclk = {
1165 .name = "per_abe_24m_fclk",
1166 .parent = &dpll_abe_m2_ck,
1167 .ops = &clkops_null,
1168 .fixed_div = 4,
1169 .recalc = &omap_fixed_divisor_recalc,
1170};
1171
1172static const struct clksel per_abe_nc_fclk_div[] = {
1173 { .parent = &dpll_abe_m2_ck, .rates = div2_1to2_rates },
1174 { .parent = NULL },
1175};
1176
1177static struct clk per_abe_nc_fclk = {
1178 .name = "per_abe_nc_fclk",
1179 .parent = &dpll_abe_m2_ck,
1180 .clksel = per_abe_nc_fclk_div,
1181 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1182 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1183 .ops = &clkops_null,
1184 .recalc = &omap2_clksel_recalc,
1185 .round_rate = &omap2_clksel_round_rate,
1186 .set_rate = &omap2_clksel_set_rate,
1187};
1188
1189static const struct clksel pmd_stm_clock_mux_sel[] = {
1190 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1191 { .parent = &dpll_core_m6x2_ck, .rates = div_1_1_rates },
1192 { .parent = &tie_low_clock_ck, .rates = div_1_2_rates },
1193 { .parent = NULL },
1194};
1195
1196static struct clk pmd_stm_clock_mux_ck = {
1197 .name = "pmd_stm_clock_mux_ck",
1198 .parent = &sys_clkin_ck,
1199 .ops = &clkops_null,
1200 .recalc = &followparent_recalc,
1201};
1202
1203static struct clk pmd_trace_clk_mux_ck = {
1204 .name = "pmd_trace_clk_mux_ck",
1205 .parent = &sys_clkin_ck,
1206 .ops = &clkops_null,
1207 .recalc = &followparent_recalc,
1208};
1209
1210static const struct clksel syc_clk_div_div[] = {
1211 { .parent = &sys_clkin_ck, .rates = div2_1to2_rates },
1212 { .parent = NULL },
1213};
1214
1215static struct clk syc_clk_div_ck = {
1216 .name = "syc_clk_div_ck",
1217 .parent = &sys_clkin_ck,
1218 .clksel = syc_clk_div_div,
1219 .clksel_reg = OMAP4430_CM_ABE_DSS_SYS_CLKSEL,
1220 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1221 .ops = &clkops_null,
1222 .recalc = &omap2_clksel_recalc,
1223 .round_rate = &omap2_clksel_round_rate,
1224 .set_rate = &omap2_clksel_set_rate,
1225};
1226
1227/* Leaf clocks controlled by modules */
1228
1229static struct clk aes1_fck = {
1230 .name = "aes1_fck",
1231 .ops = &clkops_omap2_dflt,
1232 .enable_reg = OMAP4430_CM_L4SEC_AES1_CLKCTRL,
1233 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1234 .clkdm_name = "l4_secure_clkdm",
1235 .parent = &l3_div_ck,
1236 .recalc = &followparent_recalc,
1237};
1238
1239static struct clk aes2_fck = {
1240 .name = "aes2_fck",
1241 .ops = &clkops_omap2_dflt,
1242 .enable_reg = OMAP4430_CM_L4SEC_AES2_CLKCTRL,
1243 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1244 .clkdm_name = "l4_secure_clkdm",
1245 .parent = &l3_div_ck,
1246 .recalc = &followparent_recalc,
1247};
1248
1249static struct clk aess_fck = {
1250 .name = "aess_fck",
1251 .ops = &clkops_omap2_dflt,
1252 .enable_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
1253 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1254 .clkdm_name = "abe_clkdm",
1255 .parent = &aess_fclk,
1256 .recalc = &followparent_recalc,
1257};
1258
1259static struct clk bandgap_fclk = {
1260 .name = "bandgap_fclk",
1261 .ops = &clkops_omap2_dflt,
1262 .enable_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1263 .enable_bit = OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT,
1264 .clkdm_name = "l4_wkup_clkdm",
1265 .parent = &sys_32k_ck,
1266 .recalc = &followparent_recalc,
1267};
1268
1269static struct clk des3des_fck = {
1270 .name = "des3des_fck",
1271 .ops = &clkops_omap2_dflt,
1272 .enable_reg = OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
1273 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1274 .clkdm_name = "l4_secure_clkdm",
1275 .parent = &l4_div_ck,
1276 .recalc = &followparent_recalc,
1277};
1278
1279static const struct clksel dmic_sync_mux_sel[] = {
1280 { .parent = &abe_24m_fclk, .rates = div_1_0_rates },
1281 { .parent = &syc_clk_div_ck, .rates = div_1_1_rates },
1282 { .parent = &func_24m_clk, .rates = div_1_2_rates },
1283 { .parent = NULL },
1284};
1285
1286static struct clk dmic_sync_mux_ck = {
1287 .name = "dmic_sync_mux_ck",
1288 .parent = &abe_24m_fclk,
1289 .clksel = dmic_sync_mux_sel,
1290 .init = &omap2_init_clksel_parent,
1291 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1292 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1293 .ops = &clkops_null,
1294 .recalc = &omap2_clksel_recalc,
1295};
1296
1297static const struct clksel func_dmic_abe_gfclk_sel[] = {
1298 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
1299 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1300 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1301 { .parent = NULL },
1302};
1303
1304/* Merged func_dmic_abe_gfclk into dmic */
1305static struct clk dmic_fck = {
1306 .name = "dmic_fck",
1307 .parent = &dmic_sync_mux_ck,
1308 .clksel = func_dmic_abe_gfclk_sel,
1309 .init = &omap2_init_clksel_parent,
1310 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1311 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1312 .ops = &clkops_omap2_dflt,
1313 .recalc = &omap2_clksel_recalc,
1314 .enable_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1315 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1316 .clkdm_name = "abe_clkdm",
1317};
1318
1319static struct clk dsp_fck = {
1320 .name = "dsp_fck",
1321 .ops = &clkops_omap2_dflt,
1322 .enable_reg = OMAP4430_CM_TESLA_TESLA_CLKCTRL,
1323 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1324 .clkdm_name = "tesla_clkdm",
1325 .parent = &dpll_iva_m4x2_ck,
1326 .recalc = &followparent_recalc,
1327};
1328
1329static struct clk dss_sys_clk = {
1330 .name = "dss_sys_clk",
1331 .ops = &clkops_omap2_dflt,
1332 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1333 .enable_bit = OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT,
1334 .clkdm_name = "l3_dss_clkdm",
1335 .parent = &syc_clk_div_ck,
1336 .recalc = &followparent_recalc,
1337};
1338
1339static struct clk dss_tv_clk = {
1340 .name = "dss_tv_clk",
1341 .ops = &clkops_omap2_dflt,
1342 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1343 .enable_bit = OMAP4430_OPTFCLKEN_TV_CLK_SHIFT,
1344 .clkdm_name = "l3_dss_clkdm",
1345 .parent = &extalt_clkin_ck,
1346 .recalc = &followparent_recalc,
1347};
1348
1349static struct clk dss_dss_clk = {
1350 .name = "dss_dss_clk",
1351 .ops = &clkops_omap2_dflt,
1352 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1353 .enable_bit = OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
1354 .clkdm_name = "l3_dss_clkdm",
1355 .parent = &dpll_per_m5x2_ck,
1356 .recalc = &followparent_recalc,
1357};
1358
1359static const struct clksel_rate div3_8to32_rates[] = {
1360 { .div = 8, .val = 0, .flags = RATE_IN_4460 },
1361 { .div = 16, .val = 1, .flags = RATE_IN_4460 },
1362 { .div = 32, .val = 2, .flags = RATE_IN_4460 },
1363 { .div = 0 },
1364};
1365
1366static const struct clksel div_ts_div[] = {
1367 { .parent = &l4_wkup_clk_mux_ck, .rates = div3_8to32_rates },
1368 { .parent = NULL },
1369};
1370
1371static struct clk div_ts_ck = {
1372 .name = "div_ts_ck",
1373 .parent = &l4_wkup_clk_mux_ck,
1374 .clksel = div_ts_div,
1375 .clksel_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1376 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1377 .ops = &clkops_null,
1378 .recalc = &omap2_clksel_recalc,
1379 .round_rate = &omap2_clksel_round_rate,
1380 .set_rate = &omap2_clksel_set_rate,
1381};
1382
1383static struct clk bandgap_ts_fclk = {
1384 .name = "bandgap_ts_fclk",
1385 .ops = &clkops_omap2_dflt,
1386 .enable_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1387 .enable_bit = OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
1388 .clkdm_name = "l4_wkup_clkdm",
1389 .parent = &div_ts_ck,
1390 .recalc = &followparent_recalc,
1391};
1392
1393static struct clk dss_48mhz_clk = {
1394 .name = "dss_48mhz_clk",
1395 .ops = &clkops_omap2_dflt,
1396 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1397 .enable_bit = OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
1398 .clkdm_name = "l3_dss_clkdm",
1399 .parent = &func_48mc_fclk,
1400 .recalc = &followparent_recalc,
1401};
1402
1403static struct clk dss_fck = {
1404 .name = "dss_fck",
1405 .ops = &clkops_omap2_dflt,
1406 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1407 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1408 .clkdm_name = "l3_dss_clkdm",
1409 .parent = &l3_div_ck,
1410 .recalc = &followparent_recalc,
1411};
1412
1413static struct clk efuse_ctrl_cust_fck = {
1414 .name = "efuse_ctrl_cust_fck",
1415 .ops = &clkops_omap2_dflt,
1416 .enable_reg = OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
1417 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1418 .clkdm_name = "l4_cefuse_clkdm",
1419 .parent = &sys_clkin_ck,
1420 .recalc = &followparent_recalc,
1421};
1422
1423static struct clk emif1_fck = {
1424 .name = "emif1_fck",
1425 .ops = &clkops_omap2_dflt,
1426 .enable_reg = OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
1427 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1428 .flags = ENABLE_ON_INIT,
1429 .clkdm_name = "l3_emif_clkdm",
1430 .parent = &ddrphy_ck,
1431 .recalc = &followparent_recalc,
1432};
1433
1434static struct clk emif2_fck = {
1435 .name = "emif2_fck",
1436 .ops = &clkops_omap2_dflt,
1437 .enable_reg = OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
1438 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1439 .flags = ENABLE_ON_INIT,
1440 .clkdm_name = "l3_emif_clkdm",
1441 .parent = &ddrphy_ck,
1442 .recalc = &followparent_recalc,
1443};
1444
1445static const struct clksel fdif_fclk_div[] = {
1446 { .parent = &dpll_per_m4x2_ck, .rates = div3_1to4_rates },
1447 { .parent = NULL },
1448};
1449
1450/* Merged fdif_fclk into fdif */
1451static struct clk fdif_fck = {
1452 .name = "fdif_fck",
1453 .parent = &dpll_per_m4x2_ck,
1454 .clksel = fdif_fclk_div,
1455 .clksel_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1456 .clksel_mask = OMAP4430_CLKSEL_FCLK_MASK,
1457 .ops = &clkops_omap2_dflt,
1458 .recalc = &omap2_clksel_recalc,
1459 .round_rate = &omap2_clksel_round_rate,
1460 .set_rate = &omap2_clksel_set_rate,
1461 .enable_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1462 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1463 .clkdm_name = "iss_clkdm",
1464};
1465
1466static struct clk fpka_fck = {
1467 .name = "fpka_fck",
1468 .ops = &clkops_omap2_dflt,
1469 .enable_reg = OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
1470 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1471 .clkdm_name = "l4_secure_clkdm",
1472 .parent = &l4_div_ck,
1473 .recalc = &followparent_recalc,
1474};
1475
1476static struct clk gpio1_dbclk = {
1477 .name = "gpio1_dbclk",
1478 .ops = &clkops_omap2_dflt,
1479 .enable_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
1480 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1481 .clkdm_name = "l4_wkup_clkdm",
1482 .parent = &sys_32k_ck,
1483 .recalc = &followparent_recalc,
1484};
1485
1486static struct clk gpio1_ick = {
1487 .name = "gpio1_ick",
1488 .ops = &clkops_omap2_dflt,
1489 .enable_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
1490 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1491 .clkdm_name = "l4_wkup_clkdm",
1492 .parent = &l4_wkup_clk_mux_ck,
1493 .recalc = &followparent_recalc,
1494};
1495
1496static struct clk gpio2_dbclk = {
1497 .name = "gpio2_dbclk",
1498 .ops = &clkops_omap2_dflt,
1499 .enable_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
1500 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1501 .clkdm_name = "l4_per_clkdm",
1502 .parent = &sys_32k_ck,
1503 .recalc = &followparent_recalc,
1504};
1505
1506static struct clk gpio2_ick = {
1507 .name = "gpio2_ick",
1508 .ops = &clkops_omap2_dflt,
1509 .enable_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
1510 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1511 .clkdm_name = "l4_per_clkdm",
1512 .parent = &l4_div_ck,
1513 .recalc = &followparent_recalc,
1514};
1515
1516static struct clk gpio3_dbclk = {
1517 .name = "gpio3_dbclk",
1518 .ops = &clkops_omap2_dflt,
1519 .enable_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
1520 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1521 .clkdm_name = "l4_per_clkdm",
1522 .parent = &sys_32k_ck,
1523 .recalc = &followparent_recalc,
1524};
1525
1526static struct clk gpio3_ick = {
1527 .name = "gpio3_ick",
1528 .ops = &clkops_omap2_dflt,
1529 .enable_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
1530 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1531 .clkdm_name = "l4_per_clkdm",
1532 .parent = &l4_div_ck,
1533 .recalc = &followparent_recalc,
1534};
1535
1536static struct clk gpio4_dbclk = {
1537 .name = "gpio4_dbclk",
1538 .ops = &clkops_omap2_dflt,
1539 .enable_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
1540 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1541 .clkdm_name = "l4_per_clkdm",
1542 .parent = &sys_32k_ck,
1543 .recalc = &followparent_recalc,
1544};
1545
1546static struct clk gpio4_ick = {
1547 .name = "gpio4_ick",
1548 .ops = &clkops_omap2_dflt,
1549 .enable_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
1550 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1551 .clkdm_name = "l4_per_clkdm",
1552 .parent = &l4_div_ck,
1553 .recalc = &followparent_recalc,
1554};
1555
1556static struct clk gpio5_dbclk = {
1557 .name = "gpio5_dbclk",
1558 .ops = &clkops_omap2_dflt,
1559 .enable_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
1560 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1561 .clkdm_name = "l4_per_clkdm",
1562 .parent = &sys_32k_ck,
1563 .recalc = &followparent_recalc,
1564};
1565
1566static struct clk gpio5_ick = {
1567 .name = "gpio5_ick",
1568 .ops = &clkops_omap2_dflt,
1569 .enable_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
1570 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1571 .clkdm_name = "l4_per_clkdm",
1572 .parent = &l4_div_ck,
1573 .recalc = &followparent_recalc,
1574};
1575
1576static struct clk gpio6_dbclk = {
1577 .name = "gpio6_dbclk",
1578 .ops = &clkops_omap2_dflt,
1579 .enable_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
1580 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1581 .clkdm_name = "l4_per_clkdm",
1582 .parent = &sys_32k_ck,
1583 .recalc = &followparent_recalc,
1584};
1585
1586static struct clk gpio6_ick = {
1587 .name = "gpio6_ick",
1588 .ops = &clkops_omap2_dflt,
1589 .enable_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
1590 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1591 .clkdm_name = "l4_per_clkdm",
1592 .parent = &l4_div_ck,
1593 .recalc = &followparent_recalc,
1594};
1595
1596static struct clk gpmc_ick = {
1597 .name = "gpmc_ick",
1598 .ops = &clkops_omap2_dflt,
1599 .enable_reg = OMAP4430_CM_L3_2_GPMC_CLKCTRL,
1600 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1601 .flags = ENABLE_ON_INIT,
1602 .clkdm_name = "l3_2_clkdm",
1603 .parent = &l3_div_ck,
1604 .recalc = &followparent_recalc,
1605};
1606
1607static const struct clksel sgx_clk_mux_sel[] = {
1608 { .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
1609 { .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
1610 { .parent = NULL },
1611};
1612
1613/* Merged sgx_clk_mux into gpu */
1614static struct clk gpu_fck = {
1615 .name = "gpu_fck",
1616 .parent = &dpll_core_m7x2_ck,
1617 .clksel = sgx_clk_mux_sel,
1618 .init = &omap2_init_clksel_parent,
1619 .clksel_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1620 .clksel_mask = OMAP4430_CLKSEL_SGX_FCLK_MASK,
1621 .ops = &clkops_omap2_dflt,
1622 .recalc = &omap2_clksel_recalc,
1623 .enable_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1624 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1625 .clkdm_name = "l3_gfx_clkdm",
1626};
1627
1628static struct clk hdq1w_fck = {
1629 .name = "hdq1w_fck",
1630 .ops = &clkops_omap2_dflt,
1631 .enable_reg = OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
1632 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1633 .clkdm_name = "l4_per_clkdm",
1634 .parent = &func_12m_fclk,
1635 .recalc = &followparent_recalc,
1636};
1637
1638static const struct clksel hsi_fclk_div[] = {
1639 { .parent = &dpll_per_m2x2_ck, .rates = div3_1to4_rates },
1640 { .parent = NULL },
1641};
1642
1643/* Merged hsi_fclk into hsi */
1644static struct clk hsi_fck = {
1645 .name = "hsi_fck",
1646 .parent = &dpll_per_m2x2_ck,
1647 .clksel = hsi_fclk_div,
1648 .clksel_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1649 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1650 .ops = &clkops_omap2_dflt,
1651 .recalc = &omap2_clksel_recalc,
1652 .round_rate = &omap2_clksel_round_rate,
1653 .set_rate = &omap2_clksel_set_rate,
1654 .enable_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1655 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1656 .clkdm_name = "l3_init_clkdm",
1657};
1658
1659static struct clk i2c1_fck = {
1660 .name = "i2c1_fck",
1661 .ops = &clkops_omap2_dflt,
1662 .enable_reg = OMAP4430_CM_L4PER_I2C1_CLKCTRL,
1663 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1664 .clkdm_name = "l4_per_clkdm",
1665 .parent = &func_96m_fclk,
1666 .recalc = &followparent_recalc,
1667};
1668
1669static struct clk i2c2_fck = {
1670 .name = "i2c2_fck",
1671 .ops = &clkops_omap2_dflt,
1672 .enable_reg = OMAP4430_CM_L4PER_I2C2_CLKCTRL,
1673 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1674 .clkdm_name = "l4_per_clkdm",
1675 .parent = &func_96m_fclk,
1676 .recalc = &followparent_recalc,
1677};
1678
1679static struct clk i2c3_fck = {
1680 .name = "i2c3_fck",
1681 .ops = &clkops_omap2_dflt,
1682 .enable_reg = OMAP4430_CM_L4PER_I2C3_CLKCTRL,
1683 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1684 .clkdm_name = "l4_per_clkdm",
1685 .parent = &func_96m_fclk,
1686 .recalc = &followparent_recalc,
1687};
1688
1689static struct clk i2c4_fck = {
1690 .name = "i2c4_fck",
1691 .ops = &clkops_omap2_dflt,
1692 .enable_reg = OMAP4430_CM_L4PER_I2C4_CLKCTRL,
1693 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1694 .clkdm_name = "l4_per_clkdm",
1695 .parent = &func_96m_fclk,
1696 .recalc = &followparent_recalc,
1697};
1698
1699static struct clk ipu_fck = {
1700 .name = "ipu_fck",
1701 .ops = &clkops_omap2_dflt,
1702 .enable_reg = OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
1703 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1704 .clkdm_name = "ducati_clkdm",
1705 .parent = &ducati_clk_mux_ck,
1706 .recalc = &followparent_recalc,
1707};
1708
1709static struct clk iss_ctrlclk = {
1710 .name = "iss_ctrlclk",
1711 .ops = &clkops_omap2_dflt,
1712 .enable_reg = OMAP4430_CM_CAM_ISS_CLKCTRL,
1713 .enable_bit = OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
1714 .clkdm_name = "iss_clkdm",
1715 .parent = &func_96m_fclk,
1716 .recalc = &followparent_recalc,
1717};
1718
1719static struct clk iss_fck = {
1720 .name = "iss_fck",
1721 .ops = &clkops_omap2_dflt,
1722 .enable_reg = OMAP4430_CM_CAM_ISS_CLKCTRL,
1723 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1724 .clkdm_name = "iss_clkdm",
1725 .parent = &ducati_clk_mux_ck,
1726 .recalc = &followparent_recalc,
1727};
1728
1729static struct clk iva_fck = {
1730 .name = "iva_fck",
1731 .ops = &clkops_omap2_dflt,
1732 .enable_reg = OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
1733 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1734 .clkdm_name = "ivahd_clkdm",
1735 .parent = &dpll_iva_m5x2_ck,
1736 .recalc = &followparent_recalc,
1737};
1738
1739static struct clk kbd_fck = {
1740 .name = "kbd_fck",
1741 .ops = &clkops_omap2_dflt,
1742 .enable_reg = OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
1743 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1744 .clkdm_name = "l4_wkup_clkdm",
1745 .parent = &sys_32k_ck,
1746 .recalc = &followparent_recalc,
1747};
1748
1749static struct clk l3_instr_ick = {
1750 .name = "l3_instr_ick",
1751 .ops = &clkops_omap2_dflt,
1752 .enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
1753 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1754 .flags = ENABLE_ON_INIT,
1755 .clkdm_name = "l3_instr_clkdm",
1756 .parent = &l3_div_ck,
1757 .recalc = &followparent_recalc,
1758};
1759
1760static struct clk l3_main_3_ick = {
1761 .name = "l3_main_3_ick",
1762 .ops = &clkops_omap2_dflt,
1763 .enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
1764 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1765 .flags = ENABLE_ON_INIT,
1766 .clkdm_name = "l3_instr_clkdm",
1767 .parent = &l3_div_ck,
1768 .recalc = &followparent_recalc,
1769};
1770
1771static struct clk mcasp_sync_mux_ck = {
1772 .name = "mcasp_sync_mux_ck",
1773 .parent = &abe_24m_fclk,
1774 .clksel = dmic_sync_mux_sel,
1775 .init = &omap2_init_clksel_parent,
1776 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1777 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1778 .ops = &clkops_null,
1779 .recalc = &omap2_clksel_recalc,
1780};
1781
1782static const struct clksel func_mcasp_abe_gfclk_sel[] = {
1783 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
1784 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1785 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1786 { .parent = NULL },
1787};
1788
1789/* Merged func_mcasp_abe_gfclk into mcasp */
1790static struct clk mcasp_fck = {
1791 .name = "mcasp_fck",
1792 .parent = &mcasp_sync_mux_ck,
1793 .clksel = func_mcasp_abe_gfclk_sel,
1794 .init = &omap2_init_clksel_parent,
1795 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1796 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1797 .ops = &clkops_omap2_dflt,
1798 .recalc = &omap2_clksel_recalc,
1799 .enable_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1800 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1801 .clkdm_name = "abe_clkdm",
1802};
1803
1804static struct clk mcbsp1_sync_mux_ck = {
1805 .name = "mcbsp1_sync_mux_ck",
1806 .parent = &abe_24m_fclk,
1807 .clksel = dmic_sync_mux_sel,
1808 .init = &omap2_init_clksel_parent,
1809 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1810 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1811 .ops = &clkops_null,
1812 .recalc = &omap2_clksel_recalc,
1813};
1814
1815static const struct clksel func_mcbsp1_gfclk_sel[] = {
1816 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
1817 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1818 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1819 { .parent = NULL },
1820};
1821
1822/* Merged func_mcbsp1_gfclk into mcbsp1 */
1823static struct clk mcbsp1_fck = {
1824 .name = "mcbsp1_fck",
1825 .parent = &mcbsp1_sync_mux_ck,
1826 .clksel = func_mcbsp1_gfclk_sel,
1827 .init = &omap2_init_clksel_parent,
1828 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1829 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1830 .ops = &clkops_omap2_dflt,
1831 .recalc = &omap2_clksel_recalc,
1832 .enable_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1833 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1834 .clkdm_name = "abe_clkdm",
1835};
1836
1837static struct clk mcbsp2_sync_mux_ck = {
1838 .name = "mcbsp2_sync_mux_ck",
1839 .parent = &abe_24m_fclk,
1840 .clksel = dmic_sync_mux_sel,
1841 .init = &omap2_init_clksel_parent,
1842 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1843 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1844 .ops = &clkops_null,
1845 .recalc = &omap2_clksel_recalc,
1846};
1847
1848static const struct clksel func_mcbsp2_gfclk_sel[] = {
1849 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
1850 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1851 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1852 { .parent = NULL },
1853};
1854
1855/* Merged func_mcbsp2_gfclk into mcbsp2 */
1856static struct clk mcbsp2_fck = {
1857 .name = "mcbsp2_fck",
1858 .parent = &mcbsp2_sync_mux_ck,
1859 .clksel = func_mcbsp2_gfclk_sel,
1860 .init = &omap2_init_clksel_parent,
1861 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1862 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1863 .ops = &clkops_omap2_dflt,
1864 .recalc = &omap2_clksel_recalc,
1865 .enable_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1866 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1867 .clkdm_name = "abe_clkdm",
1868};
1869
1870static struct clk mcbsp3_sync_mux_ck = {
1871 .name = "mcbsp3_sync_mux_ck",
1872 .parent = &abe_24m_fclk,
1873 .clksel = dmic_sync_mux_sel,
1874 .init = &omap2_init_clksel_parent,
1875 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1876 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1877 .ops = &clkops_null,
1878 .recalc = &omap2_clksel_recalc,
1879};
1880
1881static const struct clksel func_mcbsp3_gfclk_sel[] = {
1882 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
1883 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1884 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1885 { .parent = NULL },
1886};
1887
1888/* Merged func_mcbsp3_gfclk into mcbsp3 */
1889static struct clk mcbsp3_fck = {
1890 .name = "mcbsp3_fck",
1891 .parent = &mcbsp3_sync_mux_ck,
1892 .clksel = func_mcbsp3_gfclk_sel,
1893 .init = &omap2_init_clksel_parent,
1894 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1895 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1896 .ops = &clkops_omap2_dflt,
1897 .recalc = &omap2_clksel_recalc,
1898 .enable_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1899 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1900 .clkdm_name = "abe_clkdm",
1901};
1902
1903static const struct clksel mcbsp4_sync_mux_sel[] = {
1904 { .parent = &func_96m_fclk, .rates = div_1_0_rates },
1905 { .parent = &per_abe_nc_fclk, .rates = div_1_1_rates },
1906 { .parent = NULL },
1907};
1908
1909static struct clk mcbsp4_sync_mux_ck = {
1910 .name = "mcbsp4_sync_mux_ck",
1911 .parent = &func_96m_fclk,
1912 .clksel = mcbsp4_sync_mux_sel,
1913 .init = &omap2_init_clksel_parent,
1914 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1915 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1916 .ops = &clkops_null,
1917 .recalc = &omap2_clksel_recalc,
1918};
1919
1920static const struct clksel per_mcbsp4_gfclk_sel[] = {
1921 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
1922 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1923 { .parent = NULL },
1924};
1925
1926/* Merged per_mcbsp4_gfclk into mcbsp4 */
1927static struct clk mcbsp4_fck = {
1928 .name = "mcbsp4_fck",
1929 .parent = &mcbsp4_sync_mux_ck,
1930 .clksel = per_mcbsp4_gfclk_sel,
1931 .init = &omap2_init_clksel_parent,
1932 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1933 .clksel_mask = OMAP4430_CLKSEL_SOURCE_24_24_MASK,
1934 .ops = &clkops_omap2_dflt,
1935 .recalc = &omap2_clksel_recalc,
1936 .enable_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1937 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1938 .clkdm_name = "l4_per_clkdm",
1939};
1940
1941static struct clk mcpdm_fck = {
1942 .name = "mcpdm_fck",
1943 .ops = &clkops_omap2_dflt,
1944 .enable_reg = OMAP4430_CM1_ABE_PDM_CLKCTRL,
1945 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1946 .clkdm_name = "abe_clkdm",
1947 .parent = &pad_clks_ck,
1948 .recalc = &followparent_recalc,
1949};
1950
1951static struct clk mcspi1_fck = {
1952 .name = "mcspi1_fck",
1953 .ops = &clkops_omap2_dflt,
1954 .enable_reg = OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
1955 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1956 .clkdm_name = "l4_per_clkdm",
1957 .parent = &func_48m_fclk,
1958 .recalc = &followparent_recalc,
1959};
1960
1961static struct clk mcspi2_fck = {
1962 .name = "mcspi2_fck",
1963 .ops = &clkops_omap2_dflt,
1964 .enable_reg = OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
1965 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1966 .clkdm_name = "l4_per_clkdm",
1967 .parent = &func_48m_fclk,
1968 .recalc = &followparent_recalc,
1969};
1970
1971static struct clk mcspi3_fck = {
1972 .name = "mcspi3_fck",
1973 .ops = &clkops_omap2_dflt,
1974 .enable_reg = OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
1975 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1976 .clkdm_name = "l4_per_clkdm",
1977 .parent = &func_48m_fclk,
1978 .recalc = &followparent_recalc,
1979};
1980
1981static struct clk mcspi4_fck = {
1982 .name = "mcspi4_fck",
1983 .ops = &clkops_omap2_dflt,
1984 .enable_reg = OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
1985 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1986 .clkdm_name = "l4_per_clkdm",
1987 .parent = &func_48m_fclk,
1988 .recalc = &followparent_recalc,
1989};
1990
1991static const struct clksel hsmmc1_fclk_sel[] = {
1992 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1993 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1994 { .parent = NULL },
1995};
1996
1997/* Merged hsmmc1_fclk into mmc1 */
1998static struct clk mmc1_fck = {
1999 .name = "mmc1_fck",
2000 .parent = &func_64m_fclk,
2001 .clksel = hsmmc1_fclk_sel,
2002 .init = &omap2_init_clksel_parent,
2003 .clksel_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2004 .clksel_mask = OMAP4430_CLKSEL_MASK,
2005 .ops = &clkops_omap2_dflt,
2006 .recalc = &omap2_clksel_recalc,
2007 .enable_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2008 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2009 .clkdm_name = "l3_init_clkdm",
2010};
2011
2012/* Merged hsmmc2_fclk into mmc2 */
2013static struct clk mmc2_fck = {
2014 .name = "mmc2_fck",
2015 .parent = &func_64m_fclk,
2016 .clksel = hsmmc1_fclk_sel,
2017 .init = &omap2_init_clksel_parent,
2018 .clksel_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2019 .clksel_mask = OMAP4430_CLKSEL_MASK,
2020 .ops = &clkops_omap2_dflt,
2021 .recalc = &omap2_clksel_recalc,
2022 .enable_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2023 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2024 .clkdm_name = "l3_init_clkdm",
2025};
2026
2027static struct clk mmc3_fck = {
2028 .name = "mmc3_fck",
2029 .ops = &clkops_omap2_dflt,
2030 .enable_reg = OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
2031 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2032 .clkdm_name = "l4_per_clkdm",
2033 .parent = &func_48m_fclk,
2034 .recalc = &followparent_recalc,
2035};
2036
2037static struct clk mmc4_fck = {
2038 .name = "mmc4_fck",
2039 .ops = &clkops_omap2_dflt,
2040 .enable_reg = OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
2041 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2042 .clkdm_name = "l4_per_clkdm",
2043 .parent = &func_48m_fclk,
2044 .recalc = &followparent_recalc,
2045};
2046
2047static struct clk mmc5_fck = {
2048 .name = "mmc5_fck",
2049 .ops = &clkops_omap2_dflt,
2050 .enable_reg = OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
2051 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2052 .clkdm_name = "l4_per_clkdm",
2053 .parent = &func_48m_fclk,
2054 .recalc = &followparent_recalc,
2055};
2056
2057static struct clk ocp2scp_usb_phy_phy_48m = {
2058 .name = "ocp2scp_usb_phy_phy_48m",
2059 .ops = &clkops_omap2_dflt,
2060 .enable_reg = OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
2061 .enable_bit = OMAP4430_OPTFCLKEN_PHY_48M_SHIFT,
2062 .clkdm_name = "l3_init_clkdm",
2063 .parent = &func_48m_fclk,
2064 .recalc = &followparent_recalc,
2065};
2066
2067static struct clk ocp2scp_usb_phy_ick = {
2068 .name = "ocp2scp_usb_phy_ick",
2069 .ops = &clkops_omap2_dflt,
2070 .enable_reg = OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
2071 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2072 .clkdm_name = "l3_init_clkdm",
2073 .parent = &l4_div_ck,
2074 .recalc = &followparent_recalc,
2075};
2076
2077static struct clk ocp_wp_noc_ick = {
2078 .name = "ocp_wp_noc_ick",
2079 .ops = &clkops_omap2_dflt,
2080 .enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
2081 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2082 .flags = ENABLE_ON_INIT,
2083 .clkdm_name = "l3_instr_clkdm",
2084 .parent = &l3_div_ck,
2085 .recalc = &followparent_recalc,
2086};
2087
2088static struct clk rng_ick = {
2089 .name = "rng_ick",
2090 .ops = &clkops_omap2_dflt,
2091 .enable_reg = OMAP4430_CM_L4SEC_RNG_CLKCTRL,
2092 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2093 .clkdm_name = "l4_secure_clkdm",
2094 .parent = &l4_div_ck,
2095 .recalc = &followparent_recalc,
2096};
2097
2098static struct clk sha2md5_fck = {
2099 .name = "sha2md5_fck",
2100 .ops = &clkops_omap2_dflt,
2101 .enable_reg = OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
2102 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2103 .clkdm_name = "l4_secure_clkdm",
2104 .parent = &l3_div_ck,
2105 .recalc = &followparent_recalc,
2106};
2107
2108static struct clk sl2if_ick = {
2109 .name = "sl2if_ick",
2110 .ops = &clkops_omap2_dflt,
2111 .enable_reg = OMAP4430_CM_IVAHD_SL2_CLKCTRL,
2112 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2113 .clkdm_name = "ivahd_clkdm",
2114 .parent = &dpll_iva_m5x2_ck,
2115 .recalc = &followparent_recalc,
2116};
2117
2118static struct clk slimbus1_fclk_1 = {
2119 .name = "slimbus1_fclk_1",
2120 .ops = &clkops_omap2_dflt,
2121 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2122 .enable_bit = OMAP4430_OPTFCLKEN_FCLK1_SHIFT,
2123 .clkdm_name = "abe_clkdm",
2124 .parent = &func_24m_clk,
2125 .recalc = &followparent_recalc,
2126};
2127
2128static struct clk slimbus1_fclk_0 = {
2129 .name = "slimbus1_fclk_0",
2130 .ops = &clkops_omap2_dflt,
2131 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2132 .enable_bit = OMAP4430_OPTFCLKEN_FCLK0_SHIFT,
2133 .clkdm_name = "abe_clkdm",
2134 .parent = &abe_24m_fclk,
2135 .recalc = &followparent_recalc,
2136};
2137
2138static struct clk slimbus1_fclk_2 = {
2139 .name = "slimbus1_fclk_2",
2140 .ops = &clkops_omap2_dflt,
2141 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2142 .enable_bit = OMAP4430_OPTFCLKEN_FCLK2_SHIFT,
2143 .clkdm_name = "abe_clkdm",
2144 .parent = &pad_clks_ck,
2145 .recalc = &followparent_recalc,
2146};
2147
2148static struct clk slimbus1_slimbus_clk = {
2149 .name = "slimbus1_slimbus_clk",
2150 .ops = &clkops_omap2_dflt,
2151 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2152 .enable_bit = OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT,
2153 .clkdm_name = "abe_clkdm",
2154 .parent = &slimbus_clk,
2155 .recalc = &followparent_recalc,
2156};
2157
2158static struct clk slimbus1_fck = {
2159 .name = "slimbus1_fck",
2160 .ops = &clkops_omap2_dflt,
2161 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2162 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2163 .clkdm_name = "abe_clkdm",
2164 .parent = &ocp_abe_iclk,
2165 .recalc = &followparent_recalc,
2166};
2167
2168static struct clk slimbus2_fclk_1 = {
2169 .name = "slimbus2_fclk_1",
2170 .ops = &clkops_omap2_dflt,
2171 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2172 .enable_bit = OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT,
2173 .clkdm_name = "l4_per_clkdm",
2174 .parent = &per_abe_24m_fclk,
2175 .recalc = &followparent_recalc,
2176};
2177
2178static struct clk slimbus2_fclk_0 = {
2179 .name = "slimbus2_fclk_0",
2180 .ops = &clkops_omap2_dflt,
2181 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2182 .enable_bit = OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT,
2183 .clkdm_name = "l4_per_clkdm",
2184 .parent = &func_24mc_fclk,
2185 .recalc = &followparent_recalc,
2186};
2187
2188static struct clk slimbus2_slimbus_clk = {
2189 .name = "slimbus2_slimbus_clk",
2190 .ops = &clkops_omap2_dflt,
2191 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2192 .enable_bit = OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT,
2193 .clkdm_name = "l4_per_clkdm",
2194 .parent = &pad_slimbus_core_clks_ck,
2195 .recalc = &followparent_recalc,
2196};
2197
2198static struct clk slimbus2_fck = {
2199 .name = "slimbus2_fck",
2200 .ops = &clkops_omap2_dflt,
2201 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2202 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2203 .clkdm_name = "l4_per_clkdm",
2204 .parent = &l4_div_ck,
2205 .recalc = &followparent_recalc,
2206};
2207
2208static struct clk smartreflex_core_fck = {
2209 .name = "smartreflex_core_fck",
2210 .ops = &clkops_omap2_dflt,
2211 .enable_reg = OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
2212 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2213 .clkdm_name = "l4_ao_clkdm",
2214 .parent = &l4_wkup_clk_mux_ck,
2215 .recalc = &followparent_recalc,
2216};
2217
2218static struct clk smartreflex_iva_fck = {
2219 .name = "smartreflex_iva_fck",
2220 .ops = &clkops_omap2_dflt,
2221 .enable_reg = OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
2222 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2223 .clkdm_name = "l4_ao_clkdm",
2224 .parent = &l4_wkup_clk_mux_ck,
2225 .recalc = &followparent_recalc,
2226};
2227
2228static struct clk smartreflex_mpu_fck = {
2229 .name = "smartreflex_mpu_fck",
2230 .ops = &clkops_omap2_dflt,
2231 .enable_reg = OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
2232 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2233 .clkdm_name = "l4_ao_clkdm",
2234 .parent = &l4_wkup_clk_mux_ck,
2235 .recalc = &followparent_recalc,
2236};
2237
2238/* Merged dmt1_clk_mux into timer1 */
2239static struct clk timer1_fck = {
2240 .name = "timer1_fck",
2241 .parent = &sys_clkin_ck,
2242 .clksel = abe_dpll_bypass_clk_mux_sel,
2243 .init = &omap2_init_clksel_parent,
2244 .clksel_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
2245 .clksel_mask = OMAP4430_CLKSEL_MASK,
2246 .ops = &clkops_omap2_dflt,
2247 .recalc = &omap2_clksel_recalc,
2248 .enable_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
2249 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2250 .clkdm_name = "l4_wkup_clkdm",
2251};
2252
2253/* Merged cm2_dm10_mux into timer10 */
2254static struct clk timer10_fck = {
2255 .name = "timer10_fck",
2256 .parent = &sys_clkin_ck,
2257 .clksel = abe_dpll_bypass_clk_mux_sel,
2258 .init = &omap2_init_clksel_parent,
2259 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
2260 .clksel_mask = OMAP4430_CLKSEL_MASK,
2261 .ops = &clkops_omap2_dflt,
2262 .recalc = &omap2_clksel_recalc,
2263 .enable_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
2264 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2265 .clkdm_name = "l4_per_clkdm",
2266};
2267
2268/* Merged cm2_dm11_mux into timer11 */
2269static struct clk timer11_fck = {
2270 .name = "timer11_fck",
2271 .parent = &sys_clkin_ck,
2272 .clksel = abe_dpll_bypass_clk_mux_sel,
2273 .init = &omap2_init_clksel_parent,
2274 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
2275 .clksel_mask = OMAP4430_CLKSEL_MASK,
2276 .ops = &clkops_omap2_dflt,
2277 .recalc = &omap2_clksel_recalc,
2278 .enable_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
2279 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2280 .clkdm_name = "l4_per_clkdm",
2281};
2282
2283/* Merged cm2_dm2_mux into timer2 */
2284static struct clk timer2_fck = {
2285 .name = "timer2_fck",
2286 .parent = &sys_clkin_ck,
2287 .clksel = abe_dpll_bypass_clk_mux_sel,
2288 .init = &omap2_init_clksel_parent,
2289 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
2290 .clksel_mask = OMAP4430_CLKSEL_MASK,
2291 .ops = &clkops_omap2_dflt,
2292 .recalc = &omap2_clksel_recalc,
2293 .enable_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
2294 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2295 .clkdm_name = "l4_per_clkdm",
2296};
2297
2298/* Merged cm2_dm3_mux into timer3 */
2299static struct clk timer3_fck = {
2300 .name = "timer3_fck",
2301 .parent = &sys_clkin_ck,
2302 .clksel = abe_dpll_bypass_clk_mux_sel,
2303 .init = &omap2_init_clksel_parent,
2304 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
2305 .clksel_mask = OMAP4430_CLKSEL_MASK,
2306 .ops = &clkops_omap2_dflt,
2307 .recalc = &omap2_clksel_recalc,
2308 .enable_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
2309 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2310 .clkdm_name = "l4_per_clkdm",
2311};
2312
2313/* Merged cm2_dm4_mux into timer4 */
2314static struct clk timer4_fck = {
2315 .name = "timer4_fck",
2316 .parent = &sys_clkin_ck,
2317 .clksel = abe_dpll_bypass_clk_mux_sel,
2318 .init = &omap2_init_clksel_parent,
2319 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
2320 .clksel_mask = OMAP4430_CLKSEL_MASK,
2321 .ops = &clkops_omap2_dflt,
2322 .recalc = &omap2_clksel_recalc,
2323 .enable_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
2324 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2325 .clkdm_name = "l4_per_clkdm",
2326};
2327
2328static const struct clksel timer5_sync_mux_sel[] = {
2329 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
2330 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
2331 { .parent = NULL },
2332};
2333
2334/* Merged timer5_sync_mux into timer5 */
2335static struct clk timer5_fck = {
2336 .name = "timer5_fck",
2337 .parent = &syc_clk_div_ck,
2338 .clksel = timer5_sync_mux_sel,
2339 .init = &omap2_init_clksel_parent,
2340 .clksel_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
2341 .clksel_mask = OMAP4430_CLKSEL_MASK,
2342 .ops = &clkops_omap2_dflt,
2343 .recalc = &omap2_clksel_recalc,
2344 .enable_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
2345 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2346 .clkdm_name = "abe_clkdm",
2347};
2348
2349/* Merged timer6_sync_mux into timer6 */
2350static struct clk timer6_fck = {
2351 .name = "timer6_fck",
2352 .parent = &syc_clk_div_ck,
2353 .clksel = timer5_sync_mux_sel,
2354 .init = &omap2_init_clksel_parent,
2355 .clksel_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
2356 .clksel_mask = OMAP4430_CLKSEL_MASK,
2357 .ops = &clkops_omap2_dflt,
2358 .recalc = &omap2_clksel_recalc,
2359 .enable_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
2360 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2361 .clkdm_name = "abe_clkdm",
2362};
2363
2364/* Merged timer7_sync_mux into timer7 */
2365static struct clk timer7_fck = {
2366 .name = "timer7_fck",
2367 .parent = &syc_clk_div_ck,
2368 .clksel = timer5_sync_mux_sel,
2369 .init = &omap2_init_clksel_parent,
2370 .clksel_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
2371 .clksel_mask = OMAP4430_CLKSEL_MASK,
2372 .ops = &clkops_omap2_dflt,
2373 .recalc = &omap2_clksel_recalc,
2374 .enable_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
2375 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2376 .clkdm_name = "abe_clkdm",
2377};
2378
2379/* Merged timer8_sync_mux into timer8 */
2380static struct clk timer8_fck = {
2381 .name = "timer8_fck",
2382 .parent = &syc_clk_div_ck,
2383 .clksel = timer5_sync_mux_sel,
2384 .init = &omap2_init_clksel_parent,
2385 .clksel_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
2386 .clksel_mask = OMAP4430_CLKSEL_MASK,
2387 .ops = &clkops_omap2_dflt,
2388 .recalc = &omap2_clksel_recalc,
2389 .enable_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
2390 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2391 .clkdm_name = "abe_clkdm",
2392};
2393
2394/* Merged cm2_dm9_mux into timer9 */
2395static struct clk timer9_fck = {
2396 .name = "timer9_fck",
2397 .parent = &sys_clkin_ck,
2398 .clksel = abe_dpll_bypass_clk_mux_sel,
2399 .init = &omap2_init_clksel_parent,
2400 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
2401 .clksel_mask = OMAP4430_CLKSEL_MASK,
2402 .ops = &clkops_omap2_dflt,
2403 .recalc = &omap2_clksel_recalc,
2404 .enable_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
2405 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2406 .clkdm_name = "l4_per_clkdm",
2407};
2408
2409static struct clk uart1_fck = {
2410 .name = "uart1_fck",
2411 .ops = &clkops_omap2_dflt,
2412 .enable_reg = OMAP4430_CM_L4PER_UART1_CLKCTRL,
2413 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2414 .clkdm_name = "l4_per_clkdm",
2415 .parent = &func_48m_fclk,
2416 .recalc = &followparent_recalc,
2417};
2418
2419static struct clk uart2_fck = {
2420 .name = "uart2_fck",
2421 .ops = &clkops_omap2_dflt,
2422 .enable_reg = OMAP4430_CM_L4PER_UART2_CLKCTRL,
2423 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2424 .clkdm_name = "l4_per_clkdm",
2425 .parent = &func_48m_fclk,
2426 .recalc = &followparent_recalc,
2427};
2428
2429static struct clk uart3_fck = {
2430 .name = "uart3_fck",
2431 .ops = &clkops_omap2_dflt,
2432 .enable_reg = OMAP4430_CM_L4PER_UART3_CLKCTRL,
2433 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2434 .clkdm_name = "l4_per_clkdm",
2435 .parent = &func_48m_fclk,
2436 .recalc = &followparent_recalc,
2437};
2438
2439static struct clk uart4_fck = {
2440 .name = "uart4_fck",
2441 .ops = &clkops_omap2_dflt,
2442 .enable_reg = OMAP4430_CM_L4PER_UART4_CLKCTRL,
2443 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2444 .clkdm_name = "l4_per_clkdm",
2445 .parent = &func_48m_fclk,
2446 .recalc = &followparent_recalc,
2447};
2448
2449static struct clk usb_host_fs_fck = {
2450 .name = "usb_host_fs_fck",
2451 .ops = &clkops_omap2_dflt,
2452 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
2453 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2454 .clkdm_name = "l3_init_clkdm",
2455 .parent = &func_48mc_fclk,
2456 .recalc = &followparent_recalc,
2457};
2458
2459static const struct clksel utmi_p1_gfclk_sel[] = {
2460 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2461 { .parent = &xclk60mhsp1_ck, .rates = div_1_1_rates },
2462 { .parent = NULL },
2463};
2464
2465static struct clk utmi_p1_gfclk = {
2466 .name = "utmi_p1_gfclk",
2467 .parent = &init_60m_fclk,
2468 .clksel = utmi_p1_gfclk_sel,
2469 .init = &omap2_init_clksel_parent,
2470 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2471 .clksel_mask = OMAP4430_CLKSEL_UTMI_P1_MASK,
2472 .ops = &clkops_null,
2473 .recalc = &omap2_clksel_recalc,
2474};
2475
2476static struct clk usb_host_hs_utmi_p1_clk = {
2477 .name = "usb_host_hs_utmi_p1_clk",
2478 .ops = &clkops_omap2_dflt,
2479 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2480 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT,
2481 .clkdm_name = "l3_init_clkdm",
2482 .parent = &utmi_p1_gfclk,
2483 .recalc = &followparent_recalc,
2484};
2485
2486static const struct clksel utmi_p2_gfclk_sel[] = {
2487 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2488 { .parent = &xclk60mhsp2_ck, .rates = div_1_1_rates },
2489 { .parent = NULL },
2490};
2491
2492static struct clk utmi_p2_gfclk = {
2493 .name = "utmi_p2_gfclk",
2494 .parent = &init_60m_fclk,
2495 .clksel = utmi_p2_gfclk_sel,
2496 .init = &omap2_init_clksel_parent,
2497 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2498 .clksel_mask = OMAP4430_CLKSEL_UTMI_P2_MASK,
2499 .ops = &clkops_null,
2500 .recalc = &omap2_clksel_recalc,
2501};
2502
2503static struct clk usb_host_hs_utmi_p2_clk = {
2504 .name = "usb_host_hs_utmi_p2_clk",
2505 .ops = &clkops_omap2_dflt,
2506 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2507 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT,
2508 .clkdm_name = "l3_init_clkdm",
2509 .parent = &utmi_p2_gfclk,
2510 .recalc = &followparent_recalc,
2511};
2512
2513static struct clk usb_host_hs_utmi_p3_clk = {
2514 .name = "usb_host_hs_utmi_p3_clk",
2515 .ops = &clkops_omap2_dflt,
2516 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2517 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT,
2518 .clkdm_name = "l3_init_clkdm",
2519 .parent = &init_60m_fclk,
2520 .recalc = &followparent_recalc,
2521};
2522
2523static struct clk usb_host_hs_hsic480m_p1_clk = {
2524 .name = "usb_host_hs_hsic480m_p1_clk",
2525 .ops = &clkops_omap2_dflt,
2526 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2527 .enable_bit = OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT,
2528 .clkdm_name = "l3_init_clkdm",
2529 .parent = &dpll_usb_m2_ck,
2530 .recalc = &followparent_recalc,
2531};
2532
2533static struct clk usb_host_hs_hsic60m_p1_clk = {
2534 .name = "usb_host_hs_hsic60m_p1_clk",
2535 .ops = &clkops_omap2_dflt,
2536 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2537 .enable_bit = OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT,
2538 .clkdm_name = "l3_init_clkdm",
2539 .parent = &init_60m_fclk,
2540 .recalc = &followparent_recalc,
2541};
2542
2543static struct clk usb_host_hs_hsic60m_p2_clk = {
2544 .name = "usb_host_hs_hsic60m_p2_clk",
2545 .ops = &clkops_omap2_dflt,
2546 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2547 .enable_bit = OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT,
2548 .clkdm_name = "l3_init_clkdm",
2549 .parent = &init_60m_fclk,
2550 .recalc = &followparent_recalc,
2551};
2552
2553static struct clk usb_host_hs_hsic480m_p2_clk = {
2554 .name = "usb_host_hs_hsic480m_p2_clk",
2555 .ops = &clkops_omap2_dflt,
2556 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2557 .enable_bit = OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT,
2558 .clkdm_name = "l3_init_clkdm",
2559 .parent = &dpll_usb_m2_ck,
2560 .recalc = &followparent_recalc,
2561};
2562
2563static struct clk usb_host_hs_func48mclk = {
2564 .name = "usb_host_hs_func48mclk",
2565 .ops = &clkops_omap2_dflt,
2566 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2567 .enable_bit = OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT,
2568 .clkdm_name = "l3_init_clkdm",
2569 .parent = &func_48mc_fclk,
2570 .recalc = &followparent_recalc,
2571};
2572
2573static struct clk usb_host_hs_fck = {
2574 .name = "usb_host_hs_fck",
2575 .ops = &clkops_omap2_dflt,
2576 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2577 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2578 .clkdm_name = "l3_init_clkdm",
2579 .parent = &init_60m_fclk,
2580 .recalc = &followparent_recalc,
2581};
2582
2583static const struct clksel otg_60m_gfclk_sel[] = {
2584 { .parent = &utmi_phy_clkout_ck, .rates = div_1_0_rates },
2585 { .parent = &xclk60motg_ck, .rates = div_1_1_rates },
2586 { .parent = NULL },
2587};
2588
2589static struct clk otg_60m_gfclk = {
2590 .name = "otg_60m_gfclk",
2591 .parent = &utmi_phy_clkout_ck,
2592 .clksel = otg_60m_gfclk_sel,
2593 .init = &omap2_init_clksel_parent,
2594 .clksel_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2595 .clksel_mask = OMAP4430_CLKSEL_60M_MASK,
2596 .ops = &clkops_null,
2597 .recalc = &omap2_clksel_recalc,
2598};
2599
2600static struct clk usb_otg_hs_xclk = {
2601 .name = "usb_otg_hs_xclk",
2602 .ops = &clkops_omap2_dflt,
2603 .enable_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2604 .enable_bit = OMAP4430_OPTFCLKEN_XCLK_SHIFT,
2605 .clkdm_name = "l3_init_clkdm",
2606 .parent = &otg_60m_gfclk,
2607 .recalc = &followparent_recalc,
2608};
2609
2610static struct clk usb_otg_hs_ick = {
2611 .name = "usb_otg_hs_ick",
2612 .ops = &clkops_omap2_dflt,
2613 .enable_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2614 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2615 .clkdm_name = "l3_init_clkdm",
2616 .parent = &l3_div_ck,
2617 .recalc = &followparent_recalc,
2618};
2619
2620static struct clk usb_phy_cm_clk32k = {
2621 .name = "usb_phy_cm_clk32k",
2622 .ops = &clkops_omap2_dflt,
2623 .enable_reg = OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
2624 .enable_bit = OMAP4430_OPTFCLKEN_CLK32K_SHIFT,
2625 .clkdm_name = "l4_ao_clkdm",
2626 .parent = &sys_32k_ck,
2627 .recalc = &followparent_recalc,
2628};
2629
2630static struct clk usb_tll_hs_usb_ch2_clk = {
2631 .name = "usb_tll_hs_usb_ch2_clk",
2632 .ops = &clkops_omap2_dflt,
2633 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2634 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT,
2635 .clkdm_name = "l3_init_clkdm",
2636 .parent = &init_60m_fclk,
2637 .recalc = &followparent_recalc,
2638};
2639
2640static struct clk usb_tll_hs_usb_ch0_clk = {
2641 .name = "usb_tll_hs_usb_ch0_clk",
2642 .ops = &clkops_omap2_dflt,
2643 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2644 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT,
2645 .clkdm_name = "l3_init_clkdm",
2646 .parent = &init_60m_fclk,
2647 .recalc = &followparent_recalc,
2648};
2649
2650static struct clk usb_tll_hs_usb_ch1_clk = {
2651 .name = "usb_tll_hs_usb_ch1_clk",
2652 .ops = &clkops_omap2_dflt,
2653 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2654 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT,
2655 .clkdm_name = "l3_init_clkdm",
2656 .parent = &init_60m_fclk,
2657 .recalc = &followparent_recalc,
2658};
2659
2660static struct clk usb_tll_hs_ick = {
2661 .name = "usb_tll_hs_ick",
2662 .ops = &clkops_omap2_dflt,
2663 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2664 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2665 .clkdm_name = "l3_init_clkdm",
2666 .parent = &l4_div_ck,
2667 .recalc = &followparent_recalc,
2668};
2669
2670static const struct clksel_rate div2_14to18_rates[] = {
2671 { .div = 14, .val = 0, .flags = RATE_IN_4430 },
2672 { .div = 18, .val = 1, .flags = RATE_IN_4430 },
2673 { .div = 0 },
2674};
2675
2676static const struct clksel usim_fclk_div[] = {
2677 { .parent = &dpll_per_m4x2_ck, .rates = div2_14to18_rates },
2678 { .parent = NULL },
2679};
2680
2681static struct clk usim_ck = {
2682 .name = "usim_ck",
2683 .parent = &dpll_per_m4x2_ck,
2684 .clksel = usim_fclk_div,
2685 .clksel_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2686 .clksel_mask = OMAP4430_CLKSEL_DIV_MASK,
2687 .ops = &clkops_null,
2688 .recalc = &omap2_clksel_recalc,
2689 .round_rate = &omap2_clksel_round_rate,
2690 .set_rate = &omap2_clksel_set_rate,
2691};
2692
2693static struct clk usim_fclk = {
2694 .name = "usim_fclk",
2695 .ops = &clkops_omap2_dflt,
2696 .enable_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2697 .enable_bit = OMAP4430_OPTFCLKEN_FCLK_SHIFT,
2698 .clkdm_name = "l4_wkup_clkdm",
2699 .parent = &usim_ck,
2700 .recalc = &followparent_recalc,
2701};
2702
2703static struct clk usim_fck = {
2704 .name = "usim_fck",
2705 .ops = &clkops_omap2_dflt,
2706 .enable_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2707 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2708 .clkdm_name = "l4_wkup_clkdm",
2709 .parent = &sys_32k_ck,
2710 .recalc = &followparent_recalc,
2711};
2712
2713static struct clk wd_timer2_fck = {
2714 .name = "wd_timer2_fck",
2715 .ops = &clkops_omap2_dflt,
2716 .enable_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL,
2717 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2718 .clkdm_name = "l4_wkup_clkdm",
2719 .parent = &sys_32k_ck,
2720 .recalc = &followparent_recalc,
2721};
2722
2723static struct clk wd_timer3_fck = {
2724 .name = "wd_timer3_fck",
2725 .ops = &clkops_omap2_dflt,
2726 .enable_reg = OMAP4430_CM1_ABE_WDT3_CLKCTRL,
2727 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2728 .clkdm_name = "abe_clkdm",
2729 .parent = &sys_32k_ck,
2730 .recalc = &followparent_recalc,
2731};
2732
2733/* Remaining optional clocks */
2734static const struct clksel stm_clk_div_div[] = {
2735 { .parent = &pmd_stm_clock_mux_ck, .rates = div3_1to4_rates },
2736 { .parent = NULL },
2737};
2738
2739static struct clk stm_clk_div_ck = {
2740 .name = "stm_clk_div_ck",
2741 .parent = &pmd_stm_clock_mux_ck,
2742 .clksel = stm_clk_div_div,
2743 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2744 .clksel_mask = OMAP4430_CLKSEL_PMD_STM_CLK_MASK,
2745 .ops = &clkops_null,
2746 .recalc = &omap2_clksel_recalc,
2747 .round_rate = &omap2_clksel_round_rate,
2748 .set_rate = &omap2_clksel_set_rate,
2749};
2750
2751static const struct clksel trace_clk_div_div[] = {
2752 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
2753 { .parent = NULL },
2754};
2755
2756static struct clk trace_clk_div_ck = {
2757 .name = "trace_clk_div_ck",
2758 .parent = &pmd_trace_clk_mux_ck,
2759 .clkdm_name = "emu_sys_clkdm",
2760 .clksel = trace_clk_div_div,
2761 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2762 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
2763 .ops = &clkops_null,
2764 .recalc = &omap2_clksel_recalc,
2765 .round_rate = &omap2_clksel_round_rate,
2766 .set_rate = &omap2_clksel_set_rate,
2767};
2768
2769/* SCRM aux clk nodes */
2770
2771static const struct clksel auxclk_src_sel[] = {
2772 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
2773 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
2774 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
2775 { .parent = NULL },
2776};
2777
2778static const struct clksel_rate div16_1to16_rates[] = {
2779 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
2780 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
2781 { .div = 3, .val = 2, .flags = RATE_IN_4430 },
2782 { .div = 4, .val = 3, .flags = RATE_IN_4430 },
2783 { .div = 5, .val = 4, .flags = RATE_IN_4430 },
2784 { .div = 6, .val = 5, .flags = RATE_IN_4430 },
2785 { .div = 7, .val = 6, .flags = RATE_IN_4430 },
2786 { .div = 8, .val = 7, .flags = RATE_IN_4430 },
2787 { .div = 9, .val = 8, .flags = RATE_IN_4430 },
2788 { .div = 10, .val = 9, .flags = RATE_IN_4430 },
2789 { .div = 11, .val = 10, .flags = RATE_IN_4430 },
2790 { .div = 12, .val = 11, .flags = RATE_IN_4430 },
2791 { .div = 13, .val = 12, .flags = RATE_IN_4430 },
2792 { .div = 14, .val = 13, .flags = RATE_IN_4430 },
2793 { .div = 15, .val = 14, .flags = RATE_IN_4430 },
2794 { .div = 16, .val = 15, .flags = RATE_IN_4430 },
2795 { .div = 0 },
2796};
2797
2798static struct clk auxclk0_src_ck = {
2799 .name = "auxclk0_src_ck",
2800 .parent = &sys_clkin_ck,
2801 .init = &omap2_init_clksel_parent,
2802 .ops = &clkops_omap2_dflt,
2803 .clksel = auxclk_src_sel,
2804 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2805 .clksel_mask = OMAP4_SRCSELECT_MASK,
2806 .recalc = &omap2_clksel_recalc,
2807 .enable_reg = OMAP4_SCRM_AUXCLK0,
2808 .enable_bit = OMAP4_ENABLE_SHIFT,
2809};
2810
2811static const struct clksel auxclk0_sel[] = {
2812 { .parent = &auxclk0_src_ck, .rates = div16_1to16_rates },
2813 { .parent = NULL },
2814};
2815
2816static struct clk auxclk0_ck = {
2817 .name = "auxclk0_ck",
2818 .parent = &auxclk0_src_ck,
2819 .clksel = auxclk0_sel,
2820 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2821 .clksel_mask = OMAP4_CLKDIV_MASK,
2822 .ops = &clkops_null,
2823 .recalc = &omap2_clksel_recalc,
2824 .round_rate = &omap2_clksel_round_rate,
2825 .set_rate = &omap2_clksel_set_rate,
2826};
2827
2828static struct clk auxclk1_src_ck = {
2829 .name = "auxclk1_src_ck",
2830 .parent = &sys_clkin_ck,
2831 .init = &omap2_init_clksel_parent,
2832 .ops = &clkops_omap2_dflt,
2833 .clksel = auxclk_src_sel,
2834 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2835 .clksel_mask = OMAP4_SRCSELECT_MASK,
2836 .recalc = &omap2_clksel_recalc,
2837 .enable_reg = OMAP4_SCRM_AUXCLK1,
2838 .enable_bit = OMAP4_ENABLE_SHIFT,
2839};
2840
2841static const struct clksel auxclk1_sel[] = {
2842 { .parent = &auxclk1_src_ck, .rates = div16_1to16_rates },
2843 { .parent = NULL },
2844};
2845
2846static struct clk auxclk1_ck = {
2847 .name = "auxclk1_ck",
2848 .parent = &auxclk1_src_ck,
2849 .clksel = auxclk1_sel,
2850 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2851 .clksel_mask = OMAP4_CLKDIV_MASK,
2852 .ops = &clkops_null,
2853 .recalc = &omap2_clksel_recalc,
2854 .round_rate = &omap2_clksel_round_rate,
2855 .set_rate = &omap2_clksel_set_rate,
2856};
2857
2858static struct clk auxclk2_src_ck = {
2859 .name = "auxclk2_src_ck",
2860 .parent = &sys_clkin_ck,
2861 .init = &omap2_init_clksel_parent,
2862 .ops = &clkops_omap2_dflt,
2863 .clksel = auxclk_src_sel,
2864 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2865 .clksel_mask = OMAP4_SRCSELECT_MASK,
2866 .recalc = &omap2_clksel_recalc,
2867 .enable_reg = OMAP4_SCRM_AUXCLK2,
2868 .enable_bit = OMAP4_ENABLE_SHIFT,
2869};
2870
2871static const struct clksel auxclk2_sel[] = {
2872 { .parent = &auxclk2_src_ck, .rates = div16_1to16_rates },
2873 { .parent = NULL },
2874};
2875
2876static struct clk auxclk2_ck = {
2877 .name = "auxclk2_ck",
2878 .parent = &auxclk2_src_ck,
2879 .clksel = auxclk2_sel,
2880 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2881 .clksel_mask = OMAP4_CLKDIV_MASK,
2882 .ops = &clkops_null,
2883 .recalc = &omap2_clksel_recalc,
2884 .round_rate = &omap2_clksel_round_rate,
2885 .set_rate = &omap2_clksel_set_rate,
2886};
2887
2888static struct clk auxclk3_src_ck = {
2889 .name = "auxclk3_src_ck",
2890 .parent = &sys_clkin_ck,
2891 .init = &omap2_init_clksel_parent,
2892 .ops = &clkops_omap2_dflt,
2893 .clksel = auxclk_src_sel,
2894 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2895 .clksel_mask = OMAP4_SRCSELECT_MASK,
2896 .recalc = &omap2_clksel_recalc,
2897 .enable_reg = OMAP4_SCRM_AUXCLK3,
2898 .enable_bit = OMAP4_ENABLE_SHIFT,
2899};
2900
2901static const struct clksel auxclk3_sel[] = {
2902 { .parent = &auxclk3_src_ck, .rates = div16_1to16_rates },
2903 { .parent = NULL },
2904};
2905
2906static struct clk auxclk3_ck = {
2907 .name = "auxclk3_ck",
2908 .parent = &auxclk3_src_ck,
2909 .clksel = auxclk3_sel,
2910 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2911 .clksel_mask = OMAP4_CLKDIV_MASK,
2912 .ops = &clkops_null,
2913 .recalc = &omap2_clksel_recalc,
2914 .round_rate = &omap2_clksel_round_rate,
2915 .set_rate = &omap2_clksel_set_rate,
2916};
2917
2918static struct clk auxclk4_src_ck = {
2919 .name = "auxclk4_src_ck",
2920 .parent = &sys_clkin_ck,
2921 .init = &omap2_init_clksel_parent,
2922 .ops = &clkops_omap2_dflt,
2923 .clksel = auxclk_src_sel,
2924 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2925 .clksel_mask = OMAP4_SRCSELECT_MASK,
2926 .recalc = &omap2_clksel_recalc,
2927 .enable_reg = OMAP4_SCRM_AUXCLK4,
2928 .enable_bit = OMAP4_ENABLE_SHIFT,
2929};
2930
2931static const struct clksel auxclk4_sel[] = {
2932 { .parent = &auxclk4_src_ck, .rates = div16_1to16_rates },
2933 { .parent = NULL },
2934};
2935
2936static struct clk auxclk4_ck = {
2937 .name = "auxclk4_ck",
2938 .parent = &auxclk4_src_ck,
2939 .clksel = auxclk4_sel,
2940 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2941 .clksel_mask = OMAP4_CLKDIV_MASK,
2942 .ops = &clkops_null,
2943 .recalc = &omap2_clksel_recalc,
2944 .round_rate = &omap2_clksel_round_rate,
2945 .set_rate = &omap2_clksel_set_rate,
2946};
2947
2948static struct clk auxclk5_src_ck = {
2949 .name = "auxclk5_src_ck",
2950 .parent = &sys_clkin_ck,
2951 .init = &omap2_init_clksel_parent,
2952 .ops = &clkops_omap2_dflt,
2953 .clksel = auxclk_src_sel,
2954 .clksel_reg = OMAP4_SCRM_AUXCLK5,
2955 .clksel_mask = OMAP4_SRCSELECT_MASK,
2956 .recalc = &omap2_clksel_recalc,
2957 .enable_reg = OMAP4_SCRM_AUXCLK5,
2958 .enable_bit = OMAP4_ENABLE_SHIFT,
2959};
2960
2961static const struct clksel auxclk5_sel[] = {
2962 { .parent = &auxclk5_src_ck, .rates = div16_1to16_rates },
2963 { .parent = NULL },
2964};
2965
2966static struct clk auxclk5_ck = {
2967 .name = "auxclk5_ck",
2968 .parent = &auxclk5_src_ck,
2969 .clksel = auxclk5_sel,
2970 .clksel_reg = OMAP4_SCRM_AUXCLK5,
2971 .clksel_mask = OMAP4_CLKDIV_MASK,
2972 .ops = &clkops_null,
2973 .recalc = &omap2_clksel_recalc,
2974 .round_rate = &omap2_clksel_round_rate,
2975 .set_rate = &omap2_clksel_set_rate,
2976};
2977
2978static const struct clksel auxclkreq_sel[] = {
2979 { .parent = &auxclk0_ck, .rates = div_1_0_rates },
2980 { .parent = &auxclk1_ck, .rates = div_1_1_rates },
2981 { .parent = &auxclk2_ck, .rates = div_1_2_rates },
2982 { .parent = &auxclk3_ck, .rates = div_1_3_rates },
2983 { .parent = &auxclk4_ck, .rates = div_1_4_rates },
2984 { .parent = &auxclk5_ck, .rates = div_1_5_rates },
2985 { .parent = NULL },
2986};
2987
2988static struct clk auxclkreq0_ck = {
2989 .name = "auxclkreq0_ck",
2990 .parent = &auxclk0_ck,
2991 .init = &omap2_init_clksel_parent,
2992 .ops = &clkops_null,
2993 .clksel = auxclkreq_sel,
2994 .clksel_reg = OMAP4_SCRM_AUXCLKREQ0,
2995 .clksel_mask = OMAP4_MAPPING_MASK,
2996 .recalc = &omap2_clksel_recalc,
2997};
2998
2999static struct clk auxclkreq1_ck = {
3000 .name = "auxclkreq1_ck",
3001 .parent = &auxclk1_ck,
3002 .init = &omap2_init_clksel_parent,
3003 .ops = &clkops_null,
3004 .clksel = auxclkreq_sel,
3005 .clksel_reg = OMAP4_SCRM_AUXCLKREQ1,
3006 .clksel_mask = OMAP4_MAPPING_MASK,
3007 .recalc = &omap2_clksel_recalc,
3008};
3009
3010static struct clk auxclkreq2_ck = {
3011 .name = "auxclkreq2_ck",
3012 .parent = &auxclk2_ck,
3013 .init = &omap2_init_clksel_parent,
3014 .ops = &clkops_null,
3015 .clksel = auxclkreq_sel,
3016 .clksel_reg = OMAP4_SCRM_AUXCLKREQ2,
3017 .clksel_mask = OMAP4_MAPPING_MASK,
3018 .recalc = &omap2_clksel_recalc,
3019};
3020
3021static struct clk auxclkreq3_ck = {
3022 .name = "auxclkreq3_ck",
3023 .parent = &auxclk3_ck,
3024 .init = &omap2_init_clksel_parent,
3025 .ops = &clkops_null,
3026 .clksel = auxclkreq_sel,
3027 .clksel_reg = OMAP4_SCRM_AUXCLKREQ3,
3028 .clksel_mask = OMAP4_MAPPING_MASK,
3029 .recalc = &omap2_clksel_recalc,
3030};
3031
3032static struct clk auxclkreq4_ck = {
3033 .name = "auxclkreq4_ck",
3034 .parent = &auxclk4_ck,
3035 .init = &omap2_init_clksel_parent,
3036 .ops = &clkops_null,
3037 .clksel = auxclkreq_sel,
3038 .clksel_reg = OMAP4_SCRM_AUXCLKREQ4,
3039 .clksel_mask = OMAP4_MAPPING_MASK,
3040 .recalc = &omap2_clksel_recalc,
3041};
3042
3043static struct clk auxclkreq5_ck = {
3044 .name = "auxclkreq5_ck",
3045 .parent = &auxclk5_ck,
3046 .init = &omap2_init_clksel_parent,
3047 .ops = &clkops_null,
3048 .clksel = auxclkreq_sel,
3049 .clksel_reg = OMAP4_SCRM_AUXCLKREQ5,
3050 .clksel_mask = OMAP4_MAPPING_MASK,
3051 .recalc = &omap2_clksel_recalc,
3052};
3053
3054/*
3055 * clkdev
3056 */
3057
3058static struct omap_clk omap44xx_clks[] = {
3059 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
3060 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
3061 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
3062 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
3063 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
3064 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
3065 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
3066 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
3067 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
3068 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
3069 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
3070 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
3071 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
3072 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
3073 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X),
3074 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
3075 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
3076 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
3077 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
3078 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X),
3079 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
3080 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
3081 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X),
3082 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
3083 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
3084 CLK(NULL, "abe_clk", &abe_clk, CK_443X),
3085 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
3086 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X),
3087 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
3088 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
3089 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X),
3090 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X),
3091 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
3092 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
3093 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
3094 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X),
3095 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
3096 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
3097 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
3098 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X),
3099 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
3100 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
3101 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X),
3102 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X),
3103 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
3104 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
3105 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X),
3106 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X),
3107 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X),
3108 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
3109 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
3110 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
3111 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
3112 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
3113 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
3114 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X),
3115 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
3116 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X),
3117 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X),
3118 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X),
3119 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X),
3120 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X),
3121 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
3122 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
3123 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
3124 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
3125 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
3126 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
3127 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
3128 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
3129 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
3130 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
3131 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
3132 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
3133 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
3134 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
3135 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
3136 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
3137 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
3138 CLK("smp_twd", NULL, &mpu_periphclk, CK_443X),
3139 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
3140 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
3141 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
3142 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
3143 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
3144 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
3145 CLK(NULL, "aes1_fck", &aes1_fck, CK_443X),
3146 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
3147 CLK(NULL, "aess_fck", &aess_fck, CK_443X),
3148 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
3149 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
3150 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
3151 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
3152 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
3153 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
3154 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
3155 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
3156 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
3157 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
3158 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
3159 CLK(NULL, "dss_fck", &dss_fck, CK_443X),
3160 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
3161 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
3162 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
3163 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
3164 CLK(NULL, "fdif_fck", &fdif_fck, CK_443X),
3165 CLK(NULL, "fpka_fck", &fpka_fck, CK_443X),
3166 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X),
3167 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_443X),
3168 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X),
3169 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_443X),
3170 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X),
3171 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_443X),
3172 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X),
3173 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_443X),
3174 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X),
3175 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_443X),
3176 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X),
3177 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
3178 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
3179 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
3180 CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
3181 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
3182 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
3183 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
3184 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
3185 CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
3186 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
3187 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
3188 CLK(NULL, "iss_fck", &iss_fck, CK_443X),
3189 CLK(NULL, "iva_fck", &iva_fck, CK_443X),
3190 CLK(NULL, "kbd_fck", &kbd_fck, CK_443X),
3191 CLK(NULL, "l3_instr_ick", &l3_instr_ick, CK_443X),
3192 CLK(NULL, "l3_main_3_ick", &l3_main_3_ick, CK_443X),
3193 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
3194 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
3195 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
3196 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
3197 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
3198 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
3199 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
3200 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
3201 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
3202 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
3203 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
3204 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
3205 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
3206 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
3207 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
3208 CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
3209 CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
3210 CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
3211 CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
3212 CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
3213 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
3214 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
3215 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
3216 CLK(NULL, "rng_ick", &rng_ick, CK_443X),
3217 CLK("omap_rng", "ick", &rng_ick, CK_443X),
3218 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
3219 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
3220 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
3221 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
3222 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X),
3223 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X),
3224 CLK(NULL, "slimbus1_fck", &slimbus1_fck, CK_443X),
3225 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X),
3226 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X),
3227 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X),
3228 CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X),
3229 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
3230 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
3231 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
3232 CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
3233 CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
3234 CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
3235 CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
3236 CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
3237 CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
3238 CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
3239 CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
3240 CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
3241 CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
3242 CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
3243 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
3244 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
3245 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
3246 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
3247 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
3248 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
3249 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
3250 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
3251 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
3252 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X),
3253 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X),
3254 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X),
3255 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X),
3256 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
3257 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
3258 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
3259 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
3260 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
3261 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
3262 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
3263 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
3264 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
3265 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
3266 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
3267 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
3268 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
3269 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
3270 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3271 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3272 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
3273 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
3274 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
3275 CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
3276 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
3277 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
3278 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
3279 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
3280 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
3281 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
3282 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
3283 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
3284 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
3285 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
3286 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
3287 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
3288 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
3289 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
3290 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
3291 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
3292 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
3293 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
3294 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
3295 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
3296 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
3297 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
3298 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
3299 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
3300 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
3301 CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X),
3302 CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X),
3303 CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X),
3304 CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X),
3305 CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X),
3306 CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X),
3307 CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X),
3308 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X),
3309 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X),
3310 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X),
3311 CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X),
3312 CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X),
3313 CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X),
3314 CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X),
3315 CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X),
3316 CLK(NULL, "uart1_ick", &dummy_ck, CK_443X),
3317 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
3318 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
3319 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
3320 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
3321 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
3322 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
3323 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
3324 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
3325 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
3326 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3327 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3328 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3329 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3330 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3331 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3332 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3333 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3334 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3335 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3336 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3337 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3338 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3339 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3340 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3341 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3342 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3343 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3344 CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3345 CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3346 CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3347 CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3348 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
3349};
3350
3351int __init omap4xxx_clk_init(void)
3352{
3353 struct omap_clk *c;
3354 u32 cpu_clkflg;
3355
3356 if (cpu_is_omap443x()) {
3357 cpu_mask = RATE_IN_4430;
3358 cpu_clkflg = CK_443X;
3359 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
3360 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
3361 cpu_clkflg = CK_446X | CK_443X;
3362
3363 if (cpu_is_omap447x())
3364 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
3365 } else {
3366 return 0;
3367 }
3368
3369 clk_init(&omap2_clk_functions);
3370
3371 /*
3372 * Must stay commented until all OMAP SoC drivers are
3373 * converted to runtime PM, or drivers may start crashing
3374 *
3375 * omap2_clk_disable_clkdm_control();
3376 */
3377
3378 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
3379 c++)
3380 clk_preinit(c->lk.clk);
3381
3382 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
3383 c++)
3384 if (c->cpu & cpu_clkflg) {
3385 clkdev_add(&c->lk);
3386 clk_register(c->lk.clk);
3387 omap2_init_clk_clkdm(c->lk.clk);
3388 }
3389
3390 /* Disable autoidle on all clocks; let the PM code enable it later */
3391 omap_clk_disable_autoidle_all();
3392
3393 recalculate_root_clocks();
3394
3395 /*
3396 * Only enable those clocks we will need, let the drivers
3397 * enable other clocks as necessary
3398 */
3399 clk_enable_init_clocks();
3400
3401 return 0;
3402}
diff --git a/arch/arm/mach-omap2/clock_common_data.c b/arch/arm/mach-omap2/clock_common_data.c
index b9f3ba68148..ef4d21bfb96 100644
--- a/arch/arm/mach-omap2/clock_common_data.c
+++ b/arch/arm/mach-omap2/clock_common_data.c
@@ -16,6 +16,7 @@
16 * OMAP3xxx clock definition files. 16 * OMAP3xxx clock definition files.
17 */ 17 */
18 18
19#include <linux/clk-private.h>
19#include "clock.h" 20#include "clock.h"
20 21
21/* clksel_rate data common to 24xx/343x */ 22/* clksel_rate data common to 24xx/343x */
@@ -52,6 +53,13 @@ const struct clksel_rate div_1_0_rates[] = {
52 { .div = 0 }, 53 { .div = 0 },
53}; 54};
54 55
56const struct clksel_rate div3_1to4_rates[] = {
57 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
58 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
59 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
60 { .div = 0 },
61};
62
55const struct clksel_rate div_1_1_rates[] = { 63const struct clksel_rate div_1_1_rates[] = {
56 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX }, 64 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
57 { .div = 0 }, 65 { .div = 0 },
@@ -109,14 +117,10 @@ const struct clksel_rate div31_1to31_rates[] = {
109 117
110/* Clocks shared between various OMAP SoCs */ 118/* Clocks shared between various OMAP SoCs */
111 119
112struct clk virt_19200000_ck = { 120static struct clk_ops dummy_ck_ops = {};
113 .name = "virt_19200000_ck",
114 .ops = &clkops_null,
115 .rate = 19200000,
116};
117 121
118struct clk virt_26000000_ck = { 122struct clk dummy_ck = {
119 .name = "virt_26000000_ck", 123 .name = "dummy_clk",
120 .ops = &clkops_null, 124 .ops = &dummy_ck_ops,
121 .rate = 26000000, 125 .flags = CLK_IS_BASIC,
122}; 126};
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 512e79a842c..384873580b2 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -22,12 +22,14 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/limits.h> 23#include <linux/limits.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/clk-provider.h>
25 26
26#include <linux/io.h> 27#include <linux/io.h>
27 28
28#include <linux/bitops.h> 29#include <linux/bitops.h>
29 30
30#include <plat/clock.h> 31#include "soc.h"
32#include "clock.h"
31#include "clockdomain.h" 33#include "clockdomain.h"
32 34
33/* clkdm_list contains all registered struct clockdomains */ 35/* clkdm_list contains all registered struct clockdomains */
@@ -946,35 +948,6 @@ static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
946 return 0; 948 return 0;
947} 949}
948 950
949static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
950{
951 unsigned long flags;
952
953 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
954 return -EINVAL;
955
956 spin_lock_irqsave(&clkdm->lock, flags);
957
958 if (atomic_read(&clkdm->usecount) == 0) {
959 spin_unlock_irqrestore(&clkdm->lock, flags);
960 WARN_ON(1); /* underflow */
961 return -ERANGE;
962 }
963
964 if (atomic_dec_return(&clkdm->usecount) > 0) {
965 spin_unlock_irqrestore(&clkdm->lock, flags);
966 return 0;
967 }
968
969 arch_clkdm->clkdm_clk_disable(clkdm);
970 pwrdm_state_switch(clkdm->pwrdm.ptr);
971 spin_unlock_irqrestore(&clkdm->lock, flags);
972
973 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
974
975 return 0;
976}
977
978/** 951/**
979 * clkdm_clk_enable - add an enabled downstream clock to this clkdm 952 * clkdm_clk_enable - add an enabled downstream clock to this clkdm
980 * @clkdm: struct clockdomain * 953 * @clkdm: struct clockdomain *
@@ -1017,15 +990,37 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
1017 */ 990 */
1018int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) 991int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1019{ 992{
1020 /* 993 unsigned long flags;
1021 * XXX Rewrite this code to maintain a list of enabled
1022 * downstream clocks for debugging purposes?
1023 */
1024 994
1025 if (!clk) 995 if (!clkdm || !clk || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
1026 return -EINVAL; 996 return -EINVAL;
1027 997
1028 return _clkdm_clk_hwmod_disable(clkdm); 998 spin_lock_irqsave(&clkdm->lock, flags);
999
1000 /* corner case: disabling unused clocks */
1001 if (__clk_get_enable_count(clk) == 0)
1002 goto ccd_exit;
1003
1004 if (atomic_read(&clkdm->usecount) == 0) {
1005 spin_unlock_irqrestore(&clkdm->lock, flags);
1006 WARN_ON(1); /* underflow */
1007 return -ERANGE;
1008 }
1009
1010 if (atomic_dec_return(&clkdm->usecount) > 0) {
1011 spin_unlock_irqrestore(&clkdm->lock, flags);
1012 return 0;
1013 }
1014
1015 arch_clkdm->clkdm_clk_disable(clkdm);
1016 pwrdm_state_switch(clkdm->pwrdm.ptr);
1017
1018 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
1019
1020ccd_exit:
1021 spin_unlock_irqrestore(&clkdm->lock, flags);
1022
1023 return 0;
1029} 1024}
1030 1025
1031/** 1026/**
@@ -1076,6 +1071,8 @@ int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1076 */ 1071 */
1077int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh) 1072int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1078{ 1073{
1074 unsigned long flags;
1075
1079 /* The clkdm attribute does not exist yet prior OMAP4 */ 1076 /* The clkdm attribute does not exist yet prior OMAP4 */
1080 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1077 if (cpu_is_omap24xx() || cpu_is_omap34xx())
1081 return 0; 1078 return 0;
@@ -1085,9 +1082,28 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1085 * downstream hwmods for debugging purposes? 1082 * downstream hwmods for debugging purposes?
1086 */ 1083 */
1087 1084
1088 if (!oh) 1085 if (!clkdm || !oh || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
1089 return -EINVAL; 1086 return -EINVAL;
1090 1087
1091 return _clkdm_clk_hwmod_disable(clkdm); 1088 spin_lock_irqsave(&clkdm->lock, flags);
1089
1090 if (atomic_read(&clkdm->usecount) == 0) {
1091 spin_unlock_irqrestore(&clkdm->lock, flags);
1092 WARN_ON(1); /* underflow */
1093 return -ERANGE;
1094 }
1095
1096 if (atomic_dec_return(&clkdm->usecount) > 0) {
1097 spin_unlock_irqrestore(&clkdm->lock, flags);
1098 return 0;
1099 }
1100
1101 arch_clkdm->clkdm_clk_disable(clkdm);
1102 pwrdm_state_switch(clkdm->pwrdm.ptr);
1103 spin_unlock_irqrestore(&clkdm->lock, flags);
1104
1105 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
1106
1107 return 0;
1092} 1108}
1093 1109
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 629576be744..bc42446e23a 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -18,9 +18,8 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19 19
20#include "powerdomain.h" 20#include "powerdomain.h"
21#include <plat/clock.h> 21#include "clock.h"
22#include <plat/omap_hwmod.h> 22#include "omap_hwmod.h"
23#include <plat/cpu.h>
24 23
25/* 24/*
26 * Clockdomain flags 25 * Clockdomain flags
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
deleted file mode 100644
index 70294f54e35..00000000000
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ /dev/null
@@ -1,339 +0,0 @@
1/*
2 * OMAP2 and OMAP3 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/types.h>
16#include <plat/prcm.h>
17#include "prm.h"
18#include "prm2xxx_3xxx.h"
19#include "cm.h"
20#include "cm2xxx_3xxx.h"
21#include "cm-regbits-24xx.h"
22#include "cm-regbits-34xx.h"
23#include "prm-regbits-24xx.h"
24#include "clockdomain.h"
25
26static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
27 struct clockdomain *clkdm2)
28{
29 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
30 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
31 return 0;
32}
33
34static int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
35 struct clockdomain *clkdm2)
36{
37 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
38 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
39 return 0;
40}
41
42static int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
43 struct clockdomain *clkdm2)
44{
45 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
46 PM_WKDEP, (1 << clkdm2->dep_bit));
47}
48
49static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
50{
51 struct clkdm_dep *cd;
52 u32 mask = 0;
53
54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
55 if (!cd->clkdm)
56 continue; /* only happens if data is erroneous */
57
58 /* PRM accesses are slow, so minimize them */
59 mask |= 1 << cd->clkdm->dep_bit;
60 atomic_set(&cd->wkdep_usecount, 0);
61 }
62
63 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
64 PM_WKDEP);
65 return 0;
66}
67
68static int omap3_clkdm_add_sleepdep(struct clockdomain *clkdm1,
69 struct clockdomain *clkdm2)
70{
71 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
72 clkdm1->pwrdm.ptr->prcm_offs,
73 OMAP3430_CM_SLEEPDEP);
74 return 0;
75}
76
77static int omap3_clkdm_del_sleepdep(struct clockdomain *clkdm1,
78 struct clockdomain *clkdm2)
79{
80 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
81 clkdm1->pwrdm.ptr->prcm_offs,
82 OMAP3430_CM_SLEEPDEP);
83 return 0;
84}
85
86static int omap3_clkdm_read_sleepdep(struct clockdomain *clkdm1,
87 struct clockdomain *clkdm2)
88{
89 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
90 OMAP3430_CM_SLEEPDEP, (1 << clkdm2->dep_bit));
91}
92
93static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
94{
95 struct clkdm_dep *cd;
96 u32 mask = 0;
97
98 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
99 if (!cd->clkdm)
100 continue; /* only happens if data is erroneous */
101
102 /* PRM accesses are slow, so minimize them */
103 mask |= 1 << cd->clkdm->dep_bit;
104 atomic_set(&cd->sleepdep_usecount, 0);
105 }
106 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
107 OMAP3430_CM_SLEEPDEP);
108 return 0;
109}
110
111static int omap2_clkdm_sleep(struct clockdomain *clkdm)
112{
113 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
114 clkdm->pwrdm.ptr->prcm_offs,
115 OMAP2_PM_PWSTCTRL);
116 return 0;
117}
118
119static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
120{
121 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
122 clkdm->pwrdm.ptr->prcm_offs,
123 OMAP2_PM_PWSTCTRL);
124 return 0;
125}
126
127static void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
128{
129 if (atomic_read(&clkdm->usecount) > 0)
130 _clkdm_add_autodeps(clkdm);
131
132 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
133 clkdm->clktrctrl_mask);
134}
135
136static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
137{
138 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
139 clkdm->clktrctrl_mask);
140
141 if (atomic_read(&clkdm->usecount) > 0)
142 _clkdm_del_autodeps(clkdm);
143}
144
145static void _enable_hwsup(struct clockdomain *clkdm)
146{
147 if (cpu_is_omap24xx())
148 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
149 clkdm->clktrctrl_mask);
150 else if (cpu_is_omap34xx())
151 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
152 clkdm->clktrctrl_mask);
153}
154
155static void _disable_hwsup(struct clockdomain *clkdm)
156{
157 if (cpu_is_omap24xx())
158 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
159 clkdm->clktrctrl_mask);
160 else if (cpu_is_omap34xx())
161 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
162 clkdm->clktrctrl_mask);
163}
164
165static int omap3_clkdm_sleep(struct clockdomain *clkdm)
166{
167 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
168 clkdm->clktrctrl_mask);
169 return 0;
170}
171
172static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
173{
174 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
175 clkdm->clktrctrl_mask);
176 return 0;
177}
178
179static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
180{
181 bool hwsup = false;
182
183 if (!clkdm->clktrctrl_mask)
184 return 0;
185
186 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
187 clkdm->clktrctrl_mask);
188
189 if (hwsup) {
190 /* Disable HW transitions when we are changing deps */
191 _disable_hwsup(clkdm);
192 _clkdm_add_autodeps(clkdm);
193 _enable_hwsup(clkdm);
194 } else {
195 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
196 omap2_clkdm_wakeup(clkdm);
197 }
198
199 return 0;
200}
201
202static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
203{
204 bool hwsup = false;
205
206 if (!clkdm->clktrctrl_mask)
207 return 0;
208
209 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
210 clkdm->clktrctrl_mask);
211
212 if (hwsup) {
213 /* Disable HW transitions when we are changing deps */
214 _disable_hwsup(clkdm);
215 _clkdm_del_autodeps(clkdm);
216 _enable_hwsup(clkdm);
217 } else {
218 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
219 omap2_clkdm_sleep(clkdm);
220 }
221
222 return 0;
223}
224
225static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
226{
227 if (atomic_read(&clkdm->usecount) > 0)
228 _clkdm_add_autodeps(clkdm);
229
230 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
231 clkdm->clktrctrl_mask);
232}
233
234static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
235{
236 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
237 clkdm->clktrctrl_mask);
238
239 if (atomic_read(&clkdm->usecount) > 0)
240 _clkdm_del_autodeps(clkdm);
241}
242
243static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
244{
245 bool hwsup = false;
246
247 if (!clkdm->clktrctrl_mask)
248 return 0;
249
250 /*
251 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
252 * more details on the unpleasant problem this is working
253 * around
254 */
255 if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
256 (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
257 omap3_clkdm_wakeup(clkdm);
258 return 0;
259 }
260
261 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
262 clkdm->clktrctrl_mask);
263
264 if (hwsup) {
265 /* Disable HW transitions when we are changing deps */
266 _disable_hwsup(clkdm);
267 _clkdm_add_autodeps(clkdm);
268 _enable_hwsup(clkdm);
269 } else {
270 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
271 omap3_clkdm_wakeup(clkdm);
272 }
273
274 return 0;
275}
276
277static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
278{
279 bool hwsup = false;
280
281 if (!clkdm->clktrctrl_mask)
282 return 0;
283
284 /*
285 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
286 * more details on the unpleasant problem this is working
287 * around
288 */
289 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
290 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
291 _enable_hwsup(clkdm);
292 return 0;
293 }
294
295 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
296 clkdm->clktrctrl_mask);
297
298 if (hwsup) {
299 /* Disable HW transitions when we are changing deps */
300 _disable_hwsup(clkdm);
301 _clkdm_del_autodeps(clkdm);
302 _enable_hwsup(clkdm);
303 } else {
304 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
305 omap3_clkdm_sleep(clkdm);
306 }
307
308 return 0;
309}
310
311struct clkdm_ops omap2_clkdm_operations = {
312 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
313 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
314 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
315 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
316 .clkdm_sleep = omap2_clkdm_sleep,
317 .clkdm_wakeup = omap2_clkdm_wakeup,
318 .clkdm_allow_idle = omap2_clkdm_allow_idle,
319 .clkdm_deny_idle = omap2_clkdm_deny_idle,
320 .clkdm_clk_enable = omap2_clkdm_clk_enable,
321 .clkdm_clk_disable = omap2_clkdm_clk_disable,
322};
323
324struct clkdm_ops omap3_clkdm_operations = {
325 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
326 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
327 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
328 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
329 .clkdm_add_sleepdep = omap3_clkdm_add_sleepdep,
330 .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep,
331 .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep,
332 .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps,
333 .clkdm_sleep = omap3_clkdm_sleep,
334 .clkdm_wakeup = omap3_clkdm_wakeup,
335 .clkdm_allow_idle = omap3_clkdm_allow_idle,
336 .clkdm_deny_idle = omap3_clkdm_deny_idle,
337 .clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
338 .clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
339};
diff --git a/arch/arm/mach-omap2/clockdomain33xx.c b/arch/arm/mach-omap2/clockdomain33xx.c
deleted file mode 100644
index aca6388fad7..00000000000
--- a/arch/arm/mach-omap2/clockdomain33xx.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * AM33XX clockdomain control
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * Derived from mach-omap2/clockdomain44xx.c written by Rajendra Nayak
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20
21#include "clockdomain.h"
22#include "cm33xx.h"
23
24
25static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
26{
27 am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
28 return 0;
29}
30
31static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
32{
33 am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
34 return 0;
35}
36
37static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
38{
39 am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
40}
41
42static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
43{
44 am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
45}
46
47static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
48{
49 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
50 return am33xx_clkdm_wakeup(clkdm);
51
52 return 0;
53}
54
55static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
56{
57 bool hwsup = false;
58
59 hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
60
61 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
62 am33xx_clkdm_sleep(clkdm);
63
64 return 0;
65}
66
67struct clkdm_ops am33xx_clkdm_operations = {
68 .clkdm_sleep = am33xx_clkdm_sleep,
69 .clkdm_wakeup = am33xx_clkdm_wakeup,
70 .clkdm_allow_idle = am33xx_clkdm_allow_idle,
71 .clkdm_deny_idle = am33xx_clkdm_deny_idle,
72 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
73 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
74};
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
deleted file mode 100644
index 6fc6155625b..00000000000
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * OMAP4 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include "clockdomain.h"
17#include "cminst44xx.h"
18#include "cm44xx.h"
19
20static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
21 struct clockdomain *clkdm2)
22{
23 omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
24 clkdm1->prcm_partition,
25 clkdm1->cm_inst, clkdm1->clkdm_offs +
26 OMAP4_CM_STATICDEP);
27 return 0;
28}
29
30static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
31 struct clockdomain *clkdm2)
32{
33 omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
34 clkdm1->prcm_partition,
35 clkdm1->cm_inst, clkdm1->clkdm_offs +
36 OMAP4_CM_STATICDEP);
37 return 0;
38}
39
40static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
41 struct clockdomain *clkdm2)
42{
43 return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
44 clkdm1->cm_inst, clkdm1->clkdm_offs +
45 OMAP4_CM_STATICDEP,
46 (1 << clkdm2->dep_bit));
47}
48
49static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
50{
51 struct clkdm_dep *cd;
52 u32 mask = 0;
53
54 if (!clkdm->prcm_partition)
55 return 0;
56
57 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
58 if (!cd->clkdm)
59 continue; /* only happens if data is erroneous */
60
61 mask |= 1 << cd->clkdm->dep_bit;
62 atomic_set(&cd->wkdep_usecount, 0);
63 }
64
65 omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
66 clkdm->cm_inst, clkdm->clkdm_offs +
67 OMAP4_CM_STATICDEP);
68 return 0;
69}
70
71static int omap4_clkdm_sleep(struct clockdomain *clkdm)
72{
73 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
74 clkdm->cm_inst, clkdm->clkdm_offs);
75 return 0;
76}
77
78static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
79{
80 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
81 clkdm->cm_inst, clkdm->clkdm_offs);
82 return 0;
83}
84
85static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
86{
87 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
88 clkdm->cm_inst, clkdm->clkdm_offs);
89}
90
91static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
92{
93 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
94 omap4_clkdm_wakeup(clkdm);
95 else
96 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
97 clkdm->cm_inst,
98 clkdm->clkdm_offs);
99}
100
101static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
102{
103 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
104 return omap4_clkdm_wakeup(clkdm);
105
106 return 0;
107}
108
109static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
110{
111 bool hwsup = false;
112
113 if (!clkdm->prcm_partition)
114 return 0;
115
116 /*
117 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
118 * more details on the unpleasant problem this is working
119 * around
120 */
121 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
122 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
123 omap4_clkdm_allow_idle(clkdm);
124 return 0;
125 }
126
127 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
128 clkdm->cm_inst, clkdm->clkdm_offs);
129
130 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
131 omap4_clkdm_sleep(clkdm);
132
133 return 0;
134}
135
136struct clkdm_ops omap4_clkdm_operations = {
137 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
138 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
139 .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
140 .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
141 .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
142 .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
143 .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
144 .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
145 .clkdm_sleep = omap4_clkdm_sleep,
146 .clkdm_wakeup = omap4_clkdm_wakeup,
147 .clkdm_allow_idle = omap4_clkdm_allow_idle,
148 .clkdm_deny_idle = omap4_clkdm_deny_idle,
149 .clkdm_clk_enable = omap4_clkdm_clk_enable,
150 .clkdm_clk_disable = omap4_clkdm_clk_disable,
151};
diff --git a/arch/arm/mach-omap2/clockdomains2420_data.c b/arch/arm/mach-omap2/clockdomains2420_data.c
index 5c741852fac..7e76becf3a4 100644
--- a/arch/arm/mach-omap2/clockdomains2420_data.c
+++ b/arch/arm/mach-omap2/clockdomains2420_data.c
@@ -35,6 +35,7 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/io.h> 36#include <linux/io.h>
37 37
38#include "soc.h"
38#include "clockdomain.h" 39#include "clockdomain.h"
39#include "prm2xxx_3xxx.h" 40#include "prm2xxx_3xxx.h"
40#include "cm2xxx_3xxx.h" 41#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clockdomains2430_data.c b/arch/arm/mach-omap2/clockdomains2430_data.c
index f09617555e1..b923007e45d 100644
--- a/arch/arm/mach-omap2/clockdomains2430_data.c
+++ b/arch/arm/mach-omap2/clockdomains2430_data.c
@@ -35,6 +35,7 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/io.h> 36#include <linux/io.h>
37 37
38#include "soc.h"
38#include "clockdomain.h" 39#include "clockdomain.h"
39#include "prm2xxx_3xxx.h" 40#include "prm2xxx_3xxx.h"
40#include "cm2xxx_3xxx.h" 41#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c
index 933a35cd124..e6b91e552d3 100644
--- a/arch/arm/mach-omap2/clockdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c
@@ -33,6 +33,7 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/io.h> 34#include <linux/io.h>
35 35
36#include "soc.h"
36#include "clockdomain.h" 37#include "clockdomain.h"
37#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
38#include "cm2xxx_3xxx.h" 39#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h
index 68629043756..669ef51b17a 100644
--- a/arch/arm/mach-omap2/cm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-24xx.h
@@ -59,6 +59,7 @@
59/* CM_CLKSEL_MPU */ 59/* CM_CLKSEL_MPU */
60#define OMAP24XX_CLKSEL_MPU_SHIFT 0 60#define OMAP24XX_CLKSEL_MPU_SHIFT 0
61#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0) 61#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0)
62#define OMAP24XX_CLKSEL_MPU_WIDTH 5
62 63
63/* CM_CLKSTCTRL_MPU */ 64/* CM_CLKSTCTRL_MPU */
64#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0 65#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0
@@ -237,8 +238,10 @@
237#define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8) 238#define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8)
238#define OMAP24XX_CLKSEL_L4_SHIFT 5 239#define OMAP24XX_CLKSEL_L4_SHIFT 5
239#define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5) 240#define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5)
241#define OMAP24XX_CLKSEL_L4_WIDTH 2
240#define OMAP24XX_CLKSEL_L3_SHIFT 0 242#define OMAP24XX_CLKSEL_L3_SHIFT 0
241#define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0) 243#define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0)
244#define OMAP24XX_CLKSEL_L3_WIDTH 5
242 245
243/* CM_CLKSEL2_CORE */ 246/* CM_CLKSEL2_CORE */
244#define OMAP24XX_CLKSEL_GPT12_SHIFT 22 247#define OMAP24XX_CLKSEL_GPT12_SHIFT 22
@@ -333,7 +336,9 @@
333#define OMAP24XX_EN_DPLL_MASK (0x3 << 0) 336#define OMAP24XX_EN_DPLL_MASK (0x3 << 0)
334 337
335/* CM_IDLEST_CKGEN */ 338/* CM_IDLEST_CKGEN */
339#define OMAP24XX_ST_54M_APLL_SHIFT 9
336#define OMAP24XX_ST_54M_APLL_MASK (1 << 9) 340#define OMAP24XX_ST_54M_APLL_MASK (1 << 9)
341#define OMAP24XX_ST_96M_APLL_SHIFT 8
337#define OMAP24XX_ST_96M_APLL_MASK (1 << 8) 342#define OMAP24XX_ST_96M_APLL_MASK (1 << 8)
338#define OMAP24XX_ST_54M_CLK_MASK (1 << 6) 343#define OMAP24XX_ST_54M_CLK_MASK (1 << 6)
339#define OMAP24XX_ST_12M_CLK_MASK (1 << 5) 344#define OMAP24XX_ST_12M_CLK_MASK (1 << 5)
@@ -361,8 +366,10 @@
361#define OMAP24XX_DPLL_DIV_MASK (0xf << 8) 366#define OMAP24XX_DPLL_DIV_MASK (0xf << 8)
362#define OMAP24XX_54M_SOURCE_SHIFT 5 367#define OMAP24XX_54M_SOURCE_SHIFT 5
363#define OMAP24XX_54M_SOURCE_MASK (1 << 5) 368#define OMAP24XX_54M_SOURCE_MASK (1 << 5)
369#define OMAP24XX_54M_SOURCE_WIDTH 1
364#define OMAP2430_96M_SOURCE_SHIFT 4 370#define OMAP2430_96M_SOURCE_SHIFT 4
365#define OMAP2430_96M_SOURCE_MASK (1 << 4) 371#define OMAP2430_96M_SOURCE_MASK (1 << 4)
372#define OMAP2430_96M_SOURCE_WIDTH 1
366#define OMAP24XX_48M_SOURCE_SHIFT 3 373#define OMAP24XX_48M_SOURCE_SHIFT 3
367#define OMAP24XX_48M_SOURCE_MASK (1 << 3) 374#define OMAP24XX_48M_SOURCE_MASK (1 << 3)
368#define OMAP2430_ALTCLK_SOURCE_SHIFT 0 375#define OMAP2430_ALTCLK_SOURCE_SHIFT 0
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 59598ffd878..adf78d32580 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -81,6 +81,7 @@
81/* CM_CLKSEL1_PLL_IVA2 */ 81/* CM_CLKSEL1_PLL_IVA2 */
82#define OMAP3430_IVA2_CLK_SRC_SHIFT 19 82#define OMAP3430_IVA2_CLK_SRC_SHIFT 19
83#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19) 83#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19)
84#define OMAP3430_IVA2_CLK_SRC_WIDTH 3
84#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8 85#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8
85#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8) 86#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8)
86#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0 87#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0
@@ -89,6 +90,7 @@
89/* CM_CLKSEL2_PLL_IVA2 */ 90/* CM_CLKSEL2_PLL_IVA2 */
90#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0 91#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0
91#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 92#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
93#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH 5
92 94
93/* CM_CLKSTCTRL_IVA2 */ 95/* CM_CLKSTCTRL_IVA2 */
94#define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0 96#define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0
@@ -118,6 +120,7 @@
118/* CM_IDLEST_PLL_MPU */ 120/* CM_IDLEST_PLL_MPU */
119#define OMAP3430_ST_MPU_CLK_SHIFT 0 121#define OMAP3430_ST_MPU_CLK_SHIFT 0
120#define OMAP3430_ST_MPU_CLK_MASK (1 << 0) 122#define OMAP3430_ST_MPU_CLK_MASK (1 << 0)
123#define OMAP3430_ST_MPU_CLK_WIDTH 1
121 124
122/* CM_AUTOIDLE_PLL_MPU */ 125/* CM_AUTOIDLE_PLL_MPU */
123#define OMAP3430_AUTO_MPU_DPLL_SHIFT 0 126#define OMAP3430_AUTO_MPU_DPLL_SHIFT 0
@@ -126,6 +129,7 @@
126/* CM_CLKSEL1_PLL_MPU */ 129/* CM_CLKSEL1_PLL_MPU */
127#define OMAP3430_MPU_CLK_SRC_SHIFT 19 130#define OMAP3430_MPU_CLK_SRC_SHIFT 19
128#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19) 131#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19)
132#define OMAP3430_MPU_CLK_SRC_WIDTH 3
129#define OMAP3430_MPU_DPLL_MULT_SHIFT 8 133#define OMAP3430_MPU_DPLL_MULT_SHIFT 8
130#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8) 134#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8)
131#define OMAP3430_MPU_DPLL_DIV_SHIFT 0 135#define OMAP3430_MPU_DPLL_DIV_SHIFT 0
@@ -134,6 +138,7 @@
134/* CM_CLKSEL2_PLL_MPU */ 138/* CM_CLKSEL2_PLL_MPU */
135#define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0 139#define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0
136#define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 140#define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
141#define OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH 5
137 142
138/* CM_CLKSTCTRL_MPU */ 143/* CM_CLKSTCTRL_MPU */
139#define OMAP3430_CLKTRCTRL_MPU_SHIFT 0 144#define OMAP3430_CLKTRCTRL_MPU_SHIFT 0
@@ -345,10 +350,13 @@
345#define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4) 350#define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4)
346#define OMAP3430_CLKSEL_L4_SHIFT 2 351#define OMAP3430_CLKSEL_L4_SHIFT 2
347#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2) 352#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2)
353#define OMAP3430_CLKSEL_L4_WIDTH 2
348#define OMAP3430_CLKSEL_L3_SHIFT 0 354#define OMAP3430_CLKSEL_L3_SHIFT 0
349#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0) 355#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0)
356#define OMAP3430_CLKSEL_L3_WIDTH 2
350#define OMAP3630_CLKSEL_96M_SHIFT 12 357#define OMAP3630_CLKSEL_96M_SHIFT 12
351#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12) 358#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12)
359#define OMAP3630_CLKSEL_96M_WIDTH 2
352 360
353/* CM_CLKSTCTRL_CORE */ 361/* CM_CLKSTCTRL_CORE */
354#define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4 362#define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4
@@ -452,6 +460,7 @@
452#define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3) 460#define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3)
453#define OMAP3430_CLKSEL_RM_SHIFT 1 461#define OMAP3430_CLKSEL_RM_SHIFT 1
454#define OMAP3430_CLKSEL_RM_MASK (0x3 << 1) 462#define OMAP3430_CLKSEL_RM_MASK (0x3 << 1)
463#define OMAP3430_CLKSEL_RM_WIDTH 2
455#define OMAP3430_CLKSEL_GPT1_SHIFT 0 464#define OMAP3430_CLKSEL_GPT1_SHIFT 0
456#define OMAP3430_CLKSEL_GPT1_MASK (1 << 0) 465#define OMAP3430_CLKSEL_GPT1_MASK (1 << 0)
457 466
@@ -520,14 +529,17 @@
520/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */ 529/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */
521#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27 530#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27
522#define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27) 531#define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27)
532#define OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH 5
523#define OMAP3430_CORE_DPLL_MULT_SHIFT 16 533#define OMAP3430_CORE_DPLL_MULT_SHIFT 16
524#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16) 534#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16)
525#define OMAP3430_CORE_DPLL_DIV_SHIFT 8 535#define OMAP3430_CORE_DPLL_DIV_SHIFT 8
526#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8) 536#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8)
527#define OMAP3430_SOURCE_96M_SHIFT 6 537#define OMAP3430_SOURCE_96M_SHIFT 6
528#define OMAP3430_SOURCE_96M_MASK (1 << 6) 538#define OMAP3430_SOURCE_96M_MASK (1 << 6)
539#define OMAP3430_SOURCE_96M_WIDTH 1
529#define OMAP3430_SOURCE_54M_SHIFT 5 540#define OMAP3430_SOURCE_54M_SHIFT 5
530#define OMAP3430_SOURCE_54M_MASK (1 << 5) 541#define OMAP3430_SOURCE_54M_MASK (1 << 5)
542#define OMAP3430_SOURCE_54M_WIDTH 1
531#define OMAP3430_SOURCE_48M_SHIFT 3 543#define OMAP3430_SOURCE_48M_SHIFT 3
532#define OMAP3430_SOURCE_48M_MASK (1 << 3) 544#define OMAP3430_SOURCE_48M_MASK (1 << 3)
533 545
@@ -545,7 +557,9 @@
545/* CM_CLKSEL3_PLL */ 557/* CM_CLKSEL3_PLL */
546#define OMAP3430_DIV_96M_SHIFT 0 558#define OMAP3430_DIV_96M_SHIFT 0
547#define OMAP3430_DIV_96M_MASK (0x1f << 0) 559#define OMAP3430_DIV_96M_MASK (0x1f << 0)
560#define OMAP3430_DIV_96M_WIDTH 5
548#define OMAP3630_DIV_96M_MASK (0x3f << 0) 561#define OMAP3630_DIV_96M_MASK (0x3f << 0)
562#define OMAP3630_DIV_96M_WIDTH 6
549 563
550/* CM_CLKSEL4_PLL */ 564/* CM_CLKSEL4_PLL */
551#define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8 565#define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8
@@ -556,12 +570,14 @@
556/* CM_CLKSEL5_PLL */ 570/* CM_CLKSEL5_PLL */
557#define OMAP3430ES2_DIV_120M_SHIFT 0 571#define OMAP3430ES2_DIV_120M_SHIFT 0
558#define OMAP3430ES2_DIV_120M_MASK (0x1f << 0) 572#define OMAP3430ES2_DIV_120M_MASK (0x1f << 0)
573#define OMAP3430ES2_DIV_120M_WIDTH 5
559 574
560/* CM_CLKOUT_CTRL */ 575/* CM_CLKOUT_CTRL */
561#define OMAP3430_CLKOUT2_EN_SHIFT 7 576#define OMAP3430_CLKOUT2_EN_SHIFT 7
562#define OMAP3430_CLKOUT2_EN_MASK (1 << 7) 577#define OMAP3430_CLKOUT2_EN_MASK (1 << 7)
563#define OMAP3430_CLKOUT2_DIV_SHIFT 3 578#define OMAP3430_CLKOUT2_DIV_SHIFT 3
564#define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3) 579#define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3)
580#define OMAP3430_CLKOUT2_DIV_WIDTH 3
565#define OMAP3430_CLKOUT2SOURCE_SHIFT 0 581#define OMAP3430_CLKOUT2SOURCE_SHIFT 0
566#define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0) 582#define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0)
567 583
@@ -592,10 +608,14 @@
592/* CM_CLKSEL_DSS */ 608/* CM_CLKSEL_DSS */
593#define OMAP3430_CLKSEL_TV_SHIFT 8 609#define OMAP3430_CLKSEL_TV_SHIFT 8
594#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8) 610#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8)
611#define OMAP3430_CLKSEL_TV_WIDTH 5
595#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8) 612#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8)
613#define OMAP3630_CLKSEL_TV_WIDTH 6
596#define OMAP3430_CLKSEL_DSS1_SHIFT 0 614#define OMAP3430_CLKSEL_DSS1_SHIFT 0
597#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0) 615#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0)
616#define OMAP3430_CLKSEL_DSS1_WIDTH 5
598#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0) 617#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0)
618#define OMAP3630_CLKSEL_DSS1_WIDTH 6
599 619
600/* CM_SLEEPDEP_DSS specific bits */ 620/* CM_SLEEPDEP_DSS specific bits */
601 621
@@ -623,7 +643,9 @@
623/* CM_CLKSEL_CAM */ 643/* CM_CLKSEL_CAM */
624#define OMAP3430_CLKSEL_CAM_SHIFT 0 644#define OMAP3430_CLKSEL_CAM_SHIFT 0
625#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0) 645#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0)
646#define OMAP3430_CLKSEL_CAM_WIDTH 5
626#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0) 647#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0)
648#define OMAP3630_CLKSEL_CAM_WIDTH 6
627 649
628/* CM_SLEEPDEP_CAM specific bits */ 650/* CM_SLEEPDEP_CAM specific bits */
629 651
@@ -721,21 +743,30 @@
721/* CM_CLKSEL1_EMU */ 743/* CM_CLKSEL1_EMU */
722#define OMAP3430_DIV_DPLL4_SHIFT 24 744#define OMAP3430_DIV_DPLL4_SHIFT 24
723#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24) 745#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24)
746#define OMAP3430_DIV_DPLL4_WIDTH 5
724#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24) 747#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24)
748#define OMAP3630_DIV_DPLL4_WIDTH 6
725#define OMAP3430_DIV_DPLL3_SHIFT 16 749#define OMAP3430_DIV_DPLL3_SHIFT 16
726#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16) 750#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16)
751#define OMAP3430_DIV_DPLL3_WIDTH 5
727#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11 752#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11
728#define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11) 753#define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11)
754#define OMAP3430_CLKSEL_TRACECLK_WIDTH 3
729#define OMAP3430_CLKSEL_PCLK_SHIFT 8 755#define OMAP3430_CLKSEL_PCLK_SHIFT 8
730#define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8) 756#define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8)
757#define OMAP3430_CLKSEL_PCLK_WIDTH 3
731#define OMAP3430_CLKSEL_PCLKX2_SHIFT 6 758#define OMAP3430_CLKSEL_PCLKX2_SHIFT 6
732#define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6) 759#define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6)
760#define OMAP3430_CLKSEL_PCLKX2_WIDTH 2
733#define OMAP3430_CLKSEL_ATCLK_SHIFT 4 761#define OMAP3430_CLKSEL_ATCLK_SHIFT 4
734#define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4) 762#define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4)
763#define OMAP3430_CLKSEL_ATCLK_WIDTH 2
735#define OMAP3430_TRACE_MUX_CTRL_SHIFT 2 764#define OMAP3430_TRACE_MUX_CTRL_SHIFT 2
736#define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2) 765#define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2)
766#define OMAP3430_TRACE_MUX_CTRL_WIDTH 2
737#define OMAP3430_MUX_CTRL_SHIFT 0 767#define OMAP3430_MUX_CTRL_SHIFT 0
738#define OMAP3430_MUX_CTRL_MASK (0x3 << 0) 768#define OMAP3430_MUX_CTRL_MASK (0x3 << 0)
769#define OMAP3430_MUX_CTRL_WIDTH 2
739 770
740/* CM_CLKSTCTRL_EMU */ 771/* CM_CLKSTCTRL_EMU */
741#define OMAP3430_CLKTRCTRL_EMU_SHIFT 0 772#define OMAP3430_CLKTRCTRL_EMU_SHIFT 0
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index f24e3f7a2bb..93473f9a551 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2+ Clock Management prototypes 2 * OMAP2+ Clock Management prototypes
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -22,6 +22,12 @@
22 */ 22 */
23#define MAX_MODULE_READY_TIME 2000 23#define MAX_MODULE_READY_TIME 2000
24 24
25# ifndef __ASSEMBLER__
26extern void __iomem *cm_base;
27extern void __iomem *cm2_base;
28extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
29# endif
30
25/* 31/*
26 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for 32 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
27 * the PRCM to request that a module enter the inactive state in the 33 * the PRCM to request that a module enter the inactive state in the
@@ -33,4 +39,26 @@
33 */ 39 */
34#define MAX_MODULE_DISABLE_TIME 5000 40#define MAX_MODULE_DISABLE_TIME 5000
35 41
42# ifndef __ASSEMBLER__
43
44/**
45 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
46 * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
47 * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
48 */
49struct cm_ll_data {
50 int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
51 u8 *idlest_reg_id);
52 int (*wait_module_ready)(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
53};
54
55extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
56 u8 *idlest_reg_id);
57extern int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
58
59extern int cm_register(struct cm_ll_data *cld);
60extern int cm_unregister(struct cm_ll_data *cld);
61
62# endif
63
36#endif 64#endif
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
new file mode 100644
index 00000000000..db650690e9d
--- /dev/null
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -0,0 +1,381 @@
1/*
2 * OMAP2xxx CM module functions
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/delay.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/io.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx.h"
25#include "cm.h"
26#include "cm2xxx.h"
27#include "cm-regbits-24xx.h"
28#include "clockdomain.h"
29
30/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
31#define DPLL_AUTOIDLE_DISABLE 0x0
32#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
33
34/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
35#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
36#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
37
38/* CM_IDLEST_PLL bit value offset for APLLs (OMAP2xxx only) */
39#define EN_APLL_LOCKED 3
40
41static const u8 omap2xxx_cm_idlest_offs[] = {
42 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
43};
44
45/*
46 *
47 */
48
49static void _write_clktrctrl(u8 c, s16 module, u32 mask)
50{
51 u32 v;
52
53 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
54 v &= ~mask;
55 v |= c << __ffs(mask);
56 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
57}
58
59bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
60{
61 u32 v;
62
63 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
64 v &= mask;
65 v >>= __ffs(mask);
66
67 return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
68}
69
70void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
71{
72 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
73}
74
75void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
76{
77 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
78}
79
80/*
81 * DPLL autoidle control
82 */
83
84static void _omap2xxx_set_dpll_autoidle(u8 m)
85{
86 u32 v;
87
88 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
89 v &= ~OMAP24XX_AUTO_DPLL_MASK;
90 v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
91 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
92}
93
94void omap2xxx_cm_set_dpll_disable_autoidle(void)
95{
96 _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
97}
98
99void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
100{
101 _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
102}
103
104/*
105 * APLL control
106 */
107
108static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
109{
110 u32 v;
111
112 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
113 v &= ~mask;
114 v |= m << __ffs(mask);
115 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
116}
117
118void omap2xxx_cm_set_apll54_disable_autoidle(void)
119{
120 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
121 OMAP24XX_AUTO_54M_MASK);
122}
123
124void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
125{
126 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
127 OMAP24XX_AUTO_54M_MASK);
128}
129
130void omap2xxx_cm_set_apll96_disable_autoidle(void)
131{
132 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
133 OMAP24XX_AUTO_96M_MASK);
134}
135
136void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
137{
138 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
139 OMAP24XX_AUTO_96M_MASK);
140}
141
142/* Enable an APLL if off */
143static int _omap2xxx_apll_enable(u8 enable_bit, u8 status_bit)
144{
145 u32 v, m;
146
147 m = EN_APLL_LOCKED << enable_bit;
148
149 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
150 if (v & m)
151 return 0; /* apll already enabled */
152
153 v |= m;
154 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
155
156 omap2xxx_cm_wait_module_ready(PLL_MOD, 1, status_bit);
157
158 /*
159 * REVISIT: Should we return an error code if
160 * omap2xxx_cm_wait_module_ready() fails?
161 */
162 return 0;
163}
164
165/* Stop APLL */
166static void _omap2xxx_apll_disable(u8 enable_bit)
167{
168 u32 v;
169
170 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
171 v &= ~(EN_APLL_LOCKED << enable_bit);
172 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
173}
174
175/* Enable an APLL if off */
176int omap2xxx_cm_apll54_enable(void)
177{
178 return _omap2xxx_apll_enable(OMAP24XX_EN_54M_PLL_SHIFT,
179 OMAP24XX_ST_54M_APLL_SHIFT);
180}
181
182/* Enable an APLL if off */
183int omap2xxx_cm_apll96_enable(void)
184{
185 return _omap2xxx_apll_enable(OMAP24XX_EN_96M_PLL_SHIFT,
186 OMAP24XX_ST_96M_APLL_SHIFT);
187}
188
189/* Stop APLL */
190void omap2xxx_cm_apll54_disable(void)
191{
192 _omap2xxx_apll_disable(OMAP24XX_EN_54M_PLL_SHIFT);
193}
194
195/* Stop APLL */
196void omap2xxx_cm_apll96_disable(void)
197{
198 _omap2xxx_apll_disable(OMAP24XX_EN_96M_PLL_SHIFT);
199}
200
201/**
202 * omap2xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
203 * @idlest_reg: CM_IDLEST* virtual address
204 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
205 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
206 *
207 * XXX This function is only needed until absolute register addresses are
208 * removed from the OMAP struct clk records.
209 */
210int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
211 u8 *idlest_reg_id)
212{
213 unsigned long offs;
214 u8 idlest_offs;
215 int i;
216
217 if (idlest_reg < cm_base || idlest_reg > (cm_base + 0x0fff))
218 return -EINVAL;
219
220 idlest_offs = (unsigned long)idlest_reg & 0xff;
221 for (i = 0; i < ARRAY_SIZE(omap2xxx_cm_idlest_offs); i++) {
222 if (idlest_offs == omap2xxx_cm_idlest_offs[i]) {
223 *idlest_reg_id = i + 1;
224 break;
225 }
226 }
227
228 if (i == ARRAY_SIZE(omap2xxx_cm_idlest_offs))
229 return -EINVAL;
230
231 offs = idlest_reg - cm_base;
232 offs &= 0xff00;
233 *prcm_inst = offs;
234
235 return 0;
236}
237
238/*
239 *
240 */
241
242/**
243 * omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby
244 * @prcm_mod: PRCM module offset
245 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
246 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
247 *
248 * Wait for the PRCM to indicate that the module identified by
249 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
250 * success or -EBUSY if the module doesn't enable in time.
251 */
252int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
253{
254 int ena = 0, i = 0;
255 u8 cm_idlest_reg;
256 u32 mask;
257
258 if (!idlest_id || (idlest_id > ARRAY_SIZE(omap2xxx_cm_idlest_offs)))
259 return -EINVAL;
260
261 cm_idlest_reg = omap2xxx_cm_idlest_offs[idlest_id - 1];
262
263 mask = 1 << idlest_shift;
264 ena = mask;
265
266 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
267 mask) == ena), MAX_MODULE_READY_TIME, i);
268
269 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
270}
271
272/* Clockdomain low-level functions */
273
274static void omap2xxx_clkdm_allow_idle(struct clockdomain *clkdm)
275{
276 if (atomic_read(&clkdm->usecount) > 0)
277 _clkdm_add_autodeps(clkdm);
278
279 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
280 clkdm->clktrctrl_mask);
281}
282
283static void omap2xxx_clkdm_deny_idle(struct clockdomain *clkdm)
284{
285 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
286 clkdm->clktrctrl_mask);
287
288 if (atomic_read(&clkdm->usecount) > 0)
289 _clkdm_del_autodeps(clkdm);
290}
291
292static int omap2xxx_clkdm_clk_enable(struct clockdomain *clkdm)
293{
294 bool hwsup = false;
295
296 if (!clkdm->clktrctrl_mask)
297 return 0;
298
299 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
300 clkdm->clktrctrl_mask);
301
302 if (hwsup) {
303 /* Disable HW transitions when we are changing deps */
304 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
305 clkdm->clktrctrl_mask);
306 _clkdm_add_autodeps(clkdm);
307 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
308 clkdm->clktrctrl_mask);
309 } else {
310 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
311 omap2xxx_clkdm_wakeup(clkdm);
312 }
313
314 return 0;
315}
316
317static int omap2xxx_clkdm_clk_disable(struct clockdomain *clkdm)
318{
319 bool hwsup = false;
320
321 if (!clkdm->clktrctrl_mask)
322 return 0;
323
324 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
325 clkdm->clktrctrl_mask);
326
327 if (hwsup) {
328 /* Disable HW transitions when we are changing deps */
329 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
330 clkdm->clktrctrl_mask);
331 _clkdm_del_autodeps(clkdm);
332 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
333 clkdm->clktrctrl_mask);
334 } else {
335 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
336 omap2xxx_clkdm_sleep(clkdm);
337 }
338
339 return 0;
340}
341
342struct clkdm_ops omap2_clkdm_operations = {
343 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
344 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
345 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
346 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
347 .clkdm_sleep = omap2xxx_clkdm_sleep,
348 .clkdm_wakeup = omap2xxx_clkdm_wakeup,
349 .clkdm_allow_idle = omap2xxx_clkdm_allow_idle,
350 .clkdm_deny_idle = omap2xxx_clkdm_deny_idle,
351 .clkdm_clk_enable = omap2xxx_clkdm_clk_enable,
352 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable,
353};
354
355/*
356 *
357 */
358
359static struct cm_ll_data omap2xxx_cm_ll_data = {
360 .split_idlest_reg = &omap2xxx_cm_split_idlest_reg,
361 .wait_module_ready = &omap2xxx_cm_wait_module_ready,
362};
363
364int __init omap2xxx_cm_init(void)
365{
366 if (!cpu_is_omap24xx())
367 return 0;
368
369 return cm_register(&omap2xxx_cm_ll_data);
370}
371
372static void __exit omap2xxx_cm_exit(void)
373{
374 if (!cpu_is_omap24xx())
375 return;
376
377 /* Should never happen */
378 WARN(cm_unregister(&omap2xxx_cm_ll_data),
379 "%s: cm_ll_data function pointer mismatch\n", __func__);
380}
381__exitcall(omap2xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm2xxx.h b/arch/arm/mach-omap2/cm2xxx.h
new file mode 100644
index 00000000000..4cbb39b051d
--- /dev/null
+++ b/arch/arm/mach-omap2/cm2xxx.h
@@ -0,0 +1,70 @@
1/*
2 * OMAP2xxx Clock Management (CM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The CM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The CM modules/instances on OMAP4 are quite different, so
14 * they are handled in a separate file.
15 */
16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_H
18
19#include "prcm-common.h"
20#include "cm2xxx_3xxx.h"
21
22#define OMAP2420_CM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
24#define OMAP2430_CM_REGADDR(module, reg) \
25 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
26
27/*
28 * Module specific CM register offsets from CM_BASE + domain offset
29 * Use cm_{read,write}_mod_reg() with these registers.
30 * These register offsets generally appear in more than one PRCM submodule.
31 */
32
33/* OMAP2-specific register offsets */
34
35#define OMAP24XX_CM_FCLKEN2 0x0004
36#define OMAP24XX_CM_ICLKEN4 0x001c
37#define OMAP24XX_CM_AUTOIDLE4 0x003c
38#define OMAP24XX_CM_IDLEST4 0x002c
39
40/* CM_IDLEST bit field values to indicate deasserted IdleReq */
41
42#define OMAP24XX_CM_IDLEST_VAL 0
43
44
45/* Clock management domain register get/set */
46
47#ifndef __ASSEMBLER__
48
49extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
50extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
51
52extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
53extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
54
55extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
56extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
57extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
58extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
59
60extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
61extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
62 u8 idlest_shift);
63extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
64 s16 *prcm_inst, u8 *idlest_reg_id);
65
66extern int __init omap2xxx_cm_init(void);
67
68#endif
69
70#endif
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index 57b2f3c2fbf..bfbd16fe915 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -16,28 +16,7 @@
16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H 16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H 17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
18 18
19#include "prcm-common.h" 19#include "cm.h"
20
21#define OMAP2420_CM_REGADDR(module, reg) \
22 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
23#define OMAP2430_CM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
25#define OMAP34XX_CM_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
27
28
29/*
30 * OMAP3-specific global CM registers
31 * Use cm_{read,write}_reg() with these registers.
32 * These registers appear once per CM module.
33 */
34
35#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
36#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
37#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
38
39#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
40#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
41 20
42/* 21/*
43 * Module specific CM register offsets from CM_BASE + domain offset 22 * Module specific CM register offsets from CM_BASE + domain offset
@@ -57,6 +36,7 @@
57#define CM_IDLEST 0x0020 36#define CM_IDLEST 0x0020
58#define CM_IDLEST1 CM_IDLEST 37#define CM_IDLEST1 CM_IDLEST
59#define CM_IDLEST2 0x0024 38#define CM_IDLEST2 0x0024
39#define OMAP2430_CM_IDLEST3 0x0028
60#define CM_AUTOIDLE 0x0030 40#define CM_AUTOIDLE 0x0030
61#define CM_AUTOIDLE1 CM_AUTOIDLE 41#define CM_AUTOIDLE1 CM_AUTOIDLE
62#define CM_AUTOIDLE2 0x0034 42#define CM_AUTOIDLE2 0x0034
@@ -66,70 +46,60 @@
66#define CM_CLKSEL2 0x0044 46#define CM_CLKSEL2 0x0044
67#define OMAP2_CM_CLKSTCTRL 0x0048 47#define OMAP2_CM_CLKSTCTRL 0x0048
68 48
69/* OMAP2-specific register offsets */ 49#ifndef __ASSEMBLER__
70
71#define OMAP24XX_CM_FCLKEN2 0x0004
72#define OMAP24XX_CM_ICLKEN4 0x001c
73#define OMAP24XX_CM_AUTOIDLE4 0x003c
74#define OMAP24XX_CM_IDLEST4 0x002c
75
76#define OMAP2430_CM_IDLEST3 0x0028
77
78/* OMAP3-specific register offsets */
79
80#define OMAP3430_CM_CLKEN_PLL 0x0004
81#define OMAP3430ES2_CM_CLKEN2 0x0004
82#define OMAP3430ES2_CM_FCLKEN3 0x0008
83#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
84#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
85#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
86#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
87#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
88#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
89#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
90#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
91#define OMAP3430_CM_CLKSTST 0x004c
92#define OMAP3430ES2_CM_CLKSEL4 0x004c
93#define OMAP3430ES2_CM_CLKSEL5 0x0050
94#define OMAP3430_CM_CLKSEL2_EMU 0x0050
95#define OMAP3430_CM_CLKSEL3_EMU 0x0054
96 50
51#include <linux/io.h>
97 52
98/* CM_IDLEST bit field values to indicate deasserted IdleReq */ 53static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
54{
55 return __raw_readl(cm_base + module + idx);
56}
99 57
100#define OMAP24XX_CM_IDLEST_VAL 0 58static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
101#define OMAP34XX_CM_IDLEST_VAL 1 59{
60 __raw_writel(val, cm_base + module + idx);
61}
102 62
63/* Read-modify-write a register in a CM module. Caller must lock */
64static inline u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
65 s16 idx)
66{
67 u32 v;
103 68
104/* Clock management domain register get/set */ 69 v = omap2_cm_read_mod_reg(module, idx);
70 v &= ~mask;
71 v |= bits;
72 omap2_cm_write_mod_reg(v, module, idx);
105 73
106#ifndef __ASSEMBLER__ 74 return v;
75}
107 76
108extern u32 omap2_cm_read_mod_reg(s16 module, u16 idx); 77/* Read a CM register, AND it, and shift the result down to bit 0 */
109extern void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx); 78static inline u32 omap2_cm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
110extern u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 79{
80 u32 v;
111 81
112extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, 82 v = omap2_cm_read_mod_reg(domain, idx);
113 u8 idlest_shift); 83 v &= mask;
114extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); 84 v >>= __ffs(mask);
115extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
116 85
117extern bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask); 86 return v;
118extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); 87}
119extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
120 88
121extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); 89static inline u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
122extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask); 90{
123extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask); 91 return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
124extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask); 92}
125 93
126extern void omap2xxx_cm_set_dpll_disable_autoidle(void); 94static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
127extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void); 95{
96 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
97}
128 98
129extern void omap2xxx_cm_set_apll54_disable_autoidle(void); 99extern int omap2xxx_cm_apll54_enable(void);
130extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void); 100extern void omap2xxx_cm_apll54_disable(void);
131extern void omap2xxx_cm_set_apll96_disable_autoidle(void); 101extern int omap2xxx_cm_apll96_enable(void);
132extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void); 102extern void omap2xxx_cm_apll96_disable(void);
133 103
134#endif 104#endif
135 105
@@ -138,6 +108,7 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
138/* CM_CLKSEL_GFX */ 108/* CM_CLKSEL_GFX */
139#define OMAP_CLKSEL_GFX_SHIFT 0 109#define OMAP_CLKSEL_GFX_SHIFT 0
140#define OMAP_CLKSEL_GFX_MASK (0x7 << 0) 110#define OMAP_CLKSEL_GFX_MASK (0x7 << 0)
111#define OMAP_CLKSEL_GFX_WIDTH 3
141 112
142/* CM_ICLKEN_GFX */ 113/* CM_ICLKEN_GFX */
143#define OMAP_EN_GFX_SHIFT 0 114#define OMAP_EN_GFX_SHIFT 0
@@ -146,11 +117,4 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
146/* CM_IDLEST_GFX */ 117/* CM_IDLEST_GFX */
147#define OMAP_ST_GFX_MASK (1 << 0) 118#define OMAP_ST_GFX_MASK (1 << 0)
148 119
149
150/* Function prototypes */
151# ifndef __ASSEMBLER__
152extern void omap3_cm_save_context(void);
153extern void omap3_cm_restore_context(void);
154# endif
155
156#endif 120#endif
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 13f56eafef0..058ce3c0873 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -22,8 +22,7 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/common.h> 25#include "clockdomain.h"
26
27#include "cm.h" 26#include "cm.h"
28#include "cm33xx.h" 27#include "cm33xx.h"
29#include "cm-regbits-34xx.h" 28#include "cm-regbits-34xx.h"
@@ -311,3 +310,58 @@ void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs)
311 v &= ~AM33XX_MODULEMODE_MASK; 310 v &= ~AM33XX_MODULEMODE_MASK;
312 am33xx_cm_write_reg(v, inst, clkctrl_offs); 311 am33xx_cm_write_reg(v, inst, clkctrl_offs);
313} 312}
313
314/*
315 * Clockdomain low-level functions
316 */
317
318static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
319{
320 am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
321 return 0;
322}
323
324static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
325{
326 am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
327 return 0;
328}
329
330static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
331{
332 am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
333}
334
335static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
336{
337 am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
338}
339
340static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
341{
342 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
343 return am33xx_clkdm_wakeup(clkdm);
344
345 return 0;
346}
347
348static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
349{
350 bool hwsup = false;
351
352 hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
353
354 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
355 am33xx_clkdm_sleep(clkdm);
356
357 return 0;
358}
359
360struct clkdm_ops am33xx_clkdm_operations = {
361 .clkdm_sleep = am33xx_clkdm_sleep,
362 .clkdm_wakeup = am33xx_clkdm_wakeup,
363 .clkdm_allow_idle = am33xx_clkdm_allow_idle,
364 .clkdm_deny_idle = am33xx_clkdm_deny_idle,
365 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
366 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
367};
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 7f07ab02a5b..c2086f2e86b 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -1,8 +1,10 @@
1/* 1/*
2 * OMAP2/3 CM module functions 2 * OMAP3xxx CM module functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -12,8 +14,6 @@
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/types.h> 15#include <linux/types.h>
14#include <linux/delay.h> 16#include <linux/delay.h>
15#include <linux/spinlock.h>
16#include <linux/list.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
@@ -21,56 +21,16 @@
21#include "soc.h" 21#include "soc.h"
22#include "iomap.h" 22#include "iomap.h"
23#include "common.h" 23#include "common.h"
24#include "prm2xxx_3xxx.h"
24#include "cm.h" 25#include "cm.h"
25#include "cm2xxx_3xxx.h" 26#include "cm3xxx.h"
26#include "cm-regbits-24xx.h"
27#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
28#include "clockdomain.h"
28 29
29/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */ 30static const u8 omap3xxx_cm_idlest_offs[] = {
30#define DPLL_AUTOIDLE_DISABLE 0x0 31 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3
31#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
32
33/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
34#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
35#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
36
37static const u8 cm_idlest_offs[] = {
38 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
39}; 32};
40 33
41u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
42{
43 return __raw_readl(cm_base + module + idx);
44}
45
46void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
47{
48 __raw_writel(val, cm_base + module + idx);
49}
50
51/* Read-modify-write a register in a CM module. Caller must lock */
52u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
53{
54 u32 v;
55
56 v = omap2_cm_read_mod_reg(module, idx);
57 v &= ~mask;
58 v |= bits;
59 omap2_cm_write_mod_reg(v, module, idx);
60
61 return v;
62}
63
64u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
65{
66 return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
67}
68
69u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
70{
71 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
72}
73
74/* 34/*
75 * 35 *
76 */ 36 */
@@ -85,33 +45,15 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask)
85 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); 45 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
86} 46}
87 47
88bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask) 48bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
89{ 49{
90 u32 v; 50 u32 v;
91 bool ret = 0;
92
93 BUG_ON(!cpu_is_omap24xx() && !cpu_is_omap34xx());
94 51
95 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL); 52 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
96 v &= mask; 53 v &= mask;
97 v >>= __ffs(mask); 54 v >>= __ffs(mask);
98 55
99 if (cpu_is_omap24xx()) 56 return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
100 ret = (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
101 else
102 ret = (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
103
104 return ret;
105}
106
107void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
108{
109 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
110}
111
112void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
113{
114 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
115} 57}
116 58
117void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) 59void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
@@ -135,109 +77,247 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
135} 77}
136 78
137/* 79/*
138 * DPLL autoidle control 80 *
139 */ 81 */
140 82
141static void _omap2xxx_set_dpll_autoidle(u8 m) 83/**
84 * omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby
85 * @prcm_mod: PRCM module offset
86 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
87 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
88 *
89 * Wait for the PRCM to indicate that the module identified by
90 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
91 * success or -EBUSY if the module doesn't enable in time.
92 */
93int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
142{ 94{
143 u32 v; 95 int ena = 0, i = 0;
96 u8 cm_idlest_reg;
97 u32 mask;
144 98
145 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); 99 if (!idlest_id || (idlest_id > ARRAY_SIZE(omap3xxx_cm_idlest_offs)))
146 v &= ~OMAP24XX_AUTO_DPLL_MASK; 100 return -EINVAL;
147 v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
148 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
149}
150 101
151void omap2xxx_cm_set_dpll_disable_autoidle(void) 102 cm_idlest_reg = omap3xxx_cm_idlest_offs[idlest_id - 1];
152{ 103
153 _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP); 104 mask = 1 << idlest_shift;
105 ena = 0;
106
107 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
108 mask) == ena), MAX_MODULE_READY_TIME, i);
109
110 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
154} 111}
155 112
156void omap2xxx_cm_set_dpll_auto_low_power_stop(void) 113/**
114 * omap3xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
115 * @idlest_reg: CM_IDLEST* virtual address
116 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
117 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
118 *
119 * XXX This function is only needed until absolute register addresses are
120 * removed from the OMAP struct clk records.
121 */
122int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
123 u8 *idlest_reg_id)
157{ 124{
158 _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE); 125 unsigned long offs;
126 u8 idlest_offs;
127 int i;
128
129 if (idlest_reg < (cm_base + OMAP3430_IVA2_MOD) ||
130 idlest_reg > (cm_base + 0x1ffff))
131 return -EINVAL;
132
133 idlest_offs = (unsigned long)idlest_reg & 0xff;
134 for (i = 0; i < ARRAY_SIZE(omap3xxx_cm_idlest_offs); i++) {
135 if (idlest_offs == omap3xxx_cm_idlest_offs[i]) {
136 *idlest_reg_id = i + 1;
137 break;
138 }
139 }
140
141 if (i == ARRAY_SIZE(omap3xxx_cm_idlest_offs))
142 return -EINVAL;
143
144 offs = idlest_reg - cm_base;
145 offs &= 0xff00;
146 *prcm_inst = offs;
147
148 return 0;
159} 149}
160 150
161/* 151/* Clockdomain low-level operations */
162 * APLL autoidle control
163 */
164 152
165static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask) 153static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1,
154 struct clockdomain *clkdm2)
166{ 155{
167 u32 v; 156 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
157 clkdm1->pwrdm.ptr->prcm_offs,
158 OMAP3430_CM_SLEEPDEP);
159 return 0;
160}
168 161
169 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); 162static int omap3xxx_clkdm_del_sleepdep(struct clockdomain *clkdm1,
170 v &= ~mask; 163 struct clockdomain *clkdm2)
171 v |= m << __ffs(mask); 164{
172 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE); 165 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
166 clkdm1->pwrdm.ptr->prcm_offs,
167 OMAP3430_CM_SLEEPDEP);
168 return 0;
173} 169}
174 170
175void omap2xxx_cm_set_apll54_disable_autoidle(void) 171static int omap3xxx_clkdm_read_sleepdep(struct clockdomain *clkdm1,
172 struct clockdomain *clkdm2)
176{ 173{
177 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, 174 return omap2_cm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
178 OMAP24XX_AUTO_54M_MASK); 175 OMAP3430_CM_SLEEPDEP,
176 (1 << clkdm2->dep_bit));
179} 177}
180 178
181void omap2xxx_cm_set_apll54_auto_low_power_stop(void) 179static int omap3xxx_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
182{ 180{
183 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, 181 struct clkdm_dep *cd;
184 OMAP24XX_AUTO_54M_MASK); 182 u32 mask = 0;
183
184 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
185 if (!cd->clkdm)
186 continue; /* only happens if data is erroneous */
187
188 mask |= 1 << cd->clkdm->dep_bit;
189 atomic_set(&cd->sleepdep_usecount, 0);
190 }
191 omap2_cm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
192 OMAP3430_CM_SLEEPDEP);
193 return 0;
185} 194}
186 195
187void omap2xxx_cm_set_apll96_disable_autoidle(void) 196static int omap3xxx_clkdm_sleep(struct clockdomain *clkdm)
188{ 197{
189 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, 198 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
190 OMAP24XX_AUTO_96M_MASK); 199 clkdm->clktrctrl_mask);
200 return 0;
191} 201}
192 202
193void omap2xxx_cm_set_apll96_auto_low_power_stop(void) 203static int omap3xxx_clkdm_wakeup(struct clockdomain *clkdm)
194{ 204{
195 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, 205 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
196 OMAP24XX_AUTO_96M_MASK); 206 clkdm->clktrctrl_mask);
207 return 0;
197} 208}
198 209
199/* 210static void omap3xxx_clkdm_allow_idle(struct clockdomain *clkdm)
200 * 211{
201 */ 212 if (atomic_read(&clkdm->usecount) > 0)
213 _clkdm_add_autodeps(clkdm);
202 214
203/** 215 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
204 * omap2_cm_wait_idlest_ready - wait for a module to leave idle or standby 216 clkdm->clktrctrl_mask);
205 * @prcm_mod: PRCM module offset 217}
206 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) 218
207 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check 219static void omap3xxx_clkdm_deny_idle(struct clockdomain *clkdm)
208 *
209 * XXX document
210 */
211int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
212{ 220{
213 int ena = 0, i = 0; 221 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
214 u8 cm_idlest_reg; 222 clkdm->clktrctrl_mask);
215 u32 mask;
216 223
217 if (!idlest_id || (idlest_id > ARRAY_SIZE(cm_idlest_offs))) 224 if (atomic_read(&clkdm->usecount) > 0)
218 return -EINVAL; 225 _clkdm_del_autodeps(clkdm);
226}
219 227
220 cm_idlest_reg = cm_idlest_offs[idlest_id - 1]; 228static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
229{
230 bool hwsup = false;
221 231
222 mask = 1 << idlest_shift; 232 if (!clkdm->clktrctrl_mask)
233 return 0;
223 234
224 if (cpu_is_omap24xx()) 235 /*
225 ena = mask; 236 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
226 else if (cpu_is_omap34xx()) 237 * more details on the unpleasant problem this is working
227 ena = 0; 238 * around
228 else 239 */
229 BUG(); 240 if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
241 (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
242 omap3xxx_clkdm_wakeup(clkdm);
243 return 0;
244 }
245
246 hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
247 clkdm->clktrctrl_mask);
248
249 if (hwsup) {
250 /* Disable HW transitions when we are changing deps */
251 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
252 clkdm->clktrctrl_mask);
253 _clkdm_add_autodeps(clkdm);
254 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
255 clkdm->clktrctrl_mask);
256 } else {
257 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
258 omap3xxx_clkdm_wakeup(clkdm);
259 }
260
261 return 0;
262}
230 263
231 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena), 264static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
232 MAX_MODULE_READY_TIME, i); 265{
266 bool hwsup = false;
233 267
234 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 268 if (!clkdm->clktrctrl_mask)
269 return 0;
270
271 /*
272 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
273 * more details on the unpleasant problem this is working
274 * around
275 */
276 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
277 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
278 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
279 clkdm->clktrctrl_mask);
280 return 0;
281 }
282
283 hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
284 clkdm->clktrctrl_mask);
285
286 if (hwsup) {
287 /* Disable HW transitions when we are changing deps */
288 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
289 clkdm->clktrctrl_mask);
290 _clkdm_del_autodeps(clkdm);
291 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
292 clkdm->clktrctrl_mask);
293 } else {
294 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
295 omap3xxx_clkdm_sleep(clkdm);
296 }
297
298 return 0;
235} 299}
236 300
301struct clkdm_ops omap3_clkdm_operations = {
302 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
303 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
304 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
305 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
306 .clkdm_add_sleepdep = omap3xxx_clkdm_add_sleepdep,
307 .clkdm_del_sleepdep = omap3xxx_clkdm_del_sleepdep,
308 .clkdm_read_sleepdep = omap3xxx_clkdm_read_sleepdep,
309 .clkdm_clear_all_sleepdeps = omap3xxx_clkdm_clear_all_sleepdeps,
310 .clkdm_sleep = omap3xxx_clkdm_sleep,
311 .clkdm_wakeup = omap3xxx_clkdm_wakeup,
312 .clkdm_allow_idle = omap3xxx_clkdm_allow_idle,
313 .clkdm_deny_idle = omap3xxx_clkdm_deny_idle,
314 .clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
315 .clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
316};
317
237/* 318/*
238 * Context save/restore code - OMAP3 only 319 * Context save/restore code - OMAP3 only
239 */ 320 */
240#ifdef CONFIG_ARCH_OMAP3
241struct omap3_cm_regs { 321struct omap3_cm_regs {
242 u32 iva2_cm_clksel1; 322 u32 iva2_cm_clksel1;
243 u32 iva2_cm_clksel2; 323 u32 iva2_cm_clksel2;
@@ -555,4 +635,31 @@ void omap3_cm_restore_context(void)
555 omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD, 635 omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD,
556 OMAP3_CM_CLKOUT_CTRL_OFFSET); 636 OMAP3_CM_CLKOUT_CTRL_OFFSET);
557} 637}
558#endif 638
639/*
640 *
641 */
642
643static struct cm_ll_data omap3xxx_cm_ll_data = {
644 .split_idlest_reg = &omap3xxx_cm_split_idlest_reg,
645 .wait_module_ready = &omap3xxx_cm_wait_module_ready,
646};
647
648int __init omap3xxx_cm_init(void)
649{
650 if (!cpu_is_omap34xx())
651 return 0;
652
653 return cm_register(&omap3xxx_cm_ll_data);
654}
655
656static void __exit omap3xxx_cm_exit(void)
657{
658 if (!cpu_is_omap34xx())
659 return;
660
661 /* Should never happen */
662 WARN(cm_unregister(&omap3xxx_cm_ll_data),
663 "%s: cm_ll_data function pointer mismatch\n", __func__);
664}
665__exitcall(omap3xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
new file mode 100644
index 00000000000..e8e146f4a43
--- /dev/null
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -0,0 +1,91 @@
1/*
2 * OMAP2/3 Clock Management (CM) register definitions
3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The CM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The CM modules/instances on OMAP4 are quite different, so
14 * they are handled in a separate file.
15 */
16#ifndef __ARCH_ASM_MACH_OMAP2_CM3XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM3XXX_H
18
19#include "prcm-common.h"
20#include "cm2xxx_3xxx.h"
21
22#define OMAP34XX_CM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
24
25
26/*
27 * OMAP3-specific global CM registers
28 * Use cm_{read,write}_reg() with these registers.
29 * These registers appear once per CM module.
30 */
31
32#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
33#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
34#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
35
36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
38
39/*
40 * Module specific CM register offsets from CM_BASE + domain offset
41 * Use cm_{read,write}_mod_reg() with these registers.
42 * These register offsets generally appear in more than one PRCM submodule.
43 */
44
45/* OMAP3-specific register offsets */
46
47#define OMAP3430_CM_CLKEN_PLL 0x0004
48#define OMAP3430ES2_CM_CLKEN2 0x0004
49#define OMAP3430ES2_CM_FCLKEN3 0x0008
50#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
51#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
52#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
53#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
54#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
55#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
56#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
57#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
58#define OMAP3430_CM_CLKSTST 0x004c
59#define OMAP3430ES2_CM_CLKSEL4 0x004c
60#define OMAP3430ES2_CM_CLKSEL5 0x0050
61#define OMAP3430_CM_CLKSEL2_EMU 0x0050
62#define OMAP3430_CM_CLKSEL3_EMU 0x0054
63
64
65/* CM_IDLEST bit field values to indicate deasserted IdleReq */
66
67#define OMAP34XX_CM_IDLEST_VAL 1
68
69
70#ifndef __ASSEMBLER__
71
72extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
73extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
74extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
75extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
76
77extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
78extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
79 u8 idlest_shift);
80
81extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
82 s16 *prcm_inst, u8 *idlest_reg_id);
83
84extern void omap3_cm_save_context(void);
85extern void omap3_cm_restore_context(void);
86
87extern int __init omap3xxx_cm_init(void);
88
89#endif
90
91#endif
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
new file mode 100644
index 00000000000..40b3b5a8445
--- /dev/null
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -0,0 +1,140 @@
1/*
2 * OMAP2+ common Clock Management (CM) IP block functions
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * XXX This code should eventually be moved to a CM driver.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17
18#include "cm2xxx.h"
19#include "cm3xxx.h"
20#include "cm44xx.h"
21#include "common.h"
22
23/*
24 * cm_ll_data: function pointers to SoC-specific implementations of
25 * common CM functions
26 */
27static struct cm_ll_data null_cm_ll_data;
28static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
29
30/* cm_base: base virtual address of the CM IP block */
31void __iomem *cm_base;
32
33/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */
34void __iomem *cm2_base;
35
36/**
37 * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use)
38 * @cm: CM base virtual address
39 * @cm2: CM2 base virtual address (if present on the booted SoC)
40 *
41 * XXX Will be replaced when the PRM/CM drivers are completed.
42 */
43void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
44{
45 cm_base = cm;
46 cm2_base = cm2;
47}
48
49/**
50 * cm_split_idlest_reg - split CM_IDLEST reg addr into its components
51 * @idlest_reg: CM_IDLEST* virtual address
52 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
53 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
54 *
55 * Given an absolute CM_IDLEST register address @idlest_reg, passes
56 * the PRCM instance offset and IDLEST register ID back to the caller
57 * via the @prcm_inst and @idlest_reg_id. Returns -EINVAL upon error,
58 * or 0 upon success. XXX This function is only needed until absolute
59 * register addresses are removed from the OMAP struct clk records.
60 */
61int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
62 u8 *idlest_reg_id)
63{
64 if (!cm_ll_data->split_idlest_reg) {
65 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
66 __func__);
67 return -EINVAL;
68 }
69
70 return cm_ll_data->split_idlest_reg(idlest_reg, prcm_inst,
71 idlest_reg_id);
72}
73
74/**
75 * cm_wait_module_ready - wait for a module to leave idle or standby
76 * @prcm_mod: PRCM module offset
77 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
78 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
79 *
80 * Wait for the PRCM to indicate that the module identified by
81 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
82 * success, -EBUSY if the module doesn't enable in time, or -EINVAL if
83 * no per-SoC wait_module_ready() function pointer has been registered
84 * or if the idlest register is unknown on the SoC.
85 */
86int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
87{
88 if (!cm_ll_data->wait_module_ready) {
89 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
90 __func__);
91 return -EINVAL;
92 }
93
94 return cm_ll_data->wait_module_ready(prcm_mod, idlest_id, idlest_shift);
95}
96
97/**
98 * cm_register - register per-SoC low-level data with the CM
99 * @cld: low-level per-SoC OMAP CM data & function pointers to register
100 *
101 * Register per-SoC low-level OMAP CM data and function pointers with
102 * the OMAP CM common interface. The caller must keep the data
103 * pointed to by @cld valid until it calls cm_unregister() and
104 * it returns successfully. Returns 0 upon success, -EINVAL if @cld
105 * is NULL, or -EEXIST if cm_register() has already been called
106 * without an intervening cm_unregister().
107 */
108int cm_register(struct cm_ll_data *cld)
109{
110 if (!cld)
111 return -EINVAL;
112
113 if (cm_ll_data != &null_cm_ll_data)
114 return -EEXIST;
115
116 cm_ll_data = cld;
117
118 return 0;
119}
120
121/**
122 * cm_unregister - unregister per-SoC low-level data & function pointers
123 * @cld: low-level per-SoC OMAP CM data & function pointers to unregister
124 *
125 * Unregister per-SoC low-level OMAP CM data and function pointers
126 * that were previously registered with cm_register(). The
127 * caller may not destroy any of the data pointed to by @cld until
128 * this function returns successfully. Returns 0 upon success, or
129 * -EINVAL if @cld is NULL or if @cld does not match the struct
130 * cm_ll_data * previously registered by cm_register().
131 */
132int cm_unregister(struct cm_ll_data *cld)
133{
134 if (!cld || cm_ll_data != cld)
135 return -EINVAL;
136
137 cm_ll_data = &null_cm_ll_data;
138
139 return 0;
140}
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 1894015ff04..7f9a464f01e 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -2,8 +2,9 @@
2 * OMAP4 CM instance functions 2 * OMAP4 CM instance functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2008-2011 Texas Instruments, Inc.
6 * Paul Walmsley 6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -22,6 +23,7 @@
22 23
23#include "iomap.h" 24#include "iomap.h"
24#include "common.h" 25#include "common.h"
26#include "clockdomain.h"
25#include "cm.h" 27#include "cm.h"
26#include "cm1_44xx.h" 28#include "cm1_44xx.h"
27#include "cm2_44xx.h" 29#include "cm2_44xx.h"
@@ -343,3 +345,141 @@ void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
343 v &= ~OMAP4430_MODULEMODE_MASK; 345 v &= ~OMAP4430_MODULEMODE_MASK;
344 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs); 346 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
345} 347}
348
349/*
350 * Clockdomain low-level functions
351 */
352
353static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
354 struct clockdomain *clkdm2)
355{
356 omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
357 clkdm1->prcm_partition,
358 clkdm1->cm_inst, clkdm1->clkdm_offs +
359 OMAP4_CM_STATICDEP);
360 return 0;
361}
362
363static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
364 struct clockdomain *clkdm2)
365{
366 omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
367 clkdm1->prcm_partition,
368 clkdm1->cm_inst, clkdm1->clkdm_offs +
369 OMAP4_CM_STATICDEP);
370 return 0;
371}
372
373static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
374 struct clockdomain *clkdm2)
375{
376 return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
377 clkdm1->cm_inst,
378 clkdm1->clkdm_offs +
379 OMAP4_CM_STATICDEP,
380 (1 << clkdm2->dep_bit));
381}
382
383static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
384{
385 struct clkdm_dep *cd;
386 u32 mask = 0;
387
388 if (!clkdm->prcm_partition)
389 return 0;
390
391 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
392 if (!cd->clkdm)
393 continue; /* only happens if data is erroneous */
394
395 mask |= 1 << cd->clkdm->dep_bit;
396 atomic_set(&cd->wkdep_usecount, 0);
397 }
398
399 omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
400 clkdm->cm_inst, clkdm->clkdm_offs +
401 OMAP4_CM_STATICDEP);
402 return 0;
403}
404
405static int omap4_clkdm_sleep(struct clockdomain *clkdm)
406{
407 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
408 clkdm->cm_inst, clkdm->clkdm_offs);
409 return 0;
410}
411
412static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
413{
414 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
415 clkdm->cm_inst, clkdm->clkdm_offs);
416 return 0;
417}
418
419static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
420{
421 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
422 clkdm->cm_inst, clkdm->clkdm_offs);
423}
424
425static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
426{
427 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
428 omap4_clkdm_wakeup(clkdm);
429 else
430 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
431 clkdm->cm_inst,
432 clkdm->clkdm_offs);
433}
434
435static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
436{
437 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
438 return omap4_clkdm_wakeup(clkdm);
439
440 return 0;
441}
442
443static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
444{
445 bool hwsup = false;
446
447 if (!clkdm->prcm_partition)
448 return 0;
449
450 /*
451 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
452 * more details on the unpleasant problem this is working
453 * around
454 */
455 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
456 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
457 omap4_clkdm_allow_idle(clkdm);
458 return 0;
459 }
460
461 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
462 clkdm->cm_inst, clkdm->clkdm_offs);
463
464 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
465 omap4_clkdm_sleep(clkdm);
466
467 return 0;
468}
469
470struct clkdm_ops omap4_clkdm_operations = {
471 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
472 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
473 .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
474 .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
475 .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
476 .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
477 .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
478 .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
479 .clkdm_sleep = omap4_clkdm_sleep,
480 .clkdm_wakeup = omap4_clkdm_wakeup,
481 .clkdm_allow_idle = omap4_clkdm_allow_idle,
482 .clkdm_deny_idle = omap4_clkdm_deny_idle,
483 .clkdm_clk_enable = omap4_clkdm_clk_enable,
484 .clkdm_clk_disable = omap4_clkdm_clk_disable,
485};
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index d69fdefef98..bd7bab88974 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -38,4 +38,6 @@ extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst,
38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, 38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
39 u32 mask); 39 u32 mask);
40 40
41extern void omap_cm_base_init(void);
42
41#endif 43#endif
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index 84551f205e4..d246efd9f73 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -25,7 +25,6 @@
25#include <linux/spi/ads7846.h> 25#include <linux/spi/ads7846.h>
26 26
27#include <linux/platform_data/spi-omap2-mcspi.h> 27#include <linux/platform_data/spi-omap2-mcspi.h>
28#include <linux/platform_data/mtd-nand-omap2.h>
29 28
30#include "common.h" 29#include "common.h"
31#include "common-board-devices.h" 30#include "common-board-devices.h"
@@ -102,48 +101,3 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
102{ 101{
103} 102}
104#endif 103#endif
105
106#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
107static struct omap_nand_platform_data nand_data;
108
109void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
110 int nr_parts)
111{
112 u8 cs = 0;
113 u8 nandcs = GPMC_CS_NUM + 1;
114
115 /* find out the chip-select on which NAND exists */
116 while (cs < GPMC_CS_NUM) {
117 u32 ret = 0;
118 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
119
120 if ((ret & 0xC00) == 0x800) {
121 printk(KERN_INFO "Found NAND on CS%d\n", cs);
122 if (nandcs > GPMC_CS_NUM)
123 nandcs = cs;
124 }
125 cs++;
126 }
127
128 if (nandcs > GPMC_CS_NUM) {
129 pr_info("NAND: Unable to find configuration in GPMC\n");
130 return;
131 }
132
133 if (nandcs < GPMC_CS_NUM) {
134 nand_data.cs = nandcs;
135 nand_data.parts = parts;
136 nand_data.nr_parts = nr_parts;
137 nand_data.devsize = options;
138
139 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
140 if (gpmc_nand_init(&nand_data) < 0)
141 printk(KERN_ERR "Unable to register NAND device\n");
142 }
143}
144#else
145void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
146 int nr_parts)
147{
148}
149#endif
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index a0b4a42836a..72bb41b3fd2 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -10,6 +10,5 @@ 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 omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts);
14 13
15#endif /* __OMAP_COMMON_BOARD_DEVICES__ */ 14#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 17950c6e130..5c2fd4863b2 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -14,189 +14,26 @@
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/clk.h> 17#include <linux/platform_data/dsp-omap.h>
18#include <linux/io.h>
19 18
20#include <plat/clock.h> 19#include <plat/vram.h>
21 20
22#include "soc.h"
23#include "iomap.h"
24#include "common.h" 21#include "common.h"
25#include "sdrc.h" 22#include "omap-secure.h"
26#include "control.h"
27
28/* Global address base setup code */
29
30static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
31{
32 omap2_set_globals_tap(omap2_globals);
33 omap2_set_globals_sdrc(omap2_globals);
34 omap2_set_globals_control(omap2_globals);
35 omap2_set_globals_prcm(omap2_globals);
36}
37
38#if defined(CONFIG_SOC_OMAP2420)
39
40static struct omap_globals omap242x_globals = {
41 .class = OMAP242X_CLASS,
42 .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
43 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
44 .sms = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
45 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
46 .prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
47 .cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
48};
49
50void __init omap2_set_globals_242x(void)
51{
52 __omap2_set_globals(&omap242x_globals);
53}
54
55void __init omap242x_map_io(void)
56{
57 omap242x_map_common_io();
58}
59#endif
60
61#if defined(CONFIG_SOC_OMAP2430)
62
63static struct omap_globals omap243x_globals = {
64 .class = OMAP243X_CLASS,
65 .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
66 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
67 .sms = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
68 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
69 .prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
70 .cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
71};
72
73void __init omap2_set_globals_243x(void)
74{
75 __omap2_set_globals(&omap243x_globals);
76}
77
78void __init omap243x_map_io(void)
79{
80 omap243x_map_common_io();
81}
82#endif
83
84#if defined(CONFIG_ARCH_OMAP3)
85
86static struct omap_globals omap3_globals = {
87 .class = OMAP343X_CLASS,
88 .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
89 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
90 .sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
91 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
92 .prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
93 .cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
94};
95
96void __init omap2_set_globals_3xxx(void)
97{
98 __omap2_set_globals(&omap3_globals);
99}
100
101void __init omap3_map_io(void)
102{
103 omap34xx_map_common_io();
104}
105 23
106/* 24/*
107 * Adjust TAP register base such that omap3_check_revision accesses the correct 25 * Stub function for OMAP2 so that common files
108 * TI81XX register for checking device ID (it adds 0x204 to tap base while 26 * continue to build when custom builds are used
109 * TI81XX DEVICE ID register is at offset 0x600 from control base).
110 */ 27 */
111#define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \ 28int __weak omap_secure_ram_reserve_memblock(void)
112 TI81XX_CONTROL_DEVICE_ID - 0x204)
113
114static struct omap_globals ti81xx_globals = {
115 .class = OMAP343X_CLASS,
116 .tap = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
117 .ctrl = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
118 .prm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
119 .cm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
120};
121
122void __init omap2_set_globals_ti81xx(void)
123{
124 __omap2_set_globals(&ti81xx_globals);
125}
126
127void __init ti81xx_map_io(void)
128{
129 omapti81xx_map_common_io();
130}
131#endif
132
133#if defined(CONFIG_SOC_AM33XX)
134#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + \
135 TI81XX_CONTROL_DEVICE_ID - 0x204)
136
137static struct omap_globals am33xx_globals = {
138 .class = AM335X_CLASS,
139 .tap = AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE),
140 .ctrl = AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
141 .prm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
142 .cm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
143};
144
145void __init omap2_set_globals_am33xx(void)
146{
147 __omap2_set_globals(&am33xx_globals);
148}
149
150void __init am33xx_map_io(void)
151{
152 omapam33xx_map_common_io();
153}
154#endif
155
156#if defined(CONFIG_ARCH_OMAP4)
157static struct omap_globals omap4_globals = {
158 .class = OMAP443X_CLASS,
159 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
160 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
161 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
162 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
163 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
164 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
165 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
166};
167
168void __init omap2_set_globals_443x(void)
169{
170 __omap2_set_globals(&omap4_globals);
171}
172
173void __init omap4_map_io(void)
174{
175 omap44xx_map_common_io();
176}
177#endif
178
179#if defined(CONFIG_SOC_OMAP5)
180static struct omap_globals omap5_globals = {
181 .class = OMAP54XX_CLASS,
182 .tap = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
183 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
184 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE),
185 .prm = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
186 .cm = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
187 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
188 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE),
189};
190
191void __init omap2_set_globals_5xxx(void)
192{ 29{
193 omap2_set_globals_tap(&omap5_globals); 30 return 0;
194 omap2_set_globals_control(&omap5_globals);
195 omap2_set_globals_prcm(&omap5_globals);
196} 31}
197 32
198void __init omap5_map_io(void) 33void __init omap_reserve(void)
199{ 34{
200 omap5_map_common_io(); 35 omap_vram_reserve_sdram_memblock();
36 omap_dsp_reserve_sdram_memblock();
37 omap_secure_ram_reserve_memblock();
38 omap_barrier_reserve_memblock();
201} 39}
202#endif
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 7045e4d61ac..948bcaa82eb 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -28,63 +28,18 @@
28 28
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/i2c.h>
31#include <linux/i2c/twl.h> 32#include <linux/i2c/twl.h>
33#include <linux/i2c-omap.h>
32 34
33#include <asm/proc-fns.h> 35#include <asm/proc-fns.h>
34 36
35#include <plat/cpu.h> 37#include "i2c.h"
36#include <plat/serial.h> 38#include "serial.h"
37#include <plat/common.h>
38 39
39#define OMAP_INTC_START NR_IRQS 40#include "usb.h"
40
41#ifdef CONFIG_SOC_OMAP2420
42extern void omap242x_map_common_io(void);
43#else
44static inline void omap242x_map_common_io(void)
45{
46}
47#endif
48
49#ifdef CONFIG_SOC_OMAP2430
50extern void omap243x_map_common_io(void);
51#else
52static inline void omap243x_map_common_io(void)
53{
54}
55#endif
56
57#ifdef CONFIG_ARCH_OMAP3
58extern void omap34xx_map_common_io(void);
59#else
60static inline void omap34xx_map_common_io(void)
61{
62}
63#endif
64
65#ifdef CONFIG_SOC_TI81XX
66extern void omapti81xx_map_common_io(void);
67#else
68static inline void omapti81xx_map_common_io(void)
69{
70}
71#endif
72 41
73#ifdef CONFIG_SOC_AM33XX 42#define OMAP_INTC_START NR_IRQS
74extern void omapam33xx_map_common_io(void);
75#else
76static inline void omapam33xx_map_common_io(void)
77{
78}
79#endif
80
81#ifdef CONFIG_ARCH_OMAP4
82extern void omap44xx_map_common_io(void);
83#else
84static inline void omap44xx_map_common_io(void)
85{
86}
87#endif
88 43
89#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) 44#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2)
90int omap2_pm_init(void); 45int omap2_pm_init(void);
@@ -122,19 +77,12 @@ static inline int omap_mux_late_init(void)
122} 77}
123#endif 78#endif
124 79
125#ifdef CONFIG_SOC_OMAP5
126extern void omap5_map_common_io(void);
127#else
128static inline void omap5_map_common_io(void)
129{
130}
131#endif
132
133extern void omap2_init_common_infrastructure(void); 80extern void omap2_init_common_infrastructure(void);
134 81
135extern struct sys_timer omap2_timer; 82extern struct sys_timer omap2_timer;
136extern struct sys_timer omap3_timer; 83extern struct sys_timer omap3_timer;
137extern struct sys_timer omap3_secure_timer; 84extern struct sys_timer omap3_secure_timer;
85extern struct sys_timer omap3_gp_timer;
138extern struct sys_timer omap3_am33xx_timer; 86extern struct sys_timer omap3_am33xx_timer;
139extern struct sys_timer omap4_timer; 87extern struct sys_timer omap4_timer;
140extern struct sys_timer omap5_timer; 88extern struct sys_timer omap5_timer;
@@ -162,52 +110,43 @@ void am35xx_init_late(void);
162void ti81xx_init_late(void); 110void ti81xx_init_late(void);
163void omap4430_init_late(void); 111void omap4430_init_late(void);
164int omap2_common_pm_late_init(void); 112int omap2_common_pm_late_init(void);
165void omap_prcm_restart(char, const char *);
166 113
167/* 114#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
168 * IO bases for various OMAP processors 115void omap2xxx_restart(char mode, const char *cmd);
169 * Except the tap base, rest all the io bases 116#else
170 * listed are physical addresses. 117static inline void omap2xxx_restart(char mode, const char *cmd)
171 */ 118{
172struct omap_globals { 119}
173 u32 class; /* OMAP class to detect */ 120#endif
174 void __iomem *tap; /* Control module ID code */ 121
175 void __iomem *sdrc; /* SDRAM Controller */ 122#ifdef CONFIG_ARCH_OMAP3
176 void __iomem *sms; /* SDRAM Memory Scheduler */ 123void omap3xxx_restart(char mode, const char *cmd);
177 void __iomem *ctrl; /* System Control Module */ 124#else
178 void __iomem *ctrl_pad; /* PAD Control Module */ 125static inline void omap3xxx_restart(char mode, const char *cmd)
179 void __iomem *prm; /* Power and Reset Management */ 126{
180 void __iomem *cm; /* Clock Management */ 127}
181 void __iomem *cm2; 128#endif
182 void __iomem *prcm_mpu; 129
183}; 130#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
184 131void omap44xx_restart(char mode, const char *cmd);
185void omap2_set_globals_242x(void);
186void omap2_set_globals_243x(void);
187void omap2_set_globals_3xxx(void);
188void omap2_set_globals_443x(void);
189void omap2_set_globals_5xxx(void);
190void omap2_set_globals_ti81xx(void);
191void omap2_set_globals_am33xx(void);
192
193/* These get called from omap2_set_globals_xxxx(), do not call these */
194void omap2_set_globals_tap(struct omap_globals *);
195#if defined(CONFIG_SOC_HAS_OMAP2_SDRC)
196void omap2_set_globals_sdrc(struct omap_globals *);
197#else 132#else
198static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 133static inline void omap44xx_restart(char mode, const char *cmd)
199{ } 134{
135}
200#endif 136#endif
201void omap2_set_globals_control(struct omap_globals *); 137
202void omap2_set_globals_prcm(struct omap_globals *); 138/* This gets called from mach-omap2/io.c, do not call this */
203 139void __init omap2_set_globals_tap(u32 class, void __iomem *tap);
204void omap242x_map_io(void); 140
205void omap243x_map_io(void); 141void __init omap242x_map_io(void);
206void omap3_map_io(void); 142void __init omap243x_map_io(void);
207void am33xx_map_io(void); 143void __init omap3_map_io(void);
208void omap4_map_io(void); 144void __init am33xx_map_io(void);
209void omap5_map_io(void); 145void __init omap4_map_io(void);
210void ti81xx_map_io(void); 146void __init omap5_map_io(void);
147void __init ti81xx_map_io(void);
148
149/* omap_barriers_init() is OMAP4 only */
211void omap_barriers_init(void); 150void omap_barriers_init(void);
212 151
213/** 152/**
@@ -275,6 +214,9 @@ static inline void __iomem *omap4_get_scu_base(void)
275#endif 214#endif
276 215
277extern void __init gic_init_irq(void); 216extern void __init gic_init_irq(void);
217extern void gic_dist_disable(void);
218extern bool gic_dist_disabled(void);
219extern void gic_timer_retrigger(void);
278extern void omap_smc1(u32 fn, u32 arg); 220extern void omap_smc1(u32 fn, u32 arg);
279extern void __iomem *omap4_get_sar_ram_base(void); 221extern void __iomem *omap4_get_sar_ram_base(void);
280extern void omap_do_wfi(void); 222extern void omap_do_wfi(void);
@@ -282,6 +224,7 @@ extern void omap_do_wfi(void);
282#ifdef CONFIG_SMP 224#ifdef CONFIG_SMP
283/* Needed for secondary core boot */ 225/* Needed for secondary core boot */
284extern void omap_secondary_startup(void); 226extern void omap_secondary_startup(void);
227extern void omap_secondary_startup_4460(void);
285extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask); 228extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
286extern void omap_auxcoreboot_addr(u32 cpu_addr); 229extern void omap_auxcoreboot_addr(u32 cpu_addr);
287extern u32 omap_read_auxcoreboot0(void); 230extern u32 omap_read_auxcoreboot0(void);
@@ -338,6 +281,10 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
338 struct omap_sdrc_params *sdrc_cs1); 281 struct omap_sdrc_params *sdrc_cs1);
339struct omap2_hsmmc_info; 282struct omap2_hsmmc_info;
340extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers); 283extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
284extern void omap_reserve(void);
285
286struct omap_hwmod;
287extern int omap_dss_reset(struct omap_hwmod *);
341 288
342#endif /* __ASSEMBLER__ */ 289#endif /* __ASSEMBLER__ */
343#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 290#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index d1ff8399a22..2adb2683f07 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 System Control Module register access 2 * OMAP2/3 System Control Module register access
3 * 3 *
4 * Copyright (C) 2007 Texas Instruments, Inc. 4 * Copyright (C) 2007, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007 Nokia Corporation 5 * Copyright (C) 2007 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -15,15 +15,13 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <plat/sdrc.h>
19
20#include "soc.h" 18#include "soc.h"
21#include "iomap.h" 19#include "iomap.h"
22#include "common.h" 20#include "common.h"
23#include "cm-regbits-34xx.h" 21#include "cm-regbits-34xx.h"
24#include "prm-regbits-34xx.h" 22#include "prm-regbits-34xx.h"
25#include "prm2xxx_3xxx.h" 23#include "prm3xxx.h"
26#include "cm2xxx_3xxx.h" 24#include "cm3xxx.h"
27#include "sdrc.h" 25#include "sdrc.h"
28#include "pm.h" 26#include "pm.h"
29#include "control.h" 27#include "control.h"
@@ -149,13 +147,11 @@ static struct omap3_control_regs control_context;
149#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) 147#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
150#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg)) 148#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg))
151 149
152void __init omap2_set_globals_control(struct omap_globals *omap2_globals) 150void __init omap2_set_globals_control(void __iomem *ctrl,
151 void __iomem *ctrl_pad)
153{ 152{
154 if (omap2_globals->ctrl) 153 omap2_ctrl_base = ctrl;
155 omap2_ctrl_base = omap2_globals->ctrl; 154 omap4_ctrl_pad_base = ctrl_pad;
156
157 if (omap2_globals->ctrl_pad)
158 omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
159} 155}
160 156
161void __iomem *omap_ctrl_base_get(void) 157void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a89e8256fd0..3d944d3263d 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -201,6 +201,7 @@
201#define OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO 0x249 201#define OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO 0x249
202#define OMAP44XX_CONTROL_FUSE_CORE_OPP50 0x254 202#define OMAP44XX_CONTROL_FUSE_CORE_OPP50 0x254
203#define OMAP44XX_CONTROL_FUSE_CORE_OPP100 0x257 203#define OMAP44XX_CONTROL_FUSE_CORE_OPP100 0x257
204#define OMAP44XX_CONTROL_FUSE_CORE_OPP100OV 0x25A
204 205
205/* AM35XX only CONTROL_GENERAL register offsets */ 206/* AM35XX only CONTROL_GENERAL register offsets */
206#define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038) 207#define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038)
@@ -414,6 +415,8 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
414extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); 415extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
415extern void omap3630_ctrl_disable_rta(void); 416extern void omap3630_ctrl_disable_rta(void);
416extern int omap3_ctrl_save_padconf(void); 417extern int omap3_ctrl_save_padconf(void);
418extern void omap2_set_globals_control(void __iomem *ctrl,
419 void __iomem *ctrl_pad);
417#else 420#else
418#define omap_ctrl_base_get() 0 421#define omap_ctrl_base_get() 0
419#define omap_ctrl_readb(x) 0 422#define omap_ctrl_readb(x) 0
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index bc2756959be..bca7a888570 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -27,7 +27,6 @@
27#include <linux/export.h> 27#include <linux/export.h>
28#include <linux/cpu_pm.h> 28#include <linux/cpu_pm.h>
29 29
30#include <plat/prcm.h>
31#include "powerdomain.h" 30#include "powerdomain.h"
32#include "clockdomain.h" 31#include "clockdomain.h"
33 32
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c72b5a72772..4abb8b5e9bc 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -24,10 +24,11 @@
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <linux/omap-dma.h>
28
27#include "iomap.h" 29#include "iomap.h"
28#include <plat/dma.h> 30#include "omap_hwmod.h"
29#include <plat/omap_hwmod.h> 31#include "omap_device.h"
30#include <plat/omap_device.h>
31#include "omap4-keypad.h" 32#include "omap4-keypad.h"
32 33
33#include "soc.h" 34#include "soc.h"
@@ -35,6 +36,7 @@
35#include "mux.h" 36#include "mux.h"
36#include "control.h" 37#include "control.h"
37#include "devices.h" 38#include "devices.h"
39#include "dma.h"
38 40
39#define L3_MODULES_MAX_LEN 12 41#define L3_MODULES_MAX_LEN 12
40#define L3_MODULES 3 42#define L3_MODULES 3
@@ -127,7 +129,7 @@ static struct platform_device omap2cam_device = {
127 129
128#if defined(CONFIG_IOMMU_API) 130#if defined(CONFIG_IOMMU_API)
129 131
130#include <plat/iommu.h> 132#include <linux/platform_data/iommu-omap.h>
131 133
132static struct resource omap3isp_resources[] = { 134static struct resource omap3isp_resources[] = {
133 { 135 {
@@ -201,6 +203,16 @@ static struct resource omap3isp_resources[] = {
201 .flags = IORESOURCE_MEM, 203 .flags = IORESOURCE_MEM,
202 }, 204 },
203 { 205 {
206 .start = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE,
207 .end = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE + 3,
208 .flags = IORESOURCE_MEM,
209 },
210 {
211 .start = OMAP343X_CTRL_BASE + OMAP3630_CONTROL_CAMERA_PHY_CTRL,
212 .end = OMAP343X_CTRL_BASE + OMAP3630_CONTROL_CAMERA_PHY_CTRL + 3,
213 .flags = IORESOURCE_MEM,
214 },
215 {
204 .start = 24 + OMAP_INTC_START, 216 .start = 24 + OMAP_INTC_START,
205 .flags = IORESOURCE_IRQ, 217 .flags = IORESOURCE_IRQ,
206 } 218 }
@@ -723,29 +735,3 @@ static int __init omap2_init_devices(void)
723 return 0; 735 return 0;
724} 736}
725arch_initcall(omap2_init_devices); 737arch_initcall(omap2_init_devices);
726
727#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
728static int __init omap_init_wdt(void)
729{
730 int id = -1;
731 struct platform_device *pdev;
732 struct omap_hwmod *oh;
733 char *oh_name = "wd_timer2";
734 char *dev_name = "omap_wdt";
735
736 if (!cpu_class_is_omap2() || of_have_populated_dt())
737 return 0;
738
739 oh = omap_hwmod_lookup(oh_name);
740 if (!oh) {
741 pr_err("Could not look up wd_timer%d hwmod\n", id);
742 return -EINVAL;
743 }
744
745 pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
746 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
747 dev_name, oh->name);
748 return 0;
749}
750subsys_initcall(omap_init_wdt);
751#endif
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 1011995f150..38ba58c9762 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -25,15 +25,17 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26 26
27#include <video/omapdss.h> 27#include <video/omapdss.h>
28#include <plat/omap_hwmod.h> 28#include "omap_hwmod.h"
29#include <plat/omap_device.h> 29#include "omap_device.h"
30#include <plat/omap-pm.h> 30#include "omap-pm.h"
31#include "common.h" 31#include "common.h"
32 32
33#include "soc.h"
33#include "iomap.h" 34#include "iomap.h"
34#include "mux.h" 35#include "mux.h"
35#include "control.h" 36#include "control.h"
36#include "display.h" 37#include "display.h"
38#include "prm.h"
37 39
38#define DISPC_CONTROL 0x0040 40#define DISPC_CONTROL 0x0040
39#define DISPC_CONTROL2 0x0238 41#define DISPC_CONTROL2 0x0238
@@ -284,6 +286,35 @@ err:
284 return ERR_PTR(r); 286 return ERR_PTR(r);
285} 287}
286 288
289static enum omapdss_version __init omap_display_get_version(void)
290{
291 if (cpu_is_omap24xx())
292 return OMAPDSS_VER_OMAP24xx;
293 else if (cpu_is_omap3630())
294 return OMAPDSS_VER_OMAP3630;
295 else if (cpu_is_omap34xx()) {
296 if (soc_is_am35xx()) {
297 return OMAPDSS_VER_AM35xx;
298 } else {
299 if (omap_rev() < OMAP3430_REV_ES3_0)
300 return OMAPDSS_VER_OMAP34xx_ES1;
301 else
302 return OMAPDSS_VER_OMAP34xx_ES3;
303 }
304 } else if (omap_rev() == OMAP4430_REV_ES1_0)
305 return OMAPDSS_VER_OMAP4430_ES1;
306 else if (omap_rev() == OMAP4430_REV_ES2_0 ||
307 omap_rev() == OMAP4430_REV_ES2_1 ||
308 omap_rev() == OMAP4430_REV_ES2_2)
309 return OMAPDSS_VER_OMAP4430_ES2;
310 else if (cpu_is_omap44xx())
311 return OMAPDSS_VER_OMAP4;
312 else if (soc_is_omap54xx())
313 return OMAPDSS_VER_OMAP5;
314 else
315 return OMAPDSS_VER_UNKNOWN;
316}
317
287int __init omap_display_init(struct omap_dss_board_info *board_data) 318int __init omap_display_init(struct omap_dss_board_info *board_data)
288{ 319{
289 int r = 0; 320 int r = 0;
@@ -291,9 +322,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
291 int i, oh_count; 322 int i, oh_count;
292 const struct omap_dss_hwmod_data *curr_dss_hwmod; 323 const struct omap_dss_hwmod_data *curr_dss_hwmod;
293 struct platform_device *dss_pdev; 324 struct platform_device *dss_pdev;
325 enum omapdss_version ver;
294 326
295 /* create omapdss device */ 327 /* create omapdss device */
296 328
329 ver = omap_display_get_version();
330
331 if (ver == OMAPDSS_VER_UNKNOWN) {
332 pr_err("DSS not supported on this SoC\n");
333 return -ENODEV;
334 }
335
336 board_data->version = ver;
297 board_data->dsi_enable_pads = omap_dsi_enable_pads; 337 board_data->dsi_enable_pads = omap_dsi_enable_pads;
298 board_data->dsi_disable_pads = omap_dsi_disable_pads; 338 board_data->dsi_disable_pads = omap_dsi_disable_pads;
299 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; 339 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
@@ -473,7 +513,6 @@ static void dispc_disable_outputs(void)
473 } 513 }
474} 514}
475 515
476#define MAX_MODULE_SOFTRESET_WAIT 10000
477int omap_dss_reset(struct omap_hwmod *oh) 516int omap_dss_reset(struct omap_hwmod *oh)
478{ 517{
479 struct omap_hwmod_opt_clk *oc; 518 struct omap_hwmod_opt_clk *oc;
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index ff75abe60af..612b9824987 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -28,9 +28,11 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/device.h> 29#include <linux/device.h>
30 30
31#include <plat/omap_hwmod.h> 31#include <linux/omap-dma.h>
32#include <plat/omap_device.h> 32
33#include <plat/dma.h> 33#include "soc.h"
34#include "omap_hwmod.h"
35#include "omap_device.h"
34 36
35#define OMAP2_DMA_STRIDE 0x60 37#define OMAP2_DMA_STRIDE 0x60
36 38
@@ -274,6 +276,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
274 return -ENOMEM; 276 return -ENOMEM;
275 } 277 }
276 278
279 if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
280 d->dev_caps |= HS_CHANNELS_RESERVED;
281
277 /* Check the capabilities register for descriptor loading feature */ 282 /* Check the capabilities register for descriptor loading feature */
278 if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS) 283 if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
279 dma_common_ch_end = CCDN; 284 dma_common_ch_end = CCDN;
diff --git a/arch/arm/mach-omap2/dma.h b/arch/arm/mach-omap2/dma.h
new file mode 100644
index 00000000000..eba80dbc521
--- /dev/null
+++ b/arch/arm/mach-omap2/dma.h
@@ -0,0 +1,131 @@
1/*
2 * OMAP2PLUS DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP2PLUS_DMA_CHANNEL_H
20#define __OMAP2PLUS_DMA_CHANNEL_H
21
22
23/* DMA channels for 24xx */
24#define OMAP24XX_DMA_NO_DEVICE 0
25#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
26#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
27#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
28#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
29#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
30#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
31#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
32#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
33#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
34#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
35#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
36#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
37#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
38#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
39#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
40#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
41#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
42#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
43#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
44#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
45#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
46#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
47#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
48#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
49#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
50#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
51#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
52#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
53#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
54#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
55#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
56#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
57#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
58#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
59#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
60#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
61#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
62#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
63#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
64#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
65#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
66#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
67#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
68#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
69#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
70#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
71#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
72#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
73#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
74#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
75#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
76#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
77#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
78#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
79#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
80#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
81#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
82#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
83#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
84#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
85#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
86#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
87#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
88#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
89#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
90#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
91#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
92#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
93#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
94#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
95#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
96#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
97#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
98#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
99#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
100#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
101#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
102#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
103#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
104#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
105#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
106#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
107#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
108#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
109#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
110#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
111#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
112#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
113#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
114#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
115#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
116#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
117#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
118#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
119#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
120#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
121#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
122#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
123
124#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
125#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
126
127/* Only for AM35xx */
128#define AM35XX_DMA_UART4_TX 54
129#define AM35XX_DMA_UART4_RX 55
130
131#endif /* __OMAP2PLUS_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 814e1808e15..fafb28c0dcb 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -28,9 +28,8 @@
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/clkdev.h> 29#include <linux/clkdev.h>
30 30
31#include <plat/clock.h>
32
33#include "soc.h" 31#include "soc.h"
32#include "clockdomain.h"
34#include "clock.h" 33#include "clock.h"
35#include "cm2xxx_3xxx.h" 34#include "cm2xxx_3xxx.h"
36#include "cm-regbits-34xx.h" 35#include "cm-regbits-34xx.h"
@@ -44,7 +43,7 @@
44/* Private functions */ 43/* Private functions */
45 44
46/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ 45/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
47static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) 46static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits)
48{ 47{
49 const struct dpll_data *dd; 48 const struct dpll_data *dd;
50 u32 v; 49 u32 v;
@@ -58,7 +57,7 @@ static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
58} 57}
59 58
60/* _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 */
61static int _omap3_wait_dpll_status(struct clk *clk, u8 state) 60static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state)
62{ 61{
63 const struct dpll_data *dd; 62 const struct dpll_data *dd;
64 int i = 0; 63 int i = 0;
@@ -66,7 +65,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
66 const char *clk_name; 65 const char *clk_name;
67 66
68 dd = clk->dpll_data; 67 dd = clk->dpll_data;
69 clk_name = __clk_get_name(clk); 68 clk_name = __clk_get_name(clk->hw.clk);
70 69
71 state <<= __ffs(dd->idlest_mask); 70 state <<= __ffs(dd->idlest_mask);
72 71
@@ -90,7 +89,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
90} 89}
91 90
92/* From 3430 TRM ES2 4.7.6.2 */ 91/* From 3430 TRM ES2 4.7.6.2 */
93static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) 92static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n)
94{ 93{
95 unsigned long fint; 94 unsigned long fint;
96 u16 f = 0; 95 u16 f = 0;
@@ -135,14 +134,14 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
135 * locked successfully, return 0; if the DPLL did not lock in the time 134 * locked successfully, return 0; if the DPLL did not lock in the time
136 * allotted, or DPLL3 was passed in, return -EINVAL. 135 * allotted, or DPLL3 was passed in, return -EINVAL.
137 */ 136 */
138static int _omap3_noncore_dpll_lock(struct clk *clk) 137static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk)
139{ 138{
140 const struct dpll_data *dd; 139 const struct dpll_data *dd;
141 u8 ai; 140 u8 ai;
142 u8 state = 1; 141 u8 state = 1;
143 int r = 0; 142 int r = 0;
144 143
145 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk)); 144 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk));
146 145
147 dd = clk->dpll_data; 146 dd = clk->dpll_data;
148 state <<= __ffs(dd->idlest_mask); 147 state <<= __ffs(dd->idlest_mask);
@@ -180,7 +179,7 @@ done:
180 * DPLL3 was passed in, or the DPLL does not support low-power bypass, 179 * DPLL3 was passed in, or the DPLL does not support low-power bypass,
181 * return -EINVAL. 180 * return -EINVAL.
182 */ 181 */
183static int _omap3_noncore_dpll_bypass(struct clk *clk) 182static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk)
184{ 183{
185 int r; 184 int r;
186 u8 ai; 185 u8 ai;
@@ -189,7 +188,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
189 return -EINVAL; 188 return -EINVAL;
190 189
191 pr_debug("clock: configuring DPLL %s for low-power bypass\n", 190 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
192 __clk_get_name(clk)); 191 __clk_get_name(clk->hw.clk));
193 192
194 ai = omap3_dpll_autoidle_read(clk); 193 ai = omap3_dpll_autoidle_read(clk);
195 194
@@ -212,14 +211,14 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
212 * code. If DPLL3 was passed in, or the DPLL does not support 211 * code. If DPLL3 was passed in, or the DPLL does not support
213 * low-power stop, return -EINVAL; otherwise, return 0. 212 * low-power stop, return -EINVAL; otherwise, return 0.
214 */ 213 */
215static int _omap3_noncore_dpll_stop(struct clk *clk) 214static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk)
216{ 215{
217 u8 ai; 216 u8 ai;
218 217
219 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) 218 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
220 return -EINVAL; 219 return -EINVAL;
221 220
222 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk)); 221 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk));
223 222
224 ai = omap3_dpll_autoidle_read(clk); 223 ai = omap3_dpll_autoidle_read(clk);
225 224
@@ -243,11 +242,11 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
243 * XXX This code is not needed for 3430/AM35xx; can it be optimized 242 * XXX This code is not needed for 3430/AM35xx; can it be optimized
244 * out in non-multi-OMAP builds for those chips? 243 * out in non-multi-OMAP builds for those chips?
245 */ 244 */
246static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) 245static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n)
247{ 246{
248 unsigned long fint, clkinp; /* watch out for overflow */ 247 unsigned long fint, clkinp; /* watch out for overflow */
249 248
250 clkinp = __clk_get_rate(__clk_get_parent(clk)); 249 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
251 fint = (clkinp / n) * m; 250 fint = (clkinp / n) * m;
252 251
253 if (fint < 1000000000) 252 if (fint < 1000000000)
@@ -268,12 +267,12 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n)
268 * XXX This code is not needed for 3430/AM35xx; can it be optimized 267 * XXX This code is not needed for 3430/AM35xx; can it be optimized
269 * out in non-multi-OMAP builds for those chips? 268 * out in non-multi-OMAP builds for those chips?
270 */ 269 */
271static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) 270static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n)
272{ 271{
273 unsigned long clkinp, sd; /* watch out for overflow */ 272 unsigned long clkinp, sd; /* watch out for overflow */
274 int mod1, mod2; 273 int mod1, mod2;
275 274
276 clkinp = __clk_get_rate(__clk_get_parent(clk)); 275 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
277 276
278 /* 277 /*
279 * target sigma-delta to near 250MHz 278 * target sigma-delta to near 250MHz
@@ -300,7 +299,8 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n)
300 * Program the DPLL with the supplied M, N values, and wait for the DPLL to 299 * Program the DPLL with the supplied M, N values, and wait for the DPLL to
301 * lock.. Returns -EINVAL upon error, or 0 upon success. 300 * lock.. Returns -EINVAL upon error, or 0 upon success.
302 */ 301 */
303static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) 302static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n,
303 u16 freqsel)
304{ 304{
305 struct dpll_data *dd = clk->dpll_data; 305 struct dpll_data *dd = clk->dpll_data;
306 u8 dco, sd_div; 306 u8 dco, sd_div;
@@ -357,8 +357,10 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
357 * 357 *
358 * Recalculate and propagate the DPLL rate. 358 * Recalculate and propagate the DPLL rate.
359 */ 359 */
360unsigned long omap3_dpll_recalc(struct clk *clk) 360unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate)
361{ 361{
362 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
363
362 return omap2_get_dpll_rate(clk); 364 return omap2_get_dpll_rate(clk);
363} 365}
364 366
@@ -378,8 +380,9 @@ unsigned long omap3_dpll_recalc(struct clk *clk)
378 * support low-power stop, or if the DPLL took too long to enter 380 * support low-power stop, or if the DPLL took too long to enter
379 * bypass or lock, return -EINVAL; otherwise, return 0. 381 * bypass or lock, return -EINVAL; otherwise, return 0.
380 */ 382 */
381int omap3_noncore_dpll_enable(struct clk *clk) 383int omap3_noncore_dpll_enable(struct clk_hw *hw)
382{ 384{
385 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
383 int r; 386 int r;
384 struct dpll_data *dd; 387 struct dpll_data *dd;
385 struct clk *parent; 388 struct clk *parent;
@@ -388,22 +391,26 @@ int omap3_noncore_dpll_enable(struct clk *clk)
388 if (!dd) 391 if (!dd)
389 return -EINVAL; 392 return -EINVAL;
390 393
391 parent = __clk_get_parent(clk); 394 if (clk->clkdm) {
395 r = clkdm_clk_enable(clk->clkdm, hw->clk);
396 if (r) {
397 WARN(1,
398 "%s: could not enable %s's clockdomain %s: %d\n",
399 __func__, __clk_get_name(hw->clk),
400 clk->clkdm->name, r);
401 return r;
402 }
403 }
392 404
393 if (__clk_get_rate(clk) == __clk_get_rate(dd->clk_bypass)) { 405 parent = __clk_get_parent(hw->clk);
406
407 if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) {
394 WARN_ON(parent != dd->clk_bypass); 408 WARN_ON(parent != dd->clk_bypass);
395 r = _omap3_noncore_dpll_bypass(clk); 409 r = _omap3_noncore_dpll_bypass(clk);
396 } else { 410 } else {
397 WARN_ON(parent != dd->clk_ref); 411 WARN_ON(parent != dd->clk_ref);
398 r = _omap3_noncore_dpll_lock(clk); 412 r = _omap3_noncore_dpll_lock(clk);
399 } 413 }
400 /*
401 *FIXME: this is dubious - if clk->rate has changed, what about
402 * propagating?
403 */
404 if (!r)
405 clk->rate = (clk->recalc) ? clk->recalc(clk) :
406 omap2_get_dpll_rate(clk);
407 414
408 return r; 415 return r;
409} 416}
@@ -415,9 +422,13 @@ int omap3_noncore_dpll_enable(struct clk *clk)
415 * Instructs a non-CORE DPLL to enter low-power stop. This function is 422 * Instructs a non-CORE DPLL to enter low-power stop. This function is
416 * intended for use in struct clkops. No return value. 423 * intended for use in struct clkops. No return value.
417 */ 424 */
418void omap3_noncore_dpll_disable(struct clk *clk) 425void omap3_noncore_dpll_disable(struct clk_hw *hw)
419{ 426{
427 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
428
420 _omap3_noncore_dpll_stop(clk); 429 _omap3_noncore_dpll_stop(clk);
430 if (clk->clkdm)
431 clkdm_clk_disable(clk->clkdm, hw->clk);
421} 432}
422 433
423 434
@@ -434,80 +445,72 @@ void omap3_noncore_dpll_disable(struct clk *clk)
434 * target rate if it hasn't been done already, then program and lock 445 * target rate if it hasn't been done already, then program and lock
435 * the DPLL. Returns -EINVAL upon error, or 0 upon success. 446 * the DPLL. Returns -EINVAL upon error, or 0 upon success.
436 */ 447 */
437int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) 448int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
449 unsigned long parent_rate)
438{ 450{
451 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
439 struct clk *new_parent = NULL; 452 struct clk *new_parent = NULL;
440 unsigned long hw_rate, bypass_rate;
441 u16 freqsel = 0; 453 u16 freqsel = 0;
442 struct dpll_data *dd; 454 struct dpll_data *dd;
443 int ret; 455 int ret;
444 456
445 if (!clk || !rate) 457 if (!hw || !rate)
446 return -EINVAL; 458 return -EINVAL;
447 459
448 dd = clk->dpll_data; 460 dd = clk->dpll_data;
449 if (!dd) 461 if (!dd)
450 return -EINVAL; 462 return -EINVAL;
451 463
452 hw_rate = (clk->recalc) ? clk->recalc(clk) : omap2_get_dpll_rate(clk); 464 __clk_prepare(dd->clk_bypass);
453 if (rate == hw_rate) 465 clk_enable(dd->clk_bypass);
454 return 0; 466 __clk_prepare(dd->clk_ref);
467 clk_enable(dd->clk_ref);
455 468
456 /* 469 if (__clk_get_rate(dd->clk_bypass) == rate &&
457 * Ensure both the bypass and ref clocks are enabled prior to 470 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
458 * doing anything; we need the bypass clock running to reprogram 471 pr_debug("%s: %s: set rate: entering bypass.\n",
459 * the DPLL. 472 __func__, __clk_get_name(hw->clk));
460 */
461 omap2_clk_enable(dd->clk_bypass);
462 omap2_clk_enable(dd->clk_ref);
463
464 bypass_rate = __clk_get_rate(dd->clk_bypass);
465 if (bypass_rate == rate &&
466 (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
467 pr_debug("clock: %s: set rate: entering bypass.\n", clk->name);
468 473
469 ret = _omap3_noncore_dpll_bypass(clk); 474 ret = _omap3_noncore_dpll_bypass(clk);
470 if (!ret) 475 if (!ret)
471 new_parent = dd->clk_bypass; 476 new_parent = dd->clk_bypass;
472 } else { 477 } else {
473 if (dd->last_rounded_rate != rate) 478 if (dd->last_rounded_rate != rate)
474 rate = clk->round_rate(clk, rate); 479 rate = __clk_round_rate(hw->clk, rate);
475 480
476 if (dd->last_rounded_rate == 0) 481 if (dd->last_rounded_rate == 0)
477 return -EINVAL; 482 return -EINVAL;
478 483
479 /* No freqsel on OMAP4 and OMAP3630 */ 484 /* No freqsel on OMAP4 and OMAP3630 */
480 if (!soc_is_am33xx() && !cpu_is_omap44xx() && !cpu_is_omap3630()) { 485 if (!cpu_is_omap44xx() && !cpu_is_omap3630()) {
481 freqsel = _omap3_dpll_compute_freqsel(clk, 486 freqsel = _omap3_dpll_compute_freqsel(clk,
482 dd->last_rounded_n); 487 dd->last_rounded_n);
483 if (!freqsel) 488 if (!freqsel)
484 WARN_ON(1); 489 WARN_ON(1);
485 } 490 }
486 491
487 pr_debug("clock: %s: set rate: locking rate to %lu.\n", 492 pr_debug("%s: %s: set rate: locking rate to %lu.\n",
488 __clk_get_name(clk), rate); 493 __func__, __clk_get_name(hw->clk), rate);
489 494
490 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, 495 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
491 dd->last_rounded_n, freqsel); 496 dd->last_rounded_n, freqsel);
492 if (!ret) 497 if (!ret)
493 new_parent = dd->clk_ref; 498 new_parent = dd->clk_ref;
494 } 499 }
495 if (!ret) { 500 /*
496 /* 501 * FIXME - this is all wrong. common code handles reparenting and
497 * Switch the parent clock in the hierarchy, and make sure 502 * migrating prepare/enable counts. dplls should be a multiplexer
498 * that the new parent's usecount is correct. Note: we 503 * clock and this should be a set_parent operation so that all of that
499 * enable the new parent before disabling the old to avoid 504 * stuff is inherited for free
500 * any unnecessary hardware disable->enable transitions. 505 */
501 */ 506
502 if (clk->usecount) { 507 if (!ret)
503 omap2_clk_enable(new_parent); 508 __clk_reparent(hw->clk, new_parent);
504 omap2_clk_disable(clk->parent); 509
505 } 510 clk_disable(dd->clk_ref);
506 clk_reparent(clk, new_parent); 511 __clk_unprepare(dd->clk_ref);
507 clk->rate = rate; 512 clk_disable(dd->clk_bypass);
508 } 513 __clk_unprepare(dd->clk_bypass);
509 omap2_clk_disable(dd->clk_ref);
510 omap2_clk_disable(dd->clk_bypass);
511 514
512 return 0; 515 return 0;
513} 516}
@@ -522,7 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
522 * -EINVAL if passed a null pointer or if the struct clk does not 525 * -EINVAL if passed a null pointer or if the struct clk does not
523 * appear to refer to a DPLL. 526 * appear to refer to a DPLL.
524 */ 527 */
525u32 omap3_dpll_autoidle_read(struct clk *clk) 528u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk)
526{ 529{
527 const struct dpll_data *dd; 530 const struct dpll_data *dd;
528 u32 v; 531 u32 v;
@@ -551,7 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk *clk)
551 * OMAP3430. The DPLL will enter low-power stop when its downstream 554 * OMAP3430. The DPLL will enter low-power stop when its downstream
552 * clocks are gated. No return value. 555 * clocks are gated. No return value.
553 */ 556 */
554void omap3_dpll_allow_idle(struct clk *clk) 557void omap3_dpll_allow_idle(struct clk_hw_omap *clk)
555{ 558{
556 const struct dpll_data *dd; 559 const struct dpll_data *dd;
557 u32 v; 560 u32 v;
@@ -561,11 +564,8 @@ void omap3_dpll_allow_idle(struct clk *clk)
561 564
562 dd = clk->dpll_data; 565 dd = clk->dpll_data;
563 566
564 if (!dd->autoidle_reg) { 567 if (!dd->autoidle_reg)
565 pr_debug("clock: DPLL %s: autoidle not supported\n",
566 __clk_get_name(clk));
567 return; 568 return;
568 }
569 569
570 /* 570 /*
571 * REVISIT: CORE DPLL can optionally enter low-power bypass 571 * REVISIT: CORE DPLL can optionally enter low-power bypass
@@ -585,7 +585,7 @@ void omap3_dpll_allow_idle(struct clk *clk)
585 * 585 *
586 * Disable DPLL automatic idle control. No return value. 586 * Disable DPLL automatic idle control. No return value.
587 */ 587 */
588void omap3_dpll_deny_idle(struct clk *clk) 588void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
589{ 589{
590 const struct dpll_data *dd; 590 const struct dpll_data *dd;
591 u32 v; 591 u32 v;
@@ -595,11 +595,8 @@ void omap3_dpll_deny_idle(struct clk *clk)
595 595
596 dd = clk->dpll_data; 596 dd = clk->dpll_data;
597 597
598 if (!dd->autoidle_reg) { 598 if (!dd->autoidle_reg)
599 pr_debug("clock: DPLL %s: autoidle not supported\n",
600 __clk_get_name(clk));
601 return; 599 return;
602 }
603 600
604 v = __raw_readl(dd->autoidle_reg); 601 v = __raw_readl(dd->autoidle_reg);
605 v &= ~dd->autoidle_mask; 602 v &= ~dd->autoidle_mask;
@@ -617,18 +614,25 @@ void omap3_dpll_deny_idle(struct clk *clk)
617 * Using parent clock DPLL data, look up DPLL state. If locked, set our 614 * Using parent clock DPLL data, look up DPLL state. If locked, set our
618 * rate to the dpll_clk * 2; otherwise, just use dpll_clk. 615 * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
619 */ 616 */
620unsigned long omap3_clkoutx2_recalc(struct clk *clk) 617unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
618 unsigned long parent_rate)
621{ 619{
622 const struct dpll_data *dd; 620 const struct dpll_data *dd;
623 unsigned long rate; 621 unsigned long rate;
624 u32 v; 622 u32 v;
625 struct clk *pclk; 623 struct clk_hw_omap *pclk = NULL;
626 unsigned long parent_rate; 624 struct clk *parent;
627 625
628 /* Walk up the parents of clk, looking for a DPLL */ 626 /* Walk up the parents of clk, looking for a DPLL */
629 pclk = __clk_get_parent(clk); 627 do {
630 while (pclk && !pclk->dpll_data) 628 do {
631 pclk = __clk_get_parent(pclk); 629 parent = __clk_get_parent(hw->clk);
630 hw = __clk_get_hw(parent);
631 } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC));
632 if (!hw)
633 break;
634 pclk = to_clk_hw_omap(hw);
635 } while (pclk && !pclk->dpll_data);
632 636
633 /* clk does not have a DPLL as a parent? error in the clock data */ 637 /* clk does not have a DPLL as a parent? error in the clock data */
634 if (!pclk) { 638 if (!pclk) {
@@ -640,7 +644,6 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
640 644
641 WARN_ON(!dd->enable_mask); 645 WARN_ON(!dd->enable_mask);
642 646
643 parent_rate = __clk_get_rate(__clk_get_parent(clk));
644 v = __raw_readl(dd->control_reg) & dd->enable_mask; 647 v = __raw_readl(dd->control_reg) & dd->enable_mask;
645 v >>= __ffs(dd->enable_mask); 648 v >>= __ffs(dd->enable_mask);
646 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) 649 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE))
@@ -651,15 +654,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
651} 654}
652 655
653/* OMAP3/4 non-CORE DPLL clkops */ 656/* OMAP3/4 non-CORE DPLL clkops */
654 657const struct clk_hw_omap_ops clkhwops_omap3_dpll = {
655const struct clkops clkops_omap3_noncore_dpll_ops = {
656 .enable = omap3_noncore_dpll_enable,
657 .disable = omap3_noncore_dpll_disable,
658 .allow_idle = omap3_dpll_allow_idle,
659 .deny_idle = omap3_dpll_deny_idle,
660};
661
662const struct clkops clkops_omap3_core_dpll_ops = {
663 .allow_idle = omap3_dpll_allow_idle, 658 .allow_idle = omap3_dpll_allow_idle,
664 .deny_idle = omap3_dpll_deny_idle, 659 .deny_idle = omap3_dpll_deny_idle,
665}; 660};
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 09d0ccccb86..d3326c474fd 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -15,15 +15,13 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17 17
18#include <plat/clock.h>
19
20#include "soc.h" 18#include "soc.h"
21#include "clock.h" 19#include "clock.h"
22#include "clock44xx.h" 20#include "clock44xx.h"
23#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
24 22
25/* Supported only on OMAP4 */ 23/* Supported only on OMAP4 */
26int omap4_dpllmx_gatectrl_read(struct clk *clk) 24int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk)
27{ 25{
28 u32 v; 26 u32 v;
29 u32 mask; 27 u32 mask;
@@ -42,7 +40,7 @@ int omap4_dpllmx_gatectrl_read(struct clk *clk)
42 return v; 40 return v;
43} 41}
44 42
45void omap4_dpllmx_allow_gatectrl(struct clk *clk) 43void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
46{ 44{
47 u32 v; 45 u32 v;
48 u32 mask; 46 u32 mask;
@@ -60,7 +58,7 @@ void omap4_dpllmx_allow_gatectrl(struct clk *clk)
60 __raw_writel(v, clk->clksel_reg); 58 __raw_writel(v, clk->clksel_reg);
61} 59}
62 60
63void omap4_dpllmx_deny_gatectrl(struct clk *clk) 61void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
64{ 62{
65 u32 v; 63 u32 v;
66 u32 mask; 64 u32 mask;
@@ -78,9 +76,9 @@ void omap4_dpllmx_deny_gatectrl(struct clk *clk)
78 __raw_writel(v, clk->clksel_reg); 76 __raw_writel(v, clk->clksel_reg);
79} 77}
80 78
81const struct clkops clkops_omap4_dpllmx_ops = { 79const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = {
82 .allow_idle = omap4_dpllmx_allow_gatectrl, 80 .allow_idle = omap4_dpllmx_allow_gatectrl,
83 .deny_idle = omap4_dpllmx_deny_gatectrl, 81 .deny_idle = omap4_dpllmx_deny_gatectrl,
84}; 82};
85 83
86/** 84/**
@@ -92,8 +90,10 @@ const struct clkops clkops_omap4_dpllmx_ops = {
92 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers) 90 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers)
93 * upon success, or 0 upon error. 91 * upon success, or 0 upon error.
94 */ 92 */
95unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk) 93unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
94 unsigned long parent_rate)
96{ 95{
96 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
97 u32 v; 97 u32 v;
98 unsigned long rate; 98 unsigned long rate;
99 struct dpll_data *dd; 99 struct dpll_data *dd;
@@ -125,8 +125,11 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk)
125 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or 125 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or
126 * ~0 if an error occurred in omap2_dpll_round_rate(). 126 * ~0 if an error occurred in omap2_dpll_round_rate().
127 */ 127 */
128long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate) 128long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
129 unsigned long target_rate,
130 unsigned long *parent_rate)
129{ 131{
132 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
130 u32 v; 133 u32 v;
131 struct dpll_data *dd; 134 struct dpll_data *dd;
132 long r; 135 long r;
@@ -142,7 +145,7 @@ long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate)
142 if (v) 145 if (v)
143 target_rate = target_rate / OMAP4430_REGM4XEN_MULT; 146 target_rate = target_rate / OMAP4430_REGM4XEN_MULT;
144 147
145 r = omap2_dpll_round_rate(clk, target_rate); 148 r = omap2_dpll_round_rate(hw, target_rate, NULL);
146 if (r == ~0) 149 if (r == ~0)
147 return r; 150 return r;
148 151
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
index 72e0f01b715..fce5aa3fff4 100644
--- a/arch/arm/mach-omap2/drm.c
+++ b/arch/arm/mach-omap2/drm.c
@@ -23,15 +23,20 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/platform_data/omap_drm.h>
26 27
27#include <plat/omap_device.h> 28#include "omap_device.h"
28#include <plat/omap_hwmod.h> 29#include "omap_hwmod.h"
30#include <plat/cpu.h>
29 31
30#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) 32#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
31 33
34static struct omap_drm_platform_data platform_data;
35
32static struct platform_device omap_drm_device = { 36static struct platform_device omap_drm_device = {
33 .dev = { 37 .dev = {
34 .coherent_dma_mask = DMA_BIT_MASK(32), 38 .coherent_dma_mask = DMA_BIT_MASK(32),
39 .platform_data = &platform_data,
35 }, 40 },
36 .name = "omapdrm", 41 .name = "omapdrm",
37 .id = 0, 42 .id = 0,
@@ -52,6 +57,8 @@ static int __init omap_init_drm(void)
52 oh->name); 57 oh->name);
53 } 58 }
54 59
60 platform_data.omaprev = GET_OMAP_REVISION();
61
55 return platform_device_register(&omap_drm_device); 62 return platform_device_register(&omap_drm_device);
56 63
57} 64}
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
index 98388109f22..b155500e84a 100644
--- a/arch/arm/mach-omap2/dsp.c
+++ b/arch/arm/mach-omap2/dsp.c
@@ -27,7 +27,7 @@
27#include "cm2xxx_3xxx.h" 27#include "cm2xxx_3xxx.h"
28#include "prm2xxx_3xxx.h" 28#include "prm2xxx_3xxx.h"
29#ifdef CONFIG_BRIDGE_DVFS 29#ifdef CONFIG_BRIDGE_DVFS
30#include <plat/omap-pm.h> 30#include "omap-pm.h"
31#endif 31#endif
32 32
33#include <linux/platform_data/dsp-omap.h> 33#include <linux/platform_data/dsp-omap.h>
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
new file mode 100644
index 00000000000..679a0478644
--- /dev/null
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -0,0 +1,276 @@
1/*
2 * Copyright (C) 2012 Texas Instruments, Inc..
3 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA
18 *
19 */
20
21/*
22 * NOTE: this is a transitional file to help with DT adaptation.
23 * This file will be removed when DSS supports DT.
24 */
25
26#include <linux/kernel.h>
27#include <linux/gpio.h>
28
29#include <video/omapdss.h>
30#include <video/omap-panel-tfp410.h>
31#include <video/omap-panel-nokia-dsi.h>
32#include <video/omap-panel-picodlp.h>
33
34#include <plat/cpu.h>
35
36#include "dss-common.h"
37#include "mux.h"
38
39#define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
40#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
41#define HDMI_GPIO_HPD 63 /* Hotplug detect */
42
43/* Display DVI */
44#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
45
46/* Using generic display panel */
47static struct tfp410_platform_data omap4_dvi_panel = {
48 .i2c_bus_num = 3,
49 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
50};
51
52static struct omap_dss_device omap4_panda_dvi_device = {
53 .type = OMAP_DISPLAY_TYPE_DPI,
54 .name = "dvi",
55 .driver_name = "tfp410",
56 .data = &omap4_dvi_panel,
57 .phy.dpi.data_lines = 24,
58 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
59 .channel = OMAP_DSS_CHANNEL_LCD2,
60};
61
62static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
63 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
64 .ls_oe_gpio = HDMI_GPIO_LS_OE,
65 .hpd_gpio = HDMI_GPIO_HPD,
66};
67
68static struct omap_dss_device omap4_panda_hdmi_device = {
69 .name = "hdmi",
70 .driver_name = "hdmi_panel",
71 .type = OMAP_DISPLAY_TYPE_HDMI,
72 .channel = OMAP_DSS_CHANNEL_DIGIT,
73 .data = &omap4_panda_hdmi_data,
74};
75
76static struct omap_dss_device *omap4_panda_dss_devices[] = {
77 &omap4_panda_dvi_device,
78 &omap4_panda_hdmi_device,
79};
80
81static struct omap_dss_board_info omap4_panda_dss_data = {
82 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
83 .devices = omap4_panda_dss_devices,
84 .default_device = &omap4_panda_dvi_device,
85};
86
87void __init omap4_panda_display_init(void)
88{
89 omap_display_init(&omap4_panda_dss_data);
90
91 /*
92 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
93 * later have external pull up on the HDMI I2C lines
94 */
95 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
96 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
97 else
98 omap_hdmi_init(0);
99
100 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
101 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
102 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
103}
104
105void __init omap4_panda_display_init_of(void)
106{
107 omap_display_init(&omap4_panda_dss_data);
108}
109
110
111/* OMAP4 Blaze display data */
112
113#define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */
114#define DLP_POWER_ON_GPIO 40
115
116static struct nokia_dsi_panel_data dsi1_panel = {
117 .name = "taal",
118 .reset_gpio = 102,
119 .use_ext_te = false,
120 .ext_te_gpio = 101,
121 .esd_interval = 0,
122 .pin_config = {
123 .num_pins = 6,
124 .pins = { 0, 1, 2, 3, 4, 5 },
125 },
126};
127
128static struct omap_dss_device sdp4430_lcd_device = {
129 .name = "lcd",
130 .driver_name = "taal",
131 .type = OMAP_DISPLAY_TYPE_DSI,
132 .data = &dsi1_panel,
133 .phy.dsi = {
134 .module = 0,
135 },
136 .channel = OMAP_DSS_CHANNEL_LCD,
137};
138
139static struct nokia_dsi_panel_data dsi2_panel = {
140 .name = "taal",
141 .reset_gpio = 104,
142 .use_ext_te = false,
143 .ext_te_gpio = 103,
144 .esd_interval = 0,
145 .pin_config = {
146 .num_pins = 6,
147 .pins = { 0, 1, 2, 3, 4, 5 },
148 },
149};
150
151static struct omap_dss_device sdp4430_lcd2_device = {
152 .name = "lcd2",
153 .driver_name = "taal",
154 .type = OMAP_DISPLAY_TYPE_DSI,
155 .data = &dsi2_panel,
156 .phy.dsi = {
157
158 .module = 1,
159 },
160 .channel = OMAP_DSS_CHANNEL_LCD2,
161};
162
163static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
164 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
165 .ls_oe_gpio = HDMI_GPIO_LS_OE,
166 .hpd_gpio = HDMI_GPIO_HPD,
167};
168
169static struct omap_dss_device sdp4430_hdmi_device = {
170 .name = "hdmi",
171 .driver_name = "hdmi_panel",
172 .type = OMAP_DISPLAY_TYPE_HDMI,
173 .channel = OMAP_DSS_CHANNEL_DIGIT,
174 .data = &sdp4430_hdmi_data,
175};
176
177static struct picodlp_panel_data sdp4430_picodlp_pdata = {
178 .picodlp_adapter_id = 2,
179 .emu_done_gpio = 44,
180 .pwrgood_gpio = 45,
181};
182
183static void sdp4430_picodlp_init(void)
184{
185 int r;
186 const struct gpio picodlp_gpios[] = {
187 {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
188 "DLP POWER ON"},
189 {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN,
190 "DLP EMU DONE"},
191 {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW,
192 "DLP PWRGOOD"},
193 };
194
195 r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios));
196 if (r)
197 pr_err("Cannot request PicoDLP GPIOs, error %d\n", r);
198}
199
200static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev)
201{
202 gpio_set_value(DISPLAY_SEL_GPIO, 0);
203 gpio_set_value(DLP_POWER_ON_GPIO, 1);
204
205 return 0;
206}
207
208static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev)
209{
210 gpio_set_value(DLP_POWER_ON_GPIO, 0);
211 gpio_set_value(DISPLAY_SEL_GPIO, 1);
212}
213
214static struct omap_dss_device sdp4430_picodlp_device = {
215 .name = "picodlp",
216 .driver_name = "picodlp_panel",
217 .type = OMAP_DISPLAY_TYPE_DPI,
218 .phy.dpi.data_lines = 24,
219 .channel = OMAP_DSS_CHANNEL_LCD2,
220 .platform_enable = sdp4430_panel_enable_picodlp,
221 .platform_disable = sdp4430_panel_disable_picodlp,
222 .data = &sdp4430_picodlp_pdata,
223};
224
225static struct omap_dss_device *sdp4430_dss_devices[] = {
226 &sdp4430_lcd_device,
227 &sdp4430_lcd2_device,
228 &sdp4430_hdmi_device,
229 &sdp4430_picodlp_device,
230};
231
232static struct omap_dss_board_info sdp4430_dss_data = {
233 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
234 .devices = sdp4430_dss_devices,
235 .default_device = &sdp4430_lcd_device,
236};
237
238void __init omap_4430sdp_display_init(void)
239{
240 int r;
241
242 /* Enable LCD2 by default (instead of Pico DLP) */
243 r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
244 "display_sel");
245 if (r)
246 pr_err("%s: Could not get display_sel GPIO\n", __func__);
247
248 sdp4430_picodlp_init();
249 omap_display_init(&sdp4430_dss_data);
250 /*
251 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
252 * later have external pull up on the HDMI I2C lines
253 */
254 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
255 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
256 else
257 omap_hdmi_init(0);
258
259 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
260 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
261 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
262}
263
264void __init omap_4430sdp_display_init_of(void)
265{
266 int r;
267
268 /* Enable LCD2 by default (instead of Pico DLP) */
269 r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
270 "display_sel");
271 if (r)
272 pr_err("%s: Could not get display_sel GPIO\n", __func__);
273
274 sdp4430_picodlp_init();
275 omap_display_init(&sdp4430_dss_data);
276}
diff --git a/arch/arm/mach-omap2/dss-common.h b/arch/arm/mach-omap2/dss-common.h
new file mode 100644
index 00000000000..915f6fff510
--- /dev/null
+++ b/arch/arm/mach-omap2/dss-common.h
@@ -0,0 +1,14 @@
1#ifndef __OMAP_DSS_COMMON__
2#define __OMAP_DSS_COMMON__
3
4/*
5 * NOTE: this is a transitional file to help with DT adaptation.
6 * This file will be removed when DSS supports DT.
7 */
8
9void __init omap4_panda_display_init(void);
10void __init omap4_panda_display_init_of(void);
11void __init omap_4430sdp_display_init(void);
12void __init omap_4430sdp_display_init_of(void);
13
14#endif
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index d1058f16fb4..399acabc3d0 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -23,9 +23,9 @@
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/platform_data/gpio-omap.h> 24#include <linux/platform_data/gpio-omap.h>
25 25
26#include <plat/omap_hwmod.h> 26#include "omap_hwmod.h"
27#include <plat/omap_device.h> 27#include "omap_device.h"
28#include <plat/omap-pm.h> 28#include "omap-pm.h"
29 29
30#include "powerdomain.h" 30#include "powerdomain.h"
31 31
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 4acf497faeb..db969a5c499 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -17,9 +17,12 @@
17 17
18#include <asm/mach/flash.h> 18#include <asm/mach/flash.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21
22#include "soc.h" 21#include "soc.h"
22#include "gpmc-nand.h"
23
24/* minimum size for IO mapping */
25#define NAND_IO_SIZE 4
23 26
24static struct resource gpmc_nand_resource[] = { 27static struct resource gpmc_nand_resource[] = {
25 { 28 {
@@ -40,41 +43,36 @@ static struct platform_device gpmc_nand_device = {
40 .resource = gpmc_nand_resource, 43 .resource = gpmc_nand_resource,
41}; 44};
42 45
43static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data) 46static int omap2_nand_gpmc_retime(
47 struct omap_nand_platform_data *gpmc_nand_data,
48 struct gpmc_timings *gpmc_t)
44{ 49{
45 struct gpmc_timings t; 50 struct gpmc_timings t;
46 int err; 51 int err;
47 52
48 if (!gpmc_nand_data->gpmc_t)
49 return 0;
50
51 memset(&t, 0, sizeof(t)); 53 memset(&t, 0, sizeof(t));
52 t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk; 54 t.sync_clk = gpmc_t->sync_clk;
53 t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on); 55 t.cs_on = gpmc_t->cs_on;
54 t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on); 56 t.adv_on = gpmc_t->adv_on;
55 57
56 /* Read */ 58 /* Read */
57 t.adv_rd_off = gpmc_round_ns_to_ticks( 59 t.adv_rd_off = gpmc_t->adv_rd_off;
58 gpmc_nand_data->gpmc_t->adv_rd_off);
59 t.oe_on = t.adv_on; 60 t.oe_on = t.adv_on;
60 t.access = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->access); 61 t.access = gpmc_t->access;
61 t.oe_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->oe_off); 62 t.oe_off = gpmc_t->oe_off;
62 t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_rd_off); 63 t.cs_rd_off = gpmc_t->cs_rd_off;
63 t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->rd_cycle); 64 t.rd_cycle = gpmc_t->rd_cycle;
64 65
65 /* Write */ 66 /* Write */
66 t.adv_wr_off = gpmc_round_ns_to_ticks( 67 t.adv_wr_off = gpmc_t->adv_wr_off;
67 gpmc_nand_data->gpmc_t->adv_wr_off);
68 t.we_on = t.oe_on; 68 t.we_on = t.oe_on;
69 if (cpu_is_omap34xx()) { 69 if (cpu_is_omap34xx()) {
70 t.wr_data_mux_bus = gpmc_round_ns_to_ticks( 70 t.wr_data_mux_bus = gpmc_t->wr_data_mux_bus;
71 gpmc_nand_data->gpmc_t->wr_data_mux_bus); 71 t.wr_access = gpmc_t->wr_access;
72 t.wr_access = gpmc_round_ns_to_ticks(
73 gpmc_nand_data->gpmc_t->wr_access);
74 } 72 }
75 t.we_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->we_off); 73 t.we_off = gpmc_t->we_off;
76 t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_wr_off); 74 t.cs_wr_off = gpmc_t->cs_wr_off;
77 t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->wr_cycle); 75 t.wr_cycle = gpmc_t->wr_cycle;
78 76
79 /* Configure GPMC */ 77 /* Configure GPMC */
80 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) 78 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
@@ -91,7 +89,29 @@ static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data
91 return 0; 89 return 0;
92} 90}
93 91
94int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data) 92static bool __init gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
93{
94 /* support only OMAP3 class */
95 if (!cpu_is_omap34xx()) {
96 pr_err("BCH ecc is not supported on this CPU\n");
97 return 0;
98 }
99
100 /*
101 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
102 * Other chips may be added if confirmed to work.
103 */
104 if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) &&
105 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
106 pr_err("BCH 4-bit mode is not supported on this CPU\n");
107 return 0;
108 }
109
110 return 1;
111}
112
113int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
114 struct gpmc_timings *gpmc_t)
95{ 115{
96 int err = 0; 116 int err = 0;
97 struct device *dev = &gpmc_nand_device.dev; 117 struct device *dev = &gpmc_nand_device.dev;
@@ -112,11 +132,13 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
112 gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE); 132 gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
113 gpmc_nand_resource[2].start = 133 gpmc_nand_resource[2].start =
114 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT); 134 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
115 /* Set timings in GPMC */ 135
116 err = omap2_nand_gpmc_retime(gpmc_nand_data); 136 if (gpmc_t) {
117 if (err < 0) { 137 err = omap2_nand_gpmc_retime(gpmc_nand_data, gpmc_t);
118 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 138 if (err < 0) {
119 return err; 139 dev_err(dev, "Unable to set gpmc timings: %d\n", err);
140 return err;
141 }
120 } 142 }
121 143
122 /* Enable RD PIN Monitoring Reg */ 144 /* Enable RD PIN Monitoring Reg */
@@ -126,6 +148,9 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
126 148
127 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 149 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
128 150
151 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt))
152 return -EINVAL;
153
129 err = platform_device_register(&gpmc_nand_device); 154 err = platform_device_register(&gpmc_nand_device);
130 if (err < 0) { 155 if (err < 0) {
131 dev_err(dev, "Unable to register NAND device\n"); 156 dev_err(dev, "Unable to register NAND device\n");
diff --git a/arch/arm/mach-omap2/gpmc-nand.h b/arch/arm/mach-omap2/gpmc-nand.h
new file mode 100644
index 00000000000..d59e1281e85
--- /dev/null
+++ b/arch/arm/mach-omap2/gpmc-nand.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-omap2/gpmc-nand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_NAND_H
11#define __OMAP2_GPMC_NAND_H
12
13#include "gpmc.h"
14#include <linux/platform_data/mtd-nand-omap2.h>
15
16#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
17extern int gpmc_nand_init(struct omap_nand_platform_data *d,
18 struct gpmc_timings *gpmc_t);
19#else
20static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
21 struct gpmc_timings *gpmc_t)
22{
23 return 0;
24}
25#endif
26
27#endif
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 916716e1da3..94a349e4dc9 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -16,15 +16,24 @@
16#include <linux/mtd/onenand_regs.h> 16#include <linux/mtd/onenand_regs.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_data/mtd-onenand-omap2.h> 18#include <linux/platform_data/mtd-onenand-omap2.h>
19#include <linux/err.h>
19 20
20#include <asm/mach/flash.h> 21#include <asm/mach/flash.h>
21 22
22#include <plat/gpmc.h> 23#include "gpmc.h"
23
24#include "soc.h" 24#include "soc.h"
25#include "gpmc-onenand.h"
25 26
26#define ONENAND_IO_SIZE SZ_128K 27#define ONENAND_IO_SIZE SZ_128K
27 28
29#define ONENAND_FLAG_SYNCREAD (1 << 0)
30#define ONENAND_FLAG_SYNCWRITE (1 << 1)
31#define ONENAND_FLAG_HF (1 << 2)
32#define ONENAND_FLAG_VHF (1 << 3)
33
34static unsigned onenand_flags;
35static unsigned latency;
36
28static struct omap_onenand_platform_data *gpmc_onenand_data; 37static struct omap_onenand_platform_data *gpmc_onenand_data;
29 38
30static struct resource gpmc_onenand_resource = { 39static struct resource gpmc_onenand_resource = {
@@ -38,11 +47,10 @@ static struct platform_device gpmc_onenand_device = {
38 .resource = &gpmc_onenand_resource, 47 .resource = &gpmc_onenand_resource,
39}; 48};
40 49
41static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base) 50static struct gpmc_timings omap2_onenand_calc_async_timings(void)
42{ 51{
52 struct gpmc_device_timings dev_t;
43 struct gpmc_timings t; 53 struct gpmc_timings t;
44 u32 reg;
45 int err;
46 54
47 const int t_cer = 15; 55 const int t_cer = 15;
48 const int t_avdp = 12; 56 const int t_avdp = 12;
@@ -51,60 +59,49 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
51 const int t_aa = 76; 59 const int t_aa = 76;
52 const int t_oe = 20; 60 const int t_oe = 20;
53 const int t_cez = 20; /* max of t_cez, t_oez */ 61 const int t_cez = 20; /* max of t_cez, t_oez */
54 const int t_ds = 30;
55 const int t_wpl = 40; 62 const int t_wpl = 40;
56 const int t_wph = 30; 63 const int t_wph = 30;
57 64
58 /* Ensure sync read and sync write are disabled */ 65 memset(&dev_t, 0, sizeof(dev_t));
59 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
60 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
61 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
62 66
63 memset(&t, 0, sizeof(t)); 67 dev_t.mux = true;
64 t.sync_clk = 0; 68 dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000;
65 t.cs_on = 0; 69 dev_t.t_avdp_w = dev_t.t_avdp_r;
66 t.adv_on = 0; 70 dev_t.t_aavdh = t_aavdh * 1000;
67 71 dev_t.t_aa = t_aa * 1000;
68 /* Read */ 72 dev_t.t_ce = t_ce * 1000;
69 t.adv_rd_off = gpmc_round_ns_to_ticks(max_t(int, t_avdp, t_cer)); 73 dev_t.t_oe = t_oe * 1000;
70 t.oe_on = t.adv_rd_off + gpmc_round_ns_to_ticks(t_aavdh); 74 dev_t.t_cez_r = t_cez * 1000;
71 t.access = t.adv_on + gpmc_round_ns_to_ticks(t_aa); 75 dev_t.t_cez_w = dev_t.t_cez_r;
72 t.access = max_t(int, t.access, t.cs_on + gpmc_round_ns_to_ticks(t_ce)); 76 dev_t.t_wpl = t_wpl * 1000;
73 t.access = max_t(int, t.access, t.oe_on + gpmc_round_ns_to_ticks(t_oe)); 77 dev_t.t_wph = t_wph * 1000;
74 t.oe_off = t.access + gpmc_round_ns_to_ticks(1); 78
75 t.cs_rd_off = t.oe_off; 79 gpmc_calc_timings(&t, &dev_t);
76 t.rd_cycle = t.cs_rd_off + gpmc_round_ns_to_ticks(t_cez); 80
77 81 return t;
78 /* Write */ 82}
79 t.adv_wr_off = t.adv_rd_off;
80 t.we_on = t.oe_on;
81 if (cpu_is_omap34xx()) {
82 t.wr_data_mux_bus = t.we_on;
83 t.wr_access = t.we_on + gpmc_round_ns_to_ticks(t_ds);
84 }
85 t.we_off = t.we_on + gpmc_round_ns_to_ticks(t_wpl);
86 t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph);
87 t.wr_cycle = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez);
88 83
84static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
85{
89 /* Configure GPMC for asynchronous read */ 86 /* Configure GPMC for asynchronous read */
90 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 87 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
91 GPMC_CONFIG1_DEVICESIZE_16 | 88 GPMC_CONFIG1_DEVICESIZE_16 |
92 GPMC_CONFIG1_MUXADDDATA); 89 GPMC_CONFIG1_MUXADDDATA);
93 90
94 err = gpmc_cs_set_timings(cs, &t); 91 return gpmc_cs_set_timings(cs, t);
95 if (err) 92}
96 return err; 93
94static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
95{
96 u32 reg;
97 97
98 /* Ensure sync read and sync write are disabled */ 98 /* Ensure sync read and sync write are disabled */
99 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1); 99 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
100 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE; 100 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
101 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1); 101 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
102
103 return 0;
104} 102}
105 103
106static void set_onenand_cfg(void __iomem *onenand_base, int latency, 104static void set_onenand_cfg(void __iomem *onenand_base)
107 int sync_read, int sync_write, int hf, int vhf)
108{ 105{
109 u32 reg; 106 u32 reg;
110 107
@@ -112,19 +109,19 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
112 reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9)); 109 reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9));
113 reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) | 110 reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
114 ONENAND_SYS_CFG1_BL_16; 111 ONENAND_SYS_CFG1_BL_16;
115 if (sync_read) 112 if (onenand_flags & ONENAND_FLAG_SYNCREAD)
116 reg |= ONENAND_SYS_CFG1_SYNC_READ; 113 reg |= ONENAND_SYS_CFG1_SYNC_READ;
117 else 114 else
118 reg &= ~ONENAND_SYS_CFG1_SYNC_READ; 115 reg &= ~ONENAND_SYS_CFG1_SYNC_READ;
119 if (sync_write) 116 if (onenand_flags & ONENAND_FLAG_SYNCWRITE)
120 reg |= ONENAND_SYS_CFG1_SYNC_WRITE; 117 reg |= ONENAND_SYS_CFG1_SYNC_WRITE;
121 else 118 else
122 reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE; 119 reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE;
123 if (hf) 120 if (onenand_flags & ONENAND_FLAG_HF)
124 reg |= ONENAND_SYS_CFG1_HF; 121 reg |= ONENAND_SYS_CFG1_HF;
125 else 122 else
126 reg &= ~ONENAND_SYS_CFG1_HF; 123 reg &= ~ONENAND_SYS_CFG1_HF;
127 if (vhf) 124 if (onenand_flags & ONENAND_FLAG_VHF)
128 reg |= ONENAND_SYS_CFG1_VHF; 125 reg |= ONENAND_SYS_CFG1_VHF;
129 else 126 else
130 reg &= ~ONENAND_SYS_CFG1_VHF; 127 reg &= ~ONENAND_SYS_CFG1_VHF;
@@ -132,21 +129,10 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
132} 129}
133 130
134static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg, 131static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
135 void __iomem *onenand_base, bool *clk_dep) 132 void __iomem *onenand_base)
136{ 133{
137 u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID); 134 u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID);
138 int freq = 0; 135 int freq;
139
140 if (cfg->get_freq) {
141 struct onenand_freq_info fi;
142
143 fi.maf_id = readw(onenand_base + ONENAND_REG_MANUFACTURER_ID);
144 fi.dev_id = readw(onenand_base + ONENAND_REG_DEVICE_ID);
145 fi.ver_id = ver;
146 freq = cfg->get_freq(&fi, clk_dep);
147 if (freq)
148 return freq;
149 }
150 136
151 switch ((ver >> 4) & 0xf) { 137 switch ((ver >> 4) & 0xf) {
152 case 0: 138 case 0:
@@ -172,41 +158,24 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
172 return freq; 158 return freq;
173} 159}
174 160
175static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, 161static struct gpmc_timings
176 void __iomem *onenand_base, 162omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
177 int *freq_ptr) 163 int freq)
178{ 164{
165 struct gpmc_device_timings dev_t;
179 struct gpmc_timings t; 166 struct gpmc_timings t;
180 const int t_cer = 15; 167 const int t_cer = 15;
181 const int t_avdp = 12; 168 const int t_avdp = 12;
182 const int t_cez = 20; /* max of t_cez, t_oez */ 169 const int t_cez = 20; /* max of t_cez, t_oez */
183 const int t_ds = 30;
184 const int t_wpl = 40; 170 const int t_wpl = 40;
185 const int t_wph = 30; 171 const int t_wph = 30;
186 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; 172 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
187 int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; 173 int div, gpmc_clk_ns;
188 int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0;
189 int err, ticks_cez;
190 int cs = cfg->cs, freq = *freq_ptr;
191 u32 reg;
192 bool clk_dep = false;
193 174
194 if (cfg->flags & ONENAND_SYNC_READ) { 175 if (cfg->flags & ONENAND_SYNC_READ)
195 sync_read = 1; 176 onenand_flags = ONENAND_FLAG_SYNCREAD;
196 } else if (cfg->flags & ONENAND_SYNC_READWRITE) { 177 else if (cfg->flags & ONENAND_SYNC_READWRITE)
197 sync_read = 1; 178 onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE;
198 sync_write = 1;
199 } else
200 return omap2_onenand_set_async_mode(cs, onenand_base);
201
202 if (!freq) {
203 /* Very first call freq is not known */
204 err = omap2_onenand_set_async_mode(cs, onenand_base);
205 if (err)
206 return err;
207 freq = omap2_onenand_get_freq(cfg, onenand_base, &clk_dep);
208 first_time = 1;
209 }
210 179
211 switch (freq) { 180 switch (freq) {
212 case 104: 181 case 104:
@@ -244,116 +213,67 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
244 t_ach = 9; 213 t_ach = 9;
245 t_aavdh = 7; 214 t_aavdh = 7;
246 t_rdyo = 15; 215 t_rdyo = 15;
247 sync_write = 0; 216 onenand_flags &= ~ONENAND_FLAG_SYNCWRITE;
248 break; 217 break;
249 } 218 }
250 219
251 div = gpmc_cs_calc_divider(cs, min_gpmc_clk_period); 220 div = gpmc_calc_divider(min_gpmc_clk_period);
252 gpmc_clk_ns = gpmc_ticks_to_ns(div); 221 gpmc_clk_ns = gpmc_ticks_to_ns(div);
253 if (gpmc_clk_ns < 15) /* >66Mhz */ 222 if (gpmc_clk_ns < 15) /* >66Mhz */
254 hf = 1; 223 onenand_flags |= ONENAND_FLAG_HF;
224 else
225 onenand_flags &= ~ONENAND_FLAG_HF;
255 if (gpmc_clk_ns < 12) /* >83Mhz */ 226 if (gpmc_clk_ns < 12) /* >83Mhz */
256 vhf = 1; 227 onenand_flags |= ONENAND_FLAG_VHF;
257 if (vhf) 228 else
229 onenand_flags &= ~ONENAND_FLAG_VHF;
230 if (onenand_flags & ONENAND_FLAG_VHF)
258 latency = 8; 231 latency = 8;
259 else if (hf) 232 else if (onenand_flags & ONENAND_FLAG_HF)
260 latency = 6; 233 latency = 6;
261 else if (gpmc_clk_ns >= 25) /* 40 MHz*/ 234 else if (gpmc_clk_ns >= 25) /* 40 MHz*/
262 latency = 3; 235 latency = 3;
263 else 236 else
264 latency = 4; 237 latency = 4;
265 238
266 if (clk_dep) { 239 /* Set synchronous read timings */
267 if (gpmc_clk_ns < 12) { /* >83Mhz */ 240 memset(&dev_t, 0, sizeof(dev_t));
268 t_ces = 3;
269 t_avds = 4;
270 } else if (gpmc_clk_ns < 15) { /* >66Mhz */
271 t_ces = 5;
272 t_avds = 4;
273 } else if (gpmc_clk_ns < 25) { /* >40Mhz */
274 t_ces = 6;
275 t_avds = 5;
276 } else {
277 t_ces = 7;
278 t_avds = 7;
279 }
280 }
281 241
282 if (first_time) 242 dev_t.mux = true;
283 set_onenand_cfg(onenand_base, latency, 243 dev_t.sync_read = true;
284 sync_read, sync_write, hf, vhf); 244 if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
285 245 dev_t.sync_write = true;
286 if (div == 1) {
287 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2);
288 reg |= (1 << 7);
289 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG2, reg);
290 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG3);
291 reg |= (1 << 7);
292 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG3, reg);
293 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG4);
294 reg |= (1 << 7);
295 reg |= (1 << 23);
296 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
297 } else { 246 } else {
298 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2); 247 dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000;
299 reg &= ~(1 << 7); 248 dev_t.t_wpl = t_wpl * 1000;
300 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG2, reg); 249 dev_t.t_wph = t_wph * 1000;
301 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG3); 250 dev_t.t_aavdh = t_aavdh * 1000;
302 reg &= ~(1 << 7);
303 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG3, reg);
304 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG4);
305 reg &= ~(1 << 7);
306 reg &= ~(1 << 23);
307 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
308 } 251 }
252 dev_t.ce_xdelay = true;
253 dev_t.avd_xdelay = true;
254 dev_t.oe_xdelay = true;
255 dev_t.we_xdelay = true;
256 dev_t.clk = min_gpmc_clk_period;
257 dev_t.t_bacc = dev_t.clk;
258 dev_t.t_ces = t_ces * 1000;
259 dev_t.t_avds = t_avds * 1000;
260 dev_t.t_avdh = t_avdh * 1000;
261 dev_t.t_ach = t_ach * 1000;
262 dev_t.cyc_iaa = (latency + 1);
263 dev_t.t_cez_r = t_cez * 1000;
264 dev_t.t_cez_w = dev_t.t_cez_r;
265 dev_t.cyc_aavdh_oe = 1;
266 dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period;
267
268 gpmc_calc_timings(&t, &dev_t);
269
270 return t;
271}
309 272
310 /* Set synchronous read timings */ 273static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t)
311 memset(&t, 0, sizeof(t)); 274{
312 t.sync_clk = min_gpmc_clk_period; 275 unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD;
313 t.cs_on = 0; 276 unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE;
314 t.adv_on = 0;
315 fclk_offset_ns = gpmc_round_ns_to_ticks(max_t(int, t_ces, t_avds));
316 fclk_offset = gpmc_ns_to_ticks(fclk_offset_ns);
317 t.page_burst_access = gpmc_clk_ns;
318
319 /* Read */
320 t.adv_rd_off = gpmc_ticks_to_ns(fclk_offset + gpmc_ns_to_ticks(t_avdh));
321 t.oe_on = gpmc_ticks_to_ns(fclk_offset + gpmc_ns_to_ticks(t_ach));
322 /* Force at least 1 clk between AVD High to OE Low */
323 if (t.oe_on <= t.adv_rd_off)
324 t.oe_on = t.adv_rd_off + gpmc_round_ns_to_ticks(1);
325 t.access = gpmc_ticks_to_ns(fclk_offset + (latency + 1) * div);
326 t.oe_off = t.access + gpmc_round_ns_to_ticks(1);
327 t.cs_rd_off = t.oe_off;
328 ticks_cez = ((gpmc_ns_to_ticks(t_cez) + div - 1) / div) * div;
329 t.rd_cycle = gpmc_ticks_to_ns(fclk_offset + (latency + 1) * div +
330 ticks_cez);
331
332 /* Write */
333 if (sync_write) {
334 t.adv_wr_off = t.adv_rd_off;
335 t.we_on = 0;
336 t.we_off = t.cs_rd_off;
337 t.cs_wr_off = t.cs_rd_off;
338 t.wr_cycle = t.rd_cycle;
339 if (cpu_is_omap34xx()) {
340 t.wr_data_mux_bus = gpmc_ticks_to_ns(fclk_offset +
341 gpmc_ps_to_ticks(min_gpmc_clk_period +
342 t_rdyo * 1000));
343 t.wr_access = t.access;
344 }
345 } else {
346 t.adv_wr_off = gpmc_round_ns_to_ticks(max_t(int,
347 t_avdp, t_cer));
348 t.we_on = t.adv_wr_off + gpmc_round_ns_to_ticks(t_aavdh);
349 t.we_off = t.we_on + gpmc_round_ns_to_ticks(t_wpl);
350 t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph);
351 t.wr_cycle = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez);
352 if (cpu_is_omap34xx()) {
353 t.wr_data_mux_bus = t.we_on;
354 t.wr_access = t.we_on + gpmc_round_ns_to_ticks(t_ds);
355 }
356 }
357 277
358 /* Configure GPMC for synchronous read */ 278 /* Configure GPMC for synchronous read */
359 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 279 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
@@ -362,7 +282,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
362 (sync_read ? GPMC_CONFIG1_READTYPE_SYNC : 0) | 282 (sync_read ? GPMC_CONFIG1_READTYPE_SYNC : 0) |
363 (sync_write ? GPMC_CONFIG1_WRITEMULTIPLE_SUPP : 0) | 283 (sync_write ? GPMC_CONFIG1_WRITEMULTIPLE_SUPP : 0) |
364 (sync_write ? GPMC_CONFIG1_WRITETYPE_SYNC : 0) | 284 (sync_write ? GPMC_CONFIG1_WRITETYPE_SYNC : 0) |
365 GPMC_CONFIG1_CLKACTIVATIONTIME(fclk_offset) |
366 GPMC_CONFIG1_PAGE_LEN(2) | 285 GPMC_CONFIG1_PAGE_LEN(2) |
367 (cpu_is_omap34xx() ? 0 : 286 (cpu_is_omap34xx() ? 0 :
368 (GPMC_CONFIG1_WAIT_READ_MON | 287 (GPMC_CONFIG1_WAIT_READ_MON |
@@ -371,11 +290,45 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
371 GPMC_CONFIG1_DEVICETYPE_NOR | 290 GPMC_CONFIG1_DEVICETYPE_NOR |
372 GPMC_CONFIG1_MUXADDDATA); 291 GPMC_CONFIG1_MUXADDDATA);
373 292
374 err = gpmc_cs_set_timings(cs, &t); 293 return gpmc_cs_set_timings(cs, t);
375 if (err) 294}
376 return err; 295
296static int omap2_onenand_setup_async(void __iomem *onenand_base)
297{
298 struct gpmc_timings t;
299 int ret;
300
301 omap2_onenand_set_async_mode(onenand_base);
302
303 t = omap2_onenand_calc_async_timings();
304
305 ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
306 if (IS_ERR_VALUE(ret))
307 return ret;
308
309 omap2_onenand_set_async_mode(onenand_base);
310
311 return 0;
312}
313
314static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
315{
316 int ret, freq = *freq_ptr;
317 struct gpmc_timings t;
377 318
378 set_onenand_cfg(onenand_base, latency, sync_read, sync_write, hf, vhf); 319 if (!freq) {
320 /* Very first call freq is not known */
321 freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
322 set_onenand_cfg(onenand_base);
323 }
324
325 t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq);
326
327 ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t);
328 if (IS_ERR_VALUE(ret))
329 return ret;
330
331 set_onenand_cfg(onenand_base);
379 332
380 *freq_ptr = freq; 333 *freq_ptr = freq;
381 334
@@ -385,15 +338,22 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
385static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) 338static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
386{ 339{
387 struct device *dev = &gpmc_onenand_device.dev; 340 struct device *dev = &gpmc_onenand_device.dev;
341 unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE;
342 int ret;
388 343
389 /* Set sync timings in GPMC */ 344 ret = omap2_onenand_setup_async(onenand_base);
390 if (omap2_onenand_set_sync_mode(gpmc_onenand_data, onenand_base, 345 if (ret) {
391 freq_ptr) < 0) { 346 dev_err(dev, "unable to set to async mode\n");
392 dev_err(dev, "Unable to set synchronous mode\n"); 347 return ret;
393 return -EINVAL;
394 } 348 }
395 349
396 return 0; 350 if (!(gpmc_onenand_data->flags & l))
351 return 0;
352
353 ret = omap2_onenand_setup_sync(onenand_base, freq_ptr);
354 if (ret)
355 dev_err(dev, "unable to set to sync mode\n");
356 return ret;
397} 357}
398 358
399void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) 359void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
@@ -411,6 +371,11 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
411 gpmc_onenand_data->flags |= ONENAND_SYNC_READ; 371 gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
412 } 372 }
413 373
374 if (cpu_is_omap34xx())
375 gpmc_onenand_data->flags |= ONENAND_IN_OMAP34XX;
376 else
377 gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX;
378
414 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, 379 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
415 (unsigned long *)&gpmc_onenand_resource.start); 380 (unsigned long *)&gpmc_onenand_resource.start);
416 if (err < 0) { 381 if (err < 0) {
diff --git a/arch/arm/mach-omap2/gpmc-onenand.h b/arch/arm/mach-omap2/gpmc-onenand.h
new file mode 100644
index 00000000000..216f23a8b45
--- /dev/null
+++ b/arch/arm/mach-omap2/gpmc-onenand.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-omap2/gpmc-onenand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_ONENAND_H
11#define __OMAP2_GPMC_ONENAND_H
12
13#include <linux/platform_data/mtd-onenand-omap2.h>
14
15#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
16extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
17#else
18#define board_onenand_data NULL
19static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
20{
21}
22#endif
23
24#endif
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
index 56547531037..11d0b756f09 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -17,7 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/smc91x.h> 18#include <linux/smc91x.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21#include "gpmc-smc91x.h" 21#include "gpmc-smc91x.h"
22 22
23#include "soc.h" 23#include "soc.h"
@@ -58,6 +58,7 @@ static struct platform_device gpmc_smc91x_device = {
58static int smc91c96_gpmc_retime(void) 58static int smc91c96_gpmc_retime(void)
59{ 59{
60 struct gpmc_timings t; 60 struct gpmc_timings t;
61 struct gpmc_device_timings dev_t;
61 const int t3 = 10; /* Figure 12.2 read and 12.4 write */ 62 const int t3 = 10; /* Figure 12.2 read and 12.4 write */
62 const int t4_r = 20; /* Figure 12.2 read */ 63 const int t4_r = 20; /* Figure 12.2 read */
63 const int t4_w = 5; /* Figure 12.4 write */ 64 const int t4_w = 5; /* Figure 12.4 write */
@@ -68,32 +69,6 @@ static int smc91c96_gpmc_retime(void)
68 const int t20 = 185; /* Figure 12.2 read and 12.4 write */ 69 const int t20 = 185; /* Figure 12.2 read and 12.4 write */
69 u32 l; 70 u32 l;
70 71
71 memset(&t, 0, sizeof(t));
72
73 /* Read timings */
74 t.cs_on = 0;
75 t.adv_on = t.cs_on;
76 t.oe_on = t.adv_on + t3;
77 t.access = t.oe_on + t5;
78 t.oe_off = t.access;
79 t.adv_rd_off = t.oe_off + max(t4_r, t6);
80 t.cs_rd_off = t.oe_off;
81 t.rd_cycle = t20 - t.oe_on;
82
83 /* Write timings */
84 t.we_on = t.adv_on + t3;
85
86 if (cpu_is_omap34xx() && (gpmc_cfg->flags & GPMC_MUX_ADD_DATA)) {
87 t.wr_data_mux_bus = t.we_on;
88 t.we_off = t.wr_data_mux_bus + t7;
89 } else
90 t.we_off = t.we_on + t7;
91 if (cpu_is_omap34xx())
92 t.wr_access = t.we_off;
93 t.adv_wr_off = t.we_off + max(t4_w, t8);
94 t.cs_wr_off = t.we_off + t4_w;
95 t.wr_cycle = t20 - t.we_on;
96
97 l = GPMC_CONFIG1_DEVICESIZE_16; 72 l = GPMC_CONFIG1_DEVICESIZE_16;
98 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) 73 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA)
99 l |= GPMC_CONFIG1_MUXADDDATA; 74 l |= GPMC_CONFIG1_MUXADDDATA;
@@ -115,6 +90,22 @@ static int smc91c96_gpmc_retime(void)
115 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) 90 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA)
116 return 0; 91 return 0;
117 92
93 memset(&dev_t, 0, sizeof(dev_t));
94
95 dev_t.t_oeasu = t3 * 1000;
96 dev_t.t_oe = t5 * 1000;
97 dev_t.t_cez_r = t4_r * 1000;
98 dev_t.t_oez = t6 * 1000;
99 dev_t.t_rd_cycle = (t20 - t3) * 1000;
100
101 dev_t.t_weasu = t3 * 1000;
102 dev_t.t_wpl = t7 * 1000;
103 dev_t.t_wph = t8 * 1000;
104 dev_t.t_cez_w = t4_w * 1000;
105 dev_t.t_wr_cycle = (t20 - t3) * 1000;
106
107 gpmc_calc_timings(&t, &dev_t);
108
118 return gpmc_cs_set_timings(gpmc_cfg->cs, &t); 109 return gpmc_cs_set_timings(gpmc_cfg->cs, &t);
119} 110}
120 111
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index 249a0b440cd..ef990118d32 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -20,7 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/smsc911x.h> 21#include <linux/smsc911x.h>
22 22
23#include <plat/gpmc.h> 23#include "gpmc.h"
24#include "gpmc-smsc911x.h" 24#include "gpmc-smsc911x.h"
25 25
26static struct resource gpmc_smsc911x_resources[] = { 26static struct resource gpmc_smsc911x_resources[] = {
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 92b5718fa72..65468f6d7f0 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -26,16 +26,14 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28 28
29#include <asm/mach-types.h> 29#include <linux/platform_data/mtd-nand-omap2.h>
30#include <plat/gpmc.h>
31 30
32#include <plat/cpu.h> 31#include <asm/mach-types.h>
33#include <plat/gpmc.h>
34#include <plat/sdrc.h>
35#include <plat/omap_device.h>
36 32
37#include "soc.h" 33#include "soc.h"
38#include "common.h" 34#include "common.h"
35#include "omap_device.h"
36#include "gpmc.h"
39 37
40#define DEVICE_NAME "omap-gpmc" 38#define DEVICE_NAME "omap-gpmc"
41 39
@@ -59,6 +57,9 @@
59#define GPMC_ECC_SIZE_CONFIG 0x1fc 57#define GPMC_ECC_SIZE_CONFIG 0x1fc
60#define GPMC_ECC1_RESULT 0x200 58#define GPMC_ECC1_RESULT 0x200
61#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */ 59#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */
60#define GPMC_ECC_BCH_RESULT_1 0x244 /* not available on OMAP2 */
61#define GPMC_ECC_BCH_RESULT_2 0x248 /* not available on OMAP2 */
62#define GPMC_ECC_BCH_RESULT_3 0x24c /* not available on OMAP2 */
62 63
63/* GPMC ECC control settings */ 64/* GPMC ECC control settings */
64#define GPMC_ECC_CTRL_ECCCLEAR 0x100 65#define GPMC_ECC_CTRL_ECCCLEAR 0x100
@@ -73,8 +74,16 @@
73#define GPMC_ECC_CTRL_ECCREG8 0x008 74#define GPMC_ECC_CTRL_ECCREG8 0x008
74#define GPMC_ECC_CTRL_ECCREG9 0x009 75#define GPMC_ECC_CTRL_ECCREG9 0x009
75 76
77#define GPMC_CONFIG2_CSEXTRADELAY BIT(7)
78#define GPMC_CONFIG3_ADVEXTRADELAY BIT(7)
79#define GPMC_CONFIG4_OEEXTRADELAY BIT(7)
80#define GPMC_CONFIG4_WEEXTRADELAY BIT(23)
81#define GPMC_CONFIG6_CYCLE2CYCLEDIFFCSEN BIT(6)
82#define GPMC_CONFIG6_CYCLE2CYCLESAMECSEN BIT(7)
83
76#define GPMC_CS0_OFFSET 0x60 84#define GPMC_CS0_OFFSET 0x60
77#define GPMC_CS_SIZE 0x30 85#define GPMC_CS_SIZE 0x30
86#define GPMC_BCH_SIZE 0x10
78 87
79#define GPMC_MEM_START 0x00000000 88#define GPMC_MEM_START 0x00000000
80#define GPMC_MEM_END 0x3FFFFFFF 89#define GPMC_MEM_END 0x3FFFFFFF
@@ -137,7 +146,6 @@ static struct resource gpmc_mem_root;
137static struct resource gpmc_cs_mem[GPMC_CS_NUM]; 146static struct resource gpmc_cs_mem[GPMC_CS_NUM];
138static DEFINE_SPINLOCK(gpmc_mem_lock); 147static DEFINE_SPINLOCK(gpmc_mem_lock);
139static unsigned int gpmc_cs_map; /* flag for cs which are initialized */ 148static unsigned int gpmc_cs_map; /* flag for cs which are initialized */
140static int gpmc_ecc_used = -EINVAL; /* cs using ecc engine */
141static struct device *gpmc_dev; 149static struct device *gpmc_dev;
142static int gpmc_irq; 150static int gpmc_irq;
143static resource_size_t phys_base, mem_size; 151static resource_size_t phys_base, mem_size;
@@ -158,22 +166,6 @@ static u32 gpmc_read_reg(int idx)
158 return __raw_readl(gpmc_base + idx); 166 return __raw_readl(gpmc_base + idx);
159} 167}
160 168
161static void gpmc_cs_write_byte(int cs, int idx, u8 val)
162{
163 void __iomem *reg_addr;
164
165 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
166 __raw_writeb(val, reg_addr);
167}
168
169static u8 gpmc_cs_read_byte(int cs, int idx)
170{
171 void __iomem *reg_addr;
172
173 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
174 return __raw_readb(reg_addr);
175}
176
177void gpmc_cs_write_reg(int cs, int idx, u32 val) 169void gpmc_cs_write_reg(int cs, int idx, u32 val)
178{ 170{
179 void __iomem *reg_addr; 171 void __iomem *reg_addr;
@@ -238,6 +230,51 @@ unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns)
238 return ticks * gpmc_get_fclk_period() / 1000; 230 return ticks * gpmc_get_fclk_period() / 1000;
239} 231}
240 232
233static unsigned int gpmc_ticks_to_ps(unsigned int ticks)
234{
235 return ticks * gpmc_get_fclk_period();
236}
237
238static unsigned int gpmc_round_ps_to_ticks(unsigned int time_ps)
239{
240 unsigned long ticks = gpmc_ps_to_ticks(time_ps);
241
242 return ticks * gpmc_get_fclk_period();
243}
244
245static inline void gpmc_cs_modify_reg(int cs, int reg, u32 mask, bool value)
246{
247 u32 l;
248
249 l = gpmc_cs_read_reg(cs, reg);
250 if (value)
251 l |= mask;
252 else
253 l &= ~mask;
254 gpmc_cs_write_reg(cs, reg, l);
255}
256
257static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p)
258{
259 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG1,
260 GPMC_CONFIG1_TIME_PARA_GRAN,
261 p->time_para_granularity);
262 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG2,
263 GPMC_CONFIG2_CSEXTRADELAY, p->cs_extra_delay);
264 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG3,
265 GPMC_CONFIG3_ADVEXTRADELAY, p->adv_extra_delay);
266 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
267 GPMC_CONFIG4_OEEXTRADELAY, p->oe_extra_delay);
268 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
269 GPMC_CONFIG4_OEEXTRADELAY, p->we_extra_delay);
270 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG6,
271 GPMC_CONFIG6_CYCLE2CYCLESAMECSEN,
272 p->cycle2cyclesamecsen);
273 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG6,
274 GPMC_CONFIG6_CYCLE2CYCLEDIFFCSEN,
275 p->cycle2cyclediffcsen);
276}
277
241#ifdef DEBUG 278#ifdef DEBUG
242static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, 279static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
243 int time, const char *name) 280 int time, const char *name)
@@ -288,7 +325,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
288 return -1 325 return -1
289#endif 326#endif
290 327
291int gpmc_cs_calc_divider(int cs, unsigned int sync_clk) 328int gpmc_calc_divider(unsigned int sync_clk)
292{ 329{
293 int div; 330 int div;
294 u32 l; 331 u32 l;
@@ -308,7 +345,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
308 int div; 345 int div;
309 u32 l; 346 u32 l;
310 347
311 div = gpmc_cs_calc_divider(cs, t->sync_clk); 348 div = gpmc_calc_divider(t->sync_clk);
312 if (div < 0) 349 if (div < 0)
313 return div; 350 return div;
314 351
@@ -331,6 +368,12 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
331 368
332 GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access); 369 GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access);
333 370
371 GPMC_SET_ONE(GPMC_CS_CONFIG6, 0, 3, bus_turnaround);
372 GPMC_SET_ONE(GPMC_CS_CONFIG6, 8, 11, cycle2cycle_delay);
373
374 GPMC_SET_ONE(GPMC_CS_CONFIG1, 18, 19, wait_monitoring);
375 GPMC_SET_ONE(GPMC_CS_CONFIG1, 25, 26, clk_activation);
376
334 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS) 377 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
335 GPMC_SET_ONE(GPMC_CS_CONFIG6, 16, 19, wr_data_mux_bus); 378 GPMC_SET_ONE(GPMC_CS_CONFIG6, 16, 19, wr_data_mux_bus);
336 if (gpmc_capability & GPMC_HAS_WR_ACCESS) 379 if (gpmc_capability & GPMC_HAS_WR_ACCESS)
@@ -350,6 +393,8 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
350 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l); 393 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
351 } 394 }
352 395
396 gpmc_cs_bool_timings(cs, &t->bool_timings);
397
353 return 0; 398 return 0;
354} 399}
355 400
@@ -509,44 +554,6 @@ void gpmc_cs_free(int cs)
509EXPORT_SYMBOL(gpmc_cs_free); 554EXPORT_SYMBOL(gpmc_cs_free);
510 555
511/** 556/**
512 * gpmc_read_status - read access request to get the different gpmc status
513 * @cmd: command type
514 * @return status
515 */
516int gpmc_read_status(int cmd)
517{
518 int status = -EINVAL;
519 u32 regval = 0;
520
521 switch (cmd) {
522 case GPMC_GET_IRQ_STATUS:
523 status = gpmc_read_reg(GPMC_IRQSTATUS);
524 break;
525
526 case GPMC_PREFETCH_FIFO_CNT:
527 regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
528 status = GPMC_PREFETCH_STATUS_FIFO_CNT(regval);
529 break;
530
531 case GPMC_PREFETCH_COUNT:
532 regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
533 status = GPMC_PREFETCH_STATUS_COUNT(regval);
534 break;
535
536 case GPMC_STATUS_BUFFER:
537 regval = gpmc_read_reg(GPMC_STATUS);
538 /* 1 : buffer is available to write */
539 status = regval & GPMC_STATUS_BUFF_EMPTY;
540 break;
541
542 default:
543 printk(KERN_ERR "gpmc_read_status: Not supported\n");
544 }
545 return status;
546}
547EXPORT_SYMBOL(gpmc_read_status);
548
549/**
550 * gpmc_cs_configure - write request to configure gpmc 557 * gpmc_cs_configure - write request to configure gpmc
551 * @cs: chip select number 558 * @cs: chip select number
552 * @cmd: command type 559 * @cmd: command type
@@ -614,121 +621,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
614} 621}
615EXPORT_SYMBOL(gpmc_cs_configure); 622EXPORT_SYMBOL(gpmc_cs_configure);
616 623
617/**
618 * gpmc_nand_read - nand specific read access request
619 * @cs: chip select number
620 * @cmd: command type
621 */
622int gpmc_nand_read(int cs, int cmd)
623{
624 int rval = -EINVAL;
625
626 switch (cmd) {
627 case GPMC_NAND_DATA:
628 rval = gpmc_cs_read_byte(cs, GPMC_CS_NAND_DATA);
629 break;
630
631 default:
632 printk(KERN_ERR "gpmc_read_nand_ctrl: Not supported\n");
633 }
634 return rval;
635}
636EXPORT_SYMBOL(gpmc_nand_read);
637
638/**
639 * gpmc_nand_write - nand specific write request
640 * @cs: chip select number
641 * @cmd: command type
642 * @wval: value to write
643 */
644int gpmc_nand_write(int cs, int cmd, int wval)
645{
646 int err = 0;
647
648 switch (cmd) {
649 case GPMC_NAND_COMMAND:
650 gpmc_cs_write_byte(cs, GPMC_CS_NAND_COMMAND, wval);
651 break;
652
653 case GPMC_NAND_ADDRESS:
654 gpmc_cs_write_byte(cs, GPMC_CS_NAND_ADDRESS, wval);
655 break;
656
657 case GPMC_NAND_DATA:
658 gpmc_cs_write_byte(cs, GPMC_CS_NAND_DATA, wval);
659
660 default:
661 printk(KERN_ERR "gpmc_write_nand_ctrl: Not supported\n");
662 err = -EINVAL;
663 }
664 return err;
665}
666EXPORT_SYMBOL(gpmc_nand_write);
667
668
669
670/**
671 * gpmc_prefetch_enable - configures and starts prefetch transfer
672 * @cs: cs (chip select) number
673 * @fifo_th: fifo threshold to be used for read/ write
674 * @dma_mode: dma mode enable (1) or disable (0)
675 * @u32_count: number of bytes to be transferred
676 * @is_write: prefetch read(0) or write post(1) mode
677 */
678int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
679 unsigned int u32_count, int is_write)
680{
681
682 if (fifo_th > PREFETCH_FIFOTHRESHOLD_MAX) {
683 pr_err("gpmc: fifo threshold is not supported\n");
684 return -1;
685 } else if (!(gpmc_read_reg(GPMC_PREFETCH_CONTROL))) {
686 /* Set the amount of bytes to be prefetched */
687 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, u32_count);
688
689 /* Set dma/mpu mode, the prefetch read / post write and
690 * enable the engine. Set which cs is has requested for.
691 */
692 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, ((cs << CS_NUM_SHIFT) |
693 PREFETCH_FIFOTHRESHOLD(fifo_th) |
694 ENABLE_PREFETCH |
695 (dma_mode << DMA_MPU_MODE) |
696 (0x1 & is_write)));
697
698 /* Start the prefetch engine */
699 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x1);
700 } else {
701 return -EBUSY;
702 }
703
704 return 0;
705}
706EXPORT_SYMBOL(gpmc_prefetch_enable);
707
708/**
709 * gpmc_prefetch_reset - disables and stops the prefetch engine
710 */
711int gpmc_prefetch_reset(int cs)
712{
713 u32 config1;
714
715 /* check if the same module/cs is trying to reset */
716 config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
717 if (((config1 >> CS_NUM_SHIFT) & 0x7) != cs)
718 return -EINVAL;
719
720 /* Stop the PFPW engine */
721 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x0);
722
723 /* Reset/disable the PFPW engine */
724 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, 0x0);
725
726 return 0;
727}
728EXPORT_SYMBOL(gpmc_prefetch_reset);
729
730void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) 624void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
731{ 625{
626 int i;
627
732 reg->gpmc_status = gpmc_base + GPMC_STATUS; 628 reg->gpmc_status = gpmc_base + GPMC_STATUS;
733 reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET + 629 reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET +
734 GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs; 630 GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
@@ -744,7 +640,17 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
744 reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL; 640 reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL;
745 reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG; 641 reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG;
746 reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT; 642 reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT;
747 reg->gpmc_bch_result0 = gpmc_base + GPMC_ECC_BCH_RESULT_0; 643
644 for (i = 0; i < GPMC_BCH_NUM_REMAINDER; i++) {
645 reg->gpmc_bch_result0[i] = gpmc_base + GPMC_ECC_BCH_RESULT_0 +
646 GPMC_BCH_SIZE * i;
647 reg->gpmc_bch_result1[i] = gpmc_base + GPMC_ECC_BCH_RESULT_1 +
648 GPMC_BCH_SIZE * i;
649 reg->gpmc_bch_result2[i] = gpmc_base + GPMC_ECC_BCH_RESULT_2 +
650 GPMC_BCH_SIZE * i;
651 reg->gpmc_bch_result3[i] = gpmc_base + GPMC_ECC_BCH_RESULT_3 +
652 GPMC_BCH_SIZE * i;
653 }
748} 654}
749 655
750int gpmc_get_client_irq(unsigned irq_config) 656int gpmc_get_client_irq(unsigned irq_config)
@@ -902,6 +808,319 @@ static int __devinit gpmc_mem_init(void)
902 return 0; 808 return 0;
903} 809}
904 810
811static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk)
812{
813 u32 temp;
814 int div;
815
816 div = gpmc_calc_divider(sync_clk);
817 temp = gpmc_ps_to_ticks(time_ps);
818 temp = (temp + div - 1) / div;
819 return gpmc_ticks_to_ps(temp * div);
820}
821
822/* XXX: can the cycles be avoided ? */
823static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t,
824 struct gpmc_device_timings *dev_t)
825{
826 bool mux = dev_t->mux;
827 u32 temp;
828
829 /* adv_rd_off */
830 temp = dev_t->t_avdp_r;
831 /* XXX: mux check required ? */
832 if (mux) {
833 /* XXX: t_avdp not to be required for sync, only added for tusb
834 * this indirectly necessitates requirement of t_avdp_r and
835 * t_avdp_w instead of having a single t_avdp
836 */
837 temp = max_t(u32, temp, gpmc_t->clk_activation + dev_t->t_avdh);
838 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
839 }
840 gpmc_t->adv_rd_off = gpmc_round_ps_to_ticks(temp);
841
842 /* oe_on */
843 temp = dev_t->t_oeasu; /* XXX: remove this ? */
844 if (mux) {
845 temp = max_t(u32, temp, gpmc_t->clk_activation + dev_t->t_ach);
846 temp = max_t(u32, temp, gpmc_t->adv_rd_off +
847 gpmc_ticks_to_ps(dev_t->cyc_aavdh_oe));
848 }
849 gpmc_t->oe_on = gpmc_round_ps_to_ticks(temp);
850
851 /* access */
852 /* XXX: any scope for improvement ?, by combining oe_on
853 * and clk_activation, need to check whether
854 * access = clk_activation + round to sync clk ?
855 */
856 temp = max_t(u32, dev_t->t_iaa, dev_t->cyc_iaa * gpmc_t->sync_clk);
857 temp += gpmc_t->clk_activation;
858 if (dev_t->cyc_oe)
859 temp = max_t(u32, temp, gpmc_t->oe_on +
860 gpmc_ticks_to_ps(dev_t->cyc_oe));
861 gpmc_t->access = gpmc_round_ps_to_ticks(temp);
862
863 gpmc_t->oe_off = gpmc_t->access + gpmc_ticks_to_ps(1);
864 gpmc_t->cs_rd_off = gpmc_t->oe_off;
865
866 /* rd_cycle */
867 temp = max_t(u32, dev_t->t_cez_r, dev_t->t_oez);
868 temp = gpmc_round_ps_to_sync_clk(temp, gpmc_t->sync_clk) +
869 gpmc_t->access;
870 /* XXX: barter t_ce_rdyz with t_cez_r ? */
871 if (dev_t->t_ce_rdyz)
872 temp = max_t(u32, temp, gpmc_t->cs_rd_off + dev_t->t_ce_rdyz);
873 gpmc_t->rd_cycle = gpmc_round_ps_to_ticks(temp);
874
875 return 0;
876}
877
878static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t,
879 struct gpmc_device_timings *dev_t)
880{
881 bool mux = dev_t->mux;
882 u32 temp;
883
884 /* adv_wr_off */
885 temp = dev_t->t_avdp_w;
886 if (mux) {
887 temp = max_t(u32, temp,
888 gpmc_t->clk_activation + dev_t->t_avdh);
889 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
890 }
891 gpmc_t->adv_wr_off = gpmc_round_ps_to_ticks(temp);
892
893 /* wr_data_mux_bus */
894 temp = max_t(u32, dev_t->t_weasu,
895 gpmc_t->clk_activation + dev_t->t_rdyo);
896 /* XXX: shouldn't mux be kept as a whole for wr_data_mux_bus ?,
897 * and in that case remember to handle we_on properly
898 */
899 if (mux) {
900 temp = max_t(u32, temp,
901 gpmc_t->adv_wr_off + dev_t->t_aavdh);
902 temp = max_t(u32, temp, gpmc_t->adv_wr_off +
903 gpmc_ticks_to_ps(dev_t->cyc_aavdh_we));
904 }
905 gpmc_t->wr_data_mux_bus = gpmc_round_ps_to_ticks(temp);
906
907 /* we_on */
908 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
909 gpmc_t->we_on = gpmc_round_ps_to_ticks(dev_t->t_weasu);
910 else
911 gpmc_t->we_on = gpmc_t->wr_data_mux_bus;
912
913 /* wr_access */
914 /* XXX: gpmc_capability check reqd ? , even if not, will not harm */
915 gpmc_t->wr_access = gpmc_t->access;
916
917 /* we_off */
918 temp = gpmc_t->we_on + dev_t->t_wpl;
919 temp = max_t(u32, temp,
920 gpmc_t->wr_access + gpmc_ticks_to_ps(1));
921 temp = max_t(u32, temp,
922 gpmc_t->we_on + gpmc_ticks_to_ps(dev_t->cyc_wpl));
923 gpmc_t->we_off = gpmc_round_ps_to_ticks(temp);
924
925 gpmc_t->cs_wr_off = gpmc_round_ps_to_ticks(gpmc_t->we_off +
926 dev_t->t_wph);
927
928 /* wr_cycle */
929 temp = gpmc_round_ps_to_sync_clk(dev_t->t_cez_w, gpmc_t->sync_clk);
930 temp += gpmc_t->wr_access;
931 /* XXX: barter t_ce_rdyz with t_cez_w ? */
932 if (dev_t->t_ce_rdyz)
933 temp = max_t(u32, temp,
934 gpmc_t->cs_wr_off + dev_t->t_ce_rdyz);
935 gpmc_t->wr_cycle = gpmc_round_ps_to_ticks(temp);
936
937 return 0;
938}
939
940static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t,
941 struct gpmc_device_timings *dev_t)
942{
943 bool mux = dev_t->mux;
944 u32 temp;
945
946 /* adv_rd_off */
947 temp = dev_t->t_avdp_r;
948 if (mux)
949 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
950 gpmc_t->adv_rd_off = gpmc_round_ps_to_ticks(temp);
951
952 /* oe_on */
953 temp = dev_t->t_oeasu;
954 if (mux)
955 temp = max_t(u32, temp,
956 gpmc_t->adv_rd_off + dev_t->t_aavdh);
957 gpmc_t->oe_on = gpmc_round_ps_to_ticks(temp);
958
959 /* access */
960 temp = max_t(u32, dev_t->t_iaa, /* XXX: remove t_iaa in async ? */
961 gpmc_t->oe_on + dev_t->t_oe);
962 temp = max_t(u32, temp,
963 gpmc_t->cs_on + dev_t->t_ce);
964 temp = max_t(u32, temp,
965 gpmc_t->adv_on + dev_t->t_aa);
966 gpmc_t->access = gpmc_round_ps_to_ticks(temp);
967
968 gpmc_t->oe_off = gpmc_t->access + gpmc_ticks_to_ps(1);
969 gpmc_t->cs_rd_off = gpmc_t->oe_off;
970
971 /* rd_cycle */
972 temp = max_t(u32, dev_t->t_rd_cycle,
973 gpmc_t->cs_rd_off + dev_t->t_cez_r);
974 temp = max_t(u32, temp, gpmc_t->oe_off + dev_t->t_oez);
975 gpmc_t->rd_cycle = gpmc_round_ps_to_ticks(temp);
976
977 return 0;
978}
979
980static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t,
981 struct gpmc_device_timings *dev_t)
982{
983 bool mux = dev_t->mux;
984 u32 temp;
985
986 /* adv_wr_off */
987 temp = dev_t->t_avdp_w;
988 if (mux)
989 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
990 gpmc_t->adv_wr_off = gpmc_round_ps_to_ticks(temp);
991
992 /* wr_data_mux_bus */
993 temp = dev_t->t_weasu;
994 if (mux) {
995 temp = max_t(u32, temp, gpmc_t->adv_wr_off + dev_t->t_aavdh);
996 temp = max_t(u32, temp, gpmc_t->adv_wr_off +
997 gpmc_ticks_to_ps(dev_t->cyc_aavdh_we));
998 }
999 gpmc_t->wr_data_mux_bus = gpmc_round_ps_to_ticks(temp);
1000
1001 /* we_on */
1002 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
1003 gpmc_t->we_on = gpmc_round_ps_to_ticks(dev_t->t_weasu);
1004 else
1005 gpmc_t->we_on = gpmc_t->wr_data_mux_bus;
1006
1007 /* we_off */
1008 temp = gpmc_t->we_on + dev_t->t_wpl;
1009 gpmc_t->we_off = gpmc_round_ps_to_ticks(temp);
1010
1011 gpmc_t->cs_wr_off = gpmc_round_ps_to_ticks(gpmc_t->we_off +
1012 dev_t->t_wph);
1013
1014 /* wr_cycle */
1015 temp = max_t(u32, dev_t->t_wr_cycle,
1016 gpmc_t->cs_wr_off + dev_t->t_cez_w);
1017 gpmc_t->wr_cycle = gpmc_round_ps_to_ticks(temp);
1018
1019 return 0;
1020}
1021
1022static int gpmc_calc_sync_common_timings(struct gpmc_timings *gpmc_t,
1023 struct gpmc_device_timings *dev_t)
1024{
1025 u32 temp;
1026
1027 gpmc_t->sync_clk = gpmc_calc_divider(dev_t->clk) *
1028 gpmc_get_fclk_period();
1029
1030 gpmc_t->page_burst_access = gpmc_round_ps_to_sync_clk(
1031 dev_t->t_bacc,
1032 gpmc_t->sync_clk);
1033
1034 temp = max_t(u32, dev_t->t_ces, dev_t->t_avds);
1035 gpmc_t->clk_activation = gpmc_round_ps_to_ticks(temp);
1036
1037 if (gpmc_calc_divider(gpmc_t->sync_clk) != 1)
1038 return 0;
1039
1040 if (dev_t->ce_xdelay)
1041 gpmc_t->bool_timings.cs_extra_delay = true;
1042 if (dev_t->avd_xdelay)
1043 gpmc_t->bool_timings.adv_extra_delay = true;
1044 if (dev_t->oe_xdelay)
1045 gpmc_t->bool_timings.oe_extra_delay = true;
1046 if (dev_t->we_xdelay)
1047 gpmc_t->bool_timings.we_extra_delay = true;
1048
1049 return 0;
1050}
1051
1052static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t,
1053 struct gpmc_device_timings *dev_t)
1054{
1055 u32 temp;
1056
1057 /* cs_on */
1058 gpmc_t->cs_on = gpmc_round_ps_to_ticks(dev_t->t_ceasu);
1059
1060 /* adv_on */
1061 temp = dev_t->t_avdasu;
1062 if (dev_t->t_ce_avd)
1063 temp = max_t(u32, temp,
1064 gpmc_t->cs_on + dev_t->t_ce_avd);
1065 gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp);
1066
1067 if (dev_t->sync_write || dev_t->sync_read)
1068 gpmc_calc_sync_common_timings(gpmc_t, dev_t);
1069
1070 return 0;
1071}
1072
1073/* TODO: remove this function once all peripherals are confirmed to
1074 * work with generic timing. Simultaneously gpmc_cs_set_timings()
1075 * has to be modified to handle timings in ps instead of ns
1076*/
1077static void gpmc_convert_ps_to_ns(struct gpmc_timings *t)
1078{
1079 t->cs_on /= 1000;
1080 t->cs_rd_off /= 1000;
1081 t->cs_wr_off /= 1000;
1082 t->adv_on /= 1000;
1083 t->adv_rd_off /= 1000;
1084 t->adv_wr_off /= 1000;
1085 t->we_on /= 1000;
1086 t->we_off /= 1000;
1087 t->oe_on /= 1000;
1088 t->oe_off /= 1000;
1089 t->page_burst_access /= 1000;
1090 t->access /= 1000;
1091 t->rd_cycle /= 1000;
1092 t->wr_cycle /= 1000;
1093 t->bus_turnaround /= 1000;
1094 t->cycle2cycle_delay /= 1000;
1095 t->wait_monitoring /= 1000;
1096 t->clk_activation /= 1000;
1097 t->wr_access /= 1000;
1098 t->wr_data_mux_bus /= 1000;
1099}
1100
1101int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
1102 struct gpmc_device_timings *dev_t)
1103{
1104 memset(gpmc_t, 0, sizeof(*gpmc_t));
1105
1106 gpmc_calc_common_timings(gpmc_t, dev_t);
1107
1108 if (dev_t->sync_read)
1109 gpmc_calc_sync_read_timings(gpmc_t, dev_t);
1110 else
1111 gpmc_calc_async_read_timings(gpmc_t, dev_t);
1112
1113 if (dev_t->sync_write)
1114 gpmc_calc_sync_write_timings(gpmc_t, dev_t);
1115 else
1116 gpmc_calc_async_write_timings(gpmc_t, dev_t);
1117
1118 /* TODO: remove, see function definition */
1119 gpmc_convert_ps_to_ns(gpmc_t);
1120
1121 return 0;
1122}
1123
905static __devinit int gpmc_probe(struct platform_device *pdev) 1124static __devinit int gpmc_probe(struct platform_device *pdev)
906{ 1125{
907 int rc; 1126 int rc;
@@ -1093,267 +1312,3 @@ void omap3_gpmc_restore_context(void)
1093 } 1312 }
1094} 1313}
1095#endif /* CONFIG_ARCH_OMAP3 */ 1314#endif /* CONFIG_ARCH_OMAP3 */
1096
1097/**
1098 * gpmc_enable_hwecc - enable hardware ecc functionality
1099 * @cs: chip select number
1100 * @mode: read/write mode
1101 * @dev_width: device bus width(1 for x16, 0 for x8)
1102 * @ecc_size: bytes for which ECC will be generated
1103 */
1104int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size)
1105{
1106 unsigned int val;
1107
1108 /* check if ecc module is in used */
1109 if (gpmc_ecc_used != -EINVAL)
1110 return -EINVAL;
1111
1112 gpmc_ecc_used = cs;
1113
1114 /* clear ecc and enable bits */
1115 gpmc_write_reg(GPMC_ECC_CONTROL,
1116 GPMC_ECC_CTRL_ECCCLEAR |
1117 GPMC_ECC_CTRL_ECCREG1);
1118
1119 /* program ecc and result sizes */
1120 val = ((((ecc_size >> 1) - 1) << 22) | (0x0000000F));
1121 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, val);
1122
1123 switch (mode) {
1124 case GPMC_ECC_READ:
1125 case GPMC_ECC_WRITE:
1126 gpmc_write_reg(GPMC_ECC_CONTROL,
1127 GPMC_ECC_CTRL_ECCCLEAR |
1128 GPMC_ECC_CTRL_ECCREG1);
1129 break;
1130 case GPMC_ECC_READSYN:
1131 gpmc_write_reg(GPMC_ECC_CONTROL,
1132 GPMC_ECC_CTRL_ECCCLEAR |
1133 GPMC_ECC_CTRL_ECCDISABLE);
1134 break;
1135 default:
1136 printk(KERN_INFO "Error: Unrecognized Mode[%d]!\n", mode);
1137 break;
1138 }
1139
1140 /* (ECC 16 or 8 bit col) | ( CS ) | ECC Enable */
1141 val = (dev_width << 7) | (cs << 1) | (0x1);
1142 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1143 return 0;
1144}
1145EXPORT_SYMBOL_GPL(gpmc_enable_hwecc);
1146
1147/**
1148 * gpmc_calculate_ecc - generate non-inverted ecc bytes
1149 * @cs: chip select number
1150 * @dat: data pointer over which ecc is computed
1151 * @ecc_code: ecc code buffer
1152 *
1153 * Using non-inverted ECC is considered ugly since writing a blank
1154 * page (padding) will clear the ECC bytes. This is not a problem as long
1155 * no one is trying to write data on the seemingly unused page. Reading
1156 * an erased page will produce an ECC mismatch between generated and read
1157 * ECC bytes that has to be dealt with separately.
1158 */
1159int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code)
1160{
1161 unsigned int val = 0x0;
1162
1163 if (gpmc_ecc_used != cs)
1164 return -EINVAL;
1165
1166 /* read ecc result */
1167 val = gpmc_read_reg(GPMC_ECC1_RESULT);
1168 *ecc_code++ = val; /* P128e, ..., P1e */
1169 *ecc_code++ = val >> 16; /* P128o, ..., P1o */
1170 /* P2048o, P1024o, P512o, P256o, P2048e, P1024e, P512e, P256e */
1171 *ecc_code++ = ((val >> 8) & 0x0f) | ((val >> 20) & 0xf0);
1172
1173 gpmc_ecc_used = -EINVAL;
1174 return 0;
1175}
1176EXPORT_SYMBOL_GPL(gpmc_calculate_ecc);
1177
1178#ifdef CONFIG_ARCH_OMAP3
1179
1180/**
1181 * gpmc_init_hwecc_bch - initialize hardware BCH ecc functionality
1182 * @cs: chip select number
1183 * @nsectors: how many 512-byte sectors to process
1184 * @nerrors: how many errors to correct per sector (4 or 8)
1185 *
1186 * This function must be executed before any call to gpmc_enable_hwecc_bch.
1187 */
1188int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors)
1189{
1190 /* check if ecc module is in use */
1191 if (gpmc_ecc_used != -EINVAL)
1192 return -EINVAL;
1193
1194 /* support only OMAP3 class */
1195 if (!cpu_is_omap34xx()) {
1196 printk(KERN_ERR "BCH ecc is not supported on this CPU\n");
1197 return -EINVAL;
1198 }
1199
1200 /*
1201 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
1202 * Other chips may be added if confirmed to work.
1203 */
1204 if ((nerrors == 4) &&
1205 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
1206 printk(KERN_ERR "BCH 4-bit mode is not supported on this CPU\n");
1207 return -EINVAL;
1208 }
1209
1210 /* sanity check */
1211 if (nsectors > 8) {
1212 printk(KERN_ERR "BCH cannot process %d sectors (max is 8)\n",
1213 nsectors);
1214 return -EINVAL;
1215 }
1216
1217 return 0;
1218}
1219EXPORT_SYMBOL_GPL(gpmc_init_hwecc_bch);
1220
1221/**
1222 * gpmc_enable_hwecc_bch - enable hardware BCH ecc functionality
1223 * @cs: chip select number
1224 * @mode: read/write mode
1225 * @dev_width: device bus width(1 for x16, 0 for x8)
1226 * @nsectors: how many 512-byte sectors to process
1227 * @nerrors: how many errors to correct per sector (4 or 8)
1228 */
1229int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
1230 int nerrors)
1231{
1232 unsigned int val;
1233
1234 /* check if ecc module is in use */
1235 if (gpmc_ecc_used != -EINVAL)
1236 return -EINVAL;
1237
1238 gpmc_ecc_used = cs;
1239
1240 /* clear ecc and enable bits */
1241 gpmc_write_reg(GPMC_ECC_CONTROL, 0x1);
1242
1243 /*
1244 * When using BCH, sector size is hardcoded to 512 bytes.
1245 * Here we are using wrapping mode 6 both for reading and writing, with:
1246 * size0 = 0 (no additional protected byte in spare area)
1247 * size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
1248 */
1249 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, (32 << 22) | (0 << 12));
1250
1251 /* BCH configuration */
1252 val = ((1 << 16) | /* enable BCH */
1253 (((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
1254 (0x06 << 8) | /* wrap mode = 6 */
1255 (dev_width << 7) | /* bus width */
1256 (((nsectors-1) & 0x7) << 4) | /* number of sectors */
1257 (cs << 1) | /* ECC CS */
1258 (0x1)); /* enable ECC */
1259
1260 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1261 gpmc_write_reg(GPMC_ECC_CONTROL, 0x101);
1262 return 0;
1263}
1264EXPORT_SYMBOL_GPL(gpmc_enable_hwecc_bch);
1265
1266/**
1267 * gpmc_calculate_ecc_bch4 - Generate 7 ecc bytes per sector of 512 data bytes
1268 * @cs: chip select number
1269 * @dat: The pointer to data on which ecc is computed
1270 * @ecc: The ecc output buffer
1271 */
1272int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc)
1273{
1274 int i;
1275 unsigned long nsectors, reg, val1, val2;
1276
1277 if (gpmc_ecc_used != cs)
1278 return -EINVAL;
1279
1280 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1281
1282 for (i = 0; i < nsectors; i++) {
1283
1284 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1285
1286 /* Read hw-computed remainder */
1287 val1 = gpmc_read_reg(reg + 0);
1288 val2 = gpmc_read_reg(reg + 4);
1289
1290 /*
1291 * Add constant polynomial to remainder, in order to get an ecc
1292 * sequence of 0xFFs for a buffer filled with 0xFFs; and
1293 * left-justify the resulting polynomial.
1294 */
1295 *ecc++ = 0x28 ^ ((val2 >> 12) & 0xFF);
1296 *ecc++ = 0x13 ^ ((val2 >> 4) & 0xFF);
1297 *ecc++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
1298 *ecc++ = 0x39 ^ ((val1 >> 20) & 0xFF);
1299 *ecc++ = 0x96 ^ ((val1 >> 12) & 0xFF);
1300 *ecc++ = 0xac ^ ((val1 >> 4) & 0xFF);
1301 *ecc++ = 0x7f ^ ((val1 & 0xF) << 4);
1302 }
1303
1304 gpmc_ecc_used = -EINVAL;
1305 return 0;
1306}
1307EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch4);
1308
1309/**
1310 * gpmc_calculate_ecc_bch8 - Generate 13 ecc bytes per block of 512 data bytes
1311 * @cs: chip select number
1312 * @dat: The pointer to data on which ecc is computed
1313 * @ecc: The ecc output buffer
1314 */
1315int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc)
1316{
1317 int i;
1318 unsigned long nsectors, reg, val1, val2, val3, val4;
1319
1320 if (gpmc_ecc_used != cs)
1321 return -EINVAL;
1322
1323 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1324
1325 for (i = 0; i < nsectors; i++) {
1326
1327 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1328
1329 /* Read hw-computed remainder */
1330 val1 = gpmc_read_reg(reg + 0);
1331 val2 = gpmc_read_reg(reg + 4);
1332 val3 = gpmc_read_reg(reg + 8);
1333 val4 = gpmc_read_reg(reg + 12);
1334
1335 /*
1336 * Add constant polynomial to remainder, in order to get an ecc
1337 * sequence of 0xFFs for a buffer filled with 0xFFs.
1338 */
1339 *ecc++ = 0xef ^ (val4 & 0xFF);
1340 *ecc++ = 0x51 ^ ((val3 >> 24) & 0xFF);
1341 *ecc++ = 0x2e ^ ((val3 >> 16) & 0xFF);
1342 *ecc++ = 0x09 ^ ((val3 >> 8) & 0xFF);
1343 *ecc++ = 0xed ^ (val3 & 0xFF);
1344 *ecc++ = 0x93 ^ ((val2 >> 24) & 0xFF);
1345 *ecc++ = 0x9a ^ ((val2 >> 16) & 0xFF);
1346 *ecc++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
1347 *ecc++ = 0x97 ^ (val2 & 0xFF);
1348 *ecc++ = 0x79 ^ ((val1 >> 24) & 0xFF);
1349 *ecc++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
1350 *ecc++ = 0x24 ^ ((val1 >> 8) & 0xFF);
1351 *ecc++ = 0xb5 ^ (val1 & 0xFF);
1352 }
1353
1354 gpmc_ecc_used = -EINVAL;
1355 return 0;
1356}
1357EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch8);
1358
1359#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index 2e6e2597178..fe0a844d500 100644
--- a/arch/arm/plat-omap/include/plat/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -11,6 +11,8 @@
11#ifndef __OMAP2_GPMC_H 11#ifndef __OMAP2_GPMC_H
12#define __OMAP2_GPMC_H 12#define __OMAP2_GPMC_H
13 13
14#include <linux/platform_data/mtd-nand-omap2.h>
15
14/* Maximum Number of Chip Selects */ 16/* Maximum Number of Chip Selects */
15#define GPMC_CS_NUM 8 17#define GPMC_CS_NUM 8
16 18
@@ -32,15 +34,6 @@
32#define GPMC_SET_IRQ_STATUS 0x00000004 34#define GPMC_SET_IRQ_STATUS 0x00000004
33#define GPMC_CONFIG_WP 0x00000005 35#define GPMC_CONFIG_WP 0x00000005
34 36
35#define GPMC_GET_IRQ_STATUS 0x00000006
36#define GPMC_PREFETCH_FIFO_CNT 0x00000007 /* bytes available in FIFO for r/w */
37#define GPMC_PREFETCH_COUNT 0x00000008 /* remaining bytes to be read/write*/
38#define GPMC_STATUS_BUFFER 0x00000009 /* 1: buffer is available to write */
39
40#define GPMC_NAND_COMMAND 0x0000000a
41#define GPMC_NAND_ADDRESS 0x0000000b
42#define GPMC_NAND_DATA 0x0000000c
43
44#define GPMC_ENABLE_IRQ 0x0000000d 37#define GPMC_ENABLE_IRQ 0x0000000d
45 38
46/* ECC commands */ 39/* ECC commands */
@@ -76,24 +69,20 @@
76#define GPMC_DEVICETYPE_NOR 0 69#define GPMC_DEVICETYPE_NOR 0
77#define GPMC_DEVICETYPE_NAND 2 70#define GPMC_DEVICETYPE_NAND 2
78#define GPMC_CONFIG_WRITEPROTECT 0x00000010 71#define GPMC_CONFIG_WRITEPROTECT 0x00000010
79#define GPMC_STATUS_BUFF_EMPTY 0x00000001
80#define WR_RD_PIN_MONITORING 0x00600000 72#define WR_RD_PIN_MONITORING 0x00600000
81#define GPMC_PREFETCH_STATUS_FIFO_CNT(val) ((val >> 24) & 0x7F)
82#define GPMC_PREFETCH_STATUS_COUNT(val) (val & 0x00003fff)
83#define GPMC_IRQ_FIFOEVENTENABLE 0x01 73#define GPMC_IRQ_FIFOEVENTENABLE 0x01
84#define GPMC_IRQ_COUNT_EVENT 0x02 74#define GPMC_IRQ_COUNT_EVENT 0x02
85 75
86#define PREFETCH_FIFOTHRESHOLD_MAX 0x40 76
87#define PREFETCH_FIFOTHRESHOLD(val) ((val) << 8) 77/* bool type time settings */
88 78struct gpmc_bool_timings {
89enum omap_ecc { 79 bool cycle2cyclediffcsen;
90 /* 1-bit ecc: stored at end of spare area */ 80 bool cycle2cyclesamecsen;
91 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */ 81 bool we_extra_delay;
92 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */ 82 bool oe_extra_delay;
93 /* 1-bit ecc: stored at beginning of spare area as romcode */ 83 bool adv_extra_delay;
94 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */ 84 bool cs_extra_delay;
95 OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */ 85 bool time_para_granularity;
96 OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
97}; 86};
98 87
99/* 88/*
@@ -105,50 +94,104 @@ struct gpmc_timings {
105 u32 sync_clk; 94 u32 sync_clk;
106 95
107 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */ 96 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
108 u16 cs_on; /* Assertion time */ 97 u32 cs_on; /* Assertion time */
109 u16 cs_rd_off; /* Read deassertion time */ 98 u32 cs_rd_off; /* Read deassertion time */
110 u16 cs_wr_off; /* Write deassertion time */ 99 u32 cs_wr_off; /* Write deassertion time */
111 100
112 /* ADV signal timings corresponding to GPMC_CONFIG3 */ 101 /* ADV signal timings corresponding to GPMC_CONFIG3 */
113 u16 adv_on; /* Assertion time */ 102 u32 adv_on; /* Assertion time */
114 u16 adv_rd_off; /* Read deassertion time */ 103 u32 adv_rd_off; /* Read deassertion time */
115 u16 adv_wr_off; /* Write deassertion time */ 104 u32 adv_wr_off; /* Write deassertion time */
116 105
117 /* WE signals timings corresponding to GPMC_CONFIG4 */ 106 /* WE signals timings corresponding to GPMC_CONFIG4 */
118 u16 we_on; /* WE assertion time */ 107 u32 we_on; /* WE assertion time */
119 u16 we_off; /* WE deassertion time */ 108 u32 we_off; /* WE deassertion time */
120 109
121 /* OE signals timings corresponding to GPMC_CONFIG4 */ 110 /* OE signals timings corresponding to GPMC_CONFIG4 */
122 u16 oe_on; /* OE assertion time */ 111 u32 oe_on; /* OE assertion time */
123 u16 oe_off; /* OE deassertion time */ 112 u32 oe_off; /* OE deassertion time */
124 113
125 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */ 114 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
126 u16 page_burst_access; /* Multiple access word delay */ 115 u32 page_burst_access; /* Multiple access word delay */
127 u16 access; /* Start-cycle to first data valid delay */ 116 u32 access; /* Start-cycle to first data valid delay */
128 u16 rd_cycle; /* Total read cycle time */ 117 u32 rd_cycle; /* Total read cycle time */
129 u16 wr_cycle; /* Total write cycle time */ 118 u32 wr_cycle; /* Total write cycle time */
119
120 u32 bus_turnaround;
121 u32 cycle2cycle_delay;
122
123 u32 wait_monitoring;
124 u32 clk_activation;
130 125
131 /* The following are only on OMAP3430 */ 126 /* The following are only on OMAP3430 */
132 u16 wr_access; /* WRACCESSTIME */ 127 u32 wr_access; /* WRACCESSTIME */
133 u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */ 128 u32 wr_data_mux_bus; /* WRDATAONADMUXBUS */
129
130 struct gpmc_bool_timings bool_timings;
134}; 131};
135 132
136struct gpmc_nand_regs { 133/* Device timings in picoseconds */
137 void __iomem *gpmc_status; 134struct gpmc_device_timings {
138 void __iomem *gpmc_nand_command; 135 u32 t_ceasu; /* address setup to CS valid */
139 void __iomem *gpmc_nand_address; 136 u32 t_avdasu; /* address setup to ADV valid */
140 void __iomem *gpmc_nand_data; 137 /* XXX: try to combine t_avdp_r & t_avdp_w. Issue is
141 void __iomem *gpmc_prefetch_config1; 138 * of tusb using these timings even for sync whilst
142 void __iomem *gpmc_prefetch_config2; 139 * ideally for adv_rd/(wr)_off it should have considered
143 void __iomem *gpmc_prefetch_control; 140 * t_avdh instead. This indirectly necessitates r/w
144 void __iomem *gpmc_prefetch_status; 141 * variations of t_avdp as it is possible to have one
145 void __iomem *gpmc_ecc_config; 142 * sync & other async
146 void __iomem *gpmc_ecc_control; 143 */
147 void __iomem *gpmc_ecc_size_config; 144 u32 t_avdp_r; /* ADV low time (what about t_cer ?) */
148 void __iomem *gpmc_ecc1_result; 145 u32 t_avdp_w;
149 void __iomem *gpmc_bch_result0; 146 u32 t_aavdh; /* address hold time */
147 u32 t_oeasu; /* address setup to OE valid */
148 u32 t_aa; /* access time from ADV assertion */
149 u32 t_iaa; /* initial access time */
150 u32 t_oe; /* access time from OE assertion */
151 u32 t_ce; /* access time from CS asertion */
152 u32 t_rd_cycle; /* read cycle time */
153 u32 t_cez_r; /* read CS deassertion to high Z */
154 u32 t_cez_w; /* write CS deassertion to high Z */
155 u32 t_oez; /* OE deassertion to high Z */
156 u32 t_weasu; /* address setup to WE valid */
157 u32 t_wpl; /* write assertion time */
158 u32 t_wph; /* write deassertion time */
159 u32 t_wr_cycle; /* write cycle time */
160
161 u32 clk;
162 u32 t_bacc; /* burst access valid clock to output delay */
163 u32 t_ces; /* CS setup time to clk */
164 u32 t_avds; /* ADV setup time to clk */
165 u32 t_avdh; /* ADV hold time from clk */
166 u32 t_ach; /* address hold time from clk */
167 u32 t_rdyo; /* clk to ready valid */
168
169 u32 t_ce_rdyz; /* XXX: description ?, or use t_cez instead */
170 u32 t_ce_avd; /* CS on to ADV on delay */
171
172 /* XXX: check the possibility of combining
173 * cyc_aavhd_oe & cyc_aavdh_we
174 */
175 u8 cyc_aavdh_oe;/* read address hold time in cycles */
176 u8 cyc_aavdh_we;/* write address hold time in cycles */
177 u8 cyc_oe; /* access time from OE assertion in cycles */
178 u8 cyc_wpl; /* write deassertion time in cycles */
179 u32 cyc_iaa; /* initial access time in cycles */
180
181 bool mux; /* address & data muxed */
182 bool sync_write;/* synchronous write */
183 bool sync_read; /* synchronous read */
184
185 /* extra delays */
186 bool ce_xdelay;
187 bool avd_xdelay;
188 bool oe_xdelay;
189 bool we_xdelay;
150}; 190};
151 191
192extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
193 struct gpmc_device_timings *dev_t);
194
152extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); 195extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
153extern int gpmc_get_client_irq(unsigned irq_config); 196extern int gpmc_get_client_irq(unsigned irq_config);
154 197
@@ -160,31 +203,14 @@ extern unsigned long gpmc_get_fclk_period(void);
160 203
161extern void gpmc_cs_write_reg(int cs, int idx, u32 val); 204extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
162extern u32 gpmc_cs_read_reg(int cs, int idx); 205extern u32 gpmc_cs_read_reg(int cs, int idx);
163extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk); 206extern int gpmc_calc_divider(unsigned int sync_clk);
164extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); 207extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
165extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); 208extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
166extern void gpmc_cs_free(int cs); 209extern void gpmc_cs_free(int cs);
167extern int gpmc_cs_set_reserved(int cs, int reserved); 210extern int gpmc_cs_set_reserved(int cs, int reserved);
168extern int gpmc_cs_reserved(int cs); 211extern int gpmc_cs_reserved(int cs);
169extern int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
170 unsigned int u32_count, int is_write);
171extern int gpmc_prefetch_reset(int cs);
172extern void omap3_gpmc_save_context(void); 212extern void omap3_gpmc_save_context(void);
173extern void omap3_gpmc_restore_context(void); 213extern void omap3_gpmc_restore_context(void);
174extern int gpmc_read_status(int cmd);
175extern int gpmc_cs_configure(int cs, int cmd, int wval); 214extern int gpmc_cs_configure(int cs, int cmd, int wval);
176extern int gpmc_nand_read(int cs, int cmd);
177extern int gpmc_nand_write(int cs, int cmd, int wval);
178
179int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size);
180int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code);
181
182#ifdef CONFIG_ARCH_OMAP3
183int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors);
184int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
185 int nerrors);
186int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc);
187int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc);
188#endif /* CONFIG_ARCH_OMAP3 */
189 215
190#endif 216#endif
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
index e003f2bba30..ab7bf181a10 100644
--- a/arch/arm/mach-omap2/hdq1w.c
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -27,15 +27,13 @@
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29 29
30#include <plat/omap_hwmod.h> 30#include "omap_hwmod.h"
31#include <plat/omap_device.h> 31#include "omap_device.h"
32#include "hdq1w.h" 32#include "hdq1w.h"
33 33
34#include "prm.h"
34#include "common.h" 35#include "common.h"
35 36
36/* Maximum microseconds to wait for OMAP module to softreset */
37#define MAX_MODULE_SOFTRESET_WAIT 10000
38
39/** 37/**
40 * omap_hdq1w_reset - reset the OMAP HDQ1W module 38 * omap_hdq1w_reset - reset the OMAP HDQ1W module
41 * @oh: struct omap_hwmod * 39 * @oh: struct omap_hwmod *
diff --git a/arch/arm/mach-omap2/hdq1w.h b/arch/arm/mach-omap2/hdq1w.h
index 0c1efc846d8..c7e08d2a7a4 100644
--- a/arch/arm/mach-omap2/hdq1w.h
+++ b/arch/arm/mach-omap2/hdq1w.h
@@ -21,7 +21,7 @@
21#ifndef ARCH_ARM_MACH_OMAP2_HDQ1W_H 21#ifndef ARCH_ARM_MACH_OMAP2_HDQ1W_H
22#define ARCH_ARM_MACH_OMAP2_HDQ1W_H 22#define ARCH_ARM_MACH_OMAP2_HDQ1W_H
23 23
24#include <plat/omap_hwmod.h> 24#include "omap_hwmod.h"
25 25
26/* 26/*
27 * XXX A future cleanup patch should modify 27 * XXX A future cleanup patch should modify
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 4d3a6324155..4a964338992 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -14,14 +14,14 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <mach/hardware.h>
18#include <linux/platform_data/gpio-omap.h> 17#include <linux/platform_data/gpio-omap.h>
19 18
20#include <plat/mmc.h> 19#include "soc.h"
21#include <plat/omap-pm.h> 20#include "omap_device.h"
22#include <plat/omap_device.h> 21#include "omap-pm.h"
23 22
24#include "mux.h" 23#include "mux.h"
24#include "mmc.h"
25#include "hsmmc.h" 25#include "hsmmc.h"
26#include "control.h" 26#include "control.h"
27 27
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
index 8763c8520dc..1df9b5feda1 100644
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -21,8 +21,8 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/hwspinlock.h> 22#include <linux/hwspinlock.h>
23 23
24#include <plat/omap_hwmod.h> 24#include "omap_hwmod.h"
25#include <plat/omap_device.h> 25#include "omap_device.h"
26 26
27static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = { 27static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = {
28 .base_id = 0, 28 .base_id = 0,
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index fc57e67b321..fbb9b152cd5 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -19,21 +19,23 @@
19 * 19 *
20 */ 20 */
21 21
22#include <plat/i2c.h> 22#include "soc.h"
23#include "common.h" 23#include "omap_hwmod.h"
24#include <plat/omap_hwmod.h> 24#include "omap_device.h"
25 25
26#include "prm.h"
27#include "common.h"
26#include "mux.h" 28#include "mux.h"
29#include "i2c.h"
27 30
28/* In register I2C_CON, Bit 15 is the I2C enable bit */ 31/* In register I2C_CON, Bit 15 is the I2C enable bit */
29#define I2C_EN BIT(15) 32#define I2C_EN BIT(15)
30#define OMAP2_I2C_CON_OFFSET 0x24 33#define OMAP2_I2C_CON_OFFSET 0x24
31#define OMAP4_I2C_CON_OFFSET 0xA4 34#define OMAP4_I2C_CON_OFFSET 0xA4
32 35
33/* Maximum microseconds to wait for OMAP module to softreset */ 36#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
34#define MAX_MODULE_SOFTRESET_WAIT 10000
35 37
36void __init omap2_i2c_mux_pins(int bus_id) 38static void __init omap2_i2c_mux_pins(int bus_id)
37{ 39{
38 char mux_name[sizeof("i2c2_scl.i2c2_scl")]; 40 char mux_name[sizeof("i2c2_scl.i2c2_scl")];
39 41
@@ -104,3 +106,62 @@ int omap_i2c_reset(struct omap_hwmod *oh)
104 106
105 return 0; 107 return 0;
106} 108}
109
110static int __init omap_i2c_nr_ports(void)
111{
112 int ports = 0;
113
114 if (cpu_is_omap24xx())
115 ports = 2;
116 else if (cpu_is_omap34xx())
117 ports = 3;
118 else if (cpu_is_omap44xx())
119 ports = 4;
120 return ports;
121}
122
123static const char name[] = "omap_i2c";
124
125int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
126 int bus_id)
127{
128 int l;
129 struct omap_hwmod *oh;
130 struct platform_device *pdev;
131 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
132 struct omap_i2c_bus_platform_data *pdata;
133 struct omap_i2c_dev_attr *dev_attr;
134
135 if (bus_id > omap_i2c_nr_ports())
136 return -EINVAL;
137
138 omap2_i2c_mux_pins(bus_id);
139
140 l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
141 WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
142 "String buffer overflow in I2C%d device setup\n", bus_id);
143 oh = omap_hwmod_lookup(oh_name);
144 if (!oh) {
145 pr_err("Could not look up %s\n", oh_name);
146 return -EEXIST;
147 }
148
149 pdata = i2c_pdata;
150 /*
151 * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
152 * use, and functionality implementation flags, up to the OMAP I2C
153 * driver via platform data
154 */
155 pdata->rev = oh->class->rev;
156
157 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
158 pdata->flags = dev_attr->flags;
159
160 pdev = omap_device_build(name, bus_id, oh, pdata,
161 sizeof(struct omap_i2c_bus_platform_data),
162 NULL, 0, 0);
163 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
164
165 return PTR_RET(pdev);
166}
167
diff --git a/arch/arm/mach-omap2/i2c.h b/arch/arm/mach-omap2/i2c.h
new file mode 100644
index 00000000000..42b6f2e7d19
--- /dev/null
+++ b/arch/arm/mach-omap2/i2c.h
@@ -0,0 +1,42 @@
1/*
2 * Helper module for board specific I2C bus registration
3 *
4 * Copyright (C) 2009 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <plat/i2c.h>
23
24#ifndef __MACH_OMAP2_I2C_H
25#define __MACH_OMAP2_I2C_H
26
27/**
28 * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
29 * @fifo_depth: total controller FIFO size (in bytes)
30 * @flags: differences in hardware support capability
31 *
32 * @fifo_depth represents what exists on the hardware, not what is
33 * actually configured at runtime by the device driver.
34 */
35struct omap_i2c_dev_attr {
36 u8 fifo_depth;
37 u32 flags;
38};
39
40int omap_i2c_reset(struct omap_hwmod *oh);
41
42#endif /* __MACH_OMAP2_I2C_H */
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index cf2362ccb23..45cc7ed4dd5 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -28,6 +28,9 @@
28#include "soc.h" 28#include "soc.h"
29#include "control.h" 29#include "control.h"
30 30
31#define OMAP4_SILICON_TYPE_STANDARD 0x01
32#define OMAP4_SILICON_TYPE_PERFORMANCE 0x02
33
31static unsigned int omap_revision; 34static unsigned int omap_revision;
32static const char *cpu_rev; 35static const char *cpu_rev;
33u32 omap_features; 36u32 omap_features;
@@ -273,25 +276,11 @@ void __init omap4xxx_check_features(void)
273{ 276{
274 u32 si_type; 277 u32 si_type;
275 278
276 if (cpu_is_omap443x()) 279 si_type =
277 omap_features |= OMAP4_HAS_MPU_1GHZ; 280 (read_tap_reg(OMAP4_CTRL_MODULE_CORE_STD_FUSE_PROD_ID_1) >> 16) & 0x03;
278
279 281
280 if (cpu_is_omap446x()) { 282 if (si_type == OMAP4_SILICON_TYPE_PERFORMANCE)
281 si_type = 283 omap_features = OMAP4_HAS_PERF_SILICON;
282 read_tap_reg(OMAP4_CTRL_MODULE_CORE_STD_FUSE_PROD_ID_1);
283 switch ((si_type & (3 << 16)) >> 16) {
284 case 2:
285 /* High performance device */
286 omap_features |= OMAP4_HAS_MPU_1_5GHZ;
287 break;
288 case 1:
289 default:
290 /* Standard device */
291 omap_features |= OMAP4_HAS_MPU_1_2GHZ;
292 break;
293 }
294 }
295} 284}
296 285
297void __init ti81xx_check_features(void) 286void __init ti81xx_check_features(void)
@@ -559,11 +548,12 @@ void __init omap5xxx_check_revision(void)
559 * detect the exact revision later on in omap2_detect_revision() once map_io 548 * detect the exact revision later on in omap2_detect_revision() once map_io
560 * is done. 549 * is done.
561 */ 550 */
562void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) 551void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
563{ 552{
564 omap_revision = omap2_globals->class; 553 omap_revision = class;
565 tap_base = omap2_globals->tap; 554 tap_base = tap;
566 555
556 /* XXX What is this intended to do? */
567 if (cpu_is_omap34xx()) 557 if (cpu_is_omap34xx())
568 tap_prod_id = 0x0210; 558 tap_prod_id = 0x0210;
569 else 559 else
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 93d10de7129..cfaed13d004 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -13,7 +13,7 @@
13 13
14#include <linux/serial_reg.h> 14#include <linux/serial_reg.h>
15 15
16#include <plat/serial.h> 16#include <mach/serial.h>
17 17
18#define UART_OFFSET(addr) ((addr) & 0x00ffffff) 18#define UART_OFFSET(addr) ((addr) & 0x00ffffff)
19 19
diff --git a/arch/arm/mach-omap2/include/mach/gpio.h b/arch/arm/mach-omap2/include/mach/gpio.h
deleted file mode 100644
index 5621cc59c9f..00000000000
--- a/arch/arm/mach-omap2/include/mach/gpio.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * arch/arm/mach-omap2/include/mach/gpio.h
3 */
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/mach-omap2/include/mach/serial.h
index 65fce44dce3..70eda00db7a 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/mach-omap2/include/mach/serial.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/serial.h
3 *
4 * Copyright (C) 2009 Texas Instruments 2 * Copyright (C) 2009 Texas Instruments
5 * Added OMAP4 support- Santosh Shilimkar <santosh.shilimkar@ti.com> 3 * Added OMAP4 support- Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * 4 *
@@ -10,11 +8,6 @@
10 * GNU General Public License for more details. 8 * GNU General Public License for more details.
11 */ 9 */
12 10
13#ifndef __ASM_ARCH_SERIAL_H
14#define __ASM_ARCH_SERIAL_H
15
16#include <linux/init.h>
17
18/* 11/*
19 * Memory entry used for the DEBUG_LL UART configuration, relative to 12 * Memory entry used for the DEBUG_LL UART configuration, relative to
20 * start of RAM. See also uncompress.h and debug-macro.S. 13 * start of RAM. See also uncompress.h and debug-macro.S.
@@ -29,11 +22,6 @@
29 */ 22 */
30#define OMAP_UART_INFO_OFS 0x3ffc 23#define OMAP_UART_INFO_OFS 0x3ffc
31 24
32/* OMAP1 serial ports */
33#define OMAP1_UART1_BASE 0xfffb0000
34#define OMAP1_UART2_BASE 0xfffb0800
35#define OMAP1_UART3_BASE 0xfffb9800
36
37/* OMAP2 serial ports */ 25/* OMAP2 serial ports */
38#define OMAP2_UART1_BASE 0x4806a000 26#define OMAP2_UART1_BASE 0x4806a000
39#define OMAP2_UART2_BASE 0x4806c000 27#define OMAP2_UART2_BASE 0x4806c000
@@ -76,20 +64,14 @@
76#define ZOOM_UART_VIRT 0xfa400000 64#define ZOOM_UART_VIRT 0xfa400000
77 65
78#define OMAP_PORT_SHIFT 2 66#define OMAP_PORT_SHIFT 2
79#define OMAP7XX_PORT_SHIFT 0
80#define ZOOM_PORT_SHIFT 1 67#define ZOOM_PORT_SHIFT 1
81 68
82#define OMAP1510_BASE_BAUD (12000000/16)
83#define OMAP16XX_BASE_BAUD (48000000/16)
84#define OMAP24XX_BASE_BAUD (48000000/16) 69#define OMAP24XX_BASE_BAUD (48000000/16)
85 70
86/* 71/*
87 * DEBUG_LL port encoding stored into the UART1 scratchpad register by 72 * DEBUG_LL port encoding stored into the UART1 scratchpad register by
88 * decomp_setup in uncompress.h 73 * decomp_setup in uncompress.h
89 */ 74 */
90#define OMAP1UART1 11
91#define OMAP1UART2 12
92#define OMAP1UART3 13
93#define OMAP2UART1 21 75#define OMAP2UART1 21
94#define OMAP2UART2 22 76#define OMAP2UART2 22
95#define OMAP2UART3 23 77#define OMAP2UART3 23
@@ -109,15 +91,6 @@
109#define OMAP5UART4 OMAP4UART4 91#define OMAP5UART4 OMAP4UART4
110#define ZOOM_UART 95 /* Only on zoom2/3 */ 92#define ZOOM_UART 95 /* Only on zoom2/3 */
111 93
112/* This is only used by 8250.c for omap1510 */
113#define is_omap_port(pt) ({int __ret = 0; \
114 if ((pt)->port.mapbase == OMAP1_UART1_BASE || \
115 (pt)->port.mapbase == OMAP1_UART2_BASE || \
116 (pt)->port.mapbase == OMAP1_UART3_BASE) \
117 __ret = 1; \
118 __ret; \
119 })
120
121#ifndef __ASSEMBLER__ 94#ifndef __ASSEMBLER__
122 95
123struct omap_board_data; 96struct omap_board_data;
@@ -128,5 +101,3 @@ extern void omap_serial_board_init(struct omap_uart_port_info *platform_data);
128extern void omap_serial_init_port(struct omap_board_data *bdata, 101extern void omap_serial_init_port(struct omap_board_data *bdata,
129 struct omap_uart_port_info *platform_data); 102 struct omap_uart_port_info *platform_data);
130#endif 103#endif
131
132#endif
diff --git a/arch/arm/mach-omap2/include/mach/uncompress.h b/arch/arm/mach-omap2/include/mach/uncompress.h
index 78e0557bfd4..8e3546d3e04 100644
--- a/arch/arm/mach-omap2/include/mach/uncompress.h
+++ b/arch/arm/mach-omap2/include/mach/uncompress.h
@@ -1,5 +1,176 @@
1/* 1/*
2 * arch/arm/mach-omap2/include/mach/uncompress.h 2 * arch/arm/plat-omap/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Initially based on:
7 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Author: Greg Lonnon <glonnon@ridgerun.com>
10 *
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
3 */ 18 */
4 19
5#include <plat/uncompress.h> 20#include <linux/types.h>
21#include <linux/serial_reg.h>
22
23#include <asm/memory.h>
24#include <asm/mach-types.h>
25
26#include <mach/serial.h>
27
28#define MDR1_MODE_MASK 0x07
29
30volatile u8 *uart_base;
31int uart_shift;
32
33/*
34 * Store the DEBUG_LL uart number into memory.
35 * See also debug-macro.S, and serial.c for related code.
36 */
37static void set_omap_uart_info(unsigned char port)
38{
39 /*
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
42 */
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
46}
47
48static void putc(int c)
49{
50 if (!uart_base)
51 return;
52
53 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
56
57 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
58 barrier();
59 uart_base[UART_TX << uart_shift] = c;
60}
61
62static inline void flush(void)
63{
64}
65
66/*
67 * Macros to configure UART1 and debug UART
68 */
69#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
70 if (machine_is_##mach()) { \
71 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
74 set_omap_uart_info(port); \
75 break; \
76 }
77
78#define DEBUG_LL_OMAP2(p, mach) \
79 _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
80 OMAP2UART##p)
81
82#define DEBUG_LL_OMAP3(p, mach) \
83 _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP3UART##p)
85
86#define DEBUG_LL_OMAP4(p, mach) \
87 _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
88 OMAP4UART##p)
89
90#define DEBUG_LL_OMAP5(p, mach) \
91 _DEBUG_LL_ENTRY(mach, OMAP5_UART##p##_BASE, OMAP_PORT_SHIFT, \
92 OMAP5UART##p)
93/* Zoom2/3 shift is different for UART1 and external port */
94#define DEBUG_LL_ZOOM(mach) \
95 _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
96
97#define DEBUG_LL_TI81XX(p, mach) \
98 _DEBUG_LL_ENTRY(mach, TI81XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
99 TI81XXUART##p)
100
101#define DEBUG_LL_AM33XX(p, mach) \
102 _DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
103 AM33XXUART##p)
104
105static inline void arch_decomp_setup(void)
106{
107 int port = 0;
108
109 /*
110 * Initialize the port based on the machine ID from the bootloader.
111 * Note that we're using macros here instead of switch statement
112 * as machine_is functions are optimized out for the boards that
113 * are not selected.
114 */
115 do {
116 /* omap2 based boards using UART1 */
117 DEBUG_LL_OMAP2(1, omap_2430sdp);
118 DEBUG_LL_OMAP2(1, omap_apollon);
119 DEBUG_LL_OMAP2(1, omap_h4);
120
121 /* omap2 based boards using UART3 */
122 DEBUG_LL_OMAP2(3, nokia_n800);
123 DEBUG_LL_OMAP2(3, nokia_n810);
124 DEBUG_LL_OMAP2(3, nokia_n810_wimax);
125
126 /* omap3 based boards using UART1 */
127 DEBUG_LL_OMAP2(1, omap3evm);
128 DEBUG_LL_OMAP3(1, omap_3430sdp);
129 DEBUG_LL_OMAP3(1, omap_3630sdp);
130 DEBUG_LL_OMAP3(1, omap3530_lv_som);
131 DEBUG_LL_OMAP3(1, omap3_torpedo);
132
133 /* omap3 based boards using UART3 */
134 DEBUG_LL_OMAP3(3, cm_t35);
135 DEBUG_LL_OMAP3(3, cm_t3517);
136 DEBUG_LL_OMAP3(3, cm_t3730);
137 DEBUG_LL_OMAP3(3, craneboard);
138 DEBUG_LL_OMAP3(3, devkit8000);
139 DEBUG_LL_OMAP3(3, igep0020);
140 DEBUG_LL_OMAP3(3, igep0030);
141 DEBUG_LL_OMAP3(3, nokia_rm680);
142 DEBUG_LL_OMAP3(3, nokia_rm696);
143 DEBUG_LL_OMAP3(3, nokia_rx51);
144 DEBUG_LL_OMAP3(3, omap3517evm);
145 DEBUG_LL_OMAP3(3, omap3_beagle);
146 DEBUG_LL_OMAP3(3, omap3_pandora);
147 DEBUG_LL_OMAP3(3, omap_ldp);
148 DEBUG_LL_OMAP3(3, overo);
149 DEBUG_LL_OMAP3(3, touchbook);
150
151 /* omap4 based boards using UART3 */
152 DEBUG_LL_OMAP4(3, omap_4430sdp);
153 DEBUG_LL_OMAP4(3, omap4_panda);
154
155 /* omap5 based boards using UART3 */
156 DEBUG_LL_OMAP5(3, omap5_sevm);
157
158 /* zoom2/3 external uart */
159 DEBUG_LL_ZOOM(omap_zoom2);
160 DEBUG_LL_ZOOM(omap_zoom3);
161
162 /* TI8168 base boards using UART3 */
163 DEBUG_LL_TI81XX(3, ti8168evm);
164
165 /* TI8148 base boards using UART1 */
166 DEBUG_LL_TI81XX(1, ti8148evm);
167
168 /* AM33XX base boards using UART1 */
169 DEBUG_LL_AM33XX(1, am335xevm);
170 } while (0);
171}
172
173/*
174 * nothing to do
175 */
176#define arch_decomp_wdog()
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4234d28dc17..2c3fdd65387 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -25,14 +25,9 @@
25#include <asm/tlb.h> 25#include <asm/tlb.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <plat/sram.h> 28#include <linux/omap-dma.h>
29#include <plat/sdrc.h>
30#include <plat/serial.h>
31#include <plat/omap-pm.h>
32#include <plat/omap_hwmod.h>
33#include <plat/multi.h>
34#include <plat/dma.h>
35 29
30#include "omap_hwmod.h"
36#include "soc.h" 31#include "soc.h"
37#include "iomap.h" 32#include "iomap.h"
38#include "voltage.h" 33#include "voltage.h"
@@ -43,6 +38,21 @@
43#include "clock2xxx.h" 38#include "clock2xxx.h"
44#include "clock3xxx.h" 39#include "clock3xxx.h"
45#include "clock44xx.h" 40#include "clock44xx.h"
41#include "omap-pm.h"
42#include "sdrc.h"
43#include "control.h"
44#include "serial.h"
45#include "sram.h"
46#include "cm2xxx.h"
47#include "cm3xxx.h"
48#include "prm.h"
49#include "cm.h"
50#include "prcm_mpu44xx.h"
51#include "prminst44xx.h"
52#include "cminst44xx.h"
53#include "prm2xxx.h"
54#include "prm3xxx.h"
55#include "prm44xx.h"
46 56
47/* 57/*
48 * The machine specific code may provide the extra mapping besides the 58 * The machine specific code may provide the extra mapping besides the
@@ -265,7 +275,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
265#endif 275#endif
266 276
267#ifdef CONFIG_SOC_OMAP2420 277#ifdef CONFIG_SOC_OMAP2420
268void __init omap242x_map_common_io(void) 278void __init omap242x_map_io(void)
269{ 279{
270 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 280 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
271 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 281 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
@@ -273,7 +283,7 @@ void __init omap242x_map_common_io(void)
273#endif 283#endif
274 284
275#ifdef CONFIG_SOC_OMAP2430 285#ifdef CONFIG_SOC_OMAP2430
276void __init omap243x_map_common_io(void) 286void __init omap243x_map_io(void)
277{ 287{
278 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 288 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
279 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 289 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
@@ -281,28 +291,28 @@ void __init omap243x_map_common_io(void)
281#endif 291#endif
282 292
283#ifdef CONFIG_ARCH_OMAP3 293#ifdef CONFIG_ARCH_OMAP3
284void __init omap34xx_map_common_io(void) 294void __init omap3_map_io(void)
285{ 295{
286 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 296 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
287} 297}
288#endif 298#endif
289 299
290#ifdef CONFIG_SOC_TI81XX 300#ifdef CONFIG_SOC_TI81XX
291void __init omapti81xx_map_common_io(void) 301void __init ti81xx_map_io(void)
292{ 302{
293 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); 303 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
294} 304}
295#endif 305#endif
296 306
297#ifdef CONFIG_SOC_AM33XX 307#ifdef CONFIG_SOC_AM33XX
298void __init omapam33xx_map_common_io(void) 308void __init am33xx_map_io(void)
299{ 309{
300 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); 310 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
301} 311}
302#endif 312#endif
303 313
304#ifdef CONFIG_ARCH_OMAP4 314#ifdef CONFIG_ARCH_OMAP4
305void __init omap44xx_map_common_io(void) 315void __init omap4_map_io(void)
306{ 316{
307 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 317 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
308 omap_barriers_init(); 318 omap_barriers_init();
@@ -310,7 +320,7 @@ void __init omap44xx_map_common_io(void)
310#endif 320#endif
311 321
312#ifdef CONFIG_SOC_OMAP5 322#ifdef CONFIG_SOC_OMAP5
313void __init omap5_map_common_io(void) 323void __init omap5_map_io(void)
314{ 324{
315 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); 325 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
316} 326}
@@ -354,11 +364,6 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
354 return omap_hwmod_set_postsetup_state(oh, *(u8 *)data); 364 return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
355} 365}
356 366
357static void __init omap_common_init_early(void)
358{
359 omap_init_consistent_dma_size();
360}
361
362static void __init omap_hwmod_init_postsetup(void) 367static void __init omap_hwmod_init_postsetup(void)
363{ 368{
364 u8 postsetup_state; 369 u8 postsetup_state;
@@ -377,9 +382,16 @@ static void __init omap_hwmod_init_postsetup(void)
377#ifdef CONFIG_SOC_OMAP2420 382#ifdef CONFIG_SOC_OMAP2420
378void __init omap2420_init_early(void) 383void __init omap2420_init_early(void)
379{ 384{
380 omap2_set_globals_242x(); 385 omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
386 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
387 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
388 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
389 NULL);
390 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
391 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
381 omap2xxx_check_revision(); 392 omap2xxx_check_revision();
382 omap_common_init_early(); 393 omap2xxx_prm_init();
394 omap2xxx_cm_init();
383 omap2xxx_voltagedomains_init(); 395 omap2xxx_voltagedomains_init();
384 omap242x_powerdomains_init(); 396 omap242x_powerdomains_init();
385 omap242x_clockdomains_init(); 397 omap242x_clockdomains_init();
@@ -393,15 +405,23 @@ void __init omap2420_init_late(void)
393 omap_mux_late_init(); 405 omap_mux_late_init();
394 omap2_common_pm_late_init(); 406 omap2_common_pm_late_init();
395 omap2_pm_init(); 407 omap2_pm_init();
408 omap2_clk_enable_autoidle_all();
396} 409}
397#endif 410#endif
398 411
399#ifdef CONFIG_SOC_OMAP2430 412#ifdef CONFIG_SOC_OMAP2430
400void __init omap2430_init_early(void) 413void __init omap2430_init_early(void)
401{ 414{
402 omap2_set_globals_243x(); 415 omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
416 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
417 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
418 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
419 NULL);
420 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
421 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
403 omap2xxx_check_revision(); 422 omap2xxx_check_revision();
404 omap_common_init_early(); 423 omap2xxx_prm_init();
424 omap2xxx_cm_init();
405 omap2xxx_voltagedomains_init(); 425 omap2xxx_voltagedomains_init();
406 omap243x_powerdomains_init(); 426 omap243x_powerdomains_init();
407 omap243x_clockdomains_init(); 427 omap243x_clockdomains_init();
@@ -415,6 +435,7 @@ void __init omap2430_init_late(void)
415 omap_mux_late_init(); 435 omap_mux_late_init();
416 omap2_common_pm_late_init(); 436 omap2_common_pm_late_init();
417 omap2_pm_init(); 437 omap2_pm_init();
438 omap2_clk_enable_autoidle_all();
418} 439}
419#endif 440#endif
420 441
@@ -425,10 +446,17 @@ void __init omap2430_init_late(void)
425#ifdef CONFIG_ARCH_OMAP3 446#ifdef CONFIG_ARCH_OMAP3
426void __init omap3_init_early(void) 447void __init omap3_init_early(void)
427{ 448{
428 omap2_set_globals_3xxx(); 449 omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
450 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
451 OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
452 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
453 NULL);
454 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
455 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
429 omap3xxx_check_revision(); 456 omap3xxx_check_revision();
430 omap3xxx_check_features(); 457 omap3xxx_check_features();
431 omap_common_init_early(); 458 omap3xxx_prm_init();
459 omap3xxx_cm_init();
432 omap3xxx_voltagedomains_init(); 460 omap3xxx_voltagedomains_init();
433 omap3xxx_powerdomains_init(); 461 omap3xxx_powerdomains_init();
434 omap3xxx_clockdomains_init(); 462 omap3xxx_clockdomains_init();
@@ -459,10 +487,14 @@ void __init am35xx_init_early(void)
459 487
460void __init ti81xx_init_early(void) 488void __init ti81xx_init_early(void)
461{ 489{
462 omap2_set_globals_ti81xx(); 490 omap2_set_globals_tap(OMAP343X_CLASS,
491 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
492 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
493 NULL);
494 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
495 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
463 omap3xxx_check_revision(); 496 omap3xxx_check_revision();
464 ti81xx_check_features(); 497 ti81xx_check_features();
465 omap_common_init_early();
466 omap3xxx_voltagedomains_init(); 498 omap3xxx_voltagedomains_init();
467 omap3xxx_powerdomains_init(); 499 omap3xxx_powerdomains_init();
468 omap3xxx_clockdomains_init(); 500 omap3xxx_clockdomains_init();
@@ -476,6 +508,7 @@ void __init omap3_init_late(void)
476 omap_mux_late_init(); 508 omap_mux_late_init();
477 omap2_common_pm_late_init(); 509 omap2_common_pm_late_init();
478 omap3_pm_init(); 510 omap3_pm_init();
511 omap2_clk_enable_autoidle_all();
479} 512}
480 513
481void __init omap3430_init_late(void) 514void __init omap3430_init_late(void)
@@ -483,6 +516,7 @@ void __init omap3430_init_late(void)
483 omap_mux_late_init(); 516 omap_mux_late_init();
484 omap2_common_pm_late_init(); 517 omap2_common_pm_late_init();
485 omap3_pm_init(); 518 omap3_pm_init();
519 omap2_clk_enable_autoidle_all();
486} 520}
487 521
488void __init omap35xx_init_late(void) 522void __init omap35xx_init_late(void)
@@ -490,6 +524,7 @@ void __init omap35xx_init_late(void)
490 omap_mux_late_init(); 524 omap_mux_late_init();
491 omap2_common_pm_late_init(); 525 omap2_common_pm_late_init();
492 omap3_pm_init(); 526 omap3_pm_init();
527 omap2_clk_enable_autoidle_all();
493} 528}
494 529
495void __init omap3630_init_late(void) 530void __init omap3630_init_late(void)
@@ -497,6 +532,7 @@ void __init omap3630_init_late(void)
497 omap_mux_late_init(); 532 omap_mux_late_init();
498 omap2_common_pm_late_init(); 533 omap2_common_pm_late_init();
499 omap3_pm_init(); 534 omap3_pm_init();
535 omap2_clk_enable_autoidle_all();
500} 536}
501 537
502void __init am35xx_init_late(void) 538void __init am35xx_init_late(void)
@@ -504,6 +540,7 @@ void __init am35xx_init_late(void)
504 omap_mux_late_init(); 540 omap_mux_late_init();
505 omap2_common_pm_late_init(); 541 omap2_common_pm_late_init();
506 omap3_pm_init(); 542 omap3_pm_init();
543 omap2_clk_enable_autoidle_all();
507} 544}
508 545
509void __init ti81xx_init_late(void) 546void __init ti81xx_init_late(void)
@@ -511,16 +548,21 @@ void __init ti81xx_init_late(void)
511 omap_mux_late_init(); 548 omap_mux_late_init();
512 omap2_common_pm_late_init(); 549 omap2_common_pm_late_init();
513 omap3_pm_init(); 550 omap3_pm_init();
551 omap2_clk_enable_autoidle_all();
514} 552}
515#endif 553#endif
516 554
517#ifdef CONFIG_SOC_AM33XX 555#ifdef CONFIG_SOC_AM33XX
518void __init am33xx_init_early(void) 556void __init am33xx_init_early(void)
519{ 557{
520 omap2_set_globals_am33xx(); 558 omap2_set_globals_tap(AM335X_CLASS,
559 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
560 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
561 NULL);
562 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
563 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
521 omap3xxx_check_revision(); 564 omap3xxx_check_revision();
522 ti81xx_check_features(); 565 ti81xx_check_features();
523 omap_common_init_early();
524 am33xx_voltagedomains_init(); 566 am33xx_voltagedomains_init();
525 am33xx_powerdomains_init(); 567 am33xx_powerdomains_init();
526 am33xx_clockdomains_init(); 568 am33xx_clockdomains_init();
@@ -533,10 +575,19 @@ void __init am33xx_init_early(void)
533#ifdef CONFIG_ARCH_OMAP4 575#ifdef CONFIG_ARCH_OMAP4
534void __init omap4430_init_early(void) 576void __init omap4430_init_early(void)
535{ 577{
536 omap2_set_globals_443x(); 578 omap2_set_globals_tap(OMAP443X_CLASS,
579 OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
580 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
581 OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
582 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
583 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
584 OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
585 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
586 omap_prm_base_init();
587 omap_cm_base_init();
537 omap4xxx_check_revision(); 588 omap4xxx_check_revision();
538 omap4xxx_check_features(); 589 omap4xxx_check_features();
539 omap_common_init_early(); 590 omap44xx_prm_init();
540 omap44xx_voltagedomains_init(); 591 omap44xx_voltagedomains_init();
541 omap44xx_powerdomains_init(); 592 omap44xx_powerdomains_init();
542 omap44xx_clockdomains_init(); 593 omap44xx_clockdomains_init();
@@ -550,15 +601,24 @@ void __init omap4430_init_late(void)
550 omap_mux_late_init(); 601 omap_mux_late_init();
551 omap2_common_pm_late_init(); 602 omap2_common_pm_late_init();
552 omap4_pm_init(); 603 omap4_pm_init();
604 omap2_clk_enable_autoidle_all();
553} 605}
554#endif 606#endif
555 607
556#ifdef CONFIG_SOC_OMAP5 608#ifdef CONFIG_SOC_OMAP5
557void __init omap5_init_early(void) 609void __init omap5_init_early(void)
558{ 610{
559 omap2_set_globals_5xxx(); 611 omap2_set_globals_tap(OMAP54XX_CLASS,
612 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
613 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
614 OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
615 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
616 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
617 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
618 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
619 omap_prm_base_init();
620 omap_cm_base_init();
560 omap5xxx_check_revision(); 621 omap5xxx_check_revision();
561 omap_common_init_early();
562} 622}
563#endif 623#endif
564 624
diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c
deleted file mode 100644
index eefc37912ef..00000000000
--- a/arch/arm/mach-omap2/iommu2.c
+++ /dev/null
@@ -1,361 +0,0 @@
1/*
2 * omap iommu: omap2/3 architecture specific functions
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
7 * Paul Mundt and Toshihiro Kobayashi
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/err.h>
15#include <linux/device.h>
16#include <linux/jiffies.h>
17#include <linux/module.h>
18#include <linux/slab.h>
19#include <linux/stringify.h>
20
21#include <plat/iommu.h>
22
23/*
24 * omap2 architecture specific register bit definitions
25 */
26#define IOMMU_ARCH_VERSION 0x00000011
27
28/* SYSCONF */
29#define MMU_SYS_IDLE_SHIFT 3
30#define MMU_SYS_IDLE_FORCE (0 << MMU_SYS_IDLE_SHIFT)
31#define MMU_SYS_IDLE_NONE (1 << MMU_SYS_IDLE_SHIFT)
32#define MMU_SYS_IDLE_SMART (2 << MMU_SYS_IDLE_SHIFT)
33#define MMU_SYS_IDLE_MASK (3 << MMU_SYS_IDLE_SHIFT)
34
35#define MMU_SYS_SOFTRESET (1 << 1)
36#define MMU_SYS_AUTOIDLE 1
37
38/* SYSSTATUS */
39#define MMU_SYS_RESETDONE 1
40
41/* IRQSTATUS & IRQENABLE */
42#define MMU_IRQ_MULTIHITFAULT (1 << 4)
43#define MMU_IRQ_TABLEWALKFAULT (1 << 3)
44#define MMU_IRQ_EMUMISS (1 << 2)
45#define MMU_IRQ_TRANSLATIONFAULT (1 << 1)
46#define MMU_IRQ_TLBMISS (1 << 0)
47
48#define __MMU_IRQ_FAULT \
49 (MMU_IRQ_MULTIHITFAULT | MMU_IRQ_EMUMISS | MMU_IRQ_TRANSLATIONFAULT)
50#define MMU_IRQ_MASK \
51 (__MMU_IRQ_FAULT | MMU_IRQ_TABLEWALKFAULT | MMU_IRQ_TLBMISS)
52#define MMU_IRQ_TWL_MASK (__MMU_IRQ_FAULT | MMU_IRQ_TABLEWALKFAULT)
53#define MMU_IRQ_TLB_MISS_MASK (__MMU_IRQ_FAULT | MMU_IRQ_TLBMISS)
54
55/* MMU_CNTL */
56#define MMU_CNTL_SHIFT 1
57#define MMU_CNTL_MASK (7 << MMU_CNTL_SHIFT)
58#define MMU_CNTL_EML_TLB (1 << 3)
59#define MMU_CNTL_TWL_EN (1 << 2)
60#define MMU_CNTL_MMU_EN (1 << 1)
61
62#define get_cam_va_mask(pgsz) \
63 (((pgsz) == MMU_CAM_PGSZ_16M) ? 0xff000000 : \
64 ((pgsz) == MMU_CAM_PGSZ_1M) ? 0xfff00000 : \
65 ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 : \
66 ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0)
67
68
69static void __iommu_set_twl(struct omap_iommu *obj, bool on)
70{
71 u32 l = iommu_read_reg(obj, MMU_CNTL);
72
73 if (on)
74 iommu_write_reg(obj, MMU_IRQ_TWL_MASK, MMU_IRQENABLE);
75 else
76 iommu_write_reg(obj, MMU_IRQ_TLB_MISS_MASK, MMU_IRQENABLE);
77
78 l &= ~MMU_CNTL_MASK;
79 if (on)
80 l |= (MMU_CNTL_MMU_EN | MMU_CNTL_TWL_EN);
81 else
82 l |= (MMU_CNTL_MMU_EN);
83
84 iommu_write_reg(obj, l, MMU_CNTL);
85}
86
87
88static int omap2_iommu_enable(struct omap_iommu *obj)
89{
90 u32 l, pa;
91 unsigned long timeout;
92
93 if (!obj->iopgd || !IS_ALIGNED((u32)obj->iopgd, SZ_16K))
94 return -EINVAL;
95
96 pa = virt_to_phys(obj->iopgd);
97 if (!IS_ALIGNED(pa, SZ_16K))
98 return -EINVAL;
99
100 iommu_write_reg(obj, MMU_SYS_SOFTRESET, MMU_SYSCONFIG);
101
102 timeout = jiffies + msecs_to_jiffies(20);
103 do {
104 l = iommu_read_reg(obj, MMU_SYSSTATUS);
105 if (l & MMU_SYS_RESETDONE)
106 break;
107 } while (!time_after(jiffies, timeout));
108
109 if (!(l & MMU_SYS_RESETDONE)) {
110 dev_err(obj->dev, "can't take mmu out of reset\n");
111 return -ENODEV;
112 }
113
114 l = iommu_read_reg(obj, MMU_REVISION);
115 dev_info(obj->dev, "%s: version %d.%d\n", obj->name,
116 (l >> 4) & 0xf, l & 0xf);
117
118 l = iommu_read_reg(obj, MMU_SYSCONFIG);
119 l &= ~MMU_SYS_IDLE_MASK;
120 l |= (MMU_SYS_IDLE_SMART | MMU_SYS_AUTOIDLE);
121 iommu_write_reg(obj, l, MMU_SYSCONFIG);
122
123 iommu_write_reg(obj, pa, MMU_TTB);
124
125 __iommu_set_twl(obj, true);
126
127 return 0;
128}
129
130static void omap2_iommu_disable(struct omap_iommu *obj)
131{
132 u32 l = iommu_read_reg(obj, MMU_CNTL);
133
134 l &= ~MMU_CNTL_MASK;
135 iommu_write_reg(obj, l, MMU_CNTL);
136 iommu_write_reg(obj, MMU_SYS_IDLE_FORCE, MMU_SYSCONFIG);
137
138 dev_dbg(obj->dev, "%s is shutting down\n", obj->name);
139}
140
141static void omap2_iommu_set_twl(struct omap_iommu *obj, bool on)
142{
143 __iommu_set_twl(obj, false);
144}
145
146static u32 omap2_iommu_fault_isr(struct omap_iommu *obj, u32 *ra)
147{
148 u32 stat, da;
149 u32 errs = 0;
150
151 stat = iommu_read_reg(obj, MMU_IRQSTATUS);
152 stat &= MMU_IRQ_MASK;
153 if (!stat) {
154 *ra = 0;
155 return 0;
156 }
157
158 da = iommu_read_reg(obj, MMU_FAULT_AD);
159 *ra = da;
160
161 if (stat & MMU_IRQ_TLBMISS)
162 errs |= OMAP_IOMMU_ERR_TLB_MISS;
163 if (stat & MMU_IRQ_TRANSLATIONFAULT)
164 errs |= OMAP_IOMMU_ERR_TRANS_FAULT;
165 if (stat & MMU_IRQ_EMUMISS)
166 errs |= OMAP_IOMMU_ERR_EMU_MISS;
167 if (stat & MMU_IRQ_TABLEWALKFAULT)
168 errs |= OMAP_IOMMU_ERR_TBLWALK_FAULT;
169 if (stat & MMU_IRQ_MULTIHITFAULT)
170 errs |= OMAP_IOMMU_ERR_MULTIHIT_FAULT;
171 iommu_write_reg(obj, stat, MMU_IRQSTATUS);
172
173 return errs;
174}
175
176static void omap2_tlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr)
177{
178 cr->cam = iommu_read_reg(obj, MMU_READ_CAM);
179 cr->ram = iommu_read_reg(obj, MMU_READ_RAM);
180}
181
182static void omap2_tlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr)
183{
184 iommu_write_reg(obj, cr->cam | MMU_CAM_V, MMU_CAM);
185 iommu_write_reg(obj, cr->ram, MMU_RAM);
186}
187
188static u32 omap2_cr_to_virt(struct cr_regs *cr)
189{
190 u32 page_size = cr->cam & MMU_CAM_PGSZ_MASK;
191 u32 mask = get_cam_va_mask(cr->cam & page_size);
192
193 return cr->cam & mask;
194}
195
196static struct cr_regs *omap2_alloc_cr(struct omap_iommu *obj,
197 struct iotlb_entry *e)
198{
199 struct cr_regs *cr;
200
201 if (e->da & ~(get_cam_va_mask(e->pgsz))) {
202 dev_err(obj->dev, "%s:\twrong alignment: %08x\n", __func__,
203 e->da);
204 return ERR_PTR(-EINVAL);
205 }
206
207 cr = kmalloc(sizeof(*cr), GFP_KERNEL);
208 if (!cr)
209 return ERR_PTR(-ENOMEM);
210
211 cr->cam = (e->da & MMU_CAM_VATAG_MASK) | e->prsvd | e->pgsz | e->valid;
212 cr->ram = e->pa | e->endian | e->elsz | e->mixed;
213
214 return cr;
215}
216
217static inline int omap2_cr_valid(struct cr_regs *cr)
218{
219 return cr->cam & MMU_CAM_V;
220}
221
222static u32 omap2_get_pte_attr(struct iotlb_entry *e)
223{
224 u32 attr;
225
226 attr = e->mixed << 5;
227 attr |= e->endian;
228 attr |= e->elsz >> 3;
229 attr <<= (((e->pgsz == MMU_CAM_PGSZ_4K) ||
230 (e->pgsz == MMU_CAM_PGSZ_64K)) ? 0 : 6);
231 return attr;
232}
233
234static ssize_t
235omap2_dump_cr(struct omap_iommu *obj, struct cr_regs *cr, char *buf)
236{
237 char *p = buf;
238
239 /* FIXME: Need more detail analysis of cam/ram */
240 p += sprintf(p, "%08x %08x %01x\n", cr->cam, cr->ram,
241 (cr->cam & MMU_CAM_P) ? 1 : 0);
242
243 return p - buf;
244}
245
246#define pr_reg(name) \
247 do { \
248 ssize_t bytes; \
249 const char *str = "%20s: %08x\n"; \
250 const int maxcol = 32; \
251 bytes = snprintf(p, maxcol, str, __stringify(name), \
252 iommu_read_reg(obj, MMU_##name)); \
253 p += bytes; \
254 len -= bytes; \
255 if (len < maxcol) \
256 goto out; \
257 } while (0)
258
259static ssize_t
260omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len)
261{
262 char *p = buf;
263
264 pr_reg(REVISION);
265 pr_reg(SYSCONFIG);
266 pr_reg(SYSSTATUS);
267 pr_reg(IRQSTATUS);
268 pr_reg(IRQENABLE);
269 pr_reg(WALKING_ST);
270 pr_reg(CNTL);
271 pr_reg(FAULT_AD);
272 pr_reg(TTB);
273 pr_reg(LOCK);
274 pr_reg(LD_TLB);
275 pr_reg(CAM);
276 pr_reg(RAM);
277 pr_reg(GFLUSH);
278 pr_reg(FLUSH_ENTRY);
279 pr_reg(READ_CAM);
280 pr_reg(READ_RAM);
281 pr_reg(EMU_FAULT_AD);
282out:
283 return p - buf;
284}
285
286static void omap2_iommu_save_ctx(struct omap_iommu *obj)
287{
288 int i;
289 u32 *p = obj->ctx;
290
291 for (i = 0; i < (MMU_REG_SIZE / sizeof(u32)); i++) {
292 p[i] = iommu_read_reg(obj, i * sizeof(u32));
293 dev_dbg(obj->dev, "%s\t[%02d] %08x\n", __func__, i, p[i]);
294 }
295
296 BUG_ON(p[0] != IOMMU_ARCH_VERSION);
297}
298
299static void omap2_iommu_restore_ctx(struct omap_iommu *obj)
300{
301 int i;
302 u32 *p = obj->ctx;
303
304 for (i = 0; i < (MMU_REG_SIZE / sizeof(u32)); i++) {
305 iommu_write_reg(obj, p[i], i * sizeof(u32));
306 dev_dbg(obj->dev, "%s\t[%02d] %08x\n", __func__, i, p[i]);
307 }
308
309 BUG_ON(p[0] != IOMMU_ARCH_VERSION);
310}
311
312static void omap2_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e)
313{
314 e->da = cr->cam & MMU_CAM_VATAG_MASK;
315 e->pa = cr->ram & MMU_RAM_PADDR_MASK;
316 e->valid = cr->cam & MMU_CAM_V;
317 e->pgsz = cr->cam & MMU_CAM_PGSZ_MASK;
318 e->endian = cr->ram & MMU_RAM_ENDIAN_MASK;
319 e->elsz = cr->ram & MMU_RAM_ELSZ_MASK;
320 e->mixed = cr->ram & MMU_RAM_MIXED;
321}
322
323static const struct iommu_functions omap2_iommu_ops = {
324 .version = IOMMU_ARCH_VERSION,
325
326 .enable = omap2_iommu_enable,
327 .disable = omap2_iommu_disable,
328 .set_twl = omap2_iommu_set_twl,
329 .fault_isr = omap2_iommu_fault_isr,
330
331 .tlb_read_cr = omap2_tlb_read_cr,
332 .tlb_load_cr = omap2_tlb_load_cr,
333
334 .cr_to_e = omap2_cr_to_e,
335 .cr_to_virt = omap2_cr_to_virt,
336 .alloc_cr = omap2_alloc_cr,
337 .cr_valid = omap2_cr_valid,
338 .dump_cr = omap2_dump_cr,
339
340 .get_pte_attr = omap2_get_pte_attr,
341
342 .save_ctx = omap2_iommu_save_ctx,
343 .restore_ctx = omap2_iommu_restore_ctx,
344 .dump_ctx = omap2_iommu_dump_ctx,
345};
346
347static int __init omap2_iommu_init(void)
348{
349 return omap_install_iommu_arch(&omap2_iommu_ops);
350}
351module_init(omap2_iommu_init);
352
353static void __exit omap2_iommu_exit(void)
354{
355 omap_uninstall_iommu_arch(&omap2_iommu_ops);
356}
357module_exit(omap2_iommu_exit);
358
359MODULE_AUTHOR("Hiroshi DOYU, Paul Mundt and Toshihiro Kobayashi");
360MODULE_DESCRIPTION("omap iommu: omap2/3 architecture specific functions");
361MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 37f8f948047..df49f2a4946 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -19,16 +19,17 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/platform_data/asoc-ti-mcbsp.h> 21#include <linux/platform_data/asoc-ti-mcbsp.h>
22
23#include <plat/dma.h>
24#include <plat/omap_device.h>
25#include <linux/pm_runtime.h> 22#include <linux/pm_runtime.h>
26 23
24#include <linux/omap-dma.h>
25
26#include "omap_device.h"
27
27/* 28/*
28 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. 29 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
29 * Sidetone needs non-gated ICLK and sidetone autoidle is broken. 30 * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
30 */ 31 */
31#include "cm2xxx_3xxx.h" 32#include "cm3xxx.h"
32#include "cm-regbits-34xx.h" 33#include "cm-regbits-34xx.h"
33 34
34static int omap3_enable_st_clock(unsigned int id, bool enable) 35static int omap3_enable_st_clock(unsigned int id, bool enable)
diff --git a/arch/arm/mach-omap2/mmc.h b/arch/arm/mach-omap2/mmc.h
new file mode 100644
index 00000000000..0cd4b089da9
--- /dev/null
+++ b/arch/arm/mach-omap2/mmc.h
@@ -0,0 +1,23 @@
1#include <linux/mmc/host.h>
2#include <linux/platform_data/mmc-omap.h>
3
4#define OMAP24XX_NR_MMC 2
5#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
6#define OMAP2_MMC1_BASE 0x4809c000
7
8#define OMAP4_MMC_REG_OFFSET 0x100
9
10#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
11void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
12#else
13static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
14{
15}
16#endif
17
18struct omap_hwmod;
19int omap_msdi_reset(struct omap_hwmod *oh);
20
21/* called from board-specific card detection service routine */
22extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
23 int is_closed);
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
index 9e57b4aadb0..aafdd4ca9f4 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -25,13 +25,13 @@
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/platform_data/gpio-omap.h> 26#include <linux/platform_data/gpio-omap.h>
27 27
28#include <plat/omap_hwmod.h> 28#include "prm.h"
29#include <plat/omap_device.h>
30#include <plat/mmc.h>
31
32#include "common.h" 29#include "common.h"
33#include "control.h" 30#include "control.h"
31#include "omap_hwmod.h"
32#include "omap_device.h"
34#include "mux.h" 33#include "mux.h"
34#include "mmc.h"
35 35
36/* 36/*
37 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register 37 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
@@ -44,9 +44,6 @@
44#define MSDI_CON_CLKD_MASK (0x3f << 0) 44#define MSDI_CON_CLKD_MASK (0x3f << 0)
45#define MSDI_CON_CLKD_SHIFT 0 45#define MSDI_CON_CLKD_SHIFT 0
46 46
47/* Maximum microseconds to wait for OMAP module to softreset */
48#define MAX_MODULE_SOFTRESET_WAIT 10000
49
50/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */ 47/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */
51#define MSDI_TARGET_RESET_CLKD 0x3ff 48#define MSDI_TARGET_RESET_CLKD 0x3ff
52 49
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 701e17cba46..26126343d6a 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -36,8 +36,9 @@
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37 37
38 38
39#include <plat/omap_hwmod.h> 39#include "omap_hwmod.h"
40 40
41#include "soc.h"
41#include "control.h" 42#include "control.h"
42#include "mux.h" 43#include "mux.h"
43#include "prm.h" 44#include "prm.h"
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 502e3135aad..0ea09faf327 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -18,6 +18,8 @@
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19#include <linux/init.h> 19#include <linux/init.h>
20 20
21#include "omap44xx.h"
22
21 __CPUINIT 23 __CPUINIT
22 24
23/* Physical address needed since MMU not enabled yet on secondary core */ 25/* Physical address needed since MMU not enabled yet on secondary core */
@@ -64,3 +66,39 @@ hold: ldr r12,=0x103
64 b secondary_startup 66 b secondary_startup
65ENDPROC(omap_secondary_startup) 67ENDPROC(omap_secondary_startup)
66 68
69ENTRY(omap_secondary_startup_4460)
70hold_2: ldr r12,=0x103
71 dsb
72 smc #0 @ read from AuxCoreBoot0
73 mov r0, r0, lsr #9
74 mrc p15, 0, r4, c0, c0, 5
75 and r4, r4, #0x0f
76 cmp r0, r4
77 bne hold_2
78
79 /*
80 * GIC distributor control register has changed between
81 * CortexA9 r1pX and r2pX. The Control Register secure
82 * banked version is now composed of 2 bits:
83 * bit 0 == Secure Enable
84 * bit 1 == Non-Secure Enable
85 * The Non-Secure banked register has not changed
86 * Because the ROM Code is based on the r1pX GIC, the CPU1
87 * GIC restoration will cause a problem to CPU0 Non-Secure SW.
88 * The workaround must be:
89 * 1) Before doing the CPU1 wakeup, CPU0 must disable
90 * the GIC distributor
91 * 2) CPU1 must re-enable the GIC distributor on
92 * it's wakeup path.
93 */
94 ldr r1, =OMAP44XX_GIC_DIST_BASE
95 ldr r0, [r1]
96 orr r0, #1
97 str r0, [r1]
98
99 /*
100 * we've been released from the wait loop,secondary_stack
101 * should now contain the SVC stack for this core
102 */
103 b secondary_startup
104ENDPROC(omap_secondary_startup_4460)
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index df298d46707..a6a4ff8744b 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -13,7 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15 15
16#include <plat/iommu.h> 16#include <linux/platform_data/iommu-omap.h>
17 17
18#include "soc.h" 18#include "soc.h"
19#include "common.h" 19#include "common.h"
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index ff4e6a0e9c7..aac46bfdbeb 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -50,6 +50,7 @@
50#include <asm/suspend.h> 50#include <asm/suspend.h>
51#include <asm/hardware/cache-l2x0.h> 51#include <asm/hardware/cache-l2x0.h>
52 52
53#include "soc.h"
53#include "common.h" 54#include "common.h"
54#include "omap44xx.h" 55#include "omap44xx.h"
55#include "omap4-sar-layout.h" 56#include "omap4-sar-layout.h"
@@ -67,6 +68,7 @@ struct omap4_cpu_pm_info {
67 void __iomem *scu_sar_addr; 68 void __iomem *scu_sar_addr;
68 void __iomem *wkup_sar_addr; 69 void __iomem *wkup_sar_addr;
69 void __iomem *l2x0_sar_addr; 70 void __iomem *l2x0_sar_addr;
71 void (*secondary_startup)(void);
70}; 72};
71 73
72static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info); 74static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
@@ -299,6 +301,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
299int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) 301int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
300{ 302{
301 unsigned int cpu_state = 0; 303 unsigned int cpu_state = 0;
304 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
302 305
303 if (omap_rev() == OMAP4430_REV_ES1_0) 306 if (omap_rev() == OMAP4430_REV_ES1_0)
304 return -ENXIO; 307 return -ENXIO;
@@ -308,7 +311,7 @@ int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
308 311
309 clear_cpu_prev_pwrst(cpu); 312 clear_cpu_prev_pwrst(cpu);
310 set_cpu_next_pwrst(cpu, power_state); 313 set_cpu_next_pwrst(cpu, power_state);
311 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_secondary_startup)); 314 set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup));
312 scu_pwrst_prepare(cpu, power_state); 315 scu_pwrst_prepare(cpu, power_state);
313 316
314 /* 317 /*
@@ -359,6 +362,11 @@ int __init omap4_mpuss_init(void)
359 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1; 362 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1;
360 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 363 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
361 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; 364 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
365 if (cpu_is_omap446x())
366 pm_info->secondary_startup = omap_secondary_startup_4460;
367 else
368 pm_info->secondary_startup = omap_secondary_startup;
369
362 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm"); 370 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm");
363 if (!pm_info->pwrdm) { 371 if (!pm_info->pwrdm) {
364 pr_err("Lookup failed for CPU1 pwrdm\n"); 372 pr_err("Lookup failed for CPU1 pwrdm\n");
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/mach-omap2/omap-pm-noop.c
index 9722f418ae1..6a3be2bebdd 100644
--- a/arch/arm/plat-omap/omap-pm-noop.c
+++ b/arch/arm/mach-omap2/omap-pm-noop.c
@@ -22,9 +22,8 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25/* Interface documentation is in mach/omap-pm.h */ 25#include "omap_device.h"
26#include <plat/omap-pm.h> 26#include "omap-pm.h"
27#include <plat/omap_device.h>
28 27
29static bool off_mode_enabled; 28static bool off_mode_enabled;
30static int dummy_context_loss_counter; 29static int dummy_context_loss_counter;
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/mach-omap2/omap-pm.h
index 67faa7b8fe9..67faa7b8fe9 100644
--- a/arch/arm/plat-omap/include/plat/omap-pm.h
+++ b/arch/arm/mach-omap2/omap-pm.h
diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c
index e089e4d1ae3..b970440cffc 100644
--- a/arch/arm/mach-omap2/omap-secure.c
+++ b/arch/arm/mach-omap2/omap-secure.c
@@ -18,7 +18,6 @@
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/memblock.h> 19#include <asm/memblock.h>
20 20
21#include <plat/omap-secure.h>
22#include "omap-secure.h" 21#include "omap-secure.h"
23 22
24static phys_addr_t omap_secure_memblock_base; 23static phys_addr_t omap_secure_memblock_base;
diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
index c90a43589ab..0e729170c46 100644
--- a/arch/arm/mach-omap2/omap-secure.h
+++ b/arch/arm/mach-omap2/omap-secure.h
@@ -52,6 +52,13 @@ extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs,
52 u32 arg1, u32 arg2, u32 arg3, u32 arg4); 52 u32 arg1, u32 arg2, u32 arg3, u32 arg4);
53extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); 53extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
54extern phys_addr_t omap_secure_ram_mempool_base(void); 54extern phys_addr_t omap_secure_ram_mempool_base(void);
55extern int omap_secure_ram_reserve_memblock(void);
55 56
57#ifdef CONFIG_OMAP4_ERRATA_I688
58extern int omap_barrier_reserve_memblock(void);
59#else
60static inline void omap_barrier_reserve_memblock(void)
61{ }
62#endif
56#endif /* __ASSEMBLER__ */ 63#endif /* __ASSEMBLER__ */
57#endif /* OMAP_ARCH_OMAP_SECURE_H */ 64#endif /* OMAP_ARCH_OMAP_SECURE_H */
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 4d05fa8a4e4..cd42d921940 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -32,6 +32,7 @@
32#include "iomap.h" 32#include "iomap.h"
33#include "common.h" 33#include "common.h"
34#include "clockdomain.h" 34#include "clockdomain.h"
35#include "pm.h"
35 36
36#define CPU_MASK 0xff0ffff0 37#define CPU_MASK 0xff0ffff0
37#define CPU_CORTEX_A9 0x410FC090 38#define CPU_CORTEX_A9 0x410FC090
@@ -39,6 +40,8 @@
39 40
40#define OMAP5_CORE_COUNT 0x2 41#define OMAP5_CORE_COUNT 0x2
41 42
43u16 pm44xx_errata;
44
42/* SCU base address */ 45/* SCU base address */
43static void __iomem *scu_base; 46static void __iomem *scu_base;
44 47
@@ -118,8 +121,37 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
118 * 4.3.4.2 Power States of CPU0 and CPU1 121 * 4.3.4.2 Power States of CPU0 and CPU1
119 */ 122 */
120 if (booted) { 123 if (booted) {
124 /*
125 * GIC distributor control register has changed between
126 * CortexA9 r1pX and r2pX. The Control Register secure
127 * banked version is now composed of 2 bits:
128 * bit 0 == Secure Enable
129 * bit 1 == Non-Secure Enable
130 * The Non-Secure banked register has not changed
131 * Because the ROM Code is based on the r1pX GIC, the CPU1
132 * GIC restoration will cause a problem to CPU0 Non-Secure SW.
133 * The workaround must be:
134 * 1) Before doing the CPU1 wakeup, CPU0 must disable
135 * the GIC distributor
136 * 2) CPU1 must re-enable the GIC distributor on
137 * it's wakeup path.
138 */
139 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {
140 local_irq_disable();
141 gic_dist_disable();
142 }
143
121 clkdm_wakeup(cpu1_clkdm); 144 clkdm_wakeup(cpu1_clkdm);
122 clkdm_allow_idle(cpu1_clkdm); 145 clkdm_allow_idle(cpu1_clkdm);
146
147 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {
148 while (gic_dist_disabled()) {
149 udelay(1);
150 cpu_relax();
151 }
152 gic_timer_retrigger();
153 local_irq_enable();
154 }
123 } else { 155 } else {
124 dsb_sev(); 156 dsb_sev();
125 booted = true; 157 booted = true;
@@ -138,7 +170,14 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
138 170
139static void __init wakeup_secondary(void) 171static void __init wakeup_secondary(void)
140{ 172{
173 void *startup_addr = omap_secondary_startup;
141 void __iomem *base = omap_get_wakeupgen_base(); 174 void __iomem *base = omap_get_wakeupgen_base();
175
176 if (cpu_is_omap446x()) {
177 startup_addr = omap_secondary_startup_4460;
178 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
179 }
180
142 /* 181 /*
143 * Write the address of secondary startup routine into the 182 * Write the address of secondary startup routine into the
144 * AuxCoreBoot1 where ROM code will jump and start executing 183 * AuxCoreBoot1 where ROM code will jump and start executing
@@ -146,7 +185,7 @@ static void __init wakeup_secondary(void)
146 * A barrier is added to ensure that write buffer is drained 185 * A barrier is added to ensure that write buffer is drained
147 */ 186 */
148 if (omap_secure_apis_support()) 187 if (omap_secure_apis_support())
149 omap_auxcoreboot_addr(virt_to_phys(omap_secondary_startup)); 188 omap_auxcoreboot_addr(virt_to_phys(startup_addr));
150 else 189 else
151 __raw_writel(virt_to_phys(omap5_secondary_startup), 190 __raw_writel(virt_to_phys(omap5_secondary_startup),
152 base + OMAP_AUX_CORE_BOOT_1); 191 base + OMAP_AUX_CORE_BOOT_1);
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
new file mode 100644
index 00000000000..be6bc89ab1e
--- /dev/null
+++ b/arch/arm/mach-omap2/omap2-restart.c
@@ -0,0 +1,65 @@
1/*
2 * omap2-restart.c - code common to all OMAP2xxx machines.
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/clk.h>
14#include <linux/io.h>
15
16#include "common.h"
17#include "prm2xxx.h"
18
19/*
20 * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set
21 * clock and the sys_ck. Used during the reset process
22 */
23static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck;
24
25/* Reboot handling */
26
27/**
28 * omap2xxx_restart - Set DPLL to bypass mode for reboot to work
29 *
30 * Set the DPLL to bypass so that reboot completes successfully. No
31 * return value.
32 */
33void omap2xxx_restart(char mode, const char *cmd)
34{
35 u32 rate;
36
37 rate = clk_get_rate(reset_sys_ck);
38 clk_set_rate(reset_virt_prcm_set_ck, rate);
39
40 /* XXX Should save the cmd argument for use after the reboot */
41
42 omap2xxx_prm_dpll_reset(); /* never returns */
43 while (1);
44}
45
46/**
47 * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart
48 *
49 * Some clocks need to be looked up in advance for the SoC restart
50 * operation to work - see omap2xxx_restart(). Returns -EINVAL upon
51 * error or 0 upon success.
52 */
53static int __init omap2xxx_common_look_up_clks_for_reset(void)
54{
55 reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set");
56 if (IS_ERR(reset_virt_prcm_set_ck))
57 return -EINVAL;
58
59 reset_sys_ck = clk_get(NULL, "sys_ck");
60 if (IS_ERR(reset_sys_ck))
61 return -EINVAL;
62
63 return 0;
64}
65core_initcall(omap2xxx_common_look_up_clks_for_reset);
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
new file mode 100644
index 00000000000..923c582189e
--- /dev/null
+++ b/arch/arm/mach-omap2/omap3-restart.c
@@ -0,0 +1,36 @@
1/*
2 * omap3-restart.c - Code common to all OMAP3xxx machines.
3 *
4 * Copyright (C) 2009, 2012 Texas Instruments
5 * Copyright (C) 2010 Nokia Corporation
6 * Tony Lindgren <tony@atomide.com>
7 * Santosh Shilimkar <santosh.shilimkar@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15
16#include "iomap.h"
17#include "common.h"
18#include "control.h"
19#include "prm3xxx.h"
20
21/* Global address base setup code */
22
23/**
24 * omap3xxx_restart - trigger a software restart of the SoC
25 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
26 * @cmd: passed from the userspace program rebooting the system (if provided)
27 *
28 * Resets the SoC. For @cmd, see the 'reboot' syscall in
29 * kernel/sys.c. No return value.
30 */
31void omap3xxx_restart(char mode, const char *cmd)
32{
33 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
34 omap3xxx_prm_dpll3_reset(); /* never returns */
35 while (1);
36}
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index e1f289748c5..6897ae21bb8 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/irq.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/memblock.h> 19#include <linux/memblock.h>
19#include <linux/of_irq.h> 20#include <linux/of_irq.h>
@@ -24,23 +25,29 @@
24#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/memblock.h> 27#include <asm/memblock.h>
27 28#include <asm/smp_twd.h>
28#include <plat/sram.h>
29#include <plat/omap-secure.h>
30#include <plat/mmc.h>
31 29
32#include "omap-wakeupgen.h" 30#include "omap-wakeupgen.h"
33
34#include "soc.h" 31#include "soc.h"
32#include "iomap.h"
35#include "common.h" 33#include "common.h"
34#include "mmc.h"
36#include "hsmmc.h" 35#include "hsmmc.h"
36#include "prminst44xx.h"
37#include "prcm_mpu44xx.h"
37#include "omap4-sar-layout.h" 38#include "omap4-sar-layout.h"
39#include "omap-secure.h"
40#include "sram.h"
38 41
39#ifdef CONFIG_CACHE_L2X0 42#ifdef CONFIG_CACHE_L2X0
40static void __iomem *l2cache_base; 43static void __iomem *l2cache_base;
41#endif 44#endif
42 45
43static void __iomem *sar_ram_base; 46static void __iomem *sar_ram_base;
47static void __iomem *gic_dist_base_addr;
48static void __iomem *twd_base;
49
50#define IRQ_LOCALTIMER 29
44 51
45#ifdef CONFIG_OMAP4_ERRATA_I688 52#ifdef CONFIG_OMAP4_ERRATA_I688
46/* Used to implement memory barrier on DRAM path */ 53/* Used to implement memory barrier on DRAM path */
@@ -95,12 +102,14 @@ void __init omap_barriers_init(void)
95void __init gic_init_irq(void) 102void __init gic_init_irq(void)
96{ 103{
97 void __iomem *omap_irq_base; 104 void __iomem *omap_irq_base;
98 void __iomem *gic_dist_base_addr;
99 105
100 /* Static mapping, never released */ 106 /* Static mapping, never released */
101 gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); 107 gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
102 BUG_ON(!gic_dist_base_addr); 108 BUG_ON(!gic_dist_base_addr);
103 109
110 twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_4K);
111 BUG_ON(!twd_base);
112
104 /* Static mapping, never released */ 113 /* Static mapping, never released */
105 omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); 114 omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
106 BUG_ON(!omap_irq_base); 115 BUG_ON(!omap_irq_base);
@@ -110,6 +119,38 @@ void __init gic_init_irq(void)
110 gic_init(0, 29, gic_dist_base_addr, omap_irq_base); 119 gic_init(0, 29, gic_dist_base_addr, omap_irq_base);
111} 120}
112 121
122void gic_dist_disable(void)
123{
124 if (gic_dist_base_addr)
125 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL);
126}
127
128bool gic_dist_disabled(void)
129{
130 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1);
131}
132
133void gic_timer_retrigger(void)
134{
135 u32 twd_int = __raw_readl(twd_base + TWD_TIMER_INTSTAT);
136 u32 gic_int = __raw_readl(gic_dist_base_addr + GIC_DIST_PENDING_SET);
137 u32 twd_ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL);
138
139 if (twd_int && !(gic_int & BIT(IRQ_LOCALTIMER))) {
140 /*
141 * The local timer interrupt got lost while the distributor was
142 * disabled. Ack the pending interrupt, and retrigger it.
143 */
144 pr_warn("%s: lost localtimer interrupt\n", __func__);
145 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT);
146 if (!(twd_ctrl & TWD_TIMER_CONTROL_PERIODIC)) {
147 __raw_writel(1, twd_base + TWD_TIMER_COUNTER);
148 twd_ctrl |= TWD_TIMER_CONTROL_ENABLE;
149 __raw_writel(twd_ctrl, twd_base + TWD_TIMER_CONTROL);
150 }
151 }
152}
153
113#ifdef CONFIG_CACHE_L2X0 154#ifdef CONFIG_CACHE_L2X0
114 155
115void __iomem *omap4_get_l2cache_base(void) 156void __iomem *omap4_get_l2cache_base(void)
@@ -281,3 +322,19 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
281 return 0; 322 return 0;
282} 323}
283#endif 324#endif
325
326/**
327 * omap44xx_restart - trigger a software restart of the SoC
328 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
329 * @cmd: passed from the userspace program rebooting the system (if provided)
330 *
331 * Resets the SoC. For @cmd, see the 'reboot' syscall in
332 * kernel/sys.c. No return value.
333 */
334void omap44xx_restart(char mode, const char *cmd)
335{
336 /* XXX Should save 'cmd' into scratchpad for use after reboot */
337 omap4_prminst_global_warm_sw_reset(); /* never returns */
338 while (1);
339}
340
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 7a7d1f2a65e..e065daa537c 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -89,9 +89,8 @@
89#include <linux/of.h> 89#include <linux/of.h>
90#include <linux/notifier.h> 90#include <linux/notifier.h>
91 91
92#include <plat/omap_device.h> 92#include "omap_device.h"
93#include <plat/omap_hwmod.h> 93#include "omap_hwmod.h"
94#include <plat/clock.h>
95 94
96/* These parameters are passed to _omap_device_{de,}activate() */ 95/* These parameters are passed to _omap_device_{de,}activate() */
97#define USE_WAKEUP_LAT 0 96#define USE_WAKEUP_LAT 0
@@ -442,19 +441,21 @@ int omap_device_get_context_loss_count(struct platform_device *pdev)
442/** 441/**
443 * omap_device_count_resources - count number of struct resource entries needed 442 * omap_device_count_resources - count number of struct resource entries needed
444 * @od: struct omap_device * 443 * @od: struct omap_device *
444 * @flags: Type of resources to include when counting (IRQ/DMA/MEM)
445 * 445 *
446 * Count the number of struct resource entries needed for this 446 * Count the number of struct resource entries needed for this
447 * omap_device @od. Used by omap_device_build_ss() to determine how 447 * omap_device @od. Used by omap_device_build_ss() to determine how
448 * much memory to allocate before calling 448 * much memory to allocate before calling
449 * omap_device_fill_resources(). Returns the count. 449 * omap_device_fill_resources(). Returns the count.
450 */ 450 */
451static int omap_device_count_resources(struct omap_device *od) 451static int omap_device_count_resources(struct omap_device *od,
452 unsigned long flags)
452{ 453{
453 int c = 0; 454 int c = 0;
454 int i; 455 int i;
455 456
456 for (i = 0; i < od->hwmods_cnt; i++) 457 for (i = 0; i < od->hwmods_cnt; i++)
457 c += omap_hwmod_count_resources(od->hwmods[i]); 458 c += omap_hwmod_count_resources(od->hwmods[i], flags);
458 459
459 pr_debug("omap_device: %s: counted %d total resources across %d hwmods\n", 460 pr_debug("omap_device: %s: counted %d total resources across %d hwmods\n",
460 od->pdev->name, c, od->hwmods_cnt); 461 od->pdev->name, c, od->hwmods_cnt);
@@ -558,52 +559,73 @@ struct omap_device *omap_device_alloc(struct platform_device *pdev,
558 od->hwmods = hwmods; 559 od->hwmods = hwmods;
559 od->pdev = pdev; 560 od->pdev = pdev;
560 561
561 res_count = omap_device_count_resources(od);
562 /* 562 /*
563 * Non-DT Boot:
564 * Here, pdev->num_resources = 0, and we should get all the
565 * resources from hwmod.
566 *
563 * DT Boot: 567 * DT Boot:
564 * OF framework will construct the resource structure (currently 568 * OF framework will construct the resource structure (currently
565 * does for MEM & IRQ resource) and we should respect/use these 569 * does for MEM & IRQ resource) and we should respect/use these
566 * resources, killing hwmod dependency. 570 * resources, killing hwmod dependency.
567 * If pdev->num_resources > 0, we assume that MEM & IRQ resources 571 * If pdev->num_resources > 0, we assume that MEM & IRQ resources
568 * have been allocated by OF layer already (through DTB). 572 * have been allocated by OF layer already (through DTB).
569 * 573 * As preparation for the future we examine the OF provided resources
570 * Non-DT Boot: 574 * to see if we have DMA resources provided already. In this case
571 * Here, pdev->num_resources = 0, and we should get all the 575 * there is no need to update the resources for the device, we use the
572 * resources from hwmod. 576 * OF provided ones.
573 * 577 *
574 * TODO: Once DMA resource is available from OF layer, we should 578 * TODO: Once DMA resource is available from OF layer, we should
575 * kill filling any resources from hwmod. 579 * kill filling any resources from hwmod.
576 */ 580 */
577 if (res_count > pdev->num_resources) { 581 if (!pdev->num_resources) {
578 /* Allocate resources memory to account for new resources */ 582 /* Count all resources for the device */
579 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL); 583 res_count = omap_device_count_resources(od, IORESOURCE_IRQ |
580 if (!res) 584 IORESOURCE_DMA |
581 goto oda_exit3; 585 IORESOURCE_MEM);
582 586 } else {
583 /* 587 /* Take a look if we already have DMA resource via DT */
584 * If pdev->num_resources > 0, then assume that, 588 for (i = 0; i < pdev->num_resources; i++) {
585 * MEM and IRQ resources will only come from DT and only 589 struct resource *r = &pdev->resource[i];
586 * fill DMA resource from hwmod layer. 590
587 */ 591 /* We have it, no need to touch the resources */
588 if (pdev->num_resources && pdev->resource) { 592 if (r->flags == IORESOURCE_DMA)
589 dev_dbg(&pdev->dev, "%s(): resources already allocated %d\n", 593 goto have_everything;
590 __func__, res_count);
591 memcpy(res, pdev->resource,
592 sizeof(struct resource) * pdev->num_resources);
593 _od_fill_dma_resources(od, &res[pdev->num_resources]);
594 } else {
595 dev_dbg(&pdev->dev, "%s(): using resources from hwmod %d\n",
596 __func__, res_count);
597 omap_device_fill_resources(od, res);
598 } 594 }
595 /* Count only DMA resources for the device */
596 res_count = omap_device_count_resources(od, IORESOURCE_DMA);
597 /* The device has no DMA resource, no need for update */
598 if (!res_count)
599 goto have_everything;
599 600
600 ret = platform_device_add_resources(pdev, res, res_count); 601 res_count += pdev->num_resources;
601 kfree(res); 602 }
602 603
603 if (ret) 604 /* Allocate resources memory to account for new resources */
604 goto oda_exit3; 605 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
606 if (!res)
607 goto oda_exit3;
608
609 if (!pdev->num_resources) {
610 dev_dbg(&pdev->dev, "%s: using %d resources from hwmod\n",
611 __func__, res_count);
612 omap_device_fill_resources(od, res);
613 } else {
614 dev_dbg(&pdev->dev,
615 "%s: appending %d DMA resources from hwmod\n",
616 __func__, res_count - pdev->num_resources);
617 memcpy(res, pdev->resource,
618 sizeof(struct resource) * pdev->num_resources);
619 _od_fill_dma_resources(od, &res[pdev->num_resources]);
605 } 620 }
606 621
622 ret = platform_device_add_resources(pdev, res, res_count);
623 kfree(res);
624
625 if (ret)
626 goto oda_exit3;
627
628have_everything:
607 if (!pm_lats) { 629 if (!pm_lats) {
608 pm_lats = omap_default_latency; 630 pm_lats = omap_default_latency;
609 pm_lats_cnt = ARRAY_SIZE(omap_default_latency); 631 pm_lats_cnt = ARRAY_SIZE(omap_default_latency);
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/mach-omap2/omap_device.h
index 106f5066580..0933c599bf8 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/mach-omap2/omap_device.h
@@ -34,7 +34,7 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36 36
37#include <plat/omap_hwmod.h> 37#include "omap_hwmod.h"
38 38
39extern struct dev_pm_domain omap_device_pm_domain; 39extern struct dev_pm_domain omap_device_pm_domain;
40 40
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 87cc6d058de..4653efb87a2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -130,7 +130,7 @@
130#include <linux/kernel.h> 130#include <linux/kernel.h>
131#include <linux/errno.h> 131#include <linux/errno.h>
132#include <linux/io.h> 132#include <linux/io.h>
133#include <linux/clk.h> 133#include <linux/clk-provider.h>
134#include <linux/delay.h> 134#include <linux/delay.h>
135#include <linux/err.h> 135#include <linux/err.h>
136#include <linux/list.h> 136#include <linux/list.h>
@@ -139,27 +139,25 @@
139#include <linux/slab.h> 139#include <linux/slab.h>
140#include <linux/bootmem.h> 140#include <linux/bootmem.h>
141 141
142#include <plat/clock.h> 142#include "clock.h"
143#include <plat/omap_hwmod.h> 143#include "omap_hwmod.h"
144#include <plat/prcm.h>
145 144
146#include "soc.h" 145#include "soc.h"
147#include "common.h" 146#include "common.h"
148#include "clockdomain.h" 147#include "clockdomain.h"
149#include "powerdomain.h" 148#include "powerdomain.h"
150#include "cm2xxx_3xxx.h" 149#include "cm2xxx.h"
150#include "cm3xxx.h"
151#include "cminst44xx.h" 151#include "cminst44xx.h"
152#include "cm33xx.h" 152#include "cm33xx.h"
153#include "prm2xxx_3xxx.h" 153#include "prm.h"
154#include "prm3xxx.h"
154#include "prm44xx.h" 155#include "prm44xx.h"
155#include "prm33xx.h" 156#include "prm33xx.h"
156#include "prminst44xx.h" 157#include "prminst44xx.h"
157#include "mux.h" 158#include "mux.h"
158#include "pm.h" 159#include "pm.h"
159 160
160/* Maximum microseconds to wait for OMAP module to softreset */
161#define MAX_MODULE_SOFTRESET_WAIT 10000
162
163/* Name of the OMAP hwmod for the MPU */ 161/* Name of the OMAP hwmod for the MPU */
164#define MPU_INITIATOR_NAME "mpu" 162#define MPU_INITIATOR_NAME "mpu"
165 163
@@ -189,6 +187,8 @@ struct omap_hwmod_soc_ops {
189 int (*is_hardreset_asserted)(struct omap_hwmod *oh, 187 int (*is_hardreset_asserted)(struct omap_hwmod *oh,
190 struct omap_hwmod_rst_info *ohri); 188 struct omap_hwmod_rst_info *ohri);
191 int (*init_clkdm)(struct omap_hwmod *oh); 189 int (*init_clkdm)(struct omap_hwmod *oh);
190 void (*update_context_lost)(struct omap_hwmod *oh);
191 int (*get_context_lost)(struct omap_hwmod *oh);
192}; 192};
193 193
194/* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */ 194/* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */
@@ -648,6 +648,19 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
648 return 0; 648 return 0;
649} 649}
650 650
651static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
652{
653 struct clk_hw_omap *clk;
654
655 if (oh->clkdm) {
656 return oh->clkdm;
657 } else if (oh->_clk) {
658 clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
659 return clk->clkdm;
660 }
661 return NULL;
662}
663
651/** 664/**
652 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active 665 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active
653 * @oh: struct omap_hwmod * 666 * @oh: struct omap_hwmod *
@@ -663,13 +676,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
663 */ 676 */
664static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 677static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
665{ 678{
666 if (!oh->_clk) 679 struct clockdomain *clkdm, *init_clkdm;
680
681 clkdm = _get_clkdm(oh);
682 init_clkdm = _get_clkdm(init_oh);
683
684 if (!clkdm || !init_clkdm)
667 return -EINVAL; 685 return -EINVAL;
668 686
669 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) 687 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
670 return 0; 688 return 0;
671 689
672 return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 690 return clkdm_add_sleepdep(clkdm, init_clkdm);
673} 691}
674 692
675/** 693/**
@@ -687,13 +705,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
687 */ 705 */
688static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 706static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
689{ 707{
690 if (!oh->_clk) 708 struct clockdomain *clkdm, *init_clkdm;
709
710 clkdm = _get_clkdm(oh);
711 init_clkdm = _get_clkdm(init_oh);
712
713 if (!clkdm || !init_clkdm)
691 return -EINVAL; 714 return -EINVAL;
692 715
693 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) 716 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
694 return 0; 717 return 0;
695 718
696 return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 719 return clkdm_del_sleepdep(clkdm, init_clkdm);
697} 720}
698 721
699/** 722/**
@@ -727,7 +750,7 @@ static int _init_main_clk(struct omap_hwmod *oh)
727 */ 750 */
728 clk_prepare(oh->_clk); 751 clk_prepare(oh->_clk);
729 752
730 if (!oh->_clk->clkdm) 753 if (!_get_clkdm(oh))
731 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", 754 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n",
732 oh->name, oh->main_clk); 755 oh->name, oh->main_clk);
733 756
@@ -1310,6 +1333,7 @@ static void _enable_sysc(struct omap_hwmod *oh)
1310 u8 idlemode, sf; 1333 u8 idlemode, sf;
1311 u32 v; 1334 u32 v;
1312 bool clkdm_act; 1335 bool clkdm_act;
1336 struct clockdomain *clkdm;
1313 1337
1314 if (!oh->class->sysc) 1338 if (!oh->class->sysc)
1315 return; 1339 return;
@@ -1329,11 +1353,9 @@ static void _enable_sysc(struct omap_hwmod *oh)
1329 v = oh->_sysc_cache; 1353 v = oh->_sysc_cache;
1330 sf = oh->class->sysc->sysc_flags; 1354 sf = oh->class->sysc->sysc_flags;
1331 1355
1356 clkdm = _get_clkdm(oh);
1332 if (sf & SYSC_HAS_SIDLEMODE) { 1357 if (sf & SYSC_HAS_SIDLEMODE) {
1333 clkdm_act = ((oh->clkdm && 1358 clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU);
1334 oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) ||
1335 (oh->_clk && oh->_clk->clkdm &&
1336 oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU));
1337 if (clkdm_act && !(oh->class->sysc->idlemodes & 1359 if (clkdm_act && !(oh->class->sysc->idlemodes &
1338 (SIDLE_SMART | SIDLE_SMART_WKUP))) 1360 (SIDLE_SMART | SIDLE_SMART_WKUP)))
1339 idlemode = HWMOD_IDLEMODE_FORCE; 1361 idlemode = HWMOD_IDLEMODE_FORCE;
@@ -1535,11 +1557,12 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1535 1557
1536 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name); 1558 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name);
1537 1559
1560 if (soc_ops.init_clkdm)
1561 ret |= soc_ops.init_clkdm(oh);
1562
1538 ret |= _init_main_clk(oh); 1563 ret |= _init_main_clk(oh);
1539 ret |= _init_interface_clks(oh); 1564 ret |= _init_interface_clks(oh);
1540 ret |= _init_opt_clks(oh); 1565 ret |= _init_opt_clks(oh);
1541 if (soc_ops.init_clkdm)
1542 ret |= soc_ops.init_clkdm(oh);
1543 1566
1544 if (!ret) 1567 if (!ret)
1545 oh->_state = _HWMOD_STATE_CLKS_INITED; 1568 oh->_state = _HWMOD_STATE_CLKS_INITED;
@@ -1994,6 +2017,42 @@ static void _reconfigure_io_chain(void)
1994} 2017}
1995 2018
1996/** 2019/**
2020 * _omap4_update_context_lost - increment hwmod context loss counter if
2021 * hwmod context was lost, and clear hardware context loss reg
2022 * @oh: hwmod to check for context loss
2023 *
2024 * If the PRCM indicates that the hwmod @oh lost context, increment
2025 * our in-memory context loss counter, and clear the RM_*_CONTEXT
2026 * bits. No return value.
2027 */
2028static void _omap4_update_context_lost(struct omap_hwmod *oh)
2029{
2030 if (oh->prcm.omap4.flags & HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT)
2031 return;
2032
2033 if (!prm_was_any_context_lost_old(oh->clkdm->pwrdm.ptr->prcm_partition,
2034 oh->clkdm->pwrdm.ptr->prcm_offs,
2035 oh->prcm.omap4.context_offs))
2036 return;
2037
2038 oh->prcm.omap4.context_lost_counter++;
2039 prm_clear_context_loss_flags_old(oh->clkdm->pwrdm.ptr->prcm_partition,
2040 oh->clkdm->pwrdm.ptr->prcm_offs,
2041 oh->prcm.omap4.context_offs);
2042}
2043
2044/**
2045 * _omap4_get_context_lost - get context loss counter for a hwmod
2046 * @oh: hwmod to get context loss counter for
2047 *
2048 * Returns the in-memory context loss counter for a hwmod.
2049 */
2050static int _omap4_get_context_lost(struct omap_hwmod *oh)
2051{
2052 return oh->prcm.omap4.context_lost_counter;
2053}
2054
2055/**
1997 * _enable - enable an omap_hwmod 2056 * _enable - enable an omap_hwmod
1998 * @oh: struct omap_hwmod * 2057 * @oh: struct omap_hwmod *
1999 * 2058 *
@@ -2076,6 +2135,9 @@ static int _enable(struct omap_hwmod *oh)
2076 if (soc_ops.enable_module) 2135 if (soc_ops.enable_module)
2077 soc_ops.enable_module(oh); 2136 soc_ops.enable_module(oh);
2078 2137
2138 if (soc_ops.update_context_lost)
2139 soc_ops.update_context_lost(oh);
2140
2079 r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) : 2141 r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) :
2080 -EINVAL; 2142 -EINVAL;
2081 if (!r) { 2143 if (!r) {
@@ -2095,7 +2157,8 @@ static int _enable(struct omap_hwmod *oh)
2095 _enable_sysc(oh); 2157 _enable_sysc(oh);
2096 } 2158 }
2097 } else { 2159 } else {
2098 _omap4_disable_module(oh); 2160 if (soc_ops.disable_module)
2161 soc_ops.disable_module(oh);
2099 _disable_clocks(oh); 2162 _disable_clocks(oh);
2100 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", 2163 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
2101 oh->name, r); 2164 oh->name, r);
@@ -2703,7 +2766,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2703/* Static functions intended only for use in soc_ops field function pointers */ 2766/* Static functions intended only for use in soc_ops field function pointers */
2704 2767
2705/** 2768/**
2706 * _omap2_wait_target_ready - wait for a module to leave slave idle 2769 * _omap2xxx_wait_target_ready - wait for a module to leave slave idle
2707 * @oh: struct omap_hwmod * 2770 * @oh: struct omap_hwmod *
2708 * 2771 *
2709 * Wait for a module @oh to leave slave idle. Returns 0 if the module 2772 * Wait for a module @oh to leave slave idle. Returns 0 if the module
@@ -2711,7 +2774,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2711 * slave idle; otherwise, pass along the return value of the 2774 * slave idle; otherwise, pass along the return value of the
2712 * appropriate *_cm*_wait_module_ready() function. 2775 * appropriate *_cm*_wait_module_ready() function.
2713 */ 2776 */
2714static int _omap2_wait_target_ready(struct omap_hwmod *oh) 2777static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
2715{ 2778{
2716 if (!oh) 2779 if (!oh)
2717 return -EINVAL; 2780 return -EINVAL;
@@ -2724,9 +2787,36 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh)
2724 2787
2725 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ 2788 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2726 2789
2727 return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs, 2790 return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2728 oh->prcm.omap2.idlest_reg_id, 2791 oh->prcm.omap2.idlest_reg_id,
2729 oh->prcm.omap2.idlest_idle_bit); 2792 oh->prcm.omap2.idlest_idle_bit);
2793}
2794
2795/**
2796 * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
2797 * @oh: struct omap_hwmod *
2798 *
2799 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2800 * does not have an IDLEST bit or if the module successfully leaves
2801 * slave idle; otherwise, pass along the return value of the
2802 * appropriate *_cm*_wait_module_ready() function.
2803 */
2804static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
2805{
2806 if (!oh)
2807 return -EINVAL;
2808
2809 if (oh->flags & HWMOD_NO_IDLEST)
2810 return 0;
2811
2812 if (!_find_mpu_rt_port(oh))
2813 return 0;
2814
2815 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2816
2817 return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2818 oh->prcm.omap2.idlest_reg_id,
2819 oh->prcm.omap2.idlest_idle_bit);
2730} 2820}
2731 2821
2732/** 2822/**
@@ -3372,7 +3462,7 @@ int omap_hwmod_reset(struct omap_hwmod *oh)
3372/** 3462/**
3373 * omap_hwmod_count_resources - count number of struct resources needed by hwmod 3463 * omap_hwmod_count_resources - count number of struct resources needed by hwmod
3374 * @oh: struct omap_hwmod * 3464 * @oh: struct omap_hwmod *
3375 * @res: pointer to the first element of an array of struct resource to fill 3465 * @flags: Type of resources to include when counting (IRQ/DMA/MEM)
3376 * 3466 *
3377 * Count the number of struct resource array elements necessary to 3467 * Count the number of struct resource array elements necessary to
3378 * contain omap_hwmod @oh resources. Intended to be called by code 3468 * contain omap_hwmod @oh resources. Intended to be called by code
@@ -3385,20 +3475,25 @@ int omap_hwmod_reset(struct omap_hwmod *oh)
3385 * resource IDs. 3475 * resource IDs.
3386 * 3476 *
3387 */ 3477 */
3388int omap_hwmod_count_resources(struct omap_hwmod *oh) 3478int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags)
3389{ 3479{
3390 struct omap_hwmod_ocp_if *os; 3480 int ret = 0;
3391 struct list_head *p;
3392 int ret;
3393 int i = 0;
3394 3481
3395 ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); 3482 if (flags & IORESOURCE_IRQ)
3483 ret += _count_mpu_irqs(oh);
3396 3484
3397 p = oh->slave_ports.next; 3485 if (flags & IORESOURCE_DMA)
3486 ret += _count_sdma_reqs(oh);
3398 3487
3399 while (i < oh->slaves_cnt) { 3488 if (flags & IORESOURCE_MEM) {
3400 os = _fetch_next_ocp_if(&p, &i); 3489 int i = 0;
3401 ret += _count_ocp_if_addr_spaces(os); 3490 struct omap_hwmod_ocp_if *os;
3491 struct list_head *p = oh->slave_ports.next;
3492
3493 while (i < oh->slaves_cnt) {
3494 os = _fetch_next_ocp_if(&p, &i);
3495 ret += _count_ocp_if_addr_spaces(os);
3496 }
3402 } 3497 }
3403 3498
3404 return ret; 3499 return ret;
@@ -3565,10 +3660,15 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
3565{ 3660{
3566 struct clk *c; 3661 struct clk *c;
3567 struct omap_hwmod_ocp_if *oi; 3662 struct omap_hwmod_ocp_if *oi;
3663 struct clockdomain *clkdm;
3664 struct clk_hw_omap *clk;
3568 3665
3569 if (!oh) 3666 if (!oh)
3570 return NULL; 3667 return NULL;
3571 3668
3669 if (oh->clkdm)
3670 return oh->clkdm->pwrdm.ptr;
3671
3572 if (oh->_clk) { 3672 if (oh->_clk) {
3573 c = oh->_clk; 3673 c = oh->_clk;
3574 } else { 3674 } else {
@@ -3578,11 +3678,12 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
3578 c = oi->_clk; 3678 c = oi->_clk;
3579 } 3679 }
3580 3680
3581 if (!c->clkdm) 3681 clk = to_clk_hw_omap(__clk_get_hw(c));
3682 clkdm = clk->clkdm;
3683 if (!clkdm)
3582 return NULL; 3684 return NULL;
3583 3685
3584 return c->clkdm->pwrdm.ptr; 3686 return clkdm->pwrdm.ptr;
3585
3586} 3687}
3587 3688
3588/** 3689/**
@@ -3887,17 +3988,21 @@ ohsps_unlock:
3887 * omap_hwmod_get_context_loss_count - get lost context count 3988 * omap_hwmod_get_context_loss_count - get lost context count
3888 * @oh: struct omap_hwmod * 3989 * @oh: struct omap_hwmod *
3889 * 3990 *
3890 * Query the powerdomain of of @oh to get the context loss 3991 * Returns the context loss count of associated @oh
3891 * count for this device. 3992 * upon success, or zero if no context loss data is available.
3892 * 3993 *
3893 * Returns the context loss count of the powerdomain assocated with @oh 3994 * On OMAP4, this queries the per-hwmod context loss register,
3894 * upon success, or zero if no powerdomain exists for @oh. 3995 * assuming one exists. If not, or on OMAP2/3, this queries the
3996 * enclosing powerdomain context loss count.
3895 */ 3997 */
3896int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) 3998int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh)
3897{ 3999{
3898 struct powerdomain *pwrdm; 4000 struct powerdomain *pwrdm;
3899 int ret = 0; 4001 int ret = 0;
3900 4002
4003 if (soc_ops.get_context_lost)
4004 return soc_ops.get_context_lost(oh);
4005
3901 pwrdm = omap_hwmod_get_pwrdm(oh); 4006 pwrdm = omap_hwmod_get_pwrdm(oh);
3902 if (pwrdm) 4007 if (pwrdm)
3903 ret = pwrdm_get_context_loss_count(pwrdm); 4008 ret = pwrdm_get_context_loss_count(pwrdm);
@@ -3994,8 +4099,13 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
3994 */ 4099 */
3995void __init omap_hwmod_init(void) 4100void __init omap_hwmod_init(void)
3996{ 4101{
3997 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 4102 if (cpu_is_omap24xx()) {
3998 soc_ops.wait_target_ready = _omap2_wait_target_ready; 4103 soc_ops.wait_target_ready = _omap2xxx_wait_target_ready;
4104 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4105 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4106 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
4107 } else if (cpu_is_omap34xx()) {
4108 soc_ops.wait_target_ready = _omap3xxx_wait_target_ready;
3999 soc_ops.assert_hardreset = _omap2_assert_hardreset; 4109 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4000 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 4110 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4001 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 4111 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
@@ -4007,6 +4117,8 @@ void __init omap_hwmod_init(void)
4007 soc_ops.deassert_hardreset = _omap4_deassert_hardreset; 4117 soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
4008 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; 4118 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
4009 soc_ops.init_clkdm = _init_clkdm; 4119 soc_ops.init_clkdm = _init_clkdm;
4120 soc_ops.update_context_lost = _omap4_update_context_lost;
4121 soc_ops.get_context_lost = _omap4_get_context_lost;
4010 } else if (soc_is_am33xx()) { 4122 } else if (soc_is_am33xx()) {
4011 soc_ops.enable_module = _am33xx_enable_module; 4123 soc_ops.enable_module = _am33xx_enable_module;
4012 soc_ops.disable_module = _am33xx_disable_module; 4124 soc_ops.disable_module = _am33xx_disable_module;
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 1db02943802..3ae852a522f 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -2,7 +2,7 @@
2 * omap_hwmod macros, structures 2 * omap_hwmod macros, structures
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc. 5 * Copyright (C) 2011-2012 Texas Instruments, Inc.
6 * Paul Walmsley 6 * Paul Walmsley
7 * 7 *
8 * Created in collaboration with (alphabetical order): Benoît Cousson, 8 * Created in collaboration with (alphabetical order): Benoît Cousson,
@@ -35,7 +35,6 @@
35#include <linux/list.h> 35#include <linux/list.h>
36#include <linux/ioport.h> 36#include <linux/ioport.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <plat/cpu.h>
39 38
40struct omap_device; 39struct omap_device;
41 40
@@ -395,12 +394,15 @@ struct omap_hwmod_omap2_prcm {
395 394
396/** 395/**
397 * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data 396 * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data
398 * @clkctrl_reg: PRCM address of the clock control register 397 * @clkctrl_offs: offset of the PRCM clock control register
399 * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM 398 * @rstctrl_offs: offset of the XXX_RSTCTRL register located in the PRM
399 * @context_offs: offset of the RM_*_CONTEXT register
400 * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register 400 * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register
401 * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM 401 * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM
402 * @submodule_wkdep_bit: bit shift of the WKDEP range 402 * @submodule_wkdep_bit: bit shift of the WKDEP range
403 * @flags: PRCM register capabilities for this IP block 403 * @flags: PRCM register capabilities for this IP block
404 * @modulemode: allowable modulemodes
405 * @context_lost_counter: Count of module level context lost
404 * 406 *
405 * If @lostcontext_mask is not defined, context loss check code uses 407 * If @lostcontext_mask is not defined, context loss check code uses
406 * whole register without masking. @lostcontext_mask should only be 408 * whole register without masking. @lostcontext_mask should only be
@@ -416,6 +418,7 @@ struct omap_hwmod_omap4_prcm {
416 u8 submodule_wkdep_bit; 418 u8 submodule_wkdep_bit;
417 u8 modulemode; 419 u8 modulemode;
418 u8 flags; 420 u8 flags;
421 int context_lost_counter;
419}; 422};
420 423
421 424
@@ -634,7 +637,7 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs);
634u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs); 637u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs);
635int omap_hwmod_softreset(struct omap_hwmod *oh); 638int omap_hwmod_softreset(struct omap_hwmod *oh);
636 639
637int omap_hwmod_count_resources(struct omap_hwmod *oh); 640int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags);
638int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res); 641int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res);
639int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res); 642int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res);
640int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type, 643int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index b5db6007c52..b5efe58c0be 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -12,21 +12,23 @@
12 * XXX handle crossbar/shared link difference for L3? 12 * XXX handle crossbar/shared link difference for L3?
13 * XXX these should be marked initdata for multi-OMAP kernels 13 * XXX these should be marked initdata for multi-OMAP kernels
14 */ 14 */
15#include <linux/platform_data/spi-omap2-mcspi.h>
16 15
17#include <plat/omap_hwmod.h> 16#include <linux/i2c-omap.h>
18#include <plat/dma.h> 17#include <linux/platform_data/spi-omap2-mcspi.h>
19#include <plat/serial.h> 18#include <linux/omap-dma.h>
20#include <plat/i2c.h>
21#include <plat/dmtimer.h> 19#include <plat/dmtimer.h>
20
21#include "omap_hwmod.h"
22#include "l3_2xxx.h" 22#include "l3_2xxx.h"
23#include "l4_2xxx.h" 23#include "l4_2xxx.h"
24#include <plat/mmc.h>
25 24
26#include "omap_hwmod_common_data.h" 25#include "omap_hwmod_common_data.h"
27 26
28#include "cm-regbits-24xx.h" 27#include "cm-regbits-24xx.h"
29#include "prm-regbits-24xx.h" 28#include "prm-regbits-24xx.h"
29#include "i2c.h"
30#include "mmc.h"
31#include "serial.h"
30#include "wd_timer.h" 32#include "wd_timer.h"
31 33
32/* 34/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index c455e41b023..6c8fa70ddad 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -12,21 +12,22 @@
12 * XXX handle crossbar/shared link difference for L3? 12 * XXX handle crossbar/shared link difference for L3?
13 * XXX these should be marked initdata for multi-OMAP kernels 13 * XXX these should be marked initdata for multi-OMAP kernels
14 */ 14 */
15
16#include <linux/i2c-omap.h>
15#include <linux/platform_data/asoc-ti-mcbsp.h> 17#include <linux/platform_data/asoc-ti-mcbsp.h>
16#include <linux/platform_data/spi-omap2-mcspi.h> 18#include <linux/platform_data/spi-omap2-mcspi.h>
17 19#include <linux/omap-dma.h>
18#include <plat/omap_hwmod.h>
19#include <plat/dma.h>
20#include <plat/serial.h>
21#include <plat/i2c.h>
22#include <plat/dmtimer.h> 20#include <plat/dmtimer.h>
23#include <plat/mmc.h> 21
22#include "omap_hwmod.h"
23#include "mmc.h"
24#include "l3_2xxx.h" 24#include "l3_2xxx.h"
25 25
26#include "soc.h" 26#include "soc.h"
27#include "omap_hwmod_common_data.h" 27#include "omap_hwmod_common_data.h"
28#include "prm-regbits-24xx.h" 28#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
30#include "i2c.h"
30#include "wd_timer.h" 31#include "wd_timer.h"
31 32
32/* 33/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
index cbb4ef6544a..0413daba2db 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
@@ -13,8 +13,7 @@
13 */ 13 */
14#include <asm/sizes.h> 14#include <asm/sizes.h>
15 15
16#include <plat/omap_hwmod.h> 16#include "omap_hwmod.h"
17#include <plat/serial.h>
18 17
19#include "omap_hwmod_common_data.h" 18#include "omap_hwmod_common_data.h"
20 19
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
index 8851bbb6bb2..534974e08ad 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
@@ -9,13 +9,15 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#include <plat/omap_hwmod.h> 12
13#include <plat/serial.h> 13#include <linux/dmaengine.h>
14#include <plat/dma.h> 14#include <linux/omap-dma.h>
15#include <plat/common.h> 15
16#include "omap_hwmod.h"
16#include "hdq1w.h" 17#include "hdq1w.h"
17 18
18#include "omap_hwmod_common_data.h" 19#include "omap_hwmod_common_data.h"
20#include "dma.h"
19 21
20/* UART */ 22/* UART */
21 23
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 1a1287d6264..47901a5e76d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -13,10 +13,10 @@
13 */ 13 */
14#include <asm/sizes.h> 14#include <asm/sizes.h>
15 15
16#include <plat/omap_hwmod.h> 16#include "omap_hwmod.h"
17#include <plat/serial.h>
18#include "l3_2xxx.h" 17#include "l3_2xxx.h"
19#include "l4_2xxx.h" 18#include "l4_2xxx.h"
19#include "serial.h"
20 20
21#include "omap_hwmod_common_data.h" 21#include "omap_hwmod_common_data.h"
22 22
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 bd9220ed5ab..e596117004d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -8,13 +8,13 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11#include <plat/omap_hwmod.h> 11
12#include <plat/serial.h>
13#include <linux/platform_data/gpio-omap.h> 12#include <linux/platform_data/gpio-omap.h>
14#include <plat/dma.h> 13#include <linux/omap-dma.h>
15#include <plat/dmtimer.h> 14#include <plat/dmtimer.h>
16#include <linux/platform_data/spi-omap2-mcspi.h> 15#include <linux/platform_data/spi-omap2-mcspi.h>
17 16
17#include "omap_hwmod.h"
18#include "omap_hwmod_common_data.h" 18#include "omap_hwmod_common_data.h"
19#include "cm-regbits-24xx.h" 19#include "cm-regbits-24xx.h"
20#include "prm-regbits-24xx.h" 20#include "prm-regbits-24xx.h"
@@ -58,8 +58,9 @@ static struct omap_hwmod_class_sysconfig omap2xxx_timer_sysc = {
58 .syss_offs = 0x0014, 58 .syss_offs = 0x0014,
59 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY | 59 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
60 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | 60 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
61 SYSC_HAS_AUTOIDLE), 61 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
62 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 62 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
63 .clockact = CLOCKACT_TEST_ICLK,
63 .sysc_fields = &omap_hwmod_sysc_type1, 64 .sysc_fields = &omap_hwmod_sysc_type1,
64}; 65};
65 66
@@ -268,6 +269,7 @@ struct omap_hwmod omap2xxx_timer1_hwmod = {
268 }, 269 },
269 .dev_attr = &capability_alwon_dev_attr, 270 .dev_attr = &capability_alwon_dev_attr,
270 .class = &omap2xxx_timer_hwmod_class, 271 .class = &omap2xxx_timer_hwmod_class,
272 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
271}; 273};
272 274
273/* timer2 */ 275/* timer2 */
@@ -286,6 +288,7 @@ struct omap_hwmod omap2xxx_timer2_hwmod = {
286 }, 288 },
287 }, 289 },
288 .class = &omap2xxx_timer_hwmod_class, 290 .class = &omap2xxx_timer_hwmod_class,
291 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
289}; 292};
290 293
291/* timer3 */ 294/* timer3 */
@@ -304,6 +307,7 @@ struct omap_hwmod omap2xxx_timer3_hwmod = {
304 }, 307 },
305 }, 308 },
306 .class = &omap2xxx_timer_hwmod_class, 309 .class = &omap2xxx_timer_hwmod_class,
310 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
307}; 311};
308 312
309/* timer4 */ 313/* timer4 */
@@ -322,6 +326,7 @@ struct omap_hwmod omap2xxx_timer4_hwmod = {
322 }, 326 },
323 }, 327 },
324 .class = &omap2xxx_timer_hwmod_class, 328 .class = &omap2xxx_timer_hwmod_class,
329 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
325}; 330};
326 331
327/* timer5 */ 332/* timer5 */
@@ -341,6 +346,7 @@ struct omap_hwmod omap2xxx_timer5_hwmod = {
341 }, 346 },
342 .dev_attr = &capability_dsp_dev_attr, 347 .dev_attr = &capability_dsp_dev_attr,
343 .class = &omap2xxx_timer_hwmod_class, 348 .class = &omap2xxx_timer_hwmod_class,
349 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
344}; 350};
345 351
346/* timer6 */ 352/* timer6 */
@@ -360,6 +366,7 @@ struct omap_hwmod omap2xxx_timer6_hwmod = {
360 }, 366 },
361 .dev_attr = &capability_dsp_dev_attr, 367 .dev_attr = &capability_dsp_dev_attr,
362 .class = &omap2xxx_timer_hwmod_class, 368 .class = &omap2xxx_timer_hwmod_class,
369 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
363}; 370};
364 371
365/* timer7 */ 372/* timer7 */
@@ -379,6 +386,7 @@ struct omap_hwmod omap2xxx_timer7_hwmod = {
379 }, 386 },
380 .dev_attr = &capability_dsp_dev_attr, 387 .dev_attr = &capability_dsp_dev_attr,
381 .class = &omap2xxx_timer_hwmod_class, 388 .class = &omap2xxx_timer_hwmod_class,
389 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
382}; 390};
383 391
384/* timer8 */ 392/* timer8 */
@@ -398,6 +406,7 @@ struct omap_hwmod omap2xxx_timer8_hwmod = {
398 }, 406 },
399 .dev_attr = &capability_dsp_dev_attr, 407 .dev_attr = &capability_dsp_dev_attr,
400 .class = &omap2xxx_timer_hwmod_class, 408 .class = &omap2xxx_timer_hwmod_class,
409 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
401}; 410};
402 411
403/* timer9 */ 412/* timer9 */
@@ -417,6 +426,7 @@ struct omap_hwmod omap2xxx_timer9_hwmod = {
417 }, 426 },
418 .dev_attr = &capability_pwm_dev_attr, 427 .dev_attr = &capability_pwm_dev_attr,
419 .class = &omap2xxx_timer_hwmod_class, 428 .class = &omap2xxx_timer_hwmod_class,
429 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
420}; 430};
421 431
422/* timer10 */ 432/* timer10 */
@@ -436,6 +446,7 @@ struct omap_hwmod omap2xxx_timer10_hwmod = {
436 }, 446 },
437 .dev_attr = &capability_pwm_dev_attr, 447 .dev_attr = &capability_pwm_dev_attr,
438 .class = &omap2xxx_timer_hwmod_class, 448 .class = &omap2xxx_timer_hwmod_class,
449 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
439}; 450};
440 451
441/* timer11 */ 452/* timer11 */
@@ -455,6 +466,7 @@ struct omap_hwmod omap2xxx_timer11_hwmod = {
455 }, 466 },
456 .dev_attr = &capability_pwm_dev_attr, 467 .dev_attr = &capability_pwm_dev_attr,
457 .class = &omap2xxx_timer_hwmod_class, 468 .class = &omap2xxx_timer_hwmod_class,
469 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
458}; 470};
459 471
460/* timer12 */ 472/* timer12 */
@@ -474,6 +486,7 @@ struct omap_hwmod omap2xxx_timer12_hwmod = {
474 }, 486 },
475 .dev_attr = &capability_pwm_dev_attr, 487 .dev_attr = &capability_pwm_dev_attr,
476 .class = &omap2xxx_timer_hwmod_class, 488 .class = &omap2xxx_timer_hwmod_class,
489 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
477}; 490};
478 491
479/* wd_timer2 */ 492/* wd_timer2 */
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 59d5c1cd316..32820d89f5b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -14,13 +14,11 @@
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16
17#include <plat/omap_hwmod.h> 17#include <linux/i2c-omap.h>
18#include <plat/cpu.h> 18
19#include "omap_hwmod.h"
19#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
20#include <linux/platform_data/spi-omap2-mcspi.h> 21#include <linux/platform_data/spi-omap2-mcspi.h>
21#include <plat/dma.h>
22#include <plat/mmc.h>
23#include <plat/i2c.h>
24 22
25#include "omap_hwmod_common_data.h" 23#include "omap_hwmod_common_data.h"
26 24
@@ -28,6 +26,8 @@
28#include "cm33xx.h" 26#include "cm33xx.h"
29#include "prm33xx.h" 27#include "prm33xx.h"
30#include "prm-regbits-33xx.h" 28#include "prm-regbits-33xx.h"
29#include "i2c.h"
30#include "mmc.h"
31 31
32/* 32/*
33 * IP blocks 33 * IP blocks
@@ -674,6 +674,7 @@ static struct omap_hwmod am33xx_cpgmac0_hwmod = {
674 .name = "cpgmac0", 674 .name = "cpgmac0",
675 .class = &am33xx_cpgmac0_hwmod_class, 675 .class = &am33xx_cpgmac0_hwmod_class,
676 .clkdm_name = "cpsw_125mhz_clkdm", 676 .clkdm_name = "cpsw_125mhz_clkdm",
677 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
677 .mpu_irqs = am33xx_cpgmac0_irqs, 678 .mpu_irqs = am33xx_cpgmac0_irqs,
678 .main_clk = "cpsw_125mhz_gclk", 679 .main_clk = "cpsw_125mhz_gclk",
679 .prcm = { 680 .prcm = {
@@ -685,6 +686,20 @@ static struct omap_hwmod am33xx_cpgmac0_hwmod = {
685}; 686};
686 687
687/* 688/*
689 * mdio class
690 */
691static struct omap_hwmod_class am33xx_mdio_hwmod_class = {
692 .name = "davinci_mdio",
693};
694
695static struct omap_hwmod am33xx_mdio_hwmod = {
696 .name = "davinci_mdio",
697 .class = &am33xx_mdio_hwmod_class,
698 .clkdm_name = "cpsw_125mhz_clkdm",
699 .main_clk = "cpsw_125mhz_gclk",
700};
701
702/*
688 * dcan class 703 * dcan class
689 */ 704 */
690static struct omap_hwmod_class am33xx_dcan_hwmod_class = { 705static struct omap_hwmod_class am33xx_dcan_hwmod_class = {
@@ -2501,6 +2516,21 @@ static struct omap_hwmod_ocp_if am33xx_l4_hs__cpgmac0 = {
2501 .user = OCP_USER_MPU, 2516 .user = OCP_USER_MPU,
2502}; 2517};
2503 2518
2519struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = {
2520 {
2521 .pa_start = 0x4A101000,
2522 .pa_end = 0x4A101000 + SZ_256 - 1,
2523 },
2524 { }
2525};
2526
2527struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = {
2528 .master = &am33xx_cpgmac0_hwmod,
2529 .slave = &am33xx_mdio_hwmod,
2530 .addr = am33xx_mdio_addr_space,
2531 .user = OCP_USER_MPU,
2532};
2533
2504static struct omap_hwmod_addr_space am33xx_elm_addr_space[] = { 2534static struct omap_hwmod_addr_space am33xx_elm_addr_space[] = {
2505 { 2535 {
2506 .pa_start = 0x48080000, 2536 .pa_start = 0x48080000,
@@ -3371,6 +3401,7 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
3371 &am33xx_l3_main__tptc2, 3401 &am33xx_l3_main__tptc2,
3372 &am33xx_l3_s__usbss, 3402 &am33xx_l3_s__usbss,
3373 &am33xx_l4_hs__cpgmac0, 3403 &am33xx_l4_hs__cpgmac0,
3404 &am33xx_cpgmac0__mdio,
3374 NULL, 3405 NULL,
3375}; 3406};
3376 3407
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index f67b7ee07dd..ec4499e5a4c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -14,28 +14,32 @@
14 * 14 *
15 * XXX these should be marked initdata for multi-OMAP kernels 15 * XXX these should be marked initdata for multi-OMAP kernels
16 */ 16 */
17
18#include <linux/i2c-omap.h>
17#include <linux/power/smartreflex.h> 19#include <linux/power/smartreflex.h>
18#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
19 21
20#include <plat/omap_hwmod.h> 22#include <linux/omap-dma.h>
21#include <plat/dma.h>
22#include <plat/serial.h>
23#include "l3_3xxx.h" 23#include "l3_3xxx.h"
24#include "l4_3xxx.h" 24#include "l4_3xxx.h"
25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <linux/platform_data/asoc-ti-mcbsp.h> 25#include <linux/platform_data/asoc-ti-mcbsp.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 26#include <linux/platform_data/spi-omap2-mcspi.h>
27#include <linux/platform_data/iommu-omap.h>
29#include <plat/dmtimer.h> 28#include <plat/dmtimer.h>
30#include <plat/iommu.h>
31 29
32#include "am35xx.h" 30#include "am35xx.h"
33 31
34#include "soc.h" 32#include "soc.h"
33#include "omap_hwmod.h"
35#include "omap_hwmod_common_data.h" 34#include "omap_hwmod_common_data.h"
36#include "prm-regbits-34xx.h" 35#include "prm-regbits-34xx.h"
37#include "cm-regbits-34xx.h" 36#include "cm-regbits-34xx.h"
37
38#include "dma.h"
39#include "i2c.h"
40#include "mmc.h"
38#include "wd_timer.h" 41#include "wd_timer.h"
42#include "serial.h"
39 43
40/* 44/*
41 * OMAP3xxx hardware module integration data 45 * OMAP3xxx hardware module integration data
@@ -149,29 +153,16 @@ static struct omap_hwmod omap3xxx_debugss_hwmod = {
149}; 153};
150 154
151/* timer class */ 155/* timer class */
152static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = {
153 .rev_offs = 0x0000,
154 .sysc_offs = 0x0010,
155 .syss_offs = 0x0014,
156 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
157 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
158 SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE),
159 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
160 .sysc_fields = &omap_hwmod_sysc_type1,
161};
162
163static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = {
164 .name = "timer",
165 .sysc = &omap3xxx_timer_1ms_sysc,
166};
167
168static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = { 156static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
169 .rev_offs = 0x0000, 157 .rev_offs = 0x0000,
170 .sysc_offs = 0x0010, 158 .sysc_offs = 0x0010,
171 .syss_offs = 0x0014, 159 .syss_offs = 0x0014,
172 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP | 160 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
173 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), 161 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
162 SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE |
163 SYSS_HAS_RESET_STATUS),
174 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 164 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
165 .clockact = CLOCKACT_TEST_ICLK,
175 .sysc_fields = &omap_hwmod_sysc_type1, 166 .sysc_fields = &omap_hwmod_sysc_type1,
176}; 167};
177 168
@@ -220,7 +211,8 @@ static struct omap_hwmod omap3xxx_timer1_hwmod = {
220 }, 211 },
221 }, 212 },
222 .dev_attr = &capability_alwon_dev_attr, 213 .dev_attr = &capability_alwon_dev_attr,
223 .class = &omap3xxx_timer_1ms_hwmod_class, 214 .class = &omap3xxx_timer_hwmod_class,
215 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
224}; 216};
225 217
226/* timer2 */ 218/* timer2 */
@@ -237,7 +229,8 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
237 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT, 229 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT,
238 }, 230 },
239 }, 231 },
240 .class = &omap3xxx_timer_1ms_hwmod_class, 232 .class = &omap3xxx_timer_hwmod_class,
233 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
241}; 234};
242 235
243/* timer3 */ 236/* timer3 */
@@ -255,6 +248,7 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
255 }, 248 },
256 }, 249 },
257 .class = &omap3xxx_timer_hwmod_class, 250 .class = &omap3xxx_timer_hwmod_class,
251 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
258}; 252};
259 253
260/* timer4 */ 254/* timer4 */
@@ -272,6 +266,7 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
272 }, 266 },
273 }, 267 },
274 .class = &omap3xxx_timer_hwmod_class, 268 .class = &omap3xxx_timer_hwmod_class,
269 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
275}; 270};
276 271
277/* timer5 */ 272/* timer5 */
@@ -290,6 +285,7 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
290 }, 285 },
291 .dev_attr = &capability_dsp_dev_attr, 286 .dev_attr = &capability_dsp_dev_attr,
292 .class = &omap3xxx_timer_hwmod_class, 287 .class = &omap3xxx_timer_hwmod_class,
288 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
293}; 289};
294 290
295/* timer6 */ 291/* timer6 */
@@ -308,6 +304,7 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
308 }, 304 },
309 .dev_attr = &capability_dsp_dev_attr, 305 .dev_attr = &capability_dsp_dev_attr,
310 .class = &omap3xxx_timer_hwmod_class, 306 .class = &omap3xxx_timer_hwmod_class,
307 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
311}; 308};
312 309
313/* timer7 */ 310/* timer7 */
@@ -326,6 +323,7 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
326 }, 323 },
327 .dev_attr = &capability_dsp_dev_attr, 324 .dev_attr = &capability_dsp_dev_attr,
328 .class = &omap3xxx_timer_hwmod_class, 325 .class = &omap3xxx_timer_hwmod_class,
326 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
329}; 327};
330 328
331/* timer8 */ 329/* timer8 */
@@ -344,6 +342,7 @@ static struct omap_hwmod omap3xxx_timer8_hwmod = {
344 }, 342 },
345 .dev_attr = &capability_dsp_pwm_dev_attr, 343 .dev_attr = &capability_dsp_pwm_dev_attr,
346 .class = &omap3xxx_timer_hwmod_class, 344 .class = &omap3xxx_timer_hwmod_class,
345 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
347}; 346};
348 347
349/* timer9 */ 348/* timer9 */
@@ -362,6 +361,7 @@ static struct omap_hwmod omap3xxx_timer9_hwmod = {
362 }, 361 },
363 .dev_attr = &capability_pwm_dev_attr, 362 .dev_attr = &capability_pwm_dev_attr,
364 .class = &omap3xxx_timer_hwmod_class, 363 .class = &omap3xxx_timer_hwmod_class,
364 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
365}; 365};
366 366
367/* timer10 */ 367/* timer10 */
@@ -379,7 +379,8 @@ static struct omap_hwmod omap3xxx_timer10_hwmod = {
379 }, 379 },
380 }, 380 },
381 .dev_attr = &capability_pwm_dev_attr, 381 .dev_attr = &capability_pwm_dev_attr,
382 .class = &omap3xxx_timer_1ms_hwmod_class, 382 .class = &omap3xxx_timer_hwmod_class,
383 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
383}; 384};
384 385
385/* timer11 */ 386/* timer11 */
@@ -398,6 +399,7 @@ static struct omap_hwmod omap3xxx_timer11_hwmod = {
398 }, 399 },
399 .dev_attr = &capability_pwm_dev_attr, 400 .dev_attr = &capability_pwm_dev_attr,
400 .class = &omap3xxx_timer_hwmod_class, 401 .class = &omap3xxx_timer_hwmod_class,
402 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
401}; 403};
402 404
403/* timer12 */ 405/* timer12 */
@@ -421,6 +423,7 @@ static struct omap_hwmod omap3xxx_timer12_hwmod = {
421 }, 423 },
422 .dev_attr = &capability_secure_dev_attr, 424 .dev_attr = &capability_secure_dev_attr,
423 .class = &omap3xxx_timer_hwmod_class, 425 .class = &omap3xxx_timer_hwmod_class,
426 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
424}; 427};
425 428
426/* 429/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 0b1249e0039..eb61cfd9452 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -22,22 +22,24 @@
22#include <linux/platform_data/gpio-omap.h> 22#include <linux/platform_data/gpio-omap.h>
23#include <linux/power/smartreflex.h> 23#include <linux/power/smartreflex.h>
24#include <linux/platform_data/omap_ocp2scp.h> 24#include <linux/platform_data/omap_ocp2scp.h>
25#include <linux/i2c-omap.h>
25 26
26#include <plat/omap_hwmod.h> 27#include <linux/omap-dma.h>
27#include <plat/i2c.h> 28
28#include <plat/dma.h> 29#include <linux/platform_data/omap_ocp2scp.h>
29#include <linux/platform_data/spi-omap2-mcspi.h> 30#include <linux/platform_data/spi-omap2-mcspi.h>
30#include <linux/platform_data/asoc-ti-mcbsp.h> 31#include <linux/platform_data/asoc-ti-mcbsp.h>
31#include <plat/mmc.h> 32#include <linux/platform_data/iommu-omap.h>
32#include <plat/dmtimer.h> 33#include <plat/dmtimer.h>
33#include <plat/common.h>
34#include <plat/iommu.h>
35 34
35#include "omap_hwmod.h"
36#include "omap_hwmod_common_data.h" 36#include "omap_hwmod_common_data.h"
37#include "cm1_44xx.h" 37#include "cm1_44xx.h"
38#include "cm2_44xx.h" 38#include "cm2_44xx.h"
39#include "prm44xx.h" 39#include "prm44xx.h"
40#include "prm-regbits-44xx.h" 40#include "prm-regbits-44xx.h"
41#include "i2c.h"
42#include "mmc.h"
41#include "wd_timer.h" 43#include "wd_timer.h"
42 44
43/* Base offset for all OMAP4 interrupts external to MPUSS */ 45/* Base offset for all OMAP4 interrupts external to MPUSS */
@@ -3102,6 +3104,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_timer_1ms_sysc = {
3102 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | 3104 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
3103 SYSS_HAS_RESET_STATUS), 3105 SYSS_HAS_RESET_STATUS),
3104 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 3106 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
3107 .clockact = CLOCKACT_TEST_ICLK,
3105 .sysc_fields = &omap_hwmod_sysc_type1, 3108 .sysc_fields = &omap_hwmod_sysc_type1,
3106}; 3109};
3107 3110
@@ -3155,6 +3158,7 @@ static struct omap_hwmod omap44xx_timer1_hwmod = {
3155 .name = "timer1", 3158 .name = "timer1",
3156 .class = &omap44xx_timer_1ms_hwmod_class, 3159 .class = &omap44xx_timer_1ms_hwmod_class,
3157 .clkdm_name = "l4_wkup_clkdm", 3160 .clkdm_name = "l4_wkup_clkdm",
3161 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
3158 .mpu_irqs = omap44xx_timer1_irqs, 3162 .mpu_irqs = omap44xx_timer1_irqs,
3159 .main_clk = "timer1_fck", 3163 .main_clk = "timer1_fck",
3160 .prcm = { 3164 .prcm = {
@@ -3177,6 +3181,7 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
3177 .name = "timer2", 3181 .name = "timer2",
3178 .class = &omap44xx_timer_1ms_hwmod_class, 3182 .class = &omap44xx_timer_1ms_hwmod_class,
3179 .clkdm_name = "l4_per_clkdm", 3183 .clkdm_name = "l4_per_clkdm",
3184 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
3180 .mpu_irqs = omap44xx_timer2_irqs, 3185 .mpu_irqs = omap44xx_timer2_irqs,
3181 .main_clk = "timer2_fck", 3186 .main_clk = "timer2_fck",
3182 .prcm = { 3187 .prcm = {
@@ -3351,6 +3356,7 @@ static struct omap_hwmod omap44xx_timer10_hwmod = {
3351 .name = "timer10", 3356 .name = "timer10",
3352 .class = &omap44xx_timer_1ms_hwmod_class, 3357 .class = &omap44xx_timer_1ms_hwmod_class,
3353 .clkdm_name = "l4_per_clkdm", 3358 .clkdm_name = "l4_per_clkdm",
3359 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
3354 .mpu_irqs = omap44xx_timer10_irqs, 3360 .mpu_irqs = omap44xx_timer10_irqs,
3355 .main_clk = "timer10_fck", 3361 .main_clk = "timer10_fck",
3356 .prcm = { 3362 .prcm = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.c b/arch/arm/mach-omap2/omap_hwmod_common_data.c
index 9f1ccdc8cc8..79d623b83e4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.c
@@ -16,7 +16,7 @@
16 * data and their integration with other OMAP modules and Linux. 16 * data and their integration with other OMAP modules and Linux.
17 */ 17 */
18 18
19#include <plat/omap_hwmod.h> 19#include "omap_hwmod.h"
20 20
21#include "omap_hwmod_common_data.h" 21#include "omap_hwmod_common_data.h"
22 22
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index 2bc8f1705d4..cfcce299177 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -13,7 +13,7 @@
13#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H 13#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H
14#define __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H 14#define __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H
15 15
16#include <plat/omap_hwmod.h> 16#include "omap_hwmod.h"
17 17
18#include "common.h" 18#include "common.h"
19#include "display.h" 19#include "display.h"
diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h
index c784c12f98a..336fdfcf88b 100644
--- a/arch/arm/mach-omap2/omap_opp_data.h
+++ b/arch/arm/mach-omap2/omap_opp_data.h
@@ -19,7 +19,7 @@
19#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H 19#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H
20#define __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H 20#define __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H
21 21
22#include <plat/omap_hwmod.h> 22#include "omap_hwmod.h"
23 23
24#include "voltage.h" 24#include "voltage.h"
25 25
@@ -89,8 +89,11 @@ extern struct omap_volt_data omap34xx_vddcore_volt_data[];
89extern struct omap_volt_data omap36xx_vddmpu_volt_data[]; 89extern struct omap_volt_data omap36xx_vddmpu_volt_data[];
90extern struct omap_volt_data omap36xx_vddcore_volt_data[]; 90extern struct omap_volt_data omap36xx_vddcore_volt_data[];
91 91
92extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[]; 92extern struct omap_volt_data omap443x_vdd_mpu_volt_data[];
93extern struct omap_volt_data omap44xx_vdd_iva_volt_data[]; 93extern struct omap_volt_data omap443x_vdd_iva_volt_data[];
94extern struct omap_volt_data omap44xx_vdd_core_volt_data[]; 94extern struct omap_volt_data omap443x_vdd_core_volt_data[];
95extern struct omap_volt_data omap446x_vdd_mpu_volt_data[];
96extern struct omap_volt_data omap446x_vdd_iva_volt_data[];
97extern struct omap_volt_data omap446x_vdd_core_volt_data[];
95 98
96#endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */ 99#endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index d992db8ff0b..e237602e10e 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -27,11 +27,43 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/usb.h> 29#include <linux/usb.h>
30 30#include <linux/usb/musb.h>
31#include <plat/usb.h>
32 31
33#include "soc.h" 32#include "soc.h"
34#include "control.h" 33#include "control.h"
34#include "usb.h"
35
36#define CONTROL_DEV_CONF 0x300
37#define PHY_PD 0x1
38
39/**
40 * omap4430_phy_power_down: disable MUSB PHY during early init
41 *
42 * OMAP4 MUSB PHY module is enabled by default on reset, but this will
43 * prevent core retention if not disabled by SW. USB driver will
44 * later on enable this, once and if the driver needs it.
45 */
46static int __init omap4430_phy_power_down(void)
47{
48 void __iomem *ctrl_base;
49
50 if (!cpu_is_omap44xx())
51 return 0;
52
53 ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
54 if (!ctrl_base) {
55 pr_err("control module ioremap failed\n");
56 return -ENOMEM;
57 }
58
59 /* Power down the phy */
60 __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
61
62 iounmap(ctrl_base);
63
64 return 0;
65}
66early_initcall(omap4430_phy_power_down);
35 67
36void am35x_musb_reset(void) 68void am35x_musb_reset(void)
37{ 69{
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index f515a1a056d..fefd4016662 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/i2c/twl.h> 19#include <linux/i2c/twl.h>
20 20
21#include "soc.h"
21#include "voltage.h" 22#include "voltage.h"
22 23
23#include "pm.h" 24#include "pm.h"
@@ -30,16 +31,6 @@
30#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04 31#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04
31#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200 32#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200
32 33
33#define OMAP3430_VP1_VLIMITTO_VDDMIN 0x14
34#define OMAP3430_VP1_VLIMITTO_VDDMAX 0x42
35#define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18
36#define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c
37
38#define OMAP3630_VP1_VLIMITTO_VDDMIN 0x18
39#define OMAP3630_VP1_VLIMITTO_VDDMAX 0x3c
40#define OMAP3630_VP2_VLIMITTO_VDDMIN 0x18
41#define OMAP3630_VP2_VLIMITTO_VDDMAX 0x30
42
43#define OMAP4_SRI2C_SLAVE_ADDR 0x12 34#define OMAP4_SRI2C_SLAVE_ADDR 0x12
44#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55 35#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55
45#define OMAP4_VDD_MPU_SR_CMD_REG 0x56 36#define OMAP4_VDD_MPU_SR_CMD_REG 0x56
@@ -53,13 +44,6 @@
53#define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04 44#define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04
54#define OMAP4_VP_VLIMITTO_TIMEOUT_US 200 45#define OMAP4_VP_VLIMITTO_TIMEOUT_US 200
55 46
56#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 0xA
57#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 0x39
58#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 0xA
59#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 0x2D
60#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 0xA
61#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 0x28
62
63static bool is_offset_valid; 47static bool is_offset_valid;
64static u8 smps_offset; 48static u8 smps_offset;
65/* 49/*
@@ -158,16 +142,11 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
158static struct omap_voltdm_pmic omap3_mpu_pmic = { 142static struct omap_voltdm_pmic omap3_mpu_pmic = {
159 .slew_rate = 4000, 143 .slew_rate = 4000,
160 .step_size = 12500, 144 .step_size = 12500,
161 .on_volt = 1200000,
162 .onlp_volt = 1000000,
163 .ret_volt = 975000,
164 .off_volt = 600000,
165 .volt_setup_time = 0xfff,
166 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, 145 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
167 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, 146 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
168 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, 147 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX,
169 .vp_vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN, 148 .vddmin = 600000,
170 .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX, 149 .vddmax = 1450000,
171 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, 150 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
172 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, 151 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
173 .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG, 152 .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG,
@@ -179,16 +158,11 @@ static struct omap_voltdm_pmic omap3_mpu_pmic = {
179static struct omap_voltdm_pmic omap3_core_pmic = { 158static struct omap_voltdm_pmic omap3_core_pmic = {
180 .slew_rate = 4000, 159 .slew_rate = 4000,
181 .step_size = 12500, 160 .step_size = 12500,
182 .on_volt = 1200000,
183 .onlp_volt = 1000000,
184 .ret_volt = 975000,
185 .off_volt = 600000,
186 .volt_setup_time = 0xfff,
187 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, 161 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
188 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, 162 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
189 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, 163 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX,
190 .vp_vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN, 164 .vddmin = 600000,
191 .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX, 165 .vddmax = 1450000,
192 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, 166 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
193 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, 167 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
194 .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG, 168 .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG,
@@ -200,21 +174,17 @@ static struct omap_voltdm_pmic omap3_core_pmic = {
200static struct omap_voltdm_pmic omap4_mpu_pmic = { 174static struct omap_voltdm_pmic omap4_mpu_pmic = {
201 .slew_rate = 4000, 175 .slew_rate = 4000,
202 .step_size = 12660, 176 .step_size = 12660,
203 .on_volt = 1375000,
204 .onlp_volt = 1375000,
205 .ret_volt = 830000,
206 .off_volt = 0,
207 .volt_setup_time = 0,
208 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 177 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
209 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 178 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
210 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, 179 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX,
211 .vp_vddmin = OMAP4_VP_MPU_VLIMITTO_VDDMIN, 180 .vddmin = 0,
212 .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX, 181 .vddmax = 2100000,
213 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 182 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
214 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 183 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
215 .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG, 184 .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG,
216 .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG, 185 .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG,
217 .i2c_high_speed = true, 186 .i2c_high_speed = true,
187 .i2c_pad_load = 3,
218 .vsel_to_uv = twl6030_vsel_to_uv, 188 .vsel_to_uv = twl6030_vsel_to_uv,
219 .uv_to_vsel = twl6030_uv_to_vsel, 189 .uv_to_vsel = twl6030_uv_to_vsel,
220}; 190};
@@ -222,21 +192,17 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = {
222static struct omap_voltdm_pmic omap4_iva_pmic = { 192static struct omap_voltdm_pmic omap4_iva_pmic = {
223 .slew_rate = 4000, 193 .slew_rate = 4000,
224 .step_size = 12660, 194 .step_size = 12660,
225 .on_volt = 1188000,
226 .onlp_volt = 1188000,
227 .ret_volt = 830000,
228 .off_volt = 0,
229 .volt_setup_time = 0,
230 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 195 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
231 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 196 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
232 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, 197 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX,
233 .vp_vddmin = OMAP4_VP_IVA_VLIMITTO_VDDMIN, 198 .vddmin = 0,
234 .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX, 199 .vddmax = 2100000,
235 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 200 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
236 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 201 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
237 .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG, 202 .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG,
238 .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG, 203 .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG,
239 .i2c_high_speed = true, 204 .i2c_high_speed = true,
205 .i2c_pad_load = 3,
240 .vsel_to_uv = twl6030_vsel_to_uv, 206 .vsel_to_uv = twl6030_vsel_to_uv,
241 .uv_to_vsel = twl6030_uv_to_vsel, 207 .uv_to_vsel = twl6030_uv_to_vsel,
242}; 208};
@@ -244,20 +210,17 @@ static struct omap_voltdm_pmic omap4_iva_pmic = {
244static struct omap_voltdm_pmic omap4_core_pmic = { 210static struct omap_voltdm_pmic omap4_core_pmic = {
245 .slew_rate = 4000, 211 .slew_rate = 4000,
246 .step_size = 12660, 212 .step_size = 12660,
247 .on_volt = 1200000,
248 .onlp_volt = 1200000,
249 .ret_volt = 830000,
250 .off_volt = 0,
251 .volt_setup_time = 0,
252 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 213 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
253 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 214 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
254 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, 215 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX,
255 .vp_vddmin = OMAP4_VP_CORE_VLIMITTO_VDDMIN, 216 .vddmin = 0,
256 .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX, 217 .vddmax = 2100000,
257 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 218 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
258 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 219 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
259 .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG, 220 .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG,
260 .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG, 221 .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG,
222 .i2c_high_speed = true,
223 .i2c_pad_load = 3,
261 .vsel_to_uv = twl6030_vsel_to_uv, 224 .vsel_to_uv = twl6030_vsel_to_uv,
262 .uv_to_vsel = twl6030_uv_to_vsel, 225 .uv_to_vsel = twl6030_uv_to_vsel,
263}; 226};
@@ -288,13 +251,6 @@ int __init omap3_twl_init(void)
288 if (!cpu_is_omap34xx()) 251 if (!cpu_is_omap34xx())
289 return -ENODEV; 252 return -ENODEV;
290 253
291 if (cpu_is_omap3630()) {
292 omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
293 omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
294 omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
295 omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
296 }
297
298 /* 254 /*
299 * The smartreflex bit on twl4030 specifies if the setting of voltage 255 * The smartreflex bit on twl4030 specifies if the setting of voltage
300 * is done over the I2C_SR path. Since this setting is independent of 256 * is done over the I2C_SR path. Since this setting is independent of
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
index 58e16aef40b..bd41d59a7ca 100644
--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -20,7 +20,7 @@
20#include <linux/opp.h> 20#include <linux/opp.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22 22
23#include <plat/omap_device.h> 23#include "omap_device.h"
24 24
25#include "omap_opp_data.h" 25#include "omap_opp_data.h"
26 26
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
index 75cef5f67a8..62772e0e0d6 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -19,6 +19,7 @@
19 */ 19 */
20#include <linux/module.h> 20#include <linux/module.h>
21 21
22#include "soc.h"
22#include "control.h" 23#include "control.h"
23#include "omap_opp_data.h" 24#include "omap_opp_data.h"
24#include "pm.h" 25#include "pm.h"
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
index a9fd6d5fe79..d470b728e72 100644
--- a/arch/arm/mach-omap2/opp4xxx_data.c
+++ b/arch/arm/mach-omap2/opp4xxx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 OPP table definitions. 2 * OMAP4 OPP table definitions.
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 4 * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Nishanth Menon 5 * Nishanth Menon
6 * Kevin Hilman 6 * Kevin Hilman
7 * Thara Gopinath 7 * Thara Gopinath
@@ -35,7 +35,7 @@
35#define OMAP4430_VDD_MPU_OPPTURBO_UV 1313000 35#define OMAP4430_VDD_MPU_OPPTURBO_UV 1313000
36#define OMAP4430_VDD_MPU_OPPNITRO_UV 1375000 36#define OMAP4430_VDD_MPU_OPPNITRO_UV 1375000
37 37
38struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = { 38struct omap_volt_data omap443x_vdd_mpu_volt_data[] = {
39 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), 39 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c),
40 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), 40 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16),
41 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), 41 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23),
@@ -47,7 +47,7 @@ struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
47#define OMAP4430_VDD_IVA_OPP100_UV 1188000 47#define OMAP4430_VDD_IVA_OPP100_UV 1188000
48#define OMAP4430_VDD_IVA_OPPTURBO_UV 1300000 48#define OMAP4430_VDD_IVA_OPPTURBO_UV 1300000
49 49
50struct omap_volt_data omap44xx_vdd_iva_volt_data[] = { 50struct omap_volt_data omap443x_vdd_iva_volt_data[] = {
51 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c), 51 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c),
52 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), 52 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16),
53 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), 53 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23),
@@ -57,14 +57,14 @@ struct omap_volt_data omap44xx_vdd_iva_volt_data[] = {
57#define OMAP4430_VDD_CORE_OPP50_UV 1025000 57#define OMAP4430_VDD_CORE_OPP50_UV 1025000
58#define OMAP4430_VDD_CORE_OPP100_UV 1200000 58#define OMAP4430_VDD_CORE_OPP100_UV 1200000
59 59
60struct omap_volt_data omap44xx_vdd_core_volt_data[] = { 60struct omap_volt_data omap443x_vdd_core_volt_data[] = {
61 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c), 61 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c),
62 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), 62 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16),
63 VOLT_DATA_DEFINE(0, 0, 0, 0), 63 VOLT_DATA_DEFINE(0, 0, 0, 0),
64}; 64};
65 65
66 66
67static struct omap_opp_def __initdata omap44xx_opp_def_list[] = { 67static struct omap_opp_def __initdata omap443x_opp_def_list[] = {
68 /* MPU OPP1 - OPP50 */ 68 /* MPU OPP1 - OPP50 */
69 OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV), 69 OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV),
70 /* MPU OPP2 - OPP100 */ 70 /* MPU OPP2 - OPP100 */
@@ -86,6 +86,82 @@ static struct omap_opp_def __initdata omap44xx_opp_def_list[] = {
86 /* TODO: add DSP, aess, fdif, gpu */ 86 /* TODO: add DSP, aess, fdif, gpu */
87}; 87};
88 88
89#define OMAP4460_VDD_MPU_OPP50_UV 1025000
90#define OMAP4460_VDD_MPU_OPP100_UV 1200000
91#define OMAP4460_VDD_MPU_OPPTURBO_UV 1313000
92#define OMAP4460_VDD_MPU_OPPNITRO_UV 1375000
93
94struct omap_volt_data omap446x_vdd_mpu_volt_data[] = {
95 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c),
96 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16),
97 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23),
98 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27),
99 VOLT_DATA_DEFINE(0, 0, 0, 0),
100};
101
102#define OMAP4460_VDD_IVA_OPP50_UV 1025000
103#define OMAP4460_VDD_IVA_OPP100_UV 1200000
104#define OMAP4460_VDD_IVA_OPPTURBO_UV 1313000
105#define OMAP4460_VDD_IVA_OPPNITRO_UV 1375000
106
107struct omap_volt_data omap446x_vdd_iva_volt_data[] = {
108 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c),
109 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16),
110 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23),
111 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPNITRO, 0xfa, 0x23),
112 VOLT_DATA_DEFINE(0, 0, 0, 0),
113};
114
115#define OMAP4460_VDD_CORE_OPP50_UV 1025000
116#define OMAP4460_VDD_CORE_OPP100_UV 1200000
117#define OMAP4460_VDD_CORE_OPP100_OV_UV 1250000
118
119struct omap_volt_data omap446x_vdd_core_volt_data[] = {
120 VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c),
121 VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16),
122 VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_OV_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100OV, 0xf9, 0x16),
123 VOLT_DATA_DEFINE(0, 0, 0, 0),
124};
125
126static struct omap_opp_def __initdata omap446x_opp_def_list[] = {
127 /* MPU OPP1 - OPP50 */
128 OPP_INITIALIZER("mpu", true, 350000000, OMAP4460_VDD_MPU_OPP50_UV),
129 /* MPU OPP2 - OPP100 */
130 OPP_INITIALIZER("mpu", true, 700000000, OMAP4460_VDD_MPU_OPP100_UV),
131 /* MPU OPP3 - OPP-Turbo */
132 OPP_INITIALIZER("mpu", true, 920000000, OMAP4460_VDD_MPU_OPPTURBO_UV),
133 /*
134 * MPU OPP4 - OPP-Nitro + Disabled as the reference schematics
135 * recommends TPS623631 - confirm and enable the opp in board file
136 * XXX: May be we should enable these based on mpu capability and
137 * Exception board files disable it...
138 */
139 OPP_INITIALIZER("mpu", false, 1200000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
140 /* MPU OPP4 - OPP-Nitro SpeedBin */
141 OPP_INITIALIZER("mpu", false, 1500000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
142 /* L3 OPP1 - OPP50 */
143 OPP_INITIALIZER("l3_main_1", true, 100000000, OMAP4460_VDD_CORE_OPP50_UV),
144 /* L3 OPP2 - OPP100 */
145 OPP_INITIALIZER("l3_main_1", true, 200000000, OMAP4460_VDD_CORE_OPP100_UV),
146 /* IVA OPP1 - OPP50 */
147 OPP_INITIALIZER("iva", true, 133000000, OMAP4460_VDD_IVA_OPP50_UV),
148 /* IVA OPP2 - OPP100 */
149 OPP_INITIALIZER("iva", true, 266100000, OMAP4460_VDD_IVA_OPP100_UV),
150 /*
151 * IVA OPP3 - OPP-Turbo + Disabled as the reference schematics
152 * recommends Phoenix VCORE2 which can supply only 600mA - so the ones
153 * above this OPP frequency, even though OMAP is capable, should be
154 * enabled by board file which is sure of the chip power capability
155 */
156 OPP_INITIALIZER("iva", false, 332000000, OMAP4460_VDD_IVA_OPPTURBO_UV),
157 /* IVA OPP4 - OPP-Nitro */
158 OPP_INITIALIZER("iva", false, 430000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
159 /* IVA OPP5 - OPP-Nitro SpeedBin*/
160 OPP_INITIALIZER("iva", false, 500000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
161
162 /* TODO: add DSP, aess, fdif, gpu */
163};
164
89/** 165/**
90 * omap4_opp_init() - initialize omap4 opp table 166 * omap4_opp_init() - initialize omap4 opp table
91 */ 167 */
@@ -93,12 +169,12 @@ int __init omap4_opp_init(void)
93{ 169{
94 int r = -ENODEV; 170 int r = -ENODEV;
95 171
96 if (!cpu_is_omap443x()) 172 if (cpu_is_omap443x())
97 return r; 173 r = omap_init_opp_table(omap443x_opp_def_list,
98 174 ARRAY_SIZE(omap443x_opp_def_list));
99 r = omap_init_opp_table(omap44xx_opp_def_list, 175 else if (cpu_is_omap446x())
100 ARRAY_SIZE(omap44xx_opp_def_list)); 176 r = omap_init_opp_table(omap446x_opp_def_list,
101 177 ARRAY_SIZE(omap446x_opp_def_list));
102 return r; 178 return r;
103} 179}
104device_initcall(omap4_opp_init); 180device_initcall(omap4_opp_init);
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 46092cd806f..e2c291f52f9 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -27,12 +27,12 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
30#include <plat/clock.h> 30#include "clock.h"
31#include "powerdomain.h" 31#include "powerdomain.h"
32#include "clockdomain.h" 32#include "clockdomain.h"
33#include <plat/dmtimer.h> 33#include "omap-pm.h"
34#include <plat/omap-pm.h>
35 34
35#include "soc.h"
36#include "cm2xxx_3xxx.h" 36#include "cm2xxx_3xxx.h"
37#include "prm2xxx_3xxx.h" 37#include "prm2xxx_3xxx.h"
38#include "pm.h" 38#include "pm.h"
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index ea61c32957b..f4b3143a8b1 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -20,10 +20,11 @@
20 20
21#include <asm/system_misc.h> 21#include <asm/system_misc.h>
22 22
23#include <plat/omap-pm.h> 23#include "omap-pm.h"
24#include <plat/omap_device.h> 24#include "omap_device.h"
25#include "common.h" 25#include "common.h"
26 26
27#include "soc.h"
27#include "prcm-common.h" 28#include "prcm-common.h"
28#include "voltage.h" 29#include "voltage.h"
29#include "powerdomain.h" 30#include "powerdomain.h"
@@ -39,6 +40,38 @@ static struct omap_device_pm_latency *pm_lats;
39 */ 40 */
40int (*omap_pm_suspend)(void); 41int (*omap_pm_suspend)(void);
41 42
43#ifdef CONFIG_PM
44/**
45 * struct omap2_oscillator - Describe the board main oscillator latencies
46 * @startup_time: oscillator startup latency
47 * @shutdown_time: oscillator shutdown latency
48 */
49struct omap2_oscillator {
50 u32 startup_time;
51 u32 shutdown_time;
52};
53
54static struct omap2_oscillator oscillator = {
55 .startup_time = ULONG_MAX,
56 .shutdown_time = ULONG_MAX,
57};
58
59void omap_pm_setup_oscillator(u32 tstart, u32 tshut)
60{
61 oscillator.startup_time = tstart;
62 oscillator.shutdown_time = tshut;
63}
64
65void omap_pm_get_oscillator(u32 *tstart, u32 *tshut)
66{
67 if (!tstart || !tshut)
68 return;
69
70 *tstart = oscillator.startup_time;
71 *tshut = oscillator.shutdown_time;
72}
73#endif
74
42static int __init _init_omap_device(char *name) 75static int __init _init_omap_device(char *name)
43{ 76{
44 struct omap_hwmod *oh; 77 struct omap_hwmod *oh;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 67d66131cfa..c22503b17ab 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -102,6 +102,15 @@ extern void enable_omap3630_toggle_l2_on_restore(void);
102static inline void enable_omap3630_toggle_l2_on_restore(void) { } 102static inline void enable_omap3630_toggle_l2_on_restore(void) { }
103#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */ 103#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */
104 104
105#define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0)
106
107#if defined(CONFIG_ARCH_OMAP4)
108extern u16 pm44xx_errata;
109#define IS_PM44XX_ERRATUM(id) (pm44xx_errata & (id))
110#else
111#define IS_PM44XX_ERRATUM(id) 0
112#endif
113
105#ifdef CONFIG_POWER_AVS_OMAP 114#ifdef CONFIG_POWER_AVS_OMAP
106extern int omap_devinit_smartreflex(void); 115extern int omap_devinit_smartreflex(void);
107extern void omap_enable_smartreflex_on_init(void); 116extern void omap_enable_smartreflex_on_init(void);
@@ -129,4 +138,14 @@ static inline int omap4_twl_init(void)
129} 138}
130#endif 139#endif
131 140
141#ifdef CONFIG_PM
142extern void omap_pm_setup_oscillator(u32 tstart, u32 tshut);
143extern void omap_pm_get_oscillator(u32 *tstart, u32 *tshut);
144extern void omap_pm_setup_sr_i2c_pcb_length(u32 mm);
145#else
146static inline void omap_pm_setup_oscillator(u32 tstart, u32 tshut) { }
147static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { *tstart = *tshut = 0; }
148static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { }
149#endif
150
132#endif 151#endif
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 8af6cd6ac33..c333fa6dffa 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -25,27 +25,30 @@
25#include <linux/sysfs.h> 25#include <linux/sysfs.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/clk.h> 28#include <linux/clk-provider.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/platform_data/gpio-omap.h> 32#include <linux/platform_data/gpio-omap.h>
33 33
34#include <asm/fncpy.h>
35
34#include <asm/mach/time.h> 36#include <asm/mach/time.h>
35#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
36#include <asm/mach-types.h> 38#include <asm/mach-types.h>
37#include <asm/system_misc.h> 39#include <asm/system_misc.h>
38 40
39#include <plat/clock.h> 41#include <linux/omap-dma.h>
40#include <plat/sram.h>
41#include <plat/dma.h>
42 42
43#include "soc.h"
43#include "common.h" 44#include "common.h"
44#include "prm2xxx_3xxx.h" 45#include "clock.h"
46#include "prm2xxx.h"
45#include "prm-regbits-24xx.h" 47#include "prm-regbits-24xx.h"
46#include "cm2xxx_3xxx.h" 48#include "cm2xxx.h"
47#include "cm-regbits-24xx.h" 49#include "cm-regbits-24xx.h"
48#include "sdrc.h" 50#include "sdrc.h"
51#include "sram.h"
49#include "pm.h" 52#include "pm.h"
50#include "control.h" 53#include "control.h"
51#include "powerdomain.h" 54#include "powerdomain.h"
@@ -200,7 +203,7 @@ static int omap2_can_sleep(void)
200{ 203{
201 if (omap2_fclks_active()) 204 if (omap2_fclks_active())
202 return 0; 205 return 0;
203 if (osc_ck->usecount > 1) 206 if (__clk_is_enabled(osc_ck))
204 return 0; 207 return 0;
205 if (omap_dma_running()) 208 if (omap_dma_running())
206 return 0; 209 return 0;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 3a904de4313..7be3622cfc8 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -28,29 +28,27 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/omap-dma.h>
31#include <linux/platform_data/gpio-omap.h> 32#include <linux/platform_data/gpio-omap.h>
32 33
33#include <trace/events/power.h> 34#include <trace/events/power.h>
34 35
36#include <asm/fncpy.h>
35#include <asm/suspend.h> 37#include <asm/suspend.h>
36#include <asm/system_misc.h> 38#include <asm/system_misc.h>
37 39
38#include <plat/sram.h>
39#include "clockdomain.h" 40#include "clockdomain.h"
40#include "powerdomain.h" 41#include "powerdomain.h"
41#include <plat/sdrc.h> 42#include "soc.h"
42#include <plat/prcm.h>
43#include <plat/gpmc.h>
44#include <plat/dma.h>
45
46#include "common.h" 43#include "common.h"
47#include "cm2xxx_3xxx.h" 44#include "cm3xxx.h"
48#include "cm-regbits-34xx.h" 45#include "cm-regbits-34xx.h"
46#include "gpmc.h"
49#include "prm-regbits-34xx.h" 47#include "prm-regbits-34xx.h"
50 48#include "prm3xxx.h"
51#include "prm2xxx_3xxx.h"
52#include "pm.h" 49#include "pm.h"
53#include "sdrc.h" 50#include "sdrc.h"
51#include "sram.h"
54#include "control.h" 52#include "control.h"
55 53
56/* pm34xx errata defined in pm.h */ 54/* pm34xx errata defined in pm.h */
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 04922d14906..aa6fd98f606 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -18,6 +18,7 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <asm/system_misc.h> 19#include <asm/system_misc.h>
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22#include "clockdomain.h" 23#include "clockdomain.h"
23#include "powerdomain.h" 24#include "powerdomain.h"
@@ -100,13 +101,6 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
100 if (!strncmp(pwrdm->name, "cpu", 3)) 101 if (!strncmp(pwrdm->name, "cpu", 3))
101 return 0; 102 return 0;
102 103
103 /*
104 * FIXME: Remove this check when core retention is supported
105 * Only MPUSS power domain is added in the list.
106 */
107 if (strcmp(pwrdm->name, "mpu_pwrdm"))
108 return 0;
109
110 pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC); 104 pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC);
111 if (!pwrst) 105 if (!pwrst)
112 return -ENOMEM; 106 return -ENOMEM;
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
index 2a791766283..250d909e38b 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ b/arch/arm/mach-omap2/pmu.c
@@ -15,8 +15,9 @@
15 15
16#include <asm/pmu.h> 16#include <asm/pmu.h>
17 17
18#include <plat/omap_hwmod.h> 18#include "soc.h"
19#include <plat/omap_device.h> 19#include "omap_hwmod.h"
20#include "omap_device.h"
20 21
21static char *omap2_pmu_oh_names[] = {"mpu"}; 22static char *omap2_pmu_oh_names[] = {"mpu"};
22static char *omap3_pmu_oh_names[] = {"mpu", "debugss"}; 23static char *omap3_pmu_oh_names[] = {"mpu", "debugss"};
@@ -57,8 +58,6 @@ static int __init omap2_init_pmu(unsigned oh_num, char *oh_names[])
57 if (IS_ERR(omap_pmu_dev)) 58 if (IS_ERR(omap_pmu_dev))
58 return PTR_ERR(omap_pmu_dev); 59 return PTR_ERR(omap_pmu_dev);
59 60
60 pm_runtime_enable(&omap_pmu_dev->dev);
61
62 return 0; 61 return 0;
63} 62}
64 63
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 1678a328423..dea62a9aad0 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -29,8 +29,6 @@
29 29
30#include <asm/cpu.h> 30#include <asm/cpu.h>
31 31
32#include <plat/prcm.h>
33
34#include "powerdomain.h" 32#include "powerdomain.h"
35#include "clockdomain.h" 33#include "clockdomain.h"
36 34
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index baee90608d1..5277d56eb37 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -22,8 +22,6 @@
22 22
23#include <linux/atomic.h> 23#include <linux/atomic.h>
24 24
25#include <plat/cpu.h>
26
27#include "voltage.h" 25#include "voltage.h"
28 26
29/* Powerdomain basic power states */ 27/* Powerdomain basic power states */
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
deleted file mode 100644
index 3950ccfe5f4..00000000000
--- a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
+++ /dev/null
@@ -1,242 +0,0 @@
1/*
2 * OMAP2 and OMAP3 powerdomain control
3 *
4 * Copyright (C) 2009-2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/io.h>
16#include <linux/errno.h>
17#include <linux/delay.h>
18#include <linux/bug.h>
19
20#include <plat/prcm.h>
21
22#include "powerdomain.h"
23#include "prm.h"
24#include "prm-regbits-24xx.h"
25#include "prm-regbits-34xx.h"
26
27
28/* Common functions across OMAP2 and OMAP3 */
29static int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
30{
31 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
32 (pwrst << OMAP_POWERSTATE_SHIFT),
33 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
34 return 0;
35}
36
37static int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
38{
39 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
40 OMAP2_PM_PWSTCTRL,
41 OMAP_POWERSTATE_MASK);
42}
43
44static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
45{
46 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
47 OMAP2_PM_PWSTST,
48 OMAP_POWERSTATEST_MASK);
49}
50
51static int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
52 u8 pwrst)
53{
54 u32 m;
55
56 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
57
58 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
59 OMAP2_PM_PWSTCTRL);
60
61 return 0;
62}
63
64static int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
65 u8 pwrst)
66{
67 u32 m;
68
69 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
70
71 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
72 OMAP2_PM_PWSTCTRL);
73
74 return 0;
75}
76
77static int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
78{
79 u32 m;
80
81 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
82
83 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
84 m);
85}
86
87static int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
88{
89 u32 m;
90
91 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
92
93 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
94 OMAP2_PM_PWSTCTRL, m);
95}
96
97static int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
98{
99 u32 v;
100
101 v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK);
102 omap2_prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v,
103 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
104
105 return 0;
106}
107
108static int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
109{
110 u32 c = 0;
111
112 /*
113 * REVISIT: pwrdm_wait_transition() may be better implemented
114 * via a callback and a periodic timer check -- how long do we expect
115 * powerdomain transitions to take?
116 */
117
118 /* XXX Is this udelay() value meaningful? */
119 while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
120 OMAP_INTRANSITION_MASK) &&
121 (c++ < PWRDM_TRANSITION_BAILOUT))
122 udelay(1);
123
124 if (c > PWRDM_TRANSITION_BAILOUT) {
125 pr_err("powerdomain: %s: waited too long to complete transition\n",
126 pwrdm->name);
127 return -EAGAIN;
128 }
129
130 pr_debug("powerdomain: completed transition in %d loops\n", c);
131
132 return 0;
133}
134
135/* Applicable only for OMAP3. Not supported on OMAP2 */
136static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
137{
138 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
139 OMAP3430_PM_PREPWSTST,
140 OMAP3430_LASTPOWERSTATEENTERED_MASK);
141}
142
143static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
144{
145 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
146 OMAP2_PM_PWSTST,
147 OMAP3430_LOGICSTATEST_MASK);
148}
149
150static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
151{
152 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
153 OMAP2_PM_PWSTCTRL,
154 OMAP3430_LOGICSTATEST_MASK);
155}
156
157static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
158{
159 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
160 OMAP3430_PM_PREPWSTST,
161 OMAP3430_LASTLOGICSTATEENTERED_MASK);
162}
163
164static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
165{
166 switch (bank) {
167 case 0:
168 return OMAP3430_LASTMEM1STATEENTERED_MASK;
169 case 1:
170 return OMAP3430_LASTMEM2STATEENTERED_MASK;
171 case 2:
172 return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
173 case 3:
174 return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
175 default:
176 WARN_ON(1); /* should never happen */
177 return -EEXIST;
178 }
179 return 0;
180}
181
182static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
183{
184 u32 m;
185
186 m = omap3_get_mem_bank_lastmemst_mask(bank);
187
188 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
189 OMAP3430_PM_PREPWSTST, m);
190}
191
192static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
193{
194 omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
195 return 0;
196}
197
198static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
199{
200 return omap2_prm_rmw_mod_reg_bits(0,
201 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
202 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
203}
204
205static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
206{
207 return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
208 0, pwrdm->prcm_offs,
209 OMAP2_PM_PWSTCTRL);
210}
211
212struct pwrdm_ops omap2_pwrdm_operations = {
213 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
214 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
215 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
216 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
217 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
218 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
219 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
220 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
221 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
222};
223
224struct pwrdm_ops omap3_pwrdm_operations = {
225 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
226 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
227 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
228 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst,
229 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
230 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
231 .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
232 .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst,
233 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
234 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
235 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
236 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
237 .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst,
238 .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst,
239 .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar,
240 .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
241 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
242};
diff --git a/arch/arm/mach-omap2/powerdomain33xx.c b/arch/arm/mach-omap2/powerdomain33xx.c
deleted file mode 100644
index 67c5663899b..00000000000
--- a/arch/arm/mach-omap2/powerdomain33xx.c
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * AM33XX Powerdomain control
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Derived from mach-omap2/powerdomain44xx.c written by Rajendra Nayak
7 * <rnayak@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/io.h>
20#include <linux/errno.h>
21#include <linux/delay.h>
22
23#include <plat/prcm.h>
24
25#include "powerdomain.h"
26#include "prm33xx.h"
27#include "prm-regbits-33xx.h"
28
29
30static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
31{
32 am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
33 (pwrst << OMAP_POWERSTATE_SHIFT),
34 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
35 return 0;
36}
37
38static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
39{
40 u32 v;
41
42 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
43 v &= OMAP_POWERSTATE_MASK;
44 v >>= OMAP_POWERSTATE_SHIFT;
45
46 return v;
47}
48
49static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
50{
51 u32 v;
52
53 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
54 v &= OMAP_POWERSTATEST_MASK;
55 v >>= OMAP_POWERSTATEST_SHIFT;
56
57 return v;
58}
59
60static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
61{
62 u32 v;
63
64 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
65 v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
66 v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
67
68 return v;
69}
70
71static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
72{
73 am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
74 (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
75 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
76 return 0;
77}
78
79static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
80{
81 am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
82 AM33XX_LASTPOWERSTATEENTERED_MASK,
83 pwrdm->prcm_offs, pwrdm->pwrstst_offs);
84 return 0;
85}
86
87static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
88{
89 u32 m;
90
91 m = pwrdm->logicretstate_mask;
92 if (!m)
93 return -EINVAL;
94
95 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
96 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
97
98 return 0;
99}
100
101static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
102{
103 u32 v;
104
105 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
106 v &= AM33XX_LOGICSTATEST_MASK;
107 v >>= AM33XX_LOGICSTATEST_SHIFT;
108
109 return v;
110}
111
112static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
113{
114 u32 v, m;
115
116 m = pwrdm->logicretstate_mask;
117 if (!m)
118 return -EINVAL;
119
120 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
121 v &= m;
122 v >>= __ffs(m);
123
124 return v;
125}
126
127static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
128 u8 pwrst)
129{
130 u32 m;
131
132 m = pwrdm->mem_on_mask[bank];
133 if (!m)
134 return -EINVAL;
135
136 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
137 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
138
139 return 0;
140}
141
142static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
143 u8 pwrst)
144{
145 u32 m;
146
147 m = pwrdm->mem_ret_mask[bank];
148 if (!m)
149 return -EINVAL;
150
151 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
152 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
153
154 return 0;
155}
156
157static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
158{
159 u32 m, v;
160
161 m = pwrdm->mem_pwrst_mask[bank];
162 if (!m)
163 return -EINVAL;
164
165 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
166 v &= m;
167 v >>= __ffs(m);
168
169 return v;
170}
171
172static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
173{
174 u32 m, v;
175
176 m = pwrdm->mem_retst_mask[bank];
177 if (!m)
178 return -EINVAL;
179
180 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
181 v &= m;
182 v >>= __ffs(m);
183
184 return v;
185}
186
187static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
188{
189 u32 c = 0;
190
191 /*
192 * REVISIT: pwrdm_wait_transition() may be better implemented
193 * via a callback and a periodic timer check -- how long do we expect
194 * powerdomain transitions to take?
195 */
196
197 /* XXX Is this udelay() value meaningful? */
198 while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
199 & OMAP_INTRANSITION_MASK) &&
200 (c++ < PWRDM_TRANSITION_BAILOUT))
201 udelay(1);
202
203 if (c > PWRDM_TRANSITION_BAILOUT) {
204 pr_err("powerdomain: %s: waited too long to complete transition\n",
205 pwrdm->name);
206 return -EAGAIN;
207 }
208
209 pr_debug("powerdomain: completed transition in %d loops\n", c);
210
211 return 0;
212}
213
214struct pwrdm_ops am33xx_pwrdm_operations = {
215 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
216 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
217 .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst,
218 .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst,
219 .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst,
220 .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst,
221 .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst,
222 .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst,
223 .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange,
224 .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst,
225 .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst,
226 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst,
227 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
228 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
229};
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
deleted file mode 100644
index aceb4f464c9..00000000000
--- a/arch/arm/mach-omap2/powerdomain44xx.c
+++ /dev/null
@@ -1,285 +0,0 @@
1/*
2 * OMAP4 powerdomain control
3 *
4 * Copyright (C) 2009-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/io.h>
16#include <linux/errno.h>
17#include <linux/delay.h>
18#include <linux/bug.h>
19
20#include "powerdomain.h"
21#include <plat/prcm.h>
22#include "prm2xxx_3xxx.h"
23#include "prm44xx.h"
24#include "prminst44xx.h"
25#include "prm-regbits-44xx.h"
26
27static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
28{
29 omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
30 (pwrst << OMAP_POWERSTATE_SHIFT),
31 pwrdm->prcm_partition,
32 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
33 return 0;
34}
35
36static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
37{
38 u32 v;
39
40 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
41 OMAP4_PM_PWSTCTRL);
42 v &= OMAP_POWERSTATE_MASK;
43 v >>= OMAP_POWERSTATE_SHIFT;
44
45 return v;
46}
47
48static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
49{
50 u32 v;
51
52 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
53 OMAP4_PM_PWSTST);
54 v &= OMAP_POWERSTATEST_MASK;
55 v >>= OMAP_POWERSTATEST_SHIFT;
56
57 return v;
58}
59
60static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
61{
62 u32 v;
63
64 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
65 OMAP4_PM_PWSTST);
66 v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
67 v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
68
69 return v;
70}
71
72static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
73{
74 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
75 (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
76 pwrdm->prcm_partition,
77 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
78 return 0;
79}
80
81static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
82{
83 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
84 OMAP4430_LASTPOWERSTATEENTERED_MASK,
85 pwrdm->prcm_partition,
86 pwrdm->prcm_offs, OMAP4_PM_PWSTST);
87 return 0;
88}
89
90static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
91{
92 u32 v;
93
94 v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
95 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
96 pwrdm->prcm_partition, pwrdm->prcm_offs,
97 OMAP4_PM_PWSTCTRL);
98
99 return 0;
100}
101
102static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
103 u8 pwrst)
104{
105 u32 m;
106
107 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
108
109 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
110 pwrdm->prcm_partition, pwrdm->prcm_offs,
111 OMAP4_PM_PWSTCTRL);
112
113 return 0;
114}
115
116static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
117 u8 pwrst)
118{
119 u32 m;
120
121 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
122
123 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
124 pwrdm->prcm_partition, pwrdm->prcm_offs,
125 OMAP4_PM_PWSTCTRL);
126
127 return 0;
128}
129
130static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
131{
132 u32 v;
133
134 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
135 OMAP4_PM_PWSTST);
136 v &= OMAP4430_LOGICSTATEST_MASK;
137 v >>= OMAP4430_LOGICSTATEST_SHIFT;
138
139 return v;
140}
141
142static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
143{
144 u32 v;
145
146 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
147 OMAP4_PM_PWSTCTRL);
148 v &= OMAP4430_LOGICRETSTATE_MASK;
149 v >>= OMAP4430_LOGICRETSTATE_SHIFT;
150
151 return v;
152}
153
154/**
155 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
156 * @pwrdm: struct powerdomain * to read the state for
157 *
158 * Reads the previous logic powerstate for a powerdomain. This
159 * function must determine the previous logic powerstate by first
160 * checking the previous powerstate for the domain. If that was OFF,
161 * then logic has been lost. If previous state was RETENTION, the
162 * function reads the setting for the next retention logic state to
163 * see the actual value. In every other case, the logic is
164 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
165 * depending whether the logic was retained or not.
166 */
167static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
168{
169 int state;
170
171 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
172
173 if (state == PWRDM_POWER_OFF)
174 return PWRDM_POWER_OFF;
175
176 if (state != PWRDM_POWER_RET)
177 return PWRDM_POWER_RET;
178
179 return omap4_pwrdm_read_logic_retst(pwrdm);
180}
181
182static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
183{
184 u32 m, v;
185
186 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
187
188 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
189 OMAP4_PM_PWSTST);
190 v &= m;
191 v >>= __ffs(m);
192
193 return v;
194}
195
196static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
197{
198 u32 m, v;
199
200 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
201
202 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
203 OMAP4_PM_PWSTCTRL);
204 v &= m;
205 v >>= __ffs(m);
206
207 return v;
208}
209
210/**
211 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
212 * @pwrdm: struct powerdomain * to read mem powerstate for
213 * @bank: memory bank index
214 *
215 * Reads the previous memory powerstate for a powerdomain. This
216 * function must determine the previous memory powerstate by first
217 * checking the previous powerstate for the domain. If that was OFF,
218 * then logic has been lost. If previous state was RETENTION, the
219 * function reads the setting for the next memory retention state to
220 * see the actual value. In every other case, the logic is
221 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
222 * depending whether logic was retained or not.
223 */
224static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
225{
226 int state;
227
228 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
229
230 if (state == PWRDM_POWER_OFF)
231 return PWRDM_POWER_OFF;
232
233 if (state != PWRDM_POWER_RET)
234 return PWRDM_POWER_RET;
235
236 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
237}
238
239static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
240{
241 u32 c = 0;
242
243 /*
244 * REVISIT: pwrdm_wait_transition() may be better implemented
245 * via a callback and a periodic timer check -- how long do we expect
246 * powerdomain transitions to take?
247 */
248
249 /* XXX Is this udelay() value meaningful? */
250 while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
251 pwrdm->prcm_offs,
252 OMAP4_PM_PWSTST) &
253 OMAP_INTRANSITION_MASK) &&
254 (c++ < PWRDM_TRANSITION_BAILOUT))
255 udelay(1);
256
257 if (c > PWRDM_TRANSITION_BAILOUT) {
258 pr_err("powerdomain: %s: waited too long to complete transition\n",
259 pwrdm->name);
260 return -EAGAIN;
261 }
262
263 pr_debug("powerdomain: completed transition in %d loops\n", c);
264
265 return 0;
266}
267
268struct pwrdm_ops omap4_pwrdm_operations = {
269 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst,
270 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst,
271 .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst,
272 .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst,
273 .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange,
274 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
275 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
276 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
277 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
278 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
279 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
280 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
281 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
282 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
283 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
284 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
285};
diff --git a/arch/arm/mach-omap2/powerdomains2xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_data.c
index 2385c1f009e..ba520d4f7c7 100644
--- a/arch/arm/mach-omap2/powerdomains2xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains2xxx_data.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include "soc.h"
17#include "powerdomain.h" 18#include "powerdomain.h"
18#include "powerdomains2xxx_3xxx_data.h" 19#include "powerdomains2xxx_3xxx_data.h"
19 20
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 72df97482cc..c7d355fafd2 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -406,11 +406,6 @@
406#define OMAP3430_EN_CORE_MASK (1 << 0) 406#define OMAP3430_EN_CORE_MASK (1 << 0)
407 407
408 408
409/*
410 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
411 * submodule to exit hardreset
412 */
413#define MAX_MODULE_HARDRESET_WAIT 10000
414 409
415/* 410/*
416 * Maximum time(us) it takes to output the signal WUCLKOUT of the last 411 * Maximum time(us) it takes to output the signal WUCLKOUT of the last
@@ -419,24 +414,7 @@
419 * microseconds on OMAP4, so this timeout may be too high. 414 * microseconds on OMAP4, so this timeout may be too high.
420 */ 415 */
421#define MAX_IOPAD_LATCH_TIME 100 416#define MAX_IOPAD_LATCH_TIME 100
422
423# ifndef __ASSEMBLER__ 417# ifndef __ASSEMBLER__
424extern void __iomem *prm_base;
425extern void __iomem *cm_base;
426extern void __iomem *cm2_base;
427extern void __iomem *prcm_mpu_base;
428
429#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
430extern void omap_prm_base_init(void);
431extern void omap_cm_base_init(void);
432#else
433static inline void omap_prm_base_init(void)
434{
435}
436static inline void omap_cm_base_init(void)
437{
438}
439#endif
440 418
441/** 419/**
442 * struct omap_prcm_irq - describes a PRCM interrupt bit 420 * struct omap_prcm_irq - describes a PRCM interrupt bit
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
deleted file mode 100644
index 0f51e034e0a..00000000000
--- a/arch/arm/mach-omap2/prcm.c
+++ /dev/null
@@ -1,188 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/prcm.c
3 *
4 * OMAP 24xx Power Reset and Clock Management (PRCM) functions
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Copyright (C) 2007 Texas Instruments, Inc.
11 * Rajendra Nayak <rnayak@ti.com>
12 *
13 * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
14 * Upgraded with OMAP4 support by Abhijit Pagare <abhijitpagare@ti.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25#include <linux/delay.h>
26#include <linux/export.h>
27
28#include "common.h"
29#include <plat/prcm.h>
30
31#include "clock.h"
32#include "clock2xxx.h"
33#include "cm2xxx_3xxx.h"
34#include "prm2xxx_3xxx.h"
35#include "prm44xx.h"
36#include "prminst44xx.h"
37#include "cminst44xx.h"
38#include "prm-regbits-24xx.h"
39#include "prm-regbits-44xx.h"
40#include "control.h"
41
42void __iomem *prm_base;
43void __iomem *cm_base;
44void __iomem *cm2_base;
45void __iomem *prcm_mpu_base;
46
47#define MAX_MODULE_ENABLE_WAIT 100000
48
49u32 omap_prcm_get_reset_sources(void)
50{
51 /* XXX This presumably needs modification for 34XX */
52 if (cpu_is_omap24xx() || cpu_is_omap34xx())
53 return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
54 if (cpu_is_omap44xx())
55 return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
56
57 return 0;
58}
59EXPORT_SYMBOL(omap_prcm_get_reset_sources);
60
61/* Resets clock rates and reboots the system. Only called from system.h */
62void omap_prcm_restart(char mode, const char *cmd)
63{
64 s16 prcm_offs = 0;
65
66 if (cpu_is_omap24xx()) {
67 omap2xxx_clk_prepare_for_reboot();
68
69 prcm_offs = WKUP_MOD;
70 } else if (cpu_is_omap34xx()) {
71 prcm_offs = OMAP3430_GR_MOD;
72 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
73 } else if (cpu_is_omap44xx()) {
74 omap4_prminst_global_warm_sw_reset(); /* never returns */
75 } else {
76 WARN_ON(1);
77 }
78
79 /*
80 * As per Errata i520, in some cases, user will not be able to
81 * access DDR memory after warm-reset.
82 * This situation occurs while the warm-reset happens during a read
83 * access to DDR memory. In that particular condition, DDR memory
84 * does not respond to a corrupted read command due to the warm
85 * reset occurrence but SDRC is waiting for read completion.
86 * SDRC is not sensitive to the warm reset, but the interconnect is
87 * reset on the fly, thus causing a misalignment between SDRC logic,
88 * interconnect logic and DDR memory state.
89 * WORKAROUND:
90 * Steps to perform before a Warm reset is trigged:
91 * 1. enable self-refresh on idle request
92 * 2. put SDRC in idle
93 * 3. wait until SDRC goes to idle
94 * 4. generate SW reset (Global SW reset)
95 *
96 * Steps to be performed after warm reset occurs (in bootloader):
97 * if HW warm reset is the source, apply below steps before any
98 * accesses to SDRAM:
99 * 1. Reset SMS and SDRC and wait till reset is complete
100 * 2. Re-initialize SMS, SDRC and memory
101 *
102 * NOTE: Above work around is required only if arch reset is implemented
103 * using Global SW reset(GLOBAL_SW_RST). DPLL3 reset does not need
104 * the WA since it resets SDRC as well as part of cold reset.
105 */
106
107 /* XXX should be moved to some OMAP2/3 specific code */
108 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
109 OMAP2_RM_RSTCTRL);
110 omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
111}
112
113/**
114 * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
115 * @reg: physical address of module IDLEST register
116 * @mask: value to mask against to determine if the module is active
117 * @idlest: idle state indicator (0 or 1) for the clock
118 * @name: name of the clock (for printk)
119 *
120 * Returns 1 if the module indicated readiness in time, or 0 if it
121 * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds.
122 *
123 * XXX This function is deprecated. It should be removed once the
124 * hwmod conversion is complete.
125 */
126int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
127 const char *name)
128{
129 int i = 0;
130 int ena = 0;
131
132 if (idlest)
133 ena = 0;
134 else
135 ena = mask;
136
137 /* Wait for lock */
138 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
139 MAX_MODULE_ENABLE_WAIT, i);
140
141 if (i < MAX_MODULE_ENABLE_WAIT)
142 pr_debug("cm: Module associated with clock %s ready after %d loops\n",
143 name, i);
144 else
145 pr_err("cm: Module associated with clock %s didn't enable in %d tries\n",
146 name, MAX_MODULE_ENABLE_WAIT);
147
148 return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
149};
150
151void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
152{
153 if (omap2_globals->prm)
154 prm_base = omap2_globals->prm;
155 if (omap2_globals->cm)
156 cm_base = omap2_globals->cm;
157 if (omap2_globals->cm2)
158 cm2_base = omap2_globals->cm2;
159 if (omap2_globals->prcm_mpu)
160 prcm_mpu_base = omap2_globals->prcm_mpu;
161
162 if (cpu_is_omap44xx() || soc_is_omap54xx()) {
163 omap_prm_base_init();
164 omap_cm_base_init();
165 }
166}
167
168/*
169 * Stubbed functions so that common files continue to build when
170 * custom builds are used
171 * XXX These are temporary and should be removed at the earliest possible
172 * opportunity
173 */
174int __weak omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
175 u16 clkctrl_offs)
176{
177 return 0;
178}
179
180void __weak omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
181 s16 cdoffs, u16 clkctrl_offs)
182{
183}
184
185void __weak omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
186 u16 clkctrl_offs)
187{
188}
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.c b/arch/arm/mach-omap2/prcm_mpu44xx.c
index 928dbd4f20e..c30e44a7fab 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.c
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.c
@@ -20,6 +20,12 @@
20#include "prcm_mpu44xx.h" 20#include "prcm_mpu44xx.h"
21#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
22 22
23/*
24 * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
25 * block registers
26 */
27void __iomem *prcm_mpu_base;
28
23/* PRCM_MPU low-level functions */ 29/* PRCM_MPU low-level functions */
24 30
25u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 31u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
@@ -43,3 +49,14 @@ u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
43 49
44 return v; 50 return v;
45} 51}
52
53/**
54 * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
55 * @prcm_mpu: PRCM_MPU base virtual address
56 *
57 * XXX Will be replaced when the PRM/CM drivers are completed.
58 */
59void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
60{
61 prcm_mpu_base = prcm_mpu;
62}
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 8a6e250f04b..884af7bb4af 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP44xx PRCM MPU instance offset macros 2 * OMAP44xx PRCM MPU instance offset macros
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments, Inc. 4 * Copyright (C) 2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley (paul@pwsan.com) 7 * Paul Walmsley (paul@pwsan.com)
@@ -25,6 +25,12 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27
28#include "common.h"
29
30# ifndef __ASSEMBLER__
31extern void __iomem *prcm_mpu_base;
32# endif
33
28#define OMAP4430_PRCM_MPU_BASE 0x48243000 34#define OMAP4430_PRCM_MPU_BASE 0x48243000
29 35
30#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \ 36#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \
@@ -98,6 +104,7 @@ extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
98extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx); 104extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
99extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, 105extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
100 s16 idx); 106 s16 idx);
107extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu);
101# endif 108# endif
102 109
103#endif 110#endif
diff --git a/arch/arm/mach-omap2/prm-regbits-24xx.h b/arch/arm/mach-omap2/prm-regbits-24xx.h
index 6ac966103f3..91aa5106d63 100644
--- a/arch/arm/mach-omap2/prm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-24xx.h
@@ -14,7 +14,7 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#include "prm2xxx_3xxx.h" 17#include "prm2xxx.h"
18 18
19/* Bits shared between registers */ 19/* Bits shared between registers */
20 20
@@ -107,12 +107,14 @@
107#define OMAP2420_CLKOUT2_EN_MASK (1 << 15) 107#define OMAP2420_CLKOUT2_EN_MASK (1 << 15)
108#define OMAP2420_CLKOUT2_DIV_SHIFT 11 108#define OMAP2420_CLKOUT2_DIV_SHIFT 11
109#define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11) 109#define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11)
110#define OMAP2420_CLKOUT2_DIV_WIDTH 3
110#define OMAP2420_CLKOUT2_SOURCE_SHIFT 8 111#define OMAP2420_CLKOUT2_SOURCE_SHIFT 8
111#define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8) 112#define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8)
112#define OMAP24XX_CLKOUT_EN_SHIFT 7 113#define OMAP24XX_CLKOUT_EN_SHIFT 7
113#define OMAP24XX_CLKOUT_EN_MASK (1 << 7) 114#define OMAP24XX_CLKOUT_EN_MASK (1 << 7)
114#define OMAP24XX_CLKOUT_DIV_SHIFT 3 115#define OMAP24XX_CLKOUT_DIV_SHIFT 3
115#define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3) 116#define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3)
117#define OMAP24XX_CLKOUT_DIV_WIDTH 3
116#define OMAP24XX_CLKOUT_SOURCE_SHIFT 0 118#define OMAP24XX_CLKOUT_SOURCE_SHIFT 0
117#define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0) 119#define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0)
118 120
@@ -209,9 +211,13 @@
209 211
210/* RM_RSTST_WKUP specific bits */ 212/* RM_RSTST_WKUP specific bits */
211/* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */ 213/* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */
214#define OMAP24XX_EXTWMPU_RST_SHIFT 6
212#define OMAP24XX_EXTWMPU_RST_MASK (1 << 6) 215#define OMAP24XX_EXTWMPU_RST_MASK (1 << 6)
216#define OMAP24XX_SECU_WD_RST_SHIFT 5
213#define OMAP24XX_SECU_WD_RST_MASK (1 << 5) 217#define OMAP24XX_SECU_WD_RST_MASK (1 << 5)
218#define OMAP24XX_MPU_WD_RST_SHIFT 4
214#define OMAP24XX_MPU_WD_RST_MASK (1 << 4) 219#define OMAP24XX_MPU_WD_RST_MASK (1 << 4)
220#define OMAP24XX_SECU_VIOL_RST_SHIFT 3
215#define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3) 221#define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3)
216 222
217/* PM_WKEN_WKUP specific bits */ 223/* PM_WKEN_WKUP specific bits */
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index 64c087af6a8..b0a2142eeb9 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -14,7 +14,7 @@
14#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H 14#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H
15 15
16 16
17#include "prm2xxx_3xxx.h" 17#include "prm3xxx.h"
18 18
19/* Shared register bits */ 19/* Shared register bits */
20 20
@@ -384,6 +384,7 @@
384/* PRM_CLKSEL */ 384/* PRM_CLKSEL */
385#define OMAP3430_SYS_CLKIN_SEL_SHIFT 0 385#define OMAP3430_SYS_CLKIN_SEL_SHIFT 0
386#define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0) 386#define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0)
387#define OMAP3430_SYS_CLKIN_SEL_WIDTH 3
387 388
388/* PRM_CLKOUT_CTRL */ 389/* PRM_CLKOUT_CTRL */
389#define OMAP3430_CLKOUT_EN_MASK (1 << 7) 390#define OMAP3430_CLKOUT_EN_MASK (1 << 7)
@@ -509,15 +510,25 @@
509#define OMAP3430_RSTTIME1_MASK (0xff << 0) 510#define OMAP3430_RSTTIME1_MASK (0xff << 0)
510 511
511/* PRM_RSTST */ 512/* PRM_RSTST */
513#define OMAP3430_ICECRUSHER_RST_SHIFT 10
512#define OMAP3430_ICECRUSHER_RST_MASK (1 << 10) 514#define OMAP3430_ICECRUSHER_RST_MASK (1 << 10)
515#define OMAP3430_ICEPICK_RST_SHIFT 9
513#define OMAP3430_ICEPICK_RST_MASK (1 << 9) 516#define OMAP3430_ICEPICK_RST_MASK (1 << 9)
517#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT 8
514#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8) 518#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8)
519#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT 7
515#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7) 520#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7)
521#define OMAP3430_EXTERNAL_WARM_RST_SHIFT 6
516#define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6) 522#define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6)
523#define OMAP3430_SECURE_WD_RST_SHIFT 5
517#define OMAP3430_SECURE_WD_RST_MASK (1 << 5) 524#define OMAP3430_SECURE_WD_RST_MASK (1 << 5)
525#define OMAP3430_MPU_WD_RST_SHIFT 4
518#define OMAP3430_MPU_WD_RST_MASK (1 << 4) 526#define OMAP3430_MPU_WD_RST_MASK (1 << 4)
527#define OMAP3430_SECURITY_VIOL_RST_SHIFT 3
519#define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3) 528#define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3)
529#define OMAP3430_GLOBAL_SW_RST_SHIFT 1
520#define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1) 530#define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1)
531#define OMAP3430_GLOBAL_COLD_RST_SHIFT 0
521#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0) 532#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0)
522 533
523/* PRM_VOLTCTRL */ 534/* PRM_VOLTCTRL */
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 39d562169d1..ac25ae6667c 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions 2 * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley 7 * Paul Walmsley
@@ -15,6 +15,28 @@
15 15
16#include "prcm-common.h" 16#include "prcm-common.h"
17 17
18# ifndef __ASSEMBLER__
19extern void __iomem *prm_base;
20extern void omap2_set_globals_prm(void __iomem *prm);
21# endif
22
23
24/*
25 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
26 * module to softreset
27 */
28#define MAX_MODULE_SOFTRESET_WAIT 10000
29
30/*
31 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
32 * submodule to exit hardreset
33 */
34#define MAX_MODULE_HARDRESET_WAIT 10000
35
36/*
37 * Register bitfields
38 */
39
18/* 40/*
19 * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP 41 * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP
20 * 42 *
@@ -52,5 +74,67 @@
52#define OMAP_POWERSTATE_SHIFT 0 74#define OMAP_POWERSTATE_SHIFT 0
53#define OMAP_POWERSTATE_MASK (0x3 << 0) 75#define OMAP_POWERSTATE_MASK (0x3 << 0)
54 76
77/*
78 * Standardized OMAP reset source bits
79 *
80 * To the extent these happen to match the hardware register bit
81 * shifts, it's purely coincidental. Used by omap-wdt.c.
82 * OMAP_UNKNOWN_RST_SRC_ID_SHIFT is a special value, used whenever
83 * there are any bits remaining in the global PRM_RSTST register that
84 * haven't been identified, or when the PRM code for the current SoC
85 * doesn't know how to interpret the register.
86 */
87#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
88#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
89#define OMAP_SECU_VIOL_RST_SRC_ID_SHIFT 2
90#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
91#define OMAP_SECU_WD_RST_SRC_ID_SHIFT 4
92#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
93#define OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT 6
94#define OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT 7
95#define OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT 8
96#define OMAP_ICEPICK_RST_SRC_ID_SHIFT 9
97#define OMAP_ICECRUSHER_RST_SRC_ID_SHIFT 10
98#define OMAP_C2C_RST_SRC_ID_SHIFT 11
99#define OMAP_UNKNOWN_RST_SRC_ID_SHIFT 12
100
101#ifndef __ASSEMBLER__
102
103/**
104 * struct prm_reset_src_map - map register bitshifts to standard bitshifts
105 * @reg_shift: bitshift in the PRM reset source register
106 * @std_shift: bitshift equivalent in the standard reset source list
107 *
108 * The fields are signed because -1 is used as a terminator.
109 */
110struct prm_reset_src_map {
111 s8 reg_shift;
112 s8 std_shift;
113};
114
115/**
116 * struct prm_ll_data - fn ptrs to per-SoC PRM function implementations
117 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl
118 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
119 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
120 *
121 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
122 * deprecated.
123 */
124struct prm_ll_data {
125 u32 (*read_reset_sources)(void);
126 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
127 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
128};
129
130extern int prm_register(struct prm_ll_data *pld);
131extern int prm_unregister(struct prm_ll_data *pld);
132
133extern u32 prm_read_reset_sources(void);
134extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx);
135extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);
136
137#endif
138
55 139
56#endif 140#endif
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
new file mode 100644
index 00000000000..faeab18696d
--- /dev/null
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -0,0 +1,138 @@
1/*
2 * OMAP2xxx PRM module functions
3 *
4 * Copyright (C) 2010-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson
7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20
21#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h"
25#include "powerdomain.h"
26#include "clockdomain.h"
27#include "prm2xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm-regbits-24xx.h"
30
31/*
32 * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP
33 * hardware register (which are specific to the OMAP2xxx SoCs) to
34 * reset source ID bit shifts (which is an OMAP SoC-independent
35 * enumeration)
36 */
37static struct prm_reset_src_map omap2xxx_prm_reset_src_map[] = {
38 { OMAP_GLOBALCOLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
39 { OMAP_GLOBALWARM_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
40 { OMAP24XX_SECU_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
41 { OMAP24XX_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
42 { OMAP24XX_SECU_WD_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
43 { OMAP24XX_EXTWMPU_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
44 { -1, -1 },
45};
46
47/**
48 * omap2xxx_prm_read_reset_sources - return the last SoC reset source
49 *
50 * Return a u32 representing the last reset sources of the SoC. The
51 * returned reset source bits are standardized across OMAP SoCs.
52 */
53static u32 omap2xxx_prm_read_reset_sources(void)
54{
55 struct prm_reset_src_map *p;
56 u32 r = 0;
57 u32 v;
58
59 v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
60
61 p = omap2xxx_prm_reset_src_map;
62 while (p->reg_shift >= 0 && p->std_shift >= 0) {
63 if (v & (1 << p->reg_shift))
64 r |= 1 << p->std_shift;
65 p++;
66 }
67
68 return r;
69}
70
71/**
72 * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC
73 *
74 * Set the DPLL reset bit, which should reboot the SoC. This is the
75 * recommended way to restart the SoC. No return value.
76 */
77void omap2xxx_prm_dpll_reset(void)
78{
79 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD,
80 OMAP2_RM_RSTCTRL);
81 /* OCP barrier */
82 omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTCTRL);
83}
84
85int omap2xxx_clkdm_sleep(struct clockdomain *clkdm)
86{
87 omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
88 clkdm->pwrdm.ptr->prcm_offs,
89 OMAP2_PM_PWSTCTRL);
90 return 0;
91}
92
93int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm)
94{
95 omap2_prm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
96 clkdm->pwrdm.ptr->prcm_offs,
97 OMAP2_PM_PWSTCTRL);
98 return 0;
99}
100
101struct pwrdm_ops omap2_pwrdm_operations = {
102 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
103 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
104 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
105 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
106 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
107 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
108 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
109 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
110 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
111};
112
113/*
114 *
115 */
116
117static struct prm_ll_data omap2xxx_prm_ll_data = {
118 .read_reset_sources = &omap2xxx_prm_read_reset_sources,
119};
120
121int __init omap2xxx_prm_init(void)
122{
123 if (!cpu_is_omap24xx())
124 return 0;
125
126 return prm_register(&omap2xxx_prm_ll_data);
127}
128
129static void __exit omap2xxx_prm_exit(void)
130{
131 if (!cpu_is_omap24xx())
132 return;
133
134 /* Should never happen */
135 WARN(prm_unregister(&omap2xxx_prm_ll_data),
136 "%s: prm_ll_data function pointer mismatch\n", __func__);
137}
138__exitcall(omap2xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
new file mode 100644
index 00000000000..3194dd87e0e
--- /dev/null
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -0,0 +1,133 @@
1/*
2 * OMAP2xxx Power/Reset Management (PRM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The PRM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The PRM on OMAP4 has a new register layout, and is handled
14 * in a separate file.
15 */
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21#include "prm2xxx_3xxx.h"
22
23#define OMAP2420_PRM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
25#define OMAP2430_PRM_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
27
28/*
29 * OMAP2-specific global PRM registers
30 * Use __raw_{read,write}l() with these registers.
31 *
32 * With a few exceptions, these are the register names beginning with
33 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
34 * bits.)
35 *
36 */
37
38#define OMAP2_PRCM_REVISION_OFFSET 0x0000
39#define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
40#define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010
41#define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
42
43#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018
44#define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
45#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c
46#define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
47
48#define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050
49#define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
50#define OMAP2_PRCM_VOLTST_OFFSET 0x0054
51#define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
52#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060
53#define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
54#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070
55#define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
56#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
57#define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
58#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080
59#define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
60#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084
61#define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
62#define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090
63#define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
64#define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094
65#define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
66#define OMAP2_PRCM_POLCTRL_OFFSET 0x0098
67#define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
68
69#define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
70#define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
71
72#define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
73#define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
74
75#define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
76#define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
77#define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
78#define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
79#define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
80#define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
81#define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
82#define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
83#define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
84#define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
85
86/*
87 * Module specific PRM register offsets from PRM_BASE + domain offset
88 *
89 * Use prm_{read,write}_mod_reg() with these registers.
90 *
91 * With a few exceptions, these are the register names beginning with
92 * {PM,RM}_* on both OMAP2/3 SoC families.. (The exceptions are the
93 * IRQSTATUS and IRQENABLE bits.)
94 */
95
96/* Register offsets appearing on both OMAP2 and OMAP3 */
97
98#define OMAP2_RM_RSTCTRL 0x0050
99#define OMAP2_RM_RSTTIME 0x0054
100#define OMAP2_RM_RSTST 0x0058
101#define OMAP2_PM_PWSTCTRL 0x00e0
102#define OMAP2_PM_PWSTST 0x00e4
103
104#define PM_WKEN 0x00a0
105#define PM_WKEN1 PM_WKEN
106#define PM_WKST 0x00b0
107#define PM_WKST1 PM_WKST
108#define PM_WKDEP 0x00c8
109#define PM_EVGENCTRL 0x00d4
110#define PM_EVGENONTIM 0x00d8
111#define PM_EVGENOFFTIM 0x00dc
112
113/* OMAP2xxx specific register offsets */
114#define OMAP24XX_PM_WKEN2 0x00a4
115#define OMAP24XX_PM_WKST2 0x00b4
116
117#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */
118#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */
119#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8
120#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc
121
122#ifndef __ASSEMBLER__
123/* Function prototypes */
124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm);
125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm);
126
127extern void omap2xxx_prm_dpll_reset(void);
128
129extern int __init omap2xxx_prm_init(void);
130
131#endif
132
133#endif
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 9529984d8d2..30517f5af70 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -15,82 +15,12 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/irq.h>
19 18
20#include <plat/prcm.h>
21
22#include "soc.h"
23#include "common.h" 19#include "common.h"
24#include "vp.h" 20#include "powerdomain.h"
25
26#include "prm2xxx_3xxx.h" 21#include "prm2xxx_3xxx.h"
27#include "cm2xxx_3xxx.h"
28#include "prm-regbits-24xx.h" 22#include "prm-regbits-24xx.h"
29#include "prm-regbits-34xx.h" 23#include "clockdomain.h"
30
31static const struct omap_prcm_irq omap3_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0),
33 OMAP_PRCM_IRQ("io", 9, 1),
34};
35
36static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
37 .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
38 .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
39 .nr_regs = 1,
40 .irqs = omap3_prcm_irqs,
41 .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs),
42 .irq = 11 + OMAP_INTC_START,
43 .read_pending_irqs = &omap3xxx_prm_read_pending_irqs,
44 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
45 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
46 .restore_irqen = &omap3xxx_prm_restore_irqen,
47};
48
49u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
50{
51 return __raw_readl(prm_base + module + idx);
52}
53
54void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
55{
56 __raw_writel(val, prm_base + module + idx);
57}
58
59/* Read-modify-write a register in a PRM module. Caller must lock */
60u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
61{
62 u32 v;
63
64 v = omap2_prm_read_mod_reg(module, idx);
65 v &= ~mask;
66 v |= bits;
67 omap2_prm_write_mod_reg(v, module, idx);
68
69 return v;
70}
71
72/* Read a PRM register, AND it, and shift the result down to bit 0 */
73u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
74{
75 u32 v;
76
77 v = omap2_prm_read_mod_reg(domain, idx);
78 v &= mask;
79 v >>= __ffs(mask);
80
81 return v;
82}
83
84u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
85{
86 return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
87}
88
89u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
90{
91 return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
92}
93
94 24
95/** 25/**
96 * omap2_prm_is_hardreset_asserted - read the HW reset line state of 26 * omap2_prm_is_hardreset_asserted - read the HW reset line state of
@@ -104,9 +34,6 @@ u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
104 */ 34 */
105int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) 35int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
106{ 36{
107 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
108 return -EINVAL;
109
110 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, 37 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL,
111 (1 << shift)); 38 (1 << shift));
112} 39}
@@ -127,9 +54,6 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
127{ 54{
128 u32 mask; 55 u32 mask;
129 56
130 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
131 return -EINVAL;
132
133 mask = 1 << shift; 57 mask = 1 << shift;
134 omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL); 58 omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL);
135 59
@@ -156,9 +80,6 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
156 u32 rst, st; 80 u32 rst, st;
157 int c; 81 int c;
158 82
159 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
160 return -EINVAL;
161
162 rst = 1 << rst_shift; 83 rst = 1 << rst_shift;
163 st = 1 << st_shift; 84 st = 1 << st_shift;
164 85
@@ -178,188 +99,155 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
178 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 99 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
179} 100}
180 101
181/* PRM VP */
182
183/*
184 * struct omap3_vp - OMAP3 VP register access description.
185 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
186 */
187struct omap3_vp {
188 u32 tranxdone_status;
189};
190
191static struct omap3_vp omap3_vp[] = {
192 [OMAP3_VP_VDD_MPU_ID] = {
193 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
194 },
195 [OMAP3_VP_VDD_CORE_ID] = {
196 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
197 },
198};
199
200#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
201
202u32 omap3_prm_vp_check_txdone(u8 vp_id)
203{
204 struct omap3_vp *vp = &omap3_vp[vp_id];
205 u32 irqstatus;
206 102
207 irqstatus = omap2_prm_read_mod_reg(OCP_MOD, 103/* Powerdomain low-level functions */
208 OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
209 return irqstatus & vp->tranxdone_status;
210}
211 104
212void omap3_prm_vp_clear_txdone(u8 vp_id) 105/* Common functions across OMAP2 and OMAP3 */
106int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
213{ 107{
214 struct omap3_vp *vp = &omap3_vp[vp_id]; 108 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
215 109 (pwrst << OMAP_POWERSTATE_SHIFT),
216 omap2_prm_write_mod_reg(vp->tranxdone_status, 110 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
217 OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); 111 return 0;
218} 112}
219 113
220u32 omap3_prm_vcvp_read(u8 offset) 114int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
221{ 115{
222 return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset); 116 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
117 OMAP2_PM_PWSTCTRL,
118 OMAP_POWERSTATE_MASK);
223} 119}
224 120
225void omap3_prm_vcvp_write(u32 val, u8 offset) 121int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
226{ 122{
227 omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset); 123 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
124 OMAP2_PM_PWSTST,
125 OMAP_POWERSTATEST_MASK);
228} 126}
229 127
230u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) 128int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
129 u8 pwrst)
231{ 130{
232 return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset); 131 u32 m;
132
133 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
134
135 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
136 OMAP2_PM_PWSTCTRL);
137
138 return 0;
233} 139}
234 140
235/** 141int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
236 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events 142 u8 pwrst)
237 * @events: ptr to a u32, preallocated by caller
238 *
239 * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
240 * MPU IRQs, and store the result into the u32 pointed to by @events.
241 * No return value.
242 */
243void omap3xxx_prm_read_pending_irqs(unsigned long *events)
244{ 143{
245 u32 mask, st; 144 u32 m;
145
146 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
246 147
247 /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */ 148 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
248 mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 149 OMAP2_PM_PWSTCTRL);
249 st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
250 150
251 events[0] = mask & st; 151 return 0;
252} 152}
253 153
254/** 154int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
255 * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
256 *
257 * Force any buffered writes to the PRM IP block to complete. Needed
258 * by the PRM IRQ handler, which reads and writes directly to the IP
259 * block, to avoid race conditions after acknowledging or clearing IRQ
260 * bits. No return value.
261 */
262void omap3xxx_prm_ocp_barrier(void)
263{ 155{
264 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); 156 u32 m;
157
158 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
159
160 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
161 m);
265} 162}
266 163
267/** 164int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
268 * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
269 * @saved_mask: ptr to a u32 array to save IRQENABLE bits
270 *
271 * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask
272 * must be allocated by the caller. Intended to be used in the PRM
273 * interrupt handler suspend callback. The OCP barrier is needed to
274 * ensure the write to disable PRM interrupts reaches the PRM before
275 * returning; otherwise, spurious interrupts might occur. No return
276 * value.
277 */
278void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
279{ 165{
280 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD, 166 u32 m;
281 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 167
282 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 168 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
283 169
284 /* OCP barrier */ 170 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
285 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); 171 OMAP2_PM_PWSTCTRL, m);
286} 172}
287 173
288/** 174int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
289 * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
290 * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
291 *
292 * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended
293 * to be used in the PRM interrupt handler resume callback to restore
294 * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP
295 * barrier should be needed here; any pending PRM interrupts will fire
296 * once the writes reach the PRM. No return value.
297 */
298void omap3xxx_prm_restore_irqen(u32 *saved_mask)
299{ 175{
300 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD, 176 u32 v;
301 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 177
178 v = pwrst << __ffs(OMAP_LOGICRETSTATE_MASK);
179 omap2_prm_rmw_mod_reg_bits(OMAP_LOGICRETSTATE_MASK, v, pwrdm->prcm_offs,
180 OMAP2_PM_PWSTCTRL);
181
182 return 0;
302} 183}
303 184
304/** 185int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
305 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
306 *
307 * Clear any previously-latched I/O wakeup events and ensure that the
308 * I/O wakeup gates are aligned with the current mux settings. Works
309 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
310 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
311 * return value.
312 */
313void omap3xxx_prm_reconfigure_io_chain(void)
314{ 186{
315 int i = 0; 187 u32 c = 0;
316 188
317 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, 189 /*
318 PM_WKEN); 190 * REVISIT: pwrdm_wait_transition() may be better implemented
191 * via a callback and a periodic timer check -- how long do we expect
192 * powerdomain transitions to take?
193 */
319 194
320 omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) & 195 /* XXX Is this udelay() value meaningful? */
321 OMAP3430_ST_IO_CHAIN_MASK, 196 while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
322 MAX_IOPAD_LATCH_TIME, i); 197 OMAP_INTRANSITION_MASK) &&
323 if (i == MAX_IOPAD_LATCH_TIME) 198 (c++ < PWRDM_TRANSITION_BAILOUT))
324 pr_warn("PRM: I/O chain clock line assertion timed out\n"); 199 udelay(1);
325 200
326 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, 201 if (c > PWRDM_TRANSITION_BAILOUT) {
327 PM_WKEN); 202 pr_err("powerdomain: %s: waited too long to complete transition\n",
203 pwrdm->name);
204 return -EAGAIN;
205 }
328 206
329 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD, 207 pr_debug("powerdomain: completed transition in %d loops\n", c);
330 PM_WKST);
331 208
332 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST); 209 return 0;
333} 210}
334 211
335/** 212int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
336 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches 213 struct clockdomain *clkdm2)
337 * 214{
338 * Activates the I/O wakeup event latches and allows events logged by 215 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
339 * those latches to signal a wakeup event to the PRCM. For I/O 216 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
340 * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux 217 return 0;
341 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called. 218}
342 * No return value. 219
343 */ 220int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
344static void __init omap3xxx_prm_enable_io_wakeup(void) 221 struct clockdomain *clkdm2)
222{
223 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
224 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
225 return 0;
226}
227
228int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
229 struct clockdomain *clkdm2)
345{ 230{
346 if (omap3_has_io_wakeup()) 231 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
347 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, 232 PM_WKDEP, (1 << clkdm2->dep_bit));
348 PM_WKEN);
349} 233}
350 234
351static int __init omap3xxx_prcm_init(void) 235int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
352{ 236{
353 int ret = 0; 237 struct clkdm_dep *cd;
354 238 u32 mask = 0;
355 if (cpu_is_omap34xx()) { 239
356 omap3xxx_prm_enable_io_wakeup(); 240 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
357 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); 241 if (!cd->clkdm)
358 if (!ret) 242 continue; /* only happens if data is erroneous */
359 irq_set_status_flags(omap_prcm_event_to_irq("io"), 243
360 IRQ_NOAUTOEN); 244 /* PRM accesses are slow, so minimize them */
245 mask |= 1 << cd->clkdm->dep_bit;
246 atomic_set(&cd->wkdep_usecount, 0);
361 } 247 }
362 248
363 return ret; 249 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
250 PM_WKDEP);
251 return 0;
364} 252}
365subsys_initcall(omap3xxx_prcm_init); 253
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index c19d249b481..9624b40836d 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 Power/Reset Management (PRM) register definitions 2 * OMAP2xxx/3xxx-common Power/Reset Management (PRM) register definitions
3 * 3 *
4 * Copyright (C) 2007-2009, 2011 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation 5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley 6 * Paul Walmsley
7 * 7 *
@@ -19,160 +19,6 @@
19#include "prcm-common.h" 19#include "prcm-common.h"
20#include "prm.h" 20#include "prm.h"
21 21
22#define OMAP2420_PRM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
24#define OMAP2430_PRM_REGADDR(module, reg) \
25 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
26#define OMAP34XX_PRM_REGADDR(module, reg) \
27 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
28
29
30/*
31 * OMAP2-specific global PRM registers
32 * Use __raw_{read,write}l() with these registers.
33 *
34 * With a few exceptions, these are the register names beginning with
35 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
36 * bits.)
37 *
38 */
39
40#define OMAP2_PRCM_REVISION_OFFSET 0x0000
41#define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
42#define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010
43#define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
44
45#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018
46#define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
47#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c
48#define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
49
50#define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050
51#define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
52#define OMAP2_PRCM_VOLTST_OFFSET 0x0054
53#define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
54#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060
55#define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
56#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070
57#define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
58#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
59#define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
60#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080
61#define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
62#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084
63#define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
64#define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090
65#define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
66#define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094
67#define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
68#define OMAP2_PRCM_POLCTRL_OFFSET 0x0098
69#define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
70
71#define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
72#define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
73
74#define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
75#define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
76
77#define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
78#define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
79#define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
80#define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
81#define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
82#define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
83#define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
84#define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
85#define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
86#define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
87
88/*
89 * OMAP3-specific global PRM registers
90 * Use __raw_{read,write}l() with these registers.
91 *
92 * With a few exceptions, these are the register names beginning with
93 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
94 * bits.)
95 */
96
97#define OMAP3_PRM_REVISION_OFFSET 0x0004
98#define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
99#define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014
100#define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
101
102#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
103#define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
104#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
105#define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
106
107
108#define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020
109#define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
110#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024
111#define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
112#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028
113#define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
114#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c
115#define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
116#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030
117#define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
118#define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034
119#define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
120#define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038
121#define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
122#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
123#define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
124#define OMAP3_PRM_RSTCTRL_OFFSET 0x0050
125#define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
126#define OMAP3_PRM_RSTTIME_OFFSET 0x0054
127#define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
128#define OMAP3_PRM_RSTST_OFFSET 0x0058
129#define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
130#define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060
131#define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
132#define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064
133#define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
134#define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070
135#define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
136#define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090
137#define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
138#define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094
139#define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
140#define OMAP3_PRM_CLKSETUP_OFFSET 0x0098
141#define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
142#define OMAP3_PRM_POLCTRL_OFFSET 0x009c
143#define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
144#define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0
145#define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
146#define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0
147#define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
148#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4
149#define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
150#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8
151#define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
152#define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc
153#define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
154#define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0
155#define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
156#define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4
157#define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
158#define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0
159#define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
160#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4
161#define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
162#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8
163#define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
164#define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc
165#define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
166#define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0
167#define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
168#define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4
169#define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
170
171#define OMAP3_PRM_CLKSEL_OFFSET 0x0040
172#define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
173#define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070
174#define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
175
176/* 22/*
177 * Module specific PRM register offsets from PRM_BASE + domain offset 23 * Module specific PRM register offsets from PRM_BASE + domain offset
178 * 24 *
@@ -200,66 +46,83 @@
200#define PM_EVGENONTIM 0x00d8 46#define PM_EVGENONTIM 0x00d8
201#define PM_EVGENOFFTIM 0x00dc 47#define PM_EVGENOFFTIM 0x00dc
202 48
203/* OMAP2xxx specific register offsets */
204#define OMAP24XX_PM_WKEN2 0x00a4
205#define OMAP24XX_PM_WKST2 0x00b4
206
207#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */
208#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */
209#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8
210#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc
211 49
212/* OMAP3 specific register offsets */ 50#ifndef __ASSEMBLER__
213#define OMAP3430ES2_PM_WKEN3 0x00f0
214#define OMAP3430ES2_PM_WKST3 0x00b8
215
216#define OMAP3430_PM_MPUGRPSEL 0x00a4
217#define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL
218#define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8
219
220#define OMAP3430_PM_IVAGRPSEL 0x00a8
221#define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL
222#define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4
223
224#define OMAP3430_PM_PREPWSTST 0x00e8
225
226#define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8
227#define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc
228 51
52#include <linux/io.h>
53#include "powerdomain.h"
229 54
230#ifndef __ASSEMBLER__
231/* Power/reset management domain register get/set */ 55/* Power/reset management domain register get/set */
232extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx); 56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
233extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx); 57{
234extern u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 58 return __raw_readl(prm_base + module + idx);
235extern u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); 59}
236extern u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx); 60
237extern u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask); 61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
62{
63 __raw_writel(val, prm_base + module + idx);
64}
65
66/* Read-modify-write a register in a PRM module. Caller must lock */
67static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
68 s16 idx)
69{
70 u32 v;
71
72 v = omap2_prm_read_mod_reg(module, idx);
73 v &= ~mask;
74 v |= bits;
75 omap2_prm_write_mod_reg(v, module, idx);
76
77 return v;
78}
79
80/* Read a PRM register, AND it, and shift the result down to bit 0 */
81static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
82{
83 u32 v;
84
85 v = omap2_prm_read_mod_reg(domain, idx);
86 v &= mask;
87 v >>= __ffs(mask);
88
89 return v;
90}
91
92static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
93{
94 return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
95}
96
97static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
98{
99 return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
100}
238 101
239/* These omap2_ PRM functions apply to both OMAP2 and 3 */ 102/* These omap2_ PRM functions apply to both OMAP2 and 3 */
240extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); 103extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
241extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); 104extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
242extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); 105extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
243 106
244/* OMAP3-specific VP functions */ 107extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
245u32 omap3_prm_vp_check_txdone(u8 vp_id); 108extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
246void omap3_prm_vp_clear_txdone(u8 vp_id); 109extern int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm);
247 110extern int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
248/* 111 u8 pwrst);
249 * OMAP3 access functions for voltage controller (VC) and 112extern int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
250 * voltage proccessor (VP) in the PRM. 113 u8 pwrst);
251 */ 114extern int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
252extern u32 omap3_prm_vcvp_read(u8 offset); 115extern int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
253extern void omap3_prm_vcvp_write(u32 val, u8 offset); 116extern int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst);
254extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 117extern int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm);
255 118
256extern void omap3xxx_prm_reconfigure_io_chain(void); 119extern int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
257 120 struct clockdomain *clkdm2);
258/* PRM interrupt-related functions */ 121extern int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
259extern void omap3xxx_prm_read_pending_irqs(unsigned long *events); 122 struct clockdomain *clkdm2);
260extern void omap3xxx_prm_ocp_barrier(void); 123extern int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
261extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask); 124 struct clockdomain *clkdm2);
262extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); 125extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
263 126
264#endif /* __ASSEMBLER */ 127#endif /* __ASSEMBLER */
265 128
@@ -289,6 +152,7 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
289/* Named PRCM_CLKSRC_CTRL on the 24XX */ 152/* Named PRCM_CLKSRC_CTRL on the 24XX */
290#define OMAP_SYSCLKDIV_SHIFT 6 153#define OMAP_SYSCLKDIV_SHIFT 6
291#define OMAP_SYSCLKDIV_MASK (0x3 << 6) 154#define OMAP_SYSCLKDIV_MASK (0x3 << 6)
155#define OMAP_SYSCLKDIV_WIDTH 2
292#define OMAP_AUTOEXTCLKMODE_SHIFT 3 156#define OMAP_AUTOEXTCLKMODE_SHIFT 3
293#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3) 157#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3)
294#define OMAP_SYSCLKSEL_SHIFT 0 158#define OMAP_SYSCLKSEL_SHIFT 0
@@ -348,7 +212,9 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
348 * 212 *
349 * 3430: RM_RSTST_CORE, RM_RSTST_EMU 213 * 3430: RM_RSTST_CORE, RM_RSTST_EMU
350 */ 214 */
215#define OMAP_GLOBALWARM_RST_SHIFT 1
351#define OMAP_GLOBALWARM_RST_MASK (1 << 1) 216#define OMAP_GLOBALWARM_RST_MASK (1 << 1)
217#define OMAP_GLOBALCOLD_RST_SHIFT 0
352#define OMAP_GLOBALCOLD_RST_MASK (1 << 0) 218#define OMAP_GLOBALCOLD_RST_MASK (1 << 0)
353 219
354/* 220/*
@@ -376,11 +242,4 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
376#define OMAP_LOGICRETSTATE_MASK (1 << 2) 242#define OMAP_LOGICRETSTATE_MASK (1 << 2)
377 243
378 244
379/*
380 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
381 * submodule to exit hardreset
382 */
383#define MAX_MODULE_HARDRESET_WAIT 10000
384
385
386#endif 245#endif
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index e7dbb6cf125..1ac73883f89 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -19,9 +19,8 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <plat/common.h>
23
24#include "common.h" 22#include "common.h"
23#include "powerdomain.h"
25#include "prm33xx.h" 24#include "prm33xx.h"
26#include "prm-regbits-33xx.h" 25#include "prm-regbits-33xx.h"
27 26
@@ -133,3 +132,204 @@ int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
133 132
134 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 133 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
135} 134}
135
136static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
137{
138 am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
139 (pwrst << OMAP_POWERSTATE_SHIFT),
140 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
141 return 0;
142}
143
144static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
145{
146 u32 v;
147
148 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
149 v &= OMAP_POWERSTATE_MASK;
150 v >>= OMAP_POWERSTATE_SHIFT;
151
152 return v;
153}
154
155static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
156{
157 u32 v;
158
159 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
160 v &= OMAP_POWERSTATEST_MASK;
161 v >>= OMAP_POWERSTATEST_SHIFT;
162
163 return v;
164}
165
166static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
167{
168 u32 v;
169
170 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
171 v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
172 v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
173
174 return v;
175}
176
177static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
178{
179 am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
180 (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
181 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
182 return 0;
183}
184
185static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
186{
187 am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
188 AM33XX_LASTPOWERSTATEENTERED_MASK,
189 pwrdm->prcm_offs, pwrdm->pwrstst_offs);
190 return 0;
191}
192
193static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
194{
195 u32 m;
196
197 m = pwrdm->logicretstate_mask;
198 if (!m)
199 return -EINVAL;
200
201 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
202 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
203
204 return 0;
205}
206
207static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
208{
209 u32 v;
210
211 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
212 v &= AM33XX_LOGICSTATEST_MASK;
213 v >>= AM33XX_LOGICSTATEST_SHIFT;
214
215 return v;
216}
217
218static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
219{
220 u32 v, m;
221
222 m = pwrdm->logicretstate_mask;
223 if (!m)
224 return -EINVAL;
225
226 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
227 v &= m;
228 v >>= __ffs(m);
229
230 return v;
231}
232
233static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
234 u8 pwrst)
235{
236 u32 m;
237
238 m = pwrdm->mem_on_mask[bank];
239 if (!m)
240 return -EINVAL;
241
242 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
243 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
244
245 return 0;
246}
247
248static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
249 u8 pwrst)
250{
251 u32 m;
252
253 m = pwrdm->mem_ret_mask[bank];
254 if (!m)
255 return -EINVAL;
256
257 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
258 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
259
260 return 0;
261}
262
263static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
264{
265 u32 m, v;
266
267 m = pwrdm->mem_pwrst_mask[bank];
268 if (!m)
269 return -EINVAL;
270
271 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
272 v &= m;
273 v >>= __ffs(m);
274
275 return v;
276}
277
278static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
279{
280 u32 m, v;
281
282 m = pwrdm->mem_retst_mask[bank];
283 if (!m)
284 return -EINVAL;
285
286 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
287 v &= m;
288 v >>= __ffs(m);
289
290 return v;
291}
292
293static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
294{
295 u32 c = 0;
296
297 /*
298 * REVISIT: pwrdm_wait_transition() may be better implemented
299 * via a callback and a periodic timer check -- how long do we expect
300 * powerdomain transitions to take?
301 */
302
303 /* XXX Is this udelay() value meaningful? */
304 while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
305 & OMAP_INTRANSITION_MASK) &&
306 (c++ < PWRDM_TRANSITION_BAILOUT))
307 udelay(1);
308
309 if (c > PWRDM_TRANSITION_BAILOUT) {
310 pr_err("powerdomain: %s: waited too long to complete transition\n",
311 pwrdm->name);
312 return -EAGAIN;
313 }
314
315 pr_debug("powerdomain: completed transition in %d loops\n", c);
316
317 return 0;
318}
319
320struct pwrdm_ops am33xx_pwrdm_operations = {
321 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
322 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
323 .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst,
324 .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst,
325 .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst,
326 .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst,
327 .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst,
328 .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst,
329 .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange,
330 .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst,
331 .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst,
332 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst,
333 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
334 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
335};
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
new file mode 100644
index 00000000000..db198d05858
--- /dev/null
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -0,0 +1,420 @@
1/*
2 * OMAP3xxx PRM module functions
3 *
4 * Copyright (C) 2010-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson
7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20
21#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h"
25#include "powerdomain.h"
26#include "prm3xxx.h"
27#include "prm2xxx_3xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm-regbits-34xx.h"
30
31static const struct omap_prcm_irq omap3_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0),
33 OMAP_PRCM_IRQ("io", 9, 1),
34};
35
36static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
37 .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
38 .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
39 .nr_regs = 1,
40 .irqs = omap3_prcm_irqs,
41 .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs),
42 .irq = 11 + OMAP_INTC_START,
43 .read_pending_irqs = &omap3xxx_prm_read_pending_irqs,
44 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
45 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
46 .restore_irqen = &omap3xxx_prm_restore_irqen,
47};
48
49/*
50 * omap3_prm_reset_src_map - map from bits in the PRM_RSTST hardware
51 * register (which are specific to OMAP3xxx SoCs) to reset source ID
52 * bit shifts (which is an OMAP SoC-independent enumeration)
53 */
54static struct prm_reset_src_map omap3xxx_prm_reset_src_map[] = {
55 { OMAP3430_GLOBAL_COLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
56 { OMAP3430_GLOBAL_SW_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
57 { OMAP3430_SECURITY_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
58 { OMAP3430_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
59 { OMAP3430_SECURE_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
60 { OMAP3430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
61 { OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT,
62 OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
63 { OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT,
64 OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
65 { OMAP3430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
66 { OMAP3430_ICECRUSHER_RST_SHIFT, OMAP_ICECRUSHER_RST_SRC_ID_SHIFT },
67 { -1, -1 },
68};
69
70/* PRM VP */
71
72/*
73 * struct omap3_vp - OMAP3 VP register access description.
74 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
75 */
76struct omap3_vp {
77 u32 tranxdone_status;
78};
79
80static struct omap3_vp omap3_vp[] = {
81 [OMAP3_VP_VDD_MPU_ID] = {
82 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
83 },
84 [OMAP3_VP_VDD_CORE_ID] = {
85 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
86 },
87};
88
89#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
90
91u32 omap3_prm_vp_check_txdone(u8 vp_id)
92{
93 struct omap3_vp *vp = &omap3_vp[vp_id];
94 u32 irqstatus;
95
96 irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
97 OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
98 return irqstatus & vp->tranxdone_status;
99}
100
101void omap3_prm_vp_clear_txdone(u8 vp_id)
102{
103 struct omap3_vp *vp = &omap3_vp[vp_id];
104
105 omap2_prm_write_mod_reg(vp->tranxdone_status,
106 OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
107}
108
109u32 omap3_prm_vcvp_read(u8 offset)
110{
111 return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset);
112}
113
114void omap3_prm_vcvp_write(u32 val, u8 offset)
115{
116 omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset);
117}
118
119u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
120{
121 return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset);
122}
123
124/**
125 * omap3xxx_prm_dpll3_reset - use DPLL3 reset to reboot the OMAP SoC
126 *
127 * Set the DPLL3 reset bit, which should reboot the SoC. This is the
128 * recommended way to restart the SoC, considering Errata i520. No
129 * return value.
130 */
131void omap3xxx_prm_dpll3_reset(void)
132{
133 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD,
134 OMAP2_RM_RSTCTRL);
135 /* OCP barrier */
136 omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL);
137}
138
139/**
140 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events
141 * @events: ptr to a u32, preallocated by caller
142 *
143 * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
144 * MPU IRQs, and store the result into the u32 pointed to by @events.
145 * No return value.
146 */
147void omap3xxx_prm_read_pending_irqs(unsigned long *events)
148{
149 u32 mask, st;
150
151 /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */
152 mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
153 st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
154
155 events[0] = mask & st;
156}
157
158/**
159 * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
160 *
161 * Force any buffered writes to the PRM IP block to complete. Needed
162 * by the PRM IRQ handler, which reads and writes directly to the IP
163 * block, to avoid race conditions after acknowledging or clearing IRQ
164 * bits. No return value.
165 */
166void omap3xxx_prm_ocp_barrier(void)
167{
168 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
169}
170
171/**
172 * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
173 * @saved_mask: ptr to a u32 array to save IRQENABLE bits
174 *
175 * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask
176 * must be allocated by the caller. Intended to be used in the PRM
177 * interrupt handler suspend callback. The OCP barrier is needed to
178 * ensure the write to disable PRM interrupts reaches the PRM before
179 * returning; otherwise, spurious interrupts might occur. No return
180 * value.
181 */
182void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
183{
184 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD,
185 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
186 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
187
188 /* OCP barrier */
189 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
190}
191
192/**
193 * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
194 * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
195 *
196 * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended
197 * to be used in the PRM interrupt handler resume callback to restore
198 * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP
199 * barrier should be needed here; any pending PRM interrupts will fire
200 * once the writes reach the PRM. No return value.
201 */
202void omap3xxx_prm_restore_irqen(u32 *saved_mask)
203{
204 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD,
205 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
206}
207
208/**
209 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
210 *
211 * Clear any previously-latched I/O wakeup events and ensure that the
212 * I/O wakeup gates are aligned with the current mux settings. Works
213 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
214 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
215 * return value.
216 */
217void omap3xxx_prm_reconfigure_io_chain(void)
218{
219 int i = 0;
220
221 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
222 PM_WKEN);
223
224 omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
225 OMAP3430_ST_IO_CHAIN_MASK,
226 MAX_IOPAD_LATCH_TIME, i);
227 if (i == MAX_IOPAD_LATCH_TIME)
228 pr_warn("PRM: I/O chain clock line assertion timed out\n");
229
230 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
231 PM_WKEN);
232
233 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD,
234 PM_WKST);
235
236 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST);
237}
238
239/**
240 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
241 *
242 * Activates the I/O wakeup event latches and allows events logged by
243 * those latches to signal a wakeup event to the PRCM. For I/O
244 * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux
245 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
246 * No return value.
247 */
248static void __init omap3xxx_prm_enable_io_wakeup(void)
249{
250 if (omap3_has_io_wakeup())
251 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
252 PM_WKEN);
253}
254
255/**
256 * omap3xxx_prm_read_reset_sources - return the last SoC reset source
257 *
258 * Return a u32 representing the last reset sources of the SoC. The
259 * returned reset source bits are standardized across OMAP SoCs.
260 */
261static u32 omap3xxx_prm_read_reset_sources(void)
262{
263 struct prm_reset_src_map *p;
264 u32 r = 0;
265 u32 v;
266
267 v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
268
269 p = omap3xxx_prm_reset_src_map;
270 while (p->reg_shift >= 0 && p->std_shift >= 0) {
271 if (v & (1 << p->reg_shift))
272 r |= 1 << p->std_shift;
273 p++;
274 }
275
276 return r;
277}
278
279/* Powerdomain low-level functions */
280
281/* Applicable only for OMAP3. Not supported on OMAP2 */
282static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
283{
284 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
285 OMAP3430_PM_PREPWSTST,
286 OMAP3430_LASTPOWERSTATEENTERED_MASK);
287}
288
289static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
290{
291 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
292 OMAP2_PM_PWSTST,
293 OMAP3430_LOGICSTATEST_MASK);
294}
295
296static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
297{
298 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
299 OMAP2_PM_PWSTCTRL,
300 OMAP3430_LOGICSTATEST_MASK);
301}
302
303static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
304{
305 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
306 OMAP3430_PM_PREPWSTST,
307 OMAP3430_LASTLOGICSTATEENTERED_MASK);
308}
309
310static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
311{
312 switch (bank) {
313 case 0:
314 return OMAP3430_LASTMEM1STATEENTERED_MASK;
315 case 1:
316 return OMAP3430_LASTMEM2STATEENTERED_MASK;
317 case 2:
318 return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
319 case 3:
320 return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
321 default:
322 WARN_ON(1); /* should never happen */
323 return -EEXIST;
324 }
325 return 0;
326}
327
328static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
329{
330 u32 m;
331
332 m = omap3_get_mem_bank_lastmemst_mask(bank);
333
334 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
335 OMAP3430_PM_PREPWSTST, m);
336}
337
338static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
339{
340 omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
341 return 0;
342}
343
344static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
345{
346 return omap2_prm_rmw_mod_reg_bits(0,
347 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
348 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
349}
350
351static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
352{
353 return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
354 0, pwrdm->prcm_offs,
355 OMAP2_PM_PWSTCTRL);
356}
357
358struct pwrdm_ops omap3_pwrdm_operations = {
359 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
360 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
361 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
362 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst,
363 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
364 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
365 .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
366 .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst,
367 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
368 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
369 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
370 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
371 .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst,
372 .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst,
373 .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar,
374 .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
375 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
376};
377
378/*
379 *
380 */
381
382static struct prm_ll_data omap3xxx_prm_ll_data = {
383 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
384};
385
386int __init omap3xxx_prm_init(void)
387{
388 if (!cpu_is_omap34xx())
389 return 0;
390
391 return prm_register(&omap3xxx_prm_ll_data);
392}
393
394static int __init omap3xxx_prm_late_init(void)
395{
396 int ret;
397
398 if (!cpu_is_omap34xx())
399 return 0;
400
401 omap3xxx_prm_enable_io_wakeup();
402 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
403 if (!ret)
404 irq_set_status_flags(omap_prcm_event_to_irq("io"),
405 IRQ_NOAUTOEN);
406
407 return ret;
408}
409subsys_initcall(omap3xxx_prm_late_init);
410
411static void __exit omap3xxx_prm_exit(void)
412{
413 if (!cpu_is_omap34xx())
414 return;
415
416 /* Should never happen */
417 WARN(prm_unregister(&omap3xxx_prm_ll_data),
418 "%s: prm_ll_data function pointer mismatch\n", __func__);
419}
420__exitcall(omap3xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
new file mode 100644
index 00000000000..277f71794e6
--- /dev/null
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -0,0 +1,163 @@
1/*
2 * OMAP3xxx Power/Reset Management (PRM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The PRM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The PRM on OMAP4 has a new register layout, and is handled
14 * in a separate file.
15 */
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21#include "prm2xxx_3xxx.h"
22
23#define OMAP34XX_PRM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
25
26
27/*
28 * OMAP3-specific global PRM registers
29 * Use __raw_{read,write}l() with these registers.
30 *
31 * With a few exceptions, these are the register names beginning with
32 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
33 * bits.)
34 */
35
36#define OMAP3_PRM_REVISION_OFFSET 0x0004
37#define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
38#define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014
39#define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
40
41#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
42#define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
43#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
44#define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
45
46
47#define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020
48#define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
49#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024
50#define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
51#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028
52#define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
53#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c
54#define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
55#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030
56#define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
57#define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034
58#define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
59#define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038
60#define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
61#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
62#define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
63#define OMAP3_PRM_RSTCTRL_OFFSET 0x0050
64#define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
65#define OMAP3_PRM_RSTTIME_OFFSET 0x0054
66#define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
67#define OMAP3_PRM_RSTST_OFFSET 0x0058
68#define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
69#define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060
70#define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
71#define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064
72#define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
73#define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070
74#define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
75#define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090
76#define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
77#define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094
78#define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
79#define OMAP3_PRM_CLKSETUP_OFFSET 0x0098
80#define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
81#define OMAP3_PRM_POLCTRL_OFFSET 0x009c
82#define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
83#define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0
84#define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
85#define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0
86#define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
87#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4
88#define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
89#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8
90#define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
91#define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc
92#define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
93#define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0
94#define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
95#define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4
96#define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
97#define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0
98#define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
99#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4
100#define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
101#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8
102#define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
103#define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc
104#define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
105#define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0
106#define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
107#define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4
108#define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
109
110#define OMAP3_PRM_CLKSEL_OFFSET 0x0040
111#define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
112#define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070
113#define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
114
115/* OMAP3 specific register offsets */
116#define OMAP3430ES2_PM_WKEN3 0x00f0
117#define OMAP3430ES2_PM_WKST3 0x00b8
118
119#define OMAP3430_PM_MPUGRPSEL 0x00a4
120#define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL
121#define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8
122
123#define OMAP3430_PM_IVAGRPSEL 0x00a8
124#define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL
125#define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4
126
127#define OMAP3430_PM_PREPWSTST 0x00e8
128
129#define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8
130#define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc
131
132
133#ifndef __ASSEMBLER__
134
135/* OMAP3-specific VP functions */
136u32 omap3_prm_vp_check_txdone(u8 vp_id);
137void omap3_prm_vp_clear_txdone(u8 vp_id);
138
139/*
140 * OMAP3 access functions for voltage controller (VC) and
141 * voltage proccessor (VP) in the PRM.
142 */
143extern u32 omap3_prm_vcvp_read(u8 offset);
144extern void omap3_prm_vcvp_write(u32 val, u8 offset);
145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
146
147extern void omap3xxx_prm_reconfigure_io_chain(void);
148
149/* PRM interrupt-related functions */
150extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
151extern void omap3xxx_prm_ocp_barrier(void);
152extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
153extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
154
155extern void omap3xxx_prm_dpll3_reset(void);
156
157extern int __init omap3xxx_prm_init(void);
158extern u32 omap3xxx_prm_get_reset_sources(void);
159
160#endif /* __ASSEMBLER */
161
162
163#endif
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index f0c4d5f4a17..7498bc77fe8 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -1,10 +1,11 @@
1/* 1/*
2 * OMAP4 PRM module functions 2 * OMAP4 PRM module functions
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments, Inc. 4 * Copyright (C) 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson 6 * Benoît Cousson
7 * Paul Walmsley 7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
8 * 9 *
9 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -17,7 +18,6 @@
17#include <linux/err.h> 18#include <linux/err.h>
18#include <linux/io.h> 19#include <linux/io.h>
19 20
20#include <plat/prcm.h>
21 21
22#include "soc.h" 22#include "soc.h"
23#include "iomap.h" 23#include "iomap.h"
@@ -27,6 +27,9 @@
27#include "prm-regbits-44xx.h" 27#include "prm-regbits-44xx.h"
28#include "prcm44xx.h" 28#include "prcm44xx.h"
29#include "prminst44xx.h" 29#include "prminst44xx.h"
30#include "powerdomain.h"
31
32/* Static data */
30 33
31static const struct omap_prcm_irq omap4_prcm_irqs[] = { 34static const struct omap_prcm_irq omap4_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0), 35 OMAP_PRCM_IRQ("wkup", 0, 0),
@@ -46,6 +49,33 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
46 .restore_irqen = &omap44xx_prm_restore_irqen, 49 .restore_irqen = &omap44xx_prm_restore_irqen,
47}; 50};
48 51
52/*
53 * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST
54 * hardware register (which are specific to OMAP44xx SoCs) to reset
55 * source ID bit shifts (which is an OMAP SoC-independent
56 * enumeration)
57 */
58static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
59 { OMAP4430_RST_GLOBAL_WARM_SW_SHIFT,
60 OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
61 { OMAP4430_RST_GLOBAL_COLD_SW_SHIFT,
62 OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
63 { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT,
64 OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
65 { OMAP4430_MPU_WDT_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
66 { OMAP4430_SECURE_WDT_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
67 { OMAP4430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
68 { OMAP4430_VDD_MPU_VOLT_MGR_RST_SHIFT,
69 OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
70 { OMAP4430_VDD_IVA_VOLT_MGR_RST_SHIFT,
71 OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT },
72 { OMAP4430_VDD_CORE_VOLT_MGR_RST_SHIFT,
73 OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
74 { OMAP4430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
75 { OMAP4430_C2C_RST_SHIFT, OMAP_C2C_RST_SRC_ID_SHIFT },
76 { -1, -1 },
77};
78
49/* PRM low-level functions */ 79/* PRM low-level functions */
50 80
51/* Read a register in a CM/PRM instance in the PRM module */ 81/* Read a register in a CM/PRM instance in the PRM module */
@@ -291,12 +321,359 @@ static void __init omap44xx_prm_enable_io_wakeup(void)
291 OMAP4_PRM_IO_PMCTRL_OFFSET); 321 OMAP4_PRM_IO_PMCTRL_OFFSET);
292} 322}
293 323
294static int __init omap4xxx_prcm_init(void) 324/**
325 * omap44xx_prm_read_reset_sources - return the last SoC reset source
326 *
327 * Return a u32 representing the last reset sources of the SoC. The
328 * returned reset source bits are standardized across OMAP SoCs.
329 */
330static u32 omap44xx_prm_read_reset_sources(void)
331{
332 struct prm_reset_src_map *p;
333 u32 r = 0;
334 u32 v;
335
336 v = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
337 OMAP4_RM_RSTST);
338
339 p = omap44xx_prm_reset_src_map;
340 while (p->reg_shift >= 0 && p->std_shift >= 0) {
341 if (v & (1 << p->reg_shift))
342 r |= 1 << p->std_shift;
343 p++;
344 }
345
346 return r;
347}
348
349/**
350 * omap44xx_prm_was_any_context_lost_old - was module hardware context lost?
351 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
352 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
353 * @idx: CONTEXT register offset
354 *
355 * Return 1 if any bits were set in the *_CONTEXT_* register
356 * identified by (@part, @inst, @idx), which means that some context
357 * was lost for that module; otherwise, return 0.
358 */
359static bool omap44xx_prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx)
360{
361 return (omap4_prminst_read_inst_reg(part, inst, idx)) ? 1 : 0;
362}
363
364/**
365 * omap44xx_prm_clear_context_lost_flags_old - clear context loss flags
366 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
367 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
368 * @idx: CONTEXT register offset
369 *
370 * Clear hardware context loss bits for the module identified by
371 * (@part, @inst, @idx). No return value. XXX Writes to reserved bits;
372 * is there a way to avoid this?
373 */
374static void omap44xx_prm_clear_context_loss_flags_old(u8 part, s16 inst,
375 u16 idx)
376{
377 omap4_prminst_write_inst_reg(0xffffffff, part, inst, idx);
378}
379
380/* Powerdomain low-level functions */
381
382static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
383{
384 omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
385 (pwrst << OMAP_POWERSTATE_SHIFT),
386 pwrdm->prcm_partition,
387 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
388 return 0;
389}
390
391static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
392{
393 u32 v;
394
395 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
396 OMAP4_PM_PWSTCTRL);
397 v &= OMAP_POWERSTATE_MASK;
398 v >>= OMAP_POWERSTATE_SHIFT;
399
400 return v;
401}
402
403static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
404{
405 u32 v;
406
407 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
408 OMAP4_PM_PWSTST);
409 v &= OMAP_POWERSTATEST_MASK;
410 v >>= OMAP_POWERSTATEST_SHIFT;
411
412 return v;
413}
414
415static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
416{
417 u32 v;
418
419 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
420 OMAP4_PM_PWSTST);
421 v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
422 v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
423
424 return v;
425}
426
427static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
428{
429 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
430 (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
431 pwrdm->prcm_partition,
432 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
433 return 0;
434}
435
436static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
437{
438 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
439 OMAP4430_LASTPOWERSTATEENTERED_MASK,
440 pwrdm->prcm_partition,
441 pwrdm->prcm_offs, OMAP4_PM_PWSTST);
442 return 0;
443}
444
445static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
446{
447 u32 v;
448
449 v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
450 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
451 pwrdm->prcm_partition, pwrdm->prcm_offs,
452 OMAP4_PM_PWSTCTRL);
453
454 return 0;
455}
456
457static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
458 u8 pwrst)
459{
460 u32 m;
461
462 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
463
464 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
465 pwrdm->prcm_partition, pwrdm->prcm_offs,
466 OMAP4_PM_PWSTCTRL);
467
468 return 0;
469}
470
471static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
472 u8 pwrst)
295{ 473{
296 if (cpu_is_omap44xx()) { 474 u32 m;
297 omap44xx_prm_enable_io_wakeup(); 475
298 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 476 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
477
478 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
479 pwrdm->prcm_partition, pwrdm->prcm_offs,
480 OMAP4_PM_PWSTCTRL);
481
482 return 0;
483}
484
485static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
486{
487 u32 v;
488
489 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
490 OMAP4_PM_PWSTST);
491 v &= OMAP4430_LOGICSTATEST_MASK;
492 v >>= OMAP4430_LOGICSTATEST_SHIFT;
493
494 return v;
495}
496
497static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
498{
499 u32 v;
500
501 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
502 OMAP4_PM_PWSTCTRL);
503 v &= OMAP4430_LOGICRETSTATE_MASK;
504 v >>= OMAP4430_LOGICRETSTATE_SHIFT;
505
506 return v;
507}
508
509/**
510 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
511 * @pwrdm: struct powerdomain * to read the state for
512 *
513 * Reads the previous logic powerstate for a powerdomain. This
514 * function must determine the previous logic powerstate by first
515 * checking the previous powerstate for the domain. If that was OFF,
516 * then logic has been lost. If previous state was RETENTION, the
517 * function reads the setting for the next retention logic state to
518 * see the actual value. In every other case, the logic is
519 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
520 * depending whether the logic was retained or not.
521 */
522static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
523{
524 int state;
525
526 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
527
528 if (state == PWRDM_POWER_OFF)
529 return PWRDM_POWER_OFF;
530
531 if (state != PWRDM_POWER_RET)
532 return PWRDM_POWER_RET;
533
534 return omap4_pwrdm_read_logic_retst(pwrdm);
535}
536
537static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
538{
539 u32 m, v;
540
541 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
542
543 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
544 OMAP4_PM_PWSTST);
545 v &= m;
546 v >>= __ffs(m);
547
548 return v;
549}
550
551static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
552{
553 u32 m, v;
554
555 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
556
557 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
558 OMAP4_PM_PWSTCTRL);
559 v &= m;
560 v >>= __ffs(m);
561
562 return v;
563}
564
565/**
566 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
567 * @pwrdm: struct powerdomain * to read mem powerstate for
568 * @bank: memory bank index
569 *
570 * Reads the previous memory powerstate for a powerdomain. This
571 * function must determine the previous memory powerstate by first
572 * checking the previous powerstate for the domain. If that was OFF,
573 * then logic has been lost. If previous state was RETENTION, the
574 * function reads the setting for the next memory retention state to
575 * see the actual value. In every other case, the logic is
576 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
577 * depending whether logic was retained or not.
578 */
579static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
580{
581 int state;
582
583 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
584
585 if (state == PWRDM_POWER_OFF)
586 return PWRDM_POWER_OFF;
587
588 if (state != PWRDM_POWER_RET)
589 return PWRDM_POWER_RET;
590
591 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
592}
593
594static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
595{
596 u32 c = 0;
597
598 /*
599 * REVISIT: pwrdm_wait_transition() may be better implemented
600 * via a callback and a periodic timer check -- how long do we expect
601 * powerdomain transitions to take?
602 */
603
604 /* XXX Is this udelay() value meaningful? */
605 while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
606 pwrdm->prcm_offs,
607 OMAP4_PM_PWSTST) &
608 OMAP_INTRANSITION_MASK) &&
609 (c++ < PWRDM_TRANSITION_BAILOUT))
610 udelay(1);
611
612 if (c > PWRDM_TRANSITION_BAILOUT) {
613 pr_err("powerdomain: %s: waited too long to complete transition\n",
614 pwrdm->name);
615 return -EAGAIN;
299 } 616 }
617
618 pr_debug("powerdomain: completed transition in %d loops\n", c);
619
300 return 0; 620 return 0;
301} 621}
302subsys_initcall(omap4xxx_prcm_init); 622
623struct pwrdm_ops omap4_pwrdm_operations = {
624 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst,
625 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst,
626 .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst,
627 .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst,
628 .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange,
629 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
630 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
631 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
632 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
633 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
634 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
635 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
636 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
637 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
638 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
639 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
640};
641
642/*
643 * XXX document
644 */
645static struct prm_ll_data omap44xx_prm_ll_data = {
646 .read_reset_sources = &omap44xx_prm_read_reset_sources,
647 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
648 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
649};
650
651int __init omap44xx_prm_init(void)
652{
653 if (!cpu_is_omap44xx())
654 return 0;
655
656 return prm_register(&omap44xx_prm_ll_data);
657}
658
659static int __init omap44xx_prm_late_init(void)
660{
661 if (!cpu_is_omap44xx())
662 return 0;
663
664 omap44xx_prm_enable_io_wakeup();
665
666 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
667}
668subsys_initcall(omap44xx_prm_late_init);
669
670static void __exit omap44xx_prm_exit(void)
671{
672 if (!cpu_is_omap44xx())
673 return;
674
675 /* Should never happen */
676 WARN(prm_unregister(&omap44xx_prm_ll_data),
677 "%s: prm_ll_data function pointer mismatch\n", __func__);
678}
679__exitcall(omap44xx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index ee72ae6bd8c..22b0979206c 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -771,6 +771,9 @@ extern void omap44xx_prm_ocp_barrier(void);
771extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask); 771extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
772extern void omap44xx_prm_restore_irqen(u32 *saved_mask); 772extern void omap44xx_prm_restore_irqen(u32 *saved_mask);
773 773
774extern int __init omap44xx_prm_init(void);
775extern u32 omap44xx_prm_get_reset_sources(void);
776
774# endif 777# endif
775 778
776#endif 779#endif
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 6b4d332be2f..228b850e632 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -24,11 +24,11 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <plat/common.h>
28#include <plat/prcm.h>
29
30#include "prm2xxx_3xxx.h" 27#include "prm2xxx_3xxx.h"
28#include "prm2xxx.h"
29#include "prm3xxx.h"
31#include "prm44xx.h" 30#include "prm44xx.h"
31#include "common.h"
32 32
33/* 33/*
34 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs 34 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
@@ -53,6 +53,16 @@ static struct irq_chip_generic **prcm_irq_chips;
53 */ 53 */
54static struct omap_prcm_irq_setup *prcm_irq_setup; 54static struct omap_prcm_irq_setup *prcm_irq_setup;
55 55
56/* prm_base: base virtual address of the PRM IP block */
57void __iomem *prm_base;
58
59/*
60 * prm_ll_data: function pointers to SoC-specific implementations of
61 * common PRM functions
62 */
63static struct prm_ll_data null_prm_ll_data;
64static struct prm_ll_data *prm_ll_data = &null_prm_ll_data;
65
56/* Private functions */ 66/* Private functions */
57 67
58/* 68/*
@@ -319,64 +329,127 @@ err:
319 return -ENOMEM; 329 return -ENOMEM;
320} 330}
321 331
322/* 332/**
323 * Stubbed functions so that common files continue to build when 333 * omap2_set_globals_prm - set the PRM base address (for early use)
324 * custom builds are used 334 * @prm: PRM base virtual address
325 * XXX These are temporary and should be removed at the earliest possible 335 *
326 * opportunity 336 * XXX Will be replaced when the PRM/CM drivers are completed.
327 */ 337 */
328u32 __weak omap2_prm_read_mod_reg(s16 module, u16 idx) 338void __init omap2_set_globals_prm(void __iomem *prm)
329{ 339{
330 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 340 prm_base = prm;
331 return 0;
332} 341}
333 342
334void __weak omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) 343/**
344 * prm_read_reset_sources - return the sources of the SoC's last reset
345 *
346 * Return a u32 bitmask representing the reset sources that caused the
347 * SoC to reset. The low-level per-SoC functions called by this
348 * function remap the SoC-specific reset source bits into an
349 * OMAP-common set of reset source bits, defined in
350 * arch/arm/mach-omap2/prm.h. Returns the standardized reset source
351 * u32 bitmask from the hardware upon success, or returns (1 <<
352 * OMAP_UNKNOWN_RST_SRC_ID_SHIFT) if no low-level read_reset_sources()
353 * function was registered.
354 */
355u32 prm_read_reset_sources(void)
335{ 356{
336 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 357 u32 ret = 1 << OMAP_UNKNOWN_RST_SRC_ID_SHIFT;
337}
338 358
339u32 __weak omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, 359 if (prm_ll_data->read_reset_sources)
340 s16 module, s16 idx) 360 ret = prm_ll_data->read_reset_sources();
341{ 361 else
342 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 362 WARN_ONCE(1, "prm: %s: no mapping function defined for reset sources\n", __func__);
343 return 0;
344}
345 363
346u32 __weak omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) 364 return ret;
347{
348 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
349 return 0;
350} 365}
351 366
352u32 __weak omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) 367/**
368 * prm_was_any_context_lost_old - was device context lost? (old API)
369 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
370 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
371 * @idx: CONTEXT register offset
372 *
373 * Return 1 if any bits were set in the *_CONTEXT_* register
374 * identified by (@part, @inst, @idx), which means that some context
375 * was lost for that module; otherwise, return 0. XXX Deprecated;
376 * callers need to use a less-SoC-dependent way to identify hardware
377 * IP blocks.
378 */
379bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx)
353{ 380{
354 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 381 bool ret = true;
355 return 0;
356}
357 382
358u32 __weak omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) 383 if (prm_ll_data->was_any_context_lost_old)
359{ 384 ret = prm_ll_data->was_any_context_lost_old(part, inst, idx);
360 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 385 else
361 return 0; 386 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
387 __func__);
388
389 return ret;
362} 390}
363 391
364int __weak omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) 392/**
393 * prm_clear_context_lost_flags_old - clear context loss flags (old API)
394 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
395 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
396 * @idx: CONTEXT register offset
397 *
398 * Clear hardware context loss bits for the module identified by
399 * (@part, @inst, @idx). No return value. XXX Deprecated; callers
400 * need to use a less-SoC-dependent way to identify hardware IP
401 * blocks.
402 */
403void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx)
365{ 404{
366 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 405 if (prm_ll_data->clear_context_loss_flags_old)
367 return 0; 406 prm_ll_data->clear_context_loss_flags_old(part, inst, idx);
407 else
408 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
409 __func__);
368} 410}
369 411
370int __weak omap2_prm_assert_hardreset(s16 prm_mod, u8 shift) 412/**
413 * prm_register - register per-SoC low-level data with the PRM
414 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
415 *
416 * Register per-SoC low-level OMAP PRM data and function pointers with
417 * the OMAP PRM common interface. The caller must keep the data
418 * pointed to by @pld valid until it calls prm_unregister() and
419 * it returns successfully. Returns 0 upon success, -EINVAL if @pld
420 * is NULL, or -EEXIST if prm_register() has already been called
421 * without an intervening prm_unregister().
422 */
423int prm_register(struct prm_ll_data *pld)
371{ 424{
372 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 425 if (!pld)
426 return -EINVAL;
427
428 if (prm_ll_data != &null_prm_ll_data)
429 return -EEXIST;
430
431 prm_ll_data = pld;
432
373 return 0; 433 return 0;
374} 434}
375 435
376int __weak omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, 436/**
377 u8 st_shift) 437 * prm_unregister - unregister per-SoC low-level data & function pointers
438 * @pld: low-level per-SoC OMAP PRM data & function pointers to unregister
439 *
440 * Unregister per-SoC low-level OMAP PRM data and function pointers
441 * that were previously registered with prm_register(). The
442 * caller may not destroy any of the data pointed to by @pld until
443 * this function returns successfully. Returns 0 upon success, or
444 * -EINVAL if @pld is NULL or if @pld does not match the struct
445 * prm_ll_data * previously registered by prm_register().
446 */
447int prm_unregister(struct prm_ll_data *pld)
378{ 448{
379 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 449 if (!pld || prm_ll_data != pld)
450 return -EINVAL;
451
452 prm_ll_data = &null_prm_ll_data;
453
380 return 0; 454 return 0;
381} 455}
382
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index 46f2efb3659..a2ede2d6548 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -30,4 +30,6 @@ extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
30extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, 30extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
31 u16 rstctrl_offs); 31 u16 rstctrl_offs);
32 32
33extern void omap_prm_base_init(void);
34
33#endif 35#endif
diff --git a/arch/arm/mach-omap2/scrm44xx.h b/arch/arm/mach-omap2/scrm44xx.h
index 701bf2d3294..e897ac89a3f 100644
--- a/arch/arm/mach-omap2/scrm44xx.h
+++ b/arch/arm/mach-omap2/scrm44xx.h
@@ -127,12 +127,14 @@
127/* AUXCLKREQ0 */ 127/* AUXCLKREQ0 */
128#define OMAP4_MAPPING_SHIFT 2 128#define OMAP4_MAPPING_SHIFT 2
129#define OMAP4_MAPPING_MASK (0x7 << 2) 129#define OMAP4_MAPPING_MASK (0x7 << 2)
130#define OMAP4_MAPPING_WIDTH 3
130#define OMAP4_ACCURACY_SHIFT 1 131#define OMAP4_ACCURACY_SHIFT 1
131#define OMAP4_ACCURACY_MASK (1 << 1) 132#define OMAP4_ACCURACY_MASK (1 << 1)
132 133
133/* AUXCLK0 */ 134/* AUXCLK0 */
134#define OMAP4_CLKDIV_SHIFT 16 135#define OMAP4_CLKDIV_SHIFT 16
135#define OMAP4_CLKDIV_MASK (0xf << 16) 136#define OMAP4_CLKDIV_MASK (0xf << 16)
137#define OMAP4_CLKDIV_WIDTH 4
136#define OMAP4_DISABLECLK_SHIFT 9 138#define OMAP4_DISABLECLK_SHIFT 9
137#define OMAP4_DISABLECLK_MASK (1 << 9) 139#define OMAP4_DISABLECLK_MASK (1 << 9)
138#define OMAP4_ENABLE_SHIFT 8 140#define OMAP4_ENABLE_SHIFT 8
diff --git a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
index 8bfaf342a02..1ee58c281a3 100644
--- a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
+++ b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
@@ -11,7 +11,7 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM 11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
12#define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM 12#define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
13 13
14#include <plat/sdrc.h> 14#include "sdrc.h"
15 15
16/* Hynix H8MBX00U0MER-0EM */ 16/* Hynix H8MBX00U0MER-0EM */
17static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = { 17static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
index a391b4939f7..85cccc004c0 100644
--- a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
+++ b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
16 16
17#include <plat/sdrc.h> 17#include "sdrc.h"
18 18
19/* Micron MT46H32M32LF-6 */ 19/* Micron MT46H32M32LF-6 */
20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */ 20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */
diff --git a/arch/arm/mach-omap2/sdram-nokia.c b/arch/arm/mach-omap2/sdram-nokia.c
index 845c4fd2b12..0fa7ffa9b5e 100644
--- a/arch/arm/mach-omap2/sdram-nokia.c
+++ b/arch/arm/mach-omap2/sdram-nokia.c
@@ -18,10 +18,8 @@
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include "common.h" 20#include "common.h"
21#include <plat/clock.h>
22#include <plat/sdrc.h>
23
24#include "sdram-nokia.h" 21#include "sdram-nokia.h"
22#include "sdrc.h"
25 23
26/* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */ 24/* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */
27struct sdram_timings { 25struct sdram_timings {
diff --git a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
index cd435291702..003f7bf4e2e 100644
--- a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
+++ b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
@@ -11,7 +11,7 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM 11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
12#define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM 12#define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
13 13
14#include <plat/sdrc.h> 14#include "sdrc.h"
15 15
16/* Numonyx M65KXXXXAM */ 16/* Numonyx M65KXXXXAM */
17static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = { 17static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
index 0e518a72831..8dc3de5ebb5 100644
--- a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
+++ b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
16 16
17#include <plat/sdrc.h> 17#include "sdrc.h"
18 18
19/* Qimonda HYB18M512160AF-6 */ 19/* Qimonda HYB18M512160AF-6 */
20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = { 20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index e3d345f4640..dae7e4804a4 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -24,10 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include "common.h" 26#include "common.h"
27#include <plat/clock.h> 27#include "clock.h"
28#include <plat/sram.h>
29
30#include <plat/sdrc.h>
31#include "sdrc.h" 28#include "sdrc.h"
32 29
33static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; 30static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
@@ -115,12 +112,10 @@ int omap2_sdrc_get_params(unsigned long r,
115} 112}
116 113
117 114
118void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 115void __init omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms)
119{ 116{
120 if (omap2_globals->sdrc) 117 omap2_sdrc_base = sdrc;
121 omap2_sdrc_base = omap2_globals->sdrc; 118 omap2_sms_base = sms;
122 if (omap2_globals->sms)
123 omap2_sms_base = omap2_globals->sms;
124} 119}
125 120
126/** 121/**
@@ -160,19 +155,3 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
160 sdrc_write_reg(l, SDRC_POWER); 155 sdrc_write_reg(l, SDRC_POWER);
161 omap2_sms_save_context(); 156 omap2_sms_save_context();
162} 157}
163
164void omap2_sms_write_rot_control(u32 val, unsigned ctx)
165{
166 sms_write_reg(val, SMS_ROT_CONTROL(ctx));
167}
168
169void omap2_sms_write_rot_size(u32 val, unsigned ctx)
170{
171 sms_write_reg(val, SMS_ROT_SIZE(ctx));
172}
173
174void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx)
175{
176 sms_write_reg(val, SMS_ROT_PHYSICAL_BA(ctx));
177}
178
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index b3f83799e6c..446aa13511f 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -2,12 +2,14 @@
2#define __ARCH_ARM_MACH_OMAP2_SDRC_H 2#define __ARCH_ARM_MACH_OMAP2_SDRC_H
3 3
4/* 4/*
5 * OMAP2 SDRC register definitions 5 * OMAP2/3 SDRC/SMS macros and prototypes
6 * 6 *
7 * Copyright (C) 2007 Texas Instruments, Inc. 7 * Copyright (C) 2007-2008, 2012 Texas Instruments, Inc.
8 * Copyright (C) 2007 Nokia Corporation 8 * Copyright (C) 2007-2008 Nokia Corporation
9 * 9 *
10 * Written by Paul Walmsley 10 * Paul Walmsley
11 * Tony Lindgren
12 * Richard Woodruff
11 * 13 *
12 * This program is free software; you can redistribute it and/or modify 14 * 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 15 * it under the terms of the GNU General Public License version 2 as
@@ -15,8 +17,6 @@
15 */ 17 */
16#undef DEBUG 18#undef DEBUG
17 19
18#include <plat/sdrc.h>
19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21 21
22#include <linux/io.h> 22#include <linux/io.h>
@@ -50,6 +50,60 @@ static inline u32 sms_read_reg(u16 reg)
50{ 50{
51 return __raw_readl(OMAP_SMS_REGADDR(reg)); 51 return __raw_readl(OMAP_SMS_REGADDR(reg));
52} 52}
53
54extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms);
55
56
57/**
58 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
59 * @rate: SDRC clock rate (in Hz)
60 * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
61 * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
62 * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
63 * @mr: Value to program to SDRC_MR for this rate
64 *
65 * This structure holds a pre-computed set of register values for the
66 * SDRC for a given SDRC clock rate and SDRAM chip. These are
67 * intended to be pre-computed and specified in an array in the board-*.c
68 * files. The structure is keyed off the 'rate' field.
69 */
70struct omap_sdrc_params {
71 unsigned long rate;
72 u32 actim_ctrla;
73 u32 actim_ctrlb;
74 u32 rfr_ctrl;
75 u32 mr;
76};
77
78#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
79void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
80 struct omap_sdrc_params *sdrc_cs1);
81#else
82static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
83 struct omap_sdrc_params *sdrc_cs1) {};
84#endif
85
86int omap2_sdrc_get_params(unsigned long r,
87 struct omap_sdrc_params **sdrc_cs0,
88 struct omap_sdrc_params **sdrc_cs1);
89void omap2_sms_save_context(void);
90void omap2_sms_restore_context(void);
91
92struct memory_timings {
93 u32 m_type; /* ddr = 1, sdr = 0 */
94 u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
95 u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
96 u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
97 u32 base_cs; /* base chip select to use for calculations */
98};
99
100extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
101struct omap_sdrc_params *rx51_get_sdram_timings(void);
102
103u32 omap2xxx_sdrc_dll_is_unlocked(void);
104u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
105
106
53#else 107#else
54#define OMAP242X_SDRC_REGADDR(reg) \ 108#define OMAP242X_SDRC_REGADDR(reg) \
55 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) 109 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
@@ -57,6 +111,7 @@ static inline u32 sms_read_reg(u16 reg)
57 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) 111 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
58#define OMAP34XX_SDRC_REGADDR(reg) \ 112#define OMAP34XX_SDRC_REGADDR(reg) \
59 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) 113 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
114
60#endif /* __ASSEMBLER__ */ 115#endif /* __ASSEMBLER__ */
61 116
62/* Minimum frequency that the SDRC DLL can lock at */ 117/* Minimum frequency that the SDRC DLL can lock at */
@@ -74,4 +129,85 @@ static inline u32 sms_read_reg(u16 reg)
74 */ 129 */
75#define SDRC_MPURATE_LOOPS 96 130#define SDRC_MPURATE_LOOPS 96
76 131
132/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
133
134#define SDRC_SYSCONFIG 0x010
135#define SDRC_CS_CFG 0x040
136#define SDRC_SHARING 0x044
137#define SDRC_ERR_TYPE 0x04C
138#define SDRC_DLLA_CTRL 0x060
139#define SDRC_DLLA_STATUS 0x064
140#define SDRC_DLLB_CTRL 0x068
141#define SDRC_DLLB_STATUS 0x06C
142#define SDRC_POWER 0x070
143#define SDRC_MCFG_0 0x080
144#define SDRC_MR_0 0x084
145#define SDRC_EMR2_0 0x08c
146#define SDRC_ACTIM_CTRL_A_0 0x09c
147#define SDRC_ACTIM_CTRL_B_0 0x0a0
148#define SDRC_RFR_CTRL_0 0x0a4
149#define SDRC_MANUAL_0 0x0a8
150#define SDRC_MCFG_1 0x0B0
151#define SDRC_MR_1 0x0B4
152#define SDRC_EMR2_1 0x0BC
153#define SDRC_ACTIM_CTRL_A_1 0x0C4
154#define SDRC_ACTIM_CTRL_B_1 0x0C8
155#define SDRC_RFR_CTRL_1 0x0D4
156#define SDRC_MANUAL_1 0x0D8
157
158#define SDRC_POWER_AUTOCOUNT_SHIFT 8
159#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
160#define SDRC_POWER_CLKCTRL_SHIFT 4
161#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
162#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
163
164/*
165 * These values represent the number of memory clock cycles between
166 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
167 * rows per device, and include a subtraction of a 50 cycle window in the
168 * event that the autorefresh command is delayed due to other SDRC activity.
169 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
170 * counter reaches 0.
171 *
172 * These represent optimal values for common parts, it won't work for all.
173 * As long as you scale down, most parameters are still work, they just
174 * become sub-optimal. The RFR value goes in the opposite direction. If you
175 * don't adjust it down as your clock period increases the refresh interval
176 * will not be met. Setting all parameters for complete worst case may work,
177 * but may cut memory performance by 2x. Due to errata the DLLs need to be
178 * unlocked and their value needs run time calibration. A dynamic call is
179 * need for that as no single right value exists acorss production samples.
180 *
181 * Only the FULL speed values are given. Current code is such that rate
182 * changes must be made at DPLLoutx2. The actual value adjustment for low
183 * frequency operation will be handled by omap_set_performance()
184 *
185 * By having the boot loader boot up in the fastest L4 speed available likely
186 * will result in something which you can switch between.
187 */
188#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
189#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
190#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
191#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
192#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
193
194
195/*
196 * SMS register access
197 */
198
199#define OMAP242X_SMS_REGADDR(reg) \
200 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
201#define OMAP243X_SMS_REGADDR(reg) \
202 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
203#define OMAP343X_SMS_REGADDR(reg) \
204 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
205
206/* SMS register offsets - read/write with sms_{read,write}_reg() */
207
208#define SMS_SYSCONFIG 0x010
209/* REVISIT: fill in other SMS registers here */
210
211
212
77#endif 213#endif
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 73e55e48532..90729171464 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -24,16 +24,13 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <plat/clock.h>
28#include <plat/sram.h>
29#include <plat/sdrc.h>
30
31#include "soc.h" 27#include "soc.h"
32#include "iomap.h" 28#include "iomap.h"
33#include "common.h" 29#include "common.h"
34#include "prm2xxx_3xxx.h" 30#include "prm2xxx.h"
35#include "clock.h" 31#include "clock.h"
36#include "sdrc.h" 32#include "sdrc.h"
33#include "sram.h"
37 34
38/* Memory timing, DLL mode flags */ 35/* Memory timing, DLL mode flags */
39#define M_DDR 1 36#define M_DDR 1
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index a507cd6cf4f..93d102535c8 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -26,21 +26,22 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
28#include <linux/console.h> 28#include <linux/console.h>
29#include <linux/omap-dma.h>
29 30
30#include <plat/omap-serial.h> 31#include <plat/omap-serial.h>
31#include "common.h"
32#include <plat/dma.h>
33#include <plat/omap_hwmod.h>
34#include <plat/omap_device.h>
35#include <plat/omap-pm.h>
36#include <plat/serial.h>
37 32
33#include "common.h"
34#include "omap_hwmod.h"
35#include "omap_device.h"
36#include "omap-pm.h"
37#include "soc.h"
38#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
39#include "pm.h" 39#include "pm.h"
40#include "cm2xxx_3xxx.h" 40#include "cm2xxx_3xxx.h"
41#include "prm-regbits-34xx.h" 41#include "prm-regbits-34xx.h"
42#include "control.h" 42#include "control.h"
43#include "mux.h" 43#include "mux.h"
44#include "serial.h"
44 45
45/* 46/*
46 * NOTE: By default the serial auto_suspend timeout is disabled as it causes 47 * NOTE: By default the serial auto_suspend timeout is disabled as it causes
diff --git a/arch/arm/mach-omap2/serial.h b/arch/arm/mach-omap2/serial.h
new file mode 100644
index 00000000000..c4014f013df
--- /dev/null
+++ b/arch/arm/mach-omap2/serial.h
@@ -0,0 +1 @@
#include <mach/serial.h>
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 506987979c1..d1dedc8195e 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -26,13 +26,12 @@
26 26
27#include <asm/assembler.h> 27#include <asm/assembler.h>
28 28
29#include <plat/sram.h>
30
31#include "omap34xx.h" 29#include "omap34xx.h"
32#include "iomap.h" 30#include "iomap.h"
33#include "cm2xxx_3xxx.h" 31#include "cm3xxx.h"
34#include "prm2xxx_3xxx.h" 32#include "prm3xxx.h"
35#include "sdrc.h" 33#include "sdrc.h"
34#include "sram.h"
36#include "control.h" 35#include "control.h"
37 36
38/* 37/*
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index fc9b96daf85..f31d90774de 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -1,7 +1,469 @@
1#include <plat/cpu.h> 1/*
2 * OMAP cpu type detection
3 *
4 * Copyright (C) 2004, 2008 Nokia Corporation
5 *
6 * Copyright (C) 2009-11 Texas Instruments.
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@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 as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
2#include "omap24xx.h" 28#include "omap24xx.h"
3#include "omap34xx.h" 29#include "omap34xx.h"
4#include "omap44xx.h" 30#include "omap44xx.h"
5#include "ti81xx.h" 31#include "ti81xx.h"
6#include "am33xx.h" 32#include "am33xx.h"
7#include "omap54xx.h" 33#include "omap54xx.h"
34
35#ifndef __ASSEMBLY__
36
37#include <linux/bitops.h>
38
39/*
40 * Test if multicore OMAP support is needed
41 */
42#undef MULTI_OMAP2
43#undef OMAP_NAME
44
45#ifdef CONFIG_SOC_OMAP2420
46# ifdef OMAP_NAME
47# undef MULTI_OMAP2
48# define MULTI_OMAP2
49# else
50# define OMAP_NAME omap2420
51# endif
52#endif
53#ifdef CONFIG_SOC_OMAP2430
54# ifdef OMAP_NAME
55# undef MULTI_OMAP2
56# define MULTI_OMAP2
57# else
58# define OMAP_NAME omap2430
59# endif
60#endif
61#ifdef CONFIG_ARCH_OMAP3
62# ifdef OMAP_NAME
63# undef MULTI_OMAP2
64# define MULTI_OMAP2
65# else
66# define OMAP_NAME omap3
67# endif
68#endif
69#ifdef CONFIG_ARCH_OMAP4
70# ifdef OMAP_NAME
71# undef MULTI_OMAP2
72# define MULTI_OMAP2
73# else
74# define OMAP_NAME omap4
75# endif
76#endif
77
78#ifdef CONFIG_SOC_OMAP5
79# ifdef OMAP_NAME
80# undef MULTI_OMAP2
81# define MULTI_OMAP2
82# else
83# define OMAP_NAME omap5
84# endif
85#endif
86
87#ifdef CONFIG_SOC_AM33XX
88# ifdef OMAP_NAME
89# undef MULTI_OMAP2
90# define MULTI_OMAP2
91# else
92# define OMAP_NAME am33xx
93# endif
94#endif
95
96/*
97 * Omap device type i.e. EMU/HS/TST/GP/BAD
98 */
99#define OMAP2_DEVICE_TYPE_TEST 0
100#define OMAP2_DEVICE_TYPE_EMU 1
101#define OMAP2_DEVICE_TYPE_SEC 2
102#define OMAP2_DEVICE_TYPE_GP 3
103#define OMAP2_DEVICE_TYPE_BAD 4
104
105int omap_type(void);
106
107/*
108 * omap_rev bits:
109 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
110 * CPU revision (See _REV_ defined in cpu.h) [15:08]
111 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
112 */
113unsigned int omap_rev(void);
114
115/*
116 * Get the CPU revision for OMAP devices
117 */
118#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
119
120/*
121 * Macros to group OMAP into cpu classes.
122 * These can be used in most places.
123 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
124 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
125 * cpu_is_omap243x(): True for OMAP2430
126 * cpu_is_omap343x(): True for OMAP3430
127 * cpu_is_omap443x(): True for OMAP4430
128 * cpu_is_omap446x(): True for OMAP4460
129 * cpu_is_omap447x(): True for OMAP4470
130 * soc_is_omap543x(): True for OMAP5430, OMAP5432
131 */
132#define GET_OMAP_CLASS (omap_rev() & 0xff)
133
134#define IS_OMAP_CLASS(class, id) \
135static inline int is_omap ##class (void) \
136{ \
137 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
138}
139
140#define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
141
142#define IS_AM_CLASS(class, id) \
143static inline int is_am ##class (void) \
144{ \
145 return (GET_AM_CLASS == (id)) ? 1 : 0; \
146}
147
148#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
149
150#define IS_TI_CLASS(class, id) \
151static inline int is_ti ##class (void) \
152{ \
153 return (GET_TI_CLASS == (id)) ? 1 : 0; \
154}
155
156#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
157
158#define IS_OMAP_SUBCLASS(subclass, id) \
159static inline int is_omap ##subclass (void) \
160{ \
161 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
162}
163
164#define IS_TI_SUBCLASS(subclass, id) \
165static inline int is_ti ##subclass (void) \
166{ \
167 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
168}
169
170#define IS_AM_SUBCLASS(subclass, id) \
171static inline int is_am ##subclass (void) \
172{ \
173 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
174}
175
176IS_OMAP_CLASS(24xx, 0x24)
177IS_OMAP_CLASS(34xx, 0x34)
178IS_OMAP_CLASS(44xx, 0x44)
179IS_AM_CLASS(35xx, 0x35)
180IS_OMAP_CLASS(54xx, 0x54)
181IS_AM_CLASS(33xx, 0x33)
182
183IS_TI_CLASS(81xx, 0x81)
184
185IS_OMAP_SUBCLASS(242x, 0x242)
186IS_OMAP_SUBCLASS(243x, 0x243)
187IS_OMAP_SUBCLASS(343x, 0x343)
188IS_OMAP_SUBCLASS(363x, 0x363)
189IS_OMAP_SUBCLASS(443x, 0x443)
190IS_OMAP_SUBCLASS(446x, 0x446)
191IS_OMAP_SUBCLASS(447x, 0x447)
192IS_OMAP_SUBCLASS(543x, 0x543)
193
194IS_TI_SUBCLASS(816x, 0x816)
195IS_TI_SUBCLASS(814x, 0x814)
196IS_AM_SUBCLASS(335x, 0x335)
197
198#define cpu_is_omap24xx() 0
199#define cpu_is_omap242x() 0
200#define cpu_is_omap243x() 0
201#define cpu_is_omap34xx() 0
202#define cpu_is_omap343x() 0
203#define cpu_is_ti81xx() 0
204#define cpu_is_ti816x() 0
205#define cpu_is_ti814x() 0
206#define soc_is_am35xx() 0
207#define soc_is_am33xx() 0
208#define soc_is_am335x() 0
209#define cpu_is_omap44xx() 0
210#define cpu_is_omap443x() 0
211#define cpu_is_omap446x() 0
212#define cpu_is_omap447x() 0
213#define soc_is_omap54xx() 0
214#define soc_is_omap543x() 0
215
216#if defined(MULTI_OMAP2)
217# if defined(CONFIG_ARCH_OMAP2)
218# undef cpu_is_omap24xx
219# define cpu_is_omap24xx() is_omap24xx()
220# endif
221# if defined (CONFIG_SOC_OMAP2420)
222# undef cpu_is_omap242x
223# define cpu_is_omap242x() is_omap242x()
224# endif
225# if defined (CONFIG_SOC_OMAP2430)
226# undef cpu_is_omap243x
227# define cpu_is_omap243x() is_omap243x()
228# endif
229# if defined(CONFIG_ARCH_OMAP3)
230# undef cpu_is_omap34xx
231# undef cpu_is_omap343x
232# define cpu_is_omap34xx() is_omap34xx()
233# define cpu_is_omap343x() is_omap343x()
234# endif
235#else
236# if defined(CONFIG_ARCH_OMAP2)
237# undef cpu_is_omap24xx
238# define cpu_is_omap24xx() 1
239# endif
240# if defined(CONFIG_SOC_OMAP2420)
241# undef cpu_is_omap242x
242# define cpu_is_omap242x() 1
243# endif
244# if defined(CONFIG_SOC_OMAP2430)
245# undef cpu_is_omap243x
246# define cpu_is_omap243x() 1
247# endif
248# if defined(CONFIG_ARCH_OMAP3)
249# undef cpu_is_omap34xx
250# define cpu_is_omap34xx() 1
251# endif
252# if defined(CONFIG_SOC_OMAP3430)
253# undef cpu_is_omap343x
254# define cpu_is_omap343x() 1
255# endif
256#endif
257
258/*
259 * Macros to detect individual cpu types.
260 * These are only rarely needed.
261 * cpu_is_omap2420(): True for OMAP2420
262 * cpu_is_omap2422(): True for OMAP2422
263 * cpu_is_omap2423(): True for OMAP2423
264 * cpu_is_omap2430(): True for OMAP2430
265 * cpu_is_omap3430(): True for OMAP3430
266 */
267#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
268
269#define IS_OMAP_TYPE(type, id) \
270static inline int is_omap ##type (void) \
271{ \
272 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
273}
274
275IS_OMAP_TYPE(2420, 0x2420)
276IS_OMAP_TYPE(2422, 0x2422)
277IS_OMAP_TYPE(2423, 0x2423)
278IS_OMAP_TYPE(2430, 0x2430)
279IS_OMAP_TYPE(3430, 0x3430)
280
281#define cpu_is_omap2420() 0
282#define cpu_is_omap2422() 0
283#define cpu_is_omap2423() 0
284#define cpu_is_omap2430() 0
285#define cpu_is_omap3430() 0
286#define cpu_is_omap3630() 0
287#define soc_is_omap5430() 0
288
289/* These are needed for the common code */
290#ifdef CONFIG_ARCH_OMAP2PLUS
291#define cpu_is_omap7xx() 0
292#define cpu_is_omap15xx() 0
293#define cpu_is_omap16xx() 0
294#define cpu_is_omap1510() 0
295#define cpu_is_omap1610() 0
296#define cpu_is_omap1611() 0
297#define cpu_is_omap1621() 0
298#define cpu_is_omap1710() 0
299#define cpu_class_is_omap1() 0
300#define cpu_class_is_omap2() 1
301#endif
302
303#if defined(CONFIG_ARCH_OMAP2)
304# undef cpu_is_omap2420
305# undef cpu_is_omap2422
306# undef cpu_is_omap2423
307# undef cpu_is_omap2430
308# define cpu_is_omap2420() is_omap2420()
309# define cpu_is_omap2422() is_omap2422()
310# define cpu_is_omap2423() is_omap2423()
311# define cpu_is_omap2430() is_omap2430()
312#endif
313
314#if defined(CONFIG_ARCH_OMAP3)
315# undef cpu_is_omap3430
316# undef cpu_is_ti81xx
317# undef cpu_is_ti816x
318# undef cpu_is_ti814x
319# undef soc_is_am35xx
320# define cpu_is_omap3430() is_omap3430()
321# undef cpu_is_omap3630
322# define cpu_is_omap3630() is_omap363x()
323# define cpu_is_ti81xx() is_ti81xx()
324# define cpu_is_ti816x() is_ti816x()
325# define cpu_is_ti814x() is_ti814x()
326# define soc_is_am35xx() is_am35xx()
327#endif
328
329# if defined(CONFIG_SOC_AM33XX)
330# undef soc_is_am33xx
331# undef soc_is_am335x
332# define soc_is_am33xx() is_am33xx()
333# define soc_is_am335x() is_am335x()
334#endif
335
336# if defined(CONFIG_ARCH_OMAP4)
337# undef cpu_is_omap44xx
338# undef cpu_is_omap443x
339# undef cpu_is_omap446x
340# undef cpu_is_omap447x
341# define cpu_is_omap44xx() is_omap44xx()
342# define cpu_is_omap443x() is_omap443x()
343# define cpu_is_omap446x() is_omap446x()
344# define cpu_is_omap447x() is_omap447x()
345# endif
346
347# if defined(CONFIG_SOC_OMAP5)
348# undef soc_is_omap54xx
349# undef soc_is_omap543x
350# define soc_is_omap54xx() is_omap54xx()
351# define soc_is_omap543x() is_omap543x()
352#endif
353
354/* Various silicon revisions for omap2 */
355#define OMAP242X_CLASS 0x24200024
356#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
357#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
358
359#define OMAP243X_CLASS 0x24300024
360#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
361
362#define OMAP343X_CLASS 0x34300034
363#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
364#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
365#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
366#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
367#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
368#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
369
370#define OMAP363X_CLASS 0x36300034
371#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
372#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
373#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
374
375#define TI816X_CLASS 0x81600034
376#define TI8168_REV_ES1_0 TI816X_CLASS
377#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
378
379#define TI814X_CLASS 0x81400034
380#define TI8148_REV_ES1_0 TI814X_CLASS
381#define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
382#define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
383
384#define AM35XX_CLASS 0x35170034
385#define AM35XX_REV_ES1_0 AM35XX_CLASS
386#define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
387
388#define AM335X_CLASS 0x33500033
389#define AM335X_REV_ES1_0 AM335X_CLASS
390
391#define OMAP443X_CLASS 0x44300044
392#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
393#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
394#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
395#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
396#define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
397
398#define OMAP446X_CLASS 0x44600044
399#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
400#define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
401
402#define OMAP447X_CLASS 0x44700044
403#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
404
405#define OMAP54XX_CLASS 0x54000054
406#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
407#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
408
409void omap2xxx_check_revision(void);
410void omap3xxx_check_revision(void);
411void omap4xxx_check_revision(void);
412void omap5xxx_check_revision(void);
413void omap3xxx_check_features(void);
414void ti81xx_check_features(void);
415void omap4xxx_check_features(void);
416
417/*
418 * Runtime detection of OMAP3 features
419 *
420 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
421 * family have OS-level control over the I/O chain clock. This is
422 * to avoid a window during which wakeups could potentially be lost
423 * during powerdomain transitions. If this bit is set, it
424 * indicates that the chip does support OS-level control of this
425 * feature.
426 */
427extern u32 omap_features;
428
429#define OMAP3_HAS_L2CACHE BIT(0)
430#define OMAP3_HAS_IVA BIT(1)
431#define OMAP3_HAS_SGX BIT(2)
432#define OMAP3_HAS_NEON BIT(3)
433#define OMAP3_HAS_ISP BIT(4)
434#define OMAP3_HAS_192MHZ_CLK BIT(5)
435#define OMAP3_HAS_IO_WAKEUP BIT(6)
436#define OMAP3_HAS_SDRC BIT(7)
437#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
438#define OMAP4_HAS_PERF_SILICON BIT(9)
439
440
441#define OMAP3_HAS_FEATURE(feat,flag) \
442static inline unsigned int omap3_has_ ##feat(void) \
443{ \
444 return omap_features & OMAP3_HAS_ ##flag; \
445} \
446
447OMAP3_HAS_FEATURE(l2cache, L2CACHE)
448OMAP3_HAS_FEATURE(sgx, SGX)
449OMAP3_HAS_FEATURE(iva, IVA)
450OMAP3_HAS_FEATURE(neon, NEON)
451OMAP3_HAS_FEATURE(isp, ISP)
452OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
453OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
454OMAP3_HAS_FEATURE(sdrc, SDRC)
455OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
456
457/*
458 * Runtime detection of OMAP4 features
459 */
460#define OMAP4_HAS_FEATURE(feat, flag) \
461static inline unsigned int omap4_has_ ##feat(void) \
462{ \
463 return omap_features & OMAP4_HAS_ ##flag; \
464} \
465
466OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON)
467
468#endif /* __ASSEMBLY__ */
469
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index f8217a5a4a2..b9753fe2723 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -23,8 +23,8 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <plat/omap_device.h> 26#include "soc.h"
27 27#include "omap_device.h"
28#include "voltage.h" 28#include "voltage.h"
29#include "control.h" 29#include "control.h"
30#include "pm.h" 30#include "pm.h"
@@ -121,6 +121,19 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
121 sr_data->senn_mod = 0x1; 121 sr_data->senn_mod = 0x1;
122 sr_data->senp_mod = 0x1; 122 sr_data->senp_mod = 0x1;
123 123
124 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
125 sr_data->err_weight = OMAP3430_SR_ERRWEIGHT;
126 sr_data->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
127 sr_data->accum_data = OMAP3430_SR_ACCUMDATA;
128 if (!(strcmp(sr_data->name, "smartreflex_mpu"))) {
129 sr_data->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT;
130 sr_data->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT;
131 } else {
132 sr_data->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT;
133 sr_data->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT;
134 }
135 }
136
124 sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); 137 sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name);
125 if (!sr_data->voltdm) { 138 if (!sr_data->voltdm) {
126 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", 139 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
diff --git a/arch/arm/mach-omap2/sram.c b/arch/arm/mach-omap2/sram.c
new file mode 100644
index 00000000000..0ff0f068bea
--- /dev/null
+++ b/arch/arm/mach-omap2/sram.c
@@ -0,0 +1,305 @@
1/*
2 *
3 * OMAP SRAM detection and management
4 *
5 * Copyright (C) 2005 Nokia Corporation
6 * Written by Tony Lindgren <tony@atomide.com>
7 *
8 * Copyright (C) 2009-2012 Texas Instruments
9 * Added OMAP4/5 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/io.h>
20
21#include <asm/fncpy.h>
22#include <asm/tlb.h>
23#include <asm/cacheflush.h>
24
25#include <asm/mach/map.h>
26
27#include "soc.h"
28#include "iomap.h"
29#include "prm2xxx_3xxx.h"
30#include "sdrc.h"
31#include "sram.h"
32
33#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800)
34#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000)
35#ifdef CONFIG_OMAP4_ERRATA_I688
36#define OMAP4_SRAM_PUB_PA OMAP4_SRAM_PA
37#else
38#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000)
39#endif
40#define OMAP5_SRAM_PA 0x40300000
41
42#define SRAM_BOOTLOADER_SZ 0x00
43
44#define OMAP24XX_VA_REQINFOPERM0 OMAP2_L3_IO_ADDRESS(0x68005048)
45#define OMAP24XX_VA_READPERM0 OMAP2_L3_IO_ADDRESS(0x68005050)
46#define OMAP24XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68005058)
47
48#define OMAP34XX_VA_REQINFOPERM0 OMAP2_L3_IO_ADDRESS(0x68012848)
49#define OMAP34XX_VA_READPERM0 OMAP2_L3_IO_ADDRESS(0x68012850)
50#define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
51#define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880)
52#define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048)
53
54#define GP_DEVICE 0x300
55
56#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
57
58static unsigned long omap_sram_start;
59static unsigned long omap_sram_skip;
60static unsigned long omap_sram_size;
61
62/*
63 * Depending on the target RAMFS firewall setup, the public usable amount of
64 * SRAM varies. The default accessible size for all device types is 2k. A GP
65 * device allows ARM11 but not other initiators for full size. This
66 * functionality seems ok until some nice security API happens.
67 */
68static int is_sram_locked(void)
69{
70 if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
71 /* RAMFW: R/W access to all initiators for all qualifier sets */
72 if (cpu_is_omap242x()) {
73 __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
74 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */
75 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
76 }
77 if (cpu_is_omap34xx()) {
78 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
79 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */
80 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
81 __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2);
82 __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
83 }
84 return 0;
85 } else
86 return 1; /* assume locked with no PPA or security driver */
87}
88
89/*
90 * The amount of SRAM depends on the core type.
91 * Note that we cannot try to test for SRAM here because writes
92 * to secure SRAM will hang the system. Also the SRAM is not
93 * yet mapped at this point.
94 */
95static void __init omap_detect_sram(void)
96{
97 omap_sram_skip = SRAM_BOOTLOADER_SZ;
98 if (is_sram_locked()) {
99 if (cpu_is_omap34xx()) {
100 omap_sram_start = OMAP3_SRAM_PUB_PA;
101 if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
102 (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
103 omap_sram_size = 0x7000; /* 28K */
104 omap_sram_skip += SZ_16K;
105 } else {
106 omap_sram_size = 0x8000; /* 32K */
107 }
108 } else if (cpu_is_omap44xx()) {
109 omap_sram_start = OMAP4_SRAM_PUB_PA;
110 omap_sram_size = 0xa000; /* 40K */
111 } else if (soc_is_omap54xx()) {
112 omap_sram_start = OMAP5_SRAM_PA;
113 omap_sram_size = SZ_128K; /* 128KB */
114 } else {
115 omap_sram_start = OMAP2_SRAM_PUB_PA;
116 omap_sram_size = 0x800; /* 2K */
117 }
118 } else {
119 if (soc_is_am33xx()) {
120 omap_sram_start = AM33XX_SRAM_PA;
121 omap_sram_size = 0x10000; /* 64K */
122 } else if (cpu_is_omap34xx()) {
123 omap_sram_start = OMAP3_SRAM_PA;
124 omap_sram_size = 0x10000; /* 64K */
125 } else if (cpu_is_omap44xx()) {
126 omap_sram_start = OMAP4_SRAM_PA;
127 omap_sram_size = 0xe000; /* 56K */
128 } else if (soc_is_omap54xx()) {
129 omap_sram_start = OMAP5_SRAM_PA;
130 omap_sram_size = SZ_128K; /* 128KB */
131 } else {
132 omap_sram_start = OMAP2_SRAM_PA;
133 if (cpu_is_omap242x())
134 omap_sram_size = 0xa0000; /* 640K */
135 else if (cpu_is_omap243x())
136 omap_sram_size = 0x10000; /* 64K */
137 }
138 }
139}
140
141/*
142 * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
143 */
144static void __init omap2_map_sram(void)
145{
146 int cached = 1;
147
148#ifdef CONFIG_OMAP4_ERRATA_I688
149 if (cpu_is_omap44xx()) {
150 omap_sram_start += PAGE_SIZE;
151 omap_sram_size -= SZ_16K;
152 }
153#endif
154 if (cpu_is_omap34xx()) {
155 /*
156 * SRAM must be marked as non-cached on OMAP3 since the
157 * CORE DPLL M2 divider change code (in SRAM) runs with the
158 * SDRAM controller disabled, and if it is marked cached,
159 * the ARM may attempt to write cache lines back to SDRAM
160 * which will cause the system to hang.
161 */
162 cached = 0;
163 }
164
165 omap_map_sram(omap_sram_start, omap_sram_size,
166 omap_sram_skip, cached);
167}
168
169static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
170 u32 base_cs, u32 force_unlock);
171
172void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
173 u32 base_cs, u32 force_unlock)
174{
175 BUG_ON(!_omap2_sram_ddr_init);
176 _omap2_sram_ddr_init(slow_dll_ctrl, fast_dll_ctrl,
177 base_cs, force_unlock);
178}
179
180static void (*_omap2_sram_reprogram_sdrc)(u32 perf_level, u32 dll_val,
181 u32 mem_type);
182
183void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, u32 mem_type)
184{
185 BUG_ON(!_omap2_sram_reprogram_sdrc);
186 _omap2_sram_reprogram_sdrc(perf_level, dll_val, mem_type);
187}
188
189static u32 (*_omap2_set_prcm)(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
190
191u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass)
192{
193 BUG_ON(!_omap2_set_prcm);
194 return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass);
195}
196
197#ifdef CONFIG_SOC_OMAP2420
198static int __init omap242x_sram_init(void)
199{
200 _omap2_sram_ddr_init = omap_sram_push(omap242x_sram_ddr_init,
201 omap242x_sram_ddr_init_sz);
202
203 _omap2_sram_reprogram_sdrc = omap_sram_push(omap242x_sram_reprogram_sdrc,
204 omap242x_sram_reprogram_sdrc_sz);
205
206 _omap2_set_prcm = omap_sram_push(omap242x_sram_set_prcm,
207 omap242x_sram_set_prcm_sz);
208
209 return 0;
210}
211#else
212static inline int omap242x_sram_init(void)
213{
214 return 0;
215}
216#endif
217
218#ifdef CONFIG_SOC_OMAP2430
219static int __init omap243x_sram_init(void)
220{
221 _omap2_sram_ddr_init = omap_sram_push(omap243x_sram_ddr_init,
222 omap243x_sram_ddr_init_sz);
223
224 _omap2_sram_reprogram_sdrc = omap_sram_push(omap243x_sram_reprogram_sdrc,
225 omap243x_sram_reprogram_sdrc_sz);
226
227 _omap2_set_prcm = omap_sram_push(omap243x_sram_set_prcm,
228 omap243x_sram_set_prcm_sz);
229
230 return 0;
231}
232#else
233static inline int omap243x_sram_init(void)
234{
235 return 0;
236}
237#endif
238
239#ifdef CONFIG_ARCH_OMAP3
240
241static u32 (*_omap3_sram_configure_core_dpll)(
242 u32 m2, u32 unlock_dll, u32 f, u32 inc,
243 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
244 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
245 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
246 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
247
248u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
249 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
250 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
251 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
252 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
253{
254 BUG_ON(!_omap3_sram_configure_core_dpll);
255 return _omap3_sram_configure_core_dpll(
256 m2, unlock_dll, f, inc,
257 sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
258 sdrc_actim_ctrl_b_0, sdrc_mr_0,
259 sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
260 sdrc_actim_ctrl_b_1, sdrc_mr_1);
261}
262
263void omap3_sram_restore_context(void)
264{
265 omap_sram_reset();
266
267 _omap3_sram_configure_core_dpll =
268 omap_sram_push(omap3_sram_configure_core_dpll,
269 omap3_sram_configure_core_dpll_sz);
270 omap_push_sram_idle();
271}
272
273static inline int omap34xx_sram_init(void)
274{
275 omap3_sram_restore_context();
276 return 0;
277}
278#else
279static inline int omap34xx_sram_init(void)
280{
281 return 0;
282}
283#endif /* CONFIG_ARCH_OMAP3 */
284
285static inline int am33xx_sram_init(void)
286{
287 return 0;
288}
289
290int __init omap_sram_init(void)
291{
292 omap_detect_sram();
293 omap2_map_sram();
294
295 if (cpu_is_omap242x())
296 omap242x_sram_init();
297 else if (cpu_is_omap2430())
298 omap243x_sram_init();
299 else if (soc_is_am33xx())
300 am33xx_sram_init();
301 else if (cpu_is_omap34xx())
302 omap34xx_sram_init();
303
304 return 0;
305}
diff --git a/arch/arm/mach-omap2/sram.h b/arch/arm/mach-omap2/sram.h
new file mode 100644
index 00000000000..ca7277c2a9e
--- /dev/null
+++ b/arch/arm/mach-omap2/sram.h
@@ -0,0 +1,83 @@
1/*
2 * Interface for functions that need to be run in internal SRAM
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASSEMBLY__
10#include <plat/sram.h>
11
12extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
13 u32 base_cs, u32 force_unlock);
14extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
15 u32 mem_type);
16extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
17
18extern u32 omap3_configure_core_dpll(
19 u32 m2, u32 unlock_dll, u32 f, u32 inc,
20 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
21 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
22 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
23 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
24extern void omap3_sram_restore_context(void);
25
26/* Do not use these */
27extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
28extern unsigned long omap24xx_sram_reprogram_clock_sz;
29
30extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
31 u32 base_cs, u32 force_unlock);
32extern unsigned long omap242x_sram_ddr_init_sz;
33
34extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
35 int bypass);
36extern unsigned long omap242x_sram_set_prcm_sz;
37
38extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
39 u32 mem_type);
40extern unsigned long omap242x_sram_reprogram_sdrc_sz;
41
42
43extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
44 u32 base_cs, u32 force_unlock);
45extern unsigned long omap243x_sram_ddr_init_sz;
46
47extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
48 int bypass);
49extern unsigned long omap243x_sram_set_prcm_sz;
50
51extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
52 u32 mem_type);
53extern unsigned long omap243x_sram_reprogram_sdrc_sz;
54
55extern u32 omap3_sram_configure_core_dpll(
56 u32 m2, u32 unlock_dll, u32 f, u32 inc,
57 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
58 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
59 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
60 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
61extern unsigned long omap3_sram_configure_core_dpll_sz;
62
63#ifdef CONFIG_PM
64extern void omap_push_sram_idle(void);
65#else
66static inline void omap_push_sram_idle(void) {}
67#endif /* CONFIG_PM */
68
69#endif /* __ASSEMBLY__ */
70
71/*
72 * OMAP2+: define the SRAM PA addresses.
73 * Used by the SRAM management code and the idle sleep code.
74 */
75#define OMAP2_SRAM_PA 0x40200000
76#define OMAP3_SRAM_PA 0x40200000
77#ifdef CONFIG_OMAP4_ERRATA_I688
78#define OMAP4_SRAM_PA 0x40304000
79#define OMAP4_SRAM_VA 0xfe404000
80#else
81#define OMAP4_SRAM_PA 0x40300000
82#endif
83#define AM33XX_SRAM_PA 0x40300000
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index 8f7326cd435..680a7c56cc3 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -34,8 +34,8 @@
34 34
35#include "soc.h" 35#include "soc.h"
36#include "iomap.h" 36#include "iomap.h"
37#include "prm2xxx_3xxx.h" 37#include "prm2xxx.h"
38#include "cm2xxx_3xxx.h" 38#include "cm2xxx.h"
39#include "sdrc.h" 39#include "sdrc.h"
40 40
41 .text 41 .text
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index b140d657852..a1e9edd673f 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -34,8 +34,8 @@
34 34
35#include "soc.h" 35#include "soc.h"
36#include "iomap.h" 36#include "iomap.h"
37#include "prm2xxx_3xxx.h" 37#include "prm2xxx.h"
38#include "cm2xxx_3xxx.h" 38#include "cm2xxx.h"
39#include "sdrc.h" 39#include "sdrc.h"
40 40
41 .text 41 .text
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S
index 2d0ceaa23fb..1446331b576 100644
--- a/arch/arm/mach-omap2/sram34xx.S
+++ b/arch/arm/mach-omap2/sram34xx.S
@@ -32,7 +32,7 @@
32#include "soc.h" 32#include "soc.h"
33#include "iomap.h" 33#include "iomap.h"
34#include "sdrc.h" 34#include "sdrc.h"
35#include "cm2xxx_3xxx.h" 35#include "cm3xxx.h"
36 36
37/* 37/*
38 * This file needs be built unconditionally as ARM to interoperate correctly 38 * This file needs be built unconditionally as ARM to interoperate correctly
diff --git a/arch/arm/mach-omap2/ti81xx.h b/arch/arm/mach-omap2/ti81xx.h
index 8f9843f7842..a1e6caf0dba 100644
--- a/arch/arm/mach-omap2/ti81xx.h
+++ b/arch/arm/mach-omap2/ti81xx.h
@@ -22,6 +22,15 @@
22#define TI81XX_CTRL_BASE TI81XX_SCM_BASE 22#define TI81XX_CTRL_BASE TI81XX_SCM_BASE
23#define TI81XX_PRCM_BASE 0x48180000 23#define TI81XX_PRCM_BASE 0x48180000
24 24
25/*
26 * Adjust TAP register base such that omap3_check_revision accesses the correct
27 * TI81XX register for checking device ID (it adds 0x204 to tap base while
28 * TI81XX DEVICE ID register is at offset 0x600 from control base).
29 */
30#define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \
31 TI81XX_CONTROL_DEVICE_ID - 0x204)
32
33
25#define TI81XX_ARM_INTC_BASE 0x48200000 34#define TI81XX_ARM_INTC_BASE 0x48200000
26 35
27#endif /* __ASM_ARCH_TI81XX_H */ 36#endif /* __ASM_ARCH_TI81XX_H */
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 69e46631a7c..7016637b531 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -37,16 +37,21 @@
37#include <linux/clockchips.h> 37#include <linux/clockchips.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/of.h> 39#include <linux/of.h>
40#include <linux/of_address.h>
41#include <linux/of_irq.h>
42#include <linux/platform_device.h>
43#include <linux/platform_data/dmtimer-omap.h>
40 44
41#include <asm/mach/time.h> 45#include <asm/mach/time.h>
42#include <asm/smp_twd.h> 46#include <asm/smp_twd.h>
43#include <asm/sched_clock.h> 47#include <asm/sched_clock.h>
44 48
45#include <asm/arch_timer.h> 49#include <asm/arch_timer.h>
46#include <plat/omap_hwmod.h> 50#include "omap_hwmod.h"
47#include <plat/omap_device.h> 51#include "omap_device.h"
52#include <plat/counter-32k.h>
48#include <plat/dmtimer.h> 53#include <plat/dmtimer.h>
49#include <plat/omap-pm.h> 54#include "omap-pm.h"
50 55
51#include "soc.h" 56#include "soc.h"
52#include "common.h" 57#include "common.h"
@@ -61,18 +66,6 @@
61#define OMAP3_32K_SOURCE "omap_32k_fck" 66#define OMAP3_32K_SOURCE "omap_32k_fck"
62#define OMAP4_32K_SOURCE "sys_32k_ck" 67#define OMAP4_32K_SOURCE "sys_32k_ck"
63 68
64#ifdef CONFIG_OMAP_32K_TIMER
65#define OMAP2_CLKEV_SOURCE OMAP2_32K_SOURCE
66#define OMAP3_CLKEV_SOURCE OMAP3_32K_SOURCE
67#define OMAP4_CLKEV_SOURCE OMAP4_32K_SOURCE
68#define OMAP3_SECURE_TIMER 12
69#else
70#define OMAP2_CLKEV_SOURCE OMAP2_MPU_SOURCE
71#define OMAP3_CLKEV_SOURCE OMAP3_MPU_SOURCE
72#define OMAP4_CLKEV_SOURCE OMAP4_MPU_SOURCE
73#define OMAP3_SECURE_TIMER 1
74#endif
75
76#define REALTIME_COUNTER_BASE 0x48243200 69#define REALTIME_COUNTER_BASE 0x48243200
77#define INCREMENTER_NUMERATOR_OFFSET 0x10 70#define INCREMENTER_NUMERATOR_OFFSET 0x10
78#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 71#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14
@@ -103,7 +96,7 @@ static int omap2_gp_timer_set_next_event(unsigned long cycles,
103 struct clock_event_device *evt) 96 struct clock_event_device *evt)
104{ 97{
105 __omap_dm_timer_load_start(&clkev, OMAP_TIMER_CTRL_ST, 98 __omap_dm_timer_load_start(&clkev, OMAP_TIMER_CTRL_ST,
106 0xffffffff - cycles, 1); 99 0xffffffff - cycles, OMAP_TIMER_POSTED);
107 100
108 return 0; 101 return 0;
109} 102}
@@ -113,7 +106,7 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
113{ 106{
114 u32 period; 107 u32 period;
115 108
116 __omap_dm_timer_stop(&clkev, 1, clkev.rate); 109 __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate);
117 110
118 switch (mode) { 111 switch (mode) {
119 case CLOCK_EVT_MODE_PERIODIC: 112 case CLOCK_EVT_MODE_PERIODIC:
@@ -121,10 +114,10 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
121 period -= 1; 114 period -= 1;
122 /* Looks like we need to first set the load value separately */ 115 /* Looks like we need to first set the load value separately */
123 __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG, 116 __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG,
124 0xffffffff - period, 1); 117 0xffffffff - period, OMAP_TIMER_POSTED);
125 __omap_dm_timer_load_start(&clkev, 118 __omap_dm_timer_load_start(&clkev,
126 OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, 119 OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
127 0xffffffff - period, 1); 120 0xffffffff - period, OMAP_TIMER_POSTED);
128 break; 121 break;
129 case CLOCK_EVT_MODE_ONESHOT: 122 case CLOCK_EVT_MODE_ONESHOT:
130 break; 123 break;
@@ -144,36 +137,144 @@ static struct clock_event_device clockevent_gpt = {
144 .set_mode = omap2_gp_timer_set_mode, 137 .set_mode = omap2_gp_timer_set_mode,
145}; 138};
146 139
140static struct property device_disabled = {
141 .name = "status",
142 .length = sizeof("disabled"),
143 .value = "disabled",
144};
145
146static struct of_device_id omap_timer_match[] __initdata = {
147 { .compatible = "ti,omap2-timer", },
148 { }
149};
150
151/**
152 * omap_get_timer_dt - get a timer using device-tree
153 * @match - device-tree match structure for matching a device type
154 * @property - optional timer property to match
155 *
156 * Helper function to get a timer during early boot using device-tree for use
157 * as kernel system timer. Optionally, the property argument can be used to
158 * select a timer with a specific property. Once a timer is found then mark
159 * the timer node in device-tree as disabled, to prevent the kernel from
160 * registering this timer as a platform device and so no one else can use it.
161 */
162static struct device_node * __init omap_get_timer_dt(struct of_device_id *match,
163 const char *property)
164{
165 struct device_node *np;
166
167 for_each_matching_node(np, match) {
168 if (!of_device_is_available(np)) {
169 of_node_put(np);
170 continue;
171 }
172
173 if (property && !of_get_property(np, property, NULL)) {
174 of_node_put(np);
175 continue;
176 }
177
178 prom_add_property(np, &device_disabled);
179 return np;
180 }
181
182 return NULL;
183}
184
185/**
186 * omap_dmtimer_init - initialisation function when device tree is used
187 *
188 * For secure OMAP3 devices, timers with device type "timer-secure" cannot
189 * be used by the kernel as they are reserved. Therefore, to prevent the
190 * kernel registering these devices remove them dynamically from the device
191 * tree on boot.
192 */
193void __init omap_dmtimer_init(void)
194{
195 struct device_node *np;
196
197 if (!cpu_is_omap34xx())
198 return;
199
200 /* If we are a secure device, remove any secure timer nodes */
201 if ((omap_type() != OMAP2_DEVICE_TYPE_GP)) {
202 np = omap_get_timer_dt(omap_timer_match, "ti,timer-secure");
203 if (np)
204 of_node_put(np);
205 }
206}
207
208/**
209 * omap_dm_timer_get_errata - get errata flags for a timer
210 *
211 * Get the timer errata flags that are specific to the OMAP device being used.
212 */
213u32 __init omap_dm_timer_get_errata(void)
214{
215 if (cpu_is_omap24xx())
216 return 0;
217
218 return OMAP_TIMER_ERRATA_I103_I767;
219}
220
147static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, 221static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
148 int gptimer_id, 222 int gptimer_id,
149 const char *fck_source) 223 const char *fck_source,
224 const char *property,
225 int posted)
150{ 226{
151 char name[10]; /* 10 = sizeof("gptXX_Xck0") */ 227 char name[10]; /* 10 = sizeof("gptXX_Xck0") */
228 const char *oh_name;
229 struct device_node *np;
152 struct omap_hwmod *oh; 230 struct omap_hwmod *oh;
153 struct resource irq_rsrc, mem_rsrc; 231 struct resource irq, mem;
154 size_t size; 232 int r = 0;
155 int res = 0; 233
156 int r; 234 if (of_have_populated_dt()) {
157 235 np = omap_get_timer_dt(omap_timer_match, NULL);
158 sprintf(name, "timer%d", gptimer_id); 236 if (!np)
159 omap_hwmod_setup_one(name); 237 return -ENODEV;
160 oh = omap_hwmod_lookup(name); 238
239 of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
240 if (!oh_name)
241 return -ENODEV;
242
243 timer->irq = irq_of_parse_and_map(np, 0);
244 if (!timer->irq)
245 return -ENXIO;
246
247 timer->io_base = of_iomap(np, 0);
248
249 of_node_put(np);
250 } else {
251 if (omap_dm_timer_reserve_systimer(gptimer_id))
252 return -ENODEV;
253
254 sprintf(name, "timer%d", gptimer_id);
255 oh_name = name;
256 }
257
258 oh = omap_hwmod_lookup(oh_name);
161 if (!oh) 259 if (!oh)
162 return -ENODEV; 260 return -ENODEV;
163 261
164 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, &irq_rsrc); 262 if (!of_have_populated_dt()) {
165 if (r) 263 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL,
166 return -ENXIO; 264 &irq);
167 timer->irq = irq_rsrc.start; 265 if (r)
266 return -ENXIO;
267 timer->irq = irq.start;
168 268
169 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL, &mem_rsrc); 269 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL,
170 if (r) 270 &mem);
171 return -ENXIO; 271 if (r)
172 timer->phys_base = mem_rsrc.start; 272 return -ENXIO;
173 size = mem_rsrc.end - mem_rsrc.start; 273
274 /* Static mapping, never released */
275 timer->io_base = ioremap(mem.start, mem.end - mem.start);
276 }
174 277
175 /* Static mapping, never released */
176 timer->io_base = ioremap(timer->phys_base, size);
177 if (!timer->io_base) 278 if (!timer->io_base)
178 return -ENXIO; 279 return -ENXIO;
179 280
@@ -182,42 +283,56 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
182 if (IS_ERR(timer->fclk)) 283 if (IS_ERR(timer->fclk))
183 return -ENODEV; 284 return -ENODEV;
184 285
185 omap_hwmod_enable(oh); 286 /* FIXME: Need to remove hard-coded test on timer ID */
186
187 if (omap_dm_timer_reserve_systimer(gptimer_id))
188 return -ENODEV;
189
190 if (gptimer_id != 12) { 287 if (gptimer_id != 12) {
191 struct clk *src; 288 struct clk *src;
192 289
193 src = clk_get(NULL, fck_source); 290 src = clk_get(NULL, fck_source);
194 if (IS_ERR(src)) { 291 if (IS_ERR(src)) {
195 res = -EINVAL; 292 r = -EINVAL;
196 } else { 293 } else {
197 res = __omap_dm_timer_set_source(timer->fclk, src); 294 r = clk_set_parent(timer->fclk, src);
198 if (IS_ERR_VALUE(res)) 295 if (IS_ERR_VALUE(r))
199 pr_warning("%s: timer%i cannot set source\n", 296 pr_warn("%s: %s cannot set source\n",
200 __func__, gptimer_id); 297 __func__, oh->name);
201 clk_put(src); 298 clk_put(src);
202 } 299 }
203 } 300 }
301
302 omap_hwmod_setup_one(oh_name);
303 omap_hwmod_enable(oh);
204 __omap_dm_timer_init_regs(timer); 304 __omap_dm_timer_init_regs(timer);
205 __omap_dm_timer_reset(timer, 1, 1);
206 timer->posted = 1;
207 305
208 timer->rate = clk_get_rate(timer->fclk); 306 if (posted)
307 __omap_dm_timer_enable_posted(timer);
308
309 /* Check that the intended posted configuration matches the actual */
310 if (posted != timer->posted)
311 return -EINVAL;
209 312
313 timer->rate = clk_get_rate(timer->fclk);
210 timer->reserved = 1; 314 timer->reserved = 1;
211 315
212 return res; 316 return r;
213} 317}
214 318
215static void __init omap2_gp_clockevent_init(int gptimer_id, 319static void __init omap2_gp_clockevent_init(int gptimer_id,
216 const char *fck_source) 320 const char *fck_source,
321 const char *property)
217{ 322{
218 int res; 323 int res;
219 324
220 res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source); 325 clkev.errata = omap_dm_timer_get_errata();
326
327 /*
328 * For clock-event timers we never read the timer counter and
329 * so we are not impacted by errata i103 and i767. Therefore,
330 * we can safely ignore this errata for clock-event timers.
331 */
332 __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767);
333
334 res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source, property,
335 OMAP_TIMER_POSTED);
221 BUG_ON(res); 336 BUG_ON(res);
222 337
223 omap2_gp_timer_irq.dev_id = &clkev; 338 omap2_gp_timer_irq.dev_id = &clkev;
@@ -250,7 +365,8 @@ static bool use_gptimer_clksrc;
250 */ 365 */
251static cycle_t clocksource_read_cycles(struct clocksource *cs) 366static cycle_t clocksource_read_cycles(struct clocksource *cs)
252{ 367{
253 return (cycle_t)__omap_dm_timer_read_counter(&clksrc, 1); 368 return (cycle_t)__omap_dm_timer_read_counter(&clksrc,
369 OMAP_TIMER_NONPOSTED);
254} 370}
255 371
256static struct clocksource clocksource_gpt = { 372static struct clocksource clocksource_gpt = {
@@ -264,21 +380,41 @@ static struct clocksource clocksource_gpt = {
264static u32 notrace dmtimer_read_sched_clock(void) 380static u32 notrace dmtimer_read_sched_clock(void)
265{ 381{
266 if (clksrc.reserved) 382 if (clksrc.reserved)
267 return __omap_dm_timer_read_counter(&clksrc, 1); 383 return __omap_dm_timer_read_counter(&clksrc,
384 OMAP_TIMER_NONPOSTED);
268 385
269 return 0; 386 return 0;
270} 387}
271 388
272#ifdef CONFIG_OMAP_32K_TIMER 389static struct of_device_id omap_counter_match[] __initdata = {
390 { .compatible = "ti,omap-counter32k", },
391 { }
392};
393
273/* Setup free-running counter for clocksource */ 394/* Setup free-running counter for clocksource */
274static int __init omap2_sync32k_clocksource_init(void) 395static int __init omap2_sync32k_clocksource_init(void)
275{ 396{
276 int ret; 397 int ret;
398 struct device_node *np = NULL;
277 struct omap_hwmod *oh; 399 struct omap_hwmod *oh;
278 void __iomem *vbase; 400 void __iomem *vbase;
279 const char *oh_name = "counter_32k"; 401 const char *oh_name = "counter_32k";
280 402
281 /* 403 /*
404 * If device-tree is present, then search the DT blob
405 * to see if the 32kHz counter is supported.
406 */
407 if (of_have_populated_dt()) {
408 np = omap_get_timer_dt(omap_counter_match, NULL);
409 if (!np)
410 return -ENODEV;
411
412 of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
413 if (!oh_name)
414 return -ENODEV;
415 }
416
417 /*
282 * First check hwmod data is available for sync32k counter 418 * First check hwmod data is available for sync32k counter
283 */ 419 */
284 oh = omap_hwmod_lookup(oh_name); 420 oh = omap_hwmod_lookup(oh_name);
@@ -287,7 +423,13 @@ static int __init omap2_sync32k_clocksource_init(void)
287 423
288 omap_hwmod_setup_one(oh_name); 424 omap_hwmod_setup_one(oh_name);
289 425
290 vbase = omap_hwmod_get_mpu_rt_va(oh); 426 if (np) {
427 vbase = of_iomap(np, 0);
428 of_node_put(np);
429 } else {
430 vbase = omap_hwmod_get_mpu_rt_va(oh);
431 }
432
291 if (!vbase) { 433 if (!vbase) {
292 pr_warn("%s: failed to get counter_32k resource\n", __func__); 434 pr_warn("%s: failed to get counter_32k resource\n", __func__);
293 return -ENXIO; 435 return -ENXIO;
@@ -309,23 +451,21 @@ static int __init omap2_sync32k_clocksource_init(void)
309 451
310 return ret; 452 return ret;
311} 453}
312#else
313static inline int omap2_sync32k_clocksource_init(void)
314{
315 return -ENODEV;
316}
317#endif
318 454
319static void __init omap2_gptimer_clocksource_init(int gptimer_id, 455static void __init omap2_gptimer_clocksource_init(int gptimer_id,
320 const char *fck_source) 456 const char *fck_source)
321{ 457{
322 int res; 458 int res;
323 459
324 res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source); 460 clksrc.errata = omap_dm_timer_get_errata();
461
462 res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source, NULL,
463 OMAP_TIMER_NONPOSTED);
325 BUG_ON(res); 464 BUG_ON(res);
326 465
327 __omap_dm_timer_load_start(&clksrc, 466 __omap_dm_timer_load_start(&clksrc,
328 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1); 467 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0,
468 OMAP_TIMER_NONPOSTED);
329 setup_sched_clock(dmtimer_read_sched_clock, 32, clksrc.rate); 469 setup_sched_clock(dmtimer_read_sched_clock, 32, clksrc.rate);
330 470
331 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate)) 471 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
@@ -336,25 +476,6 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
336 gptimer_id, clksrc.rate); 476 gptimer_id, clksrc.rate);
337} 477}
338 478
339static void __init omap2_clocksource_init(int gptimer_id,
340 const char *fck_source)
341{
342 /*
343 * First give preference to kernel parameter configuration
344 * by user (clocksource="gp_timer").
345 *
346 * In case of missing kernel parameter for clocksource,
347 * first check for availability for 32k-sync timer, in case
348 * of failure in finding 32k_counter module or registering
349 * it as clocksource, execution will fallback to gp-timer.
350 */
351 if (use_gptimer_clksrc == true)
352 omap2_gptimer_clocksource_init(gptimer_id, fck_source);
353 else if (omap2_sync32k_clocksource_init())
354 /* Fall back to gp-timer code */
355 omap2_gptimer_clocksource_init(gptimer_id, fck_source);
356}
357
358#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER 479#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
359/* 480/*
360 * The realtime counter also called master counter, is a free-running 481 * The realtime counter also called master counter, is a free-running
@@ -433,48 +554,65 @@ static inline void __init realtime_counter_init(void)
433{} 554{}
434#endif 555#endif
435 556
436#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src, \ 557#define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \
558 clksrc_nr, clksrc_src) \
559static void __init omap##name##_gptimer_timer_init(void) \
560{ \
561 omap_dmtimer_init(); \
562 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
563 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \
564}
565
566#define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \
437 clksrc_nr, clksrc_src) \ 567 clksrc_nr, clksrc_src) \
438static void __init omap##name##_timer_init(void) \ 568static void __init omap##name##_sync32k_timer_init(void) \
439{ \ 569{ \
440 omap2_gp_clockevent_init((clkev_nr), clkev_src); \ 570 omap_dmtimer_init(); \
441 omap2_clocksource_init((clksrc_nr), clksrc_src); \ 571 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
572 /* Enable the use of clocksource="gp_timer" kernel parameter */ \
573 if (use_gptimer_clksrc) \
574 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);\
575 else \
576 omap2_sync32k_clocksource_init(); \
442} 577}
443 578
444#define OMAP_SYS_TIMER(name) \ 579#define OMAP_SYS_TIMER(name, clksrc) \
445struct sys_timer omap##name##_timer = { \ 580struct sys_timer omap##name##_timer = { \
446 .init = omap##name##_timer_init, \ 581 .init = omap##name##_##clksrc##_timer_init, \
447}; 582};
448 583
449#ifdef CONFIG_ARCH_OMAP2 584#ifdef CONFIG_ARCH_OMAP2
450OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, 2, OMAP2_MPU_SOURCE) 585OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon",
451OMAP_SYS_TIMER(2) 586 2, OMAP2_MPU_SOURCE);
452#endif 587OMAP_SYS_TIMER(2, sync32k);
588#endif /* CONFIG_ARCH_OMAP2 */
453 589
454#ifdef CONFIG_ARCH_OMAP3 590#ifdef CONFIG_ARCH_OMAP3
455OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, 2, OMAP3_MPU_SOURCE) 591OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon",
456OMAP_SYS_TIMER(3) 592 2, OMAP3_MPU_SOURCE);
457OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE, 593OMAP_SYS_TIMER(3, sync32k);
458 2, OMAP3_MPU_SOURCE) 594OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure",
459OMAP_SYS_TIMER(3_secure) 595 2, OMAP3_MPU_SOURCE);
460#endif 596OMAP_SYS_TIMER(3_secure, sync32k);
597OMAP_SYS_GP_TIMER_INIT(3_gp, 1, OMAP3_MPU_SOURCE, "ti,timer-alwon",
598 2, OMAP3_MPU_SOURCE);
599OMAP_SYS_TIMER(3_gp, gptimer);
600#endif /* CONFIG_ARCH_OMAP3 */
461 601
462#ifdef CONFIG_SOC_AM33XX 602#ifdef CONFIG_SOC_AM33XX
463OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, 2, OMAP4_MPU_SOURCE) 603OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon",
464OMAP_SYS_TIMER(3_am33xx) 604 2, OMAP4_MPU_SOURCE);
465#endif 605OMAP_SYS_TIMER(3_am33xx, gptimer);
606#endif /* CONFIG_SOC_AM33XX */
466 607
467#ifdef CONFIG_ARCH_OMAP4 608#ifdef CONFIG_ARCH_OMAP4
609OMAP_SYS_32K_TIMER_INIT(4, 1, OMAP4_32K_SOURCE, "ti,timer-alwon",
610 2, OMAP4_MPU_SOURCE);
468#ifdef CONFIG_LOCAL_TIMERS 611#ifdef CONFIG_LOCAL_TIMERS
469static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 612static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29);
470 OMAP44XX_LOCAL_TWD_BASE, 29); 613static void __init omap4_local_timer_init(void)
471#endif
472
473static void __init omap4_timer_init(void)
474{ 614{
475 omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE); 615 omap4_sync32k_timer_init();
476 omap2_clocksource_init(2, OMAP4_MPU_SOURCE);
477#ifdef CONFIG_LOCAL_TIMERS
478 /* Local timers are not supprted on OMAP4430 ES1.0 */ 616 /* Local timers are not supprted on OMAP4430 ES1.0 */
479 if (omap_rev() != OMAP4430_REV_ES1_0) { 617 if (omap_rev() != OMAP4430_REV_ES1_0) {
480 int err; 618 int err;
@@ -488,26 +626,32 @@ static void __init omap4_timer_init(void)
488 if (err) 626 if (err)
489 pr_err("twd_local_timer_register failed %d\n", err); 627 pr_err("twd_local_timer_register failed %d\n", err);
490 } 628 }
491#endif
492} 629}
493OMAP_SYS_TIMER(4) 630#else /* CONFIG_LOCAL_TIMERS */
494#endif 631static void __init omap4_local_timer_init(void)
632{
633 omap4_sync32k_timer_init();
634}
635#endif /* CONFIG_LOCAL_TIMERS */
636OMAP_SYS_TIMER(4, local);
637#endif /* CONFIG_ARCH_OMAP4 */
495 638
496#ifdef CONFIG_SOC_OMAP5 639#ifdef CONFIG_SOC_OMAP5
497static void __init omap5_timer_init(void) 640OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon",
641 2, OMAP4_MPU_SOURCE);
642static void __init omap5_realtime_timer_init(void)
498{ 643{
499 int err; 644 int err;
500 645
501 omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE); 646 omap5_sync32k_timer_init();
502 omap2_clocksource_init(2, OMAP4_MPU_SOURCE);
503 realtime_counter_init(); 647 realtime_counter_init();
504 648
505 err = arch_timer_of_register(); 649 err = arch_timer_of_register();
506 if (err) 650 if (err)
507 pr_err("%s: arch_timer_register failed %d\n", __func__, err); 651 pr_err("%s: arch_timer_register failed %d\n", __func__, err);
508} 652}
509OMAP_SYS_TIMER(5) 653OMAP_SYS_TIMER(5, realtime);
510#endif 654#endif /* CONFIG_SOC_OMAP5 */
511 655
512/** 656/**
513 * omap_timer_init - build and register timer device with an 657 * omap_timer_init - build and register timer device with an
@@ -559,6 +703,9 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
559 if (timer_dev_attr) 703 if (timer_dev_attr)
560 pdata->timer_capability = timer_dev_attr->timer_capability; 704 pdata->timer_capability = timer_dev_attr->timer_capability;
561 705
706 pdata->timer_errata = omap_dm_timer_get_errata();
707 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
708
562 pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata), 709 pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
563 NULL, 0, 0); 710 NULL, 0, 0);
564 711
@@ -583,6 +730,10 @@ static int __init omap2_dm_timer_init(void)
583{ 730{
584 int ret; 731 int ret;
585 732
733 /* If dtb is there, the devices will be created dynamically */
734 if (of_have_populated_dt())
735 return -ENODEV;
736
586 ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL); 737 ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
587 if (unlikely(ret)) { 738 if (unlikely(ret)) {
588 pr_err("%s: device registration failed.\n", __func__); 739 pr_err("%s: device registration failed.\n", __func__);
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index a256135d8e4..e49b40b4c90 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -26,9 +26,6 @@
26#include <linux/regulator/machine.h> 26#include <linux/regulator/machine.h>
27#include <linux/regulator/fixed.h> 27#include <linux/regulator/fixed.h>
28 28
29#include <plat/i2c.h>
30#include <plat/usb.h>
31
32#include "soc.h" 29#include "soc.h"
33#include "twl-common.h" 30#include "twl-common.h"
34#include "pm.h" 31#include "pm.h"
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 3c434498e12..d1dbe125b34 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -25,10 +25,10 @@
25 25
26#include <asm/io.h> 26#include <asm/io.h>
27 27
28#include <plat/usb.h> 28#include "soc.h"
29#include <plat/omap_device.h> 29#include "omap_device.h"
30
31#include "mux.h" 30#include "mux.h"
31#include "usb.h"
32 32
33#ifdef CONFIG_MFD_OMAP_USB_HOST 33#ifdef CONFIG_MFD_OMAP_USB_HOST
34 34
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 51da21cb78f..7b33b375fe7 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -25,12 +25,10 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/usb/musb.h> 26#include <linux/usb/musb.h>
27 27
28#include <plat/usb.h> 28#include "omap_device.h"
29#include <plat/omap_device.h> 29#include "soc.h"
30
31#include "am35xx.h"
32
33#include "mux.h" 30#include "mux.h"
31#include "usb.h"
34 32
35static struct musb_hdrc_config musb_config = { 33static struct musb_hdrc_config musb_config = {
36 .multipoint = 1, 34 .multipoint = 1,
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 805bea6edf1..c5a3c6f9504 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -15,10 +15,11 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/platform_data/usb-omap.h>
18 19
19#include <linux/usb/musb.h> 20#include <linux/usb/musb.h>
20 21
21#include <plat/gpmc.h> 22#include "gpmc.h"
22 23
23#include "mux.h" 24#include "mux.h"
24 25
@@ -26,180 +27,88 @@ static u8 async_cs, sync_cs;
26static unsigned refclk_psec; 27static unsigned refclk_psec;
27 28
28 29
29/* t2_ps, when quantized to fclk units, must happen no earlier than
30 * the clock after after t1_NS.
31 *
32 * Return a possibly updated value of t2_ps, converted to nsec.
33 */
34static unsigned
35next_clk(unsigned t1_NS, unsigned t2_ps, unsigned fclk_ps)
36{
37 unsigned t1_ps = t1_NS * 1000;
38 unsigned t1_f, t2_f;
39
40 if ((t1_ps + fclk_ps) < t2_ps)
41 return t2_ps / 1000;
42
43 t1_f = (t1_ps + fclk_ps - 1) / fclk_ps;
44 t2_f = (t2_ps + fclk_ps - 1) / fclk_ps;
45
46 if (t1_f >= t2_f)
47 t2_f = t1_f + 1;
48
49 return (t2_f * fclk_ps) / 1000;
50}
51
52/* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ 30/* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */
53 31
54static int tusb_set_async_mode(unsigned sysclk_ps, unsigned fclk_ps) 32static int tusb_set_async_mode(unsigned sysclk_ps)
55{ 33{
34 struct gpmc_device_timings dev_t;
56 struct gpmc_timings t; 35 struct gpmc_timings t;
57 unsigned t_acsnh_advnh = sysclk_ps + 3000; 36 unsigned t_acsnh_advnh = sysclk_ps + 3000;
58 unsigned tmp;
59
60 memset(&t, 0, sizeof(t));
61
62 /* CS_ON = t_acsnh_acsnl */
63 t.cs_on = 8;
64 /* ADV_ON = t_acsnh_advnh - t_advn */
65 t.adv_on = next_clk(t.cs_on, t_acsnh_advnh - 7000, fclk_ps);
66
67 /*
68 * READ ... from omap2420 TRM fig 12-13
69 */
70
71 /* ADV_RD_OFF = t_acsnh_advnh */
72 t.adv_rd_off = next_clk(t.adv_on, t_acsnh_advnh, fclk_ps);
73
74 /* OE_ON = t_acsnh_advnh + t_advn_oen (then wait for nRDY) */
75 t.oe_on = next_clk(t.adv_on, t_acsnh_advnh + 1000, fclk_ps);
76
77 /* ACCESS = counters continue only after nRDY */
78 tmp = t.oe_on * 1000 + 300;
79 t.access = next_clk(t.oe_on, tmp, fclk_ps);
80
81 /* OE_OFF = after data gets sampled */
82 tmp = t.access * 1000;
83 t.oe_off = next_clk(t.access, tmp, fclk_ps);
84
85 t.cs_rd_off = t.oe_off;
86
87 tmp = t.cs_rd_off * 1000 + 7000 /* t_acsn_rdy_z */;
88 t.rd_cycle = next_clk(t.cs_rd_off, tmp, fclk_ps);
89
90 /*
91 * WRITE ... from omap2420 TRM fig 12-15
92 */
93
94 /* ADV_WR_OFF = t_acsnh_advnh */
95 t.adv_wr_off = t.adv_rd_off;
96 37
97 /* WE_ON = t_acsnh_advnh + t_advn_wen (then wait for nRDY) */ 38 memset(&dev_t, 0, sizeof(dev_t));
98 t.we_on = next_clk(t.adv_wr_off, t_acsnh_advnh + 1000, fclk_ps);
99 39
100 /* WE_OFF = after data gets sampled */ 40 dev_t.mux = true;
101 tmp = t.we_on * 1000 + 300;
102 t.we_off = next_clk(t.we_on, tmp, fclk_ps);
103 41
104 t.cs_wr_off = t.we_off; 42 dev_t.t_ceasu = 8 * 1000;
43 dev_t.t_avdasu = t_acsnh_advnh - 7000;
44 dev_t.t_ce_avd = 1000;
45 dev_t.t_avdp_r = t_acsnh_advnh;
46 dev_t.t_oeasu = t_acsnh_advnh + 1000;
47 dev_t.t_oe = 300;
48 dev_t.t_cez_r = 7000;
49 dev_t.t_cez_w = dev_t.t_cez_r;
50 dev_t.t_avdp_w = t_acsnh_advnh;
51 dev_t.t_weasu = t_acsnh_advnh + 1000;
52 dev_t.t_wpl = 300;
53 dev_t.cyc_aavdh_we = 1;
105 54
106 tmp = t.cs_wr_off * 1000 + 7000 /* t_acsn_rdy_z */; 55 gpmc_calc_timings(&t, &dev_t);
107 t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps);
108 56
109 return gpmc_cs_set_timings(async_cs, &t); 57 return gpmc_cs_set_timings(async_cs, &t);
110} 58}
111 59
112static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps) 60static int tusb_set_sync_mode(unsigned sysclk_ps)
113{ 61{
62 struct gpmc_device_timings dev_t;
114 struct gpmc_timings t; 63 struct gpmc_timings t;
115 unsigned t_scsnh_advnh = sysclk_ps + 3000; 64 unsigned t_scsnh_advnh = sysclk_ps + 3000;
116 unsigned tmp;
117
118 memset(&t, 0, sizeof(t));
119 t.cs_on = 8;
120
121 /* ADV_ON = t_acsnh_advnh - t_advn */
122 t.adv_on = next_clk(t.cs_on, t_scsnh_advnh - 7000, fclk_ps);
123
124 /* GPMC_CLK rate = fclk rate / div */
125 t.sync_clk = 11100 /* 11.1 nsec */;
126 tmp = (t.sync_clk + fclk_ps - 1) / fclk_ps;
127 if (tmp > 4)
128 return -ERANGE;
129 if (tmp == 0)
130 tmp = 1;
131 t.page_burst_access = (fclk_ps * tmp) / 1000;
132
133 /*
134 * READ ... based on omap2420 TRM fig 12-19, 12-20
135 */
136
137 /* ADV_RD_OFF = t_scsnh_advnh */
138 t.adv_rd_off = next_clk(t.adv_on, t_scsnh_advnh, fclk_ps);
139
140 /* OE_ON = t_scsnh_advnh + t_advn_oen * fclk_ps (then wait for nRDY) */
141 tmp = (t.adv_rd_off * 1000) + (3 * fclk_ps);
142 t.oe_on = next_clk(t.adv_on, tmp, fclk_ps);
143
144 /* ACCESS = number of clock cycles after t_adv_eon */
145 tmp = (t.oe_on * 1000) + (5 * fclk_ps);
146 t.access = next_clk(t.oe_on, tmp, fclk_ps);
147 65
148 /* OE_OFF = after data gets sampled */ 66 memset(&dev_t, 0, sizeof(dev_t));
149 tmp = (t.access * 1000) + (1 * fclk_ps); 67
150 t.oe_off = next_clk(t.access, tmp, fclk_ps); 68 dev_t.mux = true;
151 69 dev_t.sync_read = true;
152 t.cs_rd_off = t.oe_off; 70 dev_t.sync_write = true;
153 71
154 tmp = t.cs_rd_off * 1000 + 7000 /* t_scsn_rdy_z */; 72 dev_t.clk = 11100;
155 t.rd_cycle = next_clk(t.cs_rd_off, tmp, fclk_ps); 73 dev_t.t_bacc = 1000;
156 74 dev_t.t_ces = 1000;
157 /* 75 dev_t.t_ceasu = 8 * 1000;
158 * WRITE ... based on omap2420 TRM fig 12-21 76 dev_t.t_avdasu = t_scsnh_advnh - 7000;
159 */ 77 dev_t.t_ce_avd = 1000;
160 78 dev_t.t_avdp_r = t_scsnh_advnh;
161 /* ADV_WR_OFF = t_scsnh_advnh */ 79 dev_t.cyc_aavdh_oe = 3;
162 t.adv_wr_off = t.adv_rd_off; 80 dev_t.cyc_oe = 5;
163 81 dev_t.t_ce_rdyz = 7000;
164 /* WE_ON = t_scsnh_advnh + t_advn_wen * fclk_ps (then wait for nRDY) */ 82 dev_t.t_avdp_w = t_scsnh_advnh;
165 tmp = (t.adv_wr_off * 1000) + (3 * fclk_ps); 83 dev_t.cyc_aavdh_we = 3;
166 t.we_on = next_clk(t.adv_wr_off, tmp, fclk_ps); 84 dev_t.cyc_wpl = 6;
167 85 dev_t.t_ce_rdyz = 7000;
168 /* WE_OFF = number of clock cycles after t_adv_wen */ 86
169 tmp = (t.we_on * 1000) + (6 * fclk_ps); 87 gpmc_calc_timings(&t, &dev_t);
170 t.we_off = next_clk(t.we_on, tmp, fclk_ps);
171
172 t.cs_wr_off = t.we_off;
173
174 tmp = t.cs_wr_off * 1000 + 7000 /* t_scsn_rdy_z */;
175 t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps);
176 88
177 return gpmc_cs_set_timings(sync_cs, &t); 89 return gpmc_cs_set_timings(sync_cs, &t);
178} 90}
179 91
180extern unsigned long gpmc_get_fclk_period(void);
181
182/* tusb driver calls this when it changes the chip's clocking */ 92/* tusb driver calls this when it changes the chip's clocking */
183int tusb6010_platform_retime(unsigned is_refclk) 93int tusb6010_platform_retime(unsigned is_refclk)
184{ 94{
185 static const char error[] = 95 static const char error[] =
186 KERN_ERR "tusb6010 %s retime error %d\n"; 96 KERN_ERR "tusb6010 %s retime error %d\n";
187 97
188 unsigned fclk_ps = gpmc_get_fclk_period();
189 unsigned sysclk_ps; 98 unsigned sysclk_ps;
190 int status; 99 int status;
191 100
192 if (!refclk_psec || fclk_ps == 0) 101 if (!refclk_psec)
193 return -ENODEV; 102 return -ENODEV;
194 103
195 sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60; 104 sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
196 105
197 status = tusb_set_async_mode(sysclk_ps, fclk_ps); 106 status = tusb_set_async_mode(sysclk_ps);
198 if (status < 0) { 107 if (status < 0) {
199 printk(error, "async", status); 108 printk(error, "async", status);
200 goto done; 109 goto done;
201 } 110 }
202 status = tusb_set_sync_mode(sysclk_ps, fclk_ps); 111 status = tusb_set_sync_mode(sysclk_ps);
203 if (status < 0) 112 if (status < 0)
204 printk(error, "sync", status); 113 printk(error, "sync", status);
205done: 114done:
@@ -283,7 +192,6 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
283 | GPMC_CONFIG1_READTYPE_SYNC 192 | GPMC_CONFIG1_READTYPE_SYNC
284 | GPMC_CONFIG1_WRITEMULTIPLE_SUPP 193 | GPMC_CONFIG1_WRITEMULTIPLE_SUPP
285 | GPMC_CONFIG1_WRITETYPE_SYNC 194 | GPMC_CONFIG1_WRITETYPE_SYNC
286 | GPMC_CONFIG1_CLKACTIVATIONTIME(1)
287 | GPMC_CONFIG1_PAGE_LEN(2) 195 | GPMC_CONFIG1_PAGE_LEN(2)
288 | GPMC_CONFIG1_WAIT_READ_MON 196 | GPMC_CONFIG1_WAIT_READ_MON
289 | GPMC_CONFIG1_WAIT_WRITE_MON 197 | GPMC_CONFIG1_WAIT_WRITE_MON
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
new file mode 100644
index 00000000000..9b986ead7c4
--- /dev/null
+++ b/arch/arm/mach-omap2/usb.h
@@ -0,0 +1,82 @@
1#include <linux/platform_data/usb-omap.h>
2
3/* AM35x */
4/* USB 2.0 PHY Control */
5#define CONF2_PHY_GPIOMODE (1 << 23)
6#define CONF2_OTGMODE (3 << 14)
7#define CONF2_NO_OVERRIDE (0 << 14)
8#define CONF2_FORCE_HOST (1 << 14)
9#define CONF2_FORCE_DEVICE (2 << 14)
10#define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
11#define CONF2_SESENDEN (1 << 13)
12#define CONF2_VBDTCTEN (1 << 12)
13#define CONF2_REFFREQ_24MHZ (2 << 8)
14#define CONF2_REFFREQ_26MHZ (7 << 8)
15#define CONF2_REFFREQ_13MHZ (6 << 8)
16#define CONF2_REFFREQ (0xf << 8)
17#define CONF2_PHYCLKGD (1 << 7)
18#define CONF2_VBUSSENSE (1 << 6)
19#define CONF2_PHY_PLLON (1 << 5)
20#define CONF2_RESET (1 << 4)
21#define CONF2_PHYPWRDN (1 << 3)
22#define CONF2_OTGPWRDN (1 << 2)
23#define CONF2_DATPOL (1 << 1)
24
25/* TI81XX specific definitions */
26#define USBCTRL0 0x620
27#define USBSTAT0 0x624
28
29/* TI816X PHY controls bits */
30#define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
31#define TI816X_USBPHY_REFCLK_OSC (1 << 8)
32
33/* TI814X PHY controls bits */
34#define USBPHY_CM_PWRDN (1 << 0)
35#define USBPHY_OTG_PWRDN (1 << 1)
36#define USBPHY_CHGDET_DIS (1 << 2)
37#define USBPHY_CHGDET_RSTRT (1 << 3)
38#define USBPHY_SRCONDM (1 << 4)
39#define USBPHY_SINKONDP (1 << 5)
40#define USBPHY_CHGISINK_EN (1 << 6)
41#define USBPHY_CHGVSRC_EN (1 << 7)
42#define USBPHY_DMPULLUP (1 << 8)
43#define USBPHY_DPPULLUP (1 << 9)
44#define USBPHY_CDET_EXTCTL (1 << 10)
45#define USBPHY_GPIO_MODE (1 << 12)
46#define USBPHY_DPOPBUFCTL (1 << 13)
47#define USBPHY_DMOPBUFCTL (1 << 14)
48#define USBPHY_DPINPUT (1 << 15)
49#define USBPHY_DMINPUT (1 << 16)
50#define USBPHY_DPGPIO_PD (1 << 17)
51#define USBPHY_DMGPIO_PD (1 << 18)
52#define USBPHY_OTGVDET_EN (1 << 19)
53#define USBPHY_OTGSESSEND_EN (1 << 20)
54#define USBPHY_DATA_POLARITY (1 << 23)
55
56struct usbhs_omap_board_data {
57 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
58
59 /* have to be valid if phy_reset is true and portx is in phy mode */
60 int reset_gpio_port[OMAP3_HS_USB_PORTS];
61
62 /* Set this to true for ES2.x silicon */
63 unsigned es2_compatibility:1;
64
65 unsigned phy_reset:1;
66
67 /*
68 * Regulators for USB PHYs.
69 * Each PHY can have a separate regulator.
70 */
71 struct regulator *regulator[OMAP3_HS_USB_PORTS];
72};
73
74extern void usb_musb_init(struct omap_musb_board_data *board_data);
75extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
76
77extern void am35x_musb_reset(void);
78extern void am35x_musb_phy_power(u8 on);
79extern void am35x_musb_clear_irq(void);
80extern void am35x_set_mode(u8 musb_mode);
81extern void ti81xx_musb_phy_power(u8 on);
82
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 75878c37959..49ac7977e03 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -11,13 +11,20 @@
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/bug.h> 13#include <linux/bug.h>
14#include <linux/io.h>
14 15
16#include <asm/div64.h>
17
18#include "iomap.h"
15#include "soc.h" 19#include "soc.h"
16#include "voltage.h" 20#include "voltage.h"
17#include "vc.h" 21#include "vc.h"
18#include "prm-regbits-34xx.h" 22#include "prm-regbits-34xx.h"
19#include "prm-regbits-44xx.h" 23#include "prm-regbits-44xx.h"
20#include "prm44xx.h" 24#include "prm44xx.h"
25#include "pm.h"
26#include "scrm44xx.h"
27#include "control.h"
21 28
22/** 29/**
23 * struct omap_vc_channel_cfg - describe the cfg_channel bitfield 30 * struct omap_vc_channel_cfg - describe the cfg_channel bitfield
@@ -63,6 +70,9 @@ static struct omap_vc_channel_cfg vc_mutant_channel_cfg = {
63}; 70};
64 71
65static struct omap_vc_channel_cfg *vc_cfg_bits; 72static struct omap_vc_channel_cfg *vc_cfg_bits;
73
74/* Default I2C trace length on pcb, 6.3cm. Used for capacitance calculations. */
75static u32 sr_i2c_pcb_length = 63;
66#define CFG_CHANNEL_MASK 0x1f 76#define CFG_CHANNEL_MASK 0x1f
67 77
68/** 78/**
@@ -135,6 +145,8 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
135 vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); 145 vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift);
136 voltdm->write(vc_cmdval, vc->cmdval_reg); 146 voltdm->write(vc_cmdval, vc->cmdval_reg);
137 147
148 voltdm->vc_param->on = target_volt;
149
138 omap_vp_update_errorgain(voltdm, target_volt); 150 omap_vp_update_errorgain(voltdm, target_volt);
139 151
140 return 0; 152 return 0;
@@ -202,46 +214,389 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm,
202 return 0; 214 return 0;
203} 215}
204 216
205static void __init omap3_vfsm_init(struct voltagedomain *voltdm) 217/* Convert microsecond value to number of 32kHz clock cycles */
218static inline u32 omap_usec_to_32k(u32 usec)
219{
220 return DIV_ROUND_UP_ULL(32768ULL * (u64)usec, 1000000ULL);
221}
222
223/* Set oscillator setup time for omap3 */
224static void omap3_set_clksetup(u32 usec, struct voltagedomain *voltdm)
225{
226 voltdm->write(omap_usec_to_32k(usec), OMAP3_PRM_CLKSETUP_OFFSET);
227}
228
229/**
230 * omap3_set_i2c_timings - sets i2c sleep timings for a channel
231 * @voltdm: channel to configure
232 * @off_mode: select whether retention or off mode values used
233 *
234 * Calculates and sets up voltage controller to use I2C based
235 * voltage scaling for sleep modes. This can be used for either off mode
236 * or retention. Off mode has additionally an option to use sys_off_mode
237 * pad, which uses a global signal to program the whole power IC to
238 * off-mode.
239 */
240static void omap3_set_i2c_timings(struct voltagedomain *voltdm, bool off_mode)
206{ 241{
242 unsigned long voltsetup1;
243 u32 tgt_volt;
244
245 /*
246 * Oscillator is shut down only if we are using sys_off_mode pad,
247 * thus we set a minimal setup time here
248 */
249 omap3_set_clksetup(1, voltdm);
250
251 if (off_mode)
252 tgt_volt = voltdm->vc_param->off;
253 else
254 tgt_volt = voltdm->vc_param->ret;
255
256 voltsetup1 = (voltdm->vc_param->on - tgt_volt) /
257 voltdm->pmic->slew_rate;
258
259 voltsetup1 = voltsetup1 * voltdm->sys_clk.rate / 8 / 1000000 + 1;
260
261 voltdm->rmw(voltdm->vfsm->voltsetup_mask,
262 voltsetup1 << __ffs(voltdm->vfsm->voltsetup_mask),
263 voltdm->vfsm->voltsetup_reg);
264
207 /* 265 /*
208 * Voltage Manager FSM parameters init 266 * pmic is not controlling the voltage scaling during retention,
209 * XXX This data should be passed in from the board file 267 * thus set voltsetup2 to 0
210 */ 268 */
211 voltdm->write(OMAP3_CLKSETUP, OMAP3_PRM_CLKSETUP_OFFSET); 269 voltdm->write(0, OMAP3_PRM_VOLTSETUP2_OFFSET);
212 voltdm->write(OMAP3_VOLTOFFSET, OMAP3_PRM_VOLTOFFSET_OFFSET);
213 voltdm->write(OMAP3_VOLTSETUP2, OMAP3_PRM_VOLTSETUP2_OFFSET);
214} 270}
215 271
216static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) 272/**
273 * omap3_set_off_timings - sets off-mode timings for a channel
274 * @voltdm: channel to configure
275 *
276 * Calculates and sets up off-mode timings for a channel. Off-mode
277 * can use either I2C based voltage scaling, or alternatively
278 * sys_off_mode pad can be used to send a global command to power IC.
279 * This function first checks which mode is being used, and calls
280 * omap3_set_i2c_timings() if the system is using I2C control mode.
281 * sys_off_mode has the additional benefit that voltages can be
282 * scaled to zero volt level with TWL4030 / TWL5030, I2C can only
283 * scale to 600mV.
284 */
285static void omap3_set_off_timings(struct voltagedomain *voltdm)
217{ 286{
218 static bool is_initialized; 287 unsigned long clksetup;
288 unsigned long voltsetup2;
289 unsigned long voltsetup2_old;
290 u32 val;
291 u32 tstart, tshut;
219 292
220 if (is_initialized) 293 /* check if sys_off_mode is used to control off-mode voltages */
294 val = voltdm->read(OMAP3_PRM_VOLTCTRL_OFFSET);
295 if (!(val & OMAP3430_SEL_OFF_MASK)) {
296 /* No, omap is controlling them over I2C */
297 omap3_set_i2c_timings(voltdm, true);
221 return; 298 return;
299 }
300
301 omap_pm_get_oscillator(&tstart, &tshut);
302 omap3_set_clksetup(tstart, voltdm);
303
304 clksetup = voltdm->read(OMAP3_PRM_CLKSETUP_OFFSET);
305
306 /* voltsetup 2 in us */
307 voltsetup2 = voltdm->vc_param->on / voltdm->pmic->slew_rate;
308
309 /* convert to 32k clk cycles */
310 voltsetup2 = DIV_ROUND_UP(voltsetup2 * 32768, 1000000);
311
312 voltsetup2_old = voltdm->read(OMAP3_PRM_VOLTSETUP2_OFFSET);
313
314 /*
315 * Update voltsetup2 if higher than current value (needed because
316 * we have multiple channels with different ramp times), also
317 * update voltoffset always to value recommended by TRM
318 */
319 if (voltsetup2 > voltsetup2_old) {
320 voltdm->write(voltsetup2, OMAP3_PRM_VOLTSETUP2_OFFSET);
321 voltdm->write(clksetup - voltsetup2,
322 OMAP3_PRM_VOLTOFFSET_OFFSET);
323 } else
324 voltdm->write(clksetup - voltsetup2_old,
325 OMAP3_PRM_VOLTOFFSET_OFFSET);
326
327 /*
328 * omap is not controlling voltage scaling during off-mode,
329 * thus set voltsetup1 to 0
330 */
331 voltdm->rmw(voltdm->vfsm->voltsetup_mask, 0,
332 voltdm->vfsm->voltsetup_reg);
333
334 /* voltoffset must be clksetup minus voltsetup2 according to TRM */
335 voltdm->write(clksetup - voltsetup2, OMAP3_PRM_VOLTOFFSET_OFFSET);
336}
337
338static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
339{
340 omap3_set_off_timings(voltdm);
341}
342
343/**
344 * omap4_calc_volt_ramp - calculates voltage ramping delays on omap4
345 * @voltdm: channel to calculate values for
346 * @voltage_diff: voltage difference in microvolts
347 *
348 * Calculates voltage ramp prescaler + counter values for a voltage
349 * difference on omap4. Returns a field value suitable for writing to
350 * VOLTSETUP register for a channel in following format:
351 * bits[8:9] prescaler ... bits[0:5] counter. See OMAP4 TRM for reference.
352 */
353static u32 omap4_calc_volt_ramp(struct voltagedomain *voltdm, u32 voltage_diff)
354{
355 u32 prescaler;
356 u32 cycles;
357 u32 time;
358
359 time = voltage_diff / voltdm->pmic->slew_rate;
360
361 cycles = voltdm->sys_clk.rate / 1000 * time / 1000;
362
363 cycles /= 64;
364 prescaler = 0;
365
366 /* shift to next prescaler until no overflow */
367
368 /* scale for div 256 = 64 * 4 */
369 if (cycles > 63) {
370 cycles /= 4;
371 prescaler++;
372 }
373
374 /* scale for div 512 = 256 * 2 */
375 if (cycles > 63) {
376 cycles /= 2;
377 prescaler++;
378 }
379
380 /* scale for div 2048 = 512 * 4 */
381 if (cycles > 63) {
382 cycles /= 4;
383 prescaler++;
384 }
385
386 /* check for overflow => invalid ramp time */
387 if (cycles > 63) {
388 pr_warn("%s: invalid setuptime for vdd_%s\n", __func__,
389 voltdm->name);
390 return 0;
391 }
392
393 cycles++;
222 394
223 omap3_vfsm_init(voltdm); 395 return (prescaler << OMAP4430_RAMP_UP_PRESCAL_SHIFT) |
396 (cycles << OMAP4430_RAMP_UP_COUNT_SHIFT);
397}
398
399/**
400 * omap4_usec_to_val_scrm - convert microsecond value to SCRM module bitfield
401 * @usec: microseconds
402 * @shift: number of bits to shift left
403 * @mask: bitfield mask
404 *
405 * Converts microsecond value to OMAP4 SCRM bitfield. Bitfield is
406 * shifted to requested position, and checked agains the mask value.
407 * If larger, forced to the max value of the field (i.e. the mask itself.)
408 * Returns the SCRM bitfield value.
409 */
410static u32 omap4_usec_to_val_scrm(u32 usec, int shift, u32 mask)
411{
412 u32 val;
413
414 val = omap_usec_to_32k(usec) << shift;
224 415
225 is_initialized = true; 416 /* Check for overflow, if yes, force to max value */
417 if (val > mask)
418 val = mask;
419
420 return val;
226} 421}
227 422
423/**
424 * omap4_set_timings - set voltage ramp timings for a channel
425 * @voltdm: channel to configure
426 * @off_mode: whether off-mode values are used
427 *
428 * Calculates and sets the voltage ramp up / down values for a channel.
429 */
430static void omap4_set_timings(struct voltagedomain *voltdm, bool off_mode)
431{
432 u32 val;
433 u32 ramp;
434 int offset;
435 u32 tstart, tshut;
436
437 if (off_mode) {
438 ramp = omap4_calc_volt_ramp(voltdm,
439 voltdm->vc_param->on - voltdm->vc_param->off);
440 offset = voltdm->vfsm->voltsetup_off_reg;
441 } else {
442 ramp = omap4_calc_volt_ramp(voltdm,
443 voltdm->vc_param->on - voltdm->vc_param->ret);
444 offset = voltdm->vfsm->voltsetup_reg;
445 }
446
447 if (!ramp)
448 return;
449
450 val = voltdm->read(offset);
451
452 val |= ramp << OMAP4430_RAMP_DOWN_COUNT_SHIFT;
453
454 val |= ramp << OMAP4430_RAMP_UP_COUNT_SHIFT;
455
456 voltdm->write(val, offset);
457
458 omap_pm_get_oscillator(&tstart, &tshut);
459
460 val = omap4_usec_to_val_scrm(tstart, OMAP4_SETUPTIME_SHIFT,
461 OMAP4_SETUPTIME_MASK);
462 val |= omap4_usec_to_val_scrm(tshut, OMAP4_DOWNTIME_SHIFT,
463 OMAP4_DOWNTIME_MASK);
464
465 __raw_writel(val, OMAP4_SCRM_CLKSETUPTIME);
466}
228 467
229/* OMAP4 specific voltage init functions */ 468/* OMAP4 specific voltage init functions */
230static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) 469static void __init omap4_vc_init_channel(struct voltagedomain *voltdm)
231{ 470{
232 static bool is_initialized; 471 omap4_set_timings(voltdm, true);
233 u32 vc_val; 472 omap4_set_timings(voltdm, false);
473}
474
475struct i2c_init_data {
476 u8 loadbits;
477 u8 load;
478 u8 hsscll_38_4;
479 u8 hsscll_26;
480 u8 hsscll_19_2;
481 u8 hsscll_16_8;
482 u8 hsscll_12;
483};
234 484
235 if (is_initialized) 485static const __initdata struct i2c_init_data omap4_i2c_timing_data[] = {
486 {
487 .load = 50,
488 .loadbits = 0x3,
489 .hsscll_38_4 = 13,
490 .hsscll_26 = 11,
491 .hsscll_19_2 = 9,
492 .hsscll_16_8 = 9,
493 .hsscll_12 = 8,
494 },
495 {
496 .load = 25,
497 .loadbits = 0x2,
498 .hsscll_38_4 = 13,
499 .hsscll_26 = 11,
500 .hsscll_19_2 = 9,
501 .hsscll_16_8 = 9,
502 .hsscll_12 = 8,
503 },
504 {
505 .load = 12,
506 .loadbits = 0x1,
507 .hsscll_38_4 = 11,
508 .hsscll_26 = 10,
509 .hsscll_19_2 = 9,
510 .hsscll_16_8 = 9,
511 .hsscll_12 = 8,
512 },
513 {
514 .load = 0,
515 .loadbits = 0x0,
516 .hsscll_38_4 = 12,
517 .hsscll_26 = 10,
518 .hsscll_19_2 = 9,
519 .hsscll_16_8 = 8,
520 .hsscll_12 = 8,
521 },
522};
523
524/**
525 * omap4_vc_i2c_timing_init - sets up board I2C timing parameters
526 * @voltdm: voltagedomain pointer to get data from
527 *
528 * Use PMIC + board supplied settings for calculating the total I2C
529 * channel capacitance and set the timing parameters based on this.
530 * Pre-calculated values are provided in data tables, as it is not
531 * too straightforward to calculate these runtime.
532 */
533static void __init omap4_vc_i2c_timing_init(struct voltagedomain *voltdm)
534{
535 u32 capacitance;
536 u32 val;
537 u16 hsscll;
538 const struct i2c_init_data *i2c_data;
539
540 if (!voltdm->pmic->i2c_high_speed) {
541 pr_warn("%s: only high speed supported!\n", __func__);
236 return; 542 return;
543 }
544
545 /* PCB trace capacitance, 0.125pF / mm => mm / 8 */
546 capacitance = DIV_ROUND_UP(sr_i2c_pcb_length, 8);
547
548 /* OMAP pad capacitance */
549 capacitance += 4;
550
551 /* PMIC pad capacitance */
552 capacitance += voltdm->pmic->i2c_pad_load;
553
554 /* Search for capacitance match in the table */
555 i2c_data = omap4_i2c_timing_data;
556
557 while (i2c_data->load > capacitance)
558 i2c_data++;
559
560 /* Select proper values based on sysclk frequency */
561 switch (voltdm->sys_clk.rate) {
562 case 38400000:
563 hsscll = i2c_data->hsscll_38_4;
564 break;
565 case 26000000:
566 hsscll = i2c_data->hsscll_26;
567 break;
568 case 19200000:
569 hsscll = i2c_data->hsscll_19_2;
570 break;
571 case 16800000:
572 hsscll = i2c_data->hsscll_16_8;
573 break;
574 case 12000000:
575 hsscll = i2c_data->hsscll_12;
576 break;
577 default:
578 pr_warn("%s: unsupported sysclk rate: %d!\n", __func__,
579 voltdm->sys_clk.rate);
580 return;
581 }
237 582
238 /* XXX These are magic numbers and do not belong! */ 583 /* Loadbits define pull setup for the I2C channels */
239 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT); 584 val = i2c_data->loadbits << 25 | i2c_data->loadbits << 29;
240 voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
241 585
242 is_initialized = true; 586 /* Write to SYSCTRL_PADCONF_WKUP_CTRL_I2C_2 to setup I2C pull */
587 __raw_writel(val, OMAP2_L4_IO_ADDRESS(OMAP4_CTRL_MODULE_PAD_WKUP +
588 OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2));
589
590 /* HSSCLH can always be zero */
591 val = hsscll << OMAP4430_HSSCLL_SHIFT;
592 val |= (0x28 << OMAP4430_SCLL_SHIFT | 0x2c << OMAP4430_SCLH_SHIFT);
593
594 /* Write setup times to I2C config register */
595 voltdm->write(val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
243} 596}
244 597
598
599
245/** 600/**
246 * omap_vc_i2c_init - initialize I2C interface to PMIC 601 * omap_vc_i2c_init - initialize I2C interface to PMIC
247 * @voltdm: voltage domain containing VC data 602 * @voltdm: voltage domain containing VC data
@@ -281,9 +636,51 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm)
281 mcode << __ffs(vc->common->i2c_mcode_mask), 636 mcode << __ffs(vc->common->i2c_mcode_mask),
282 vc->common->i2c_cfg_reg); 637 vc->common->i2c_cfg_reg);
283 638
639 if (cpu_is_omap44xx())
640 omap4_vc_i2c_timing_init(voltdm);
641
284 initialized = true; 642 initialized = true;
285} 643}
286 644
645/**
646 * omap_vc_calc_vsel - calculate vsel value for a channel
647 * @voltdm: channel to calculate value for
648 * @uvolt: microvolt value to convert to vsel
649 *
650 * Converts a microvolt value to vsel value for the used PMIC.
651 * This checks whether the microvolt value is out of bounds, and
652 * adjusts the value accordingly. If unsupported value detected,
653 * warning is thrown.
654 */
655static u8 omap_vc_calc_vsel(struct voltagedomain *voltdm, u32 uvolt)
656{
657 if (voltdm->pmic->vddmin > uvolt)
658 uvolt = voltdm->pmic->vddmin;
659 if (voltdm->pmic->vddmax < uvolt) {
660 WARN(1, "%s: voltage not supported by pmic: %u vs max %u\n",
661 __func__, uvolt, voltdm->pmic->vddmax);
662 /* Lets try maximum value anyway */
663 uvolt = voltdm->pmic->vddmax;
664 }
665
666 return voltdm->pmic->uv_to_vsel(uvolt);
667}
668
669#ifdef CONFIG_PM
670/**
671 * omap_pm_setup_sr_i2c_pcb_length - set length of SR I2C traces on PCB
672 * @mm: length of the PCB trace in millimetres
673 *
674 * Sets the PCB trace length for the I2C channel. By default uses 63mm.
675 * This is needed for properly calculating the capacitance value for
676 * the PCB trace, and for setting the SR I2C channel timing parameters.
677 */
678void __init omap_pm_setup_sr_i2c_pcb_length(u32 mm)
679{
680 sr_i2c_pcb_length = mm;
681}
682#endif
683
287void __init omap_vc_init_channel(struct voltagedomain *voltdm) 684void __init omap_vc_init_channel(struct voltagedomain *voltdm)
288{ 685{
289 struct omap_vc_channel *vc = voltdm->vc; 686 struct omap_vc_channel *vc = voltdm->vc;
@@ -311,7 +708,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
311 vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr; 708 vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr;
312 vc->volt_reg_addr = voltdm->pmic->volt_reg_addr; 709 vc->volt_reg_addr = voltdm->pmic->volt_reg_addr;
313 vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr; 710 vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr;
314 vc->setup_time = voltdm->pmic->volt_setup_time;
315 711
316 /* Configure the i2c slave address for this VC */ 712 /* Configure the i2c slave address for this VC */
317 voltdm->rmw(vc->smps_sa_mask, 713 voltdm->rmw(vc->smps_sa_mask,
@@ -331,14 +727,18 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
331 voltdm->rmw(vc->smps_cmdra_mask, 727 voltdm->rmw(vc->smps_cmdra_mask,
332 vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask), 728 vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask),
333 vc->smps_cmdra_reg); 729 vc->smps_cmdra_reg);
334 vc->cfg_channel |= vc_cfg_bits->rac | vc_cfg_bits->racen; 730 vc->cfg_channel |= vc_cfg_bits->rac;
335 } 731 }
336 732
733 if (vc->cmd_reg_addr == vc->volt_reg_addr)
734 vc->cfg_channel |= vc_cfg_bits->racen;
735
337 /* Set up the on, inactive, retention and off voltage */ 736 /* Set up the on, inactive, retention and off voltage */
338 on_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->on_volt); 737 on_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->on);
339 onlp_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->onlp_volt); 738 onlp_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->onlp);
340 ret_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->ret_volt); 739 ret_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->ret);
341 off_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->off_volt); 740 off_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->off);
741
342 val = ((on_vsel << vc->common->cmd_on_shift) | 742 val = ((on_vsel << vc->common->cmd_on_shift) |
343 (onlp_vsel << vc->common->cmd_onlp_shift) | 743 (onlp_vsel << vc->common->cmd_onlp_shift) |
344 (ret_vsel << vc->common->cmd_ret_shift) | 744 (ret_vsel << vc->common->cmd_ret_shift) |
@@ -349,11 +749,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
349 /* Channel configuration */ 749 /* Channel configuration */
350 omap_vc_config_channel(voltdm); 750 omap_vc_config_channel(voltdm);
351 751
352 /* Configure the setup times */
353 voltdm->rmw(voltdm->vfsm->voltsetup_mask,
354 vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask),
355 voltdm->vfsm->voltsetup_reg);
356
357 omap_vc_i2c_init(voltdm); 752 omap_vc_i2c_init(voltdm);
358 753
359 if (cpu_is_omap34xx()) 754 if (cpu_is_omap34xx())
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 478bf6b432c..91c8d75bf2e 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -86,7 +86,6 @@ struct omap_vc_channel {
86 u16 i2c_slave_addr; 86 u16 i2c_slave_addr;
87 u16 volt_reg_addr; 87 u16 volt_reg_addr;
88 u16 cmd_reg_addr; 88 u16 cmd_reg_addr;
89 u16 setup_time;
90 u8 cfg_channel; 89 u8 cfg_channel;
91 bool i2c_high_speed; 90 bool i2c_high_speed;
92 91
@@ -111,6 +110,13 @@ extern struct omap_vc_channel omap4_vc_mpu;
111extern struct omap_vc_channel omap4_vc_iva; 110extern struct omap_vc_channel omap4_vc_iva;
112extern struct omap_vc_channel omap4_vc_core; 111extern struct omap_vc_channel omap4_vc_core;
113 112
113extern struct omap_vc_param omap3_mpu_vc_data;
114extern struct omap_vc_param omap3_core_vc_data;
115
116extern struct omap_vc_param omap4_mpu_vc_data;
117extern struct omap_vc_param omap4_iva_vc_data;
118extern struct omap_vc_param omap4_core_vc_data;
119
114void omap_vc_init_channel(struct voltagedomain *voltdm); 120void omap_vc_init_channel(struct voltagedomain *voltdm);
115int omap_vc_pre_scale(struct voltagedomain *voltdm, 121int omap_vc_pre_scale(struct voltagedomain *voltdm,
116 unsigned long target_volt, 122 unsigned long target_volt,
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
index 5d8eaf31569..75bc4aa22b3 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -71,3 +71,25 @@ struct omap_vc_channel omap3_vc_core = {
71 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, 71 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK,
72 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT, 72 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
73}; 73};
74
75/*
76 * Voltage levels for different operating modes: on, sleep, retention and off
77 */
78#define OMAP3_ON_VOLTAGE_UV 1200000
79#define OMAP3_ONLP_VOLTAGE_UV 1000000
80#define OMAP3_RET_VOLTAGE_UV 975000
81#define OMAP3_OFF_VOLTAGE_UV 600000
82
83struct omap_vc_param omap3_mpu_vc_data = {
84 .on = OMAP3_ON_VOLTAGE_UV,
85 .onlp = OMAP3_ONLP_VOLTAGE_UV,
86 .ret = OMAP3_RET_VOLTAGE_UV,
87 .off = OMAP3_OFF_VOLTAGE_UV,
88};
89
90struct omap_vc_param omap3_core_vc_data = {
91 .on = OMAP3_ON_VOLTAGE_UV,
92 .onlp = OMAP3_ONLP_VOLTAGE_UV,
93 .ret = OMAP3_RET_VOLTAGE_UV,
94 .off = OMAP3_OFF_VOLTAGE_UV,
95};
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c
index d70b930f273..085e5d6a04f 100644
--- a/arch/arm/mach-omap2/vc44xx_data.c
+++ b/arch/arm/mach-omap2/vc44xx_data.c
@@ -87,3 +87,31 @@ struct omap_vc_channel omap4_vc_core = {
87 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT, 87 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT,
88}; 88};
89 89
90/*
91 * Voltage levels for different operating modes: on, sleep, retention and off
92 */
93#define OMAP4_ON_VOLTAGE_UV 1375000
94#define OMAP4_ONLP_VOLTAGE_UV 1375000
95#define OMAP4_RET_VOLTAGE_UV 837500
96#define OMAP4_OFF_VOLTAGE_UV 0
97
98struct omap_vc_param omap4_mpu_vc_data = {
99 .on = OMAP4_ON_VOLTAGE_UV,
100 .onlp = OMAP4_ONLP_VOLTAGE_UV,
101 .ret = OMAP4_RET_VOLTAGE_UV,
102 .off = OMAP4_OFF_VOLTAGE_UV,
103};
104
105struct omap_vc_param omap4_iva_vc_data = {
106 .on = OMAP4_ON_VOLTAGE_UV,
107 .onlp = OMAP4_ONLP_VOLTAGE_UV,
108 .ret = OMAP4_RET_VOLTAGE_UV,
109 .off = OMAP4_OFF_VOLTAGE_UV,
110};
111
112struct omap_vc_param omap4_core_vc_data = {
113 .on = OMAP4_ON_VOLTAGE_UV,
114 .onlp = OMAP4_ONLP_VOLTAGE_UV,
115 .ret = OMAP4_RET_VOLTAGE_UV,
116 .off = OMAP4_OFF_VOLTAGE_UV,
117};
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 7283b7ed7de..a0ce4f10ff1 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -40,12 +40,14 @@ struct powerdomain;
40 * data 40 * data
41 * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register 41 * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
42 * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base 42 * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
43 * @voltsetup_off_reg: register offset of PRM_VOLTSETUP_OFF from PRM base
43 * 44 *
44 * XXX What about VOLTOFFSET/VOLTCTRL? 45 * XXX What about VOLTOFFSET/VOLTCTRL?
45 */ 46 */
46struct omap_vfsm_instance { 47struct omap_vfsm_instance {
47 u32 voltsetup_mask; 48 u32 voltsetup_mask;
48 u8 voltsetup_reg; 49 u8 voltsetup_reg;
50 u8 voltsetup_off_reg;
49}; 51};
50 52
51/** 53/**
@@ -74,6 +76,8 @@ struct voltagedomain {
74 const struct omap_vfsm_instance *vfsm; 76 const struct omap_vfsm_instance *vfsm;
75 struct omap_vp_instance *vp; 77 struct omap_vp_instance *vp;
76 struct omap_voltdm_pmic *pmic; 78 struct omap_voltdm_pmic *pmic;
79 struct omap_vp_param *vp_param;
80 struct omap_vc_param *vc_param;
77 81
78 /* VC/VP register access functions: SoC specific */ 82 /* VC/VP register access functions: SoC specific */
79 u32 (*read) (u8 offset); 83 u32 (*read) (u8 offset);
@@ -92,6 +96,24 @@ struct voltagedomain {
92 struct omap_volt_data *volt_data; 96 struct omap_volt_data *volt_data;
93}; 97};
94 98
99/* Min and max voltages from OMAP perspective */
100#define OMAP3430_VP1_VLIMITTO_VDDMIN 850000
101#define OMAP3430_VP1_VLIMITTO_VDDMAX 1425000
102#define OMAP3430_VP2_VLIMITTO_VDDMIN 900000
103#define OMAP3430_VP2_VLIMITTO_VDDMAX 1150000
104
105#define OMAP3630_VP1_VLIMITTO_VDDMIN 900000
106#define OMAP3630_VP1_VLIMITTO_VDDMAX 1350000
107#define OMAP3630_VP2_VLIMITTO_VDDMIN 900000
108#define OMAP3630_VP2_VLIMITTO_VDDMAX 1200000
109
110#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 830000
111#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 1410000
112#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 830000
113#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 1260000
114#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 830000
115#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 1200000
116
95/** 117/**
96 * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. 118 * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
97 * @slew_rate: PMIC slew rate (in uv/us) 119 * @slew_rate: PMIC slew rate (in uv/us)
@@ -107,26 +129,34 @@ struct voltagedomain {
107struct omap_voltdm_pmic { 129struct omap_voltdm_pmic {
108 int slew_rate; 130 int slew_rate;
109 int step_size; 131 int step_size;
110 u32 on_volt;
111 u32 onlp_volt;
112 u32 ret_volt;
113 u32 off_volt;
114 u16 volt_setup_time;
115 u16 i2c_slave_addr; 132 u16 i2c_slave_addr;
116 u16 volt_reg_addr; 133 u16 volt_reg_addr;
117 u16 cmd_reg_addr; 134 u16 cmd_reg_addr;
118 u8 vp_erroroffset; 135 u8 vp_erroroffset;
119 u8 vp_vstepmin; 136 u8 vp_vstepmin;
120 u8 vp_vstepmax; 137 u8 vp_vstepmax;
121 u8 vp_vddmin; 138 u32 vddmin;
122 u8 vp_vddmax; 139 u32 vddmax;
123 u8 vp_timeout_us; 140 u8 vp_timeout_us;
124 bool i2c_high_speed; 141 bool i2c_high_speed;
142 u32 i2c_pad_load;
125 u8 i2c_mcode; 143 u8 i2c_mcode;
126 unsigned long (*vsel_to_uv) (const u8 vsel); 144 unsigned long (*vsel_to_uv) (const u8 vsel);
127 u8 (*uv_to_vsel) (unsigned long uV); 145 u8 (*uv_to_vsel) (unsigned long uV);
128}; 146};
129 147
148struct omap_vp_param {
149 u32 vddmax;
150 u32 vddmin;
151};
152
153struct omap_vc_param {
154 u32 on;
155 u32 onlp;
156 u32 ret;
157 u32 off;
158};
159
130void omap_voltage_get_volttable(struct voltagedomain *voltdm, 160void omap_voltage_get_volttable(struct voltagedomain *voltdm,
131 struct omap_volt_data **volt_data); 161 struct omap_volt_data **volt_data);
132struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, 162struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index 63afbfed3cb..261bb7cb4e6 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -117,6 +117,11 @@ void __init omap3xxx_voltagedomains_init(void)
117 } 117 }
118#endif 118#endif
119 119
120 omap3_voltdm_mpu.vp_param = &omap3_mpu_vp_data;
121 omap3_voltdm_core.vp_param = &omap3_core_vp_data;
122 omap3_voltdm_mpu.vc_param = &omap3_mpu_vc_data;
123 omap3_voltdm_core.vc_param = &omap3_core_vc_data;
124
120 if (soc_is_am35xx()) 125 if (soc_is_am35xx())
121 voltdms = voltagedomains_am35xx; 126 voltdms = voltagedomains_am35xx;
122 else 127 else
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index c3115f6853d..48b22a0a0c8 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -22,7 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24#include "common.h" 24#include "common.h"
25 25#include "soc.h"
26#include "prm-regbits-44xx.h" 26#include "prm-regbits-44xx.h"
27#include "prm44xx.h" 27#include "prm44xx.h"
28#include "prcm44xx.h" 28#include "prcm44xx.h"
@@ -34,14 +34,17 @@
34 34
35static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = { 35static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, 36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
37 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET,
37}; 38};
38 39
39static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { 40static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
40 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, 41 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
42 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET,
41}; 43};
42 44
43static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { 45static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
44 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, 46 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
47 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET,
45}; 48};
46 49
47static struct voltagedomain omap4_voltdm_mpu = { 50static struct voltagedomain omap4_voltdm_mpu = {
@@ -101,11 +104,25 @@ void __init omap44xx_voltagedomains_init(void)
101 * for the currently-running IC 104 * for the currently-running IC
102 */ 105 */
103#ifdef CONFIG_PM_OPP 106#ifdef CONFIG_PM_OPP
104 omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data; 107 if (cpu_is_omap443x()) {
105 omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data; 108 omap4_voltdm_mpu.volt_data = omap443x_vdd_mpu_volt_data;
106 omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data; 109 omap4_voltdm_iva.volt_data = omap443x_vdd_iva_volt_data;
110 omap4_voltdm_core.volt_data = omap443x_vdd_core_volt_data;
111 } else if (cpu_is_omap446x()) {
112 omap4_voltdm_mpu.volt_data = omap446x_vdd_mpu_volt_data;
113 omap4_voltdm_iva.volt_data = omap446x_vdd_iva_volt_data;
114 omap4_voltdm_core.volt_data = omap446x_vdd_core_volt_data;
115 }
107#endif 116#endif
108 117
118 omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data;
119 omap4_voltdm_iva.vp_param = &omap4_iva_vp_data;
120 omap4_voltdm_core.vp_param = &omap4_core_vp_data;
121
122 omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data;
123 omap4_voltdm_iva.vc_param = &omap4_iva_vc_data;
124 omap4_voltdm_core.vc_param = &omap4_core_vc_data;
125
109 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) 126 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
110 voltdm->sys_clk.name = sys_clk_name; 127 voltdm->sys_clk.name = sys_clk_name;
111 128
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index 85241b828c0..a3c30655aa3 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -58,8 +58,10 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
58 sys_clk_rate = voltdm->sys_clk.rate / 1000; 58 sys_clk_rate = voltdm->sys_clk.rate / 1000;
59 59
60 timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000; 60 timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
61 vddmin = voltdm->pmic->vp_vddmin; 61 vddmin = max(voltdm->vp_param->vddmin, voltdm->pmic->vddmin);
62 vddmax = voltdm->pmic->vp_vddmax; 62 vddmax = min(voltdm->vp_param->vddmax, voltdm->pmic->vddmax);
63 vddmin = voltdm->pmic->uv_to_vsel(vddmin);
64 vddmax = voltdm->pmic->uv_to_vsel(vddmax);
63 65
64 waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate, 66 waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate,
65 1000 * voltdm->pmic->slew_rate); 67 1000 * voltdm->pmic->slew_rate);
@@ -138,7 +140,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
138 udelay(1); 140 udelay(1);
139 } 141 }
140 if (timeout >= VP_TRANXDONE_TIMEOUT) { 142 if (timeout >= VP_TRANXDONE_TIMEOUT) {
141 pr_warn("%s: vdd_%s TRANXDONE timeout exceeded. Voltage change aborted", 143 pr_warn("%s: vdd_%s TRANXDONE timeout exceeded. Voltage change aborted\n",
142 __func__, voltdm->name); 144 __func__, voltdm->name);
143 return -ETIMEDOUT; 145 return -ETIMEDOUT;
144 } 146 }
@@ -197,7 +199,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
197 u32 vpconfig, volt; 199 u32 vpconfig, volt;
198 200
199 if (!voltdm || IS_ERR(voltdm)) { 201 if (!voltdm || IS_ERR(voltdm)) {
200 pr_warning("%s: VDD specified does not exist!\n", __func__); 202 pr_warn("%s: VDD specified does not exist!\n", __func__);
201 return; 203 return;
202 } 204 }
203 205
@@ -214,8 +216,8 @@ void omap_vp_enable(struct voltagedomain *voltdm)
214 216
215 volt = voltdm_get_voltage(voltdm); 217 volt = voltdm_get_voltage(voltdm);
216 if (!volt) { 218 if (!volt) {
217 pr_warning("%s: unable to find current voltage for %s\n", 219 pr_warn("%s: unable to find current voltage for %s\n",
218 __func__, voltdm->name); 220 __func__, voltdm->name);
219 return; 221 return;
220 } 222 }
221 223
@@ -242,7 +244,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
242 int timeout; 244 int timeout;
243 245
244 if (!voltdm || IS_ERR(voltdm)) { 246 if (!voltdm || IS_ERR(voltdm)) {
245 pr_warning("%s: VDD specified does not exist!\n", __func__); 247 pr_warn("%s: VDD specified does not exist!\n", __func__);
246 return; 248 return;
247 } 249 }
248 250
@@ -272,8 +274,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
272 VP_IDLE_TIMEOUT, timeout); 274 VP_IDLE_TIMEOUT, timeout);
273 275
274 if (timeout >= VP_IDLE_TIMEOUT) 276 if (timeout >= VP_IDLE_TIMEOUT)
275 pr_warning("%s: vdd_%s idle timedout\n", 277 pr_warn("%s: vdd_%s idle timedout\n", __func__, voltdm->name);
276 __func__, voltdm->name);
277 278
278 vp->enabled = false; 279 vp->enabled = false;
279 280
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index 7c155d248aa..0fdf7080e4a 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -117,6 +117,13 @@ extern struct omap_vp_instance omap4_vp_mpu;
117extern struct omap_vp_instance omap4_vp_iva; 117extern struct omap_vp_instance omap4_vp_iva;
118extern struct omap_vp_instance omap4_vp_core; 118extern struct omap_vp_instance omap4_vp_core;
119 119
120extern struct omap_vp_param omap3_mpu_vp_data;
121extern struct omap_vp_param omap3_core_vp_data;
122
123extern struct omap_vp_param omap4_mpu_vp_data;
124extern struct omap_vp_param omap4_iva_vp_data;
125extern struct omap_vp_param omap4_core_vp_data;
126
120void omap_vp_init(struct voltagedomain *voltdm); 127void omap_vp_init(struct voltagedomain *voltdm);
121void omap_vp_enable(struct voltagedomain *voltdm); 128void omap_vp_enable(struct voltagedomain *voltdm);
122void omap_vp_disable(struct voltagedomain *voltdm); 129void omap_vp_disable(struct voltagedomain *voltdm);
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c
index bd89f80089f..1914e026245 100644
--- a/arch/arm/mach-omap2/vp3xxx_data.c
+++ b/arch/arm/mach-omap2/vp3xxx_data.c
@@ -77,3 +77,13 @@ struct omap_vp_instance omap3_vp_core = {
77 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, 77 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
78 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, 78 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
79}; 79};
80
81struct omap_vp_param omap3_mpu_vp_data = {
82 .vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN,
83 .vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX,
84};
85
86struct omap_vp_param omap3_core_vp_data = {
87 .vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN,
88 .vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX,
89};
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c
index 8c031d16879..e62f6b018be 100644
--- a/arch/arm/mach-omap2/vp44xx_data.c
+++ b/arch/arm/mach-omap2/vp44xx_data.c
@@ -87,3 +87,18 @@ struct omap_vp_instance omap4_vp_core = {
87 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, 87 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
88 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, 88 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
89}; 89};
90
91struct omap_vp_param omap4_mpu_vp_data = {
92 .vddmin = OMAP4_VP_MPU_VLIMITTO_VDDMIN,
93 .vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX,
94};
95
96struct omap_vp_param omap4_iva_vp_data = {
97 .vddmin = OMAP4_VP_IVA_VLIMITTO_VDDMIN,
98 .vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX,
99};
100
101struct omap_vp_param omap4_core_vp_data = {
102 .vddmin = OMAP4_VP_CORE_VLIMITTO_VDDMIN,
103 .vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX,
104};
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index b2f1c67043a..7c2b4ed38f0 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * OMAP2+ MPU WD_TIMER-specific code 2 * OMAP2+ MPU WD_TIMER-specific code
3 * 3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
4 * 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
5 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
@@ -11,10 +13,14 @@
11#include <linux/io.h> 13#include <linux/io.h>
12#include <linux/err.h> 14#include <linux/err.h>
13 15
14#include <plat/omap_hwmod.h> 16#include <linux/platform_data/omap-wd-timer.h>
15 17
18#include "omap_hwmod.h"
19#include "omap_device.h"
16#include "wd_timer.h" 20#include "wd_timer.h"
17#include "common.h" 21#include "common.h"
22#include "prm.h"
23#include "soc.h"
18 24
19/* 25/*
20 * In order to avoid any assumptions from bootloader regarding WDT 26 * In order to avoid any assumptions from bootloader regarding WDT
@@ -26,9 +32,6 @@
26#define OMAP_WDT_WPS 0x34 32#define OMAP_WDT_WPS 0x34
27#define OMAP_WDT_SPR 0x48 33#define OMAP_WDT_SPR 0x48
28 34
29/* Maximum microseconds to wait for OMAP module to softreset */
30#define MAX_MODULE_SOFTRESET_WAIT 10000
31
32int omap2_wd_timer_disable(struct omap_hwmod *oh) 35int omap2_wd_timer_disable(struct omap_hwmod *oh)
33{ 36{
34 void __iomem *base; 37 void __iomem *base;
@@ -99,3 +102,32 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
99 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 102 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
100 omap2_wd_timer_disable(oh); 103 omap2_wd_timer_disable(oh);
101} 104}
105
106static int __init omap_init_wdt(void)
107{
108 int id = -1;
109 struct platform_device *pdev;
110 struct omap_hwmod *oh;
111 char *oh_name = "wd_timer2";
112 char *dev_name = "omap_wdt";
113 struct omap_wd_timer_platform_data pdata;
114
115 if (!cpu_class_is_omap2() || of_have_populated_dt())
116 return 0;
117
118 oh = omap_hwmod_lookup(oh_name);
119 if (!oh) {
120 pr_err("Could not look up wd_timer%d hwmod\n", id);
121 return -EINVAL;
122 }
123
124 pdata.read_reset_sources = prm_read_reset_sources;
125
126 pdev = omap_device_build(dev_name, id, oh, &pdata,
127 sizeof(struct omap_wd_timer_platform_data),
128 NULL, 0, 0);
129 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
130 dev_name, oh->name);
131 return 0;
132}
133subsys_initcall(omap_init_wdt);
diff --git a/arch/arm/mach-omap2/wd_timer.h b/arch/arm/mach-omap2/wd_timer.h
index f6bbba73b53..a78f81034a9 100644
--- a/arch/arm/mach-omap2/wd_timer.h
+++ b/arch/arm/mach-omap2/wd_timer.h
@@ -10,7 +10,7 @@
10#ifndef __ARCH_ARM_MACH_OMAP2_WD_TIMER_H 10#ifndef __ARCH_ARM_MACH_OMAP2_WD_TIMER_H
11#define __ARCH_ARM_MACH_OMAP2_WD_TIMER_H 11#define __ARCH_ARM_MACH_OMAP2_WD_TIMER_H
12 12
13#include <plat/omap_hwmod.h> 13#include "omap_hwmod.h"
14 14
15extern int omap2_wd_timer_disable(struct omap_hwmod *oh); 15extern int omap2_wd_timer_disable(struct omap_hwmod *oh);
16extern int omap2_wd_timer_reset(struct omap_hwmod *oh); 16extern int omap2_wd_timer_reset(struct omap_hwmod *oh);
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 0673f0c1043..2cb2f06c20f 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -2,6 +2,13 @@ if ARCH_ORION5X
2 2
3menu "Orion Implementations" 3menu "Orion Implementations"
4 4
5config ARCH_ORION5X_DT
6 bool "Marvell Orion5x Flattened Device Tree"
7 select USE_OF
8 help
9 Say 'Y' here if you want your kernel to support the
10 Marvell Orion5x using flattened device tree.
11
5config MACH_DB88F5281 12config MACH_DB88F5281
6 bool "Marvell Orion-2 Development Board" 13 bool "Marvell Orion-2 Development Board"
7 select I2C_BOARDINFO 14 select I2C_BOARDINFO
@@ -96,12 +103,13 @@ config MACH_MV2120
96 Say 'Y' here if you want your kernel to support the 103 Say 'Y' here if you want your kernel to support the
97 HP Media Vault mv2120 or mv5100. 104 HP Media Vault mv2120 or mv5100.
98 105
99config MACH_EDMINI_V2 106config MACH_EDMINI_V2_DT
100 bool "LaCie Ethernet Disk mini V2" 107 bool "LaCie Ethernet Disk mini V2 (Flattened Device Tree)"
101 select I2C_BOARDINFO 108 select I2C_BOARDINFO
109 select ARCH_ORION5X_DT
102 help 110 help
103 Say 'Y' here if you want your kernel to support the 111 Say 'Y' here if you want your kernel to support the
104 LaCie Ethernet Disk mini V2. 112 LaCie Ethernet Disk mini V2 (Flattened Device Tree).
105 113
106config MACH_D2NET 114config MACH_D2NET
107 bool "LaCie d2 Network" 115 bool "LaCie d2 Network"
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 7f18cdacd48..9e809a7c05c 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o
12obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o 12obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o
13obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o 13obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o
14obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o 14obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
15obj-$(CONFIG_MACH_EDMINI_V2) += edmini_v2-setup.o
16obj-$(CONFIG_MACH_D2NET) += d2net-setup.o 15obj-$(CONFIG_MACH_D2NET) += d2net-setup.o
17obj-$(CONFIG_MACH_BIGDISK) += d2net-setup.o 16obj-$(CONFIG_MACH_BIGDISK) += d2net-setup.o
18obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o 17obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o
@@ -22,3 +21,6 @@ obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
22obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o 21obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
23obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o 22obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o
24obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o 23obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o
24
25obj-$(CONFIG_ARCH_ORION5X_DT) += board-dt.o
26obj-$(CONFIG_MACH_EDMINI_V2_DT) += edmini_v2-setup.o
diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c
new file mode 100644
index 00000000000..32e5c211a89
--- /dev/null
+++ b/arch/arm/mach-orion5x/board-dt.c
@@ -0,0 +1,79 @@
1/*
2 * Copyright 2012 (C), Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 *
4 * arch/arm/mach-orion5x/board-dt.c
5 *
6 * Flattened Device Tree board initialization
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/of.h>
16#include <linux/of_platform.h>
17#include <asm/system_misc.h>
18#include <asm/mach/arch.h>
19#include <mach/orion5x.h>
20#include <plat/irq.h>
21#include "common.h"
22
23struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = {
24 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
25 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
26 NULL),
27 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
28 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
29 OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1090000, "mv_crypto", NULL),
30 {},
31};
32
33static void __init orion5x_dt_init(void)
34{
35 char *dev_name;
36 u32 dev, rev;
37
38 orion5x_id(&dev, &rev, &dev_name);
39 printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
40
41 /*
42 * Setup Orion address map
43 */
44 orion5x_setup_cpu_mbus_bridge();
45
46 /* Setup root of clk tree */
47 clk_init();
48
49 /*
50 * Don't issue "Wait for Interrupt" instruction if we are
51 * running on D0 5281 silicon.
52 */
53 if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
54 printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
55 disable_hlt();
56 }
57
58 if (of_machine_is_compatible("lacie,ethernet-disk-mini-v2"))
59 edmini_v2_init();
60
61 of_platform_populate(NULL, of_default_bus_match_table,
62 orion5x_auxdata_lookup, NULL);
63}
64
65static const char *orion5x_dt_compat[] = {
66 "marvell,orion5x",
67 NULL,
68};
69
70DT_MACHINE_START(ORION5X_DT, "Marvell Orion5x (Flattened Device Tree)")
71 /* Maintainer: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> */
72 .map_io = orion5x_map_io,
73 .init_early = orion5x_init_early,
74 .init_irq = orion_dt_init_irq,
75 .timer = &orion5x_timer,
76 .init_machine = orion5x_dt_init,
77 .restart = orion5x_restart,
78 .dt_compat = orion5x_dt_compat,
79MACHINE_END
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index b3eb3da0116..550f92320af 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -65,7 +65,7 @@ void __init orion5x_map_io(void)
65 ****************************************************************************/ 65 ****************************************************************************/
66static struct clk *tclk; 66static struct clk *tclk;
67 67
68static void __init clk_init(void) 68void __init clk_init(void)
69{ 69{
70 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, 70 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
71 orion5x_tclk); 71 orion5x_tclk);
@@ -236,7 +236,7 @@ struct sys_timer orion5x_timer = {
236/* 236/*
237 * Identify device ID and rev from PCIe configuration header space '0'. 237 * Identify device ID and rev from PCIe configuration header space '0'.
238 */ 238 */
239static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name) 239void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
240{ 240{
241 orion5x_pcie_id(dev, rev); 241 orion5x_pcie_id(dev, rev);
242 242
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index 31bab92ce03..7db5cdd9c4b 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -12,6 +12,8 @@ void orion5x_map_io(void);
12void orion5x_init_early(void); 12void orion5x_init_early(void);
13void orion5x_init_irq(void); 13void orion5x_init_irq(void);
14void orion5x_init(void); 14void orion5x_init(void);
15void orion5x_id(u32 *dev, u32 *rev, char **dev_name);
16void clk_init(void);
15extern int orion5x_tclk; 17extern int orion5x_tclk;
16extern struct sys_timer orion5x_timer; 18extern struct sys_timer orion5x_timer;
17 19
@@ -54,6 +56,13 @@ int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
54struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 56struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
55int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 57int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
56 58
59/* board init functions for boards not fully converted to fdt */
60#ifdef CONFIG_MACH_EDMINI_V2_DT
61void edmini_v2_init(void);
62#else
63static inline void edmini_v2_init(void) {};
64#endif
65
57struct meminfo; 66struct meminfo;
58struct tag; 67struct tag;
59extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *); 68extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *);
diff --git a/arch/arm/mach-orion5x/edmini_v2-setup.c b/arch/arm/mach-orion5x/edmini_v2-setup.c
index 355e962137c..d675e727803 100644
--- a/arch/arm/mach-orion5x/edmini_v2-setup.c
+++ b/arch/arm/mach-orion5x/edmini_v2-setup.c
@@ -115,69 +115,6 @@ static struct i2c_board_info __initdata edmini_v2_i2c_rtc = {
115}; 115};
116 116
117/***************************************************************************** 117/*****************************************************************************
118 * Sata
119 ****************************************************************************/
120
121static struct mv_sata_platform_data edmini_v2_sata_data = {
122 .n_ports = 2,
123};
124
125/*****************************************************************************
126 * GPIO LED (simple - doesn't use hardware blinking support)
127 ****************************************************************************/
128
129#define EDMINI_V2_GPIO_LED_POWER 16
130
131static struct gpio_led edmini_v2_leds[] = {
132 {
133 .name = "power:blue",
134 .gpio = EDMINI_V2_GPIO_LED_POWER,
135 .active_low = 1,
136 },
137};
138
139static struct gpio_led_platform_data edmini_v2_led_data = {
140 .num_leds = ARRAY_SIZE(edmini_v2_leds),
141 .leds = edmini_v2_leds,
142};
143
144static struct platform_device edmini_v2_gpio_leds = {
145 .name = "leds-gpio",
146 .id = -1,
147 .dev = {
148 .platform_data = &edmini_v2_led_data,
149 },
150};
151
152/****************************************************************************
153 * GPIO key
154 ****************************************************************************/
155
156#define EDMINI_V2_GPIO_KEY_POWER 18
157
158static struct gpio_keys_button edmini_v2_buttons[] = {
159 {
160 .code = KEY_POWER,
161 .gpio = EDMINI_V2_GPIO_KEY_POWER,
162 .desc = "Power Button",
163 .active_low = 0,
164 },
165};
166
167static struct gpio_keys_platform_data edmini_v2_button_data = {
168 .buttons = edmini_v2_buttons,
169 .nbuttons = ARRAY_SIZE(edmini_v2_buttons),
170};
171
172static struct platform_device edmini_v2_gpio_buttons = {
173 .name = "gpio-keys",
174 .id = -1,
175 .dev = {
176 .platform_data = &edmini_v2_button_data,
177 },
178};
179
180/*****************************************************************************
181 * General Setup 118 * General Setup
182 ****************************************************************************/ 119 ****************************************************************************/
183static unsigned int edminiv2_mpp_modes[] __initdata = { 120static unsigned int edminiv2_mpp_modes[] __initdata = {
@@ -207,13 +144,8 @@ static unsigned int edminiv2_mpp_modes[] __initdata = {
207 0, 144 0,
208}; 145};
209 146
210static void __init edmini_v2_init(void) 147void __init edmini_v2_init(void)
211{ 148{
212 /*
213 * Setup basic Orion functions. Need to be called early.
214 */
215 orion5x_init();
216
217 orion5x_mpp_conf(edminiv2_mpp_modes); 149 orion5x_mpp_conf(edminiv2_mpp_modes);
218 150
219 /* 151 /*
@@ -221,15 +153,10 @@ static void __init edmini_v2_init(void)
221 */ 153 */
222 orion5x_ehci0_init(); 154 orion5x_ehci0_init();
223 orion5x_eth_init(&edmini_v2_eth_data); 155 orion5x_eth_init(&edmini_v2_eth_data);
224 orion5x_i2c_init();
225 orion5x_sata_init(&edmini_v2_sata_data);
226 orion5x_uart0_init();
227 156
228 orion5x_setup_dev_boot_win(EDMINI_V2_NOR_BOOT_BASE, 157 orion5x_setup_dev_boot_win(EDMINI_V2_NOR_BOOT_BASE,
229 EDMINI_V2_NOR_BOOT_SIZE); 158 EDMINI_V2_NOR_BOOT_SIZE);
230 platform_device_register(&edmini_v2_nor_flash); 159 platform_device_register(&edmini_v2_nor_flash);
231 platform_device_register(&edmini_v2_gpio_leds);
232 platform_device_register(&edmini_v2_gpio_buttons);
233 160
234 pr_notice("edmini_v2: USB device port, flash write and power-off " 161 pr_notice("edmini_v2: USB device port, flash write and power-off "
235 "are not yet supported.\n"); 162 "are not yet supported.\n");
@@ -247,16 +174,3 @@ static void __init edmini_v2_init(void)
247 174
248 i2c_register_board_info(0, &edmini_v2_i2c_rtc, 1); 175 i2c_register_board_info(0, &edmini_v2_i2c_rtc, 1);
249} 176}
250
251/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */
252MACHINE_START(EDMINI_V2, "LaCie Ethernet Disk mini V2")
253 /* Maintainer: Christopher Moore <moore@free.fr> */
254 .atag_offset = 0x100,
255 .init_machine = edmini_v2_init,
256 .map_io = orion5x_map_io,
257 .init_early = orion5x_init_early,
258 .init_irq = orion5x_init_irq,
259 .timer = &orion5x_timer,
260 .fixup = tag_fixup_mem32,
261 .restart = orion5x_restart,
262MACHINE_END
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 11aa7399dc0..86eec4159cb 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -2,27 +2,6 @@ if ARCH_PXA
2 2
3menu "Intel PXA2xx/PXA3xx Implementations" 3menu "Intel PXA2xx/PXA3xx Implementations"
4 4
5config ARCH_PXA_V7
6 bool "ARMv7 (PXA95x) based systems"
7
8if ARCH_PXA_V7
9comment "Marvell Dev Platforms (sorted by hardware release time)"
10config MACH_TAVOREVB3
11 bool "PXA95x Development Platform (aka TavorEVB III)"
12 select CPU_PXA955
13
14config MACH_SAARB
15 bool "PXA955 Handheld Platform (aka SAARB)"
16 select CPU_PXA955
17endif
18
19config PXA_V7_MACH_AUTO
20 def_bool y
21 depends on ARCH_PXA_V7
22 depends on !MACH_SAARB
23 select MACH_TAVOREVB3
24
25if !ARCH_PXA_V7
26comment "Intel/Marvell Dev Platforms (sorted by hardware release time)" 5comment "Intel/Marvell Dev Platforms (sorted by hardware release time)"
27 6
28config MACH_PXA3XX_DT 7config MACH_PXA3XX_DT
@@ -630,7 +609,6 @@ config MACH_ZIPIT2
630 bool "Zipit Z2 Handheld" 609 bool "Zipit Z2 Handheld"
631 select HAVE_PWM 610 select HAVE_PWM
632 select PXA27x 611 select PXA27x
633endif
634endmenu 612endmenu
635 613
636config PXA25x 614config PXA25x
@@ -688,18 +666,6 @@ config CPU_PXA935
688 help 666 help
689 PXA935 (codename Tavor-P65) 667 PXA935 (codename Tavor-P65)
690 668
691config PXA95x
692 bool
693 select CPU_PJ4
694 help
695 Select code specific to PXA95x variants
696
697config CPU_PXA955
698 bool
699 select PXA95x
700 help
701 PXA950 (codename MG1)
702
703config PXA_SHARP_C7xx 669config PXA_SHARP_C7xx
704 bool 670 bool
705 select SHARPSL_PM 671 select SHARPSL_PM
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index ee88d6eae64..12c50055838 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -19,7 +19,6 @@ endif
19obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o clock-pxa2xx.o pxa2xx.o pxa25x.o 19obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o clock-pxa2xx.o pxa2xx.o pxa25x.o
20obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o clock-pxa2xx.o pxa2xx.o pxa27x.o 20obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o clock-pxa2xx.o pxa2xx.o pxa27x.o
21obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o clock-pxa3xx.o pxa3xx.o smemc.o pxa3xx-ulpi.o 21obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o clock-pxa3xx.o pxa3xx.o smemc.o pxa3xx-ulpi.o
22obj-$(CONFIG_PXA95x) += mfp-pxa3xx.o clock-pxa3xx.o pxa3xx.o pxa95x.o smemc.o
23obj-$(CONFIG_CPU_PXA300) += pxa300.o 22obj-$(CONFIG_CPU_PXA300) += pxa300.o
24obj-$(CONFIG_CPU_PXA320) += pxa320.o 23obj-$(CONFIG_CPU_PXA320) += pxa320.o
25obj-$(CONFIG_CPU_PXA930) += pxa930.o 24obj-$(CONFIG_CPU_PXA930) += pxa930.o
@@ -36,9 +35,7 @@ obj-$(CONFIG_MACH_ZYLONITE300) += zylonite.o zylonite_pxa300.o
36obj-$(CONFIG_MACH_ZYLONITE320) += zylonite.o zylonite_pxa320.o 35obj-$(CONFIG_MACH_ZYLONITE320) += zylonite.o zylonite_pxa320.o
37obj-$(CONFIG_MACH_LITTLETON) += littleton.o 36obj-$(CONFIG_MACH_LITTLETON) += littleton.o
38obj-$(CONFIG_MACH_TAVOREVB) += tavorevb.o 37obj-$(CONFIG_MACH_TAVOREVB) += tavorevb.o
39obj-$(CONFIG_MACH_TAVOREVB3) += tavorevb3.o
40obj-$(CONFIG_MACH_SAAR) += saar.o 38obj-$(CONFIG_MACH_SAAR) += saar.o
41obj-$(CONFIG_MACH_SAARB) += saarb.o
42 39
43# 3rd Party Dev Platforms 40# 3rd Party Dev Platforms
44obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 41obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 3a258b1bf1a..1f65d32c8d5 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -57,7 +57,7 @@ void clk_pxa2xx_cken_disable(struct clk *clk);
57 57
58extern struct syscore_ops pxa2xx_clock_syscore_ops; 58extern struct syscore_ops pxa2xx_clock_syscore_ops;
59 59
60#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x) 60#if defined(CONFIG_PXA3xx)
61#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \ 61#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
62struct clk clk_##_name = { \ 62struct clk clk_##_name = { \
63 .ops = &clk_pxa3xx_cken_ops, \ 63 .ops = &clk_pxa3xx_cken_ops, \
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index ddaa04de8e2..daa86d39ed9 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -703,7 +703,7 @@ void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
703} 703}
704#endif /* CONFIG_PXA27x || CONFIG_PXA3xx */ 704#endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
705 705
706#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x) 706#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
707static struct resource pxa27x_resource_keypad[] = { 707static struct resource pxa27x_resource_keypad[] = {
708 [0] = { 708 [0] = {
709 .start = 0x41500000, 709 .start = 0x41500000,
@@ -872,7 +872,7 @@ struct platform_device pxa27x_device_pwm1 = {
872 .resource = pxa27x_resource_pwm1, 872 .resource = pxa27x_resource_pwm1,
873 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1), 873 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
874}; 874};
875#endif /* CONFIG_PXA27x || CONFIG_PXA3xx || CONFIG_PXA95x*/ 875#endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
876 876
877#ifdef CONFIG_PXA3xx 877#ifdef CONFIG_PXA3xx
878static struct resource pxa3xx_resources_mci2[] = { 878static struct resource pxa3xx_resources_mci2[] = {
@@ -981,7 +981,7 @@ struct platform_device pxa3xx_device_gcu = {
981 981
982#endif /* CONFIG_PXA3xx */ 982#endif /* CONFIG_PXA3xx */
983 983
984#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x) 984#if defined(CONFIG_PXA3xx)
985static struct resource pxa3xx_resources_i2c_power[] = { 985static struct resource pxa3xx_resources_i2c_power[] = {
986 { 986 {
987 .start = 0x40f500c0, 987 .start = 0x40f500c0,
@@ -1082,7 +1082,7 @@ struct platform_device pxa3xx_device_ssp4 = {
1082 .resource = pxa3xx_resource_ssp4, 1082 .resource = pxa3xx_resource_ssp4,
1083 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4), 1083 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
1084}; 1084};
1085#endif /* CONFIG_PXA3xx || CONFIG_PXA95x */ 1085#endif /* CONFIG_PXA3xx */
1086 1086
1087struct resource pxa_resource_gpio[] = { 1087struct resource pxa_resource_gpio[] = {
1088 { 1088 {
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index 56d92e5cad8..ccb06e48552 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -194,17 +194,6 @@
194#define __cpu_is_pxa935(id) (0) 194#define __cpu_is_pxa935(id) (0)
195#endif 195#endif
196 196
197#ifdef CONFIG_CPU_PXA955
198#define __cpu_is_pxa955(id) \
199 ({ \
200 unsigned int _id = (id) >> 4 & 0xfff; \
201 _id == 0x581 || _id == 0xc08 \
202 || _id == 0xb76; \
203 })
204#else
205#define __cpu_is_pxa955(id) (0)
206#endif
207
208#define cpu_is_pxa210() \ 197#define cpu_is_pxa210() \
209 ({ \ 198 ({ \
210 __cpu_is_pxa210(read_cpuid_id()); \ 199 __cpu_is_pxa210(read_cpuid_id()); \
@@ -255,10 +244,6 @@
255 __cpu_is_pxa935(read_cpuid_id()); \ 244 __cpu_is_pxa935(read_cpuid_id()); \
256 }) 245 })
257 246
258#define cpu_is_pxa955() \
259 ({ \
260 __cpu_is_pxa955(read_cpuid_id()); \
261 })
262 247
263 248
264/* 249/*
@@ -297,15 +282,6 @@
297#define __cpu_is_pxa93x(id) (0) 282#define __cpu_is_pxa93x(id) (0)
298#endif 283#endif
299 284
300#ifdef CONFIG_PXA95x
301#define __cpu_is_pxa95x(id) \
302 ({ \
303 __cpu_is_pxa955(id); \
304 })
305#else
306#define __cpu_is_pxa95x(id) (0)
307#endif
308
309#define cpu_is_pxa2xx() \ 285#define cpu_is_pxa2xx() \
310 ({ \ 286 ({ \
311 __cpu_is_pxa2xx(read_cpuid_id()); \ 287 __cpu_is_pxa2xx(read_cpuid_id()); \
@@ -321,10 +297,6 @@
321 __cpu_is_pxa93x(read_cpuid_id()); \ 297 __cpu_is_pxa93x(read_cpuid_id()); \
322 }) 298 })
323 299
324#define cpu_is_pxa95x() \
325 ({ \
326 __cpu_is_pxa95x(read_cpuid_id()); \
327 })
328 300
329/* 301/*
330 * return current memory and LCD clock frequency in units of 10kHz 302 * return current memory and LCD clock frequency in units of 10kHz
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 8765782dd95..48c2fd85168 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -84,7 +84,6 @@
84#define IRQ_PXA935_MMC0 PXA_IRQ(72) /* MMC0 Controller (PXA935) */ 84#define IRQ_PXA935_MMC0 PXA_IRQ(72) /* MMC0 Controller (PXA935) */
85#define IRQ_PXA935_MMC1 PXA_IRQ(73) /* MMC1 Controller (PXA935) */ 85#define IRQ_PXA935_MMC1 PXA_IRQ(73) /* MMC1 Controller (PXA935) */
86#define IRQ_PXA935_MMC2 PXA_IRQ(74) /* MMC2 Controller (PXA935) */ 86#define IRQ_PXA935_MMC2 PXA_IRQ(74) /* MMC2 Controller (PXA935) */
87#define IRQ_PXA955_MMC3 PXA_IRQ(75) /* MMC3 Controller (PXA955) */
88#define IRQ_U2P PXA_IRQ(93) /* USB PHY D+/D- Lines (PXA935) */ 87#define IRQ_U2P PXA_IRQ(93) /* USB PHY D+/D- Lines (PXA935) */
89 88
90#define PXA_GPIO_IRQ_BASE PXA_IRQ(96) 89#define PXA_GPIO_IRQ_BASE PXA_IRQ(96)
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx.h b/arch/arm/mach-pxa/include/mach/pxa3xx.h
index cd3e57f4268..6dd7fa163e2 100644
--- a/arch/arm/mach-pxa/include/mach/pxa3xx.h
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx.h
@@ -7,7 +7,6 @@
7 7
8extern void __init pxa3xx_map_io(void); 8extern void __init pxa3xx_map_io(void);
9extern void __init pxa3xx_init_irq(void); 9extern void __init pxa3xx_init_irq(void);
10extern void __init pxa95x_init_irq(void);
11 10
12#define pxa3xx_handle_irq ichp_handle_irq 11#define pxa3xx_handle_irq ichp_handle_irq
13 12
diff --git a/arch/arm/mach-pxa/include/mach/pxa95x.h b/arch/arm/mach-pxa/include/mach/pxa95x.h
deleted file mode 100644
index cbb097c4cb1..00000000000
--- a/arch/arm/mach-pxa/include/mach/pxa95x.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __MACH_PXA95X_H
2#define __MACH_PXA95X_H
3
4#include <mach/pxa3xx.h>
5#include <mach/mfp-pxa930.h>
6
7#endif /* __MACH_PXA95X_H */
diff --git a/arch/arm/mach-pxa/include/mach/udc.h b/arch/arm/mach-pxa/include/mach/udc.h
index 2f82332e81a..9a827e32db9 100644
--- a/arch/arm/mach-pxa/include/mach/udc.h
+++ b/arch/arm/mach-pxa/include/mach/udc.h
@@ -2,7 +2,7 @@
2 * arch/arm/mach-pxa/include/mach/udc.h 2 * arch/arm/mach-pxa/include/mach/udc.h
3 * 3 *
4 */ 4 */
5#include <asm/mach/udc_pxa2xx.h> 5#include <linux/platform_data/pxa2xx_udc.h>
6 6
7extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); 7extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
8 8
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 113c57a0356..fb7f1d1627d 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -26,6 +26,7 @@
26#include <linux/i2c/pxa-i2c.h> 26#include <linux/i2c/pxa-i2c.h>
27#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
28 28
29#include <media/mt9v022.h>
29#include <media/soc_camera.h> 30#include <media/soc_camera.h>
30 31
31#include <linux/platform_data/camera-pxa.h> 32#include <linux/platform_data/camera-pxa.h>
@@ -468,6 +469,10 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
468 }, 469 },
469}; 470};
470 471
472static struct mt9v022_platform_data mt9v022_pdata = {
473 .y_skip_top = 1,
474};
475
471static struct i2c_board_info pcm990_camera_i2c[] = { 476static struct i2c_board_info pcm990_camera_i2c[] = {
472 { 477 {
473 I2C_BOARD_INFO("mt9v022", 0x48), 478 I2C_BOARD_INFO("mt9v022", 0x48),
@@ -480,6 +485,7 @@ static struct soc_camera_link iclink[] = {
480 { 485 {
481 .bus_id = 0, /* Must match with the camera ID */ 486 .bus_id = 0, /* Must match with the camera ID */
482 .board_info = &pcm990_camera_i2c[0], 487 .board_info = &pcm990_camera_i2c[0],
488 .priv = &mt9v022_pdata,
483 .i2c_adapter_id = 0, 489 .i2c_adapter_id = 0,
484 .query_bus_param = pcm990_camera_query_bus_param, 490 .query_bus_param = pcm990_camera_query_bus_param,
485 .set_bus_param = pcm990_camera_set_bus_param, 491 .set_bus_param = pcm990_camera_set_bus_param,
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 3352b37b60c..3f5171eaf67 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -209,6 +209,7 @@ static struct clk_lookup pxa25x_clkregs[] = {
209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), 209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), 210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL),
211 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), 211 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL),
212 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
212}; 213};
213 214
214static struct clk_lookup pxa25x_hwuart_clkreg = 215static struct clk_lookup pxa25x_hwuart_clkreg =
@@ -338,6 +339,10 @@ void __init pxa25x_map_io(void)
338 pxa25x_get_clk_frequency_khz(1); 339 pxa25x_get_clk_frequency_khz(1);
339} 340}
340 341
342static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = {
343 .gpio_set_wake = gpio_set_wake,
344};
345
341static struct platform_device *pxa25x_devices[] __initdata = { 346static struct platform_device *pxa25x_devices[] __initdata = {
342 &pxa25x_device_udc, 347 &pxa25x_device_udc,
343 &pxa_device_pmu, 348 &pxa_device_pmu,
@@ -370,6 +375,7 @@ static int __init pxa25x_init(void)
370 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 375 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
371 register_syscore_ops(&pxa2xx_clock_syscore_ops); 376 register_syscore_ops(&pxa2xx_clock_syscore_ops);
372 377
378 pxa_register_device(&pxa_device_gpio, &pxa25x_gpio_info);
373 ret = platform_add_devices(pxa25x_devices, 379 ret = platform_add_devices(pxa25x_devices,
374 ARRAY_SIZE(pxa25x_devices)); 380 ARRAY_SIZE(pxa25x_devices));
375 if (ret) 381 if (ret)
diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index 7dbe3ccf199..e329ccefd36 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -384,18 +384,7 @@ static struct platform_driver pxa3xx_u2d_ulpi_driver = {
384 .probe = pxa3xx_u2d_probe, 384 .probe = pxa3xx_u2d_probe,
385 .remove = pxa3xx_u2d_remove, 385 .remove = pxa3xx_u2d_remove,
386}; 386};
387 387module_platform_driver(pxa3xx_u2d_ulpi_driver);
388static int pxa3xx_u2d_ulpi_init(void)
389{
390 return platform_driver_register(&pxa3xx_u2d_ulpi_driver);
391}
392module_init(pxa3xx_u2d_ulpi_init);
393
394static void __exit pxa3xx_u2d_ulpi_exit(void)
395{
396 platform_driver_unregister(&pxa3xx_u2d_ulpi_driver);
397}
398module_exit(pxa3xx_u2d_ulpi_exit);
399 388
400MODULE_DESCRIPTION("PXA3xx U2D ULPI driver"); 389MODULE_DESCRIPTION("PXA3xx U2D ULPI driver");
401MODULE_AUTHOR("Igor Grinberg"); 390MODULE_AUTHOR("Igor Grinberg");
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c
deleted file mode 100644
index 47601f80e6e..00000000000
--- a/arch/arm/mach-pxa/pxa95x.c
+++ /dev/null
@@ -1,295 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa95x.c
3 *
4 * code specific to PXA95x aka MGx
5 *
6 * Copyright (C) 2009-2010 Marvell International Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/pm.h>
16#include <linux/platform_device.h>
17#include <linux/i2c/pxa-i2c.h>
18#include <linux/irq.h>
19#include <linux/io.h>
20#include <linux/syscore_ops.h>
21
22#include <mach/hardware.h>
23#include <mach/pxa3xx-regs.h>
24#include <mach/pxa930.h>
25#include <mach/reset.h>
26#include <mach/pm.h>
27#include <mach/dma.h>
28
29#include "generic.h"
30#include "devices.h"
31#include "clock.h"
32
33static struct mfp_addr_map pxa95x_mfp_addr_map[] __initdata = {
34
35 MFP_ADDR(GPIO0, 0x02e0),
36 MFP_ADDR(GPIO1, 0x02dc),
37 MFP_ADDR(GPIO2, 0x02e8),
38 MFP_ADDR(GPIO3, 0x02d8),
39 MFP_ADDR(GPIO4, 0x02e4),
40 MFP_ADDR(GPIO5, 0x02ec),
41 MFP_ADDR(GPIO6, 0x02f8),
42 MFP_ADDR(GPIO7, 0x02fc),
43 MFP_ADDR(GPIO8, 0x0300),
44 MFP_ADDR(GPIO9, 0x02d4),
45 MFP_ADDR(GPIO10, 0x02f4),
46 MFP_ADDR(GPIO11, 0x02f0),
47 MFP_ADDR(GPIO12, 0x0304),
48 MFP_ADDR(GPIO13, 0x0310),
49 MFP_ADDR(GPIO14, 0x0308),
50 MFP_ADDR(GPIO15, 0x030c),
51 MFP_ADDR(GPIO16, 0x04e8),
52 MFP_ADDR(GPIO17, 0x04f4),
53 MFP_ADDR(GPIO18, 0x04f8),
54 MFP_ADDR(GPIO19, 0x04fc),
55 MFP_ADDR(GPIO20, 0x0518),
56 MFP_ADDR(GPIO21, 0x051c),
57 MFP_ADDR(GPIO22, 0x04ec),
58 MFP_ADDR(GPIO23, 0x0500),
59 MFP_ADDR(GPIO24, 0x04f0),
60 MFP_ADDR(GPIO25, 0x0504),
61 MFP_ADDR(GPIO26, 0x0510),
62 MFP_ADDR(GPIO27, 0x0514),
63 MFP_ADDR(GPIO28, 0x0520),
64 MFP_ADDR(GPIO29, 0x0600),
65 MFP_ADDR(GPIO30, 0x0618),
66 MFP_ADDR(GPIO31, 0x0610),
67 MFP_ADDR(GPIO32, 0x060c),
68 MFP_ADDR(GPIO33, 0x061c),
69 MFP_ADDR(GPIO34, 0x0620),
70 MFP_ADDR(GPIO35, 0x0628),
71 MFP_ADDR(GPIO36, 0x062c),
72 MFP_ADDR(GPIO37, 0x0630),
73 MFP_ADDR(GPIO38, 0x0634),
74 MFP_ADDR(GPIO39, 0x0638),
75 MFP_ADDR(GPIO40, 0x063c),
76 MFP_ADDR(GPIO41, 0x0614),
77 MFP_ADDR(GPIO42, 0x0624),
78 MFP_ADDR(GPIO43, 0x0608),
79 MFP_ADDR(GPIO44, 0x0604),
80 MFP_ADDR(GPIO45, 0x050c),
81 MFP_ADDR(GPIO46, 0x0508),
82 MFP_ADDR(GPIO47, 0x02bc),
83 MFP_ADDR(GPIO48, 0x02b4),
84 MFP_ADDR(GPIO49, 0x02b8),
85 MFP_ADDR(GPIO50, 0x02c8),
86 MFP_ADDR(GPIO51, 0x02c0),
87 MFP_ADDR(GPIO52, 0x02c4),
88 MFP_ADDR(GPIO53, 0x02d0),
89 MFP_ADDR(GPIO54, 0x02cc),
90 MFP_ADDR(GPIO55, 0x029c),
91 MFP_ADDR(GPIO56, 0x02a0),
92 MFP_ADDR(GPIO57, 0x0294),
93 MFP_ADDR(GPIO58, 0x0298),
94 MFP_ADDR(GPIO59, 0x02a4),
95 MFP_ADDR(GPIO60, 0x02a8),
96 MFP_ADDR(GPIO61, 0x02b0),
97 MFP_ADDR(GPIO62, 0x02ac),
98 MFP_ADDR(GPIO63, 0x0640),
99 MFP_ADDR(GPIO64, 0x065c),
100 MFP_ADDR(GPIO65, 0x0648),
101 MFP_ADDR(GPIO66, 0x0644),
102 MFP_ADDR(GPIO67, 0x0674),
103 MFP_ADDR(GPIO68, 0x0658),
104 MFP_ADDR(GPIO69, 0x0654),
105 MFP_ADDR(GPIO70, 0x0660),
106 MFP_ADDR(GPIO71, 0x0668),
107 MFP_ADDR(GPIO72, 0x0664),
108 MFP_ADDR(GPIO73, 0x0650),
109 MFP_ADDR(GPIO74, 0x066c),
110 MFP_ADDR(GPIO75, 0x064c),
111 MFP_ADDR(GPIO76, 0x0670),
112 MFP_ADDR(GPIO77, 0x0678),
113 MFP_ADDR(GPIO78, 0x067c),
114 MFP_ADDR(GPIO79, 0x0694),
115 MFP_ADDR(GPIO80, 0x069c),
116 MFP_ADDR(GPIO81, 0x06a0),
117 MFP_ADDR(GPIO82, 0x06a4),
118 MFP_ADDR(GPIO83, 0x0698),
119 MFP_ADDR(GPIO84, 0x06bc),
120 MFP_ADDR(GPIO85, 0x06b4),
121 MFP_ADDR(GPIO86, 0x06b0),
122 MFP_ADDR(GPIO87, 0x06c0),
123 MFP_ADDR(GPIO88, 0x06c4),
124 MFP_ADDR(GPIO89, 0x06ac),
125 MFP_ADDR(GPIO90, 0x0680),
126 MFP_ADDR(GPIO91, 0x0684),
127 MFP_ADDR(GPIO92, 0x0688),
128 MFP_ADDR(GPIO93, 0x0690),
129 MFP_ADDR(GPIO94, 0x068c),
130 MFP_ADDR(GPIO95, 0x06a8),
131 MFP_ADDR(GPIO96, 0x06b8),
132 MFP_ADDR(GPIO97, 0x0410),
133 MFP_ADDR(GPIO98, 0x0418),
134 MFP_ADDR(GPIO99, 0x041c),
135 MFP_ADDR(GPIO100, 0x0414),
136 MFP_ADDR(GPIO101, 0x0408),
137 MFP_ADDR(GPIO102, 0x0324),
138 MFP_ADDR(GPIO103, 0x040c),
139 MFP_ADDR(GPIO104, 0x0400),
140 MFP_ADDR(GPIO105, 0x0328),
141 MFP_ADDR(GPIO106, 0x0404),
142
143 MFP_ADDR(GPIO159, 0x0524),
144 MFP_ADDR(GPIO163, 0x0534),
145 MFP_ADDR(GPIO167, 0x0544),
146 MFP_ADDR(GPIO168, 0x0548),
147 MFP_ADDR(GPIO169, 0x054c),
148 MFP_ADDR(GPIO170, 0x0550),
149 MFP_ADDR(GPIO171, 0x0554),
150 MFP_ADDR(GPIO172, 0x0558),
151 MFP_ADDR(GPIO173, 0x055c),
152
153 MFP_ADDR(nXCVREN, 0x0204),
154 MFP_ADDR(DF_CLE_nOE, 0x020c),
155 MFP_ADDR(DF_nADV1_ALE, 0x0218),
156 MFP_ADDR(DF_SCLK_E, 0x0214),
157 MFP_ADDR(DF_SCLK_S, 0x0210),
158 MFP_ADDR(nBE0, 0x021c),
159 MFP_ADDR(nBE1, 0x0220),
160 MFP_ADDR(DF_nADV2_ALE, 0x0224),
161 MFP_ADDR(DF_INT_RnB, 0x0228),
162 MFP_ADDR(DF_nCS0, 0x022c),
163 MFP_ADDR(DF_nCS1, 0x0230),
164 MFP_ADDR(nLUA, 0x0254),
165 MFP_ADDR(nLLA, 0x0258),
166 MFP_ADDR(DF_nWE, 0x0234),
167 MFP_ADDR(DF_nRE_nOE, 0x0238),
168 MFP_ADDR(DF_ADDR0, 0x024c),
169 MFP_ADDR(DF_ADDR1, 0x0250),
170 MFP_ADDR(DF_ADDR2, 0x025c),
171 MFP_ADDR(DF_ADDR3, 0x0260),
172 MFP_ADDR(DF_IO0, 0x023c),
173 MFP_ADDR(DF_IO1, 0x0240),
174 MFP_ADDR(DF_IO2, 0x0244),
175 MFP_ADDR(DF_IO3, 0x0248),
176 MFP_ADDR(DF_IO4, 0x0264),
177 MFP_ADDR(DF_IO5, 0x0268),
178 MFP_ADDR(DF_IO6, 0x026c),
179 MFP_ADDR(DF_IO7, 0x0270),
180 MFP_ADDR(DF_IO8, 0x0274),
181 MFP_ADDR(DF_IO9, 0x0278),
182 MFP_ADDR(DF_IO10, 0x027c),
183 MFP_ADDR(DF_IO11, 0x0280),
184 MFP_ADDR(DF_IO12, 0x0284),
185 MFP_ADDR(DF_IO13, 0x0288),
186 MFP_ADDR(DF_IO14, 0x028c),
187 MFP_ADDR(DF_IO15, 0x0290),
188
189 MFP_ADDR(GSIM_UIO, 0x0314),
190 MFP_ADDR(GSIM_UCLK, 0x0318),
191 MFP_ADDR(GSIM_UDET, 0x031c),
192 MFP_ADDR(GSIM_nURST, 0x0320),
193
194 MFP_ADDR(PMIC_INT, 0x06c8),
195
196 MFP_ADDR(RDY, 0x0200),
197
198 MFP_ADDR_END,
199};
200
201static DEFINE_CK(pxa95x_lcd, LCD, &clk_pxa3xx_hsio_ops);
202static DEFINE_CLK(pxa95x_pout, &clk_pxa3xx_pout_ops, 13000000, 70);
203static DEFINE_PXA3_CKEN(pxa95x_ffuart, FFUART, 14857000, 1);
204static DEFINE_PXA3_CKEN(pxa95x_btuart, BTUART, 14857000, 1);
205static DEFINE_PXA3_CKEN(pxa95x_stuart, STUART, 14857000, 1);
206static DEFINE_PXA3_CKEN(pxa95x_i2c, I2C, 32842000, 0);
207static DEFINE_PXA3_CKEN(pxa95x_keypad, KEYPAD, 32768, 0);
208static DEFINE_PXA3_CKEN(pxa95x_ssp1, SSP1, 13000000, 0);
209static DEFINE_PXA3_CKEN(pxa95x_ssp2, SSP2, 13000000, 0);
210static DEFINE_PXA3_CKEN(pxa95x_ssp3, SSP3, 13000000, 0);
211static DEFINE_PXA3_CKEN(pxa95x_ssp4, SSP4, 13000000, 0);
212static DEFINE_PXA3_CKEN(pxa95x_pwm0, PWM0, 13000000, 0);
213static DEFINE_PXA3_CKEN(pxa95x_pwm1, PWM1, 13000000, 0);
214static DEFINE_PXA3_CKEN(pxa95x_gpio, GPIO, 13000000, 0);
215
216static struct clk_lookup pxa95x_clkregs[] = {
217 INIT_CLKREG(&clk_pxa95x_pout, NULL, "CLK_POUT"),
218 /* Power I2C clock is always on */
219 INIT_CLKREG(&clk_dummy, "pxa3xx-pwri2c.1", NULL),
220 INIT_CLKREG(&clk_pxa95x_lcd, "pxa2xx-fb", NULL),
221 INIT_CLKREG(&clk_pxa95x_ffuart, "pxa2xx-uart.0", NULL),
222 INIT_CLKREG(&clk_pxa95x_btuart, "pxa2xx-uart.1", NULL),
223 INIT_CLKREG(&clk_pxa95x_stuart, "pxa2xx-uart.2", NULL),
224 INIT_CLKREG(&clk_pxa95x_stuart, "pxa2xx-ir", "UARTCLK"),
225 INIT_CLKREG(&clk_pxa95x_i2c, "pxa2xx-i2c.0", NULL),
226 INIT_CLKREG(&clk_pxa95x_keypad, "pxa27x-keypad", NULL),
227 INIT_CLKREG(&clk_pxa95x_ssp1, "pxa27x-ssp.0", NULL),
228 INIT_CLKREG(&clk_pxa95x_ssp2, "pxa27x-ssp.1", NULL),
229 INIT_CLKREG(&clk_pxa95x_ssp3, "pxa27x-ssp.2", NULL),
230 INIT_CLKREG(&clk_pxa95x_ssp4, "pxa27x-ssp.3", NULL),
231 INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL),
232 INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL),
233 INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL),
234 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
235};
236
237void __init pxa95x_init_irq(void)
238{
239 pxa_init_irq(96, NULL);
240}
241
242/*
243 * device registration specific to PXA93x.
244 */
245
246void __init pxa95x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
247{
248 pxa_register_device(&pxa3xx_device_i2c_power, info);
249}
250
251static struct platform_device *devices[] __initdata = {
252 &pxa_device_gpio,
253 &sa1100_device_rtc,
254 &pxa_device_rtc,
255 &pxa27x_device_ssp1,
256 &pxa27x_device_ssp2,
257 &pxa27x_device_ssp3,
258 &pxa3xx_device_ssp4,
259 &pxa27x_device_pwm0,
260 &pxa27x_device_pwm1,
261};
262
263static int __init pxa95x_init(void)
264{
265 int ret = 0, i;
266
267 if (cpu_is_pxa95x()) {
268 mfp_init_base(io_p2v(MFPR_BASE));
269 mfp_init_addr(pxa95x_mfp_addr_map);
270
271 reset_status = ARSR;
272
273 /*
274 * clear RDH bit every time after reset
275 *
276 * Note: the last 3 bits DxS are write-1-to-clear so carefully
277 * preserve them here in case they will be referenced later
278 */
279 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S);
280
281 clkdev_add_table(pxa95x_clkregs, ARRAY_SIZE(pxa95x_clkregs));
282
283 if ((ret = pxa_init_dma(IRQ_DMA, 32)))
284 return ret;
285
286 register_syscore_ops(&pxa_irq_syscore_ops);
287 register_syscore_ops(&pxa3xx_clock_syscore_ops);
288
289 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
290 }
291
292 return ret;
293}
294
295postcore_initcall(pxa95x_init);
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
deleted file mode 100644
index 5aded5e6148..00000000000
--- a/arch/arm/mach-pxa/saarb.c
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/saarb.c
3 *
4 * Support for the Marvell Handheld Platform (aka SAARB)
5 *
6 * Copyright (C) 2007-2010 Marvell International Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * publishhed by the Free Software Foundation.
11 */
12#include <linux/gpio.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/i2c.h>
16#include <linux/i2c/pxa-i2c.h>
17#include <linux/mfd/88pm860x.h>
18
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21
22#include <mach/irqs.h>
23#include <mach/hardware.h>
24#include <mach/mfp.h>
25#include <mach/mfp-pxa930.h>
26#include <mach/pxa95x.h>
27
28#include "generic.h"
29
30#define SAARB_NR_IRQS (IRQ_BOARD_START + 40)
31
32static struct pm860x_touch_pdata saarb_touch = {
33 .gpadc_prebias = 1,
34 .slot_cycle = 1,
35 .tsi_prebias = 6,
36 .pen_prebias = 16,
37 .pen_prechg = 2,
38 .res_x = 300,
39};
40
41static struct pm860x_backlight_pdata saarb_backlight[] = {
42 {
43 .id = PM8606_ID_BACKLIGHT,
44 .iset = PM8606_WLED_CURRENT(24),
45 .flags = PM8606_BACKLIGHT1,
46 },
47 {},
48};
49
50static struct pm860x_led_pdata saarb_led[] = {
51 {
52 .id = PM8606_ID_LED,
53 .iset = PM8606_LED_CURRENT(12),
54 .flags = PM8606_LED1_RED,
55 }, {
56 .id = PM8606_ID_LED,
57 .iset = PM8606_LED_CURRENT(12),
58 .flags = PM8606_LED1_GREEN,
59 }, {
60 .id = PM8606_ID_LED,
61 .iset = PM8606_LED_CURRENT(12),
62 .flags = PM8606_LED1_BLUE,
63 }, {
64 .id = PM8606_ID_LED,
65 .iset = PM8606_LED_CURRENT(12),
66 .flags = PM8606_LED2_RED,
67 }, {
68 .id = PM8606_ID_LED,
69 .iset = PM8606_LED_CURRENT(12),
70 .flags = PM8606_LED2_GREEN,
71 }, {
72 .id = PM8606_ID_LED,
73 .iset = PM8606_LED_CURRENT(12),
74 .flags = PM8606_LED2_BLUE,
75 },
76};
77
78static struct pm860x_platform_data saarb_pm8607_info = {
79 .touch = &saarb_touch,
80 .backlight = &saarb_backlight[0],
81 .led = &saarb_led[0],
82 .companion_addr = 0x10,
83 .irq_mode = 0,
84 .irq_base = IRQ_BOARD_START,
85
86 .i2c_port = GI2C_PORT,
87};
88
89static struct i2c_board_info saarb_i2c_info[] = {
90 {
91 .type = "88PM860x",
92 .addr = 0x34,
93 .platform_data = &saarb_pm8607_info,
94 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
95 },
96};
97
98static void __init saarb_init(void)
99{
100 pxa_set_ffuart_info(NULL);
101 pxa_set_i2c_info(NULL);
102 i2c_register_board_info(0, ARRAY_AND_SIZE(saarb_i2c_info));
103}
104
105MACHINE_START(SAARB, "PXA955 Handheld Platform (aka SAARB)")
106 .atag_offset = 0x100,
107 .map_io = pxa3xx_map_io,
108 .nr_irqs = SAARB_NR_IRQS,
109 .init_irq = pxa95x_init_irq,
110 .handle_irq = pxa3xx_handle_irq,
111 .timer = &pxa_timer,
112 .init_machine = saarb_init,
113 .restart = pxa_restart,
114MACHINE_END
115
diff --git a/arch/arm/mach-pxa/tavorevb3.c b/arch/arm/mach-pxa/tavorevb3.c
deleted file mode 100644
index f7d9305cfd7..00000000000
--- a/arch/arm/mach-pxa/tavorevb3.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/tavorevb3.c
3 *
4 * Support for the Marvell EVB3 Development Platform.
5 *
6 * Copyright: (C) Copyright 2008-2010 Marvell International Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * publishhed by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/interrupt.h>
17#include <linux/i2c.h>
18#include <linux/i2c/pxa-i2c.h>
19#include <linux/gpio.h>
20#include <linux/mfd/88pm860x.h>
21
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24
25#include <mach/pxa930.h>
26
27#include "devices.h"
28#include "generic.h"
29
30#define TAVOREVB3_NR_IRQS (IRQ_BOARD_START + 24)
31
32static mfp_cfg_t evb3_mfp_cfg[] __initdata = {
33 /* UART */
34 GPIO53_UART1_TXD,
35 GPIO54_UART1_RXD,
36
37 /* PMIC */
38 PMIC_INT_GPIO83,
39};
40
41#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
42static struct pm860x_touch_pdata evb3_touch = {
43 .gpadc_prebias = 1,
44 .slot_cycle = 1,
45 .tsi_prebias = 6,
46 .pen_prebias = 16,
47 .pen_prechg = 2,
48 .res_x = 300,
49};
50
51static struct pm860x_backlight_pdata evb3_backlight[] = {
52 {
53 .id = PM8606_ID_BACKLIGHT,
54 .iset = PM8606_WLED_CURRENT(24),
55 .flags = PM8606_BACKLIGHT1,
56 },
57 {},
58};
59
60static struct pm860x_led_pdata evb3_led[] = {
61 {
62 .id = PM8606_ID_LED,
63 .iset = PM8606_LED_CURRENT(12),
64 .flags = PM8606_LED1_RED,
65 }, {
66 .id = PM8606_ID_LED,
67 .iset = PM8606_LED_CURRENT(12),
68 .flags = PM8606_LED1_GREEN,
69 }, {
70 .id = PM8606_ID_LED,
71 .iset = PM8606_LED_CURRENT(12),
72 .flags = PM8606_LED1_BLUE,
73 }, {
74 .id = PM8606_ID_LED,
75 .iset = PM8606_LED_CURRENT(12),
76 .flags = PM8606_LED2_RED,
77 }, {
78 .id = PM8606_ID_LED,
79 .iset = PM8606_LED_CURRENT(12),
80 .flags = PM8606_LED2_GREEN,
81 }, {
82 .id = PM8606_ID_LED,
83 .iset = PM8606_LED_CURRENT(12),
84 .flags = PM8606_LED2_BLUE,
85 },
86};
87
88static struct pm860x_platform_data evb3_pm8607_info = {
89 .touch = &evb3_touch,
90 .backlight = &evb3_backlight[0],
91 .led = &evb3_led[0],
92 .companion_addr = 0x10,
93 .irq_mode = 0,
94 .irq_base = IRQ_BOARD_START,
95
96 .i2c_port = GI2C_PORT,
97};
98
99static struct i2c_board_info evb3_i2c_info[] = {
100 {
101 .type = "88PM860x",
102 .addr = 0x34,
103 .platform_data = &evb3_pm8607_info,
104 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
105 },
106};
107
108static void __init evb3_init_i2c(void)
109{
110 pxa_set_i2c_info(NULL);
111 i2c_register_board_info(0, ARRAY_AND_SIZE(evb3_i2c_info));
112}
113#else
114static inline void evb3_init_i2c(void) {}
115#endif
116
117static void __init evb3_init(void)
118{
119 /* initialize MFP configurations */
120 pxa3xx_mfp_config(ARRAY_AND_SIZE(evb3_mfp_cfg));
121
122 pxa_set_ffuart_info(NULL);
123
124 evb3_init_i2c();
125}
126
127MACHINE_START(TAVOREVB3, "PXA950 Evaluation Board (aka TavorEVB3)")
128 .atag_offset = 0x100,
129 .map_io = pxa3xx_map_io,
130 .nr_irqs = TAVOREVB3_NR_IRQS,
131 .init_irq = pxa3xx_init_irq,
132 .handle_irq = pxa3xx_handle_irq,
133 .timer = &pxa_timer,
134 .init_machine = evb3_init,
135 .restart = pxa_restart,
136MACHINE_END
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index d3b3cd216d6..28511d43637 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -467,6 +467,7 @@ static void __init realview_eb_init(void)
467MACHINE_START(REALVIEW_EB, "ARM-RealView EB") 467MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
468 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 468 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
469 .atag_offset = 0x100, 469 .atag_offset = 0x100,
470 .smp = smp_ops(realview_smp_ops),
470 .fixup = realview_fixup, 471 .fixup = realview_fixup,
471 .map_io = realview_eb_map_io, 472 .map_io = realview_eb_map_io,
472 .init_early = realview_init_early, 473 .init_early = realview_init_early,
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 2b6cb5f29c2..25df14a9e26 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -400,11 +400,12 @@ config MACH_MINI2440
400 bool "MINI2440 development board" 400 bool "MINI2440 development board"
401 select EEPROM_AT24 401 select EEPROM_AT24
402 select LEDS_CLASS 402 select LEDS_CLASS
403 select LEDS_TRIGGER 403 select LEDS_TRIGGERS
404 select LEDS_TRIGGER_BACKLIGHT 404 select LEDS_TRIGGER_BACKLIGHT
405 select NEW_LEDS 405 select NEW_LEDS
406 select S3C_DEV_NAND 406 select S3C_DEV_NAND
407 select S3C_DEV_USB_HOST 407 select S3C_DEV_USB_HOST
408 select S3C_SETUP_CAMIF
408 help 409 help
409 Say Y here to select support for the MINI2440. Is a 10cm x 10cm board 410 Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
410 available via various sources. It can come with a 3.5" or 7" touch LCD. 411 available via various sources. It can come with a 3.5" or 7" touch LCD.
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c
index 4407b173053..04b87ec9253 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2440.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c
@@ -161,6 +161,7 @@ static struct clk_lookup s3c2440_clk_lookup[] = {
161 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk), 161 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
162 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), 162 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
163 CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n), 163 CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n),
164 CLKDEV_INIT("s3c2440-camif", "camera", &s3c2440_clk_cam_upll),
164}; 165};
165 166
166static int __init_refok s3c2440_clk_add(struct device *dev, struct subsys_interface *sif) 167static int __init_refok s3c2440_clk_add(struct device *dev, struct subsys_interface *sif)
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2443.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c
index 7f689ce1be6..bdaba59b42d 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2443.c
@@ -158,12 +158,6 @@ static struct clk init_clocks_off[] = {
158 .devname = "s3c2410-spi.0", 158 .devname = "s3c2410-spi.0",
159 .parent = &clk_p, 159 .parent = &clk_p,
160 .enable = s3c2443_clkcon_enable_p, 160 .enable = s3c2443_clkcon_enable_p,
161 .ctrlbit = S3C2443_PCLKCON_SPI0,
162 }, {
163 .name = "spi",
164 .devname = "s3c2410-spi.1",
165 .parent = &clk_p,
166 .enable = s3c2443_clkcon_enable_p,
167 .ctrlbit = S3C2443_PCLKCON_SPI1, 161 .ctrlbit = S3C2443_PCLKCON_SPI1,
168 } 162 }
169}; 163};
diff --git a/arch/arm/mach-s3c24xx/include/mach/bast-map.h b/arch/arm/mach-s3c24xx/include/mach/bast-map.h
index 6e7dc9d0cf0..eecea2a50f8 100644
--- a/arch/arm/mach-s3c24xx/include/mach/bast-map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/bast-map.h
@@ -74,7 +74,7 @@
74 74
75 75
76/* 0xE0000000 contains the IO space that is split by speed and 76/* 0xE0000000 contains the IO space that is split by speed and
77 * wether the access is for 8 or 16bit IO... this ensures that 77 * whether the access is for 8 or 16bit IO... this ensures that
78 * the correct access is made 78 * the correct access is made
79 * 79 *
80 * 0x10000000 of space, partitioned as so: 80 * 0x10000000 of space, partitioned as so:
diff --git a/arch/arm/mach-s3c24xx/include/mach/dma.h b/arch/arm/mach-s3c24xx/include/mach/dma.h
index ee99fd56c04..6b72d5a4b37 100644
--- a/arch/arm/mach-s3c24xx/include/mach/dma.h
+++ b/arch/arm/mach-s3c24xx/include/mach/dma.h
@@ -88,7 +88,7 @@ enum s3c2410_dma_state {
88 * 88 *
89 * This represents the state of the DMA engine, wrt to the loaded / running 89 * This represents the state of the DMA engine, wrt to the loaded / running
90 * transfers. Since we don't have any way of knowing exactly the state of 90 * transfers. Since we don't have any way of knowing exactly the state of
91 * the DMA transfers, we need to know the state to make decisions on wether 91 * the DMA transfers, we need to know the state to make decisions on whether
92 * we can 92 * we can
93 * 93 *
94 * S3C2410_DMA_NONE 94 * S3C2410_DMA_NONE
diff --git a/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h
index 99612fcc4eb..28376e56dd3 100644
--- a/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h
+++ b/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h
@@ -51,7 +51,7 @@
51#define VR1000_VA_PC104_IRQMASK VR1000_IOADDR(0x00600000) 51#define VR1000_VA_PC104_IRQMASK VR1000_IOADDR(0x00600000)
52 52
53/* 0xE0000000 contains the IO space that is split by speed and 53/* 0xE0000000 contains the IO space that is split by speed and
54 * wether the access is for 8 or 16bit IO... this ensures that 54 * whether the access is for 8 or 16bit IO... this ensures that
55 * the correct access is made 55 * the correct access is made
56 * 56 *
57 * 0x10000000 of space, partitioned as so: 57 * 0x10000000 of space, partitioned as so:
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 4a963467b7e..973b87ca87f 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -521,7 +521,6 @@ static struct platform_device *gta02_devices[] __initdata = {
521 &gta02_nor_flash, 521 &gta02_nor_flash,
522 &s3c24xx_pwm_device, 522 &s3c24xx_pwm_device,
523 &s3c_device_iis, 523 &s3c_device_iis,
524 &samsung_asoc_dma,
525 &s3c_device_i2c0, 524 &s3c_device_i2c0,
526 &gta02_dfbmcs320_device, 525 &gta02_dfbmcs320_device,
527 &gta02_buttons_device, 526 &gta02_buttons_device,
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 63aaf076f61..b23dd1b106e 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -632,7 +632,6 @@ static struct platform_device *h1940_devices[] __initdata = {
632 &s3c_device_wdt, 632 &s3c_device_wdt,
633 &s3c_device_i2c0, 633 &s3c_device_i2c0,
634 &s3c_device_iis, 634 &s3c_device_iis,
635 &samsung_asoc_dma,
636 &s3c_device_usbgadget, 635 &s3c_device_usbgadget,
637 &h1940_device_leds, 636 &h1940_device_leds,
638 &h1940_device_bluetooth, 637 &h1940_device_bluetooth,
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 393c0f1ac11..a31d5b83e5f 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -519,7 +519,6 @@ static struct platform_device *mini2440_devices[] __initdata = {
519 &s3c_device_iis, 519 &s3c_device_iis,
520 &uda1340_codec, 520 &uda1340_codec,
521 &mini2440_audio, 521 &mini2440_audio,
522 &samsung_asoc_dma,
523}; 522};
524 523
525static void __init mini2440_map_io(void) 524static void __init mini2440_map_io(void)
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 379fde521d3..0606f2faaa5 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -712,7 +712,6 @@ static struct platform_device *rx1950_devices[] __initdata = {
712 &s3c_device_wdt, 712 &s3c_device_wdt,
713 &s3c_device_i2c0, 713 &s3c_device_i2c0,
714 &s3c_device_iis, 714 &s3c_device_iis,
715 &samsung_asoc_dma,
716 &s3c_device_usbgadget, 715 &s3c_device_usbgadget,
717 &s3c_device_rtc, 716 &s3c_device_rtc,
718 &s3c_device_nand, 717 &s3c_device_nand,
diff --git a/arch/arm/mach-s3c24xx/pm.c b/arch/arm/mach-s3c24xx/pm.c
index 60627e63a25..724755f0b0f 100644
--- a/arch/arm/mach-s3c24xx/pm.c
+++ b/arch/arm/mach-s3c24xx/pm.c
@@ -121,7 +121,7 @@ void s3c_pm_configure_extint(void)
121 int pin; 121 int pin;
122 122
123 /* for each of the external interrupts (EINT0..EINT15) we 123 /* for each of the external interrupts (EINT0..EINT15) we
124 * need to check wether it is an external interrupt source, 124 * need to check whether it is an external interrupt source,
125 * and then configure it as an input if it is not 125 * and then configure it as an input if it is not
126 */ 126 */
127 127
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 63e7ae3ee9e..131c8628471 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -294,6 +294,7 @@ config MACH_WLF_CRAGG_6410
294 select S3C64XX_SETUP_SDHCI 294 select S3C64XX_SETUP_SDHCI
295 select S3C64XX_SETUP_SPI 295 select S3C64XX_SETUP_SPI
296 select S3C64XX_SETUP_USB_PHY 296 select S3C64XX_SETUP_USB_PHY
297 select S3C_DEV_FB
297 select S3C_DEV_HSMMC 298 select S3C_DEV_HSMMC
298 select S3C_DEV_HSMMC1 299 select S3C_DEV_HSMMC1
299 select S3C_DEV_HSMMC2 300 select S3C_DEV_HSMMC2
@@ -304,6 +305,7 @@ config MACH_WLF_CRAGG_6410
304 select S3C_DEV_WDT 305 select S3C_DEV_WDT
305 select SAMSUNG_DEV_ADC 306 select SAMSUNG_DEV_ADC
306 select SAMSUNG_DEV_KEYPAD 307 select SAMSUNG_DEV_KEYPAD
308 select SAMSUNG_DEV_PWM
307 select SAMSUNG_GPIO_EXTRA128 309 select SAMSUNG_GPIO_EXTRA128
308 help 310 help
309 Machine support for the Wolfson Cragganmore S3C6410 variant. 311 Machine support for the Wolfson Cragganmore S3C6410 variant.
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
index 28041e83dc8..1a6f8577744 100644
--- a/arch/arm/mach-s3c64xx/clock.c
+++ b/arch/arm/mach-s3c64xx/clock.c
@@ -138,11 +138,7 @@ static struct clk init_clocks_off[] = {
138 .ctrlbit = S3C_CLKCON_PCLK_TSADC, 138 .ctrlbit = S3C_CLKCON_PCLK_TSADC,
139 }, { 139 }, {
140 .name = "i2c", 140 .name = "i2c",
141#ifdef CONFIG_S3C_DEV_I2C1
142 .devname = "s3c2440-i2c.0", 141 .devname = "s3c2440-i2c.0",
143#else
144 .devname = "s3c2440-i2c",
145#endif
146 .parent = &clk_p, 142 .parent = &clk_p,
147 .enable = s3c64xx_pclk_ctrl, 143 .enable = s3c64xx_pclk_ctrl,
148 .ctrlbit = S3C_CLKCON_PCLK_IIC, 144 .ctrlbit = S3C_CLKCON_PCLK_IIC,
@@ -319,10 +315,6 @@ static struct clk init_clocks_off[] = {
319 .enable = s3c64xx_sclk_ctrl, 315 .enable = s3c64xx_sclk_ctrl,
320 .ctrlbit = S3C_CLKCON_SCLK_MFC, 316 .ctrlbit = S3C_CLKCON_SCLK_MFC,
321 }, { 317 }, {
322 .name = "cam",
323 .enable = s3c64xx_sclk_ctrl,
324 .ctrlbit = S3C_CLKCON_SCLK_CAM,
325 }, {
326 .name = "sclk_jpeg", 318 .name = "sclk_jpeg",
327 .enable = s3c64xx_sclk_ctrl, 319 .enable = s3c64xx_sclk_ctrl,
328 .ctrlbit = S3C_CLKCON_SCLK_JPEG, 320 .ctrlbit = S3C_CLKCON_SCLK_JPEG,
@@ -681,15 +673,6 @@ static struct clksrc_sources clkset_audio2 = {
681 .nr_sources = ARRAY_SIZE(clkset_audio2_list), 673 .nr_sources = ARRAY_SIZE(clkset_audio2_list),
682}; 674};
683 675
684static struct clk *clkset_camif_list[] = {
685 &clk_h2,
686};
687
688static struct clksrc_sources clkset_camif = {
689 .sources = clkset_camif_list,
690 .nr_sources = ARRAY_SIZE(clkset_camif_list),
691};
692
693static struct clksrc_clk clksrcs[] = { 676static struct clksrc_clk clksrcs[] = {
694 { 677 {
695 .clk = { 678 .clk = {
@@ -744,10 +727,9 @@ static struct clksrc_clk clksrcs[] = {
744 .name = "camera", 727 .name = "camera",
745 .ctrlbit = S3C_CLKCON_SCLK_CAM, 728 .ctrlbit = S3C_CLKCON_SCLK_CAM,
746 .enable = s3c64xx_sclk_ctrl, 729 .enable = s3c64xx_sclk_ctrl,
730 .parent = &clk_h2,
747 }, 731 },
748 .reg_div = { .reg = S3C_CLK_DIV0, .shift = 20, .size = 4 }, 732 .reg_div = { .reg = S3C_CLK_DIV0, .shift = 20, .size = 4 },
749 .reg_src = { .reg = NULL, .shift = 0, .size = 0 },
750 .sources = &clkset_camif,
751 }, 733 },
752}; 734};
753 735
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index be746e33e86..aef303b8997 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -155,7 +155,6 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
155 /* initialise the io descriptors we need for initialisation */ 155 /* initialise the io descriptors we need for initialisation */
156 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc)); 156 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
157 iotable_init(mach_desc, size); 157 iotable_init(mach_desc, size);
158 init_consistent_dma_size(SZ_8M);
159 158
160 /* detect cpu id */ 159 /* detect cpu id */
161 s3c64xx_init_cpu(); 160 s3c64xx_init_cpu();
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index 4e3fe57674c..c6d8dba9062 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -20,6 +20,8 @@
20 20
21#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22 22
23#include <sound/wm0010.h>
24#include <sound/wm2200.h>
23#include <sound/wm5100.h> 25#include <sound/wm5100.h>
24#include <sound/wm8996.h> 26#include <sound/wm8996.h>
25#include <sound/wm8962.h> 27#include <sound/wm8962.h>
@@ -33,14 +35,34 @@ static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
33 .line = S3C64XX_GPC(3), 35 .line = S3C64XX_GPC(3),
34}; 36};
35 37
38static struct wm0010_pdata wm0010_pdata = {
39 .gpio_reset = S3C64XX_GPN(6),
40 .reset_active_high = 1, /* Active high for Glenfarclas Rev 2 */
41};
42
36static struct spi_board_info wm1253_devs[] = { 43static struct spi_board_info wm1253_devs[] = {
37 [0] = { 44 [0] = {
38 .modalias = "wm0010", 45 .modalias = "wm0010",
46 .max_speed_hz = 26 * 1000 * 1000,
39 .bus_num = 0, 47 .bus_num = 0,
40 .chip_select = 0, 48 .chip_select = 0,
41 .mode = SPI_MODE_0, 49 .mode = SPI_MODE_0,
42 .irq = S3C_EINT(5), 50 .irq = S3C_EINT(5),
43 .controller_data = &wm0010_spi_csinfo, 51 .controller_data = &wm0010_spi_csinfo,
52 .platform_data = &wm0010_pdata,
53 },
54};
55
56static struct spi_board_info balblair_devs[] = {
57 [0] = {
58 .modalias = "wm0010",
59 .max_speed_hz = 26 * 1000 * 1000,
60 .bus_num = 0,
61 .chip_select = 0,
62 .mode = SPI_MODE_0,
63 .irq = S3C_EINT(4),
64 .controller_data = &wm0010_spi_csinfo,
65 .platform_data = &wm0010_pdata,
44 }, 66 },
45}; 67};
46 68
@@ -166,12 +188,13 @@ static struct regulator_init_data wm8994_ldo2 = {
166 188
167static struct wm8994_pdata wm8994_pdata = { 189static struct wm8994_pdata wm8994_pdata = {
168 .gpio_base = CODEC_GPIO_BASE, 190 .gpio_base = CODEC_GPIO_BASE,
191 .micb2_delay = 150,
169 .gpio_defaults = { 192 .gpio_defaults = {
170 0x3, /* IRQ out, active high, CMOS */ 193 0x3, /* IRQ out, active high, CMOS */
171 }, 194 },
172 .ldo = { 195 .ldo = {
173 { .init_data = &wm8994_ldo1, }, 196 { .enable = S3C64XX_GPN(6), .init_data = &wm8994_ldo1, },
174 { .init_data = &wm8994_ldo2, }, 197 { .enable = S3C64XX_GPN(4), .init_data = &wm8994_ldo2, },
175 }, 198 },
176}; 199};
177 200
@@ -182,7 +205,7 @@ static const struct i2c_board_info wm1277_devs[] = {
182 }, 205 },
183}; 206};
184 207
185static struct arizona_pdata wm5102_pdata = { 208static struct arizona_pdata wm5102_reva_pdata = {
186 .ldoena = S3C64XX_GPN(7), 209 .ldoena = S3C64XX_GPN(7),
187 .gpio_base = CODEC_GPIO_BASE, 210 .gpio_base = CODEC_GPIO_BASE,
188 .irq_active_high = true, 211 .irq_active_high = true,
@@ -193,64 +216,131 @@ static struct arizona_pdata wm5102_pdata = {
193 }, 216 },
194}; 217};
195 218
196static struct s3c64xx_spi_csinfo wm5102_spi_csinfo = { 219static struct s3c64xx_spi_csinfo codec_spi_csinfo = {
197 .line = S3C64XX_GPN(5), 220 .line = S3C64XX_GPN(5),
198}; 221};
199 222
223static struct spi_board_info wm5102_reva_spi_devs[] = {
224 [0] = {
225 .modalias = "wm5102",
226 .max_speed_hz = 10 * 1000 * 1000,
227 .bus_num = 0,
228 .chip_select = 1,
229 .mode = SPI_MODE_0,
230 .irq = GLENFARCLAS_PMIC_IRQ_BASE +
231 WM831X_IRQ_GPIO_2,
232 .controller_data = &codec_spi_csinfo,
233 .platform_data = &wm5102_reva_pdata,
234 },
235};
236
237static struct arizona_pdata wm5102_pdata = {
238 .ldoena = S3C64XX_GPN(7),
239 .gpio_base = CODEC_GPIO_BASE,
240 .irq_active_high = true,
241 .micd_pol_gpio = CODEC_GPIO_BASE + 2,
242 .gpio_defaults = {
243 [2] = 0x10000, /* AIF3TXLRCLK */
244 [3] = 0x4, /* OPCLK */
245 },
246};
247
200static struct spi_board_info wm5102_spi_devs[] = { 248static struct spi_board_info wm5102_spi_devs[] = {
201 [0] = { 249 [0] = {
202 .modalias = "wm5102", 250 .modalias = "wm5102",
203 .max_speed_hz = 10 * 1000 * 1000, 251 .max_speed_hz = 10 * 1000 * 1000,
204 .bus_num = 0, 252 .bus_num = 0,
205 .chip_select = 0, 253 .chip_select = 1,
206 .mode = SPI_MODE_0, 254 .mode = SPI_MODE_0,
207 .irq = GLENFARCLAS_PMIC_IRQ_BASE + 255 .irq = GLENFARCLAS_PMIC_IRQ_BASE +
208 WM831X_IRQ_GPIO_2, 256 WM831X_IRQ_GPIO_2,
209 .controller_data = &wm5102_spi_csinfo, 257 .controller_data = &codec_spi_csinfo,
210 .platform_data = &wm5102_pdata, 258 .platform_data = &wm5102_pdata,
211 }, 259 },
212}; 260};
213 261
262static struct spi_board_info wm5110_spi_devs[] = {
263 [0] = {
264 .modalias = "wm5110",
265 .max_speed_hz = 10 * 1000 * 1000,
266 .bus_num = 0,
267 .chip_select = 1,
268 .mode = SPI_MODE_0,
269 .irq = GLENFARCLAS_PMIC_IRQ_BASE +
270 WM831X_IRQ_GPIO_2,
271 .controller_data = &codec_spi_csinfo,
272 .platform_data = &wm5102_reva_pdata,
273 },
274};
275
214static const struct i2c_board_info wm6230_i2c_devs[] = { 276static const struct i2c_board_info wm6230_i2c_devs[] = {
215 { I2C_BOARD_INFO("wm9081", 0x6c), 277 { I2C_BOARD_INFO("wm9081", 0x6c),
216 .platform_data = &wm9081_pdata, }, 278 .platform_data = &wm9081_pdata, },
217}; 279};
218 280
281static struct wm2200_pdata wm2200_pdata = {
282 .ldo_ena = S3C64XX_GPN(7),
283 .gpio_defaults = {
284 [2] = 0x0005, /* GPIO3 24.576MHz output clock */
285 },
286};
287
288static const struct i2c_board_info wm2200_i2c[] = {
289 { I2C_BOARD_INFO("wm2200", 0x3a),
290 .platform_data = &wm2200_pdata, },
291};
292
219static __devinitdata const struct { 293static __devinitdata const struct {
220 u8 id; 294 u8 id;
295 u8 rev;
221 const char *name; 296 const char *name;
222 const struct i2c_board_info *i2c_devs; 297 const struct i2c_board_info *i2c_devs;
223 int num_i2c_devs; 298 int num_i2c_devs;
224 const struct spi_board_info *spi_devs; 299 const struct spi_board_info *spi_devs;
225 int num_spi_devs; 300 int num_spi_devs;
226} gf_mods[] = { 301} gf_mods[] = {
227 { .id = 0x01, .name = "1250-EV1 Springbank" }, 302 { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" },
228 { .id = 0x02, .name = "1251-EV1 Jura" }, 303 { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" },
229 { .id = 0x03, .name = "1252-EV1 Glenlivet" }, 304 { .id = 0x03, .rev = 0xff, .name = "1252-EV1 Glenlivet" },
230 { .id = 0x11, .name = "6249-EV2 Glenfarclas", }, 305 { .id = 0x06, .rev = 0xff, .name = "WM8997-6721-CS96-EV1 Lapraoig" },
231 { .id = 0x14, .name = "6271-EV1 Lochnagar" }, 306 { .id = 0x07, .rev = 0xff, .name = "WM5110-6271 Deanston",
232 { .id = 0x15, .name = "6320-EV1 Bells", 307 .spi_devs = wm5110_spi_devs,
308 .num_spi_devs = ARRAY_SIZE(wm5110_spi_devs) },
309 { .id = 0x08, .rev = 0xff, .name = "WM8903-6102 Tamdhu" },
310 { .id = 0x09, .rev = 0xff, .name = "WM1811A-6305 Adelphi" },
311 { .id = 0x0a, .rev = 0xff, .name = "WM8996-6272 Blackadder" },
312 { .id = 0x0b, .rev = 0xff, .name = "WM8994-6235 Benromach" },
313 { .id = 0x11, .rev = 0xff, .name = "6249-EV2 Glenfarclas", },
314 { .id = 0x14, .rev = 0xff, .name = "6271-EV1 Lochnagar" },
315 { .id = 0x15, .rev = 0xff, .name = "6320-EV1 Bells",
233 .i2c_devs = wm6230_i2c_devs, 316 .i2c_devs = wm6230_i2c_devs,
234 .num_i2c_devs = ARRAY_SIZE(wm6230_i2c_devs) }, 317 .num_i2c_devs = ARRAY_SIZE(wm6230_i2c_devs) },
235 { .id = 0x21, .name = "1275-EV1 Mortlach" }, 318 { .id = 0x21, .rev = 0xff, .name = "1275-EV1 Mortlach" },
236 { .id = 0x25, .name = "1274-EV1 Glencadam" }, 319 { .id = 0x25, .rev = 0xff, .name = "1274-EV1 Glencadam" },
237 { .id = 0x31, .name = "1253-EV1 Tomatin", 320 { .id = 0x31, .rev = 0xff, .name = "1253-EV1 Tomatin",
238 .spi_devs = wm1253_devs, .num_spi_devs = ARRAY_SIZE(wm1253_devs) }, 321 .spi_devs = wm1253_devs, .num_spi_devs = ARRAY_SIZE(wm1253_devs) },
239 { .id = 0x32, .name = "XXXX-EV1 Caol Illa" }, 322 { .id = 0x32, .rev = 0xff, .name = "XXXX-EV1 Caol Illa" },
240 { .id = 0x33, .name = "XXXX-EV1 Oban" }, 323 { .id = 0x33, .rev = 0xff, .name = "XXXX-EV1 Oban" },
241 { .id = 0x34, .name = "WM0010-6320-CS42 Balblair" }, 324 { .id = 0x34, .rev = 0xff, .name = "WM0010-6320-CS42 Balblair",
242 { .id = 0x39, .name = "1254-EV1 Dallas Dhu", 325 .spi_devs = balblair_devs,
326 .num_spi_devs = ARRAY_SIZE(balblair_devs) },
327 { .id = 0x39, .rev = 0xff, .name = "1254-EV1 Dallas Dhu",
243 .i2c_devs = wm1254_devs, .num_i2c_devs = ARRAY_SIZE(wm1254_devs) }, 328 .i2c_devs = wm1254_devs, .num_i2c_devs = ARRAY_SIZE(wm1254_devs) },
244 { .id = 0x3a, .name = "1259-EV1 Tobermory", 329 { .id = 0x3a, .rev = 0xff, .name = "1259-EV1 Tobermory",
245 .i2c_devs = wm1259_devs, .num_i2c_devs = ARRAY_SIZE(wm1259_devs) }, 330 .i2c_devs = wm1259_devs, .num_i2c_devs = ARRAY_SIZE(wm1259_devs) },
246 { .id = 0x3b, .name = "1255-EV1 Kilchoman", 331 { .id = 0x3b, .rev = 0xff, .name = "1255-EV1 Kilchoman",
247 .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) }, 332 .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) },
248 { .id = 0x3c, .name = "1273-EV1 Longmorn" }, 333 { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" },
249 { .id = 0x3d, .name = "1277-EV1 Littlemill", 334 { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill",
250 .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) }, 335 .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) },
251 { .id = 0x3e, .name = "WM5102-6271-EV1-CS127 Amrut", 336 { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut",
337 .spi_devs = wm5102_reva_spi_devs,
338 .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs) },
339 { .id = 0x3e, .rev = -1, .name = "WM5102-6271-EV1-CS127 Amrut",
252 .spi_devs = wm5102_spi_devs, 340 .spi_devs = wm5102_spi_devs,
253 .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs) }, 341 .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs) },
342 { .id = 0x3f, .rev = -1, .name = "WM2200-6271-CS90-M-REV1",
343 .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) },
254}; 344};
255 345
256static __devinit int wlf_gf_module_probe(struct i2c_client *i2c, 346static __devinit int wlf_gf_module_probe(struct i2c_client *i2c,
@@ -267,7 +357,8 @@ static __devinit int wlf_gf_module_probe(struct i2c_client *i2c,
267 id = (ret & 0xfe) >> 2; 357 id = (ret & 0xfe) >> 2;
268 rev = ret & 0x3; 358 rev = ret & 0x3;
269 for (i = 0; i < ARRAY_SIZE(gf_mods); i++) 359 for (i = 0; i < ARRAY_SIZE(gf_mods); i++)
270 if (id == gf_mods[i].id) 360 if (id == gf_mods[i].id && (gf_mods[i].rev == 0xff ||
361 rev == gf_mods[i].rev))
271 break; 362 break;
272 363
273 if (i < ARRAY_SIZE(gf_mods)) { 364 if (i < ARRAY_SIZE(gf_mods)) {
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 13b7eaa45fd..cdde249166b 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -287,16 +287,21 @@ static struct platform_device littlemill_device = {
287 .id = -1, 287 .id = -1,
288}; 288};
289 289
290static struct platform_device bells_wm5102_device = { 290static struct platform_device bells_wm2200_device = {
291 .name = "bells", 291 .name = "bells",
292 .id = 0, 292 .id = 0,
293}; 293};
294 294
295static struct platform_device bells_wm5110_device = { 295static struct platform_device bells_wm5102_device = {
296 .name = "bells", 296 .name = "bells",
297 .id = 1, 297 .id = 1,
298}; 298};
299 299
300static struct platform_device bells_wm5110_device = {
301 .name = "bells",
302 .id = 2,
303};
304
300static struct regulator_consumer_supply wallvdd_consumers[] = { 305static struct regulator_consumer_supply wallvdd_consumers[] = {
301 REGULATOR_SUPPLY("SPKVDD", "1-001a"), 306 REGULATOR_SUPPLY("SPKVDD", "1-001a"),
302 REGULATOR_SUPPLY("SPKVDD1", "1-001a"), 307 REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
@@ -304,6 +309,13 @@ static struct regulator_consumer_supply wallvdd_consumers[] = {
304 REGULATOR_SUPPLY("SPKVDDL", "1-001a"), 309 REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
305 REGULATOR_SUPPLY("SPKVDDR", "1-001a"), 310 REGULATOR_SUPPLY("SPKVDDR", "1-001a"),
306 311
312 REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),
313 REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),
314 REGULATOR_SUPPLY("SPKVDDL", "wm5102-codec"),
315 REGULATOR_SUPPLY("SPKVDDR", "wm5102-codec"),
316 REGULATOR_SUPPLY("SPKVDDL", "wm5110-codec"),
317 REGULATOR_SUPPLY("SPKVDDR", "wm5110-codec"),
318
307 REGULATOR_SUPPLY("DC1VDD", "0-0034"), 319 REGULATOR_SUPPLY("DC1VDD", "0-0034"),
308 REGULATOR_SUPPLY("DC2VDD", "0-0034"), 320 REGULATOR_SUPPLY("DC2VDD", "0-0034"),
309 REGULATOR_SUPPLY("DC3VDD", "0-0034"), 321 REGULATOR_SUPPLY("DC3VDD", "0-0034"),
@@ -321,6 +333,16 @@ static struct regulator_consumer_supply wallvdd_consumers[] = {
321 REGULATOR_SUPPLY("DC1VDD", "1-0034"), 333 REGULATOR_SUPPLY("DC1VDD", "1-0034"),
322 REGULATOR_SUPPLY("DC2VDD", "1-0034"), 334 REGULATOR_SUPPLY("DC2VDD", "1-0034"),
323 REGULATOR_SUPPLY("DC3VDD", "1-0034"), 335 REGULATOR_SUPPLY("DC3VDD", "1-0034"),
336 REGULATOR_SUPPLY("LDO1VDD", "1-0034"),
337 REGULATOR_SUPPLY("LDO2VDD", "1-0034"),
338 REGULATOR_SUPPLY("LDO4VDD", "1-0034"),
339 REGULATOR_SUPPLY("LDO5VDD", "1-0034"),
340 REGULATOR_SUPPLY("LDO6VDD", "1-0034"),
341 REGULATOR_SUPPLY("LDO7VDD", "1-0034"),
342 REGULATOR_SUPPLY("LDO8VDD", "1-0034"),
343 REGULATOR_SUPPLY("LDO9VDD", "1-0034"),
344 REGULATOR_SUPPLY("LDO10VDD", "1-0034"),
345 REGULATOR_SUPPLY("LDO11VDD", "1-0034"),
324}; 346};
325 347
326static struct regulator_init_data wallvdd_data = { 348static struct regulator_init_data wallvdd_data = {
@@ -357,7 +379,6 @@ static struct platform_device *crag6410_devices[] __initdata = {
357 &s3c_device_timer[0], 379 &s3c_device_timer[0],
358 &s3c64xx_device_iis0, 380 &s3c64xx_device_iis0,
359 &s3c64xx_device_iis1, 381 &s3c64xx_device_iis1,
360 &samsung_asoc_dma,
361 &samsung_device_keypad, 382 &samsung_device_keypad,
362 &crag6410_gpio_keydev, 383 &crag6410_gpio_keydev,
363 &crag6410_dm9k_device, 384 &crag6410_dm9k_device,
@@ -369,6 +390,7 @@ static struct platform_device *crag6410_devices[] __initdata = {
369 &tobermory_device, 390 &tobermory_device,
370 &littlemill_device, 391 &littlemill_device,
371 &lowland_device, 392 &lowland_device,
393 &bells_wm2200_device,
372 &bells_wm5102_device, 394 &bells_wm5102_device,
373 &bells_wm5110_device, 395 &bells_wm5110_device,
374 &wallvdd_device, 396 &wallvdd_device,
@@ -597,6 +619,7 @@ static struct s3c2410_platform_i2c i2c0_pdata = {
597static struct regulator_consumer_supply pvdd_1v2_consumers[] __devinitdata = { 619static struct regulator_consumer_supply pvdd_1v2_consumers[] __devinitdata = {
598 REGULATOR_SUPPLY("DCVDD", "spi0.0"), 620 REGULATOR_SUPPLY("DCVDD", "spi0.0"),
599 REGULATOR_SUPPLY("AVDD", "spi0.0"), 621 REGULATOR_SUPPLY("AVDD", "spi0.0"),
622 REGULATOR_SUPPLY("AVDD", "spi0.1"),
600}; 623};
601 624
602static struct regulator_init_data pvdd_1v2 __devinitdata = { 625static struct regulator_init_data pvdd_1v2 __devinitdata = {
@@ -621,6 +644,24 @@ static struct regulator_consumer_supply pvdd_1v8_consumers[] __devinitdata = {
621 REGULATOR_SUPPLY("DCVDD", "1-001a"), 644 REGULATOR_SUPPLY("DCVDD", "1-001a"),
622 REGULATOR_SUPPLY("AVDD", "1-001a"), 645 REGULATOR_SUPPLY("AVDD", "1-001a"),
623 REGULATOR_SUPPLY("DBVDD", "spi0.0"), 646 REGULATOR_SUPPLY("DBVDD", "spi0.0"),
647
648 REGULATOR_SUPPLY("DBVDD", "1-003a"),
649 REGULATOR_SUPPLY("LDOVDD", "1-003a"),
650 REGULATOR_SUPPLY("CPVDD", "1-003a"),
651 REGULATOR_SUPPLY("AVDD", "1-003a"),
652 REGULATOR_SUPPLY("DBVDD1", "spi0.1"),
653 REGULATOR_SUPPLY("DBVDD2", "spi0.1"),
654 REGULATOR_SUPPLY("DBVDD3", "spi0.1"),
655 REGULATOR_SUPPLY("LDOVDD", "spi0.1"),
656 REGULATOR_SUPPLY("CPVDD", "spi0.1"),
657
658 REGULATOR_SUPPLY("DBVDD2", "wm5102-codec"),
659 REGULATOR_SUPPLY("DBVDD3", "wm5102-codec"),
660 REGULATOR_SUPPLY("CPVDD", "wm5102-codec"),
661
662 REGULATOR_SUPPLY("DBVDD2", "wm5110-codec"),
663 REGULATOR_SUPPLY("DBVDD3", "wm5110-codec"),
664 REGULATOR_SUPPLY("CPVDD", "wm5110-codec"),
624}; 665};
625 666
626static struct regulator_init_data pvdd_1v8 __devinitdata = { 667static struct regulator_init_data pvdd_1v8 __devinitdata = {
@@ -685,6 +726,7 @@ static struct i2c_board_info i2c_devs1[] __devinitdata = {
685 .irq = S3C_EINT(0), 726 .irq = S3C_EINT(0),
686 .platform_data = &glenfarclas_pmic_pdata }, 727 .platform_data = &glenfarclas_pmic_pdata },
687 728
729 { I2C_BOARD_INFO("wlf-gf-module", 0x20) },
688 { I2C_BOARD_INFO("wlf-gf-module", 0x22) }, 730 { I2C_BOARD_INFO("wlf-gf-module", 0x22) },
689 { I2C_BOARD_INFO("wlf-gf-module", 0x24) }, 731 { I2C_BOARD_INFO("wlf-gf-module", 0x24) },
690 { I2C_BOARD_INFO("wlf-gf-module", 0x25) }, 732 { I2C_BOARD_INFO("wlf-gf-module", 0x25) },
@@ -810,7 +852,7 @@ static void __init crag6410_machine_init(void)
810 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); 852 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
811 853
812 samsung_keypad_set_platdata(&crag6410_keypad_data); 854 samsung_keypad_set_platdata(&crag6410_keypad_data);
813 s3c64xx_spi0_set_platdata(NULL, 0, 1); 855 s3c64xx_spi0_set_platdata(NULL, 0, 2);
814 856
815 platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices)); 857 platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
816 858
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index da1a771a29e..574a9eef588 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -275,7 +275,6 @@ static struct platform_device *smdk6410_devices[] __initdata = {
275 &s3c_device_fb, 275 &s3c_device_fb,
276 &s3c_device_ohci, 276 &s3c_device_ohci,
277 &s3c_device_usb_hsotg, 277 &s3c_device_usb_hsotg,
278 &samsung_asoc_dma,
279 &s3c64xx_device_iisv4, 278 &s3c64xx_device_iisv4,
280 &samsung_device_keypad, 279 &samsung_device_keypad,
281 280
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 111e404a81f..8ae5800e807 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -187,7 +187,6 @@ void __init s5p6440_map_io(void)
187 s5p6440_default_sdhci2(); 187 s5p6440_default_sdhci2();
188 188
189 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); 189 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
190 init_consistent_dma_size(SZ_8M);
191} 190}
192 191
193void __init s5p6450_map_io(void) 192void __init s5p6450_map_io(void)
@@ -202,7 +201,6 @@ void __init s5p6450_map_io(void)
202 s5p6450_default_sdhci2(); 201 s5p6450_default_sdhci2();
203 202
204 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); 203 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc));
205 init_consistent_dma_size(SZ_8M);
206} 204}
207 205
208/* 206/*
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 96ea1fe0ec9..1af823558c6 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -165,7 +165,6 @@ static struct platform_device *smdk6440_devices[] __initdata = {
165 &s3c_device_i2c1, 165 &s3c_device_i2c1,
166 &s3c_device_ts, 166 &s3c_device_ts,
167 &s3c_device_wdt, 167 &s3c_device_wdt,
168 &samsung_asoc_dma,
169 &s5p6440_device_iis, 168 &s5p6440_device_iis,
170 &s3c_device_fb, 169 &s3c_device_fb,
171 &smdk6440_lcd_lte480wv, 170 &smdk6440_lcd_lte480wv,
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 12748b6eaa7..62526ccf6b7 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -183,7 +183,6 @@ static struct platform_device *smdk6450_devices[] __initdata = {
183 &s3c_device_i2c1, 183 &s3c_device_i2c1,
184 &s3c_device_ts, 184 &s3c_device_ts,
185 &s3c_device_wdt, 185 &s3c_device_wdt,
186 &samsung_asoc_dma,
187 &s5p6450_device_iis0, 186 &s5p6450_device_iis0,
188 &s3c_device_fb, 187 &s3c_device_fb,
189 &smdk6450_lcd_lte480wv, 188 &smdk6450_lcd_lte480wv,
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index dba7384a87b..9abe95e806a 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -197,7 +197,6 @@ static struct platform_device *smdkc100_devices[] __initdata = {
197 &s3c_device_ts, 197 &s3c_device_ts,
198 &s3c_device_wdt, 198 &s3c_device_wdt,
199 &smdkc100_lcd_powerdev, 199 &smdkc100_lcd_powerdev,
200 &samsung_asoc_dma,
201 &s5pc100_device_iis0, 200 &s5pc100_device_iis0,
202 &samsung_device_keypad, 201 &samsung_device_keypad,
203 &s5pc100_device_ac97, 202 &s5pc100_device_ac97,
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index a0c50efe814..9dfe93e2624 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -169,8 +169,6 @@ void __init s5pv210_init_io(struct map_desc *mach_desc, int size)
169 169
170void __init s5pv210_map_io(void) 170void __init s5pv210_map_io(void)
171{ 171{
172 init_consistent_dma_size(14 << 20);
173
174 /* initialise device information early */ 172 /* initialise device information early */
175 s5pv210_default_sdhci0(); 173 s5pv210_default_sdhci0();
176 s5pv210_default_sdhci1(); 174 s5pv210_default_sdhci1();
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 55e1dba4ffd..c72b31078c9 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -774,7 +774,6 @@ static void __init goni_pmic_init(void)
774/* MoviNAND */ 774/* MoviNAND */
775static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = { 775static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
776 .max_width = 4, 776 .max_width = 4,
777 .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
778 .cd_type = S3C_SDHCI_CD_PERMANENT, 777 .cd_type = S3C_SDHCI_CD_PERMANENT,
779}; 778};
780 779
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index d9c99fcc1aa..f1f3bd37ecd 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -85,7 +85,6 @@ static struct s3c_ide_platdata smdkc110_ide_pdata __initdata = {
85}; 85};
86 86
87static struct platform_device *smdkc110_devices[] __initdata = { 87static struct platform_device *smdkc110_devices[] __initdata = {
88 &samsung_asoc_dma,
89 &s5pv210_device_iis0, 88 &s5pv210_device_iis0,
90 &s5pv210_device_ac97, 89 &s5pv210_device_ac97,
91 &s5pv210_device_spdif, 90 &s5pv210_device_spdif,
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 4cdb5bb7bbc..6bc8404bf67 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -234,7 +234,6 @@ static struct platform_device *smdkv210_devices[] __initdata = {
234 &s5pv210_device_ac97, 234 &s5pv210_device_ac97,
235 &s5pv210_device_iis0, 235 &s5pv210_device_iis0,
236 &s5pv210_device_spdif, 236 &s5pv210_device_spdif,
237 &samsung_asoc_dma,
238 &samsung_asoc_idma, 237 &samsung_asoc_idma,
239 &samsung_device_keypad, 238 &samsung_device_keypad,
240 &smdkv210_dm9000, 239 &smdkv210_dm9000,
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 6a7ad3c2a3f..9a23739f702 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -14,6 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/platform_data/sa11x0-serial.h>
17#include <linux/serial_core.h> 18#include <linux/serial_core.h>
18#include <linux/mfd/ucb1x00.h> 19#include <linux/mfd/ucb1x00.h>
19#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/flash.h> 38#include <asm/mach/flash.h>
38#include <asm/mach/irda.h> 39#include <asm/mach/irda.h>
39#include <asm/mach/map.h> 40#include <asm/mach/map.h>
40#include <asm/mach/serial_sa1100.h>
41#include <mach/assabet.h> 41#include <mach/assabet.h>
42#include <linux/platform_data/mfd-mcp-sa11x0.h> 42#include <linux/platform_data/mfd-mcp-sa11x0.h>
43#include <mach/irqs.h> 43#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index 038df4894b0..b2dadf3ea3d 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/platform_data/sa11x0-serial.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/tty.h> 22#include <linux/tty.h>
@@ -34,7 +35,6 @@
34#include <asm/mach/flash.h> 35#include <asm/mach/flash.h>
35#include <asm/mach/map.h> 36#include <asm/mach/map.h>
36#include <asm/hardware/sa1111.h> 37#include <asm/hardware/sa1111.h>
37#include <asm/mach/serial_sa1100.h>
38 38
39#include <mach/badge4.h> 39#include <mach/badge4.h>
40 40
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index ad0eb08ea07..304bca4a07c 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/platform_data/sa11x0-serial.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/irq.h> 18#include <linux/irq.h>
18#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
@@ -27,7 +28,6 @@
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
29#include <asm/mach/map.h> 30#include <asm/mach/map.h>
30#include <asm/mach/serial_sa1100.h>
31 31
32#include <mach/cerf.h> 32#include <mach/cerf.h>
33#include <linux/platform_data/mfd-mcp-sa11x0.h> 33#include <linux/platform_data/mfd-mcp-sa11x0.h>
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 170cb6107f6..45f424f5fca 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -21,6 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/tty.h> 22#include <linux/tty.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/platform_data/sa11x0-serial.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/mfd/ucb1x00.h> 26#include <linux/mfd/ucb1x00.h>
26#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
@@ -40,7 +41,6 @@
40#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
41#include <asm/mach/flash.h> 42#include <asm/mach/flash.h>
42#include <asm/mach/map.h> 43#include <asm/mach/map.h>
43#include <asm/mach/serial_sa1100.h>
44 44
45#include <asm/hardware/scoop.h> 45#include <asm/hardware/scoop.h>
46#include <asm/mach/sharpsl_param.h> 46#include <asm/mach/sharpsl_param.h>
diff --git a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c
index 63150e1ffe9..f17e7382242 100644
--- a/arch/arm/mach-sa1100/h3xxx.c
+++ b/arch/arm/mach-sa1100/h3xxx.c
@@ -17,12 +17,12 @@
17#include <linux/mfd/htc-egpio.h> 17#include <linux/mfd/htc-egpio.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/platform_data/sa11x0-serial.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/serial_core.h> 22#include <linux/serial_core.h>
22 23
23#include <asm/mach/flash.h> 24#include <asm/mach/flash.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25#include <asm/mach/serial_sa1100.h>
26 26
27#include <mach/h3xxx.h> 27#include <mach/h3xxx.h>
28 28
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index fc106aab7c7..d005939c41f 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -18,6 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/cpufreq.h> 20#include <linux/cpufreq.h>
21#include <linux/platform_data/sa11x0-serial.h>
21#include <linux/serial_core.h> 22#include <linux/serial_core.h>
22#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
@@ -35,7 +36,6 @@
35#include <asm/mach/flash.h> 36#include <asm/mach/flash.h>
36#include <asm/mach/map.h> 37#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38#include <asm/mach/serial_sa1100.h>
39 39
40#include <mach/hardware.h> 40#include <mach/hardware.h>
41#include <mach/irqs.h> 41#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index e3084f47027..35cfc428b4d 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/tty.h> 18#include <linux/tty.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/platform_data/sa11x0-serial.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/ioport.h> 22#include <linux/ioport.h>
22#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
@@ -30,7 +31,6 @@
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
32#include <asm/mach/map.h> 33#include <asm/mach/map.h>
33#include <asm/mach/serial_sa1100.h>
34 34
35#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <mach/irqs.h> 36#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index 3048b17e84c..f69f78fc3dd 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -4,6 +4,7 @@
4 4
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/platform_data/sa11x0-serial.h>
7#include <linux/tty.h> 8#include <linux/tty.h>
8#include <linux/gpio.h> 9#include <linux/gpio.h>
9#include <linux/leds.h> 10#include <linux/leds.h>
@@ -18,7 +19,6 @@
18 19
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
20#include <asm/mach/map.h> 21#include <asm/mach/map.h>
21#include <asm/mach/serial_sa1100.h>
22#include <linux/platform_data/mfd-mcp-sa11x0.h> 22#include <linux/platform_data/mfd-mcp-sa11x0.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24 24
diff --git a/arch/arm/mach-sa1100/nanoengine.c b/arch/arm/mach-sa1100/nanoengine.c
index 41f69d97066..102e08f7b10 100644
--- a/arch/arm/mach-sa1100/nanoengine.c
+++ b/arch/arm/mach-sa1100/nanoengine.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/platform_data/sa11x0-serial.h>
16#include <linux/mtd/mtd.h> 17#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h> 18#include <linux/mtd/partitions.h>
18#include <linux/root_dev.h> 19#include <linux/root_dev.h>
@@ -24,7 +25,6 @@
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
25#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
27#include <asm/mach/serial_sa1100.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/nanoengine.h> 30#include <mach/nanoengine.h>
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 266db873a4e..88be0474f3d 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -7,6 +7,7 @@
7#include <linux/irq.h> 7#include <linux/irq.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/platform_data/sa11x0-serial.h>
10#include <linux/platform_device.h> 11#include <linux/platform_device.h>
11#include <linux/pm.h> 12#include <linux/pm.h>
12#include <linux/serial_core.h> 13#include <linux/serial_core.h>
@@ -14,7 +15,6 @@
14 15
15#include <asm/mach-types.h> 16#include <asm/mach-types.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
17#include <asm/mach/serial_sa1100.h>
18#include <asm/hardware/sa1111.h> 18#include <asm/hardware/sa1111.h>
19#include <asm/sizes.h> 19#include <asm/sizes.h>
20 20
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index 37fe0a0a536..c51bb63f90f 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -6,6 +6,7 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/tty.h> 7#include <linux/tty.h>
8#include <linux/ioport.h> 8#include <linux/ioport.h>
9#include <linux/platform_data/sa11x0-serial.h>
9#include <linux/platform_device.h> 10#include <linux/platform_device.h>
10#include <linux/irq.h> 11#include <linux/irq.h>
11#include <linux/io.h> 12#include <linux/io.h>
@@ -18,7 +19,6 @@
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 20#include <asm/mach/map.h>
20#include <asm/mach/flash.h> 21#include <asm/mach/flash.h>
21#include <asm/mach/serial_sa1100.h>
22#include <mach/irqs.h> 22#include <mach/irqs.h>
23 23
24#include "generic.h" 24#include "generic.h"
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index ff6b7b35bca..6460d25fbb8 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -5,6 +5,7 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/device.h> 6#include <linux/device.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/platform_data/sa11x0-serial.h>
8#include <linux/tty.h> 9#include <linux/tty.h>
9#include <linux/mtd/mtd.h> 10#include <linux/mtd/mtd.h>
10#include <linux/mtd/partitions.h> 11#include <linux/mtd/partitions.h>
@@ -18,7 +19,6 @@
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <asm/mach/flash.h> 20#include <asm/mach/flash.h>
20#include <asm/mach/map.h> 21#include <asm/mach/map.h>
21#include <asm/mach/serial_sa1100.h>
22#include <linux/platform_data/mfd-mcp-sa11x0.h> 22#include <linux/platform_data/mfd-mcp-sa11x0.h>
23#include <mach/shannon.h> 23#include <mach/shannon.h>
24#include <mach/irqs.h> 24#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index 71790e581d9..6d65f65fcb2 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -9,6 +9,7 @@
9#include <linux/proc_fs.h> 9#include <linux/proc_fs.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/platform_data/sa11x0-serial.h>
12#include <linux/platform_device.h> 13#include <linux/platform_device.h>
13#include <linux/mfd/ucb1x00.h> 14#include <linux/mfd/ucb1x00.h>
14#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
@@ -23,7 +24,6 @@
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/flash.h> 25#include <asm/mach/flash.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/mach/serial_sa1100.h>
27#include <linux/platform_data/mfd-mcp-sa11x0.h> 27#include <linux/platform_data/mfd-mcp-sa11x0.h>
28#include <mach/simpad.h> 28#include <mach/simpad.h>
29#include <mach/irqs.h> 29#include <mach/irqs.h>
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 8ae100cc655..9255546e7bf 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -2,18 +2,6 @@ if ARCH_SHMOBILE
2 2
3comment "SH-Mobile System Type" 3comment "SH-Mobile System Type"
4 4
5config ARCH_SH7367
6 bool "SH-Mobile G3 (SH7367)"
7 select ARCH_WANT_OPTIONAL_GPIOLIB
8 select CPU_V6
9 select SH_CLK_CPG
10
11config ARCH_SH7377
12 bool "SH-Mobile G4 (SH7377)"
13 select ARCH_WANT_OPTIONAL_GPIOLIB
14 select CPU_V7
15 select SH_CLK_CPG
16
17config ARCH_SH7372 5config ARCH_SH7372
18 bool "SH-Mobile AP4 (SH7372)" 6 bool "SH-Mobile AP4 (SH7372)"
19 select ARCH_WANT_OPTIONAL_GPIOLIB 7 select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -41,6 +29,8 @@ config ARCH_R8A7779
41 select ARM_GIC 29 select ARM_GIC
42 select CPU_V7 30 select CPU_V7
43 select SH_CLK_CPG 31 select SH_CLK_CPG
32 select USB_ARCH_HAS_EHCI
33 select USB_ARCH_HAS_OHCI
44 34
45config ARCH_EMEV2 35config ARCH_EMEV2
46 bool "Emma Mobile EV2" 36 bool "Emma Mobile EV2"
@@ -50,17 +40,6 @@ config ARCH_EMEV2
50 40
51comment "SH-Mobile Board Type" 41comment "SH-Mobile Board Type"
52 42
53config MACH_G3EVM
54 bool "G3EVM board"
55 depends on ARCH_SH7367
56 select ARCH_REQUIRE_GPIOLIB
57
58config MACH_G4EVM
59 bool "G4EVM board"
60 depends on ARCH_SH7377
61 select ARCH_REQUIRE_GPIOLIB
62 select REGULATOR_FIXED_VOLTAGE if REGULATOR
63
64config MACH_AP4EVB 43config MACH_AP4EVB
65 bool "AP4EVB board" 44 bool "AP4EVB board"
66 depends on ARCH_SH7372 45 depends on ARCH_SH7372
@@ -95,6 +74,7 @@ config MACH_MACKEREL
95 select ARCH_REQUIRE_GPIOLIB 74 select ARCH_REQUIRE_GPIOLIB
96 select REGULATOR_FIXED_VOLTAGE if REGULATOR 75 select REGULATOR_FIXED_VOLTAGE if REGULATOR
97 select SND_SOC_AK4642 if SND_SIMPLE_CARD 76 select SND_SOC_AK4642 if SND_SIMPLE_CARD
77 select USE_OF
98 78
99config MACH_KOTA2 79config MACH_KOTA2
100 bool "KOTA2 board" 80 bool "KOTA2 board"
@@ -146,8 +126,7 @@ menu "Memory configuration"
146 126
147config MEMORY_START 127config MEMORY_START
148 hex "Physical memory start address" 128 hex "Physical memory start address"
149 default "0x50000000" if MACH_G3EVM 129 default "0x40000000" if MACH_AP4EVB || MACH_AG5EVM || \
150 default "0x40000000" if MACH_G4EVM || MACH_AP4EVB || MACH_AG5EVM || \
151 MACH_MACKEREL || MACH_BONITO || \ 130 MACH_MACKEREL || MACH_BONITO || \
152 MACH_ARMADILLO800EVA 131 MACH_ARMADILLO800EVA
153 default "0x41000000" if MACH_KOTA2 132 default "0x41000000" if MACH_KOTA2
@@ -159,8 +138,6 @@ config MEMORY_START
159 138
160config MEMORY_SIZE 139config MEMORY_SIZE
161 hex "Physical memory size" 140 hex "Physical memory size"
162 default "0x08000000" if MACH_G3EVM
163 default "0x08000000" if MACH_G4EVM
164 default "0x20000000" if MACH_AG5EVM || MACH_BONITO || \ 141 default "0x20000000" if MACH_AG5EVM || MACH_BONITO || \
165 MACH_ARMADILLO800EVA 142 MACH_ARMADILLO800EVA
166 default "0x1e000000" if MACH_KOTA2 143 default "0x1e000000" if MACH_KOTA2
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index fe2c97c179d..0b7147928aa 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -6,8 +6,6 @@
6obj-y := timer.o console.o clock.o 6obj-y := timer.o console.o clock.o
7 7
8# CPU objects 8# CPU objects
9obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
10obj-$(CONFIG_ARCH_SH7377) += setup-sh7377.o clock-sh7377.o intc-sh7377.o
11obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7372.o intc-sh7372.o 9obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7372.o intc-sh7372.o
12obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o 10obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o
13obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o 11obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
@@ -23,16 +21,12 @@ smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o
23 21
24# Pinmux setup 22# Pinmux setup
25pfc-y := 23pfc-y :=
26pfc-$(CONFIG_ARCH_SH7367) += pfc-sh7367.o
27pfc-$(CONFIG_ARCH_SH7377) += pfc-sh7377.o
28pfc-$(CONFIG_ARCH_SH7372) += pfc-sh7372.o 24pfc-$(CONFIG_ARCH_SH7372) += pfc-sh7372.o
29pfc-$(CONFIG_ARCH_SH73A0) += pfc-sh73a0.o 25pfc-$(CONFIG_ARCH_SH73A0) += pfc-sh73a0.o
30pfc-$(CONFIG_ARCH_R8A7740) += pfc-r8a7740.o 26pfc-$(CONFIG_ARCH_R8A7740) += pfc-r8a7740.o
31pfc-$(CONFIG_ARCH_R8A7779) += pfc-r8a7779.o 27pfc-$(CONFIG_ARCH_R8A7779) += pfc-r8a7779.o
32 28
33# IRQ objects 29# IRQ objects
34obj-$(CONFIG_ARCH_SH7367) += entry-intc.o
35obj-$(CONFIG_ARCH_SH7377) += entry-intc.o
36obj-$(CONFIG_ARCH_SH7372) += entry-intc.o 30obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
37obj-$(CONFIG_ARCH_R8A7740) += entry-intc.o 31obj-$(CONFIG_ARCH_R8A7740) += entry-intc.o
38 32
@@ -45,8 +39,6 @@ obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o
45obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o 39obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o
46 40
47# Board objects 41# Board objects
48obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o
49obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o
50obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o 42obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o
51obj-$(CONFIG_MACH_AG5EVM) += board-ag5evm.o 43obj-$(CONFIG_MACH_AG5EVM) += board-ag5evm.o
52obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o 44obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 790dc68c431..40657854e3a 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -658,133 +658,16 @@ static struct platform_device lcdc_device = {
658 658
659/* FSI */ 659/* FSI */
660#define IRQ_FSI evt2irq(0x1840) 660#define IRQ_FSI evt2irq(0x1840)
661static int __fsi_set_rate(struct clk *clk, long rate, int enable)
662{
663 int ret = 0;
664
665 if (rate <= 0)
666 return ret;
667
668 if (enable) {
669 ret = clk_set_rate(clk, rate);
670 if (0 == ret)
671 ret = clk_enable(clk);
672 } else {
673 clk_disable(clk);
674 }
675
676 return ret;
677}
678
679static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
680{
681 return __fsi_set_rate(clk, clk_round_rate(clk, rate), enable);
682}
683
684static int fsi_ak4642_set_rate(struct device *dev, int rate, int enable)
685{
686 struct clk *fsia_ick;
687 struct clk *fsiack;
688 int ret = -EIO;
689
690 fsia_ick = clk_get(dev, "icka");
691 if (IS_ERR(fsia_ick))
692 return PTR_ERR(fsia_ick);
693
694 /*
695 * FSIACK is connected to AK4642,
696 * and use external clock pin from it.
697 * it is parent of fsia_ick now.
698 */
699 fsiack = clk_get_parent(fsia_ick);
700 if (!fsiack)
701 goto fsia_ick_out;
702
703 /*
704 * we get 1/1 divided clock by setting same rate to fsiack and fsia_ick
705 *
706 ** FIXME **
707 * Because the freq_table of external clk (fsiack) are all 0,
708 * the return value of clk_round_rate became 0.
709 * So, it use __fsi_set_rate here.
710 */
711 ret = __fsi_set_rate(fsiack, rate, enable);
712 if (ret < 0)
713 goto fsiack_out;
714
715 ret = __fsi_set_round_rate(fsia_ick, rate, enable);
716 if ((ret < 0) && enable)
717 __fsi_set_round_rate(fsiack, rate, 0); /* disable FSI ACK */
718
719fsiack_out:
720 clk_put(fsiack);
721
722fsia_ick_out:
723 clk_put(fsia_ick);
724
725 return 0;
726}
727
728static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
729{
730 struct clk *fsib_clk;
731 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
732 long fsib_rate = 0;
733 long fdiv_rate = 0;
734 int ackmd_bpfmd;
735 int ret;
736
737 switch (rate) {
738 case 44100:
739 fsib_rate = rate * 256;
740 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
741 break;
742 case 48000:
743 fsib_rate = 85428000; /* around 48kHz x 256 x 7 */
744 fdiv_rate = rate * 256;
745 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
746 break;
747 default:
748 pr_err("unsupported rate in FSI2 port B\n");
749 return -EINVAL;
750 }
751
752 /* FSI B setting */
753 fsib_clk = clk_get(dev, "ickb");
754 if (IS_ERR(fsib_clk))
755 return -EIO;
756
757 ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
758 if (ret < 0)
759 goto fsi_set_rate_end;
760
761 /* FSI DIV setting */
762 ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
763 if (ret < 0) {
764 /* disable FSI B */
765 if (enable)
766 __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
767 goto fsi_set_rate_end;
768 }
769
770 ret = ackmd_bpfmd;
771
772fsi_set_rate_end:
773 clk_put(fsib_clk);
774 return ret;
775}
776
777static struct sh_fsi_platform_info fsi_info = { 661static struct sh_fsi_platform_info fsi_info = {
778 .port_a = { 662 .port_a = {
779 .flags = SH_FSI_BRS_INV, 663 .flags = SH_FSI_BRS_INV,
780 .set_rate = fsi_ak4642_set_rate,
781 }, 664 },
782 .port_b = { 665 .port_b = {
783 .flags = SH_FSI_BRS_INV | 666 .flags = SH_FSI_BRS_INV |
784 SH_FSI_BRM_INV | 667 SH_FSI_BRM_INV |
785 SH_FSI_LRS_INV | 668 SH_FSI_LRS_INV |
669 SH_FSI_CLK_CPG |
786 SH_FSI_FMT_SPDIF, 670 SH_FSI_FMT_SPDIF,
787 .set_rate = fsi_hdmi_set_rate,
788 }, 671 },
789}; 672};
790 673
@@ -1144,25 +1027,6 @@ out:
1144 clk_put(hdmi_ick); 1027 clk_put(hdmi_ick);
1145} 1028}
1146 1029
1147static void __init fsi_init_pm_clock(void)
1148{
1149 struct clk *fsia_ick;
1150 int ret;
1151
1152 fsia_ick = clk_get(&fsi_device.dev, "icka");
1153 if (IS_ERR(fsia_ick)) {
1154 ret = PTR_ERR(fsia_ick);
1155 pr_err("Cannot get FSI ICK: %d\n", ret);
1156 return;
1157 }
1158
1159 ret = clk_set_parent(fsia_ick, &sh7372_fsiack_clk);
1160 if (ret < 0)
1161 pr_err("Cannot set FSI-A parent: %d\n", ret);
1162
1163 clk_put(fsia_ick);
1164}
1165
1166/* TouchScreen */ 1030/* TouchScreen */
1167#ifdef CONFIG_AP4EVB_QHD 1031#ifdef CONFIG_AP4EVB_QHD
1168# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123 1032# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
@@ -1476,7 +1340,6 @@ static void __init ap4evb_init(void)
1476 ARRAY_SIZE(domain_devices)); 1340 ARRAY_SIZE(domain_devices));
1477 1341
1478 hdmi_init_pm_clock(); 1342 hdmi_init_pm_clock();
1479 fsi_init_pm_clock();
1480 sh7372_pm_init(); 1343 sh7372_pm_init();
1481 pm_clk_add(&fsi_device.dev, "spu2"); 1344 pm_clk_add(&fsi_device.dev, "spu2");
1482 pm_clk_add(&lcdc1_device.dev, "hdmi"); 1345 pm_clk_add(&lcdc1_device.dev, "hdmi");
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 3cc8b1c21da..5353adf6b82 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -768,32 +768,6 @@ static struct platform_device ceu0_device = {
768}; 768};
769 769
770/* FSI */ 770/* FSI */
771static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
772{
773 struct clk *fsib;
774 int ret;
775
776 /* it support 48KHz only */
777 if (48000 != rate)
778 return -EINVAL;
779
780 fsib = clk_get(dev, "ickb");
781 if (IS_ERR(fsib))
782 return -EINVAL;
783
784 if (enable) {
785 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
786 clk_enable(fsib);
787 } else {
788 ret = 0;
789 clk_disable(fsib);
790 }
791
792 clk_put(fsib);
793
794 return ret;
795}
796
797static struct sh_fsi_platform_info fsi_info = { 771static struct sh_fsi_platform_info fsi_info = {
798 /* FSI-WM8978 */ 772 /* FSI-WM8978 */
799 .port_a = { 773 .port_a = {
@@ -802,8 +776,8 @@ static struct sh_fsi_platform_info fsi_info = {
802 /* FSI-HDMI */ 776 /* FSI-HDMI */
803 .port_b = { 777 .port_b = {
804 .flags = SH_FSI_FMT_SPDIF | 778 .flags = SH_FSI_FMT_SPDIF |
805 SH_FSI_ENABLE_STREAM_MODE, 779 SH_FSI_ENABLE_STREAM_MODE |
806 .set_rate = fsi_hdmi_set_rate, 780 SH_FSI_CLK_CPG,
807 .tx_id = SHDMA_SLAVE_FSIB_TX, 781 .tx_id = SHDMA_SLAVE_FSIB_TX,
808 } 782 }
809}; 783};
@@ -938,13 +912,11 @@ static void __init eva_clock_init(void)
938 struct clk *xtal1 = clk_get(NULL, "extal1"); 912 struct clk *xtal1 = clk_get(NULL, "extal1");
939 struct clk *usb24s = clk_get(NULL, "usb24s"); 913 struct clk *usb24s = clk_get(NULL, "usb24s");
940 struct clk *fsibck = clk_get(NULL, "fsibck"); 914 struct clk *fsibck = clk_get(NULL, "fsibck");
941 struct clk *fsib = clk_get(&fsi_device.dev, "ickb");
942 915
943 if (IS_ERR(system) || 916 if (IS_ERR(system) ||
944 IS_ERR(xtal1) || 917 IS_ERR(xtal1) ||
945 IS_ERR(usb24s) || 918 IS_ERR(usb24s) ||
946 IS_ERR(fsibck) || 919 IS_ERR(fsibck)) {
947 IS_ERR(fsib)) {
948 pr_err("armadillo800eva board clock init failed\n"); 920 pr_err("armadillo800eva board clock init failed\n");
949 goto clock_error; 921 goto clock_error;
950 } 922 }
@@ -956,9 +928,7 @@ static void __init eva_clock_init(void)
956 clk_set_parent(usb24s, system); 928 clk_set_parent(usb24s, system);
957 929
958 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */ 930 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
959 clk_set_parent(fsib, fsibck);
960 clk_set_rate(fsibck, 12288000); 931 clk_set_rate(fsibck, 12288000);
961 clk_set_rate(fsib, 12288000);
962 932
963clock_error: 933clock_error:
964 if (!IS_ERR(system)) 934 if (!IS_ERR(system))
@@ -969,8 +939,6 @@ clock_error:
969 clk_put(usb24s); 939 clk_put(usb24s);
970 if (!IS_ERR(fsibck)) 940 if (!IS_ERR(fsibck))
971 clk_put(fsibck); 941 clk_put(fsibck);
972 if (!IS_ERR(fsib))
973 clk_put(fsib);
974} 942}
975 943
976/* 944/*
@@ -1229,6 +1197,13 @@ static void __init eva_add_early_devices(void)
1229 shmobile_timer.init = eva_earlytimer_init; 1197 shmobile_timer.init = eva_earlytimer_init;
1230} 1198}
1231 1199
1200#define RESCNT2 IOMEM(0xe6188020)
1201static void eva_restart(char mode, const char *cmd)
1202{
1203 /* Do soft power on reset */
1204 writel((1 << 31), RESCNT2);
1205}
1206
1232static const char *eva_boards_compat_dt[] __initdata = { 1207static const char *eva_boards_compat_dt[] __initdata = {
1233 "renesas,armadillo800eva", 1208 "renesas,armadillo800eva",
1234 NULL, 1209 NULL,
@@ -1243,4 +1218,5 @@ DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
1243 .init_late = shmobile_init_late, 1218 .init_late = shmobile_init_late,
1244 .timer = &shmobile_timer, 1219 .timer = &shmobile_timer,
1245 .dt_compat = eva_boards_compat_dt, 1220 .dt_compat = eva_boards_compat_dt,
1221 .restart = eva_restart,
1246MACHINE_END 1222MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
deleted file mode 100644
index b179d4c213b..00000000000
--- a/arch/arm/mach-shmobile/board-g3evm.c
+++ /dev/null
@@ -1,343 +0,0 @@
1/*
2 * G3EVM board support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/delay.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h>
29#include <linux/mtd/sh_flctl.h>
30#include <linux/usb/r8a66597.h>
31#include <linux/io.h>
32#include <linux/gpio.h>
33#include <linux/input.h>
34#include <linux/input/sh_keysc.h>
35#include <linux/dma-mapping.h>
36#include <mach/irqs.h>
37#include <mach/sh7367.h>
38#include <mach/common.h>
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
41
42/*
43 * IrDA
44 *
45 * S67: 5bit : ON power
46 * : 6bit : ON remote control
47 * OFF IrDA
48 */
49
50static struct mtd_partition nor_flash_partitions[] = {
51 {
52 .name = "loader",
53 .offset = 0x00000000,
54 .size = 512 * 1024,
55 },
56 {
57 .name = "bootenv",
58 .offset = MTDPART_OFS_APPEND,
59 .size = 512 * 1024,
60 },
61 {
62 .name = "kernel_ro",
63 .offset = MTDPART_OFS_APPEND,
64 .size = 8 * 1024 * 1024,
65 .mask_flags = MTD_WRITEABLE,
66 },
67 {
68 .name = "kernel",
69 .offset = MTDPART_OFS_APPEND,
70 .size = 8 * 1024 * 1024,
71 },
72 {
73 .name = "data",
74 .offset = MTDPART_OFS_APPEND,
75 .size = MTDPART_SIZ_FULL,
76 },
77};
78
79static struct physmap_flash_data nor_flash_data = {
80 .width = 2,
81 .parts = nor_flash_partitions,
82 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
83};
84
85static struct resource nor_flash_resources[] = {
86 [0] = {
87 .start = 0x00000000,
88 .end = 0x08000000 - 1,
89 .flags = IORESOURCE_MEM,
90 }
91};
92
93static struct platform_device nor_flash_device = {
94 .name = "physmap-flash",
95 .dev = {
96 .platform_data = &nor_flash_data,
97 },
98 .num_resources = ARRAY_SIZE(nor_flash_resources),
99 .resource = nor_flash_resources,
100};
101
102/* USBHS */
103static void usb_host_port_power(int port, int power)
104{
105 if (!power) /* only power-on supported for now */
106 return;
107
108 /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */
109 __raw_writew(__raw_readw(IOMEM(0xe6890008)) | 0x600, IOMEM(0xe6890008));
110}
111
112static struct r8a66597_platdata usb_host_data = {
113 .on_chip = 1,
114 .port_power = usb_host_port_power,
115};
116
117static struct resource usb_host_resources[] = {
118 [0] = {
119 .name = "USBHS",
120 .start = 0xe6890000,
121 .end = 0xe68900e5,
122 .flags = IORESOURCE_MEM,
123 },
124 [1] = {
125 .start = evt2irq(0xa20), /* USBHS_USHI0 */
126 .flags = IORESOURCE_IRQ,
127 },
128};
129
130static struct platform_device usb_host_device = {
131 .name = "r8a66597_hcd",
132 .id = 0,
133 .dev = {
134 .platform_data = &usb_host_data,
135 .dma_mask = NULL,
136 .coherent_dma_mask = 0xffffffff,
137 },
138 .num_resources = ARRAY_SIZE(usb_host_resources),
139 .resource = usb_host_resources,
140};
141
142/* KEYSC */
143static struct sh_keysc_info keysc_info = {
144 .mode = SH_KEYSC_MODE_5,
145 .scan_timing = 3,
146 .delay = 100,
147 .keycodes = {
148 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
149 KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N,
150 KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U,
151 KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_HOME, KEY_SLEEP,
152 KEY_WAKEUP, KEY_COFFEE, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4,
153 KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_STOP, KEY_COMPUTER,
154 },
155};
156
157static struct resource keysc_resources[] = {
158 [0] = {
159 .name = "KEYSC",
160 .start = 0xe61b0000,
161 .end = 0xe61b000f,
162 .flags = IORESOURCE_MEM,
163 },
164 [1] = {
165 .start = evt2irq(0xbe0), /* KEYSC_KEY */
166 .flags = IORESOURCE_IRQ,
167 },
168};
169
170static struct platform_device keysc_device = {
171 .name = "sh_keysc",
172 .num_resources = ARRAY_SIZE(keysc_resources),
173 .resource = keysc_resources,
174 .dev = {
175 .platform_data = &keysc_info,
176 },
177};
178
179static struct mtd_partition nand_partition_info[] = {
180 {
181 .name = "system",
182 .offset = 0,
183 .size = 64 * 1024 * 1024,
184 },
185 {
186 .name = "userdata",
187 .offset = MTDPART_OFS_APPEND,
188 .size = 128 * 1024 * 1024,
189 },
190 {
191 .name = "cache",
192 .offset = MTDPART_OFS_APPEND,
193 .size = 64 * 1024 * 1024,
194 },
195};
196
197static struct resource nand_flash_resources[] = {
198 [0] = {
199 .start = 0xe6a30000,
200 .end = 0xe6a3009b,
201 .flags = IORESOURCE_MEM,
202 }
203};
204
205static struct sh_flctl_platform_data nand_flash_data = {
206 .parts = nand_partition_info,
207 .nr_parts = ARRAY_SIZE(nand_partition_info),
208 .flcmncr_val = QTSEL_E | FCKSEL_E | TYPESEL_SET | NANWF_E
209 | SHBUSSEL | SEL_16BIT,
210};
211
212static struct platform_device nand_flash_device = {
213 .name = "sh_flctl",
214 .resource = nand_flash_resources,
215 .num_resources = ARRAY_SIZE(nand_flash_resources),
216 .dev = {
217 .platform_data = &nand_flash_data,
218 },
219};
220
221static struct resource irda_resources[] = {
222 [0] = {
223 .start = 0xE6D00000,
224 .end = 0xE6D01FD4 - 1,
225 .flags = IORESOURCE_MEM,
226 },
227 [1] = {
228 .start = evt2irq(0x480), /* IRDA */
229 .flags = IORESOURCE_IRQ,
230 },
231};
232
233static struct platform_device irda_device = {
234 .name = "sh_irda",
235 .id = -1,
236 .resource = irda_resources,
237 .num_resources = ARRAY_SIZE(irda_resources),
238};
239
240static struct platform_device *g3evm_devices[] __initdata = {
241 &nor_flash_device,
242 &usb_host_device,
243 &keysc_device,
244 &nand_flash_device,
245 &irda_device,
246};
247
248static void __init g3evm_init(void)
249{
250 sh7367_pinmux_init();
251
252 /* Lit DS4 LED */
253 gpio_request(GPIO_PORT22, NULL);
254 gpio_direction_output(GPIO_PORT22, 1);
255 gpio_export(GPIO_PORT22, 0);
256
257 /* Lit DS8 LED */
258 gpio_request(GPIO_PORT23, NULL);
259 gpio_direction_output(GPIO_PORT23, 1);
260 gpio_export(GPIO_PORT23, 0);
261
262 /* Lit DS3 LED */
263 gpio_request(GPIO_PORT24, NULL);
264 gpio_direction_output(GPIO_PORT24, 1);
265 gpio_export(GPIO_PORT24, 0);
266
267 /* SCIFA1 */
268 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
269 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
270 gpio_request(GPIO_FN_SCIFA1_CTS, NULL);
271 gpio_request(GPIO_FN_SCIFA1_RTS, NULL);
272
273 /* USBHS */
274 gpio_request(GPIO_FN_VBUS0, NULL);
275 gpio_request(GPIO_FN_PWEN, NULL);
276 gpio_request(GPIO_FN_OVCN, NULL);
277 gpio_request(GPIO_FN_OVCN2, NULL);
278 gpio_request(GPIO_FN_EXTLP, NULL);
279 gpio_request(GPIO_FN_IDIN, NULL);
280
281 /* setup USB phy */
282 __raw_writew(0x0300, IOMEM(0xe605810a)); /* USBCR1 */
283 __raw_writew(0x00e0, IOMEM(0xe60581c0)); /* CPFCH */
284 __raw_writew(0x6010, IOMEM(0xe60581c6)); /* CGPOSR */
285 __raw_writew(0x8a0a, IOMEM(0xe605810c)); /* USBCR2 */
286
287 /* KEYSC @ CN7 */
288 gpio_request(GPIO_FN_PORT42_KEYOUT0, NULL);
289 gpio_request(GPIO_FN_PORT43_KEYOUT1, NULL);
290 gpio_request(GPIO_FN_PORT44_KEYOUT2, NULL);
291 gpio_request(GPIO_FN_PORT45_KEYOUT3, NULL);
292 gpio_request(GPIO_FN_PORT46_KEYOUT4, NULL);
293 gpio_request(GPIO_FN_PORT47_KEYOUT5, NULL);
294 gpio_request(GPIO_FN_PORT48_KEYIN0_PU, NULL);
295 gpio_request(GPIO_FN_PORT49_KEYIN1_PU, NULL);
296 gpio_request(GPIO_FN_PORT50_KEYIN2_PU, NULL);
297 gpio_request(GPIO_FN_PORT55_KEYIN3_PU, NULL);
298 gpio_request(GPIO_FN_PORT56_KEYIN4_PU, NULL);
299 gpio_request(GPIO_FN_PORT57_KEYIN5_PU, NULL);
300 gpio_request(GPIO_FN_PORT58_KEYIN6_PU, NULL);
301
302 /* FLCTL */
303 gpio_request(GPIO_FN_FCE0, NULL);
304 gpio_request(GPIO_FN_D0_ED0_NAF0, NULL);
305 gpio_request(GPIO_FN_D1_ED1_NAF1, NULL);
306 gpio_request(GPIO_FN_D2_ED2_NAF2, NULL);
307 gpio_request(GPIO_FN_D3_ED3_NAF3, NULL);
308 gpio_request(GPIO_FN_D4_ED4_NAF4, NULL);
309 gpio_request(GPIO_FN_D5_ED5_NAF5, NULL);
310 gpio_request(GPIO_FN_D6_ED6_NAF6, NULL);
311 gpio_request(GPIO_FN_D7_ED7_NAF7, NULL);
312 gpio_request(GPIO_FN_D8_ED8_NAF8, NULL);
313 gpio_request(GPIO_FN_D9_ED9_NAF9, NULL);
314 gpio_request(GPIO_FN_D10_ED10_NAF10, NULL);
315 gpio_request(GPIO_FN_D11_ED11_NAF11, NULL);
316 gpio_request(GPIO_FN_D12_ED12_NAF12, NULL);
317 gpio_request(GPIO_FN_D13_ED13_NAF13, NULL);
318 gpio_request(GPIO_FN_D14_ED14_NAF14, NULL);
319 gpio_request(GPIO_FN_D15_ED15_NAF15, NULL);
320 gpio_request(GPIO_FN_WE0_XWR0_FWE, NULL);
321 gpio_request(GPIO_FN_FRB, NULL);
322 /* FOE, FCDE, FSC on dedicated pins */
323 __raw_writel(__raw_readl(IOMEM(0xe6158048)) & ~(1 << 15), IOMEM(0xe6158048));
324
325 /* IrDA */
326 gpio_request(GPIO_FN_IRDA_OUT, NULL);
327 gpio_request(GPIO_FN_IRDA_IN, NULL);
328 gpio_request(GPIO_FN_IRDA_FIRSEL, NULL);
329
330 sh7367_add_standard_devices();
331
332 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
333}
334
335MACHINE_START(G3EVM, "g3evm")
336 .map_io = sh7367_map_io,
337 .init_early = sh7367_add_early_devices,
338 .init_irq = sh7367_init_irq,
339 .handle_irq = shmobile_handle_irq_intc,
340 .init_machine = g3evm_init,
341 .init_late = shmobile_init_late,
342 .timer = &shmobile_timer,
343MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
deleted file mode 100644
index 35c126caa4d..00000000000
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ /dev/null
@@ -1,384 +0,0 @@
1/*
2 * G4EVM board support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/delay.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h>
29#include <linux/regulator/fixed.h>
30#include <linux/regulator/machine.h>
31#include <linux/usb/r8a66597.h>
32#include <linux/io.h>
33#include <linux/input.h>
34#include <linux/input/sh_keysc.h>
35#include <linux/mmc/host.h>
36#include <linux/mmc/sh_mobile_sdhi.h>
37#include <linux/gpio.h>
38#include <linux/dma-mapping.h>
39#include <mach/irqs.h>
40#include <mach/sh7377.h>
41#include <mach/common.h>
42#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
44
45#include "sh-gpio.h"
46
47/*
48 * SDHI
49 *
50 * SDHI0 : card detection is possible
51 * SDHI1 : card detection is impossible
52 *
53 * [G4-MAIN-BOARD]
54 * JP74 : short # DBG_2V8A for SDHI0
55 * JP75 : NC # DBG_3V3A for SDHI0
56 * JP76 : NC # DBG_3V3A_SD for SDHI0
57 * JP77 : NC # 3V3A_SDIO for SDHI1
58 * JP78 : short # DBG_2V8A for SDHI1
59 * JP79 : NC # DBG_3V3A for SDHI1
60 * JP80 : NC # DBG_3V3A_SD for SDHI1
61 *
62 * [G4-CORE-BOARD]
63 * S32 : all off # to dissever from G3-CORE_DBG board
64 * S33 : all off # to dissever from G3-CORE_DBG board
65 *
66 * [G3-CORE_DBG-BOARD]
67 * S1 : all off # to dissever from G3-CORE_DBG board
68 * S3 : all off # to dissever from G3-CORE_DBG board
69 * S4 : all off # to dissever from G3-CORE_DBG board
70 */
71
72static struct mtd_partition nor_flash_partitions[] = {
73 {
74 .name = "loader",
75 .offset = 0x00000000,
76 .size = 512 * 1024,
77 },
78 {
79 .name = "bootenv",
80 .offset = MTDPART_OFS_APPEND,
81 .size = 512 * 1024,
82 },
83 {
84 .name = "kernel_ro",
85 .offset = MTDPART_OFS_APPEND,
86 .size = 8 * 1024 * 1024,
87 .mask_flags = MTD_WRITEABLE,
88 },
89 {
90 .name = "kernel",
91 .offset = MTDPART_OFS_APPEND,
92 .size = 8 * 1024 * 1024,
93 },
94 {
95 .name = "data",
96 .offset = MTDPART_OFS_APPEND,
97 .size = MTDPART_SIZ_FULL,
98 },
99};
100
101static struct physmap_flash_data nor_flash_data = {
102 .width = 2,
103 .parts = nor_flash_partitions,
104 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
105};
106
107static struct resource nor_flash_resources[] = {
108 [0] = {
109 .start = 0x00000000,
110 .end = 0x08000000 - 1,
111 .flags = IORESOURCE_MEM,
112 }
113};
114
115static struct platform_device nor_flash_device = {
116 .name = "physmap-flash",
117 .dev = {
118 .platform_data = &nor_flash_data,
119 },
120 .num_resources = ARRAY_SIZE(nor_flash_resources),
121 .resource = nor_flash_resources,
122};
123
124/* USBHS */
125static void usb_host_port_power(int port, int power)
126{
127 if (!power) /* only power-on supported for now */
128 return;
129
130 /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */
131 __raw_writew(__raw_readw(IOMEM(0xe6890008)) | 0x600, IOMEM(0xe6890008));
132}
133
134static struct r8a66597_platdata usb_host_data = {
135 .on_chip = 1,
136 .port_power = usb_host_port_power,
137};
138
139static struct resource usb_host_resources[] = {
140 [0] = {
141 .name = "USBHS",
142 .start = 0xe6890000,
143 .end = 0xe68900e5,
144 .flags = IORESOURCE_MEM,
145 },
146 [1] = {
147 .start = evt2irq(0x0a20), /* USBHS_USHI0 */
148 .flags = IORESOURCE_IRQ,
149 },
150};
151
152static struct platform_device usb_host_device = {
153 .name = "r8a66597_hcd",
154 .id = 0,
155 .dev = {
156 .platform_data = &usb_host_data,
157 .dma_mask = NULL,
158 .coherent_dma_mask = 0xffffffff,
159 },
160 .num_resources = ARRAY_SIZE(usb_host_resources),
161 .resource = usb_host_resources,
162};
163
164/* KEYSC */
165static struct sh_keysc_info keysc_info = {
166 .mode = SH_KEYSC_MODE_5,
167 .scan_timing = 3,
168 .delay = 100,
169 .keycodes = {
170 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F,
171 KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L,
172 KEY_M, KEY_N, KEY_U, KEY_P, KEY_Q, KEY_R,
173 KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X,
174 KEY_Y, KEY_Z, KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE,
175 KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5,
176 KEY_6, KEY_7, KEY_8, KEY_9, KEY_STOP, KEY_COMPUTER,
177 },
178};
179
180static struct resource keysc_resources[] = {
181 [0] = {
182 .name = "KEYSC",
183 .start = 0xe61b0000,
184 .end = 0xe61b000f,
185 .flags = IORESOURCE_MEM,
186 },
187 [1] = {
188 .start = evt2irq(0x0be0), /* KEYSC_KEY */
189 .flags = IORESOURCE_IRQ,
190 },
191};
192
193static struct platform_device keysc_device = {
194 .name = "sh_keysc",
195 .id = 0, /* keysc0 clock */
196 .num_resources = ARRAY_SIZE(keysc_resources),
197 .resource = keysc_resources,
198 .dev = {
199 .platform_data = &keysc_info,
200 },
201};
202
203/* Fixed 3.3V regulator to be used by SDHI0 and SDHI1 */
204static struct regulator_consumer_supply fixed3v3_power_consumers[] =
205{
206 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
207 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
208 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
209 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
210};
211
212/* SDHI */
213static struct sh_mobile_sdhi_info sdhi0_info = {
214 .tmio_caps = MMC_CAP_SDIO_IRQ,
215};
216
217static struct resource sdhi0_resources[] = {
218 [0] = {
219 .name = "SDHI0",
220 .start = 0xe6d50000,
221 .end = 0xe6d500ff,
222 .flags = IORESOURCE_MEM,
223 },
224 [1] = {
225 .start = evt2irq(0x0e00), /* SDHI0 */
226 .flags = IORESOURCE_IRQ,
227 },
228};
229
230static struct platform_device sdhi0_device = {
231 .name = "sh_mobile_sdhi",
232 .num_resources = ARRAY_SIZE(sdhi0_resources),
233 .resource = sdhi0_resources,
234 .id = 0,
235 .dev = {
236 .platform_data = &sdhi0_info,
237 },
238};
239
240static struct sh_mobile_sdhi_info sdhi1_info = {
241 .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ,
242};
243
244static struct resource sdhi1_resources[] = {
245 [0] = {
246 .name = "SDHI1",
247 .start = 0xe6d60000,
248 .end = 0xe6d600ff,
249 .flags = IORESOURCE_MEM,
250 },
251 [1] = {
252 .start = evt2irq(0x0e80), /* SDHI1 */
253 .flags = IORESOURCE_IRQ,
254 },
255};
256
257static struct platform_device sdhi1_device = {
258 .name = "sh_mobile_sdhi",
259 .num_resources = ARRAY_SIZE(sdhi1_resources),
260 .resource = sdhi1_resources,
261 .id = 1,
262 .dev = {
263 .platform_data = &sdhi1_info,
264 },
265};
266
267static struct platform_device *g4evm_devices[] __initdata = {
268 &nor_flash_device,
269 &usb_host_device,
270 &keysc_device,
271 &sdhi0_device,
272 &sdhi1_device,
273};
274
275#define GPIO_SDHID0_D0 IOMEM(0xe60520fc)
276#define GPIO_SDHID0_D1 IOMEM(0xe60520fd)
277#define GPIO_SDHID0_D2 IOMEM(0xe60520fe)
278#define GPIO_SDHID0_D3 IOMEM(0xe60520ff)
279#define GPIO_SDHICMD0 IOMEM(0xe6052100)
280
281#define GPIO_SDHID1_D0 IOMEM(0xe6052103)
282#define GPIO_SDHID1_D1 IOMEM(0xe6052104)
283#define GPIO_SDHID1_D2 IOMEM(0xe6052105)
284#define GPIO_SDHID1_D3 IOMEM(0xe6052106)
285#define GPIO_SDHICMD1 IOMEM(0xe6052107)
286
287static void __init g4evm_init(void)
288{
289 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
290 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
291
292 sh7377_pinmux_init();
293
294 /* Lit DS14 LED */
295 gpio_request(GPIO_PORT109, NULL);
296 gpio_direction_output(GPIO_PORT109, 1);
297 gpio_export(GPIO_PORT109, 1);
298
299 /* Lit DS15 LED */
300 gpio_request(GPIO_PORT110, NULL);
301 gpio_direction_output(GPIO_PORT110, 1);
302 gpio_export(GPIO_PORT110, 1);
303
304 /* Lit DS16 LED */
305 gpio_request(GPIO_PORT112, NULL);
306 gpio_direction_output(GPIO_PORT112, 1);
307 gpio_export(GPIO_PORT112, 1);
308
309 /* Lit DS17 LED */
310 gpio_request(GPIO_PORT113, NULL);
311 gpio_direction_output(GPIO_PORT113, 1);
312 gpio_export(GPIO_PORT113, 1);
313
314 /* USBHS */
315 gpio_request(GPIO_FN_VBUS_0, NULL);
316 gpio_request(GPIO_FN_PWEN, NULL);
317 gpio_request(GPIO_FN_OVCN, NULL);
318 gpio_request(GPIO_FN_OVCN2, NULL);
319 gpio_request(GPIO_FN_EXTLP, NULL);
320 gpio_request(GPIO_FN_IDIN, NULL);
321
322 /* setup USB phy */
323 __raw_writew(0x0200, IOMEM(0xe605810a)); /* USBCR1 */
324 __raw_writew(0x00e0, IOMEM(0xe60581c0)); /* CPFCH */
325 __raw_writew(0x6010, IOMEM(0xe60581c6)); /* CGPOSR */
326 __raw_writew(0x8a0a, IOMEM(0xe605810c)); /* USBCR2 */
327
328 /* KEYSC @ CN31 */
329 gpio_request(GPIO_FN_PORT60_KEYOUT5, NULL);
330 gpio_request(GPIO_FN_PORT61_KEYOUT4, NULL);
331 gpio_request(GPIO_FN_PORT62_KEYOUT3, NULL);
332 gpio_request(GPIO_FN_PORT63_KEYOUT2, NULL);
333 gpio_request(GPIO_FN_PORT64_KEYOUT1, NULL);
334 gpio_request(GPIO_FN_PORT65_KEYOUT0, NULL);
335 gpio_request(GPIO_FN_PORT66_KEYIN0_PU, NULL);
336 gpio_request(GPIO_FN_PORT67_KEYIN1_PU, NULL);
337 gpio_request(GPIO_FN_PORT68_KEYIN2_PU, NULL);
338 gpio_request(GPIO_FN_PORT69_KEYIN3_PU, NULL);
339 gpio_request(GPIO_FN_PORT70_KEYIN4_PU, NULL);
340 gpio_request(GPIO_FN_PORT71_KEYIN5_PU, NULL);
341 gpio_request(GPIO_FN_PORT72_KEYIN6_PU, NULL);
342
343 /* SDHI0 */
344 gpio_request(GPIO_FN_SDHICLK0, NULL);
345 gpio_request(GPIO_FN_SDHICD0, NULL);
346 gpio_request(GPIO_FN_SDHID0_0, NULL);
347 gpio_request(GPIO_FN_SDHID0_1, NULL);
348 gpio_request(GPIO_FN_SDHID0_2, NULL);
349 gpio_request(GPIO_FN_SDHID0_3, NULL);
350 gpio_request(GPIO_FN_SDHICMD0, NULL);
351 gpio_request(GPIO_FN_SDHIWP0, NULL);
352 gpio_request_pullup(GPIO_SDHID0_D0);
353 gpio_request_pullup(GPIO_SDHID0_D1);
354 gpio_request_pullup(GPIO_SDHID0_D2);
355 gpio_request_pullup(GPIO_SDHID0_D3);
356 gpio_request_pullup(GPIO_SDHICMD0);
357
358 /* SDHI1 */
359 gpio_request(GPIO_FN_SDHICLK1, NULL);
360 gpio_request(GPIO_FN_SDHID1_0, NULL);
361 gpio_request(GPIO_FN_SDHID1_1, NULL);
362 gpio_request(GPIO_FN_SDHID1_2, NULL);
363 gpio_request(GPIO_FN_SDHID1_3, NULL);
364 gpio_request(GPIO_FN_SDHICMD1, NULL);
365 gpio_request_pullup(GPIO_SDHID1_D0);
366 gpio_request_pullup(GPIO_SDHID1_D1);
367 gpio_request_pullup(GPIO_SDHID1_D2);
368 gpio_request_pullup(GPIO_SDHID1_D3);
369 gpio_request_pullup(GPIO_SDHICMD1);
370
371 sh7377_add_standard_devices();
372
373 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices));
374}
375
376MACHINE_START(G4EVM, "g4evm")
377 .map_io = sh7377_map_io,
378 .init_early = sh7377_add_early_devices,
379 .init_irq = sh7377_init_irq,
380 .handle_irq = shmobile_handle_irq_intc,
381 .init_machine = g4evm_init,
382 .init_late = shmobile_init_late,
383 .timer = &shmobile_timer,
384MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 0a43f3189c2..c02448d6847 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -384,6 +384,8 @@ static struct regulator_consumer_supply fixed2v8_power_consumers[] =
384 384
385/* SDHI */ 385/* SDHI */
386static struct sh_mobile_sdhi_info sdhi0_info = { 386static struct sh_mobile_sdhi_info sdhi0_info = {
387 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
388 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
387 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 389 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
388 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 390 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
389 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 391 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
@@ -424,6 +426,8 @@ static struct platform_device sdhi0_device = {
424 426
425/* Micro SD */ 427/* Micro SD */
426static struct sh_mobile_sdhi_info sdhi2_info = { 428static struct sh_mobile_sdhi_info sdhi2_info = {
429 .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX,
430 .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX,
427 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | 431 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
428 TMIO_MMC_USE_GPIO_CD | 432 TMIO_MMC_USE_GPIO_CD |
429 TMIO_MMC_WRPROTECT_DISABLE, 433 TMIO_MMC_WRPROTECT_DISABLE,
@@ -548,7 +552,6 @@ static struct platform_device fsi_ak4648_device = {
548/* I2C */ 552/* I2C */
549static struct pcf857x_platform_data pcf8575_pdata = { 553static struct pcf857x_platform_data pcf8575_pdata = {
550 .gpio_base = GPIO_PCF8575_BASE, 554 .gpio_base = GPIO_PCF8575_BASE,
551 .irq = intcs_evt2irq(0x3260), /* IRQ19 */
552}; 555};
553 556
554static struct i2c_board_info i2c0_devices[] = { 557static struct i2c_board_info i2c0_devices[] = {
@@ -557,7 +560,15 @@ static struct i2c_board_info i2c0_devices[] = {
557 }, 560 },
558 { 561 {
559 I2C_BOARD_INFO("r2025sd", 0x32), 562 I2C_BOARD_INFO("r2025sd", 0x32),
560 } 563 },
564 {
565 I2C_BOARD_INFO("ak8975", 0x0c),
566 .irq = intcs_evt2irq(0x3380), /* IRQ28 */
567 },
568 {
569 I2C_BOARD_INFO("adxl34x", 0x1d),
570 .irq = intcs_evt2irq(0x3340), /* IRQ26 */
571 },
561}; 572};
562 573
563static struct i2c_board_info i2c1_devices[] = { 574static struct i2c_board_info i2c1_devices[] = {
@@ -570,6 +581,7 @@ static struct i2c_board_info i2c1_devices[] = {
570static struct i2c_board_info i2c3_devices[] = { 581static struct i2c_board_info i2c3_devices[] = {
571 { 582 {
572 I2C_BOARD_INFO("pcf8575", 0x20), 583 I2C_BOARD_INFO("pcf8575", 0x20),
584 .irq = intcs_evt2irq(0x3260), /* IRQ19 */
573 .platform_data = &pcf8575_pdata, 585 .platform_data = &pcf8575_pdata,
574 }, 586 },
575}; 587};
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0c27c810cf9..3f56e70795b 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -816,6 +816,8 @@ static struct platform_device usbhs1_device = {
816 .id = 1, 816 .id = 1,
817 .dev = { 817 .dev = {
818 .platform_data = &usbhs1_private.info, 818 .platform_data = &usbhs1_private.info,
819 .dma_mask = &usbhs1_device.dev.coherent_dma_mask,
820 .coherent_dma_mask = DMA_BIT_MASK(32),
819 }, 821 },
820 .num_resources = ARRAY_SIZE(usbhs1_resources), 822 .num_resources = ARRAY_SIZE(usbhs1_resources),
821 .resource = usbhs1_resources, 823 .resource = usbhs1_resources,
@@ -860,76 +862,6 @@ static struct platform_device leds_device = {
860 862
861/* FSI */ 863/* FSI */
862#define IRQ_FSI evt2irq(0x1840) 864#define IRQ_FSI evt2irq(0x1840)
863static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
864{
865 int ret;
866
867 if (rate <= 0)
868 return 0;
869
870 if (!enable) {
871 clk_disable(clk);
872 return 0;
873 }
874
875 ret = clk_set_rate(clk, clk_round_rate(clk, rate));
876 if (ret < 0)
877 return ret;
878
879 return clk_enable(clk);
880}
881
882static int fsi_b_set_rate(struct device *dev, int rate, int enable)
883{
884 struct clk *fsib_clk;
885 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
886 long fsib_rate = 0;
887 long fdiv_rate = 0;
888 int ackmd_bpfmd;
889 int ret;
890
891 /* clock start */
892 switch (rate) {
893 case 44100:
894 fsib_rate = rate * 256;
895 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
896 break;
897 case 48000:
898 fsib_rate = 85428000; /* around 48kHz x 256 x 7 */
899 fdiv_rate = rate * 256;
900 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
901 break;
902 default:
903 pr_err("unsupported rate in FSI2 port B\n");
904 return -EINVAL;
905 }
906
907 /* FSI B setting */
908 fsib_clk = clk_get(dev, "ickb");
909 if (IS_ERR(fsib_clk))
910 return -EIO;
911
912 /* fsib */
913 ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
914 if (ret < 0)
915 goto fsi_set_rate_end;
916
917 /* FSI DIV */
918 ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
919 if (ret < 0) {
920 /* disable FSI B */
921 if (enable)
922 __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
923 goto fsi_set_rate_end;
924 }
925
926 ret = ackmd_bpfmd;
927
928fsi_set_rate_end:
929 clk_put(fsib_clk);
930 return ret;
931}
932
933static struct sh_fsi_platform_info fsi_info = { 865static struct sh_fsi_platform_info fsi_info = {
934 .port_a = { 866 .port_a = {
935 .flags = SH_FSI_BRS_INV, 867 .flags = SH_FSI_BRS_INV,
@@ -940,8 +872,8 @@ static struct sh_fsi_platform_info fsi_info = {
940 .flags = SH_FSI_BRS_INV | 872 .flags = SH_FSI_BRS_INV |
941 SH_FSI_BRM_INV | 873 SH_FSI_BRM_INV |
942 SH_FSI_LRS_INV | 874 SH_FSI_LRS_INV |
875 SH_FSI_CLK_CPG |
943 SH_FSI_FMT_SPDIF, 876 SH_FSI_FMT_SPDIF,
944 .set_rate = fsi_b_set_rate,
945 } 877 }
946}; 878};
947 879
@@ -1018,7 +950,11 @@ static struct resource nand_flash_resources[] = {
1018 .start = 0xe6a30000, 950 .start = 0xe6a30000,
1019 .end = 0xe6a3009b, 951 .end = 0xe6a3009b,
1020 .flags = IORESOURCE_MEM, 952 .flags = IORESOURCE_MEM,
1021 } 953 },
954 [1] = {
955 .start = evt2irq(0x0d80), /* flstei: status error irq */
956 .flags = IORESOURCE_IRQ,
957 },
1022}; 958};
1023 959
1024static struct sh_flctl_platform_data nand_flash_data = { 960static struct sh_flctl_platform_data nand_flash_data = {
@@ -1651,7 +1587,12 @@ static void __init mackerel_init(void)
1651 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi"); 1587 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi");
1652} 1588}
1653 1589
1654MACHINE_START(MACKEREL, "mackerel") 1590static const char *mackerel_boards_compat_dt[] __initdata = {
1591 "renesas,mackerel",
1592 NULL,
1593};
1594
1595DT_MACHINE_START(MACKEREL_DT, "mackerel")
1655 .map_io = sh7372_map_io, 1596 .map_io = sh7372_map_io,
1656 .init_early = sh7372_add_early_devices, 1597 .init_early = sh7372_add_early_devices,
1657 .init_irq = sh7372_init_irq, 1598 .init_irq = sh7372_init_irq,
@@ -1659,4 +1600,5 @@ MACHINE_START(MACKEREL, "mackerel")
1659 .init_machine = mackerel_init, 1600 .init_machine = mackerel_init,
1660 .init_late = sh7372_pm_init_late, 1601 .init_late = sh7372_pm_init_late,
1661 .timer = &shmobile_timer, 1602 .timer = &shmobile_timer,
1603 .dt_compat = mackerel_boards_compat_dt,
1662MACHINE_END 1604MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index b8a7525a4e2..449f9289567 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -30,8 +30,14 @@
30#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/smsc911x.h> 32#include <linux/smsc911x.h>
33#include <linux/spi/spi.h>
34#include <linux/spi/sh_hspi.h>
33#include <linux/mmc/sh_mobile_sdhi.h> 35#include <linux/mmc/sh_mobile_sdhi.h>
34#include <linux/mfd/tmio.h> 36#include <linux/mfd/tmio.h>
37#include <linux/usb/otg.h>
38#include <linux/usb/ehci_pdriver.h>
39#include <linux/usb/ohci_pdriver.h>
40#include <linux/pm_runtime.h>
35#include <mach/hardware.h> 41#include <mach/hardware.h>
36#include <mach/r8a7779.h> 42#include <mach/r8a7779.h>
37#include <mach/common.h> 43#include <mach/common.h>
@@ -126,12 +132,201 @@ static struct platform_device thermal_device = {
126 .num_resources = ARRAY_SIZE(thermal_resources), 132 .num_resources = ARRAY_SIZE(thermal_resources),
127}; 133};
128 134
135/* HSPI */
136static struct resource hspi_resources[] = {
137 [0] = {
138 .start = 0xFFFC7000,
139 .end = 0xFFFC7018 - 1,
140 .flags = IORESOURCE_MEM,
141 },
142};
143
144static struct platform_device hspi_device = {
145 .name = "sh-hspi",
146 .id = 0,
147 .resource = hspi_resources,
148 .num_resources = ARRAY_SIZE(hspi_resources),
149};
150
151/* USB PHY */
152static struct resource usb_phy_resources[] = {
153 [0] = {
154 .start = 0xffe70000,
155 .end = 0xffe70900 - 1,
156 .flags = IORESOURCE_MEM,
157 },
158 [1] = {
159 .start = 0xfff70000,
160 .end = 0xfff70900 - 1,
161 .flags = IORESOURCE_MEM,
162 },
163};
164
165static struct platform_device usb_phy_device = {
166 .name = "rcar_usb_phy",
167 .resource = usb_phy_resources,
168 .num_resources = ARRAY_SIZE(usb_phy_resources),
169};
170
129static struct platform_device *marzen_devices[] __initdata = { 171static struct platform_device *marzen_devices[] __initdata = {
130 &eth_device, 172 &eth_device,
131 &sdhi0_device, 173 &sdhi0_device,
132 &thermal_device, 174 &thermal_device,
175 &hspi_device,
176 &usb_phy_device,
133}; 177};
134 178
179/* USB */
180static struct usb_phy *phy;
181static int usb_power_on(struct platform_device *pdev)
182{
183 if (!phy)
184 return -EIO;
185
186 pm_runtime_enable(&pdev->dev);
187 pm_runtime_get_sync(&pdev->dev);
188
189 usb_phy_init(phy);
190
191 return 0;
192}
193
194static void usb_power_off(struct platform_device *pdev)
195{
196 if (!phy)
197 return;
198
199 usb_phy_shutdown(phy);
200
201 pm_runtime_put_sync(&pdev->dev);
202 pm_runtime_disable(&pdev->dev);
203}
204
205static struct usb_ehci_pdata ehcix_pdata = {
206 .power_on = usb_power_on,
207 .power_off = usb_power_off,
208 .power_suspend = usb_power_off,
209};
210
211static struct resource ehci0_resources[] = {
212 [0] = {
213 .start = 0xffe70000,
214 .end = 0xffe70400 - 1,
215 .flags = IORESOURCE_MEM,
216 },
217 [1] = {
218 .start = gic_spi(44),
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static struct platform_device ehci0_device = {
224 .name = "ehci-platform",
225 .id = 0,
226 .dev = {
227 .dma_mask = &ehci0_device.dev.coherent_dma_mask,
228 .coherent_dma_mask = 0xffffffff,
229 .platform_data = &ehcix_pdata,
230 },
231 .num_resources = ARRAY_SIZE(ehci0_resources),
232 .resource = ehci0_resources,
233};
234
235static struct resource ehci1_resources[] = {
236 [0] = {
237 .start = 0xfff70000,
238 .end = 0xfff70400 - 1,
239 .flags = IORESOURCE_MEM,
240 },
241 [1] = {
242 .start = gic_spi(45),
243 .flags = IORESOURCE_IRQ,
244 },
245};
246
247static struct platform_device ehci1_device = {
248 .name = "ehci-platform",
249 .id = 1,
250 .dev = {
251 .dma_mask = &ehci1_device.dev.coherent_dma_mask,
252 .coherent_dma_mask = 0xffffffff,
253 .platform_data = &ehcix_pdata,
254 },
255 .num_resources = ARRAY_SIZE(ehci1_resources),
256 .resource = ehci1_resources,
257};
258
259static struct usb_ohci_pdata ohcix_pdata = {
260 .power_on = usb_power_on,
261 .power_off = usb_power_off,
262 .power_suspend = usb_power_off,
263};
264
265static struct resource ohci0_resources[] = {
266 [0] = {
267 .start = 0xffe70400,
268 .end = 0xffe70800 - 1,
269 .flags = IORESOURCE_MEM,
270 },
271 [1] = {
272 .start = gic_spi(44),
273 .flags = IORESOURCE_IRQ,
274 },
275};
276
277static struct platform_device ohci0_device = {
278 .name = "ohci-platform",
279 .id = 0,
280 .dev = {
281 .dma_mask = &ohci0_device.dev.coherent_dma_mask,
282 .coherent_dma_mask = 0xffffffff,
283 .platform_data = &ohcix_pdata,
284 },
285 .num_resources = ARRAY_SIZE(ohci0_resources),
286 .resource = ohci0_resources,
287};
288
289static struct resource ohci1_resources[] = {
290 [0] = {
291 .start = 0xfff70400,
292 .end = 0xfff70800 - 1,
293 .flags = IORESOURCE_MEM,
294 },
295 [1] = {
296 .start = gic_spi(45),
297 .flags = IORESOURCE_IRQ,
298 },
299};
300
301static struct platform_device ohci1_device = {
302 .name = "ohci-platform",
303 .id = 1,
304 .dev = {
305 .dma_mask = &ohci1_device.dev.coherent_dma_mask,
306 .coherent_dma_mask = 0xffffffff,
307 .platform_data = &ohcix_pdata,
308 },
309 .num_resources = ARRAY_SIZE(ohci1_resources),
310 .resource = ohci1_resources,
311};
312
313static struct platform_device *marzen_late_devices[] __initdata = {
314 &ehci0_device,
315 &ehci1_device,
316 &ohci0_device,
317 &ohci1_device,
318};
319
320void __init marzen_init_late(void)
321{
322 /* get usb phy */
323 phy = usb_get_phy(USB_PHY_TYPE_USB2);
324
325 shmobile_init_late();
326 platform_add_devices(marzen_late_devices,
327 ARRAY_SIZE(marzen_late_devices));
328}
329
135static void __init marzen_init(void) 330static void __init marzen_init(void)
136{ 331{
137 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 332 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
@@ -163,6 +358,20 @@ static void __init marzen_init(void)
163 gpio_request(GPIO_FN_SD0_CD, NULL); 358 gpio_request(GPIO_FN_SD0_CD, NULL);
164 gpio_request(GPIO_FN_SD0_WP, NULL); 359 gpio_request(GPIO_FN_SD0_WP, NULL);
165 360
361 /* HSPI 0 */
362 gpio_request(GPIO_FN_HSPI_CLK0, NULL);
363 gpio_request(GPIO_FN_HSPI_CS0, NULL);
364 gpio_request(GPIO_FN_HSPI_TX0, NULL);
365 gpio_request(GPIO_FN_HSPI_RX0, NULL);
366
367 /* USB (CN21) */
368 gpio_request(GPIO_FN_USB_OVC0, NULL);
369 gpio_request(GPIO_FN_USB_OVC1, NULL);
370 gpio_request(GPIO_FN_USB_OVC2, NULL);
371
372 /* USB (CN22) */
373 gpio_request(GPIO_FN_USB_PENC2, NULL);
374
166 r8a7779_add_standard_devices(); 375 r8a7779_add_standard_devices();
167 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 376 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
168} 377}
@@ -175,6 +384,6 @@ MACHINE_START(MARZEN, "marzen")
175 .init_irq = r8a7779_init_irq, 384 .init_irq = r8a7779_init_irq,
176 .handle_irq = gic_handle_irq, 385 .handle_irq = gic_handle_irq,
177 .init_machine = marzen_init, 386 .init_machine = marzen_init,
178 .init_late = shmobile_init_late, 387 .init_late = marzen_init_late,
179 .timer = &shmobile_timer, 388 .timer = &shmobile_timer,
180MACHINE_END 389MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 6729e003218..eac49d59782 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -65,6 +65,9 @@
65#define SMSTPCR3 IOMEM(0xe615013c) 65#define SMSTPCR3 IOMEM(0xe615013c)
66#define SMSTPCR4 IOMEM(0xe6150140) 66#define SMSTPCR4 IOMEM(0xe6150140)
67 67
68#define FSIDIVA IOMEM(0xFE1F8000)
69#define FSIDIVB IOMEM(0xFE1F8008)
70
68/* Fixed 32 KHz root clock from EXTALR pin */ 71/* Fixed 32 KHz root clock from EXTALR pin */
69static struct clk extalr_clk = { 72static struct clk extalr_clk = {
70 .rate = 32768, 73 .rate = 32768,
@@ -188,6 +191,22 @@ static struct clk pllc1_div2_clk = {
188}; 191};
189 192
190/* USB clock */ 193/* USB clock */
194/*
195 * USBCKCR is controlling usb24 clock
196 * bit[7] : parent clock
197 * bit[6] : clock divide rate
198 * And this bit[7] is used as a "usb24s" from other devices.
199 * (Video clock / Sub clock / SPU clock)
200 * You can controll this clock as a below.
201 *
202 * struct clk *usb24 = clk_get(dev, "usb24");
203 * struct clk *usb24s = clk_get(NULL, "usb24s");
204 * struct clk *system = clk_get(NULL, "system_clk");
205 * int rate = clk_get_rate(system);
206 *
207 * clk_set_parent(usb24s, system); // for bit[7]
208 * clk_set_rate(usb24, rate / 2); // for bit[6]
209 */
191static struct clk *usb24s_parents[] = { 210static struct clk *usb24s_parents[] = {
192 [0] = &system_clk, 211 [0] = &system_clk,
193 [1] = &extal2_clk 212 [1] = &extal2_clk
@@ -427,6 +446,14 @@ static struct clk *late_main_clks[] = {
427 &hdmi2_clk, 446 &hdmi2_clk,
428}; 447};
429 448
449/* FSI DIV */
450enum { FSIDIV_A, FSIDIV_B, FSIDIV_REPARENT_NR };
451
452static struct clk fsidivs[] = {
453 [FSIDIV_A] = SH_CLK_FSIDIV(FSIDIVA, &div6_reparent_clks[DIV6_FSIA]),
454 [FSIDIV_B] = SH_CLK_FSIDIV(FSIDIVB, &div6_reparent_clks[DIV6_FSIB]),
455};
456
430/* MSTP */ 457/* MSTP */
431enum { 458enum {
432 DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP, 459 DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP,
@@ -596,6 +623,10 @@ static struct clk_lookup lookups[] = {
596 623
597 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), 624 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
598 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), 625 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
626 CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]),
627 CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]),
628 CLKDEV_ICK_ID("xcka", "sh_fsi2", &fsiack_clk),
629 CLKDEV_ICK_ID("xckb", "sh_fsi2", &fsibck_clk),
599}; 630};
600 631
601void __init r8a7740_clock_init(u8 md_ck) 632void __init r8a7740_clock_init(u8 md_ck)
@@ -641,6 +672,9 @@ void __init r8a7740_clock_init(u8 md_ck)
641 for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) 672 for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
642 ret = clk_register(late_main_clks[k]); 673 ret = clk_register(late_main_clks[k]);
643 674
675 if (!ret)
676 ret = sh_clk_fsidiv_register(fsidivs, FSIDIV_REPARENT_NR);
677
644 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 678 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
645 679
646 if (!ret) 680 if (!ret)
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 37b2a3133b3..c019609da66 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -87,8 +87,11 @@ static struct clk div4_clks[DIV4_NR] = {
87}; 87};
88 88
89enum { MSTP323, MSTP322, MSTP321, MSTP320, 89enum { MSTP323, MSTP322, MSTP321, MSTP320,
90 MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 90 MSTP101, MSTP100,
91 MSTP030,
92 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
91 MSTP016, MSTP015, MSTP014, 93 MSTP016, MSTP015, MSTP014,
94 MSTP007,
92 MSTP_NR }; 95 MSTP_NR };
93 96
94static struct clk mstp_clks[MSTP_NR] = { 97static struct clk mstp_clks[MSTP_NR] = {
@@ -96,6 +99,12 @@ static struct clk mstp_clks[MSTP_NR] = {
96 [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ 99 [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */
97 [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ 100 [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */
98 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ 101 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */
102 [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */
103 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */
104 [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */
105 [MSTP029] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 29, 0), /* I2C1 */
106 [MSTP028] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 28, 0), /* I2C2 */
107 [MSTP027] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 27, 0), /* I2C3 */
99 [MSTP026] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 26, 0), /* SCIF0 */ 108 [MSTP026] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 26, 0), /* SCIF0 */
100 [MSTP025] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 25, 0), /* SCIF1 */ 109 [MSTP025] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 25, 0), /* SCIF1 */
101 [MSTP024] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 24, 0), /* SCIF2 */ 110 [MSTP024] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 24, 0), /* SCIF2 */
@@ -105,6 +114,7 @@ static struct clk mstp_clks[MSTP_NR] = {
105 [MSTP016] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 16, 0), /* TMU0 */ 114 [MSTP016] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 16, 0), /* TMU0 */
106 [MSTP015] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 15, 0), /* TMU1 */ 115 [MSTP015] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 15, 0), /* TMU1 */
107 [MSTP014] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 14, 0), /* TMU2 */ 116 [MSTP014] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 14, 0), /* TMU2 */
117 [MSTP007] = SH_CLK_MSTP32(&div4_clks[DIV4_S], MSTPCR0, 7, 0), /* HSPI */
108}; 118};
109 119
110static unsigned long mul4_recalc(struct clk *clk) 120static unsigned long mul4_recalc(struct clk *clk)
@@ -146,14 +156,25 @@ static struct clk_lookup lookups[] = {
146 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), 156 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]),
147 157
148 /* MSTP32 clocks */ 158 /* MSTP32 clocks */
159 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
160 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
161 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
162 CLKDEV_DEV_ID("ohci-platform.0", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
149 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */ 163 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */
150 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */ 164 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */
165 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
166 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
167 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
168 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
151 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */ 169 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
152 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */ 170 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
153 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */ 171 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
154 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */ 172 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */
155 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */ 173 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
156 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */ 174 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
175 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
176 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
177 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
157 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */ 178 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
158 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ 179 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
159 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ 180 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
deleted file mode 100644
index ef0a95e592c..00000000000
--- a/arch/arm/mach-shmobile/clock-sh7367.c
+++ /dev/null
@@ -1,355 +0,0 @@
1/*
2 * SH7367 clock framework support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/io.h>
22#include <linux/sh_clk.h>
23#include <linux/clkdev.h>
24#include <mach/common.h>
25
26/* SH7367 registers */
27#define RTFRQCR IOMEM(0xe6150000)
28#define SYFRQCR IOMEM(0xe6150004)
29#define CMFRQCR IOMEM(0xe61500E0)
30#define VCLKCR1 IOMEM(0xe6150008)
31#define VCLKCR2 IOMEM(0xe615000C)
32#define VCLKCR3 IOMEM(0xe615001C)
33#define SCLKACR IOMEM(0xe6150010)
34#define SCLKBCR IOMEM(0xe6150014)
35#define SUBUSBCKCR IOMEM(0xe6158080)
36#define SPUCKCR IOMEM(0xe6150084)
37#define MSUCKCR IOMEM(0xe6150088)
38#define MVI3CKCR IOMEM(0xe6150090)
39#define VOUCKCR IOMEM(0xe6150094)
40#define MFCK1CR IOMEM(0xe6150098)
41#define MFCK2CR IOMEM(0xe615009C)
42#define PLLC1CR IOMEM(0xe6150028)
43#define PLLC2CR IOMEM(0xe615002C)
44#define RTMSTPCR0 IOMEM(0xe6158030)
45#define RTMSTPCR2 IOMEM(0xe6158038)
46#define SYMSTPCR0 IOMEM(0xe6158040)
47#define SYMSTPCR2 IOMEM(0xe6158048)
48#define CMMSTPCR0 IOMEM(0xe615804c)
49
50/* Fixed 32 KHz root clock from EXTALR pin */
51static struct clk r_clk = {
52 .rate = 32768,
53};
54
55/*
56 * 26MHz default rate for the EXTALB1 root input clock.
57 * If needed, reset this with clk_set_rate() from the platform code.
58 */
59struct clk sh7367_extalb1_clk = {
60 .rate = 26666666,
61};
62
63/*
64 * 48MHz default rate for the EXTAL2 root input clock.
65 * If needed, reset this with clk_set_rate() from the platform code.
66 */
67struct clk sh7367_extal2_clk = {
68 .rate = 48000000,
69};
70
71/* A fixed divide-by-2 block */
72static unsigned long div2_recalc(struct clk *clk)
73{
74 return clk->parent->rate / 2;
75}
76
77static struct sh_clk_ops div2_clk_ops = {
78 .recalc = div2_recalc,
79};
80
81/* Divide extalb1 by two */
82static struct clk extalb1_div2_clk = {
83 .ops = &div2_clk_ops,
84 .parent = &sh7367_extalb1_clk,
85};
86
87/* Divide extal2 by two */
88static struct clk extal2_div2_clk = {
89 .ops = &div2_clk_ops,
90 .parent = &sh7367_extal2_clk,
91};
92
93/* PLLC1 */
94static unsigned long pllc1_recalc(struct clk *clk)
95{
96 unsigned long mult = 1;
97
98 if (__raw_readl(PLLC1CR) & (1 << 14))
99 mult = (((__raw_readl(RTFRQCR) >> 24) & 0x3f) + 1) * 2;
100
101 return clk->parent->rate * mult;
102}
103
104static struct sh_clk_ops pllc1_clk_ops = {
105 .recalc = pllc1_recalc,
106};
107
108static struct clk pllc1_clk = {
109 .ops = &pllc1_clk_ops,
110 .flags = CLK_ENABLE_ON_INIT,
111 .parent = &extalb1_div2_clk,
112};
113
114/* Divide PLLC1 by two */
115static struct clk pllc1_div2_clk = {
116 .ops = &div2_clk_ops,
117 .parent = &pllc1_clk,
118};
119
120/* PLLC2 */
121static unsigned long pllc2_recalc(struct clk *clk)
122{
123 unsigned long mult = 1;
124
125 if (__raw_readl(PLLC2CR) & (1 << 31))
126 mult = (((__raw_readl(PLLC2CR) >> 24) & 0x3f) + 1) * 2;
127
128 return clk->parent->rate * mult;
129}
130
131static struct sh_clk_ops pllc2_clk_ops = {
132 .recalc = pllc2_recalc,
133};
134
135static struct clk pllc2_clk = {
136 .ops = &pllc2_clk_ops,
137 .flags = CLK_ENABLE_ON_INIT,
138 .parent = &extalb1_div2_clk,
139};
140
141static struct clk *main_clks[] = {
142 &r_clk,
143 &sh7367_extalb1_clk,
144 &sh7367_extal2_clk,
145 &extalb1_div2_clk,
146 &extal2_div2_clk,
147 &pllc1_clk,
148 &pllc1_div2_clk,
149 &pllc2_clk,
150};
151
152static void div4_kick(struct clk *clk)
153{
154 unsigned long value;
155
156 /* set KICK bit in SYFRQCR to update hardware setting */
157 value = __raw_readl(SYFRQCR);
158 value |= (1 << 31);
159 __raw_writel(value, SYFRQCR);
160}
161
162static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,
163 24, 32, 36, 48, 0, 72, 0, 0 };
164
165static struct clk_div_mult_table div4_div_mult_table = {
166 .divisors = divisors,
167 .nr_divisors = ARRAY_SIZE(divisors),
168};
169
170static struct clk_div4_table div4_table = {
171 .div_mult_table = &div4_div_mult_table,
172 .kick = div4_kick,
173};
174
175enum { DIV4_I, DIV4_G, DIV4_S, DIV4_B,
176 DIV4_ZX, DIV4_ZT, DIV4_Z, DIV4_ZD, DIV4_HP,
177 DIV4_ZS, DIV4_ZB, DIV4_ZB3, DIV4_CP, DIV4_NR };
178
179#define DIV4(_reg, _bit, _mask, _flags) \
180 SH_CLK_DIV4(&pllc1_clk, _reg, _bit, _mask, _flags)
181
182static struct clk div4_clks[DIV4_NR] = {
183 [DIV4_I] = DIV4(RTFRQCR, 20, 0x6fff, CLK_ENABLE_ON_INIT),
184 [DIV4_G] = DIV4(RTFRQCR, 16, 0x6fff, CLK_ENABLE_ON_INIT),
185 [DIV4_S] = DIV4(RTFRQCR, 12, 0x6fff, CLK_ENABLE_ON_INIT),
186 [DIV4_B] = DIV4(RTFRQCR, 8, 0x6fff, CLK_ENABLE_ON_INIT),
187 [DIV4_ZX] = DIV4(SYFRQCR, 20, 0x6fff, 0),
188 [DIV4_ZT] = DIV4(SYFRQCR, 16, 0x6fff, 0),
189 [DIV4_Z] = DIV4(SYFRQCR, 12, 0x6fff, 0),
190 [DIV4_ZD] = DIV4(SYFRQCR, 8, 0x6fff, 0),
191 [DIV4_HP] = DIV4(SYFRQCR, 4, 0x6fff, 0),
192 [DIV4_ZS] = DIV4(CMFRQCR, 12, 0x6fff, 0),
193 [DIV4_ZB] = DIV4(CMFRQCR, 8, 0x6fff, 0),
194 [DIV4_ZB3] = DIV4(CMFRQCR, 4, 0x6fff, 0),
195 [DIV4_CP] = DIV4(CMFRQCR, 0, 0x6fff, 0),
196};
197
198enum { DIV6_SUB, DIV6_SIUA, DIV6_SIUB, DIV6_MSU, DIV6_SPU,
199 DIV6_MVI3, DIV6_MF1, DIV6_MF2,
200 DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_VOU,
201 DIV6_NR };
202
203static struct clk div6_clks[DIV6_NR] = {
204 [DIV6_SUB] = SH_CLK_DIV6(&sh7367_extal2_clk, SUBUSBCKCR, 0),
205 [DIV6_SIUA] = SH_CLK_DIV6(&pllc1_div2_clk, SCLKACR, 0),
206 [DIV6_SIUB] = SH_CLK_DIV6(&pllc1_div2_clk, SCLKBCR, 0),
207 [DIV6_MSU] = SH_CLK_DIV6(&pllc1_div2_clk, MSUCKCR, 0),
208 [DIV6_SPU] = SH_CLK_DIV6(&pllc1_div2_clk, SPUCKCR, 0),
209 [DIV6_MVI3] = SH_CLK_DIV6(&pllc1_div2_clk, MVI3CKCR, 0),
210 [DIV6_MF1] = SH_CLK_DIV6(&pllc1_div2_clk, MFCK1CR, 0),
211 [DIV6_MF2] = SH_CLK_DIV6(&pllc1_div2_clk, MFCK2CR, 0),
212 [DIV6_VCK1] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR1, 0),
213 [DIV6_VCK2] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR2, 0),
214 [DIV6_VCK3] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR3, 0),
215 [DIV6_VOU] = SH_CLK_DIV6(&pllc1_div2_clk, VOUCKCR, 0),
216};
217
218enum { RTMSTP001,
219 RTMSTP231, RTMSTP230, RTMSTP229, RTMSTP228, RTMSTP226,
220 RTMSTP216, RTMSTP206, RTMSTP205, RTMSTP201,
221 SYMSTP023, SYMSTP007, SYMSTP006, SYMSTP004,
222 SYMSTP003, SYMSTP002, SYMSTP001, SYMSTP000,
223 SYMSTP231, SYMSTP229, SYMSTP225, SYMSTP223, SYMSTP222,
224 SYMSTP215, SYMSTP214, SYMSTP213, SYMSTP211,
225 CMMSTP003,
226 MSTP_NR };
227
228#define MSTP(_parent, _reg, _bit, _flags) \
229 SH_CLK_MSTP32(_parent, _reg, _bit, _flags)
230
231static struct clk mstp_clks[MSTP_NR] = {
232 [RTMSTP001] = MSTP(&div6_clks[DIV6_SUB], RTMSTPCR0, 1, 0), /* IIC2 */
233 [RTMSTP231] = MSTP(&div4_clks[DIV4_B], RTMSTPCR2, 31, 0), /* VEU3 */
234 [RTMSTP230] = MSTP(&div4_clks[DIV4_B], RTMSTPCR2, 30, 0), /* VEU2 */
235 [RTMSTP229] = MSTP(&div4_clks[DIV4_B], RTMSTPCR2, 29, 0), /* VEU1 */
236 [RTMSTP228] = MSTP(&div4_clks[DIV4_B], RTMSTPCR2, 28, 0), /* VEU0 */
237 [RTMSTP226] = MSTP(&div4_clks[DIV4_B], RTMSTPCR2, 26, 0), /* VEU2H */
238 [RTMSTP216] = MSTP(&div6_clks[DIV6_SUB], RTMSTPCR2, 16, 0), /* IIC0 */
239 [RTMSTP206] = MSTP(&div4_clks[DIV4_B], RTMSTPCR2, 6, 0), /* JPU */
240 [RTMSTP205] = MSTP(&div6_clks[DIV6_VOU], RTMSTPCR2, 5, 0), /* VOU */
241 [RTMSTP201] = MSTP(&div4_clks[DIV4_B], RTMSTPCR2, 1, 0), /* VPU */
242 [SYMSTP023] = MSTP(&div6_clks[DIV6_SPU], SYMSTPCR0, 23, 0), /* SPU1 */
243 [SYMSTP007] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR0, 7, 0), /* SCIFA5 */
244 [SYMSTP006] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR0, 6, 0), /* SCIFB */
245 [SYMSTP004] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR0, 4, 0), /* SCIFA0 */
246 [SYMSTP003] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR0, 3, 0), /* SCIFA1 */
247 [SYMSTP002] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR0, 2, 0), /* SCIFA2 */
248 [SYMSTP001] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR0, 1, 0), /* SCIFA3 */
249 [SYMSTP000] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR0, 0, 0), /* SCIFA4 */
250 [SYMSTP231] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR2, 31, 0), /* SIU */
251 [SYMSTP229] = MSTP(&r_clk, SYMSTPCR2, 29, 0), /* CMT10 */
252 [SYMSTP225] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR2, 25, 0), /* IRDA */
253 [SYMSTP223] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR2, 23, 0), /* IIC1 */
254 [SYMSTP222] = MSTP(&div6_clks[DIV6_SUB], SYMSTPCR2, 22, 0), /* USBHS */
255 [SYMSTP215] = MSTP(&div4_clks[DIV4_HP], SYMSTPCR2, 15, 0), /* FLCTL */
256 [SYMSTP214] = MSTP(&div4_clks[DIV4_HP], SYMSTPCR2, 14, 0), /* SDHI0 */
257 [SYMSTP213] = MSTP(&div4_clks[DIV4_HP], SYMSTPCR2, 13, 0), /* SDHI1 */
258 [SYMSTP211] = MSTP(&div4_clks[DIV4_HP], SYMSTPCR2, 11, 0), /* SDHI2 */
259 [CMMSTP003] = MSTP(&r_clk, CMMSTPCR0, 3, 0), /* KEYSC */
260};
261
262static struct clk_lookup lookups[] = {
263 /* main clocks */
264 CLKDEV_CON_ID("r_clk", &r_clk),
265 CLKDEV_CON_ID("extalb1", &sh7367_extalb1_clk),
266 CLKDEV_CON_ID("extal2", &sh7367_extal2_clk),
267 CLKDEV_CON_ID("extalb1_div2_clk", &extalb1_div2_clk),
268 CLKDEV_CON_ID("extal2_div2_clk", &extal2_div2_clk),
269 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk),
270 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk),
271 CLKDEV_CON_ID("pllc2_clk", &pllc2_clk),
272
273 /* DIV4 clocks */
274 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]),
275 CLKDEV_CON_ID("g_clk", &div4_clks[DIV4_G]),
276 CLKDEV_CON_ID("b_clk", &div4_clks[DIV4_B]),
277 CLKDEV_CON_ID("zx_clk", &div4_clks[DIV4_ZX]),
278 CLKDEV_CON_ID("zt_clk", &div4_clks[DIV4_ZT]),
279 CLKDEV_CON_ID("z_clk", &div4_clks[DIV4_Z]),
280 CLKDEV_CON_ID("zd_clk", &div4_clks[DIV4_ZD]),
281 CLKDEV_CON_ID("hp_clk", &div4_clks[DIV4_HP]),
282 CLKDEV_CON_ID("zs_clk", &div4_clks[DIV4_ZS]),
283 CLKDEV_CON_ID("zb_clk", &div4_clks[DIV4_ZB]),
284 CLKDEV_CON_ID("zb3_clk", &div4_clks[DIV4_ZB3]),
285 CLKDEV_CON_ID("cp_clk", &div4_clks[DIV4_CP]),
286
287 /* DIV6 clocks */
288 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
289 CLKDEV_CON_ID("siua_clk", &div6_clks[DIV6_SIUA]),
290 CLKDEV_CON_ID("siub_clk", &div6_clks[DIV6_SIUB]),
291 CLKDEV_CON_ID("msu_clk", &div6_clks[DIV6_MSU]),
292 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]),
293 CLKDEV_CON_ID("mvi3_clk", &div6_clks[DIV6_MVI3]),
294 CLKDEV_CON_ID("mf1_clk", &div6_clks[DIV6_MF1]),
295 CLKDEV_CON_ID("mf2_clk", &div6_clks[DIV6_MF2]),
296 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
297 CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]),
298 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]),
299 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]),
300
301 /* MSTP32 clocks */
302 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[RTMSTP001]), /* IIC2 */
303 CLKDEV_DEV_ID("uio_pdrv_genirq.4", &mstp_clks[RTMSTP231]), /* VEU3 */
304 CLKDEV_DEV_ID("uio_pdrv_genirq.3", &mstp_clks[RTMSTP230]), /* VEU2 */
305 CLKDEV_DEV_ID("uio_pdrv_genirq.2", &mstp_clks[RTMSTP229]), /* VEU1 */
306 CLKDEV_DEV_ID("uio_pdrv_genirq.1", &mstp_clks[RTMSTP228]), /* VEU0 */
307 CLKDEV_DEV_ID("uio_pdrv_genirq.5", &mstp_clks[RTMSTP226]), /* VEU2H */
308 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[RTMSTP216]), /* IIC0 */
309 CLKDEV_DEV_ID("uio_pdrv_genirq.6", &mstp_clks[RTMSTP206]), /* JPU */
310 CLKDEV_DEV_ID("sh-vou", &mstp_clks[RTMSTP205]), /* VOU */
311 CLKDEV_DEV_ID("uio_pdrv_genirq.0", &mstp_clks[RTMSTP201]), /* VPU */
312 CLKDEV_DEV_ID("uio_pdrv_genirq.7", &mstp_clks[SYMSTP023]), /* SPU1 */
313 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[SYMSTP007]), /* SCIFA5 */
314 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[SYMSTP006]), /* SCIFB */
315 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[SYMSTP004]), /* SCIFA0 */
316 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[SYMSTP003]), /* SCIFA1 */
317 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[SYMSTP002]), /* SCIFA2 */
318 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[SYMSTP001]), /* SCIFA3 */
319 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[SYMSTP000]), /* SCIFA4 */
320 CLKDEV_DEV_ID("sh_siu", &mstp_clks[SYMSTP231]), /* SIU */
321 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[SYMSTP229]), /* CMT10 */
322 CLKDEV_DEV_ID("sh_irda", &mstp_clks[SYMSTP225]), /* IRDA */
323 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[SYMSTP223]), /* IIC1 */
324 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[SYMSTP222]), /* USBHS */
325 CLKDEV_DEV_ID("r8a66597_udc.0", &mstp_clks[SYMSTP222]), /* USBHS */
326 CLKDEV_DEV_ID("sh_flctl", &mstp_clks[SYMSTP215]), /* FLCTL */
327 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[SYMSTP214]), /* SDHI0 */
328 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[SYMSTP213]), /* SDHI1 */
329 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[SYMSTP211]), /* SDHI2 */
330 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[CMMSTP003]), /* KEYSC */
331};
332
333void __init sh7367_clock_init(void)
334{
335 int k, ret = 0;
336
337 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
338 ret = clk_register(main_clks[k]);
339
340 if (!ret)
341 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
342
343 if (!ret)
344 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
345
346 if (!ret)
347 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
348
349 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
350
351 if (!ret)
352 shmobile_clk_init();
353 else
354 panic("failed to setup sh7367 clocks\n");
355}
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 430a90ffa12..4d57e342537 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -420,87 +420,11 @@ static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
420}; 420};
421 421
422/* FSI DIV */ 422/* FSI DIV */
423static unsigned long fsidiv_recalc(struct clk *clk) 423enum { FSIDIV_A, FSIDIV_B, FSIDIV_REPARENT_NR };
424{
425 unsigned long value;
426
427 value = __raw_readl(clk->mapping->base);
428
429 value >>= 16;
430 if (value < 2)
431 return 0;
432
433 return clk->parent->rate / value;
434}
435
436static long fsidiv_round_rate(struct clk *clk, unsigned long rate)
437{
438 return clk_rate_div_range_round(clk, 2, 0xffff, rate);
439}
440
441static void fsidiv_disable(struct clk *clk)
442{
443 __raw_writel(0, clk->mapping->base);
444}
445
446static int fsidiv_enable(struct clk *clk)
447{
448 unsigned long value;
449
450 value = __raw_readl(clk->mapping->base) >> 16;
451 if (value < 2)
452 return -EIO;
453
454 __raw_writel((value << 16) | 0x3, clk->mapping->base);
455
456 return 0;
457}
458 424
459static int fsidiv_set_rate(struct clk *clk, unsigned long rate) 425static struct clk fsidivs[] = {
460{ 426 [FSIDIV_A] = SH_CLK_FSIDIV(FSIDIVA, &div6_reparent_clks[DIV6_FSIA]),
461 int idx; 427 [FSIDIV_B] = SH_CLK_FSIDIV(FSIDIVB, &div6_reparent_clks[DIV6_FSIB]),
462
463 idx = (clk->parent->rate / rate) & 0xffff;
464 if (idx < 2)
465 return -EINVAL;
466
467 __raw_writel(idx << 16, clk->mapping->base);
468 return 0;
469}
470
471static struct sh_clk_ops fsidiv_clk_ops = {
472 .recalc = fsidiv_recalc,
473 .round_rate = fsidiv_round_rate,
474 .set_rate = fsidiv_set_rate,
475 .enable = fsidiv_enable,
476 .disable = fsidiv_disable,
477};
478
479static struct clk_mapping fsidiva_clk_mapping = {
480 .phys = FSIDIVA,
481 .len = 8,
482};
483
484struct clk sh7372_fsidiva_clk = {
485 .ops = &fsidiv_clk_ops,
486 .parent = &div6_reparent_clks[DIV6_FSIA], /* late install */
487 .mapping = &fsidiva_clk_mapping,
488};
489
490static struct clk_mapping fsidivb_clk_mapping = {
491 .phys = FSIDIVB,
492 .len = 8,
493};
494
495struct clk sh7372_fsidivb_clk = {
496 .ops = &fsidiv_clk_ops,
497 .parent = &div6_reparent_clks[DIV6_FSIB], /* late install */
498 .mapping = &fsidivb_clk_mapping,
499};
500
501static struct clk *late_main_clks[] = {
502 &sh7372_fsidiva_clk,
503 &sh7372_fsidivb_clk,
504}; 428};
505 429
506enum { MSTP001, MSTP000, 430enum { MSTP001, MSTP000,
@@ -583,6 +507,8 @@ static struct clk_lookup lookups[] = {
583 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk), 507 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk),
584 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk), 508 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk),
585 CLKDEV_CON_ID("pllc2_clk", &sh7372_pllc2_clk), 509 CLKDEV_CON_ID("pllc2_clk", &sh7372_pllc2_clk),
510 CLKDEV_CON_ID("fsidiva", &fsidivs[FSIDIV_A]),
511 CLKDEV_CON_ID("fsidivb", &fsidivs[FSIDIV_B]),
586 512
587 /* DIV4 clocks */ 513 /* DIV4 clocks */
588 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]), 514 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]),
@@ -678,6 +604,10 @@ static struct clk_lookup lookups[] = {
678 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), 604 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
679 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), 605 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
680 CLKDEV_ICK_ID("spu2", "sh_fsi2", &mstp_clks[MSTP223]), 606 CLKDEV_ICK_ID("spu2", "sh_fsi2", &mstp_clks[MSTP223]),
607 CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]),
608 CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]),
609 CLKDEV_ICK_ID("xcka", "sh_fsi2", &sh7372_fsiack_clk),
610 CLKDEV_ICK_ID("xckb", "sh_fsi2", &sh7372_fsibck_clk),
681}; 611};
682 612
683void __init sh7372_clock_init(void) 613void __init sh7372_clock_init(void)
@@ -706,8 +636,8 @@ void __init sh7372_clock_init(void)
706 if (!ret) 636 if (!ret)
707 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); 637 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
708 638
709 for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) 639 if (!ret)
710 ret = clk_register(late_main_clks[k]); 640 ret = sh_clk_fsidiv_register(fsidivs, FSIDIV_REPARENT_NR);
711 641
712 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 642 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
713 643
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
deleted file mode 100644
index b8480d19e1c..00000000000
--- a/arch/arm/mach-shmobile/clock-sh7377.c
+++ /dev/null
@@ -1,366 +0,0 @@
1/*
2 * SH7377 clock framework support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/io.h>
22#include <linux/sh_clk.h>
23#include <linux/clkdev.h>
24#include <mach/common.h>
25
26/* SH7377 registers */
27#define RTFRQCR IOMEM(0xe6150000)
28#define SYFRQCR IOMEM(0xe6150004)
29#define CMFRQCR IOMEM(0xe61500E0)
30#define VCLKCR1 IOMEM(0xe6150008)
31#define VCLKCR2 IOMEM(0xe615000C)
32#define VCLKCR3 IOMEM(0xe615001C)
33#define FMSICKCR IOMEM(0xe6150010)
34#define FMSOCKCR IOMEM(0xe6150014)
35#define FSICKCR IOMEM(0xe6150018)
36#define PLLC1CR IOMEM(0xe6150028)
37#define PLLC2CR IOMEM(0xe615002C)
38#define SUBUSBCKCR IOMEM(0xe6150080)
39#define SPUCKCR IOMEM(0xe6150084)
40#define MSUCKCR IOMEM(0xe6150088)
41#define MVI3CKCR IOMEM(0xe6150090)
42#define HDMICKCR IOMEM(0xe6150094)
43#define MFCK1CR IOMEM(0xe6150098)
44#define MFCK2CR IOMEM(0xe615009C)
45#define DSITCKCR IOMEM(0xe6150060)
46#define DSIPCKCR IOMEM(0xe6150064)
47#define SMSTPCR0 IOMEM(0xe6150130)
48#define SMSTPCR1 IOMEM(0xe6150134)
49#define SMSTPCR2 IOMEM(0xe6150138)
50#define SMSTPCR3 IOMEM(0xe615013C)
51#define SMSTPCR4 IOMEM(0xe6150140)
52
53/* Fixed 32 KHz root clock from EXTALR pin */
54static struct clk r_clk = {
55 .rate = 32768,
56};
57
58/*
59 * 26MHz default rate for the EXTALC1 root input clock.
60 * If needed, reset this with clk_set_rate() from the platform code.
61 */
62struct clk sh7377_extalc1_clk = {
63 .rate = 26666666,
64};
65
66/*
67 * 48MHz default rate for the EXTAL2 root input clock.
68 * If needed, reset this with clk_set_rate() from the platform code.
69 */
70struct clk sh7377_extal2_clk = {
71 .rate = 48000000,
72};
73
74/* A fixed divide-by-2 block */
75static unsigned long div2_recalc(struct clk *clk)
76{
77 return clk->parent->rate / 2;
78}
79
80static struct sh_clk_ops div2_clk_ops = {
81 .recalc = div2_recalc,
82};
83
84/* Divide extalc1 by two */
85static struct clk extalc1_div2_clk = {
86 .ops = &div2_clk_ops,
87 .parent = &sh7377_extalc1_clk,
88};
89
90/* Divide extal2 by two */
91static struct clk extal2_div2_clk = {
92 .ops = &div2_clk_ops,
93 .parent = &sh7377_extal2_clk,
94};
95
96/* Divide extal2 by four */
97static struct clk extal2_div4_clk = {
98 .ops = &div2_clk_ops,
99 .parent = &extal2_div2_clk,
100};
101
102/* PLLC1 */
103static unsigned long pllc1_recalc(struct clk *clk)
104{
105 unsigned long mult = 1;
106
107 if (__raw_readl(PLLC1CR) & (1 << 14))
108 mult = (((__raw_readl(RTFRQCR) >> 24) & 0x3f) + 1) * 2;
109
110 return clk->parent->rate * mult;
111}
112
113static struct sh_clk_ops pllc1_clk_ops = {
114 .recalc = pllc1_recalc,
115};
116
117static struct clk pllc1_clk = {
118 .ops = &pllc1_clk_ops,
119 .flags = CLK_ENABLE_ON_INIT,
120 .parent = &extalc1_div2_clk,
121};
122
123/* Divide PLLC1 by two */
124static struct clk pllc1_div2_clk = {
125 .ops = &div2_clk_ops,
126 .parent = &pllc1_clk,
127};
128
129/* PLLC2 */
130static unsigned long pllc2_recalc(struct clk *clk)
131{
132 unsigned long mult = 1;
133
134 if (__raw_readl(PLLC2CR) & (1 << 31))
135 mult = (((__raw_readl(PLLC2CR) >> 24) & 0x3f) + 1) * 2;
136
137 return clk->parent->rate * mult;
138}
139
140static struct sh_clk_ops pllc2_clk_ops = {
141 .recalc = pllc2_recalc,
142};
143
144static struct clk pllc2_clk = {
145 .ops = &pllc2_clk_ops,
146 .flags = CLK_ENABLE_ON_INIT,
147 .parent = &extalc1_div2_clk,
148};
149
150static struct clk *main_clks[] = {
151 &r_clk,
152 &sh7377_extalc1_clk,
153 &sh7377_extal2_clk,
154 &extalc1_div2_clk,
155 &extal2_div2_clk,
156 &extal2_div4_clk,
157 &pllc1_clk,
158 &pllc1_div2_clk,
159 &pllc2_clk,
160};
161
162static void div4_kick(struct clk *clk)
163{
164 unsigned long value;
165
166 /* set KICK bit in SYFRQCR to update hardware setting */
167 value = __raw_readl(SYFRQCR);
168 value |= (1 << 31);
169 __raw_writel(value, SYFRQCR);
170}
171
172static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,
173 24, 32, 36, 48, 0, 72, 96, 0 };
174
175static struct clk_div_mult_table div4_div_mult_table = {
176 .divisors = divisors,
177 .nr_divisors = ARRAY_SIZE(divisors),
178};
179
180static struct clk_div4_table div4_table = {
181 .div_mult_table = &div4_div_mult_table,
182 .kick = div4_kick,
183};
184
185enum { DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_CSIR,
186 DIV4_ZTR, DIV4_ZT, DIV4_Z, DIV4_HP,
187 DIV4_ZS, DIV4_ZB, DIV4_ZB3, DIV4_CP, DIV4_NR };
188
189#define DIV4(_reg, _bit, _mask, _flags) \
190 SH_CLK_DIV4(&pllc1_clk, _reg, _bit, _mask, _flags)
191
192static struct clk div4_clks[DIV4_NR] = {
193 [DIV4_I] = DIV4(RTFRQCR, 20, 0x6fff, CLK_ENABLE_ON_INIT),
194 [DIV4_ZG] = DIV4(RTFRQCR, 16, 0x6fff, CLK_ENABLE_ON_INIT),
195 [DIV4_B] = DIV4(RTFRQCR, 8, 0x6fff, CLK_ENABLE_ON_INIT),
196 [DIV4_M1] = DIV4(RTFRQCR, 4, 0x6fff, CLK_ENABLE_ON_INIT),
197 [DIV4_CSIR] = DIV4(RTFRQCR, 0, 0x6fff, 0),
198 [DIV4_ZTR] = DIV4(SYFRQCR, 20, 0x6fff, 0),
199 [DIV4_ZT] = DIV4(SYFRQCR, 16, 0x6fff, 0),
200 [DIV4_Z] = DIV4(SYFRQCR, 12, 0x6fff, 0),
201 [DIV4_HP] = DIV4(SYFRQCR, 4, 0x6fff, 0),
202 [DIV4_ZS] = DIV4(CMFRQCR, 12, 0x6fff, 0),
203 [DIV4_ZB] = DIV4(CMFRQCR, 8, 0x6fff, 0),
204 [DIV4_ZB3] = DIV4(CMFRQCR, 4, 0x6fff, 0),
205 [DIV4_CP] = DIV4(CMFRQCR, 0, 0x6fff, 0),
206};
207
208enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_FMSI, DIV6_FMSO,
209 DIV6_FSI, DIV6_SUB, DIV6_SPU, DIV6_MSU, DIV6_MVI3, DIV6_HDMI,
210 DIV6_MF1, DIV6_MF2, DIV6_DSIT, DIV6_DSIP,
211 DIV6_NR };
212
213static struct clk div6_clks[] = {
214 [DIV6_VCK1] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR1, 0),
215 [DIV6_VCK2] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR2, 0),
216 [DIV6_VCK3] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR3, 0),
217 [DIV6_FMSI] = SH_CLK_DIV6(&pllc1_div2_clk, FMSICKCR, 0),
218 [DIV6_FMSO] = SH_CLK_DIV6(&pllc1_div2_clk, FMSOCKCR, 0),
219 [DIV6_FSI] = SH_CLK_DIV6(&pllc1_div2_clk, FSICKCR, 0),
220 [DIV6_SUB] = SH_CLK_DIV6(&sh7377_extal2_clk, SUBUSBCKCR, 0),
221 [DIV6_SPU] = SH_CLK_DIV6(&pllc1_div2_clk, SPUCKCR, 0),
222 [DIV6_MSU] = SH_CLK_DIV6(&pllc1_div2_clk, MSUCKCR, 0),
223 [DIV6_MVI3] = SH_CLK_DIV6(&pllc1_div2_clk, MVI3CKCR, 0),
224 [DIV6_HDMI] = SH_CLK_DIV6(&pllc1_div2_clk, HDMICKCR, 0),
225 [DIV6_MF1] = SH_CLK_DIV6(&pllc1_div2_clk, MFCK1CR, 0),
226 [DIV6_MF2] = SH_CLK_DIV6(&pllc1_div2_clk, MFCK2CR, 0),
227 [DIV6_DSIT] = SH_CLK_DIV6(&pllc1_div2_clk, DSITCKCR, 0),
228 [DIV6_DSIP] = SH_CLK_DIV6(&pllc1_div2_clk, DSIPCKCR, 0),
229};
230
231enum { MSTP001,
232 MSTP131, MSTP130, MSTP129, MSTP128, MSTP116, MSTP106, MSTP101,
233 MSTP223, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
234 MSTP331, MSTP329, MSTP325, MSTP323, MSTP322,
235 MSTP315, MSTP314, MSTP313,
236 MSTP403,
237 MSTP_NR };
238
239#define MSTP(_parent, _reg, _bit, _flags) \
240 SH_CLK_MSTP32(_parent, _reg, _bit, _flags)
241
242static struct clk mstp_clks[] = {
243 [MSTP001] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR0, 1, 0), /* IIC2 */
244 [MSTP131] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 31, 0), /* VEU3 */
245 [MSTP130] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 30, 0), /* VEU2 */
246 [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* VEU1 */
247 [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* VEU0 */
248 [MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */
249 [MSTP106] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 6, 0), /* JPU */
250 [MSTP101] = MSTP(&div4_clks[DIV4_M1], SMSTPCR1, 1, 0), /* VPU */
251 [MSTP223] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR2, 23, 0), /* SPU2 */
252 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
253 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
254 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
255 [MSTP203] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 3, 0), /* SCIFA1 */
256 [MSTP202] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */
257 [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
258 [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
259 [MSTP331] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 31, 0), /* SCIFA6 */
260 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
261 [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IRDA */
262 [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
263 [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */
264 [MSTP315] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 15, 0), /* FLCTL */
265 [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
266 [MSTP313] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
267 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
268};
269
270static struct clk_lookup lookups[] = {
271 /* main clocks */
272 CLKDEV_CON_ID("r_clk", &r_clk),
273 CLKDEV_CON_ID("extalc1", &sh7377_extalc1_clk),
274 CLKDEV_CON_ID("extal2", &sh7377_extal2_clk),
275 CLKDEV_CON_ID("extalc1_div2_clk", &extalc1_div2_clk),
276 CLKDEV_CON_ID("extal2_div2_clk", &extal2_div2_clk),
277 CLKDEV_CON_ID("extal2_div4_clk", &extal2_div4_clk),
278 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk),
279 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk),
280 CLKDEV_CON_ID("pllc2_clk", &pllc2_clk),
281
282 /* DIV4 clocks */
283 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]),
284 CLKDEV_CON_ID("zg_clk", &div4_clks[DIV4_ZG]),
285 CLKDEV_CON_ID("b_clk", &div4_clks[DIV4_B]),
286 CLKDEV_CON_ID("m1_clk", &div4_clks[DIV4_M1]),
287 CLKDEV_CON_ID("csir_clk", &div4_clks[DIV4_CSIR]),
288 CLKDEV_CON_ID("ztr_clk", &div4_clks[DIV4_ZTR]),
289 CLKDEV_CON_ID("zt_clk", &div4_clks[DIV4_ZT]),
290 CLKDEV_CON_ID("z_clk", &div4_clks[DIV4_Z]),
291 CLKDEV_CON_ID("hp_clk", &div4_clks[DIV4_HP]),
292 CLKDEV_CON_ID("zs_clk", &div4_clks[DIV4_ZS]),
293 CLKDEV_CON_ID("zb_clk", &div4_clks[DIV4_ZB]),
294 CLKDEV_CON_ID("zb3_clk", &div4_clks[DIV4_ZB3]),
295 CLKDEV_CON_ID("cp_clk", &div4_clks[DIV4_CP]),
296
297 /* DIV6 clocks */
298 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
299 CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]),
300 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]),
301 CLKDEV_CON_ID("fmsi_clk", &div6_clks[DIV6_FMSI]),
302 CLKDEV_CON_ID("fmso_clk", &div6_clks[DIV6_FMSO]),
303 CLKDEV_CON_ID("fsi_clk", &div6_clks[DIV6_FSI]),
304 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
305 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]),
306 CLKDEV_CON_ID("msu_clk", &div6_clks[DIV6_MSU]),
307 CLKDEV_CON_ID("mvi3_clk", &div6_clks[DIV6_MVI3]),
308 CLKDEV_CON_ID("hdmi_clk", &div6_clks[DIV6_HDMI]),
309 CLKDEV_CON_ID("mf1_clk", &div6_clks[DIV6_MF1]),
310 CLKDEV_CON_ID("mf2_clk", &div6_clks[DIV6_MF2]),
311 CLKDEV_CON_ID("dsit_clk", &div6_clks[DIV6_DSIT]),
312 CLKDEV_CON_ID("dsip_clk", &div6_clks[DIV6_DSIP]),
313
314 /* MSTP32 clocks */
315 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */
316 CLKDEV_DEV_ID("uio_pdrv_genirq.4", &mstp_clks[MSTP131]), /* VEU3 */
317 CLKDEV_DEV_ID("uio_pdrv_genirq.3", &mstp_clks[MSTP130]), /* VEU2 */
318 CLKDEV_DEV_ID("uio_pdrv_genirq.2", &mstp_clks[MSTP129]), /* VEU1 */
319 CLKDEV_DEV_ID("uio_pdrv_genirq.1", &mstp_clks[MSTP128]), /* VEU0 */
320 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */
321 CLKDEV_DEV_ID("uio_pdrv_genirq.5", &mstp_clks[MSTP106]), /* JPU */
322 CLKDEV_DEV_ID("uio_pdrv_genirq.0", &mstp_clks[MSTP101]), /* VPU */
323 CLKDEV_DEV_ID("uio_pdrv_genirq.6", &mstp_clks[MSTP223]), /* SPU2DSP0 */
324 CLKDEV_DEV_ID("uio_pdrv_genirq.7", &mstp_clks[MSTP223]), /* SPU2DSP1 */
325 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
326 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP206]), /* SCIFB */
327 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
328 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
329 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
330 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
331 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
332 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
333 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
334 CLKDEV_DEV_ID("sh_irda", &mstp_clks[MSTP325]), /* IRDA */
335 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */
336 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USBHS */
337 CLKDEV_DEV_ID("r8a66597_udc.0", &mstp_clks[MSTP322]), /* USBHS */
338 CLKDEV_DEV_ID("sh_flctl", &mstp_clks[MSTP315]), /* FLCTL */
339 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
340 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
341 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
342};
343
344void __init sh7377_clock_init(void)
345{
346 int k, ret = 0;
347
348 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
349 ret = clk_register(main_clks[k]);
350
351 if (!ret)
352 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
353
354 if (!ret)
355 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
356
357 if (!ret)
358 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
359
360 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
361
362 if (!ret)
363 shmobile_clk_init();
364 else
365 panic("failed to setup sh7377 clocks\n");
366}
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index d47e215aca8..dfeca79e9e9 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -18,24 +18,6 @@ extern int shmobile_enter_wfi(struct cpuidle_device *dev,
18 struct cpuidle_driver *drv, int index); 18 struct cpuidle_driver *drv, int index);
19extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv); 19extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);
20 20
21extern void sh7367_init_irq(void);
22extern void sh7367_map_io(void);
23extern void sh7367_add_early_devices(void);
24extern void sh7367_add_standard_devices(void);
25extern void sh7367_clock_init(void);
26extern void sh7367_pinmux_init(void);
27extern struct clk sh7367_extalb1_clk;
28extern struct clk sh7367_extal2_clk;
29
30extern void sh7377_init_irq(void);
31extern void sh7377_map_io(void);
32extern void sh7377_add_early_devices(void);
33extern void sh7377_add_standard_devices(void);
34extern void sh7377_clock_init(void);
35extern void sh7377_pinmux_init(void);
36extern struct clk sh7377_extalc1_clk;
37extern struct clk sh7377_extal2_clk;
38
39extern void sh7372_init_irq(void); 21extern void sh7372_init_irq(void);
40extern void sh7372_map_io(void); 22extern void sh7372_map_io(void);
41extern void sh7372_add_early_devices(void); 23extern void sh7372_add_early_devices(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 499f52d2a4a..8ab0cd6ad6b 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -71,7 +71,7 @@ enum {
71 GPIO_FN_A19, 71 GPIO_FN_A19,
72 72
73 /* IPSR0 */ 73 /* IPSR0 */
74 GPIO_FN_PENC2, GPIO_FN_SCK0, GPIO_FN_PWM1, GPIO_FN_PWMFSW0, 74 GPIO_FN_USB_PENC2, GPIO_FN_SCK0, GPIO_FN_PWM1, GPIO_FN_PWMFSW0,
75 GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS, GPIO_FN_SD1_DAT2, 75 GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS, GPIO_FN_SD1_DAT2,
76 GPIO_FN_MMC0_D2, GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF, 76 GPIO_FN_MMC0_D2, GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF,
77 GPIO_FN_HCTS1, GPIO_FN_TX4_C, GPIO_FN_A0, GPIO_FN_SD1_DAT3, 77 GPIO_FN_HCTS1, GPIO_FN_TX4_C, GPIO_FN_A0, GPIO_FN_SD1_DAT3,
diff --git a/arch/arm/mach-shmobile/include/mach/sh7367.h b/arch/arm/mach-shmobile/include/mach/sh7367.h
deleted file mode 100644
index 52d0de686f6..00000000000
--- a/arch/arm/mach-shmobile/include/mach/sh7367.h
+++ /dev/null
@@ -1,332 +0,0 @@
1#ifndef __ASM_SH7367_H__
2#define __ASM_SH7367_H__
3
4/* Pin Function Controller:
5 * GPIO_FN_xx - GPIO used to select pin function
6 * GPIO_PORTxx - GPIO mapped to real I/O pin on CPU
7 */
8enum {
9 /* 49-1 -> 49-6 (GPIO) */
10 GPIO_PORT0, GPIO_PORT1, GPIO_PORT2, GPIO_PORT3, GPIO_PORT4,
11 GPIO_PORT5, GPIO_PORT6, GPIO_PORT7, GPIO_PORT8, GPIO_PORT9,
12
13 GPIO_PORT10, GPIO_PORT11, GPIO_PORT12, GPIO_PORT13, GPIO_PORT14,
14 GPIO_PORT15, GPIO_PORT16, GPIO_PORT17, GPIO_PORT18, GPIO_PORT19,
15
16 GPIO_PORT20, GPIO_PORT21, GPIO_PORT22, GPIO_PORT23, GPIO_PORT24,
17 GPIO_PORT25, GPIO_PORT26, GPIO_PORT27, GPIO_PORT28, GPIO_PORT29,
18
19 GPIO_PORT30, GPIO_PORT31, GPIO_PORT32, GPIO_PORT33, GPIO_PORT34,
20 GPIO_PORT35, GPIO_PORT36, GPIO_PORT37, GPIO_PORT38, GPIO_PORT39,
21
22 GPIO_PORT40, GPIO_PORT41, GPIO_PORT42, GPIO_PORT43, GPIO_PORT44,
23 GPIO_PORT45, GPIO_PORT46, GPIO_PORT47, GPIO_PORT48, GPIO_PORT49,
24
25 GPIO_PORT50, GPIO_PORT51, GPIO_PORT52, GPIO_PORT53, GPIO_PORT54,
26 GPIO_PORT55, GPIO_PORT56, GPIO_PORT57, GPIO_PORT58, GPIO_PORT59,
27
28 GPIO_PORT60, GPIO_PORT61, GPIO_PORT62, GPIO_PORT63, GPIO_PORT64,
29 GPIO_PORT65, GPIO_PORT66, GPIO_PORT67, GPIO_PORT68, GPIO_PORT69,
30
31 GPIO_PORT70, GPIO_PORT71, GPIO_PORT72, GPIO_PORT73, GPIO_PORT74,
32 GPIO_PORT75, GPIO_PORT76, GPIO_PORT77, GPIO_PORT78, GPIO_PORT79,
33
34 GPIO_PORT80, GPIO_PORT81, GPIO_PORT82, GPIO_PORT83, GPIO_PORT84,
35 GPIO_PORT85, GPIO_PORT86, GPIO_PORT87, GPIO_PORT88, GPIO_PORT89,
36
37 GPIO_PORT90, GPIO_PORT91, GPIO_PORT92, GPIO_PORT93, GPIO_PORT94,
38 GPIO_PORT95, GPIO_PORT96, GPIO_PORT97, GPIO_PORT98, GPIO_PORT99,
39
40 GPIO_PORT100, GPIO_PORT101, GPIO_PORT102, GPIO_PORT103, GPIO_PORT104,
41 GPIO_PORT105, GPIO_PORT106, GPIO_PORT107, GPIO_PORT108, GPIO_PORT109,
42
43 GPIO_PORT110, GPIO_PORT111, GPIO_PORT112, GPIO_PORT113, GPIO_PORT114,
44 GPIO_PORT115, GPIO_PORT116, GPIO_PORT117, GPIO_PORT118, GPIO_PORT119,
45
46 GPIO_PORT120, GPIO_PORT121, GPIO_PORT122, GPIO_PORT123, GPIO_PORT124,
47 GPIO_PORT125, GPIO_PORT126, GPIO_PORT127, GPIO_PORT128, GPIO_PORT129,
48
49 GPIO_PORT130, GPIO_PORT131, GPIO_PORT132, GPIO_PORT133, GPIO_PORT134,
50 GPIO_PORT135, GPIO_PORT136, GPIO_PORT137, GPIO_PORT138, GPIO_PORT139,
51
52 GPIO_PORT140, GPIO_PORT141, GPIO_PORT142, GPIO_PORT143, GPIO_PORT144,
53 GPIO_PORT145, GPIO_PORT146, GPIO_PORT147, GPIO_PORT148, GPIO_PORT149,
54
55 GPIO_PORT150, GPIO_PORT151, GPIO_PORT152, GPIO_PORT153, GPIO_PORT154,
56 GPIO_PORT155, GPIO_PORT156, GPIO_PORT157, GPIO_PORT158, GPIO_PORT159,
57
58 GPIO_PORT160, GPIO_PORT161, GPIO_PORT162, GPIO_PORT163, GPIO_PORT164,
59 GPIO_PORT165, GPIO_PORT166, GPIO_PORT167, GPIO_PORT168, GPIO_PORT169,
60
61 GPIO_PORT170, GPIO_PORT171, GPIO_PORT172, GPIO_PORT173, GPIO_PORT174,
62 GPIO_PORT175, GPIO_PORT176, GPIO_PORT177, GPIO_PORT178, GPIO_PORT179,
63
64 GPIO_PORT180, GPIO_PORT181, GPIO_PORT182, GPIO_PORT183, GPIO_PORT184,
65 GPIO_PORT185, GPIO_PORT186, GPIO_PORT187, GPIO_PORT188, GPIO_PORT189,
66
67 GPIO_PORT190, GPIO_PORT191, GPIO_PORT192, GPIO_PORT193, GPIO_PORT194,
68 GPIO_PORT195, GPIO_PORT196, GPIO_PORT197, GPIO_PORT198, GPIO_PORT199,
69
70 GPIO_PORT200, GPIO_PORT201, GPIO_PORT202, GPIO_PORT203, GPIO_PORT204,
71 GPIO_PORT205, GPIO_PORT206, GPIO_PORT207, GPIO_PORT208, GPIO_PORT209,
72
73 GPIO_PORT210, GPIO_PORT211, GPIO_PORT212, GPIO_PORT213, GPIO_PORT214,
74 GPIO_PORT215, GPIO_PORT216, GPIO_PORT217, GPIO_PORT218, GPIO_PORT219,
75
76 GPIO_PORT220, GPIO_PORT221, GPIO_PORT222, GPIO_PORT223, GPIO_PORT224,
77 GPIO_PORT225, GPIO_PORT226, GPIO_PORT227, GPIO_PORT228, GPIO_PORT229,
78
79 GPIO_PORT230, GPIO_PORT231, GPIO_PORT232, GPIO_PORT233, GPIO_PORT234,
80 GPIO_PORT235, GPIO_PORT236, GPIO_PORT237, GPIO_PORT238, GPIO_PORT239,
81
82 GPIO_PORT240, GPIO_PORT241, GPIO_PORT242, GPIO_PORT243, GPIO_PORT244,
83 GPIO_PORT245, GPIO_PORT246, GPIO_PORT247, GPIO_PORT248, GPIO_PORT249,
84
85 GPIO_PORT250, GPIO_PORT251, GPIO_PORT252, GPIO_PORT253, GPIO_PORT254,
86 GPIO_PORT255, GPIO_PORT256, GPIO_PORT257, GPIO_PORT258, GPIO_PORT259,
87
88 GPIO_PORT260, GPIO_PORT261, GPIO_PORT262, GPIO_PORT263, GPIO_PORT264,
89 GPIO_PORT265, GPIO_PORT266, GPIO_PORT267, GPIO_PORT268, GPIO_PORT269,
90
91 GPIO_PORT270, GPIO_PORT271, GPIO_PORT272,
92
93 /* Special Pull-up / Pull-down Functions */
94 GPIO_FN_PORT48_KEYIN0_PU, GPIO_FN_PORT49_KEYIN1_PU,
95 GPIO_FN_PORT50_KEYIN2_PU, GPIO_FN_PORT55_KEYIN3_PU,
96 GPIO_FN_PORT56_KEYIN4_PU, GPIO_FN_PORT57_KEYIN5_PU,
97 GPIO_FN_PORT58_KEYIN6_PU,
98
99 /* 49-1 (FN) */
100 GPIO_FN_VBUS0, GPIO_FN_CPORT0, GPIO_FN_CPORT1, GPIO_FN_CPORT2,
101 GPIO_FN_CPORT3, GPIO_FN_CPORT4, GPIO_FN_CPORT5, GPIO_FN_CPORT6,
102 GPIO_FN_CPORT7, GPIO_FN_CPORT8, GPIO_FN_CPORT9, GPIO_FN_CPORT10,
103 GPIO_FN_CPORT11, GPIO_FN_SIN2, GPIO_FN_CPORT12, GPIO_FN_XCTS2,
104 GPIO_FN_CPORT13, GPIO_FN_RFSPO4, GPIO_FN_CPORT14, GPIO_FN_RFSPO5,
105 GPIO_FN_CPORT15, GPIO_FN_CPORT16, GPIO_FN_CPORT17, GPIO_FN_SOUT2,
106 GPIO_FN_CPORT18, GPIO_FN_XRTS2, GPIO_FN_CPORT19, GPIO_FN_CPORT20,
107 GPIO_FN_RFSPO6, GPIO_FN_CPORT21, GPIO_FN_STATUS0, GPIO_FN_CPORT22,
108 GPIO_FN_STATUS1, GPIO_FN_CPORT23, GPIO_FN_STATUS2, GPIO_FN_RFSPO7,
109 GPIO_FN_MPORT0, GPIO_FN_MPORT1, GPIO_FN_B_SYNLD1, GPIO_FN_B_SYNLD2,
110 GPIO_FN_XMAINPS, GPIO_FN_XDIVPS, GPIO_FN_XIDRST, GPIO_FN_IDCLK,
111 GPIO_FN_IDIO, GPIO_FN_SOUT1, GPIO_FN_SCIFA4_TXD,
112 GPIO_FN_M02_BERDAT, GPIO_FN_SIN1, GPIO_FN_SCIFA4_RXD, GPIO_FN_XWUP,
113 GPIO_FN_XRTS1, GPIO_FN_SCIFA4_RTS, GPIO_FN_M03_BERCLK,
114 GPIO_FN_XCTS1, GPIO_FN_SCIFA4_CTS,
115
116 /* 49-2 (FN) */
117 GPIO_FN_HSU_IQ_AGC6, GPIO_FN_MFG2_IN2, GPIO_FN_MSIOF2_MCK0,
118 GPIO_FN_HSU_IQ_AGC5, GPIO_FN_MFG2_IN1, GPIO_FN_MSIOF2_MCK1,
119 GPIO_FN_HSU_IQ_AGC4, GPIO_FN_MSIOF2_RSYNC,
120 GPIO_FN_HSU_IQ_AGC3, GPIO_FN_MFG2_OUT1, GPIO_FN_MSIOF2_RSCK,
121 GPIO_FN_HSU_IQ_AGC2, GPIO_FN_PORT42_KEYOUT0,
122 GPIO_FN_HSU_IQ_AGC1, GPIO_FN_PORT43_KEYOUT1,
123 GPIO_FN_HSU_IQ_AGC0, GPIO_FN_PORT44_KEYOUT2,
124 GPIO_FN_HSU_IQ_AGC_ST, GPIO_FN_PORT45_KEYOUT3,
125 GPIO_FN_HSU_IQ_PDO, GPIO_FN_PORT46_KEYOUT4,
126 GPIO_FN_HSU_IQ_PYO, GPIO_FN_PORT47_KEYOUT5,
127 GPIO_FN_HSU_EN_TXMUX_G3MO, GPIO_FN_PORT48_KEYIN0,
128 GPIO_FN_HSU_I_TXMUX_G3MO, GPIO_FN_PORT49_KEYIN1,
129 GPIO_FN_HSU_Q_TXMUX_G3MO, GPIO_FN_PORT50_KEYIN2,
130 GPIO_FN_HSU_SYO, GPIO_FN_PORT51_MSIOF2_TSYNC,
131 GPIO_FN_HSU_SDO, GPIO_FN_PORT52_MSIOF2_TSCK,
132 GPIO_FN_HSU_TGTTI_G3MO, GPIO_FN_PORT53_MSIOF2_TXD,
133 GPIO_FN_B_TIME_STAMP, GPIO_FN_PORT54_MSIOF2_RXD,
134 GPIO_FN_HSU_SDI, GPIO_FN_PORT55_KEYIN3,
135 GPIO_FN_HSU_SCO, GPIO_FN_PORT56_KEYIN4,
136 GPIO_FN_HSU_DREQ, GPIO_FN_PORT57_KEYIN5,
137 GPIO_FN_HSU_DACK, GPIO_FN_PORT58_KEYIN6,
138 GPIO_FN_HSU_CLK61M, GPIO_FN_PORT59_MSIOF2_SS1,
139 GPIO_FN_HSU_XRST, GPIO_FN_PORT60_MSIOF2_SS2,
140 GPIO_FN_PCMCLKO, GPIO_FN_SYNC8KO, GPIO_FN_DNPCM_A, GPIO_FN_UPPCM_A,
141 GPIO_FN_XTALB1L,
142 GPIO_FN_GPS_AGC1, GPIO_FN_SCIFA0_RTS,
143 GPIO_FN_GPS_AGC2, GPIO_FN_SCIFA0_SCK,
144 GPIO_FN_GPS_AGC3, GPIO_FN_SCIFA0_TXD,
145 GPIO_FN_GPS_AGC4, GPIO_FN_SCIFA0_RXD,
146 GPIO_FN_GPS_PWRD, GPIO_FN_SCIFA0_CTS,
147 GPIO_FN_GPS_IM, GPIO_FN_GPS_IS, GPIO_FN_GPS_QM, GPIO_FN_GPS_QS,
148 GPIO_FN_SIUBOMC, GPIO_FN_TPU2TO0,
149 GPIO_FN_SIUCKB, GPIO_FN_TPU2TO1,
150 GPIO_FN_SIUBOLR, GPIO_FN_BBIF2_TSYNC, GPIO_FN_TPU2TO2,
151 GPIO_FN_SIUBOBT, GPIO_FN_BBIF2_TSCK, GPIO_FN_TPU2TO3,
152 GPIO_FN_SIUBOSLD, GPIO_FN_BBIF2_TXD, GPIO_FN_TPU3TO0,
153 GPIO_FN_SIUBILR, GPIO_FN_TPU3TO1,
154 GPIO_FN_SIUBIBT, GPIO_FN_TPU3TO2,
155 GPIO_FN_SIUBISLD, GPIO_FN_TPU3TO3,
156 GPIO_FN_NMI, GPIO_FN_TPU4TO0,
157 GPIO_FN_DNPCM_M, GPIO_FN_TPU4TO1, GPIO_FN_TPU4TO2, GPIO_FN_TPU4TO3,
158 GPIO_FN_IRQ_TMPB,
159 GPIO_FN_PWEN, GPIO_FN_MFG1_OUT1,
160 GPIO_FN_OVCN, GPIO_FN_MFG1_IN1,
161 GPIO_FN_OVCN2, GPIO_FN_MFG1_IN2,
162
163 /* 49-3 (FN) */
164 GPIO_FN_RFSPO1, GPIO_FN_RFSPO2, GPIO_FN_RFSPO3, GPIO_FN_PORT93_VIO_CKO2,
165 GPIO_FN_USBTERM, GPIO_FN_EXTLP, GPIO_FN_IDIN,
166 GPIO_FN_SCIFA5_CTS, GPIO_FN_MFG0_IN1,
167 GPIO_FN_SCIFA5_RTS, GPIO_FN_MFG0_IN2,
168 GPIO_FN_SCIFA5_RXD,
169 GPIO_FN_SCIFA5_TXD,
170 GPIO_FN_SCIFA5_SCK, GPIO_FN_MFG0_OUT1,
171 GPIO_FN_A0_EA0, GPIO_FN_BS,
172 GPIO_FN_A14_EA14, GPIO_FN_PORT102_KEYOUT0,
173 GPIO_FN_A15_EA15, GPIO_FN_PORT103_KEYOUT1, GPIO_FN_DV_CLKOL,
174 GPIO_FN_A16_EA16, GPIO_FN_PORT104_KEYOUT2,
175 GPIO_FN_DV_VSYNCL, GPIO_FN_MSIOF0_SS1,
176 GPIO_FN_A17_EA17, GPIO_FN_PORT105_KEYOUT3,
177 GPIO_FN_DV_HSYNCL, GPIO_FN_MSIOF0_TSYNC,
178 GPIO_FN_A18_EA18, GPIO_FN_PORT106_KEYOUT4,
179 GPIO_FN_DV_DL0, GPIO_FN_MSIOF0_TSCK,
180 GPIO_FN_A19_EA19, GPIO_FN_PORT107_KEYOUT5,
181 GPIO_FN_DV_DL1, GPIO_FN_MSIOF0_TXD,
182 GPIO_FN_A20_EA20, GPIO_FN_PORT108_KEYIN0,
183 GPIO_FN_DV_DL2, GPIO_FN_MSIOF0_RSCK,
184 GPIO_FN_A21_EA21, GPIO_FN_PORT109_KEYIN1,
185 GPIO_FN_DV_DL3, GPIO_FN_MSIOF0_RSYNC,
186 GPIO_FN_A22_EA22, GPIO_FN_PORT110_KEYIN2,
187 GPIO_FN_DV_DL4, GPIO_FN_MSIOF0_MCK0,
188 GPIO_FN_A23_EA23, GPIO_FN_PORT111_KEYIN3,
189 GPIO_FN_DV_DL5, GPIO_FN_MSIOF0_MCK1,
190 GPIO_FN_A24_EA24, GPIO_FN_PORT112_KEYIN4,
191 GPIO_FN_DV_DL6, GPIO_FN_MSIOF0_RXD,
192 GPIO_FN_A25_EA25, GPIO_FN_PORT113_KEYIN5,
193 GPIO_FN_DV_DL7, GPIO_FN_MSIOF0_SS2,
194 GPIO_FN_A26, GPIO_FN_PORT113_KEYIN6, GPIO_FN_DV_CLKIL,
195 GPIO_FN_D0_ED0_NAF0, GPIO_FN_D1_ED1_NAF1, GPIO_FN_D2_ED2_NAF2,
196 GPIO_FN_D3_ED3_NAF3, GPIO_FN_D4_ED4_NAF4, GPIO_FN_D5_ED5_NAF5,
197 GPIO_FN_D6_ED6_NAF6, GPIO_FN_D7_ED7_NAF7, GPIO_FN_D8_ED8_NAF8,
198 GPIO_FN_D9_ED9_NAF9, GPIO_FN_D10_ED10_NAF10, GPIO_FN_D11_ED11_NAF11,
199 GPIO_FN_D12_ED12_NAF12, GPIO_FN_D13_ED13_NAF13,
200 GPIO_FN_D14_ED14_NAF14, GPIO_FN_D15_ED15_NAF15,
201 GPIO_FN_CS4, GPIO_FN_CS5A, GPIO_FN_CS5B, GPIO_FN_FCE1,
202 GPIO_FN_CS6B, GPIO_FN_XCS2, GPIO_FN_FCE0, GPIO_FN_CS6A,
203 GPIO_FN_DACK0, GPIO_FN_WAIT, GPIO_FN_DREQ0, GPIO_FN_RD_XRD,
204 GPIO_FN_A27, GPIO_FN_RDWR_XWE, GPIO_FN_WE0_XWR0_FWE,
205 GPIO_FN_WE1_XWR1, GPIO_FN_FRB, GPIO_FN_CKO,
206 GPIO_FN_NBRSTOUT, GPIO_FN_NBRST,
207
208 /* 49-4 (FN) */
209 GPIO_FN_RFSPO0, GPIO_FN_PORT146_VIO_CKO2, GPIO_FN_TSTMD,
210 GPIO_FN_VIO_VD, GPIO_FN_VIO_HD,
211 GPIO_FN_VIO_D0, GPIO_FN_VIO_D1, GPIO_FN_VIO_D2,
212 GPIO_FN_VIO_D3, GPIO_FN_VIO_D4, GPIO_FN_VIO_D5,
213 GPIO_FN_VIO_D6, GPIO_FN_VIO_D7, GPIO_FN_VIO_D8,
214 GPIO_FN_VIO_D9, GPIO_FN_VIO_D10, GPIO_FN_VIO_D11,
215 GPIO_FN_VIO_D12, GPIO_FN_VIO_D13, GPIO_FN_VIO_D14,
216 GPIO_FN_VIO_D15, GPIO_FN_VIO_CLK, GPIO_FN_VIO_FIELD,
217 GPIO_FN_VIO_CKO,
218 GPIO_FN_MFG3_IN1, GPIO_FN_MFG3_IN2,
219 GPIO_FN_M9_SLCD_A01, GPIO_FN_MFG3_OUT1, GPIO_FN_TPU0TO0,
220 GPIO_FN_M10_SLCD_CK1, GPIO_FN_MFG4_IN1, GPIO_FN_TPU0TO1,
221 GPIO_FN_M11_SLCD_SO1, GPIO_FN_MFG4_IN2, GPIO_FN_TPU0TO2,
222 GPIO_FN_M12_SLCD_CE1, GPIO_FN_MFG4_OUT1, GPIO_FN_TPU0TO3,
223 GPIO_FN_LCDD0, GPIO_FN_PORT175_KEYOUT0, GPIO_FN_DV_D0,
224 GPIO_FN_SIUCKA, GPIO_FN_MFG0_OUT2,
225 GPIO_FN_LCDD1, GPIO_FN_PORT176_KEYOUT1, GPIO_FN_DV_D1,
226 GPIO_FN_SIUAOLR, GPIO_FN_BBIF2_TSYNC1,
227 GPIO_FN_LCDD2, GPIO_FN_PORT177_KEYOUT2, GPIO_FN_DV_D2,
228 GPIO_FN_SIUAOBT, GPIO_FN_BBIF2_TSCK1,
229 GPIO_FN_LCDD3, GPIO_FN_PORT178_KEYOUT3, GPIO_FN_DV_D3,
230 GPIO_FN_SIUAOSLD, GPIO_FN_BBIF2_TXD1,
231 GPIO_FN_LCDD4, GPIO_FN_PORT179_KEYOUT4, GPIO_FN_DV_D4,
232 GPIO_FN_SIUAISPD, GPIO_FN_MFG1_OUT2,
233 GPIO_FN_LCDD5, GPIO_FN_PORT180_KEYOUT5, GPIO_FN_DV_D5,
234 GPIO_FN_SIUAILR, GPIO_FN_MFG2_OUT2,
235 GPIO_FN_LCDD6, GPIO_FN_DV_D6,
236 GPIO_FN_SIUAIBT, GPIO_FN_MFG3_OUT2, GPIO_FN_XWR2,
237 GPIO_FN_LCDD7, GPIO_FN_DV_D7,
238 GPIO_FN_SIUAISLD, GPIO_FN_MFG4_OUT2, GPIO_FN_XWR3,
239 GPIO_FN_LCDD8, GPIO_FN_DV_D8, GPIO_FN_D16, GPIO_FN_ED16,
240 GPIO_FN_LCDD9, GPIO_FN_DV_D9, GPIO_FN_D17, GPIO_FN_ED17,
241 GPIO_FN_LCDD10, GPIO_FN_DV_D10, GPIO_FN_D18, GPIO_FN_ED18,
242 GPIO_FN_LCDD11, GPIO_FN_DV_D11, GPIO_FN_D19, GPIO_FN_ED19,
243 GPIO_FN_LCDD12, GPIO_FN_DV_D12, GPIO_FN_D20, GPIO_FN_ED20,
244 GPIO_FN_LCDD13, GPIO_FN_DV_D13, GPIO_FN_D21, GPIO_FN_ED21,
245 GPIO_FN_LCDD14, GPIO_FN_DV_D14, GPIO_FN_D22, GPIO_FN_ED22,
246 GPIO_FN_LCDD15, GPIO_FN_DV_D15, GPIO_FN_D23, GPIO_FN_ED23,
247 GPIO_FN_LCDD16, GPIO_FN_DV_HSYNC, GPIO_FN_D24, GPIO_FN_ED24,
248 GPIO_FN_LCDD17, GPIO_FN_DV_VSYNC, GPIO_FN_D25, GPIO_FN_ED25,
249 GPIO_FN_LCDD18, GPIO_FN_DREQ2, GPIO_FN_MSIOF0L_TSCK,
250 GPIO_FN_D26, GPIO_FN_ED26,
251 GPIO_FN_LCDD19, GPIO_FN_MSIOF0L_TSYNC,
252 GPIO_FN_D27, GPIO_FN_ED27,
253 GPIO_FN_LCDD20, GPIO_FN_TS_SPSYNC1, GPIO_FN_MSIOF0L_MCK0,
254 GPIO_FN_D28, GPIO_FN_ED28,
255 GPIO_FN_LCDD21, GPIO_FN_TS_SDAT1, GPIO_FN_MSIOF0L_MCK1,
256 GPIO_FN_D29, GPIO_FN_ED29,
257 GPIO_FN_LCDD22, GPIO_FN_TS_SDEN1, GPIO_FN_MSIOF0L_SS1,
258 GPIO_FN_D30, GPIO_FN_ED30,
259 GPIO_FN_LCDD23, GPIO_FN_TS_SCK1, GPIO_FN_MSIOF0L_SS2,
260 GPIO_FN_D31, GPIO_FN_ED31,
261 GPIO_FN_LCDDCK, GPIO_FN_LCDWR, GPIO_FN_DV_CKO, GPIO_FN_SIUAOSPD,
262 GPIO_FN_LCDRD, GPIO_FN_DACK2, GPIO_FN_MSIOF0L_RSYNC,
263
264
265 /* 49-5 (FN) */
266 GPIO_FN_LCDHSYN, GPIO_FN_LCDCS, GPIO_FN_LCDCS2, GPIO_FN_DACK3,
267 GPIO_FN_LCDDISP, GPIO_FN_LCDRS, GPIO_FN_DREQ3, GPIO_FN_MSIOF0L_RSCK,
268 GPIO_FN_LCDCSYN, GPIO_FN_LCDCSYN2, GPIO_FN_DV_CKI,
269 GPIO_FN_LCDLCLK, GPIO_FN_DREQ1, GPIO_FN_MSIOF0L_RXD,
270 GPIO_FN_LCDDON, GPIO_FN_LCDDON2, GPIO_FN_DACK1, GPIO_FN_MSIOF0L_TXD,
271 GPIO_FN_VIO_DR0, GPIO_FN_VIO_DR1, GPIO_FN_VIO_DR2, GPIO_FN_VIO_DR3,
272 GPIO_FN_VIO_DR4, GPIO_FN_VIO_DR5, GPIO_FN_VIO_DR6, GPIO_FN_VIO_DR7,
273 GPIO_FN_VIO_VDR, GPIO_FN_VIO_HDR,
274 GPIO_FN_VIO_CLKR, GPIO_FN_VIO_CKOR,
275 GPIO_FN_SCIFA1_TXD, GPIO_FN_GPS_PGFA0,
276 GPIO_FN_SCIFA1_SCK, GPIO_FN_GPS_PGFA1,
277 GPIO_FN_SCIFA1_RTS, GPIO_FN_GPS_EPPSINMON,
278 GPIO_FN_SCIFA1_RXD, GPIO_FN_SCIFA1_CTS,
279 GPIO_FN_MSIOF1_TXD, GPIO_FN_SCIFA1_TXD2, GPIO_FN_GPS_TXD,
280 GPIO_FN_MSIOF1_TSYNC, GPIO_FN_SCIFA1_CTS2, GPIO_FN_I2C_SDA2,
281 GPIO_FN_MSIOF1_TSCK, GPIO_FN_SCIFA1_SCK2,
282 GPIO_FN_MSIOF1_RXD, GPIO_FN_SCIFA1_RXD2, GPIO_FN_GPS_RXD,
283 GPIO_FN_MSIOF1_RSCK, GPIO_FN_SCIFA1_RTS2,
284 GPIO_FN_MSIOF1_RSYNC, GPIO_FN_I2C_SCL2,
285 GPIO_FN_MSIOF1_MCK0, GPIO_FN_MSIOF1_MCK1,
286 GPIO_FN_MSIOF1_SS1, GPIO_FN_EDBGREQ3,
287 GPIO_FN_MSIOF1_SS2,
288 GPIO_FN_PORT236_IROUT, GPIO_FN_IRDA_OUT,
289 GPIO_FN_IRDA_IN, GPIO_FN_IRDA_FIRSEL,
290 GPIO_FN_TPU1TO0, GPIO_FN_TS_SPSYNC3,
291 GPIO_FN_TPU1TO1, GPIO_FN_TS_SDAT3,
292 GPIO_FN_TPU1TO2, GPIO_FN_TS_SDEN3, GPIO_FN_PORT241_MSIOF2_SS1,
293 GPIO_FN_TPU1TO3, GPIO_FN_PORT242_MSIOF2_TSCK,
294 GPIO_FN_M13_BSW, GPIO_FN_PORT243_MSIOF2_TSYNC,
295 GPIO_FN_M14_GSW, GPIO_FN_PORT244_MSIOF2_TXD,
296 GPIO_FN_PORT245_IROUT, GPIO_FN_M15_RSW,
297 GPIO_FN_SOUT3, GPIO_FN_SCIFA2_TXD1,
298 GPIO_FN_SIN3, GPIO_FN_SCIFA2_RXD1,
299 GPIO_FN_XRTS3, GPIO_FN_SCIFA2_RTS1, GPIO_FN_PORT248_MSIOF2_SS2,
300 GPIO_FN_XCTS3, GPIO_FN_SCIFA2_CTS1, GPIO_FN_PORT249_MSIOF2_RXD,
301 GPIO_FN_DINT, GPIO_FN_SCIFA2_SCK1, GPIO_FN_TS_SCK3,
302 GPIO_FN_SDHICLK0, GPIO_FN_TCK2,
303 GPIO_FN_SDHICD0,
304 GPIO_FN_SDHID0_0, GPIO_FN_TMS2,
305 GPIO_FN_SDHID0_1, GPIO_FN_TDO2,
306 GPIO_FN_SDHID0_2, GPIO_FN_TDI2,
307 GPIO_FN_SDHID0_3, GPIO_FN_RTCK2,
308
309 /* 49-6 (FN) */
310 GPIO_FN_SDHICMD0, GPIO_FN_TRST2,
311 GPIO_FN_SDHIWP0, GPIO_FN_EDBGREQ2,
312 GPIO_FN_SDHICLK1, GPIO_FN_TCK3,
313 GPIO_FN_SDHID1_0, GPIO_FN_M11_SLCD_SO2,
314 GPIO_FN_TS_SPSYNC2, GPIO_FN_TMS3,
315 GPIO_FN_SDHID1_1, GPIO_FN_M9_SLCD_AO2,
316 GPIO_FN_TS_SDAT2, GPIO_FN_TDO3,
317 GPIO_FN_SDHID1_2, GPIO_FN_M10_SLCD_CK2,
318 GPIO_FN_TS_SDEN2, GPIO_FN_TDI3,
319 GPIO_FN_SDHID1_3, GPIO_FN_M12_SLCD_CE2,
320 GPIO_FN_TS_SCK2, GPIO_FN_RTCK3,
321 GPIO_FN_SDHICMD1, GPIO_FN_TRST3,
322 GPIO_FN_SDHICLK2, GPIO_FN_SCIFB_SCK,
323 GPIO_FN_SDHID2_0, GPIO_FN_SCIFB_TXD,
324 GPIO_FN_SDHID2_1, GPIO_FN_SCIFB_CTS,
325 GPIO_FN_SDHID2_2, GPIO_FN_SCIFB_RXD,
326 GPIO_FN_SDHID2_3, GPIO_FN_SCIFB_RTS,
327 GPIO_FN_SDHICMD2,
328 GPIO_FN_RESETOUTS,
329 GPIO_FN_DIVLOCK,
330};
331
332#endif /* __ASM_SH7367_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index eb98b45c508..26cd1016fad 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -452,6 +452,10 @@ enum {
452 SHDMA_SLAVE_SCIF5_RX, 452 SHDMA_SLAVE_SCIF5_RX,
453 SHDMA_SLAVE_SCIF6_TX, 453 SHDMA_SLAVE_SCIF6_TX,
454 SHDMA_SLAVE_SCIF6_RX, 454 SHDMA_SLAVE_SCIF6_RX,
455 SHDMA_SLAVE_FLCTL0_TX,
456 SHDMA_SLAVE_FLCTL0_RX,
457 SHDMA_SLAVE_FLCTL1_TX,
458 SHDMA_SLAVE_FLCTL1_RX,
455 SHDMA_SLAVE_SDHI0_RX, 459 SHDMA_SLAVE_SDHI0_RX,
456 SHDMA_SLAVE_SDHI0_TX, 460 SHDMA_SLAVE_SDHI0_TX,
457 SHDMA_SLAVE_SDHI1_RX, 461 SHDMA_SLAVE_SDHI1_RX,
@@ -475,8 +479,6 @@ extern struct clk sh7372_dv_clki_div2_clk;
475extern struct clk sh7372_pllc2_clk; 479extern struct clk sh7372_pllc2_clk;
476extern struct clk sh7372_fsiack_clk; 480extern struct clk sh7372_fsiack_clk;
477extern struct clk sh7372_fsibck_clk; 481extern struct clk sh7372_fsibck_clk;
478extern struct clk sh7372_fsidiva_clk;
479extern struct clk sh7372_fsidivb_clk;
480 482
481extern void sh7372_intcs_suspend(void); 483extern void sh7372_intcs_suspend(void);
482extern void sh7372_intcs_resume(void); 484extern void sh7372_intcs_resume(void);
diff --git a/arch/arm/mach-shmobile/include/mach/sh7377.h b/arch/arm/mach-shmobile/include/mach/sh7377.h
deleted file mode 100644
index f580e227dd1..00000000000
--- a/arch/arm/mach-shmobile/include/mach/sh7377.h
+++ /dev/null
@@ -1,360 +0,0 @@
1#ifndef __ASM_SH7377_H__
2#define __ASM_SH7377_H__
3
4/* Pin Function Controller:
5 * GPIO_FN_xx - GPIO used to select pin function
6 * GPIO_PORTxx - GPIO mapped to real I/O pin on CPU
7 */
8enum {
9 /* 55-1 -> 55-5 (GPIO) */
10 GPIO_PORT0, GPIO_PORT1, GPIO_PORT2, GPIO_PORT3, GPIO_PORT4,
11 GPIO_PORT5, GPIO_PORT6, GPIO_PORT7, GPIO_PORT8, GPIO_PORT9,
12
13 GPIO_PORT10, GPIO_PORT11, GPIO_PORT12, GPIO_PORT13, GPIO_PORT14,
14 GPIO_PORT15, GPIO_PORT16, GPIO_PORT17, GPIO_PORT18, GPIO_PORT19,
15
16 GPIO_PORT20, GPIO_PORT21, GPIO_PORT22, GPIO_PORT23, GPIO_PORT24,
17 GPIO_PORT25, GPIO_PORT26, GPIO_PORT27, GPIO_PORT28, GPIO_PORT29,
18
19 GPIO_PORT30, GPIO_PORT31, GPIO_PORT32, GPIO_PORT33, GPIO_PORT34,
20 GPIO_PORT35, GPIO_PORT36, GPIO_PORT37, GPIO_PORT38, GPIO_PORT39,
21
22 GPIO_PORT40, GPIO_PORT41, GPIO_PORT42, GPIO_PORT43, GPIO_PORT44,
23 GPIO_PORT45, GPIO_PORT46, GPIO_PORT47, GPIO_PORT48, GPIO_PORT49,
24
25 GPIO_PORT50, GPIO_PORT51, GPIO_PORT52, GPIO_PORT53, GPIO_PORT54,
26 GPIO_PORT55, GPIO_PORT56, GPIO_PORT57, GPIO_PORT58, GPIO_PORT59,
27
28 GPIO_PORT60, GPIO_PORT61, GPIO_PORT62, GPIO_PORT63, GPIO_PORT64,
29 GPIO_PORT65, GPIO_PORT66, GPIO_PORT67, GPIO_PORT68, GPIO_PORT69,
30
31 GPIO_PORT70, GPIO_PORT71, GPIO_PORT72, GPIO_PORT73, GPIO_PORT74,
32 GPIO_PORT75, GPIO_PORT76, GPIO_PORT77, GPIO_PORT78, GPIO_PORT79,
33
34 GPIO_PORT80, GPIO_PORT81, GPIO_PORT82, GPIO_PORT83, GPIO_PORT84,
35 GPIO_PORT85, GPIO_PORT86, GPIO_PORT87, GPIO_PORT88, GPIO_PORT89,
36
37 GPIO_PORT90, GPIO_PORT91, GPIO_PORT92, GPIO_PORT93, GPIO_PORT94,
38 GPIO_PORT95, GPIO_PORT96, GPIO_PORT97, GPIO_PORT98, GPIO_PORT99,
39
40 GPIO_PORT100, GPIO_PORT101, GPIO_PORT102, GPIO_PORT103, GPIO_PORT104,
41 GPIO_PORT105, GPIO_PORT106, GPIO_PORT107, GPIO_PORT108, GPIO_PORT109,
42
43 GPIO_PORT110, GPIO_PORT111, GPIO_PORT112, GPIO_PORT113, GPIO_PORT114,
44 GPIO_PORT115, GPIO_PORT116, GPIO_PORT117, GPIO_PORT118,
45
46 GPIO_PORT128, GPIO_PORT129,
47
48 GPIO_PORT130, GPIO_PORT131, GPIO_PORT132, GPIO_PORT133, GPIO_PORT134,
49 GPIO_PORT135, GPIO_PORT136, GPIO_PORT137, GPIO_PORT138, GPIO_PORT139,
50
51 GPIO_PORT140, GPIO_PORT141, GPIO_PORT142, GPIO_PORT143, GPIO_PORT144,
52 GPIO_PORT145, GPIO_PORT146, GPIO_PORT147, GPIO_PORT148, GPIO_PORT149,
53
54 GPIO_PORT150, GPIO_PORT151, GPIO_PORT152, GPIO_PORT153, GPIO_PORT154,
55 GPIO_PORT155, GPIO_PORT156, GPIO_PORT157, GPIO_PORT158, GPIO_PORT159,
56
57 GPIO_PORT160, GPIO_PORT161, GPIO_PORT162, GPIO_PORT163, GPIO_PORT164,
58
59 GPIO_PORT192, GPIO_PORT193, GPIO_PORT194,
60 GPIO_PORT195, GPIO_PORT196, GPIO_PORT197, GPIO_PORT198, GPIO_PORT199,
61
62 GPIO_PORT200, GPIO_PORT201, GPIO_PORT202, GPIO_PORT203, GPIO_PORT204,
63 GPIO_PORT205, GPIO_PORT206, GPIO_PORT207, GPIO_PORT208, GPIO_PORT209,
64
65 GPIO_PORT210, GPIO_PORT211, GPIO_PORT212, GPIO_PORT213, GPIO_PORT214,
66 GPIO_PORT215, GPIO_PORT216, GPIO_PORT217, GPIO_PORT218, GPIO_PORT219,
67
68 GPIO_PORT220, GPIO_PORT221, GPIO_PORT222, GPIO_PORT223, GPIO_PORT224,
69 GPIO_PORT225, GPIO_PORT226, GPIO_PORT227, GPIO_PORT228, GPIO_PORT229,
70
71 GPIO_PORT230, GPIO_PORT231, GPIO_PORT232, GPIO_PORT233, GPIO_PORT234,
72 GPIO_PORT235, GPIO_PORT236, GPIO_PORT237, GPIO_PORT238, GPIO_PORT239,
73
74 GPIO_PORT240, GPIO_PORT241, GPIO_PORT242, GPIO_PORT243, GPIO_PORT244,
75 GPIO_PORT245, GPIO_PORT246, GPIO_PORT247, GPIO_PORT248, GPIO_PORT249,
76
77 GPIO_PORT250, GPIO_PORT251, GPIO_PORT252, GPIO_PORT253, GPIO_PORT254,
78 GPIO_PORT255, GPIO_PORT256, GPIO_PORT257, GPIO_PORT258, GPIO_PORT259,
79
80 GPIO_PORT260, GPIO_PORT261, GPIO_PORT262, GPIO_PORT263, GPIO_PORT264,
81
82 /* Special Pull-up / Pull-down Functions */
83 GPIO_FN_PORT66_KEYIN0_PU, GPIO_FN_PORT67_KEYIN1_PU,
84 GPIO_FN_PORT68_KEYIN2_PU, GPIO_FN_PORT69_KEYIN3_PU,
85 GPIO_FN_PORT70_KEYIN4_PU, GPIO_FN_PORT71_KEYIN5_PU,
86 GPIO_FN_PORT72_KEYIN6_PU,
87
88 /* 55-1 (FN) */
89 GPIO_FN_VBUS_0,
90 GPIO_FN_CPORT0,
91 GPIO_FN_CPORT1,
92 GPIO_FN_CPORT2,
93 GPIO_FN_CPORT3,
94 GPIO_FN_CPORT4,
95 GPIO_FN_CPORT5,
96 GPIO_FN_CPORT6,
97 GPIO_FN_CPORT7,
98 GPIO_FN_CPORT8,
99 GPIO_FN_CPORT9,
100 GPIO_FN_CPORT10,
101 GPIO_FN_CPORT11, GPIO_FN_SIN2,
102 GPIO_FN_CPORT12, GPIO_FN_XCTS2,
103 GPIO_FN_CPORT13, GPIO_FN_RFSPO4,
104 GPIO_FN_CPORT14, GPIO_FN_RFSPO5,
105 GPIO_FN_CPORT15, GPIO_FN_SCIFA0_SCK, GPIO_FN_GPS_AGC2,
106 GPIO_FN_CPORT16, GPIO_FN_SCIFA0_TXD, GPIO_FN_GPS_AGC3,
107 GPIO_FN_CPORT17_IC_OE, GPIO_FN_SOUT2,
108 GPIO_FN_CPORT18, GPIO_FN_XRTS2, GPIO_FN_PORT19_VIO_CKO2,
109 GPIO_FN_CPORT19_MPORT1,
110 GPIO_FN_CPORT20, GPIO_FN_RFSPO6,
111 GPIO_FN_CPORT21, GPIO_FN_STATUS0,
112 GPIO_FN_CPORT22, GPIO_FN_STATUS1,
113 GPIO_FN_CPORT23, GPIO_FN_STATUS2, GPIO_FN_RFSPO7,
114 GPIO_FN_B_SYNLD1,
115 GPIO_FN_B_SYNLD2, GPIO_FN_SYSENMSK,
116 GPIO_FN_XMAINPS,
117 GPIO_FN_XDIVPS,
118 GPIO_FN_XIDRST,
119 GPIO_FN_IDCLK, GPIO_FN_IC_DP,
120 GPIO_FN_IDIO, GPIO_FN_IC_DM,
121 GPIO_FN_SOUT1, GPIO_FN_SCIFA4_TXD, GPIO_FN_M02_BERDAT,
122 GPIO_FN_SIN1, GPIO_FN_SCIFA4_RXD, GPIO_FN_XWUP,
123 GPIO_FN_XRTS1, GPIO_FN_SCIFA4_RTS, GPIO_FN_M03_BERCLK,
124 GPIO_FN_XCTS1, GPIO_FN_SCIFA4_CTS,
125 GPIO_FN_PCMCLKO,
126 GPIO_FN_SYNC8KO,
127
128 /* 55-2 (FN) */
129 GPIO_FN_DNPCM_A,
130 GPIO_FN_UPPCM_A,
131 GPIO_FN_VACK,
132 GPIO_FN_XTALB1L,
133 GPIO_FN_GPS_AGC1, GPIO_FN_SCIFA0_RTS,
134 GPIO_FN_GPS_AGC4, GPIO_FN_SCIFA0_RXD,
135 GPIO_FN_GPS_PWRDOWN, GPIO_FN_SCIFA0_CTS,
136 GPIO_FN_GPS_IM,
137 GPIO_FN_GPS_IS,
138 GPIO_FN_GPS_QM,
139 GPIO_FN_GPS_QS,
140 GPIO_FN_FMSOCK, GPIO_FN_PORT49_IRDA_OUT, GPIO_FN_PORT49_IROUT,
141 GPIO_FN_FMSOOLR, GPIO_FN_BBIF2_TSYNC2, GPIO_FN_TPU2TO2, GPIO_FN_IPORT3,
142 GPIO_FN_FMSIOLR,
143 GPIO_FN_FMSOOBT, GPIO_FN_BBIF2_TSCK2, GPIO_FN_TPU2TO3, GPIO_FN_OPORT1,
144 GPIO_FN_FMSIOBT,
145 GPIO_FN_FMSOSLD, GPIO_FN_BBIF2_TXD2, GPIO_FN_OPORT2,
146 GPIO_FN_FMSOILR, GPIO_FN_PORT53_IRDA_IN, GPIO_FN_TPU3TO3,
147 GPIO_FN_OPORT3, GPIO_FN_FMSIILR,
148 GPIO_FN_FMSOIBT, GPIO_FN_PORT54_IRDA_FIRSEL, GPIO_FN_TPU3TO2,
149 GPIO_FN_FMSIIBT,
150 GPIO_FN_FMSISLD, GPIO_FN_MFG0_OUT1, GPIO_FN_TPU0TO0,
151 GPIO_FN_A0_EA0, GPIO_FN_BS,
152 GPIO_FN_A12_EA12, GPIO_FN_PORT58_VIO_CKOR, GPIO_FN_TPU4TO2,
153 GPIO_FN_A13_EA13, GPIO_FN_PORT59_IROUT, GPIO_FN_MFG0_OUT2,
154 GPIO_FN_TPU0TO1,
155 GPIO_FN_A14_EA14, GPIO_FN_PORT60_KEYOUT5,
156 GPIO_FN_A15_EA15, GPIO_FN_PORT61_KEYOUT4,
157 GPIO_FN_A16_EA16, GPIO_FN_PORT62_KEYOUT3, GPIO_FN_MSIOF0_SS1,
158 GPIO_FN_A17_EA17, GPIO_FN_PORT63_KEYOUT2, GPIO_FN_MSIOF0_TSYNC,
159 GPIO_FN_A18_EA18, GPIO_FN_PORT64_KEYOUT1, GPIO_FN_MSIOF0_TSCK,
160 GPIO_FN_A19_EA19, GPIO_FN_PORT65_KEYOUT0, GPIO_FN_MSIOF0_TXD,
161 GPIO_FN_A20_EA20, GPIO_FN_PORT66_KEYIN0, GPIO_FN_MSIOF0_RSCK,
162 GPIO_FN_A21_EA21, GPIO_FN_PORT67_KEYIN1, GPIO_FN_MSIOF0_RSYNC,
163 GPIO_FN_A22_EA22, GPIO_FN_PORT68_KEYIN2, GPIO_FN_MSIOF0_MCK0,
164 GPIO_FN_A23_EA23, GPIO_FN_PORT69_KEYIN3, GPIO_FN_MSIOF0_MCK1,
165 GPIO_FN_A24_EA24, GPIO_FN_PORT70_KEYIN4, GPIO_FN_MSIOF0_RXD,
166 GPIO_FN_A25_EA25, GPIO_FN_PORT71_KEYIN5, GPIO_FN_MSIOF0_SS2,
167 GPIO_FN_A26, GPIO_FN_PORT72_KEYIN6,
168 GPIO_FN_D0_ED0_NAF0,
169 GPIO_FN_D1_ED1_NAF1,
170 GPIO_FN_D2_ED2_NAF2,
171 GPIO_FN_D3_ED3_NAF3,
172 GPIO_FN_D4_ED4_NAF4,
173 GPIO_FN_D5_ED5_NAF5,
174 GPIO_FN_D6_ED6_NAF6,
175 GPIO_FN_D7_ED7_NAF7,
176 GPIO_FN_D8_ED8_NAF8,
177 GPIO_FN_D9_ED9_NAF9,
178 GPIO_FN_D10_ED10_NAF10,
179 GPIO_FN_D11_ED11_NAF11,
180 GPIO_FN_D12_ED12_NAF12,
181 GPIO_FN_D13_ED13_NAF13,
182 GPIO_FN_D14_ED14_NAF14,
183 GPIO_FN_D15_ED15_NAF15,
184 GPIO_FN_CS4,
185 GPIO_FN_CS5A, GPIO_FN_FMSICK,
186 GPIO_FN_CS5B, GPIO_FN_FCE1,
187
188 /* 55-3 (FN) */
189 GPIO_FN_CS6B, GPIO_FN_XCS2, GPIO_FN_CS6A, GPIO_FN_DACK0,
190 GPIO_FN_FCE0,
191 GPIO_FN_WAIT, GPIO_FN_DREQ0,
192 GPIO_FN_RD_XRD,
193 GPIO_FN_WE0_XWR0_FWE,
194 GPIO_FN_WE1_XWR1,
195 GPIO_FN_FRB,
196 GPIO_FN_CKO,
197 GPIO_FN_NBRSTOUT,
198 GPIO_FN_NBRST,
199 GPIO_FN_GPS_EPPSIN,
200 GPIO_FN_LATCHPULSE,
201 GPIO_FN_LTESIGNAL,
202 GPIO_FN_LEGACYSTATE,
203 GPIO_FN_TCKON,
204 GPIO_FN_VIO_VD, GPIO_FN_PORT128_KEYOUT0, GPIO_FN_IPORT0,
205 GPIO_FN_VIO_HD, GPIO_FN_PORT129_KEYOUT1, GPIO_FN_IPORT1,
206 GPIO_FN_VIO_D0, GPIO_FN_PORT130_KEYOUT2, GPIO_FN_PORT130_MSIOF2_RXD,
207 GPIO_FN_VIO_D1, GPIO_FN_PORT131_KEYOUT3, GPIO_FN_PORT131_MSIOF2_SS1,
208 GPIO_FN_VIO_D2, GPIO_FN_PORT132_KEYOUT4, GPIO_FN_PORT132_MSIOF2_SS2,
209 GPIO_FN_VIO_D3, GPIO_FN_PORT133_KEYOUT5, GPIO_FN_PORT133_MSIOF2_TSYNC,
210 GPIO_FN_VIO_D4, GPIO_FN_PORT134_KEYIN0, GPIO_FN_PORT134_MSIOF2_TXD,
211 GPIO_FN_VIO_D5, GPIO_FN_PORT135_KEYIN1, GPIO_FN_PORT135_MSIOF2_TSCK,
212 GPIO_FN_VIO_D6, GPIO_FN_PORT136_KEYIN2,
213 GPIO_FN_VIO_D7, GPIO_FN_PORT137_KEYIN3,
214 GPIO_FN_VIO_D8, GPIO_FN_M9_SLCD_A01, GPIO_FN_PORT138_FSIAOMC,
215 GPIO_FN_VIO_D9, GPIO_FN_M10_SLCD_CK1, GPIO_FN_PORT139_FSIAOLR,
216 GPIO_FN_VIO_D10, GPIO_FN_M11_SLCD_SO1, GPIO_FN_TPU0TO2,
217 GPIO_FN_PORT140_FSIAOBT,
218 GPIO_FN_VIO_D11, GPIO_FN_M12_SLCD_CE1, GPIO_FN_TPU0TO3,
219 GPIO_FN_PORT141_FSIAOSLD,
220 GPIO_FN_VIO_D12, GPIO_FN_M13_BSW, GPIO_FN_PORT142_FSIACK,
221 GPIO_FN_VIO_D13, GPIO_FN_M14_GSW, GPIO_FN_PORT143_FSIAILR,
222 GPIO_FN_VIO_D14, GPIO_FN_M15_RSW, GPIO_FN_PORT144_FSIAIBT,
223 GPIO_FN_VIO_D15, GPIO_FN_TPU1TO3, GPIO_FN_PORT145_FSIAISLD,
224 GPIO_FN_VIO_CLK, GPIO_FN_PORT146_KEYIN4, GPIO_FN_IPORT2,
225 GPIO_FN_VIO_FIELD, GPIO_FN_PORT147_KEYIN5,
226 GPIO_FN_VIO_CKO, GPIO_FN_PORT148_KEYIN6,
227 GPIO_FN_A27, GPIO_FN_RDWR_XWE, GPIO_FN_MFG0_IN1,
228 GPIO_FN_MFG0_IN2,
229 GPIO_FN_TS_SPSYNC3, GPIO_FN_MSIOF2_RSCK,
230 GPIO_FN_TS_SDAT3, GPIO_FN_MSIOF2_RSYNC,
231 GPIO_FN_TPU1TO2, GPIO_FN_TS_SDEN3, GPIO_FN_PORT153_MSIOF2_SS1,
232 GPIO_FN_SOUT3, GPIO_FN_SCIFA2_TXD1, GPIO_FN_MSIOF2_MCK0,
233 GPIO_FN_SIN3, GPIO_FN_SCIFA2_RXD1, GPIO_FN_MSIOF2_MCK1,
234 GPIO_FN_XRTS3, GPIO_FN_SCIFA2_RTS1, GPIO_FN_PORT156_MSIOF2_SS2,
235 GPIO_FN_XCTS3, GPIO_FN_SCIFA2_CTS1, GPIO_FN_PORT157_MSIOF2_RXD,
236
237 /* 55-4 (FN) */
238 GPIO_FN_DINT, GPIO_FN_SCIFA2_SCK1, GPIO_FN_TS_SCK3,
239 GPIO_FN_PORT159_SCIFB_SCK, GPIO_FN_PORT159_SCIFA5_SCK, GPIO_FN_NMI,
240 GPIO_FN_PORT160_SCIFB_TXD, GPIO_FN_PORT160_SCIFA5_TXD, GPIO_FN_SOUT0,
241 GPIO_FN_PORT161_SCIFB_CTS, GPIO_FN_PORT161_SCIFA5_CTS, GPIO_FN_XCTS0,
242 GPIO_FN_MFG3_IN2,
243 GPIO_FN_PORT162_SCIFB_RXD, GPIO_FN_PORT162_SCIFA5_RXD, GPIO_FN_SIN0,
244 GPIO_FN_MFG3_IN1,
245 GPIO_FN_PORT163_SCIFB_RTS, GPIO_FN_PORT163_SCIFA5_RTS, GPIO_FN_XRTS0,
246 GPIO_FN_MFG3_OUT1,
247 GPIO_FN_TPU3TO0,
248 GPIO_FN_LCDD0, GPIO_FN_PORT192_KEYOUT0, GPIO_FN_EXT_CKI,
249 GPIO_FN_LCDD1, GPIO_FN_PORT193_KEYOUT1, GPIO_FN_PORT193_SCIFA5_CTS,
250 GPIO_FN_BBIF2_TSYNC1,
251 GPIO_FN_LCDD2, GPIO_FN_PORT194_KEYOUT2, GPIO_FN_PORT194_SCIFA5_RTS,
252 GPIO_FN_BBIF2_TSCK1,
253 GPIO_FN_LCDD3, GPIO_FN_PORT195_KEYOUT3, GPIO_FN_PORT195_SCIFA5_RXD,
254 GPIO_FN_BBIF2_TXD1,
255 GPIO_FN_LCDD4, GPIO_FN_PORT196_KEYOUT4, GPIO_FN_PORT196_SCIFA5_TXD,
256 GPIO_FN_LCDD5, GPIO_FN_PORT197_KEYOUT5, GPIO_FN_PORT197_SCIFA5_SCK,
257 GPIO_FN_MFG2_OUT2, GPIO_FN_TPU2TO1,
258 GPIO_FN_LCDD6, GPIO_FN_XWR2,
259 GPIO_FN_LCDD7, GPIO_FN_TPU4TO1, GPIO_FN_MFG4_OUT2, GPIO_FN_XWR3,
260 GPIO_FN_LCDD8, GPIO_FN_PORT200_KEYIN0, GPIO_FN_VIO_DR0, GPIO_FN_D16,
261 GPIO_FN_ED16,
262 GPIO_FN_LCDD9, GPIO_FN_PORT201_KEYIN1, GPIO_FN_VIO_DR1, GPIO_FN_D17,
263 GPIO_FN_ED17,
264 GPIO_FN_LCDD10, GPIO_FN_PORT202_KEYIN2, GPIO_FN_VIO_DR2, GPIO_FN_D18,
265 GPIO_FN_ED18,
266 GPIO_FN_LCDD11, GPIO_FN_PORT203_KEYIN3, GPIO_FN_VIO_DR3, GPIO_FN_D19,
267 GPIO_FN_ED19,
268 GPIO_FN_LCDD12, GPIO_FN_PORT204_KEYIN4, GPIO_FN_VIO_DR4, GPIO_FN_D20,
269 GPIO_FN_ED20,
270 GPIO_FN_LCDD13, GPIO_FN_PORT205_KEYIN5, GPIO_FN_VIO_DR5, GPIO_FN_D21,
271 GPIO_FN_ED21,
272 GPIO_FN_LCDD14, GPIO_FN_PORT206_KEYIN6, GPIO_FN_VIO_DR6, GPIO_FN_D22,
273 GPIO_FN_ED22,
274 GPIO_FN_LCDD15, GPIO_FN_PORT207_MSIOF0L_SS1, GPIO_FN_PORT207_KEYOUT0,
275 GPIO_FN_VIO_DR7,
276 GPIO_FN_D23, GPIO_FN_ED23,
277 GPIO_FN_LCDD16, GPIO_FN_PORT208_MSIOF0L_SS2, GPIO_FN_PORT208_KEYOUT1,
278 GPIO_FN_VIO_VDR,
279 GPIO_FN_D24, GPIO_FN_ED24,
280 GPIO_FN_LCDD17, GPIO_FN_PORT209_KEYOUT2, GPIO_FN_VIO_HDR, GPIO_FN_D25,
281 GPIO_FN_ED25,
282 GPIO_FN_LCDD18, GPIO_FN_DREQ2, GPIO_FN_PORT210_MSIOF0L_SS1, GPIO_FN_D26,
283 GPIO_FN_ED26,
284 GPIO_FN_LCDD19, GPIO_FN_PORT211_MSIOF0L_SS2, GPIO_FN_D27, GPIO_FN_ED27,
285 GPIO_FN_LCDD20, GPIO_FN_TS_SPSYNC1, GPIO_FN_MSIOF0L_MCK0, GPIO_FN_D28,
286 GPIO_FN_ED28,
287 GPIO_FN_LCDD21, GPIO_FN_TS_SDAT1, GPIO_FN_MSIOF0L_MCK1, GPIO_FN_D29,
288 GPIO_FN_ED29,
289 GPIO_FN_LCDD22, GPIO_FN_TS_SDEN1, GPIO_FN_MSIOF0L_RSCK, GPIO_FN_D30,
290 GPIO_FN_ED30,
291 GPIO_FN_LCDD23, GPIO_FN_TS_SCK1, GPIO_FN_MSIOF0L_RSYNC, GPIO_FN_D31,
292 GPIO_FN_ED31,
293 GPIO_FN_LCDDCK, GPIO_FN_LCDWR, GPIO_FN_PORT216_KEYOUT3,
294 GPIO_FN_VIO_CLKR,
295 GPIO_FN_LCDRD, GPIO_FN_DACK2, GPIO_FN_MSIOF0L_TSYNC,
296 GPIO_FN_LCDHSYN, GPIO_FN_LCDCS, GPIO_FN_LCDCS2, GPIO_FN_DACK3,
297 GPIO_FN_PORT218_VIO_CKOR, GPIO_FN_PORT218_KEYOUT4,
298 GPIO_FN_LCDDISP, GPIO_FN_LCDRS, GPIO_FN_DREQ3, GPIO_FN_MSIOF0L_TSCK,
299 GPIO_FN_LCDVSYN, GPIO_FN_LCDVSYN2, GPIO_FN_PORT220_KEYOUT5,
300 GPIO_FN_LCDLCLK, GPIO_FN_DREQ1, GPIO_FN_PWEN, GPIO_FN_MSIOF0L_RXD,
301 GPIO_FN_LCDDON, GPIO_FN_LCDDON2, GPIO_FN_DACK1, GPIO_FN_OVCN,
302 GPIO_FN_MSIOF0L_TXD,
303 GPIO_FN_SCIFA1_TXD, GPIO_FN_OVCN2,
304 GPIO_FN_EXTLP, GPIO_FN_SCIFA1_SCK, GPIO_FN_USBTERM,
305 GPIO_FN_PORT226_VIO_CKO2,
306 GPIO_FN_SCIFA1_RTS, GPIO_FN_IDIN,
307 GPIO_FN_SCIFA1_RXD,
308 GPIO_FN_SCIFA1_CTS, GPIO_FN_MFG1_IN1,
309 GPIO_FN_MSIOF1_TXD, GPIO_FN_SCIFA2_TXD2, GPIO_FN_PORT230_FSIAOMC,
310 GPIO_FN_MSIOF1_TSYNC, GPIO_FN_SCIFA2_CTS2, GPIO_FN_PORT231_FSIAOLR,
311 GPIO_FN_MSIOF1_TSCK, GPIO_FN_SCIFA2_SCK2, GPIO_FN_PORT232_FSIAOBT,
312 GPIO_FN_MSIOF1_RXD, GPIO_FN_SCIFA2_RXD2, GPIO_FN_GPS_VCOTRIG,
313 GPIO_FN_PORT233_FSIACK,
314 GPIO_FN_MSIOF1_RSCK, GPIO_FN_SCIFA2_RTS2, GPIO_FN_PORT234_FSIAOSLD,
315 GPIO_FN_MSIOF1_RSYNC, GPIO_FN_OPORT0, GPIO_FN_MFG1_IN2,
316 GPIO_FN_PORT235_FSIAILR,
317 GPIO_FN_MSIOF1_MCK0, GPIO_FN_I2C_SDA2, GPIO_FN_PORT236_FSIAIBT,
318 GPIO_FN_MSIOF1_MCK1, GPIO_FN_I2C_SCL2, GPIO_FN_PORT237_FSIAISLD,
319 GPIO_FN_MSIOF1_SS1, GPIO_FN_EDBGREQ3,
320
321 /* 55-5 (FN) */
322 GPIO_FN_MSIOF1_SS2,
323 GPIO_FN_SCIFA6_TXD,
324 GPIO_FN_PORT241_IRDA_OUT, GPIO_FN_PORT241_IROUT, GPIO_FN_MFG4_OUT1,
325 GPIO_FN_TPU4TO0,
326 GPIO_FN_PORT242_IRDA_IN, GPIO_FN_MFG4_IN2,
327 GPIO_FN_PORT243_IRDA_FIRSEL, GPIO_FN_PORT243_VIO_CKO2,
328 GPIO_FN_PORT244_SCIFA5_CTS, GPIO_FN_MFG2_IN1, GPIO_FN_PORT244_SCIFB_CTS,
329 GPIO_FN_PORT244_MSIOF2_RXD,
330 GPIO_FN_PORT245_SCIFA5_RTS, GPIO_FN_MFG2_IN2, GPIO_FN_PORT245_SCIFB_RTS,
331 GPIO_FN_PORT245_MSIOF2_TXD,
332 GPIO_FN_PORT246_SCIFA5_RXD, GPIO_FN_MFG1_OUT1,
333 GPIO_FN_PORT246_SCIFB_RXD, GPIO_FN_TPU1TO0,
334 GPIO_FN_PORT247_SCIFA5_TXD, GPIO_FN_MFG3_OUT2,
335 GPIO_FN_PORT247_SCIFB_TXD, GPIO_FN_TPU3TO1,
336 GPIO_FN_PORT248_SCIFA5_SCK, GPIO_FN_MFG2_OUT1,
337 GPIO_FN_PORT248_SCIFB_SCK, GPIO_FN_TPU2TO0,
338 GPIO_FN_PORT248_MSIOF2_TSCK,
339 GPIO_FN_PORT249_IROUT, GPIO_FN_MFG4_IN1, GPIO_FN_PORT249_MSIOF2_TSYNC,
340 GPIO_FN_SDHICLK0, GPIO_FN_TCK2_SWCLK_MC0,
341 GPIO_FN_SDHICD0,
342 GPIO_FN_SDHID0_0, GPIO_FN_TMS2_SWDIO_MC0,
343 GPIO_FN_SDHID0_1, GPIO_FN_TDO2_SWO0_MC0,
344 GPIO_FN_SDHID0_2, GPIO_FN_TDI2,
345 GPIO_FN_SDHID0_3, GPIO_FN_RTCK2_SWO1_MC0,
346 GPIO_FN_SDHICMD0, GPIO_FN_TRST2,
347 GPIO_FN_SDHIWP0, GPIO_FN_EDBGREQ2,
348 GPIO_FN_SDHICLK1, GPIO_FN_TCK3_SWCLK_MC1,
349 GPIO_FN_SDHID1_0, GPIO_FN_M11_SLCD_SO2, GPIO_FN_TS_SPSYNC2,
350 GPIO_FN_TMS3_SWDIO_MC1,
351 GPIO_FN_SDHID1_1, GPIO_FN_M9_SLCD_A02, GPIO_FN_TS_SDAT2,
352 GPIO_FN_TDO3_SWO0_MC1,
353 GPIO_FN_SDHID1_2, GPIO_FN_M10_SLCD_CK2, GPIO_FN_TS_SDEN2, GPIO_FN_TDI3,
354 GPIO_FN_SDHID1_3, GPIO_FN_M12_SLCD_CE2, GPIO_FN_TS_SCK2,
355 GPIO_FN_RTCK3_SWO1_MC1,
356 GPIO_FN_SDHICMD1, GPIO_FN_TRST3,
357 GPIO_FN_RESETOUTS,
358};
359
360#endif /* __ASM_SH7377_H__ */
diff --git a/arch/arm/mach-shmobile/intc-sh7367.c b/arch/arm/mach-shmobile/intc-sh7367.c
deleted file mode 100644
index 5bf776495b7..00000000000
--- a/arch/arm/mach-shmobile/intc-sh7367.c
+++ /dev/null
@@ -1,413 +0,0 @@
1/*
2 * sh7367 processor support - INTC hardware block
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/io.h>
24#include <linux/sh_intc.h>
25#include <mach/intc.h>
26#include <mach/irqs.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30enum {
31 UNUSED_INTCA = 0,
32 ENABLED,
33 DISABLED,
34
35 /* interrupt sources INTCA */
36 DIRC,
37 CRYPT1_ERR, CRYPT2_STD,
38 IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1,
39 ARM11_IRQPMU, ARM11_COMMTX, ARM11_COMMRX,
40 ETM11_ACQCMP, ETM11_FULL,
41 MFI_MFIM, MFI_MFIS,
42 BBIF1, BBIF2,
43 USBDMAC_USHDMI,
44 USBHS_USHI0, USBHS_USHI1,
45 CMT1_CMT10, CMT1_CMT11, CMT1_CMT12, CMT1_CMT13, CMT2, CMT3,
46 KEYSC_KEY,
47 SCIFA0, SCIFA1, SCIFA2, SCIFA3,
48 MSIOF2, MSIOF1,
49 SCIFA4, SCIFA5, SCIFB,
50 FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
51 SDHI0,
52 SDHI1,
53 MSU_MSU, MSU_MSU2,
54 IREM,
55 SIU,
56 SPU,
57 IRDA,
58 TPU0, TPU1, TPU2, TPU3, TPU4,
59 LCRC,
60 PINT1, PINT2,
61 TTI20,
62 MISTY,
63 DDM,
64 SDHI2,
65 RWDT0, RWDT1,
66 DMAC_1_DEI0, DMAC_1_DEI1, DMAC_1_DEI2, DMAC_1_DEI3,
67 DMAC_2_DEI4, DMAC_2_DEI5, DMAC_2_DADERR,
68 DMAC2_1_DEI0, DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3,
69 DMAC2_2_DEI4, DMAC2_2_DEI5, DMAC2_2_DADERR,
70 DMAC3_1_DEI0, DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3,
71 DMAC3_2_DEI4, DMAC3_2_DEI5, DMAC3_2_DADERR,
72
73 /* interrupt groups INTCA */
74 DMAC_1, DMAC_2, DMAC2_1, DMAC2_2, DMAC3_1, DMAC3_2,
75 ETM11, ARM11, USBHS, FLCTL, IIC1
76};
77
78static struct intc_vect intca_vectors[] __initdata = {
79 INTC_VECT(DIRC, 0x0560),
80 INTC_VECT(CRYPT1_ERR, 0x05e0),
81 INTC_VECT(CRYPT2_STD, 0x0700),
82 INTC_VECT(IIC1_ALI1, 0x0780), INTC_VECT(IIC1_TACKI1, 0x07a0),
83 INTC_VECT(IIC1_WAITI1, 0x07c0), INTC_VECT(IIC1_DTEI1, 0x07e0),
84 INTC_VECT(ARM11_IRQPMU, 0x0800), INTC_VECT(ARM11_COMMTX, 0x0840),
85 INTC_VECT(ARM11_COMMRX, 0x0860),
86 INTC_VECT(ETM11_ACQCMP, 0x0880), INTC_VECT(ETM11_FULL, 0x08a0),
87 INTC_VECT(MFI_MFIM, 0x0900), INTC_VECT(MFI_MFIS, 0x0920),
88 INTC_VECT(BBIF1, 0x0940), INTC_VECT(BBIF2, 0x0960),
89 INTC_VECT(USBDMAC_USHDMI, 0x0a00),
90 INTC_VECT(USBHS_USHI0, 0x0a20), INTC_VECT(USBHS_USHI1, 0x0a40),
91 INTC_VECT(CMT1_CMT10, 0x0b00), INTC_VECT(CMT1_CMT11, 0x0b20),
92 INTC_VECT(CMT1_CMT12, 0x0b40), INTC_VECT(CMT1_CMT13, 0x0b60),
93 INTC_VECT(CMT2, 0x0b80), INTC_VECT(CMT3, 0x0ba0),
94 INTC_VECT(KEYSC_KEY, 0x0be0),
95 INTC_VECT(SCIFA0, 0x0c00), INTC_VECT(SCIFA1, 0x0c20),
96 INTC_VECT(SCIFA2, 0x0c40), INTC_VECT(SCIFA3, 0x0c60),
97 INTC_VECT(MSIOF2, 0x0c80), INTC_VECT(MSIOF1, 0x0d00),
98 INTC_VECT(SCIFA4, 0x0d20), INTC_VECT(SCIFA5, 0x0d40),
99 INTC_VECT(SCIFB, 0x0d60),
100 INTC_VECT(FLCTL_FLSTEI, 0x0d80), INTC_VECT(FLCTL_FLTENDI, 0x0da0),
101 INTC_VECT(FLCTL_FLTREQ0I, 0x0dc0), INTC_VECT(FLCTL_FLTREQ1I, 0x0de0),
102 INTC_VECT(SDHI0, 0x0e00), INTC_VECT(SDHI0, 0x0e20),
103 INTC_VECT(SDHI0, 0x0e40), INTC_VECT(SDHI0, 0x0e60),
104 INTC_VECT(SDHI1, 0x0e80), INTC_VECT(SDHI1, 0x0ea0),
105 INTC_VECT(SDHI1, 0x0ec0), INTC_VECT(SDHI1, 0x0ee0),
106 INTC_VECT(MSU_MSU, 0x0f20), INTC_VECT(MSU_MSU2, 0x0f40),
107 INTC_VECT(IREM, 0x0f60),
108 INTC_VECT(SIU, 0x0fa0),
109 INTC_VECT(SPU, 0x0fc0),
110 INTC_VECT(IRDA, 0x0480),
111 INTC_VECT(TPU0, 0x04a0), INTC_VECT(TPU1, 0x04c0),
112 INTC_VECT(TPU2, 0x04e0), INTC_VECT(TPU3, 0x0500),
113 INTC_VECT(TPU4, 0x0520),
114 INTC_VECT(LCRC, 0x0540),
115 INTC_VECT(PINT1, 0x1000), INTC_VECT(PINT2, 0x1020),
116 INTC_VECT(TTI20, 0x1100),
117 INTC_VECT(MISTY, 0x1120),
118 INTC_VECT(DDM, 0x1140),
119 INTC_VECT(SDHI2, 0x1200), INTC_VECT(SDHI2, 0x1220),
120 INTC_VECT(SDHI2, 0x1240), INTC_VECT(SDHI2, 0x1260),
121 INTC_VECT(RWDT0, 0x1280), INTC_VECT(RWDT1, 0x12a0),
122 INTC_VECT(DMAC_1_DEI0, 0x2000), INTC_VECT(DMAC_1_DEI1, 0x2020),
123 INTC_VECT(DMAC_1_DEI2, 0x2040), INTC_VECT(DMAC_1_DEI3, 0x2060),
124 INTC_VECT(DMAC_2_DEI4, 0x2080), INTC_VECT(DMAC_2_DEI5, 0x20a0),
125 INTC_VECT(DMAC_2_DADERR, 0x20c0),
126 INTC_VECT(DMAC2_1_DEI0, 0x2100), INTC_VECT(DMAC2_1_DEI1, 0x2120),
127 INTC_VECT(DMAC2_1_DEI2, 0x2140), INTC_VECT(DMAC2_1_DEI3, 0x2160),
128 INTC_VECT(DMAC2_2_DEI4, 0x2180), INTC_VECT(DMAC2_2_DEI5, 0x21a0),
129 INTC_VECT(DMAC2_2_DADERR, 0x21c0),
130 INTC_VECT(DMAC3_1_DEI0, 0x2200), INTC_VECT(DMAC3_1_DEI1, 0x2220),
131 INTC_VECT(DMAC3_1_DEI2, 0x2240), INTC_VECT(DMAC3_1_DEI3, 0x2260),
132 INTC_VECT(DMAC3_2_DEI4, 0x2280), INTC_VECT(DMAC3_2_DEI5, 0x22a0),
133 INTC_VECT(DMAC3_2_DADERR, 0x22c0),
134};
135
136static struct intc_group intca_groups[] __initdata = {
137 INTC_GROUP(DMAC_1, DMAC_1_DEI0,
138 DMAC_1_DEI1, DMAC_1_DEI2, DMAC_1_DEI3),
139 INTC_GROUP(DMAC_2, DMAC_2_DEI4,
140 DMAC_2_DEI5, DMAC_2_DADERR),
141 INTC_GROUP(DMAC2_1, DMAC2_1_DEI0,
142 DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3),
143 INTC_GROUP(DMAC2_2, DMAC2_2_DEI4,
144 DMAC2_2_DEI5, DMAC2_2_DADERR),
145 INTC_GROUP(DMAC3_1, DMAC3_1_DEI0,
146 DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3),
147 INTC_GROUP(DMAC3_2, DMAC3_2_DEI4,
148 DMAC3_2_DEI5, DMAC3_2_DADERR),
149 INTC_GROUP(ETM11, ETM11_ACQCMP, ETM11_FULL),
150 INTC_GROUP(ARM11, ARM11_IRQPMU, ARM11_COMMTX, ARM11_COMMTX),
151 INTC_GROUP(USBHS, USBHS_USHI0, USBHS_USHI1),
152 INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI,
153 FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
154 INTC_GROUP(IIC1, IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1),
155};
156
157static struct intc_mask_reg intca_mask_registers[] __initdata = {
158 { 0xe6940080, 0xe69400c0, 8, /* IMR0A / IMCR0A */
159 { DMAC2_1_DEI3, DMAC2_1_DEI2, DMAC2_1_DEI1, DMAC2_1_DEI0,
160 ARM11_IRQPMU, 0, ARM11_COMMTX, ARM11_COMMRX } },
161 { 0xe6940084, 0xe69400c4, 8, /* IMR1A / IMCR1A */
162 { CRYPT1_ERR, CRYPT2_STD, DIRC, 0,
163 DMAC_1_DEI3, DMAC_1_DEI2, DMAC_1_DEI1, DMAC_1_DEI0 } },
164 { 0xe6940088, 0xe69400c8, 8, /* IMR2A / IMCR2A */
165 { PINT1, PINT2, 0, 0,
166 BBIF1, BBIF2, MFI_MFIS, MFI_MFIM } },
167 { 0xe694008c, 0xe69400cc, 8, /* IMR3A / IMCR3A */
168 { DMAC3_1_DEI3, DMAC3_1_DEI2, DMAC3_1_DEI1, DMAC3_1_DEI0,
169 DMAC3_2_DADERR, DMAC3_2_DEI5, DMAC3_2_DEI4, IRDA } },
170 { 0xe6940090, 0xe69400d0, 8, /* IMR4A / IMCR4A */
171 { DDM, 0, 0, 0,
172 0, 0, ETM11_FULL, ETM11_ACQCMP } },
173 { 0xe6940094, 0xe69400d4, 8, /* IMR5A / IMCR5A */
174 { KEYSC_KEY, DMAC_2_DADERR, DMAC_2_DEI5, DMAC_2_DEI4,
175 SCIFA3, SCIFA2, SCIFA1, SCIFA0 } },
176 { 0xe6940098, 0xe69400d8, 8, /* IMR6A / IMCR6A */
177 { SCIFB, SCIFA5, SCIFA4, MSIOF1,
178 0, 0, MSIOF2, 0 } },
179 { 0xe694009c, 0xe69400dc, 8, /* IMR7A / IMCR7A */
180 { DISABLED, ENABLED, ENABLED, ENABLED,
181 FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } },
182 { 0xe69400a0, 0xe69400e0, 8, /* IMR8A / IMCR8A */
183 { DISABLED, ENABLED, ENABLED, ENABLED,
184 TTI20, USBDMAC_USHDMI, SPU, SIU } },
185 { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */
186 { CMT1_CMT13, CMT1_CMT12, CMT1_CMT11, CMT1_CMT10,
187 CMT2, USBHS_USHI1, USBHS_USHI0, 0 } },
188 { 0xe69400a8, 0xe69400e8, 8, /* IMR10A / IMCR10A */
189 { 0, DMAC2_2_DADERR, DMAC2_2_DEI5, DMAC2_2_DEI4,
190 0, 0, 0, 0 } },
191 { 0xe69400ac, 0xe69400ec, 8, /* IMR11A / IMCR11A */
192 { IIC1_DTEI1, IIC1_WAITI1, IIC1_TACKI1, IIC1_ALI1,
193 LCRC, MSU_MSU2, IREM, MSU_MSU } },
194 { 0xe69400b0, 0xe69400f0, 8, /* IMR12A / IMCR12A */
195 { 0, 0, TPU0, TPU1,
196 TPU2, TPU3, TPU4, 0 } },
197 { 0xe69400b4, 0xe69400f4, 8, /* IMR13A / IMCR13A */
198 { DISABLED, ENABLED, ENABLED, ENABLED,
199 MISTY, CMT3, RWDT1, RWDT0 } },
200};
201
202static struct intc_prio_reg intca_prio_registers[] __initdata = {
203 { 0xe6940000, 0, 16, 4, /* IPRAA */ { DMAC3_1, DMAC3_2, CMT2, LCRC } },
204 { 0xe6940004, 0, 16, 4, /* IPRBA */ { IRDA, ETM11, BBIF1, BBIF2 } },
205 { 0xe6940008, 0, 16, 4, /* IPRCA */ { CRYPT1_ERR, CRYPT2_STD,
206 CMT1_CMT11, ARM11 } },
207 { 0xe694000c, 0, 16, 4, /* IPRDA */ { PINT1, PINT2,
208 CMT1_CMT12, TPU4 } },
209 { 0xe6940010, 0, 16, 4, /* IPREA */ { DMAC_1, MFI_MFIS,
210 MFI_MFIM, USBHS } },
211 { 0xe6940014, 0, 16, 4, /* IPRFA */ { KEYSC_KEY, DMAC_2,
212 0, CMT1_CMT10 } },
213 { 0xe6940018, 0, 16, 4, /* IPRGA */ { SCIFA0, SCIFA1,
214 SCIFA2, SCIFA3 } },
215 { 0xe694001c, 0, 16, 4, /* IPRGH */ { MSIOF2, USBDMAC_USHDMI,
216 FLCTL, SDHI0 } },
217 { 0xe6940020, 0, 16, 4, /* IPRIA */ { MSIOF1, SCIFA4, MSU_MSU, IIC1 } },
218 { 0xe6940024, 0, 16, 4, /* IPRJA */ { DMAC2_1, DMAC2_2, SIU, TTI20 } },
219 { 0xe6940028, 0, 16, 4, /* IPRKA */ { 0, CMT1_CMT13, IREM, SDHI1 } },
220 { 0xe694002c, 0, 16, 4, /* IPRLA */ { TPU0, TPU1, TPU2, TPU3 } },
221 { 0xe6940030, 0, 16, 4, /* IPRMA */ { MISTY, CMT3, RWDT1, RWDT0 } },
222 { 0xe6940034, 0, 16, 4, /* IPRNA */ { SCIFB, SCIFA5, SPU, DDM } },
223 { 0xe6940038, 0, 16, 4, /* IPROA */ { 0, 0, DIRC, SDHI2 } },
224};
225
226static struct intc_desc intca_desc __initdata = {
227 .name = "sh7367-intca",
228 .force_enable = ENABLED,
229 .force_disable = DISABLED,
230 .hw = INTC_HW_DESC(intca_vectors, intca_groups,
231 intca_mask_registers, intca_prio_registers,
232 NULL, NULL),
233};
234
235INTC_IRQ_PINS_16(intca_irq_pins, 0xe6900000,
236 INTC_VECT, "sh7367-intca-irq-pins");
237
238enum {
239 UNUSED_INTCS = 0,
240
241 INTCS,
242
243 /* interrupt sources INTCS */
244 VIO2_VEU0, VIO2_VEU1, VIO2_VEU2, VIO2_VEU3,
245 VIO3_VOU,
246 RTDMAC_1_DEI0, RTDMAC_1_DEI1, RTDMAC_1_DEI2, RTDMAC_1_DEI3,
247 VIO1_CEU, VIO1_BEU0, VIO1_BEU1, VIO1_BEU2,
248 VPU,
249 SGX530,
250 _2DDMAC_2DDM0, _2DDMAC_2DDM1, _2DDMAC_2DDM2, _2DDMAC_2DDM3,
251 IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2,
252 IPMMU_IPMMUB, IPMMU_IPMMUS,
253 RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR,
254 MSIOF,
255 IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0,
256 TMU_TUNI0, TMU_TUNI1, TMU_TUNI2,
257 CMT,
258 TSIF,
259 IPMMUI,
260 MVI3,
261 ICB,
262 PEP,
263 ASA,
264 BEM,
265 VE2HO,
266 HQE,
267 JPEG,
268 LCDC,
269
270 /* interrupt groups INTCS */
271 _2DDMAC, RTDMAC_1, RTDMAC_2, VEU, BEU, IIC0, IPMMU, IIC2,
272};
273
274static struct intc_vect intcs_vectors[] = {
275 INTCS_VECT(VIO2_VEU0, 0x700), INTCS_VECT(VIO2_VEU1, 0x720),
276 INTCS_VECT(VIO2_VEU2, 0x740), INTCS_VECT(VIO2_VEU3, 0x760),
277 INTCS_VECT(VIO3_VOU, 0x780),
278 INTCS_VECT(RTDMAC_1_DEI0, 0x800), INTCS_VECT(RTDMAC_1_DEI1, 0x820),
279 INTCS_VECT(RTDMAC_1_DEI2, 0x840), INTCS_VECT(RTDMAC_1_DEI3, 0x860),
280 INTCS_VECT(VIO1_CEU, 0x880), INTCS_VECT(VIO1_BEU0, 0x8a0),
281 INTCS_VECT(VIO1_BEU1, 0x8c0), INTCS_VECT(VIO1_BEU2, 0x8e0),
282 INTCS_VECT(VPU, 0x980),
283 INTCS_VECT(SGX530, 0x9e0),
284 INTCS_VECT(_2DDMAC_2DDM0, 0xa00), INTCS_VECT(_2DDMAC_2DDM1, 0xa20),
285 INTCS_VECT(_2DDMAC_2DDM2, 0xa40), INTCS_VECT(_2DDMAC_2DDM3, 0xa60),
286 INTCS_VECT(IIC2_ALI2, 0xa80), INTCS_VECT(IIC2_TACKI2, 0xaa0),
287 INTCS_VECT(IIC2_WAITI2, 0xac0), INTCS_VECT(IIC2_DTEI2, 0xae0),
288 INTCS_VECT(IPMMU_IPMMUB, 0xb20), INTCS_VECT(IPMMU_IPMMUS, 0xb60),
289 INTCS_VECT(RTDMAC_2_DEI4, 0xb80), INTCS_VECT(RTDMAC_2_DEI5, 0xba0),
290 INTCS_VECT(RTDMAC_2_DADERR, 0xbc0),
291 INTCS_VECT(MSIOF, 0xd20),
292 INTCS_VECT(IIC0_ALI0, 0xe00), INTCS_VECT(IIC0_TACKI0, 0xe20),
293 INTCS_VECT(IIC0_WAITI0, 0xe40), INTCS_VECT(IIC0_DTEI0, 0xe60),
294 INTCS_VECT(TMU_TUNI0, 0xe80), INTCS_VECT(TMU_TUNI1, 0xea0),
295 INTCS_VECT(TMU_TUNI2, 0xec0),
296 INTCS_VECT(CMT, 0xf00),
297 INTCS_VECT(TSIF, 0xf20),
298 INTCS_VECT(IPMMUI, 0xf60),
299 INTCS_VECT(MVI3, 0x420),
300 INTCS_VECT(ICB, 0x480),
301 INTCS_VECT(PEP, 0x4a0),
302 INTCS_VECT(ASA, 0x4c0),
303 INTCS_VECT(BEM, 0x4e0),
304 INTCS_VECT(VE2HO, 0x520),
305 INTCS_VECT(HQE, 0x540),
306 INTCS_VECT(JPEG, 0x560),
307 INTCS_VECT(LCDC, 0x580),
308
309 INTC_VECT(INTCS, 0xf80),
310};
311
312static struct intc_group intcs_groups[] __initdata = {
313 INTC_GROUP(_2DDMAC, _2DDMAC_2DDM0, _2DDMAC_2DDM1,
314 _2DDMAC_2DDM2, _2DDMAC_2DDM3),
315 INTC_GROUP(RTDMAC_1, RTDMAC_1_DEI0, RTDMAC_1_DEI1,
316 RTDMAC_1_DEI2, RTDMAC_1_DEI3),
317 INTC_GROUP(RTDMAC_2, RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR),
318 INTC_GROUP(VEU, VIO2_VEU0, VIO2_VEU1, VIO2_VEU2, VIO2_VEU3),
319 INTC_GROUP(BEU, VIO1_BEU0, VIO1_BEU1, VIO1_BEU2),
320 INTC_GROUP(IIC0, IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0),
321 INTC_GROUP(IPMMU, IPMMU_IPMMUS, IPMMU_IPMMUB),
322 INTC_GROUP(IIC2, IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2),
323};
324
325static struct intc_mask_reg intcs_mask_registers[] = {
326 { 0xffd20184, 0xffd201c4, 8, /* IMR1SA / IMCR1SA */
327 { VIO1_BEU2, VIO1_BEU1, VIO1_BEU0, VIO1_CEU,
328 VIO2_VEU3, VIO2_VEU2, VIO2_VEU1, VIO2_VEU0 } },
329 { 0xffd20188, 0xffd201c8, 8, /* IMR2SA / IMCR2SA */
330 { VIO3_VOU, 0, VE2HO, VPU,
331 0, 0, 0, 0 } },
332 { 0xffd2018c, 0xffd201cc, 8, /* IMR3SA / IMCR3SA */
333 { _2DDMAC_2DDM3, _2DDMAC_2DDM2, _2DDMAC_2DDM1, _2DDMAC_2DDM0,
334 BEM, ASA, PEP, ICB } },
335 { 0xffd20190, 0xffd201d0, 8, /* IMR4SA / IMCR4SA */
336 { 0, 0, MVI3, 0,
337 JPEG, HQE, 0, LCDC } },
338 { 0xffd20194, 0xffd201d4, 8, /* IMR5SA / IMCR5SA */
339 { 0, RTDMAC_2_DADERR, RTDMAC_2_DEI5, RTDMAC_2_DEI4,
340 RTDMAC_1_DEI3, RTDMAC_1_DEI2, RTDMAC_1_DEI1, RTDMAC_1_DEI0 } },
341 { 0xffd20198, 0xffd201d8, 8, /* IMR6SA / IMCR6SA */
342 { 0, 0, MSIOF, 0,
343 SGX530, 0, 0, 0 } },
344 { 0xffd2019c, 0xffd201dc, 8, /* IMR7SA / IMCR7SA */
345 { 0, TMU_TUNI2, TMU_TUNI1, TMU_TUNI0,
346 0, 0, 0, 0 } },
347 { 0xffd201a4, 0xffd201e4, 8, /* IMR9SA / IMCR9SA */
348 { 0, 0, 0, CMT,
349 IIC2_DTEI2, IIC2_WAITI2, IIC2_TACKI2, IIC2_ALI2 } },
350 { 0xffd201a8, 0xffd201e8, 8, /* IMR10SA / IMCR10SA */
351 { IPMMU_IPMMUS, 0, IPMMU_IPMMUB, 0,
352 0, 0, 0, 0 } },
353 { 0xffd201ac, 0xffd201ec, 8, /* IMR11SA / IMCR11SA */
354 { IIC0_DTEI0, IIC0_WAITI0, IIC0_TACKI0, IIC0_ALI0,
355 0, 0, IPMMUI, TSIF } },
356 { 0xffd20104, 0, 16, /* INTAMASK */
357 { 0, 0, 0, 0, 0, 0, 0, 0,
358 0, 0, 0, 0, 0, 0, 0, INTCS } },
359};
360
361/* Priority is needed for INTCA to receive the INTCS interrupt */
362static struct intc_prio_reg intcs_prio_registers[] = {
363 { 0xffd20000, 0, 16, 4, /* IPRAS */ { 0, MVI3, _2DDMAC, ICB } },
364 { 0xffd20004, 0, 16, 4, /* IPRBS */ { JPEG, LCDC, 0, 0 } },
365 { 0xffd20008, 0, 16, 4, /* IPRCS */ { BBIF2, 0, 0, 0 } },
366 { 0xffd20010, 0, 16, 4, /* IPRES */ { RTDMAC_1, VIO1_CEU, 0, VPU } },
367 { 0xffd20014, 0, 16, 4, /* IPRFS */ { 0, RTDMAC_2, 0, CMT } },
368 { 0xffd20018, 0, 16, 4, /* IPRGS */ { TMU_TUNI0, TMU_TUNI1,
369 TMU_TUNI2, 0 } },
370 { 0xffd2001c, 0, 16, 4, /* IPRHS */ { 0, VIO3_VOU, VEU, BEU } },
371 { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, MSIOF, TSIF, IIC0 } },
372 { 0xffd20024, 0, 16, 4, /* IPRJS */ { 0, SGX530, 0, 0 } },
373 { 0xffd20028, 0, 16, 4, /* IPRKS */ { BEM, ASA, IPMMUI, PEP } },
374 { 0xffd2002c, 0, 16, 4, /* IPRLS */ { IPMMU, 0, VE2HO, HQE } },
375 { 0xffd20030, 0, 16, 4, /* IPRMS */ { IIC2, 0, 0, 0 } },
376};
377
378static struct resource intcs_resources[] __initdata = {
379 [0] = {
380 .start = 0xffd20000,
381 .end = 0xffd2ffff,
382 .flags = IORESOURCE_MEM,
383 }
384};
385
386static struct intc_desc intcs_desc __initdata = {
387 .name = "sh7367-intcs",
388 .resource = intcs_resources,
389 .num_resources = ARRAY_SIZE(intcs_resources),
390 .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
391 intcs_prio_registers, NULL, NULL),
392};
393
394static void intcs_demux(unsigned int irq, struct irq_desc *desc)
395{
396 void __iomem *reg = (void *)irq_get_handler_data(irq);
397 unsigned int evtcodeas = ioread32(reg);
398
399 generic_handle_irq(intcs_evt2irq(evtcodeas));
400}
401
402void __init sh7367_init_irq(void)
403{
404 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE);
405
406 register_intc_controller(&intca_desc);
407 register_intc_controller(&intca_irq_pins_desc);
408 register_intc_controller(&intcs_desc);
409
410 /* demux using INTEVTSA */
411 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa);
412 irq_set_chained_handler(evt2irq(0xf80), intcs_demux);
413}
diff --git a/arch/arm/mach-shmobile/intc-sh7377.c b/arch/arm/mach-shmobile/intc-sh7377.c
deleted file mode 100644
index b84a460a340..00000000000
--- a/arch/arm/mach-shmobile/intc-sh7377.c
+++ /dev/null
@@ -1,592 +0,0 @@
1/*
2 * sh7377 processor support - INTC hardware block
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/io.h>
24#include <linux/sh_intc.h>
25#include <mach/intc.h>
26#include <mach/irqs.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30enum {
31 UNUSED_INTCA = 0,
32 ENABLED,
33 DISABLED,
34
35 /* interrupt sources INTCA */
36 DIRC,
37 _2DG,
38 CRYPT_STD,
39 IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1,
40 AP_ARM_IRQPMU, AP_ARM_COMMTX, AP_ARM_COMMRX,
41 MFI_MFIM, MFI_MFIS,
42 BBIF1, BBIF2,
43 USBDMAC_USHDMI,
44 USBHS_USHI0, USBHS_USHI1,
45 _3DG_SGX540,
46 CMT1_CMT10, CMT1_CMT11, CMT1_CMT12, CMT1_CMT13, CMT2, CMT3,
47 KEYSC_KEY,
48 SCIFA0, SCIFA1, SCIFA2, SCIFA3,
49 MSIOF2, MSIOF1,
50 SCIFA4, SCIFA5, SCIFB,
51 FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
52 SDHI0,
53 SDHI1,
54 MSU_MSU, MSU_MSU2,
55 IRREM,
56 MSUG,
57 IRDA,
58 TPU0, TPU1, TPU2, TPU3, TPU4,
59 LCRC,
60 PINTCA_PINT1, PINTCA_PINT2,
61 TTI20,
62 MISTY,
63 DDM,
64 RWDT0, RWDT1,
65 DMAC_1_DEI0, DMAC_1_DEI1, DMAC_1_DEI2, DMAC_1_DEI3,
66 DMAC_2_DEI4, DMAC_2_DEI5, DMAC_2_DADERR,
67 DMAC2_1_DEI0, DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3,
68 DMAC2_2_DEI4, DMAC2_2_DEI5, DMAC2_2_DADERR,
69 DMAC3_1_DEI0, DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3,
70 DMAC3_2_DEI4, DMAC3_2_DEI5, DMAC3_2_DADERR,
71 SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM,
72 ICUSB_ICUSB0, ICUSB_ICUSB1,
73 ICUDMC_ICUDMC1, ICUDMC_ICUDMC2,
74 SPU2_SPU0, SPU2_SPU1,
75 FSI,
76 FMSI,
77 SCUV,
78 IPMMU_IPMMUB,
79 AP_ARM_CTIIRQ, AP_ARM_DMAEXTERRIRQ, AP_ARM_DMAIRQ, AP_ARM_DMASIRQ,
80 MFIS2,
81 CPORTR2S,
82 CMT14, CMT15,
83 SCIFA6,
84
85 /* interrupt groups INTCA */
86 DMAC_1, DMAC_2, DMAC2_1, DMAC2_2, DMAC3_1, DMAC3_2, SHWYSTAT,
87 AP_ARM1, AP_ARM2, USBHS, SPU2, FLCTL, IIC1,
88 ICUSB, ICUDMC
89};
90
91static struct intc_vect intca_vectors[] __initdata = {
92 INTC_VECT(DIRC, 0x0560),
93 INTC_VECT(_2DG, 0x05e0),
94 INTC_VECT(CRYPT_STD, 0x0700),
95 INTC_VECT(IIC1_ALI1, 0x0780), INTC_VECT(IIC1_TACKI1, 0x07a0),
96 INTC_VECT(IIC1_WAITI1, 0x07c0), INTC_VECT(IIC1_DTEI1, 0x07e0),
97 INTC_VECT(AP_ARM_IRQPMU, 0x0800), INTC_VECT(AP_ARM_COMMTX, 0x0840),
98 INTC_VECT(AP_ARM_COMMRX, 0x0860),
99 INTC_VECT(MFI_MFIM, 0x0900), INTC_VECT(MFI_MFIS, 0x0920),
100 INTC_VECT(BBIF1, 0x0940), INTC_VECT(BBIF2, 0x0960),
101 INTC_VECT(USBDMAC_USHDMI, 0x0a00),
102 INTC_VECT(USBHS_USHI0, 0x0a20), INTC_VECT(USBHS_USHI1, 0x0a40),
103 INTC_VECT(_3DG_SGX540, 0x0a60),
104 INTC_VECT(CMT1_CMT10, 0x0b00), INTC_VECT(CMT1_CMT11, 0x0b20),
105 INTC_VECT(CMT1_CMT12, 0x0b40), INTC_VECT(CMT1_CMT13, 0x0b60),
106 INTC_VECT(CMT2, 0x0b80), INTC_VECT(CMT3, 0x0ba0),
107 INTC_VECT(KEYSC_KEY, 0x0be0),
108 INTC_VECT(SCIFA0, 0x0c00), INTC_VECT(SCIFA1, 0x0c20),
109 INTC_VECT(SCIFA2, 0x0c40), INTC_VECT(SCIFA3, 0x0c60),
110 INTC_VECT(MSIOF2, 0x0c80), INTC_VECT(MSIOF1, 0x0d00),
111 INTC_VECT(SCIFA4, 0x0d20), INTC_VECT(SCIFA5, 0x0d40),
112 INTC_VECT(SCIFB, 0x0d60),
113 INTC_VECT(FLCTL_FLSTEI, 0x0d80), INTC_VECT(FLCTL_FLTENDI, 0x0da0),
114 INTC_VECT(FLCTL_FLTREQ0I, 0x0dc0), INTC_VECT(FLCTL_FLTREQ1I, 0x0de0),
115 INTC_VECT(SDHI0, 0x0e00), INTC_VECT(SDHI0, 0x0e20),
116 INTC_VECT(SDHI0, 0x0e40), INTC_VECT(SDHI0, 0x0e60),
117 INTC_VECT(SDHI1, 0x0e80), INTC_VECT(SDHI1, 0x0ea0),
118 INTC_VECT(SDHI1, 0x0ec0), INTC_VECT(SDHI1, 0x0ee0),
119 INTC_VECT(MSU_MSU, 0x0f20), INTC_VECT(MSU_MSU2, 0x0f40),
120 INTC_VECT(IRREM, 0x0f60),
121 INTC_VECT(MSUG, 0x0fa0),
122 INTC_VECT(IRDA, 0x0480),
123 INTC_VECT(TPU0, 0x04a0), INTC_VECT(TPU1, 0x04c0),
124 INTC_VECT(TPU2, 0x04e0), INTC_VECT(TPU3, 0x0500),
125 INTC_VECT(TPU4, 0x0520),
126 INTC_VECT(LCRC, 0x0540),
127 INTC_VECT(PINTCA_PINT1, 0x1000), INTC_VECT(PINTCA_PINT2, 0x1020),
128 INTC_VECT(TTI20, 0x1100),
129 INTC_VECT(MISTY, 0x1120),
130 INTC_VECT(DDM, 0x1140),
131 INTC_VECT(RWDT0, 0x1280), INTC_VECT(RWDT1, 0x12a0),
132 INTC_VECT(DMAC_1_DEI0, 0x2000), INTC_VECT(DMAC_1_DEI1, 0x2020),
133 INTC_VECT(DMAC_1_DEI2, 0x2040), INTC_VECT(DMAC_1_DEI3, 0x2060),
134 INTC_VECT(DMAC_2_DEI4, 0x2080), INTC_VECT(DMAC_2_DEI5, 0x20a0),
135 INTC_VECT(DMAC_2_DADERR, 0x20c0),
136 INTC_VECT(DMAC2_1_DEI0, 0x2100), INTC_VECT(DMAC2_1_DEI1, 0x2120),
137 INTC_VECT(DMAC2_1_DEI2, 0x2140), INTC_VECT(DMAC2_1_DEI3, 0x2160),
138 INTC_VECT(DMAC2_2_DEI4, 0x2180), INTC_VECT(DMAC2_2_DEI5, 0x21a0),
139 INTC_VECT(DMAC2_2_DADERR, 0x21c0),
140 INTC_VECT(DMAC3_1_DEI0, 0x2200), INTC_VECT(DMAC3_1_DEI1, 0x2220),
141 INTC_VECT(DMAC3_1_DEI2, 0x2240), INTC_VECT(DMAC3_1_DEI3, 0x2260),
142 INTC_VECT(DMAC3_2_DEI4, 0x2280), INTC_VECT(DMAC3_2_DEI5, 0x22a0),
143 INTC_VECT(DMAC3_2_DADERR, 0x22c0),
144 INTC_VECT(SHWYSTAT_RT, 0x1300), INTC_VECT(SHWYSTAT_HS, 0x1d20),
145 INTC_VECT(SHWYSTAT_COM, 0x1340),
146 INTC_VECT(ICUSB_ICUSB0, 0x1700), INTC_VECT(ICUSB_ICUSB1, 0x1720),
147 INTC_VECT(ICUDMC_ICUDMC1, 0x1780), INTC_VECT(ICUDMC_ICUDMC2, 0x17a0),
148 INTC_VECT(SPU2_SPU0, 0x1800), INTC_VECT(SPU2_SPU1, 0x1820),
149 INTC_VECT(FSI, 0x1840),
150 INTC_VECT(FMSI, 0x1860),
151 INTC_VECT(SCUV, 0x1880),
152 INTC_VECT(IPMMU_IPMMUB, 0x1900),
153 INTC_VECT(AP_ARM_CTIIRQ, 0x1980),
154 INTC_VECT(AP_ARM_DMAEXTERRIRQ, 0x19a0),
155 INTC_VECT(AP_ARM_DMAIRQ, 0x19c0),
156 INTC_VECT(AP_ARM_DMASIRQ, 0x19e0),
157 INTC_VECT(MFIS2, 0x1a00),
158 INTC_VECT(CPORTR2S, 0x1a20),
159 INTC_VECT(CMT14, 0x1a40), INTC_VECT(CMT15, 0x1a60),
160 INTC_VECT(SCIFA6, 0x1a80),
161};
162
163static struct intc_group intca_groups[] __initdata = {
164 INTC_GROUP(DMAC_1, DMAC_1_DEI0,
165 DMAC_1_DEI1, DMAC_1_DEI2, DMAC_1_DEI3),
166 INTC_GROUP(DMAC_2, DMAC_2_DEI4,
167 DMAC_2_DEI5, DMAC_2_DADERR),
168 INTC_GROUP(DMAC2_1, DMAC2_1_DEI0,
169 DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3),
170 INTC_GROUP(DMAC2_2, DMAC2_2_DEI4,
171 DMAC2_2_DEI5, DMAC2_2_DADERR),
172 INTC_GROUP(DMAC3_1, DMAC3_1_DEI0,
173 DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3),
174 INTC_GROUP(DMAC3_2, DMAC3_2_DEI4,
175 DMAC3_2_DEI5, DMAC3_2_DADERR),
176 INTC_GROUP(AP_ARM1, AP_ARM_IRQPMU, AP_ARM_COMMTX, AP_ARM_COMMTX),
177 INTC_GROUP(USBHS, USBHS_USHI0, USBHS_USHI1),
178 INTC_GROUP(SPU2, SPU2_SPU0, SPU2_SPU1),
179 INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI,
180 FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
181 INTC_GROUP(IIC1, IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1),
182 INTC_GROUP(SHWYSTAT, SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM),
183 INTC_GROUP(ICUSB, ICUSB_ICUSB0, ICUSB_ICUSB1),
184 INTC_GROUP(ICUDMC, ICUDMC_ICUDMC1, ICUDMC_ICUDMC2),
185};
186
187static struct intc_mask_reg intca_mask_registers[] __initdata = {
188 { 0xe6940080, 0xe69400c0, 8, /* IMR0A / IMCR0A */
189 { DMAC2_1_DEI3, DMAC2_1_DEI2, DMAC2_1_DEI1, DMAC2_1_DEI0,
190 AP_ARM_IRQPMU, 0, AP_ARM_COMMTX, AP_ARM_COMMRX } },
191 { 0xe6940084, 0xe69400c4, 8, /* IMR1A / IMCR1A */
192 { _2DG, CRYPT_STD, DIRC, 0,
193 DMAC_1_DEI3, DMAC_1_DEI2, DMAC_1_DEI1, DMAC_1_DEI0 } },
194 { 0xe6940088, 0xe69400c8, 8, /* IMR2A / IMCR2A */
195 { PINTCA_PINT1, PINTCA_PINT2, 0, 0,
196 BBIF1, BBIF2, MFI_MFIS, MFI_MFIM } },
197 { 0xe694008c, 0xe69400cc, 8, /* IMR3A / IMCR3A */
198 { DMAC3_1_DEI3, DMAC3_1_DEI2, DMAC3_1_DEI1, DMAC3_1_DEI0,
199 DMAC3_2_DADERR, DMAC3_2_DEI5, DMAC3_2_DEI4, IRDA } },
200 { 0xe6940090, 0xe69400d0, 8, /* IMR4A / IMCR4A */
201 { DDM, 0, 0, 0,
202 0, 0, 0, 0 } },
203 { 0xe6940094, 0xe69400d4, 8, /* IMR5A / IMCR5A */
204 { KEYSC_KEY, DMAC_2_DADERR, DMAC_2_DEI5, DMAC_2_DEI4,
205 SCIFA3, SCIFA2, SCIFA1, SCIFA0 } },
206 { 0xe6940098, 0xe69400d8, 8, /* IMR6A / IMCR6A */
207 { SCIFB, SCIFA5, SCIFA4, MSIOF1,
208 0, 0, MSIOF2, 0 } },
209 { 0xe694009c, 0xe69400dc, 8, /* IMR7A / IMCR7A */
210 { DISABLED, ENABLED, ENABLED, ENABLED,
211 FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } },
212 { 0xe69400a0, 0xe69400e0, 8, /* IMR8A / IMCR8A */
213 { DISABLED, ENABLED, ENABLED, ENABLED,
214 TTI20, USBDMAC_USHDMI, 0, MSUG } },
215 { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */
216 { CMT1_CMT13, CMT1_CMT12, CMT1_CMT11, CMT1_CMT10,
217 CMT2, USBHS_USHI1, USBHS_USHI0, _3DG_SGX540 } },
218 { 0xe69400a8, 0xe69400e8, 8, /* IMR10A / IMCR10A */
219 { 0, DMAC2_2_DADERR, DMAC2_2_DEI5, DMAC2_2_DEI4,
220 0, 0, 0, 0 } },
221 { 0xe69400ac, 0xe69400ec, 8, /* IMR11A / IMCR11A */
222 { IIC1_DTEI1, IIC1_WAITI1, IIC1_TACKI1, IIC1_ALI1,
223 LCRC, MSU_MSU2, IRREM, MSU_MSU } },
224 { 0xe69400b0, 0xe69400f0, 8, /* IMR12A / IMCR12A */
225 { 0, 0, TPU0, TPU1,
226 TPU2, TPU3, TPU4, 0 } },
227 { 0xe69400b4, 0xe69400f4, 8, /* IMR13A / IMCR13A */
228 { 0, 0, 0, 0,
229 MISTY, CMT3, RWDT1, RWDT0 } },
230 { 0xe6950080, 0xe69500c0, 8, /* IMR0A3 / IMCR0A3 */
231 { SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM, 0,
232 0, 0, 0, 0 } },
233 { 0xe6950090, 0xe69500d0, 8, /* IMR4A3 / IMCR4A3 */
234 { ICUSB_ICUSB0, ICUSB_ICUSB1, 0, 0,
235 ICUDMC_ICUDMC1, ICUDMC_ICUDMC2, 0, 0 } },
236 { 0xe6950094, 0xe69500d4, 8, /* IMR5A3 / IMCR5A3 */
237 { SPU2_SPU0, SPU2_SPU1, FSI, FMSI,
238 SCUV, 0, 0, 0 } },
239 { 0xe6950098, 0xe69500d8, 8, /* IMR6A3 / IMCR6A3 */
240 { IPMMU_IPMMUB, 0, 0, 0,
241 AP_ARM_CTIIRQ, AP_ARM_DMAEXTERRIRQ,
242 AP_ARM_DMAIRQ, AP_ARM_DMASIRQ } },
243 { 0xe695009c, 0xe69500dc, 8, /* IMR7A3 / IMCR7A3 */
244 { MFIS2, CPORTR2S, CMT14, CMT15,
245 SCIFA6, 0, 0, 0 } },
246};
247
248static struct intc_prio_reg intca_prio_registers[] __initdata = {
249 { 0xe6940000, 0, 16, 4, /* IPRAA */ { DMAC3_1, DMAC3_2, CMT2, LCRC } },
250 { 0xe6940004, 0, 16, 4, /* IPRBA */ { IRDA, 0, BBIF1, BBIF2 } },
251 { 0xe6940008, 0, 16, 4, /* IPRCA */ { _2DG, CRYPT_STD,
252 CMT1_CMT11, AP_ARM1 } },
253 { 0xe694000c, 0, 16, 4, /* IPRDA */ { PINTCA_PINT1, PINTCA_PINT2,
254 CMT1_CMT12, TPU4 } },
255 { 0xe6940010, 0, 16, 4, /* IPREA */ { DMAC_1, MFI_MFIS,
256 MFI_MFIM, USBHS } },
257 { 0xe6940014, 0, 16, 4, /* IPRFA */ { KEYSC_KEY, DMAC_2,
258 _3DG_SGX540, CMT1_CMT10 } },
259 { 0xe6940018, 0, 16, 4, /* IPRGA */ { SCIFA0, SCIFA1,
260 SCIFA2, SCIFA3 } },
261 { 0xe694001c, 0, 16, 4, /* IPRGH */ { MSIOF2, USBDMAC_USHDMI,
262 FLCTL, SDHI0 } },
263 { 0xe6940020, 0, 16, 4, /* IPRIA */ { MSIOF1, SCIFA4, MSU_MSU, IIC1 } },
264 { 0xe6940024, 0, 16, 4, /* IPRJA */ { DMAC2_1, DMAC2_2, MSUG, TTI20 } },
265 { 0xe6940028, 0, 16, 4, /* IPRKA */ { 0, CMT1_CMT13, IRREM, SDHI1 } },
266 { 0xe694002c, 0, 16, 4, /* IPRLA */ { TPU0, TPU1, TPU2, TPU3 } },
267 { 0xe6940030, 0, 16, 4, /* IPRMA */ { MISTY, CMT3, RWDT1, RWDT0 } },
268 { 0xe6940034, 0, 16, 4, /* IPRNA */ { SCIFB, SCIFA5, 0, DDM } },
269 { 0xe6940038, 0, 16, 4, /* IPROA */ { 0, 0, DIRC, 0 } },
270 { 0xe6950000, 0, 16, 4, /* IPRAA3 */ { SHWYSTAT, 0, 0, 0 } },
271 { 0xe6950020, 0, 16, 4, /* IPRIA3 */ { ICUSB, 0, 0, 0 } },
272 { 0xe6950024, 0, 16, 4, /* IPRJA3 */ { ICUDMC, 0, 0, 0 } },
273 { 0xe6950028, 0, 16, 4, /* IPRKA3 */ { SPU2, 0, FSI, FMSI } },
274 { 0xe695002c, 0, 16, 4, /* IPRLA3 */ { SCUV, 0, 0, 0 } },
275 { 0xe6950030, 0, 16, 4, /* IPRMA3 */ { IPMMU_IPMMUB, 0, 0, 0 } },
276 { 0xe6950034, 0, 16, 4, /* IPRNA3 */ { AP_ARM2, 0, 0, 0 } },
277 { 0xe6950038, 0, 16, 4, /* IPROA3 */ { MFIS2, CPORTR2S,
278 CMT14, CMT15 } },
279 { 0xe694003c, 0, 16, 4, /* IPRPA3 */ { SCIFA6, 0, 0, 0 } },
280};
281
282static struct intc_desc intca_desc __initdata = {
283 .name = "sh7377-intca",
284 .force_enable = ENABLED,
285 .force_disable = DISABLED,
286 .hw = INTC_HW_DESC(intca_vectors, intca_groups,
287 intca_mask_registers, intca_prio_registers,
288 NULL, NULL),
289};
290
291INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000,
292 INTC_VECT, "sh7377-intca-irq-pins");
293
294/* this macro ignore entry which is also in INTCA */
295#define __IGNORE(a...)
296#define __IGNORE0(a...) 0
297
298enum {
299 UNUSED_INTCS = 0,
300
301 INTCS,
302
303 /* interrupt sources INTCS */
304 VEU_VEU0, VEU_VEU1, VEU_VEU2, VEU_VEU3,
305 RTDMAC1_1_DEI0, RTDMAC1_1_DEI1, RTDMAC1_1_DEI2, RTDMAC1_1_DEI3,
306 CEU,
307 BEU_BEU0, BEU_BEU1, BEU_BEU2,
308 __IGNORE(MFI)
309 __IGNORE(BBIF2)
310 VPU,
311 TSIF1,
312 __IGNORE(SGX540)
313 _2DDMAC,
314 IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2,
315 IPMMU_IPMMUR, IPMMU_IPMMUR2,
316 RTDMAC1_2_DEI4, RTDMAC1_2_DEI5, RTDMAC1_2_DADERR,
317 __IGNORE(KEYSC)
318 __IGNORE(TTI20)
319 __IGNORE(MSIOF)
320 IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0,
321 TMU_TUNI0, TMU_TUNI1, TMU_TUNI2,
322 CMT0,
323 TSIF0,
324 __IGNORE(CMT2)
325 LMB,
326 __IGNORE(MSUG)
327 __IGNORE(MSU_MSU, MSU_MSU2)
328 __IGNORE(CTI)
329 MVI3,
330 __IGNORE(RWDT0)
331 __IGNORE(RWDT1)
332 ICB,
333 PEP,
334 ASA,
335 __IGNORE(_2DG)
336 HQE,
337 JPU,
338 LCDC0,
339 __IGNORE(LCRC)
340 RTDMAC2_1_DEI0, RTDMAC2_1_DEI1, RTDMAC2_1_DEI2, RTDMAC2_1_DEI3,
341 RTDMAC2_2_DEI4, RTDMAC2_2_DEI5, RTDMAC2_2_DADERR,
342 FRC,
343 LCDC1,
344 CSIRX,
345 DSITX_DSITX0, DSITX_DSITX1,
346 __IGNORE(SPU2_SPU0, SPU2_SPU1)
347 __IGNORE(FSI)
348 __IGNORE(FMSI)
349 __IGNORE(SCUV)
350 TMU1_TUNI10, TMU1_TUNI11, TMU1_TUNI12,
351 TSIF2,
352 CMT4,
353 __IGNORE(MFIS2)
354 CPORTS2R,
355
356 /* interrupt groups INTCS */
357 RTDMAC1_1, RTDMAC1_2, VEU, BEU, IIC0, __IGNORE(MSU) IPMMU,
358 IIC2, RTDMAC2_1, RTDMAC2_2, DSITX, __IGNORE(SPU2) TMU1,
359};
360
361#define INTCS_INTVECT 0x0F80
362static struct intc_vect intcs_vectors[] __initdata = {
363 INTCS_VECT(VEU_VEU0, 0x0700), INTCS_VECT(VEU_VEU1, 0x0720),
364 INTCS_VECT(VEU_VEU2, 0x0740), INTCS_VECT(VEU_VEU3, 0x0760),
365 INTCS_VECT(RTDMAC1_1_DEI0, 0x0800), INTCS_VECT(RTDMAC1_1_DEI1, 0x0820),
366 INTCS_VECT(RTDMAC1_1_DEI2, 0x0840), INTCS_VECT(RTDMAC1_1_DEI3, 0x0860),
367 INTCS_VECT(CEU, 0x0880),
368 INTCS_VECT(BEU_BEU0, 0x08A0),
369 INTCS_VECT(BEU_BEU1, 0x08C0),
370 INTCS_VECT(BEU_BEU2, 0x08E0),
371 __IGNORE(INTCS_VECT(MFI, 0x0900))
372 __IGNORE(INTCS_VECT(BBIF2, 0x0960))
373 INTCS_VECT(VPU, 0x0980),
374 INTCS_VECT(TSIF1, 0x09A0),
375 __IGNORE(INTCS_VECT(SGX540, 0x09E0))
376 INTCS_VECT(_2DDMAC, 0x0A00),
377 INTCS_VECT(IIC2_ALI2, 0x0A80), INTCS_VECT(IIC2_TACKI2, 0x0AA0),
378 INTCS_VECT(IIC2_WAITI2, 0x0AC0), INTCS_VECT(IIC2_DTEI2, 0x0AE0),
379 INTCS_VECT(IPMMU_IPMMUR, 0x0B00), INTCS_VECT(IPMMU_IPMMUR2, 0x0B20),
380 INTCS_VECT(RTDMAC1_2_DEI4, 0x0B80),
381 INTCS_VECT(RTDMAC1_2_DEI5, 0x0BA0),
382 INTCS_VECT(RTDMAC1_2_DADERR, 0x0BC0),
383 __IGNORE(INTCS_VECT(KEYSC 0x0BE0))
384 __IGNORE(INTCS_VECT(TTI20, 0x0C80))
385 __IGNORE(INTCS_VECT(MSIOF, 0x0D20))
386 INTCS_VECT(IIC0_ALI0, 0x0E00), INTCS_VECT(IIC0_TACKI0, 0x0E20),
387 INTCS_VECT(IIC0_WAITI0, 0x0E40), INTCS_VECT(IIC0_DTEI0, 0x0E60),
388 INTCS_VECT(TMU_TUNI0, 0x0E80),
389 INTCS_VECT(TMU_TUNI1, 0x0EA0),
390 INTCS_VECT(TMU_TUNI2, 0x0EC0),
391 INTCS_VECT(CMT0, 0x0F00),
392 INTCS_VECT(TSIF0, 0x0F20),
393 __IGNORE(INTCS_VECT(CMT2, 0x0F40))
394 INTCS_VECT(LMB, 0x0F60),
395 __IGNORE(INTCS_VECT(MSUG, 0x0F80))
396 __IGNORE(INTCS_VECT(MSU_MSU, 0x0FA0))
397 __IGNORE(INTCS_VECT(MSU_MSU2, 0x0FC0))
398 __IGNORE(INTCS_VECT(CTI, 0x0400))
399 INTCS_VECT(MVI3, 0x0420),
400 __IGNORE(INTCS_VECT(RWDT0, 0x0440))
401 __IGNORE(INTCS_VECT(RWDT1, 0x0460))
402 INTCS_VECT(ICB, 0x0480),
403 INTCS_VECT(PEP, 0x04A0),
404 INTCS_VECT(ASA, 0x04C0),
405 __IGNORE(INTCS_VECT(_2DG, 0x04E0))
406 INTCS_VECT(HQE, 0x0540),
407 INTCS_VECT(JPU, 0x0560),
408 INTCS_VECT(LCDC0, 0x0580),
409 __IGNORE(INTCS_VECT(LCRC, 0x05A0))
410 INTCS_VECT(RTDMAC2_1_DEI0, 0x1300), INTCS_VECT(RTDMAC2_1_DEI1, 0x1320),
411 INTCS_VECT(RTDMAC2_1_DEI2, 0x1340), INTCS_VECT(RTDMAC2_1_DEI3, 0x1360),
412 INTCS_VECT(RTDMAC2_2_DEI4, 0x1380), INTCS_VECT(RTDMAC2_2_DEI5, 0x13A0),
413 INTCS_VECT(RTDMAC2_2_DADERR, 0x13C0),
414 INTCS_VECT(FRC, 0x1700),
415 INTCS_VECT(LCDC1, 0x1780),
416 INTCS_VECT(CSIRX, 0x17A0),
417 INTCS_VECT(DSITX_DSITX0, 0x17C0), INTCS_VECT(DSITX_DSITX1, 0x17E0),
418 __IGNORE(INTCS_VECT(SPU2_SPU0, 0x1800))
419 __IGNORE(INTCS_VECT(SPU2_SPU1, 0x1820))
420 __IGNORE(INTCS_VECT(FSI, 0x1840))
421 __IGNORE(INTCS_VECT(FMSI, 0x1860))
422 __IGNORE(INTCS_VECT(SCUV, 0x1880))
423 INTCS_VECT(TMU1_TUNI10, 0x1900), INTCS_VECT(TMU1_TUNI11, 0x1920),
424 INTCS_VECT(TMU1_TUNI12, 0x1940),
425 INTCS_VECT(TSIF2, 0x1960),
426 INTCS_VECT(CMT4, 0x1980),
427 __IGNORE(INTCS_VECT(MFIS2, 0x1A00))
428 INTCS_VECT(CPORTS2R, 0x1A20),
429
430 INTC_VECT(INTCS, INTCS_INTVECT),
431};
432
433static struct intc_group intcs_groups[] __initdata = {
434 INTC_GROUP(RTDMAC1_1,
435 RTDMAC1_1_DEI0, RTDMAC1_1_DEI1,
436 RTDMAC1_1_DEI2, RTDMAC1_1_DEI3),
437 INTC_GROUP(RTDMAC1_2,
438 RTDMAC1_2_DEI4, RTDMAC1_2_DEI5, RTDMAC1_2_DADERR),
439 INTC_GROUP(VEU, VEU_VEU0, VEU_VEU1, VEU_VEU2, VEU_VEU3),
440 INTC_GROUP(BEU, BEU_BEU0, BEU_BEU1, BEU_BEU2),
441 INTC_GROUP(IIC0, IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0),
442 __IGNORE(INTC_GROUP(MSU, MSU_MSU, MSU_MSU2))
443 INTC_GROUP(IPMMU, IPMMU_IPMMUR, IPMMU_IPMMUR2),
444 INTC_GROUP(IIC2, IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2),
445 INTC_GROUP(RTDMAC2_1,
446 RTDMAC2_1_DEI0, RTDMAC2_1_DEI1,
447 RTDMAC2_1_DEI2, RTDMAC2_1_DEI3),
448 INTC_GROUP(RTDMAC2_2, RTDMAC2_2_DEI4, RTDMAC2_2_DEI5, RTDMAC2_2_DADERR),
449 INTC_GROUP(DSITX, DSITX_DSITX0, DSITX_DSITX1),
450 __IGNORE(INTC_GROUP(SPU2, SPU2_SPU0, SPU2_SPU1))
451 INTC_GROUP(TMU1, TMU1_TUNI10, TMU1_TUNI11, TMU1_TUNI12),
452};
453
454static struct intc_mask_reg intcs_mask_registers[] __initdata = {
455 { 0xE6940184, 0xE69401C4, 8, /* IMR1AS / IMCR1AS */
456 { BEU_BEU2, BEU_BEU1, BEU_BEU0, CEU,
457 VEU_VEU3, VEU_VEU2, VEU_VEU1, VEU_VEU0 } },
458 { 0xE6940188, 0xE69401C8, 8, /* IMR2AS / IMCR2AS */
459 { 0, 0, 0, VPU,
460 __IGNORE0(BBIF2), 0, 0, __IGNORE0(MFI) } },
461 { 0xE694018C, 0xE69401CC, 8, /* IMR3AS / IMCR3AS */
462 { 0, 0, 0, _2DDMAC,
463 __IGNORE0(_2DG), ASA, PEP, ICB } },
464 { 0xE6940190, 0xE69401D0, 8, /* IMR4AS / IMCR4AS */
465 { 0, 0, MVI3, __IGNORE0(CTI),
466 JPU, HQE, __IGNORE0(LCRC), LCDC0 } },
467 { 0xE6940194, 0xE69401D4, 8, /* IMR5AS / IMCR5AS */
468 { __IGNORE0(KEYSC), RTDMAC1_2_DADERR, RTDMAC1_2_DEI5, RTDMAC1_2_DEI4,
469 RTDMAC1_1_DEI3, RTDMAC1_1_DEI2, RTDMAC1_1_DEI1, RTDMAC1_1_DEI0 } },
470 __IGNORE({ 0xE6940198, 0xE69401D8, 8, /* IMR6AS / IMCR6AS */
471 { 0, 0, MSIOF, 0,
472 SGX540, 0, TTI20, 0 } })
473 { 0xE694019C, 0xE69401DC, 8, /* IMR7AS / IMCR7AS */
474 { 0, TMU_TUNI2, TMU_TUNI1, TMU_TUNI0,
475 0, 0, 0, 0 } },
476 __IGNORE({ 0xE69401A0, 0xE69401E0, 8, /* IMR8AS / IMCR8AS */
477 { 0, 0, 0, 0,
478 0, MSU_MSU, MSU_MSU2, MSUG } })
479 { 0xE69401A4, 0xE69401E4, 8, /* IMR9AS / IMCR9AS */
480 { __IGNORE0(RWDT1), __IGNORE0(RWDT0), __IGNORE0(CMT2), CMT0,
481 IIC2_DTEI2, IIC2_WAITI2, IIC2_TACKI2, IIC2_ALI2 } },
482 { 0xE69401A8, 0xE69401E8, 8, /* IMR10AS / IMCR10AS */
483 { 0, 0, IPMMU_IPMMUR, IPMMU_IPMMUR2,
484 0, 0, 0, 0 } },
485 { 0xE69401AC, 0xE69401EC, 8, /* IMR11AS / IMCR11AS */
486 { IIC0_DTEI0, IIC0_WAITI0, IIC0_TACKI0, IIC0_ALI0,
487 0, TSIF1, LMB, TSIF0 } },
488 { 0xE6950180, 0xE69501C0, 8, /* IMR0AS3 / IMCR0AS3 */
489 { RTDMAC2_1_DEI0, RTDMAC2_1_DEI1, RTDMAC2_1_DEI2, RTDMAC2_1_DEI3,
490 RTDMAC2_2_DEI4, RTDMAC2_2_DEI5, RTDMAC2_2_DADERR, 0 } },
491 { 0xE6950190, 0xE69501D0, 8, /* IMR4AS3 / IMCR4AS3 */
492 { FRC, 0, 0, 0,
493 LCDC1, CSIRX, DSITX_DSITX0, DSITX_DSITX1 } },
494 __IGNORE({ 0xE6950194, 0xE69501D4, 8, /* IMR5AS3 / IMCR5AS3 */
495 {SPU2_SPU0, SPU2_SPU1, FSI, FMSI,
496 SCUV, 0, 0, 0 } })
497 { 0xE6950198, 0xE69501D8, 8, /* IMR6AS3 / IMCR6AS3 */
498 { TMU1_TUNI10, TMU1_TUNI11, TMU1_TUNI12, TSIF2,
499 CMT4, 0, 0, 0 } },
500 { 0xE695019C, 0xE69501DC, 8, /* IMR7AS3 / IMCR7AS3 */
501 { __IGNORE0(MFIS2), CPORTS2R, 0, 0,
502 0, 0, 0, 0 } },
503 { 0xFFD20104, 0, 16, /* INTAMASK */
504 { 0, 0, 0, 0, 0, 0, 0, 0,
505 0, 0, 0, 0, 0, 0, 0, INTCS } }
506};
507
508static struct intc_prio_reg intcs_prio_registers[] __initdata = {
509 /* IPRAS */
510 { 0xFFD20000, 0, 16, 4, { __IGNORE0(CTI), MVI3, _2DDMAC, ICB } },
511 /* IPRBS */
512 { 0xFFD20004, 0, 16, 4, { JPU, LCDC0, 0, __IGNORE0(LCRC) } },
513 /* IPRCS */
514 __IGNORE({ 0xFFD20008, 0, 16, 4, { BBIF2, 0, 0, 0 } })
515 /* IPRES */
516 { 0xFFD20010, 0, 16, 4, { RTDMAC1_1, CEU, __IGNORE0(MFI), VPU } },
517 /* IPRFS */
518 { 0xFFD20014, 0, 16, 4,
519 { __IGNORE0(KEYSC), RTDMAC1_2, __IGNORE0(CMT2), CMT0 } },
520 /* IPRGS */
521 { 0xFFD20018, 0, 16, 4, { TMU_TUNI0, TMU_TUNI1, TMU_TUNI2, TSIF1 } },
522 /* IPRHS */
523 { 0xFFD2001C, 0, 16, 4, { __IGNORE0(TTI20), 0, VEU, BEU } },
524 /* IPRIS */
525 { 0xFFD20020, 0, 16, 4, { 0, __IGNORE0(MSIOF), TSIF0, IIC0 } },
526 /* IPRJS */
527 __IGNORE({ 0xFFD20024, 0, 16, 4, { 0, SGX540, MSUG, MSU } })
528 /* IPRKS */
529 { 0xFFD20028, 0, 16, 4, { __IGNORE0(_2DG), ASA, LMB, PEP } },
530 /* IPRLS */
531 { 0xFFD2002C, 0, 16, 4, { IPMMU, 0, 0, HQE } },
532 /* IPRMS */
533 { 0xFFD20030, 0, 16, 4,
534 { IIC2, 0, __IGNORE0(RWDT1), __IGNORE0(RWDT0) } },
535 /* IPRAS3 */
536 { 0xFFD50000, 0, 16, 4, { RTDMAC2_1, 0, 0, 0 } },
537 /* IPRBS3 */
538 { 0xFFD50004, 0, 16, 4, { RTDMAC2_2, 0, 0, 0 } },
539 /* IPRIS3 */
540 { 0xFFD50020, 0, 16, 4, { FRC, 0, 0, 0 } },
541 /* IPRJS3 */
542 { 0xFFD50024, 0, 16, 4, { LCDC1, CSIRX, DSITX, 0 } },
543 /* IPRKS3 */
544 __IGNORE({ 0xFFD50028, 0, 16, 4, { SPU2, 0, FSI, FMSI } })
545 /* IPRLS3 */
546 __IGNORE({ 0xFFD5002C, 0, 16, 4, { SCUV, 0, 0, 0 } })
547 /* IPRMS3 */
548 { 0xFFD50030, 0, 16, 4, { TMU1, 0, 0, TSIF2 } },
549 /* IPRNS3 */
550 { 0xFFD50034, 0, 16, 4, { CMT4, 0, 0, 0 } },
551 /* IPROS3 */
552 { 0xFFD50038, 0, 16, 4, { __IGNORE0(MFIS2), CPORTS2R, 0, 0 } },
553};
554
555static struct resource intcs_resources[] __initdata = {
556 [0] = {
557 .start = 0xffd20000,
558 .end = 0xffd500ff,
559 .flags = IORESOURCE_MEM,
560 }
561};
562
563static struct intc_desc intcs_desc __initdata = {
564 .name = "sh7377-intcs",
565 .resource = intcs_resources,
566 .num_resources = ARRAY_SIZE(intcs_resources),
567 .hw = INTC_HW_DESC(intcs_vectors, intcs_groups,
568 intcs_mask_registers, intcs_prio_registers,
569 NULL, NULL),
570};
571
572static void intcs_demux(unsigned int irq, struct irq_desc *desc)
573{
574 void __iomem *reg = (void *)irq_get_handler_data(irq);
575 unsigned int evtcodeas = ioread32(reg);
576
577 generic_handle_irq(intcs_evt2irq(evtcodeas));
578}
579
580#define INTEVTSA 0xFFD20100
581void __init sh7377_init_irq(void)
582{
583 void __iomem *intevtsa = ioremap_nocache(INTEVTSA, PAGE_SIZE);
584
585 register_intc_controller(&intca_desc);
586 register_intc_controller(&intca_irq_pins_desc);
587 register_intc_controller(&intcs_desc);
588
589 /* demux using INTEVTSA */
590 irq_set_handler_data(evt2irq(INTCS_INTVECT), (void *)intevtsa);
591 irq_set_chained_handler(evt2irq(INTCS_INTVECT), intcs_demux);
592}
diff --git a/arch/arm/mach-shmobile/pfc-r8a7779.c b/arch/arm/mach-shmobile/pfc-r8a7779.c
index cbc26ba2a0a..9513234d322 100644
--- a/arch/arm/mach-shmobile/pfc-r8a7779.c
+++ b/arch/arm/mach-shmobile/pfc-r8a7779.c
@@ -140,7 +140,7 @@ enum {
140 FN_IP7_3_2, FN_IP7_6_4, FN_IP7_9_7, FN_IP7_12_10, 140 FN_IP7_3_2, FN_IP7_6_4, FN_IP7_9_7, FN_IP7_12_10,
141 FN_IP7_14_13, FN_IP2_7_4, FN_IP2_11_8, FN_IP2_15_12, 141 FN_IP7_14_13, FN_IP2_7_4, FN_IP2_11_8, FN_IP2_15_12,
142 FN_IP1_28_25, FN_IP2_3_0, FN_IP8_3_0, FN_IP8_7_4, 142 FN_IP1_28_25, FN_IP2_3_0, FN_IP8_3_0, FN_IP8_7_4,
143 FN_IP8_11_8, FN_IP8_15_12, FN_PENC0, FN_PENC1, 143 FN_IP8_11_8, FN_IP8_15_12, FN_USB_PENC0, FN_USB_PENC1,
144 FN_IP0_2_0, FN_IP8_17_16, FN_IP8_18, FN_IP8_19, 144 FN_IP0_2_0, FN_IP8_17_16, FN_IP8_18, FN_IP8_19,
145 145
146 /* GPSR5 */ 146 /* GPSR5 */
@@ -176,7 +176,7 @@ enum {
176 FN_A0, FN_SD1_DAT3, FN_MMC0_D3, FN_FD3, 176 FN_A0, FN_SD1_DAT3, FN_MMC0_D3, FN_FD3,
177 FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2, 177 FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2,
178 FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C, 178 FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C,
179 FN_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0, 179 FN_USB_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0,
180 FN_SCIF_CLK, FN_TCLK0_C, 180 FN_SCIF_CLK, FN_TCLK0_C,
181 181
182 /* IPSR1 */ 182 /* IPSR1 */
@@ -447,7 +447,7 @@ enum {
447 A0_MARK, SD1_DAT3_MARK, MMC0_D3_MARK, FD3_MARK, 447 A0_MARK, SD1_DAT3_MARK, MMC0_D3_MARK, FD3_MARK,
448 BS_MARK, SD1_DAT2_MARK, MMC0_D2_MARK, FD2_MARK, 448 BS_MARK, SD1_DAT2_MARK, MMC0_D2_MARK, FD2_MARK,
449 ATADIR0_MARK, SDSELF_MARK, HCTS1_MARK, TX4_C_MARK, 449 ATADIR0_MARK, SDSELF_MARK, HCTS1_MARK, TX4_C_MARK,
450 PENC2_MARK, SCK0_MARK, PWM1_MARK, PWMFSW0_MARK, 450 USB_PENC2_MARK, SCK0_MARK, PWM1_MARK, PWMFSW0_MARK,
451 SCIF_CLK_MARK, TCLK0_C_MARK, 451 SCIF_CLK_MARK, TCLK0_C_MARK,
452 452
453 EX_CS0_MARK, RX3_C_IRDA_RX_C_MARK, MMC0_D6_MARK, 453 EX_CS0_MARK, RX3_C_IRDA_RX_C_MARK, MMC0_D6_MARK,
@@ -658,7 +658,7 @@ static pinmux_enum_t pinmux_data[] = {
658 PINMUX_DATA(A18_MARK, FN_A18), 658 PINMUX_DATA(A18_MARK, FN_A18),
659 PINMUX_DATA(A19_MARK, FN_A19), 659 PINMUX_DATA(A19_MARK, FN_A19),
660 660
661 PINMUX_IPSR_DATA(IP0_2_0, PENC2), 661 PINMUX_IPSR_DATA(IP0_2_0, USB_PENC2),
662 PINMUX_IPSR_MODSEL_DATA(IP0_2_0, SCK0, SEL_SCIF0_0), 662 PINMUX_IPSR_MODSEL_DATA(IP0_2_0, SCK0, SEL_SCIF0_0),
663 PINMUX_IPSR_DATA(IP0_2_0, PWM1), 663 PINMUX_IPSR_DATA(IP0_2_0, PWM1),
664 PINMUX_IPSR_MODSEL_DATA(IP0_2_0, PWMFSW0, SEL_PWMFSW_0), 664 PINMUX_IPSR_MODSEL_DATA(IP0_2_0, PWMFSW0, SEL_PWMFSW_0),
@@ -1456,7 +1456,7 @@ static struct pinmux_gpio pinmux_gpios[] = {
1456 GPIO_FN(A19), 1456 GPIO_FN(A19),
1457 1457
1458 /* IPSR0 */ 1458 /* IPSR0 */
1459 GPIO_FN(PENC2), GPIO_FN(SCK0), GPIO_FN(PWM1), GPIO_FN(PWMFSW0), 1459 GPIO_FN(USB_PENC2), GPIO_FN(SCK0), GPIO_FN(PWM1), GPIO_FN(PWMFSW0),
1460 GPIO_FN(SCIF_CLK), GPIO_FN(TCLK0_C), GPIO_FN(BS), GPIO_FN(SD1_DAT2), 1460 GPIO_FN(SCIF_CLK), GPIO_FN(TCLK0_C), GPIO_FN(BS), GPIO_FN(SD1_DAT2),
1461 GPIO_FN(MMC0_D2), GPIO_FN(FD2), GPIO_FN(ATADIR0), GPIO_FN(SDSELF), 1461 GPIO_FN(MMC0_D2), GPIO_FN(FD2), GPIO_FN(ATADIR0), GPIO_FN(SDSELF),
1462 GPIO_FN(HCTS1), GPIO_FN(TX4_C), GPIO_FN(A0), GPIO_FN(SD1_DAT3), 1462 GPIO_FN(HCTS1), GPIO_FN(TX4_C), GPIO_FN(A0), GPIO_FN(SD1_DAT3),
@@ -1865,8 +1865,8 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1865 GP_4_30_FN, FN_IP8_18, 1865 GP_4_30_FN, FN_IP8_18,
1866 GP_4_29_FN, FN_IP8_17_16, 1866 GP_4_29_FN, FN_IP8_17_16,
1867 GP_4_28_FN, FN_IP0_2_0, 1867 GP_4_28_FN, FN_IP0_2_0,
1868 GP_4_27_FN, FN_PENC1, 1868 GP_4_27_FN, FN_USB_PENC1,
1869 GP_4_26_FN, FN_PENC0, 1869 GP_4_26_FN, FN_USB_PENC0,
1870 GP_4_25_FN, FN_IP8_15_12, 1870 GP_4_25_FN, FN_IP8_15_12,
1871 GP_4_24_FN, FN_IP8_11_8, 1871 GP_4_24_FN, FN_IP8_11_8,
1872 GP_4_23_FN, FN_IP8_7_4, 1872 GP_4_23_FN, FN_IP8_7_4,
@@ -1981,7 +1981,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1981 FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2, 1981 FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2,
1982 FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C, 1982 FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C,
1983 /* IP0_2_0 [3] */ 1983 /* IP0_2_0 [3] */
1984 FN_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0, 1984 FN_USB_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0,
1985 FN_SCIF_CLK, FN_TCLK0_C, 0, 0 } 1985 FN_SCIF_CLK, FN_TCLK0_C, 0, 0 }
1986 }, 1986 },
1987 { PINMUX_CFG_REG_VAR("IPSR1", 0xfffc0024, 32, 1987 { PINMUX_CFG_REG_VAR("IPSR1", 0xfffc0024, 32,
diff --git a/arch/arm/mach-shmobile/pfc-sh7367.c b/arch/arm/mach-shmobile/pfc-sh7367.c
deleted file mode 100644
index c0c137f3905..00000000000
--- a/arch/arm/mach-shmobile/pfc-sh7367.c
+++ /dev/null
@@ -1,1727 +0,0 @@
1/*
2 * sh7367 processor support - PFC hardware block
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/sh_pfc.h>
22#include <mach/sh7367.h>
23
24#define CPU_ALL_PORT(fn, pfx, sfx) \
25 PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
26 PORT_10(fn, pfx##10, sfx), PORT_90(fn, pfx##1, sfx), \
27 PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
28 PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
29 PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
30 PORT_10(fn, pfx##26, sfx), PORT_1(fn, pfx##270, sfx), \
31 PORT_1(fn, pfx##271, sfx), PORT_1(fn, pfx##272, sfx)
32
33enum {
34 PINMUX_RESERVED = 0,
35
36 PINMUX_DATA_BEGIN,
37 PORT_ALL(DATA), /* PORT0_DATA -> PORT272_DATA */
38 PINMUX_DATA_END,
39
40 PINMUX_INPUT_BEGIN,
41 PORT_ALL(IN), /* PORT0_IN -> PORT272_IN */
42 PINMUX_INPUT_END,
43
44 PINMUX_INPUT_PULLUP_BEGIN,
45 PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT272_IN_PU */
46 PINMUX_INPUT_PULLUP_END,
47
48 PINMUX_INPUT_PULLDOWN_BEGIN,
49 PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT272_IN_PD */
50 PINMUX_INPUT_PULLDOWN_END,
51
52 PINMUX_OUTPUT_BEGIN,
53 PORT_ALL(OUT), /* PORT0_OUT -> PORT272_OUT */
54 PINMUX_OUTPUT_END,
55
56 PINMUX_FUNCTION_BEGIN,
57 PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT272_FN_IN */
58 PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT272_FN_OUT */
59 PORT_ALL(FN0), /* PORT0_FN0 -> PORT272_FN0 */
60 PORT_ALL(FN1), /* PORT0_FN1 -> PORT272_FN1 */
61 PORT_ALL(FN2), /* PORT0_FN2 -> PORT272_FN2 */
62 PORT_ALL(FN3), /* PORT0_FN3 -> PORT272_FN3 */
63 PORT_ALL(FN4), /* PORT0_FN4 -> PORT272_FN4 */
64 PORT_ALL(FN5), /* PORT0_FN5 -> PORT272_FN5 */
65 PORT_ALL(FN6), /* PORT0_FN6 -> PORT272_FN6 */
66 PORT_ALL(FN7), /* PORT0_FN7 -> PORT272_FN7 */
67
68 MSELBCR_MSEL2_1, MSELBCR_MSEL2_0,
69 PINMUX_FUNCTION_END,
70
71 PINMUX_MARK_BEGIN,
72 /* Special Pull-up / Pull-down Functions */
73 PORT48_KEYIN0_PU_MARK, PORT49_KEYIN1_PU_MARK,
74 PORT50_KEYIN2_PU_MARK, PORT55_KEYIN3_PU_MARK,
75 PORT56_KEYIN4_PU_MARK, PORT57_KEYIN5_PU_MARK,
76 PORT58_KEYIN6_PU_MARK,
77
78 /* 49-1 */
79 VBUS0_MARK, CPORT0_MARK, CPORT1_MARK, CPORT2_MARK,
80 CPORT3_MARK, CPORT4_MARK, CPORT5_MARK, CPORT6_MARK,
81 CPORT7_MARK, CPORT8_MARK, CPORT9_MARK, CPORT10_MARK,
82 CPORT11_MARK, SIN2_MARK, CPORT12_MARK, XCTS2_MARK,
83 CPORT13_MARK, RFSPO4_MARK, CPORT14_MARK, RFSPO5_MARK,
84 CPORT15_MARK, CPORT16_MARK, CPORT17_MARK, SOUT2_MARK,
85 CPORT18_MARK, XRTS2_MARK, CPORT19_MARK, CPORT20_MARK,
86 RFSPO6_MARK, CPORT21_MARK, STATUS0_MARK, CPORT22_MARK,
87 STATUS1_MARK, CPORT23_MARK, STATUS2_MARK, RFSPO7_MARK,
88 MPORT0_MARK, MPORT1_MARK, B_SYNLD1_MARK, B_SYNLD2_MARK,
89 XMAINPS_MARK, XDIVPS_MARK, XIDRST_MARK, IDCLK_MARK,
90 IDIO_MARK, SOUT1_MARK, SCIFA4_TXD_MARK,
91 M02_BERDAT_MARK, SIN1_MARK, SCIFA4_RXD_MARK, XWUP_MARK,
92 XRTS1_MARK, SCIFA4_RTS_MARK, M03_BERCLK_MARK,
93 XCTS1_MARK, SCIFA4_CTS_MARK,
94
95 /* 49-2 */
96 HSU_IQ_AGC6_MARK, MFG2_IN2_MARK, MSIOF2_MCK0_MARK,
97 HSU_IQ_AGC5_MARK, MFG2_IN1_MARK, MSIOF2_MCK1_MARK,
98 HSU_IQ_AGC4_MARK, MSIOF2_RSYNC_MARK,
99 HSU_IQ_AGC3_MARK, MFG2_OUT1_MARK, MSIOF2_RSCK_MARK,
100 HSU_IQ_AGC2_MARK, PORT42_KEYOUT0_MARK,
101 HSU_IQ_AGC1_MARK, PORT43_KEYOUT1_MARK,
102 HSU_IQ_AGC0_MARK, PORT44_KEYOUT2_MARK,
103 HSU_IQ_AGC_ST_MARK, PORT45_KEYOUT3_MARK,
104 HSU_IQ_PDO_MARK, PORT46_KEYOUT4_MARK,
105 HSU_IQ_PYO_MARK, PORT47_KEYOUT5_MARK,
106 HSU_EN_TXMUX_G3MO_MARK, PORT48_KEYIN0_MARK,
107 HSU_I_TXMUX_G3MO_MARK, PORT49_KEYIN1_MARK,
108 HSU_Q_TXMUX_G3MO_MARK, PORT50_KEYIN2_MARK,
109 HSU_SYO_MARK, PORT51_MSIOF2_TSYNC_MARK,
110 HSU_SDO_MARK, PORT52_MSIOF2_TSCK_MARK,
111 HSU_TGTTI_G3MO_MARK, PORT53_MSIOF2_TXD_MARK,
112 B_TIME_STAMP_MARK, PORT54_MSIOF2_RXD_MARK,
113 HSU_SDI_MARK, PORT55_KEYIN3_MARK,
114 HSU_SCO_MARK, PORT56_KEYIN4_MARK,
115 HSU_DREQ_MARK, PORT57_KEYIN5_MARK,
116 HSU_DACK_MARK, PORT58_KEYIN6_MARK,
117 HSU_CLK61M_MARK, PORT59_MSIOF2_SS1_MARK,
118 HSU_XRST_MARK, PORT60_MSIOF2_SS2_MARK,
119 PCMCLKO_MARK, SYNC8KO_MARK, DNPCM_A_MARK, UPPCM_A_MARK,
120 XTALB1L_MARK,
121 GPS_AGC1_MARK, SCIFA0_RTS_MARK,
122 GPS_AGC2_MARK, SCIFA0_SCK_MARK,
123 GPS_AGC3_MARK, SCIFA0_TXD_MARK,
124 GPS_AGC4_MARK, SCIFA0_RXD_MARK,
125 GPS_PWRD_MARK, SCIFA0_CTS_MARK,
126 GPS_IM_MARK, GPS_IS_MARK, GPS_QM_MARK, GPS_QS_MARK,
127 SIUBOMC_MARK, TPU2TO0_MARK,
128 SIUCKB_MARK, TPU2TO1_MARK,
129 SIUBOLR_MARK, BBIF2_TSYNC_MARK, TPU2TO2_MARK,
130 SIUBOBT_MARK, BBIF2_TSCK_MARK, TPU2TO3_MARK,
131 SIUBOSLD_MARK, BBIF2_TXD_MARK, TPU3TO0_MARK,
132 SIUBILR_MARK, TPU3TO1_MARK,
133 SIUBIBT_MARK, TPU3TO2_MARK,
134 SIUBISLD_MARK, TPU3TO3_MARK,
135 NMI_MARK, TPU4TO0_MARK,
136 DNPCM_M_MARK, TPU4TO1_MARK, TPU4TO2_MARK, TPU4TO3_MARK,
137 IRQ_TMPB_MARK,
138 PWEN_MARK, MFG1_OUT1_MARK,
139 OVCN_MARK, MFG1_IN1_MARK,
140 OVCN2_MARK, MFG1_IN2_MARK,
141
142 /* 49-3 */
143 RFSPO1_MARK, RFSPO2_MARK, RFSPO3_MARK, PORT93_VIO_CKO2_MARK,
144 USBTERM_MARK, EXTLP_MARK, IDIN_MARK,
145 SCIFA5_CTS_MARK, MFG0_IN1_MARK,
146 SCIFA5_RTS_MARK, MFG0_IN2_MARK,
147 SCIFA5_RXD_MARK,
148 SCIFA5_TXD_MARK,
149 SCIFA5_SCK_MARK, MFG0_OUT1_MARK,
150 A0_EA0_MARK, BS_MARK,
151 A14_EA14_MARK, PORT102_KEYOUT0_MARK,
152 A15_EA15_MARK, PORT103_KEYOUT1_MARK, DV_CLKOL_MARK,
153 A16_EA16_MARK, PORT104_KEYOUT2_MARK,
154 DV_VSYNCL_MARK, MSIOF0_SS1_MARK,
155 A17_EA17_MARK, PORT105_KEYOUT3_MARK,
156 DV_HSYNCL_MARK, MSIOF0_TSYNC_MARK,
157 A18_EA18_MARK, PORT106_KEYOUT4_MARK,
158 DV_DL0_MARK, MSIOF0_TSCK_MARK,
159 A19_EA19_MARK, PORT107_KEYOUT5_MARK,
160 DV_DL1_MARK, MSIOF0_TXD_MARK,
161 A20_EA20_MARK, PORT108_KEYIN0_MARK,
162 DV_DL2_MARK, MSIOF0_RSCK_MARK,
163 A21_EA21_MARK, PORT109_KEYIN1_MARK,
164 DV_DL3_MARK, MSIOF0_RSYNC_MARK,
165 A22_EA22_MARK, PORT110_KEYIN2_MARK,
166 DV_DL4_MARK, MSIOF0_MCK0_MARK,
167 A23_EA23_MARK, PORT111_KEYIN3_MARK,
168 DV_DL5_MARK, MSIOF0_MCK1_MARK,
169 A24_EA24_MARK, PORT112_KEYIN4_MARK,
170 DV_DL6_MARK, MSIOF0_RXD_MARK,
171 A25_EA25_MARK, PORT113_KEYIN5_MARK,
172 DV_DL7_MARK, MSIOF0_SS2_MARK,
173 A26_MARK, PORT113_KEYIN6_MARK, DV_CLKIL_MARK,
174 D0_ED0_NAF0_MARK, D1_ED1_NAF1_MARK, D2_ED2_NAF2_MARK,
175 D3_ED3_NAF3_MARK, D4_ED4_NAF4_MARK, D5_ED5_NAF5_MARK,
176 D6_ED6_NAF6_MARK, D7_ED7_NAF7_MARK, D8_ED8_NAF8_MARK,
177 D9_ED9_NAF9_MARK, D10_ED10_NAF10_MARK, D11_ED11_NAF11_MARK,
178 D12_ED12_NAF12_MARK, D13_ED13_NAF13_MARK,
179 D14_ED14_NAF14_MARK, D15_ED15_NAF15_MARK,
180 CS4_MARK, CS5A_MARK, CS5B_MARK, FCE1_MARK,
181 CS6B_MARK, XCS2_MARK, FCE0_MARK, CS6A_MARK,
182 DACK0_MARK, WAIT_MARK, DREQ0_MARK, RD_XRD_MARK,
183 A27_MARK, RDWR_XWE_MARK, WE0_XWR0_FWE_MARK,
184 WE1_XWR1_MARK, FRB_MARK, CKO_MARK,
185 NBRSTOUT_MARK, NBRST_MARK,
186
187 /* 49-4 */
188 RFSPO0_MARK, PORT146_VIO_CKO2_MARK, TSTMD_MARK,
189 VIO_VD_MARK, VIO_HD_MARK,
190 VIO_D0_MARK, VIO_D1_MARK, VIO_D2_MARK,
191 VIO_D3_MARK, VIO_D4_MARK, VIO_D5_MARK,
192 VIO_D6_MARK, VIO_D7_MARK, VIO_D8_MARK,
193 VIO_D9_MARK, VIO_D10_MARK, VIO_D11_MARK,
194 VIO_D12_MARK, VIO_D13_MARK, VIO_D14_MARK,
195 VIO_D15_MARK, VIO_CLK_MARK, VIO_FIELD_MARK,
196 VIO_CKO_MARK,
197 MFG3_IN1_MARK, MFG3_IN2_MARK,
198 M9_SLCD_A01_MARK, MFG3_OUT1_MARK, TPU0TO0_MARK,
199 M10_SLCD_CK1_MARK, MFG4_IN1_MARK, TPU0TO1_MARK,
200 M11_SLCD_SO1_MARK, MFG4_IN2_MARK, TPU0TO2_MARK,
201 M12_SLCD_CE1_MARK, MFG4_OUT1_MARK, TPU0TO3_MARK,
202 LCDD0_MARK, PORT175_KEYOUT0_MARK, DV_D0_MARK,
203 SIUCKA_MARK, MFG0_OUT2_MARK,
204 LCDD1_MARK, PORT176_KEYOUT1_MARK, DV_D1_MARK,
205 SIUAOLR_MARK, BBIF2_TSYNC1_MARK,
206 LCDD2_MARK, PORT177_KEYOUT2_MARK, DV_D2_MARK,
207 SIUAOBT_MARK, BBIF2_TSCK1_MARK,
208 LCDD3_MARK, PORT178_KEYOUT3_MARK, DV_D3_MARK,
209 SIUAOSLD_MARK, BBIF2_TXD1_MARK,
210 LCDD4_MARK, PORT179_KEYOUT4_MARK, DV_D4_MARK,
211 SIUAISPD_MARK, MFG1_OUT2_MARK,
212 LCDD5_MARK, PORT180_KEYOUT5_MARK, DV_D5_MARK,
213 SIUAILR_MARK, MFG2_OUT2_MARK,
214 LCDD6_MARK, DV_D6_MARK,
215 SIUAIBT_MARK, MFG3_OUT2_MARK, XWR2_MARK,
216 LCDD7_MARK, DV_D7_MARK,
217 SIUAISLD_MARK, MFG4_OUT2_MARK, XWR3_MARK,
218 LCDD8_MARK, DV_D8_MARK, D16_MARK, ED16_MARK,
219 LCDD9_MARK, DV_D9_MARK, D17_MARK, ED17_MARK,
220 LCDD10_MARK, DV_D10_MARK, D18_MARK, ED18_MARK,
221 LCDD11_MARK, DV_D11_MARK, D19_MARK, ED19_MARK,
222 LCDD12_MARK, DV_D12_MARK, D20_MARK, ED20_MARK,
223 LCDD13_MARK, DV_D13_MARK, D21_MARK, ED21_MARK,
224 LCDD14_MARK, DV_D14_MARK, D22_MARK, ED22_MARK,
225 LCDD15_MARK, DV_D15_MARK, D23_MARK, ED23_MARK,
226 LCDD16_MARK, DV_HSYNC_MARK, D24_MARK, ED24_MARK,
227 LCDD17_MARK, DV_VSYNC_MARK, D25_MARK, ED25_MARK,
228 LCDD18_MARK, DREQ2_MARK, MSIOF0L_TSCK_MARK,
229 D26_MARK, ED26_MARK,
230 LCDD19_MARK, MSIOF0L_TSYNC_MARK,
231 D27_MARK, ED27_MARK,
232 LCDD20_MARK, TS_SPSYNC1_MARK, MSIOF0L_MCK0_MARK,
233 D28_MARK, ED28_MARK,
234 LCDD21_MARK, TS_SDAT1_MARK, MSIOF0L_MCK1_MARK,
235 D29_MARK, ED29_MARK,
236 LCDD22_MARK, TS_SDEN1_MARK, MSIOF0L_SS1_MARK,
237 D30_MARK, ED30_MARK,
238 LCDD23_MARK, TS_SCK1_MARK, MSIOF0L_SS2_MARK,
239 D31_MARK, ED31_MARK,
240 LCDDCK_MARK, LCDWR_MARK, DV_CKO_MARK, SIUAOSPD_MARK,
241 LCDRD_MARK, DACK2_MARK, MSIOF0L_RSYNC_MARK,
242
243 /* 49-5 */
244 LCDHSYN_MARK, LCDCS_MARK, LCDCS2_MARK, DACK3_MARK,
245 LCDDISP_MARK, LCDRS_MARK, DREQ3_MARK, MSIOF0L_RSCK_MARK,
246 LCDCSYN_MARK, LCDCSYN2_MARK, DV_CKI_MARK,
247 LCDLCLK_MARK, DREQ1_MARK, MSIOF0L_RXD_MARK,
248 LCDDON_MARK, LCDDON2_MARK, DACK1_MARK, MSIOF0L_TXD_MARK,
249 VIO_DR0_MARK, VIO_DR1_MARK, VIO_DR2_MARK, VIO_DR3_MARK,
250 VIO_DR4_MARK, VIO_DR5_MARK, VIO_DR6_MARK, VIO_DR7_MARK,
251 VIO_VDR_MARK, VIO_HDR_MARK,
252 VIO_CLKR_MARK, VIO_CKOR_MARK,
253 SCIFA1_TXD_MARK, GPS_PGFA0_MARK,
254 SCIFA1_SCK_MARK, GPS_PGFA1_MARK,
255 SCIFA1_RTS_MARK, GPS_EPPSINMON_MARK,
256 SCIFA1_RXD_MARK, SCIFA1_CTS_MARK,
257 MSIOF1_TXD_MARK, SCIFA1_TXD2_MARK, GPS_TXD_MARK,
258 MSIOF1_TSYNC_MARK, SCIFA1_CTS2_MARK, I2C_SDA2_MARK,
259 MSIOF1_TSCK_MARK, SCIFA1_SCK2_MARK,
260 MSIOF1_RXD_MARK, SCIFA1_RXD2_MARK, GPS_RXD_MARK,
261 MSIOF1_RSCK_MARK, SCIFA1_RTS2_MARK,
262 MSIOF1_RSYNC_MARK, I2C_SCL2_MARK,
263 MSIOF1_MCK0_MARK, MSIOF1_MCK1_MARK,
264 MSIOF1_SS1_MARK, EDBGREQ3_MARK,
265 MSIOF1_SS2_MARK,
266 PORT236_IROUT_MARK, IRDA_OUT_MARK,
267 IRDA_IN_MARK, IRDA_FIRSEL_MARK,
268 TPU1TO0_MARK, TS_SPSYNC3_MARK,
269 TPU1TO1_MARK, TS_SDAT3_MARK,
270 TPU1TO2_MARK, TS_SDEN3_MARK, PORT241_MSIOF2_SS1_MARK,
271 TPU1TO3_MARK, PORT242_MSIOF2_TSCK_MARK,
272 M13_BSW_MARK, PORT243_MSIOF2_TSYNC_MARK,
273 M14_GSW_MARK, PORT244_MSIOF2_TXD_MARK,
274 PORT245_IROUT_MARK, M15_RSW_MARK,
275 SOUT3_MARK, SCIFA2_TXD1_MARK,
276 SIN3_MARK, SCIFA2_RXD1_MARK,
277 XRTS3_MARK, SCIFA2_RTS1_MARK, PORT248_MSIOF2_SS2_MARK,
278 XCTS3_MARK, SCIFA2_CTS1_MARK, PORT249_MSIOF2_RXD_MARK,
279 DINT_MARK, SCIFA2_SCK1_MARK, TS_SCK3_MARK,
280 SDHICLK0_MARK, TCK2_MARK,
281 SDHICD0_MARK,
282 SDHID0_0_MARK, TMS2_MARK,
283 SDHID0_1_MARK, TDO2_MARK,
284 SDHID0_2_MARK, TDI2_MARK,
285 SDHID0_3_MARK, RTCK2_MARK,
286
287 /* 49-6 */
288 SDHICMD0_MARK, TRST2_MARK,
289 SDHIWP0_MARK, EDBGREQ2_MARK,
290 SDHICLK1_MARK, TCK3_MARK,
291 SDHID1_0_MARK, M11_SLCD_SO2_MARK,
292 TS_SPSYNC2_MARK, TMS3_MARK,
293 SDHID1_1_MARK, M9_SLCD_AO2_MARK,
294 TS_SDAT2_MARK, TDO3_MARK,
295 SDHID1_2_MARK, M10_SLCD_CK2_MARK,
296 TS_SDEN2_MARK, TDI3_MARK,
297 SDHID1_3_MARK, M12_SLCD_CE2_MARK,
298 TS_SCK2_MARK, RTCK3_MARK,
299 SDHICMD1_MARK, TRST3_MARK,
300 SDHICLK2_MARK, SCIFB_SCK_MARK,
301 SDHID2_0_MARK, SCIFB_TXD_MARK,
302 SDHID2_1_MARK, SCIFB_CTS_MARK,
303 SDHID2_2_MARK, SCIFB_RXD_MARK,
304 SDHID2_3_MARK, SCIFB_RTS_MARK,
305 SDHICMD2_MARK,
306 RESETOUTS_MARK,
307 DIVLOCK_MARK,
308 PINMUX_MARK_END,
309};
310
311static pinmux_enum_t pinmux_data[] = {
312
313 /* specify valid pin states for each pin in GPIO mode */
314
315 /* 49-1 (GPIO) */
316 PORT_DATA_I_PD(0),
317 PORT_DATA_I_PU(1), PORT_DATA_I_PU(2), PORT_DATA_I_PU(3),
318 PORT_DATA_I_PU(4), PORT_DATA_I_PU(5), PORT_DATA_I_PU(6),
319 PORT_DATA_I_PU(7), PORT_DATA_I_PU(8), PORT_DATA_I_PU(9),
320 PORT_DATA_I_PU(10), PORT_DATA_I_PU(11), PORT_DATA_I_PU(12),
321 PORT_DATA_I_PU(13),
322 PORT_DATA_IO_PU_PD(14), PORT_DATA_IO_PU_PD(15),
323 PORT_DATA_O(16), PORT_DATA_O(17), PORT_DATA_O(18), PORT_DATA_O(19),
324 PORT_DATA_O(20), PORT_DATA_O(21), PORT_DATA_O(22), PORT_DATA_O(23),
325 PORT_DATA_O(24), PORT_DATA_O(25), PORT_DATA_O(26),
326 PORT_DATA_I_PD(27), PORT_DATA_I_PD(28),
327 PORT_DATA_O(29), PORT_DATA_O(30), PORT_DATA_O(31), PORT_DATA_O(32),
328 PORT_DATA_IO_PU(33),
329 PORT_DATA_O(34),
330 PORT_DATA_I_PU(35),
331 PORT_DATA_O(36),
332 PORT_DATA_I_PU_PD(37),
333
334 /* 49-2 (GPIO) */
335 PORT_DATA_IO_PU_PD(38),
336 PORT_DATA_IO_PD(39), PORT_DATA_IO_PD(40), PORT_DATA_IO_PD(41),
337 PORT_DATA_O(42), PORT_DATA_O(43), PORT_DATA_O(44), PORT_DATA_O(45),
338 PORT_DATA_O(46), PORT_DATA_O(47),
339 PORT_DATA_I_PU_PD(48), PORT_DATA_I_PU_PD(49), PORT_DATA_I_PU_PD(50),
340 PORT_DATA_IO_PD(51), PORT_DATA_IO_PD(52),
341 PORT_DATA_O(53),
342 PORT_DATA_IO_PD(54),
343 PORT_DATA_I_PU_PD(55),
344 PORT_DATA_IO_PU_PD(56),
345 PORT_DATA_I_PU_PD(57),
346 PORT_DATA_IO_PU_PD(58),
347 PORT_DATA_O(59), PORT_DATA_O(60), PORT_DATA_O(61), PORT_DATA_O(62),
348 PORT_DATA_O(63),
349 PORT_DATA_I_PU(64),
350 PORT_DATA_O(65), PORT_DATA_O(66), PORT_DATA_O(67), PORT_DATA_O(68),
351 PORT_DATA_IO_PD(69), PORT_DATA_IO_PD(70),
352 PORT_DATA_I_PD(71), PORT_DATA_I_PD(72), PORT_DATA_I_PD(73),
353 PORT_DATA_I_PD(74),
354 PORT_DATA_IO_PU_PD(75), PORT_DATA_IO_PU_PD(76),
355 PORT_DATA_IO_PD(77), PORT_DATA_IO_PD(78),
356 PORT_DATA_O(79),
357 PORT_DATA_IO_PD(80), PORT_DATA_IO_PD(81), PORT_DATA_IO_PD(82),
358 PORT_DATA_IO_PU_PD(83), PORT_DATA_IO_PU_PD(84),
359 PORT_DATA_IO_PU_PD(85), PORT_DATA_IO_PU_PD(86),
360 PORT_DATA_I_PD(87),
361 PORT_DATA_IO_PU_PD(88),
362 PORT_DATA_I_PU_PD(89), PORT_DATA_I_PU_PD(90),
363
364 /* 49-3 (GPIO) */
365 PORT_DATA_O(91), PORT_DATA_O(92), PORT_DATA_O(93), PORT_DATA_O(94),
366 PORT_DATA_I_PU_PD(95),
367 PORT_DATA_IO_PU_PD(96), PORT_DATA_IO_PU_PD(97), PORT_DATA_IO_PU_PD(98),
368 PORT_DATA_IO_PU_PD(99), PORT_DATA_IO_PU_PD(100),
369 PORT_DATA_IO(101), PORT_DATA_IO(102), PORT_DATA_IO(103),
370 PORT_DATA_IO_PD(104), PORT_DATA_IO_PD(105), PORT_DATA_IO_PD(106),
371 PORT_DATA_IO_PD(107),
372 PORT_DATA_IO_PU_PD(108), PORT_DATA_IO_PU_PD(109),
373 PORT_DATA_IO_PU_PD(110), PORT_DATA_IO_PU_PD(111),
374 PORT_DATA_IO_PU_PD(112), PORT_DATA_IO_PU_PD(113),
375 PORT_DATA_IO_PU_PD(114),
376 PORT_DATA_IO_PU(115), PORT_DATA_IO_PU(116), PORT_DATA_IO_PU(117),
377 PORT_DATA_IO_PU(118), PORT_DATA_IO_PU(119), PORT_DATA_IO_PU(120),
378 PORT_DATA_IO_PU(121), PORT_DATA_IO_PU(122), PORT_DATA_IO_PU(123),
379 PORT_DATA_IO_PU(124), PORT_DATA_IO_PU(125), PORT_DATA_IO_PU(126),
380 PORT_DATA_IO_PU(127), PORT_DATA_IO_PU(128), PORT_DATA_IO_PU(129),
381 PORT_DATA_IO_PU(130),
382 PORT_DATA_O(131), PORT_DATA_O(132), PORT_DATA_O(133),
383 PORT_DATA_IO_PU(134),
384 PORT_DATA_O(135), PORT_DATA_O(136),
385 PORT_DATA_I_PU_PD(137),
386 PORT_DATA_IO(138),
387 PORT_DATA_IO_PU_PD(139),
388 PORT_DATA_IO(140), PORT_DATA_IO(141),
389 PORT_DATA_I_PU(142),
390 PORT_DATA_O(143), PORT_DATA_O(144),
391 PORT_DATA_I_PU(145),
392
393 /* 49-4 (GPIO) */
394 PORT_DATA_O(146),
395 PORT_DATA_I_PU_PD(147),
396 PORT_DATA_I_PD(148), PORT_DATA_I_PD(149),
397 PORT_DATA_IO_PD(150), PORT_DATA_IO_PD(151), PORT_DATA_IO_PD(152),
398 PORT_DATA_IO_PD(153), PORT_DATA_IO_PD(154), PORT_DATA_IO_PD(155),
399 PORT_DATA_IO_PD(156), PORT_DATA_IO_PD(157), PORT_DATA_IO_PD(158),
400 PORT_DATA_IO_PD(159), PORT_DATA_IO_PD(160), PORT_DATA_IO_PD(161),
401 PORT_DATA_IO_PD(162), PORT_DATA_IO_PD(163), PORT_DATA_IO_PD(164),
402 PORT_DATA_IO_PD(165), PORT_DATA_IO_PD(166),
403 PORT_DATA_IO_PU_PD(167),
404 PORT_DATA_O(168),
405 PORT_DATA_I_PD(169), PORT_DATA_I_PD(170),
406 PORT_DATA_O(171),
407 PORT_DATA_IO_PD(172), PORT_DATA_IO_PD(173),
408 PORT_DATA_O(174),
409 PORT_DATA_IO_PD(175), PORT_DATA_IO_PD(176), PORT_DATA_IO_PD(177),
410 PORT_DATA_IO_PD(178), PORT_DATA_IO_PD(179), PORT_DATA_IO_PD(180),
411 PORT_DATA_IO_PD(181), PORT_DATA_IO_PD(182), PORT_DATA_IO_PD(183),
412 PORT_DATA_IO_PD(184), PORT_DATA_IO_PD(185), PORT_DATA_IO_PD(186),
413 PORT_DATA_IO_PD(187), PORT_DATA_IO_PD(188), PORT_DATA_IO_PD(189),
414 PORT_DATA_IO_PD(190), PORT_DATA_IO_PD(191), PORT_DATA_IO_PD(192),
415 PORT_DATA_IO_PD(193), PORT_DATA_IO_PD(194), PORT_DATA_IO_PD(195),
416 PORT_DATA_IO_PD(196), PORT_DATA_IO_PD(197), PORT_DATA_IO_PD(198),
417 PORT_DATA_O(199),
418 PORT_DATA_IO_PD(200),
419
420 /* 49-5 (GPIO) */
421 PORT_DATA_O(201),
422 PORT_DATA_IO_PD(202), PORT_DATA_IO_PD(203),
423 PORT_DATA_I(204),
424 PORT_DATA_O(205),
425 PORT_DATA_IO_PD(206), PORT_DATA_IO_PD(207), PORT_DATA_IO_PD(208),
426 PORT_DATA_IO_PD(209), PORT_DATA_IO_PD(210), PORT_DATA_IO_PD(211),
427 PORT_DATA_IO_PD(212), PORT_DATA_IO_PD(213), PORT_DATA_IO_PD(214),
428 PORT_DATA_IO_PD(215), PORT_DATA_IO_PD(216),
429 PORT_DATA_O(217),
430 PORT_DATA_I_PU_PD(218), PORT_DATA_I_PU_PD(219),
431 PORT_DATA_O(220), PORT_DATA_O(221), PORT_DATA_O(222),
432 PORT_DATA_I_PD(223),
433 PORT_DATA_I_PU_PD(224),
434 PORT_DATA_O(225),
435 PORT_DATA_IO_PD(226),
436 PORT_DATA_IO_PU_PD(227),
437 PORT_DATA_I_PD(228),
438 PORT_DATA_IO_PD(229), PORT_DATA_IO_PD(230),
439 PORT_DATA_I_PU_PD(231), PORT_DATA_I_PU_PD(232),
440 PORT_DATA_IO_PU_PD(233), PORT_DATA_IO_PU_PD(234),
441 PORT_DATA_I_PU_PD(235),
442 PORT_DATA_O(236),
443 PORT_DATA_I_PD(237),
444 PORT_DATA_IO_PU_PD(238), PORT_DATA_IO_PU_PD(239),
445 PORT_DATA_IO_PD(240), PORT_DATA_IO_PD(241),
446 PORT_DATA_IO_PD(242), PORT_DATA_IO_PD(243),
447 PORT_DATA_O(244),
448 PORT_DATA_IO_PU_PD(245),
449 PORT_DATA_O(246),
450 PORT_DATA_I_PD(247),
451 PORT_DATA_IO_PU_PD(248),
452 PORT_DATA_I_PU_PD(249),
453 PORT_DATA_IO_PD(250), PORT_DATA_IO_PD(251),
454 PORT_DATA_IO_PU_PD(252), PORT_DATA_IO_PU_PD(253),
455 PORT_DATA_IO_PU_PD(254), PORT_DATA_IO_PU_PD(255),
456 PORT_DATA_IO_PU_PD(256),
457
458 /* 49-6 (GPIO) */
459 PORT_DATA_IO_PU_PD(257), PORT_DATA_IO_PU_PD(258),
460 PORT_DATA_IO_PD(259),
461 PORT_DATA_IO_PU(260), PORT_DATA_IO_PU(261), PORT_DATA_IO_PU(262),
462 PORT_DATA_IO_PU(263), PORT_DATA_IO_PU(264),
463 PORT_DATA_O(265),
464 PORT_DATA_IO_PU(266), PORT_DATA_IO_PU(267), PORT_DATA_IO_PU(268),
465 PORT_DATA_IO_PU(269), PORT_DATA_IO_PU(270),
466 PORT_DATA_O(271),
467 PORT_DATA_I_PD(272),
468
469 /* Special Pull-up / Pull-down Functions */
470 PINMUX_DATA(PORT48_KEYIN0_PU_MARK, MSELBCR_MSEL2_1,
471 PORT48_FN2, PORT48_IN_PU),
472 PINMUX_DATA(PORT49_KEYIN1_PU_MARK, MSELBCR_MSEL2_1,
473 PORT49_FN2, PORT49_IN_PU),
474 PINMUX_DATA(PORT50_KEYIN2_PU_MARK, MSELBCR_MSEL2_1,
475 PORT50_FN2, PORT50_IN_PU),
476 PINMUX_DATA(PORT55_KEYIN3_PU_MARK, MSELBCR_MSEL2_1,
477 PORT55_FN2, PORT55_IN_PU),
478 PINMUX_DATA(PORT56_KEYIN4_PU_MARK, MSELBCR_MSEL2_1,
479 PORT56_FN2, PORT56_IN_PU),
480 PINMUX_DATA(PORT57_KEYIN5_PU_MARK, MSELBCR_MSEL2_1,
481 PORT57_FN2, PORT57_IN_PU),
482 PINMUX_DATA(PORT58_KEYIN6_PU_MARK, MSELBCR_MSEL2_1,
483 PORT58_FN2, PORT58_IN_PU),
484
485 /* 49-1 (FN) */
486 PINMUX_DATA(VBUS0_MARK, PORT0_FN1),
487 PINMUX_DATA(CPORT0_MARK, PORT1_FN1),
488 PINMUX_DATA(CPORT1_MARK, PORT2_FN1),
489 PINMUX_DATA(CPORT2_MARK, PORT3_FN1),
490 PINMUX_DATA(CPORT3_MARK, PORT4_FN1),
491 PINMUX_DATA(CPORT4_MARK, PORT5_FN1),
492 PINMUX_DATA(CPORT5_MARK, PORT6_FN1),
493 PINMUX_DATA(CPORT6_MARK, PORT7_FN1),
494 PINMUX_DATA(CPORT7_MARK, PORT8_FN1),
495 PINMUX_DATA(CPORT8_MARK, PORT9_FN1),
496 PINMUX_DATA(CPORT9_MARK, PORT10_FN1),
497 PINMUX_DATA(CPORT10_MARK, PORT11_FN1),
498 PINMUX_DATA(CPORT11_MARK, PORT12_FN1),
499 PINMUX_DATA(SIN2_MARK, PORT12_FN2),
500 PINMUX_DATA(CPORT12_MARK, PORT13_FN1),
501 PINMUX_DATA(XCTS2_MARK, PORT13_FN2),
502 PINMUX_DATA(CPORT13_MARK, PORT14_FN1),
503 PINMUX_DATA(RFSPO4_MARK, PORT14_FN2),
504 PINMUX_DATA(CPORT14_MARK, PORT15_FN1),
505 PINMUX_DATA(RFSPO5_MARK, PORT15_FN2),
506 PINMUX_DATA(CPORT15_MARK, PORT16_FN1),
507 PINMUX_DATA(CPORT16_MARK, PORT17_FN1),
508 PINMUX_DATA(CPORT17_MARK, PORT18_FN1),
509 PINMUX_DATA(SOUT2_MARK, PORT18_FN2),
510 PINMUX_DATA(CPORT18_MARK, PORT19_FN1),
511 PINMUX_DATA(XRTS2_MARK, PORT19_FN1),
512 PINMUX_DATA(CPORT19_MARK, PORT20_FN1),
513 PINMUX_DATA(CPORT20_MARK, PORT21_FN1),
514 PINMUX_DATA(RFSPO6_MARK, PORT21_FN2),
515 PINMUX_DATA(CPORT21_MARK, PORT22_FN1),
516 PINMUX_DATA(STATUS0_MARK, PORT22_FN2),
517 PINMUX_DATA(CPORT22_MARK, PORT23_FN1),
518 PINMUX_DATA(STATUS1_MARK, PORT23_FN2),
519 PINMUX_DATA(CPORT23_MARK, PORT24_FN1),
520 PINMUX_DATA(STATUS2_MARK, PORT24_FN2),
521 PINMUX_DATA(RFSPO7_MARK, PORT24_FN3),
522 PINMUX_DATA(MPORT0_MARK, PORT25_FN1),
523 PINMUX_DATA(MPORT1_MARK, PORT26_FN1),
524 PINMUX_DATA(B_SYNLD1_MARK, PORT27_FN1),
525 PINMUX_DATA(B_SYNLD2_MARK, PORT28_FN1),
526 PINMUX_DATA(XMAINPS_MARK, PORT29_FN1),
527 PINMUX_DATA(XDIVPS_MARK, PORT30_FN1),
528 PINMUX_DATA(XIDRST_MARK, PORT31_FN1),
529 PINMUX_DATA(IDCLK_MARK, PORT32_FN1),
530 PINMUX_DATA(IDIO_MARK, PORT33_FN1),
531 PINMUX_DATA(SOUT1_MARK, PORT34_FN1),
532 PINMUX_DATA(SCIFA4_TXD_MARK, PORT34_FN2),
533 PINMUX_DATA(M02_BERDAT_MARK, PORT34_FN3),
534 PINMUX_DATA(SIN1_MARK, PORT35_FN1),
535 PINMUX_DATA(SCIFA4_RXD_MARK, PORT35_FN2),
536 PINMUX_DATA(XWUP_MARK, PORT35_FN3),
537 PINMUX_DATA(XRTS1_MARK, PORT36_FN1),
538 PINMUX_DATA(SCIFA4_RTS_MARK, PORT36_FN2),
539 PINMUX_DATA(M03_BERCLK_MARK, PORT36_FN3),
540 PINMUX_DATA(XCTS1_MARK, PORT37_FN1),
541 PINMUX_DATA(SCIFA4_CTS_MARK, PORT37_FN2),
542
543 /* 49-2 (FN) */
544 PINMUX_DATA(HSU_IQ_AGC6_MARK, PORT38_FN1),
545 PINMUX_DATA(MFG2_IN2_MARK, PORT38_FN2),
546 PINMUX_DATA(MSIOF2_MCK0_MARK, PORT38_FN3),
547 PINMUX_DATA(HSU_IQ_AGC5_MARK, PORT39_FN1),
548 PINMUX_DATA(MFG2_IN1_MARK, PORT39_FN2),
549 PINMUX_DATA(MSIOF2_MCK1_MARK, PORT39_FN3),
550 PINMUX_DATA(HSU_IQ_AGC4_MARK, PORT40_FN1),
551 PINMUX_DATA(MSIOF2_RSYNC_MARK, PORT40_FN3),
552 PINMUX_DATA(HSU_IQ_AGC3_MARK, PORT41_FN1),
553 PINMUX_DATA(MFG2_OUT1_MARK, PORT41_FN2),
554 PINMUX_DATA(MSIOF2_RSCK_MARK, PORT41_FN3),
555 PINMUX_DATA(HSU_IQ_AGC2_MARK, PORT42_FN1),
556 PINMUX_DATA(PORT42_KEYOUT0_MARK, MSELBCR_MSEL2_1, PORT42_FN2),
557 PINMUX_DATA(HSU_IQ_AGC1_MARK, PORT43_FN1),
558 PINMUX_DATA(PORT43_KEYOUT1_MARK, MSELBCR_MSEL2_1, PORT43_FN2),
559 PINMUX_DATA(HSU_IQ_AGC0_MARK, PORT44_FN1),
560 PINMUX_DATA(PORT44_KEYOUT2_MARK, MSELBCR_MSEL2_1, PORT44_FN2),
561 PINMUX_DATA(HSU_IQ_AGC_ST_MARK, PORT45_FN1),
562 PINMUX_DATA(PORT45_KEYOUT3_MARK, MSELBCR_MSEL2_1, PORT45_FN2),
563 PINMUX_DATA(HSU_IQ_PDO_MARK, PORT46_FN1),
564 PINMUX_DATA(PORT46_KEYOUT4_MARK, MSELBCR_MSEL2_1, PORT46_FN2),
565 PINMUX_DATA(HSU_IQ_PYO_MARK, PORT47_FN1),
566 PINMUX_DATA(PORT47_KEYOUT5_MARK, MSELBCR_MSEL2_1, PORT47_FN2),
567 PINMUX_DATA(HSU_EN_TXMUX_G3MO_MARK, PORT48_FN1),
568 PINMUX_DATA(PORT48_KEYIN0_MARK, MSELBCR_MSEL2_1, PORT48_FN2),
569 PINMUX_DATA(HSU_I_TXMUX_G3MO_MARK, PORT49_FN1),
570 PINMUX_DATA(PORT49_KEYIN1_MARK, MSELBCR_MSEL2_1, PORT49_FN2),
571 PINMUX_DATA(HSU_Q_TXMUX_G3MO_MARK, PORT50_FN1),
572 PINMUX_DATA(PORT50_KEYIN2_MARK, MSELBCR_MSEL2_1, PORT50_FN2),
573 PINMUX_DATA(HSU_SYO_MARK, PORT51_FN1),
574 PINMUX_DATA(PORT51_MSIOF2_TSYNC_MARK, PORT51_FN2),
575 PINMUX_DATA(HSU_SDO_MARK, PORT52_FN1),
576 PINMUX_DATA(PORT52_MSIOF2_TSCK_MARK, PORT52_FN2),
577 PINMUX_DATA(HSU_TGTTI_G3MO_MARK, PORT53_FN1),
578 PINMUX_DATA(PORT53_MSIOF2_TXD_MARK, PORT53_FN2),
579 PINMUX_DATA(B_TIME_STAMP_MARK, PORT54_FN1),
580 PINMUX_DATA(PORT54_MSIOF2_RXD_MARK, PORT54_FN2),
581 PINMUX_DATA(HSU_SDI_MARK, PORT55_FN1),
582 PINMUX_DATA(PORT55_KEYIN3_MARK, MSELBCR_MSEL2_1, PORT55_FN2),
583 PINMUX_DATA(HSU_SCO_MARK, PORT56_FN1),
584 PINMUX_DATA(PORT56_KEYIN4_MARK, MSELBCR_MSEL2_1, PORT56_FN2),
585 PINMUX_DATA(HSU_DREQ_MARK, PORT57_FN1),
586 PINMUX_DATA(PORT57_KEYIN5_MARK, MSELBCR_MSEL2_1, PORT57_FN2),
587 PINMUX_DATA(HSU_DACK_MARK, PORT58_FN1),
588 PINMUX_DATA(PORT58_KEYIN6_MARK, MSELBCR_MSEL2_1, PORT58_FN2),
589 PINMUX_DATA(HSU_CLK61M_MARK, PORT59_FN1),
590 PINMUX_DATA(PORT59_MSIOF2_SS1_MARK, PORT59_FN2),
591 PINMUX_DATA(HSU_XRST_MARK, PORT60_FN1),
592 PINMUX_DATA(PORT60_MSIOF2_SS2_MARK, PORT60_FN2),
593 PINMUX_DATA(PCMCLKO_MARK, PORT61_FN1),
594 PINMUX_DATA(SYNC8KO_MARK, PORT62_FN1),
595 PINMUX_DATA(DNPCM_A_MARK, PORT63_FN1),
596 PINMUX_DATA(UPPCM_A_MARK, PORT64_FN1),
597 PINMUX_DATA(XTALB1L_MARK, PORT65_FN1),
598 PINMUX_DATA(GPS_AGC1_MARK, PORT66_FN1),
599 PINMUX_DATA(SCIFA0_RTS_MARK, PORT66_FN2),
600 PINMUX_DATA(GPS_AGC2_MARK, PORT67_FN1),
601 PINMUX_DATA(SCIFA0_SCK_MARK, PORT67_FN2),
602 PINMUX_DATA(GPS_AGC3_MARK, PORT68_FN1),
603 PINMUX_DATA(SCIFA0_TXD_MARK, PORT68_FN2),
604 PINMUX_DATA(GPS_AGC4_MARK, PORT69_FN1),
605 PINMUX_DATA(SCIFA0_RXD_MARK, PORT69_FN2),
606 PINMUX_DATA(GPS_PWRD_MARK, PORT70_FN1),
607 PINMUX_DATA(SCIFA0_CTS_MARK, PORT70_FN2),
608 PINMUX_DATA(GPS_IM_MARK, PORT71_FN1),
609 PINMUX_DATA(GPS_IS_MARK, PORT72_FN1),
610 PINMUX_DATA(GPS_QM_MARK, PORT73_FN1),
611 PINMUX_DATA(GPS_QS_MARK, PORT74_FN1),
612 PINMUX_DATA(SIUBOMC_MARK, PORT75_FN1),
613 PINMUX_DATA(TPU2TO0_MARK, PORT75_FN3),
614 PINMUX_DATA(SIUCKB_MARK, PORT76_FN1),
615 PINMUX_DATA(TPU2TO1_MARK, PORT76_FN3),
616 PINMUX_DATA(SIUBOLR_MARK, PORT77_FN1),
617 PINMUX_DATA(BBIF2_TSYNC_MARK, PORT77_FN2),
618 PINMUX_DATA(TPU2TO2_MARK, PORT77_FN3),
619 PINMUX_DATA(SIUBOBT_MARK, PORT78_FN1),
620 PINMUX_DATA(BBIF2_TSCK_MARK, PORT78_FN2),
621 PINMUX_DATA(TPU2TO3_MARK, PORT78_FN3),
622 PINMUX_DATA(SIUBOSLD_MARK, PORT79_FN1),
623 PINMUX_DATA(BBIF2_TXD_MARK, PORT79_FN2),
624 PINMUX_DATA(TPU3TO0_MARK, PORT79_FN3),
625 PINMUX_DATA(SIUBILR_MARK, PORT80_FN1),
626 PINMUX_DATA(TPU3TO1_MARK, PORT80_FN3),
627 PINMUX_DATA(SIUBIBT_MARK, PORT81_FN1),
628 PINMUX_DATA(TPU3TO2_MARK, PORT81_FN3),
629 PINMUX_DATA(SIUBISLD_MARK, PORT82_FN1),
630 PINMUX_DATA(TPU3TO3_MARK, PORT82_FN3),
631 PINMUX_DATA(NMI_MARK, PORT83_FN1),
632 PINMUX_DATA(TPU4TO0_MARK, PORT83_FN3),
633 PINMUX_DATA(DNPCM_M_MARK, PORT84_FN1),
634 PINMUX_DATA(TPU4TO1_MARK, PORT84_FN3),
635 PINMUX_DATA(TPU4TO2_MARK, PORT85_FN3),
636 PINMUX_DATA(TPU4TO3_MARK, PORT86_FN3),
637 PINMUX_DATA(IRQ_TMPB_MARK, PORT87_FN1),
638 PINMUX_DATA(PWEN_MARK, PORT88_FN1),
639 PINMUX_DATA(MFG1_OUT1_MARK, PORT88_FN2),
640 PINMUX_DATA(OVCN_MARK, PORT89_FN1),
641 PINMUX_DATA(MFG1_IN1_MARK, PORT89_FN2),
642 PINMUX_DATA(OVCN2_MARK, PORT90_FN1),
643 PINMUX_DATA(MFG1_IN2_MARK, PORT90_FN2),
644
645 /* 49-3 (FN) */
646 PINMUX_DATA(RFSPO1_MARK, PORT91_FN1),
647 PINMUX_DATA(RFSPO2_MARK, PORT92_FN1),
648 PINMUX_DATA(RFSPO3_MARK, PORT93_FN1),
649 PINMUX_DATA(PORT93_VIO_CKO2_MARK, PORT93_FN2),
650 PINMUX_DATA(USBTERM_MARK, PORT94_FN1),
651 PINMUX_DATA(EXTLP_MARK, PORT94_FN2),
652 PINMUX_DATA(IDIN_MARK, PORT95_FN1),
653 PINMUX_DATA(SCIFA5_CTS_MARK, PORT96_FN1),
654 PINMUX_DATA(MFG0_IN1_MARK, PORT96_FN2),
655 PINMUX_DATA(SCIFA5_RTS_MARK, PORT97_FN1),
656 PINMUX_DATA(MFG0_IN2_MARK, PORT97_FN2),
657 PINMUX_DATA(SCIFA5_RXD_MARK, PORT98_FN1),
658 PINMUX_DATA(SCIFA5_TXD_MARK, PORT99_FN1),
659 PINMUX_DATA(SCIFA5_SCK_MARK, PORT100_FN1),
660 PINMUX_DATA(MFG0_OUT1_MARK, PORT100_FN2),
661 PINMUX_DATA(A0_EA0_MARK, PORT101_FN1),
662 PINMUX_DATA(BS_MARK, PORT101_FN2),
663 PINMUX_DATA(A14_EA14_MARK, PORT102_FN1),
664 PINMUX_DATA(PORT102_KEYOUT0_MARK, MSELBCR_MSEL2_0, PORT102_FN2),
665 PINMUX_DATA(A15_EA15_MARK, PORT103_FN1),
666 PINMUX_DATA(PORT103_KEYOUT1_MARK, MSELBCR_MSEL2_0, PORT103_FN2),
667 PINMUX_DATA(DV_CLKOL_MARK, PORT103_FN3),
668 PINMUX_DATA(A16_EA16_MARK, PORT104_FN1),
669 PINMUX_DATA(PORT104_KEYOUT2_MARK, MSELBCR_MSEL2_0, PORT104_FN2),
670 PINMUX_DATA(DV_VSYNCL_MARK, PORT104_FN3),
671 PINMUX_DATA(MSIOF0_SS1_MARK, PORT104_FN4),
672 PINMUX_DATA(A17_EA17_MARK, PORT105_FN1),
673 PINMUX_DATA(PORT105_KEYOUT3_MARK, MSELBCR_MSEL2_0, PORT105_FN2),
674 PINMUX_DATA(DV_HSYNCL_MARK, PORT105_FN3),
675 PINMUX_DATA(MSIOF0_TSYNC_MARK, PORT105_FN4),
676 PINMUX_DATA(A18_EA18_MARK, PORT106_FN1),
677 PINMUX_DATA(PORT106_KEYOUT4_MARK, MSELBCR_MSEL2_0, PORT106_FN2),
678 PINMUX_DATA(DV_DL0_MARK, PORT106_FN3),
679 PINMUX_DATA(MSIOF0_TSCK_MARK, PORT106_FN4),
680 PINMUX_DATA(A19_EA19_MARK, PORT107_FN1),
681 PINMUX_DATA(PORT107_KEYOUT5_MARK, MSELBCR_MSEL2_0, PORT107_FN2),
682 PINMUX_DATA(DV_DL1_MARK, PORT107_FN3),
683 PINMUX_DATA(MSIOF0_TXD_MARK, PORT107_FN4),
684 PINMUX_DATA(A20_EA20_MARK, PORT108_FN1),
685 PINMUX_DATA(PORT108_KEYIN0_MARK, MSELBCR_MSEL2_0, PORT108_FN2),
686 PINMUX_DATA(DV_DL2_MARK, PORT108_FN3),
687 PINMUX_DATA(MSIOF0_RSCK_MARK, PORT108_FN4),
688 PINMUX_DATA(A21_EA21_MARK, PORT109_FN1),
689 PINMUX_DATA(PORT109_KEYIN1_MARK, MSELBCR_MSEL2_0, PORT109_FN2),
690 PINMUX_DATA(DV_DL3_MARK, PORT109_FN3),
691 PINMUX_DATA(MSIOF0_RSYNC_MARK, PORT109_FN4),
692 PINMUX_DATA(A22_EA22_MARK, PORT110_FN1),
693 PINMUX_DATA(PORT110_KEYIN2_MARK, MSELBCR_MSEL2_0, PORT110_FN2),
694 PINMUX_DATA(DV_DL4_MARK, PORT110_FN3),
695 PINMUX_DATA(MSIOF0_MCK0_MARK, PORT110_FN4),
696 PINMUX_DATA(A23_EA23_MARK, PORT111_FN1),
697 PINMUX_DATA(PORT111_KEYIN3_MARK, MSELBCR_MSEL2_0, PORT111_FN2),
698 PINMUX_DATA(DV_DL5_MARK, PORT111_FN3),
699 PINMUX_DATA(MSIOF0_MCK1_MARK, PORT111_FN4),
700 PINMUX_DATA(A24_EA24_MARK, PORT112_FN1),
701 PINMUX_DATA(PORT112_KEYIN4_MARK, MSELBCR_MSEL2_0, PORT112_FN2),
702 PINMUX_DATA(DV_DL6_MARK, PORT112_FN3),
703 PINMUX_DATA(MSIOF0_RXD_MARK, PORT112_FN4),
704 PINMUX_DATA(A25_EA25_MARK, PORT113_FN1),
705 PINMUX_DATA(PORT113_KEYIN5_MARK, MSELBCR_MSEL2_0, PORT113_FN2),
706 PINMUX_DATA(DV_DL7_MARK, PORT113_FN3),
707 PINMUX_DATA(MSIOF0_SS2_MARK, PORT113_FN4),
708 PINMUX_DATA(A26_MARK, PORT114_FN1),
709 PINMUX_DATA(PORT113_KEYIN6_MARK, MSELBCR_MSEL2_0, PORT114_FN2),
710 PINMUX_DATA(DV_CLKIL_MARK, PORT114_FN3),
711 PINMUX_DATA(D0_ED0_NAF0_MARK, PORT115_FN1),
712 PINMUX_DATA(D1_ED1_NAF1_MARK, PORT116_FN1),
713 PINMUX_DATA(D2_ED2_NAF2_MARK, PORT117_FN1),
714 PINMUX_DATA(D3_ED3_NAF3_MARK, PORT118_FN1),
715 PINMUX_DATA(D4_ED4_NAF4_MARK, PORT119_FN1),
716 PINMUX_DATA(D5_ED5_NAF5_MARK, PORT120_FN1),
717 PINMUX_DATA(D6_ED6_NAF6_MARK, PORT121_FN1),
718 PINMUX_DATA(D7_ED7_NAF7_MARK, PORT122_FN1),
719 PINMUX_DATA(D8_ED8_NAF8_MARK, PORT123_FN1),
720 PINMUX_DATA(D9_ED9_NAF9_MARK, PORT124_FN1),
721 PINMUX_DATA(D10_ED10_NAF10_MARK, PORT125_FN1),
722 PINMUX_DATA(D11_ED11_NAF11_MARK, PORT126_FN1),
723 PINMUX_DATA(D12_ED12_NAF12_MARK, PORT127_FN1),
724 PINMUX_DATA(D13_ED13_NAF13_MARK, PORT128_FN1),
725 PINMUX_DATA(D14_ED14_NAF14_MARK, PORT129_FN1),
726 PINMUX_DATA(D15_ED15_NAF15_MARK, PORT130_FN1),
727 PINMUX_DATA(CS4_MARK, PORT131_FN1),
728 PINMUX_DATA(CS5A_MARK, PORT132_FN1),
729 PINMUX_DATA(CS5B_MARK, PORT133_FN1),
730 PINMUX_DATA(FCE1_MARK, PORT133_FN2),
731 PINMUX_DATA(CS6B_MARK, PORT134_FN1),
732 PINMUX_DATA(XCS2_MARK, PORT134_FN2),
733 PINMUX_DATA(FCE0_MARK, PORT135_FN1),
734 PINMUX_DATA(CS6A_MARK, PORT136_FN1),
735 PINMUX_DATA(DACK0_MARK, PORT136_FN2),
736 PINMUX_DATA(WAIT_MARK, PORT137_FN1),
737 PINMUX_DATA(DREQ0_MARK, PORT137_FN2),
738 PINMUX_DATA(RD_XRD_MARK, PORT138_FN1),
739 PINMUX_DATA(A27_MARK, PORT139_FN1),
740 PINMUX_DATA(RDWR_XWE_MARK, PORT139_FN2),
741 PINMUX_DATA(WE0_XWR0_FWE_MARK, PORT140_FN1),
742 PINMUX_DATA(WE1_XWR1_MARK, PORT141_FN1),
743 PINMUX_DATA(FRB_MARK, PORT142_FN1),
744 PINMUX_DATA(CKO_MARK, PORT143_FN1),
745 PINMUX_DATA(NBRSTOUT_MARK, PORT144_FN1),
746 PINMUX_DATA(NBRST_MARK, PORT145_FN1),
747
748 /* 49-4 (FN) */
749 PINMUX_DATA(RFSPO0_MARK, PORT146_FN1),
750 PINMUX_DATA(PORT146_VIO_CKO2_MARK, PORT146_FN2),
751 PINMUX_DATA(TSTMD_MARK, PORT147_FN1),
752 PINMUX_DATA(VIO_VD_MARK, PORT148_FN1),
753 PINMUX_DATA(VIO_HD_MARK, PORT149_FN1),
754 PINMUX_DATA(VIO_D0_MARK, PORT150_FN1),
755 PINMUX_DATA(VIO_D1_MARK, PORT151_FN1),
756 PINMUX_DATA(VIO_D2_MARK, PORT152_FN1),
757 PINMUX_DATA(VIO_D3_MARK, PORT153_FN1),
758 PINMUX_DATA(VIO_D4_MARK, PORT154_FN1),
759 PINMUX_DATA(VIO_D5_MARK, PORT155_FN1),
760 PINMUX_DATA(VIO_D6_MARK, PORT156_FN1),
761 PINMUX_DATA(VIO_D7_MARK, PORT157_FN1),
762 PINMUX_DATA(VIO_D8_MARK, PORT158_FN1),
763 PINMUX_DATA(VIO_D9_MARK, PORT159_FN1),
764 PINMUX_DATA(VIO_D10_MARK, PORT160_FN1),
765 PINMUX_DATA(VIO_D11_MARK, PORT161_FN1),
766 PINMUX_DATA(VIO_D12_MARK, PORT162_FN1),
767 PINMUX_DATA(VIO_D13_MARK, PORT163_FN1),
768 PINMUX_DATA(VIO_D14_MARK, PORT164_FN1),
769 PINMUX_DATA(VIO_D15_MARK, PORT165_FN1),
770 PINMUX_DATA(VIO_CLK_MARK, PORT166_FN1),
771 PINMUX_DATA(VIO_FIELD_MARK, PORT167_FN1),
772 PINMUX_DATA(VIO_CKO_MARK, PORT168_FN1),
773 PINMUX_DATA(MFG3_IN1_MARK, PORT169_FN2),
774 PINMUX_DATA(MFG3_IN2_MARK, PORT170_FN2),
775 PINMUX_DATA(M9_SLCD_A01_MARK, PORT171_FN1),
776 PINMUX_DATA(MFG3_OUT1_MARK, PORT171_FN2),
777 PINMUX_DATA(TPU0TO0_MARK, PORT171_FN3),
778 PINMUX_DATA(M10_SLCD_CK1_MARK, PORT172_FN1),
779 PINMUX_DATA(MFG4_IN1_MARK, PORT172_FN2),
780 PINMUX_DATA(TPU0TO1_MARK, PORT172_FN3),
781 PINMUX_DATA(M11_SLCD_SO1_MARK, PORT173_FN1),
782 PINMUX_DATA(MFG4_IN2_MARK, PORT173_FN2),
783 PINMUX_DATA(TPU0TO2_MARK, PORT173_FN3),
784 PINMUX_DATA(M12_SLCD_CE1_MARK, PORT174_FN1),
785 PINMUX_DATA(MFG4_OUT1_MARK, PORT174_FN2),
786 PINMUX_DATA(TPU0TO3_MARK, PORT174_FN3),
787 PINMUX_DATA(LCDD0_MARK, PORT175_FN1),
788 PINMUX_DATA(PORT175_KEYOUT0_MARK, PORT175_FN2),
789 PINMUX_DATA(DV_D0_MARK, PORT175_FN3),
790 PINMUX_DATA(SIUCKA_MARK, PORT175_FN4),
791 PINMUX_DATA(MFG0_OUT2_MARK, PORT175_FN5),
792 PINMUX_DATA(LCDD1_MARK, PORT176_FN1),
793 PINMUX_DATA(PORT176_KEYOUT1_MARK, PORT176_FN2),
794 PINMUX_DATA(DV_D1_MARK, PORT176_FN3),
795 PINMUX_DATA(SIUAOLR_MARK, PORT176_FN4),
796 PINMUX_DATA(BBIF2_TSYNC1_MARK, PORT176_FN5),
797 PINMUX_DATA(LCDD2_MARK, PORT177_FN1),
798 PINMUX_DATA(PORT177_KEYOUT2_MARK, PORT177_FN2),
799 PINMUX_DATA(DV_D2_MARK, PORT177_FN3),
800 PINMUX_DATA(SIUAOBT_MARK, PORT177_FN4),
801 PINMUX_DATA(BBIF2_TSCK1_MARK, PORT177_FN5),
802 PINMUX_DATA(LCDD3_MARK, PORT178_FN1),
803 PINMUX_DATA(PORT178_KEYOUT3_MARK, PORT178_FN2),
804 PINMUX_DATA(DV_D3_MARK, PORT178_FN3),
805 PINMUX_DATA(SIUAOSLD_MARK, PORT178_FN4),
806 PINMUX_DATA(BBIF2_TXD1_MARK, PORT178_FN5),
807 PINMUX_DATA(LCDD4_MARK, PORT179_FN1),
808 PINMUX_DATA(PORT179_KEYOUT4_MARK, PORT179_FN2),
809 PINMUX_DATA(DV_D4_MARK, PORT179_FN3),
810 PINMUX_DATA(SIUAISPD_MARK, PORT179_FN4),
811 PINMUX_DATA(MFG1_OUT2_MARK, PORT179_FN5),
812 PINMUX_DATA(LCDD5_MARK, PORT180_FN1),
813 PINMUX_DATA(PORT180_KEYOUT5_MARK, PORT180_FN2),
814 PINMUX_DATA(DV_D5_MARK, PORT180_FN3),
815 PINMUX_DATA(SIUAILR_MARK, PORT180_FN4),
816 PINMUX_DATA(MFG2_OUT2_MARK, PORT180_FN5),
817 PINMUX_DATA(LCDD6_MARK, PORT181_FN1),
818 PINMUX_DATA(DV_D6_MARK, PORT181_FN3),
819 PINMUX_DATA(SIUAIBT_MARK, PORT181_FN4),
820 PINMUX_DATA(MFG3_OUT2_MARK, PORT181_FN5),
821 PINMUX_DATA(XWR2_MARK, PORT181_FN7),
822 PINMUX_DATA(LCDD7_MARK, PORT182_FN1),
823 PINMUX_DATA(DV_D7_MARK, PORT182_FN3),
824 PINMUX_DATA(SIUAISLD_MARK, PORT182_FN4),
825 PINMUX_DATA(MFG4_OUT2_MARK, PORT182_FN5),
826 PINMUX_DATA(XWR3_MARK, PORT182_FN7),
827 PINMUX_DATA(LCDD8_MARK, PORT183_FN1),
828 PINMUX_DATA(DV_D8_MARK, PORT183_FN3),
829 PINMUX_DATA(D16_MARK, PORT183_FN6),
830 PINMUX_DATA(ED16_MARK, PORT183_FN7),
831 PINMUX_DATA(LCDD9_MARK, PORT184_FN1),
832 PINMUX_DATA(DV_D9_MARK, PORT184_FN3),
833 PINMUX_DATA(D17_MARK, PORT184_FN6),
834 PINMUX_DATA(ED17_MARK, PORT184_FN7),
835 PINMUX_DATA(LCDD10_MARK, PORT185_FN1),
836 PINMUX_DATA(DV_D10_MARK, PORT185_FN3),
837 PINMUX_DATA(D18_MARK, PORT185_FN6),
838 PINMUX_DATA(ED18_MARK, PORT185_FN7),
839 PINMUX_DATA(LCDD11_MARK, PORT186_FN1),
840 PINMUX_DATA(DV_D11_MARK, PORT186_FN3),
841 PINMUX_DATA(D19_MARK, PORT186_FN6),
842 PINMUX_DATA(ED19_MARK, PORT186_FN7),
843 PINMUX_DATA(LCDD12_MARK, PORT187_FN1),
844 PINMUX_DATA(DV_D12_MARK, PORT187_FN3),
845 PINMUX_DATA(D20_MARK, PORT187_FN6),
846 PINMUX_DATA(ED20_MARK, PORT187_FN7),
847 PINMUX_DATA(LCDD13_MARK, PORT188_FN1),
848 PINMUX_DATA(DV_D13_MARK, PORT188_FN3),
849 PINMUX_DATA(D21_MARK, PORT188_FN6),
850 PINMUX_DATA(ED21_MARK, PORT188_FN7),
851 PINMUX_DATA(LCDD14_MARK, PORT189_FN1),
852 PINMUX_DATA(DV_D14_MARK, PORT189_FN3),
853 PINMUX_DATA(D22_MARK, PORT189_FN6),
854 PINMUX_DATA(ED22_MARK, PORT189_FN7),
855 PINMUX_DATA(LCDD15_MARK, PORT190_FN1),
856 PINMUX_DATA(DV_D15_MARK, PORT190_FN3),
857 PINMUX_DATA(D23_MARK, PORT190_FN6),
858 PINMUX_DATA(ED23_MARK, PORT190_FN7),
859 PINMUX_DATA(LCDD16_MARK, PORT191_FN1),
860 PINMUX_DATA(DV_HSYNC_MARK, PORT191_FN3),
861 PINMUX_DATA(D24_MARK, PORT191_FN6),
862 PINMUX_DATA(ED24_MARK, PORT191_FN7),
863 PINMUX_DATA(LCDD17_MARK, PORT192_FN1),
864 PINMUX_DATA(DV_VSYNC_MARK, PORT192_FN3),
865 PINMUX_DATA(D25_MARK, PORT192_FN6),
866 PINMUX_DATA(ED25_MARK, PORT192_FN7),
867 PINMUX_DATA(LCDD18_MARK, PORT193_FN1),
868 PINMUX_DATA(DREQ2_MARK, PORT193_FN2),
869 PINMUX_DATA(MSIOF0L_TSCK_MARK, PORT193_FN5),
870 PINMUX_DATA(D26_MARK, PORT193_FN6),
871 PINMUX_DATA(ED26_MARK, PORT193_FN7),
872 PINMUX_DATA(LCDD19_MARK, PORT194_FN1),
873 PINMUX_DATA(MSIOF0L_TSYNC_MARK, PORT194_FN5),
874 PINMUX_DATA(D27_MARK, PORT194_FN6),
875 PINMUX_DATA(ED27_MARK, PORT194_FN7),
876 PINMUX_DATA(LCDD20_MARK, PORT195_FN1),
877 PINMUX_DATA(TS_SPSYNC1_MARK, PORT195_FN2),
878 PINMUX_DATA(MSIOF0L_MCK0_MARK, PORT195_FN5),
879 PINMUX_DATA(D28_MARK, PORT195_FN6),
880 PINMUX_DATA(ED28_MARK, PORT195_FN7),
881 PINMUX_DATA(LCDD21_MARK, PORT196_FN1),
882 PINMUX_DATA(TS_SDAT1_MARK, PORT196_FN2),
883 PINMUX_DATA(MSIOF0L_MCK1_MARK, PORT196_FN5),
884 PINMUX_DATA(D29_MARK, PORT196_FN6),
885 PINMUX_DATA(ED29_MARK, PORT196_FN7),
886 PINMUX_DATA(LCDD22_MARK, PORT197_FN1),
887 PINMUX_DATA(TS_SDEN1_MARK, PORT197_FN2),
888 PINMUX_DATA(MSIOF0L_SS1_MARK, PORT197_FN5),
889 PINMUX_DATA(D30_MARK, PORT197_FN6),
890 PINMUX_DATA(ED30_MARK, PORT197_FN7),
891 PINMUX_DATA(LCDD23_MARK, PORT198_FN1),
892 PINMUX_DATA(TS_SCK1_MARK, PORT198_FN2),
893 PINMUX_DATA(MSIOF0L_SS2_MARK, PORT198_FN5),
894 PINMUX_DATA(D31_MARK, PORT198_FN6),
895 PINMUX_DATA(ED31_MARK, PORT198_FN7),
896 PINMUX_DATA(LCDDCK_MARK, PORT199_FN1),
897 PINMUX_DATA(LCDWR_MARK, PORT199_FN2),
898 PINMUX_DATA(DV_CKO_MARK, PORT199_FN3),
899 PINMUX_DATA(SIUAOSPD_MARK, PORT199_FN4),
900 PINMUX_DATA(LCDRD_MARK, PORT200_FN1),
901 PINMUX_DATA(DACK2_MARK, PORT200_FN2),
902 PINMUX_DATA(MSIOF0L_RSYNC_MARK, PORT200_FN5),
903
904 /* 49-5 (FN) */
905 PINMUX_DATA(LCDHSYN_MARK, PORT201_FN1),
906 PINMUX_DATA(LCDCS_MARK, PORT201_FN2),
907 PINMUX_DATA(LCDCS2_MARK, PORT201_FN3),
908 PINMUX_DATA(DACK3_MARK, PORT201_FN4),
909 PINMUX_DATA(LCDDISP_MARK, PORT202_FN1),
910 PINMUX_DATA(LCDRS_MARK, PORT202_FN2),
911 PINMUX_DATA(DREQ3_MARK, PORT202_FN4),
912 PINMUX_DATA(MSIOF0L_RSCK_MARK, PORT202_FN5),
913 PINMUX_DATA(LCDCSYN_MARK, PORT203_FN1),
914 PINMUX_DATA(LCDCSYN2_MARK, PORT203_FN2),
915 PINMUX_DATA(DV_CKI_MARK, PORT203_FN3),
916 PINMUX_DATA(LCDLCLK_MARK, PORT204_FN1),
917 PINMUX_DATA(DREQ1_MARK, PORT204_FN3),
918 PINMUX_DATA(MSIOF0L_RXD_MARK, PORT204_FN5),
919 PINMUX_DATA(LCDDON_MARK, PORT205_FN1),
920 PINMUX_DATA(LCDDON2_MARK, PORT205_FN2),
921 PINMUX_DATA(DACK1_MARK, PORT205_FN3),
922 PINMUX_DATA(MSIOF0L_TXD_MARK, PORT205_FN5),
923 PINMUX_DATA(VIO_DR0_MARK, PORT206_FN1),
924 PINMUX_DATA(VIO_DR1_MARK, PORT207_FN1),
925 PINMUX_DATA(VIO_DR2_MARK, PORT208_FN1),
926 PINMUX_DATA(VIO_DR3_MARK, PORT209_FN1),
927 PINMUX_DATA(VIO_DR4_MARK, PORT210_FN1),
928 PINMUX_DATA(VIO_DR5_MARK, PORT211_FN1),
929 PINMUX_DATA(VIO_DR6_MARK, PORT212_FN1),
930 PINMUX_DATA(VIO_DR7_MARK, PORT213_FN1),
931 PINMUX_DATA(VIO_VDR_MARK, PORT214_FN1),
932 PINMUX_DATA(VIO_HDR_MARK, PORT215_FN1),
933 PINMUX_DATA(VIO_CLKR_MARK, PORT216_FN1),
934 PINMUX_DATA(VIO_CKOR_MARK, PORT217_FN1),
935 PINMUX_DATA(SCIFA1_TXD_MARK, PORT220_FN2),
936 PINMUX_DATA(GPS_PGFA0_MARK, PORT220_FN3),
937 PINMUX_DATA(SCIFA1_SCK_MARK, PORT221_FN2),
938 PINMUX_DATA(GPS_PGFA1_MARK, PORT221_FN3),
939 PINMUX_DATA(SCIFA1_RTS_MARK, PORT222_FN2),
940 PINMUX_DATA(GPS_EPPSINMON_MARK, PORT222_FN3),
941 PINMUX_DATA(SCIFA1_RXD_MARK, PORT223_FN2),
942 PINMUX_DATA(SCIFA1_CTS_MARK, PORT224_FN2),
943 PINMUX_DATA(MSIOF1_TXD_MARK, PORT225_FN1),
944 PINMUX_DATA(SCIFA1_TXD2_MARK, PORT225_FN2),
945 PINMUX_DATA(GPS_TXD_MARK, PORT225_FN3),
946 PINMUX_DATA(MSIOF1_TSYNC_MARK, PORT226_FN1),
947 PINMUX_DATA(SCIFA1_CTS2_MARK, PORT226_FN2),
948 PINMUX_DATA(I2C_SDA2_MARK, PORT226_FN3),
949 PINMUX_DATA(MSIOF1_TSCK_MARK, PORT227_FN1),
950 PINMUX_DATA(SCIFA1_SCK2_MARK, PORT227_FN2),
951 PINMUX_DATA(MSIOF1_RXD_MARK, PORT228_FN1),
952 PINMUX_DATA(SCIFA1_RXD2_MARK, PORT228_FN2),
953 PINMUX_DATA(GPS_RXD_MARK, PORT228_FN3),
954 PINMUX_DATA(MSIOF1_RSCK_MARK, PORT229_FN1),
955 PINMUX_DATA(SCIFA1_RTS2_MARK, PORT229_FN2),
956 PINMUX_DATA(MSIOF1_RSYNC_MARK, PORT230_FN1),
957 PINMUX_DATA(I2C_SCL2_MARK, PORT230_FN3),
958 PINMUX_DATA(MSIOF1_MCK0_MARK, PORT231_FN1),
959 PINMUX_DATA(MSIOF1_MCK1_MARK, PORT232_FN1),
960 PINMUX_DATA(MSIOF1_SS1_MARK, PORT233_FN1),
961 PINMUX_DATA(EDBGREQ3_MARK, PORT233_FN2),
962 PINMUX_DATA(MSIOF1_SS2_MARK, PORT234_FN1),
963 PINMUX_DATA(PORT236_IROUT_MARK, PORT236_FN1),
964 PINMUX_DATA(IRDA_OUT_MARK, PORT236_FN2),
965 PINMUX_DATA(IRDA_IN_MARK, PORT237_FN2),
966 PINMUX_DATA(IRDA_FIRSEL_MARK, PORT238_FN1),
967 PINMUX_DATA(TPU1TO0_MARK, PORT239_FN3),
968 PINMUX_DATA(TS_SPSYNC3_MARK, PORT239_FN4),
969 PINMUX_DATA(TPU1TO1_MARK, PORT240_FN3),
970 PINMUX_DATA(TS_SDAT3_MARK, PORT240_FN4),
971 PINMUX_DATA(TPU1TO2_MARK, PORT241_FN3),
972 PINMUX_DATA(TS_SDEN3_MARK, PORT241_FN4),
973 PINMUX_DATA(PORT241_MSIOF2_SS1_MARK, PORT241_FN5),
974 PINMUX_DATA(TPU1TO3_MARK, PORT242_FN3),
975 PINMUX_DATA(PORT242_MSIOF2_TSCK_MARK, PORT242_FN5),
976 PINMUX_DATA(M13_BSW_MARK, PORT243_FN2),
977 PINMUX_DATA(PORT243_MSIOF2_TSYNC_MARK, PORT243_FN5),
978 PINMUX_DATA(M14_GSW_MARK, PORT244_FN2),
979 PINMUX_DATA(PORT244_MSIOF2_TXD_MARK, PORT244_FN5),
980 PINMUX_DATA(PORT245_IROUT_MARK, PORT245_FN1),
981 PINMUX_DATA(M15_RSW_MARK, PORT245_FN2),
982 PINMUX_DATA(SOUT3_MARK, PORT246_FN1),
983 PINMUX_DATA(SCIFA2_TXD1_MARK, PORT246_FN2),
984 PINMUX_DATA(SIN3_MARK, PORT247_FN1),
985 PINMUX_DATA(SCIFA2_RXD1_MARK, PORT247_FN2),
986 PINMUX_DATA(XRTS3_MARK, PORT248_FN1),
987 PINMUX_DATA(SCIFA2_RTS1_MARK, PORT248_FN2),
988 PINMUX_DATA(PORT248_MSIOF2_SS2_MARK, PORT248_FN5),
989 PINMUX_DATA(XCTS3_MARK, PORT249_FN1),
990 PINMUX_DATA(SCIFA2_CTS1_MARK, PORT249_FN2),
991 PINMUX_DATA(PORT249_MSIOF2_RXD_MARK, PORT249_FN5),
992 PINMUX_DATA(DINT_MARK, PORT250_FN1),
993 PINMUX_DATA(SCIFA2_SCK1_MARK, PORT250_FN2),
994 PINMUX_DATA(TS_SCK3_MARK, PORT250_FN4),
995 PINMUX_DATA(SDHICLK0_MARK, PORT251_FN1),
996 PINMUX_DATA(TCK2_MARK, PORT251_FN2),
997 PINMUX_DATA(SDHICD0_MARK, PORT252_FN1),
998 PINMUX_DATA(SDHID0_0_MARK, PORT253_FN1),
999 PINMUX_DATA(TMS2_MARK, PORT253_FN2),
1000 PINMUX_DATA(SDHID0_1_MARK, PORT254_FN1),
1001 PINMUX_DATA(TDO2_MARK, PORT254_FN2),
1002 PINMUX_DATA(SDHID0_2_MARK, PORT255_FN1),
1003 PINMUX_DATA(TDI2_MARK, PORT255_FN2),
1004 PINMUX_DATA(SDHID0_3_MARK, PORT256_FN1),
1005 PINMUX_DATA(RTCK2_MARK, PORT256_FN2),
1006
1007 /* 49-6 (FN) */
1008 PINMUX_DATA(SDHICMD0_MARK, PORT257_FN1),
1009 PINMUX_DATA(TRST2_MARK, PORT257_FN2),
1010 PINMUX_DATA(SDHIWP0_MARK, PORT258_FN1),
1011 PINMUX_DATA(EDBGREQ2_MARK, PORT258_FN2),
1012 PINMUX_DATA(SDHICLK1_MARK, PORT259_FN1),
1013 PINMUX_DATA(TCK3_MARK, PORT259_FN4),
1014 PINMUX_DATA(SDHID1_0_MARK, PORT260_FN1),
1015 PINMUX_DATA(M11_SLCD_SO2_MARK, PORT260_FN2),
1016 PINMUX_DATA(TS_SPSYNC2_MARK, PORT260_FN3),
1017 PINMUX_DATA(TMS3_MARK, PORT260_FN4),
1018 PINMUX_DATA(SDHID1_1_MARK, PORT261_FN1),
1019 PINMUX_DATA(M9_SLCD_AO2_MARK, PORT261_FN2),
1020 PINMUX_DATA(TS_SDAT2_MARK, PORT261_FN3),
1021 PINMUX_DATA(TDO3_MARK, PORT261_FN4),
1022 PINMUX_DATA(SDHID1_2_MARK, PORT262_FN1),
1023 PINMUX_DATA(M10_SLCD_CK2_MARK, PORT262_FN2),
1024 PINMUX_DATA(TS_SDEN2_MARK, PORT262_FN3),
1025 PINMUX_DATA(TDI3_MARK, PORT262_FN4),
1026 PINMUX_DATA(SDHID1_3_MARK, PORT263_FN1),
1027 PINMUX_DATA(M12_SLCD_CE2_MARK, PORT263_FN2),
1028 PINMUX_DATA(TS_SCK2_MARK, PORT263_FN3),
1029 PINMUX_DATA(RTCK3_MARK, PORT263_FN4),
1030 PINMUX_DATA(SDHICMD1_MARK, PORT264_FN1),
1031 PINMUX_DATA(TRST3_MARK, PORT264_FN4),
1032 PINMUX_DATA(SDHICLK2_MARK, PORT265_FN1),
1033 PINMUX_DATA(SCIFB_SCK_MARK, PORT265_FN2),
1034 PINMUX_DATA(SDHID2_0_MARK, PORT266_FN1),
1035 PINMUX_DATA(SCIFB_TXD_MARK, PORT266_FN2),
1036 PINMUX_DATA(SDHID2_1_MARK, PORT267_FN1),
1037 PINMUX_DATA(SCIFB_CTS_MARK, PORT267_FN2),
1038 PINMUX_DATA(SDHID2_2_MARK, PORT268_FN1),
1039 PINMUX_DATA(SCIFB_RXD_MARK, PORT268_FN2),
1040 PINMUX_DATA(SDHID2_3_MARK, PORT269_FN1),
1041 PINMUX_DATA(SCIFB_RTS_MARK, PORT269_FN2),
1042 PINMUX_DATA(SDHICMD2_MARK, PORT270_FN1),
1043 PINMUX_DATA(RESETOUTS_MARK, PORT271_FN1),
1044 PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1),
1045};
1046
1047static struct pinmux_gpio pinmux_gpios[] = {
1048 /* 49-1 -> 49-6 (GPIO) */
1049 GPIO_PORT_ALL(),
1050
1051 /* Special Pull-up / Pull-down Functions */
1052 GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU),
1053 GPIO_FN(PORT50_KEYIN2_PU), GPIO_FN(PORT55_KEYIN3_PU),
1054 GPIO_FN(PORT56_KEYIN4_PU), GPIO_FN(PORT57_KEYIN5_PU),
1055 GPIO_FN(PORT58_KEYIN6_PU),
1056
1057 /* 49-1 (FN) */
1058 GPIO_FN(VBUS0), GPIO_FN(CPORT0), GPIO_FN(CPORT1), GPIO_FN(CPORT2),
1059 GPIO_FN(CPORT3), GPIO_FN(CPORT4), GPIO_FN(CPORT5), GPIO_FN(CPORT6),
1060 GPIO_FN(CPORT7), GPIO_FN(CPORT8), GPIO_FN(CPORT9), GPIO_FN(CPORT10),
1061 GPIO_FN(CPORT11), GPIO_FN(SIN2), GPIO_FN(CPORT12), GPIO_FN(XCTS2),
1062 GPIO_FN(CPORT13), GPIO_FN(RFSPO4), GPIO_FN(CPORT14), GPIO_FN(RFSPO5),
1063 GPIO_FN(CPORT15), GPIO_FN(CPORT16), GPIO_FN(CPORT17), GPIO_FN(SOUT2),
1064 GPIO_FN(CPORT18), GPIO_FN(XRTS2), GPIO_FN(CPORT19), GPIO_FN(CPORT20),
1065 GPIO_FN(RFSPO6), GPIO_FN(CPORT21), GPIO_FN(STATUS0), GPIO_FN(CPORT22),
1066 GPIO_FN(STATUS1), GPIO_FN(CPORT23), GPIO_FN(STATUS2), GPIO_FN(RFSPO7),
1067 GPIO_FN(MPORT0), GPIO_FN(MPORT1), GPIO_FN(B_SYNLD1), GPIO_FN(B_SYNLD2),
1068 GPIO_FN(XMAINPS), GPIO_FN(XDIVPS), GPIO_FN(XIDRST), GPIO_FN(IDCLK),
1069 GPIO_FN(IDIO), GPIO_FN(SOUT1), GPIO_FN(SCIFA4_TXD),
1070 GPIO_FN(M02_BERDAT), GPIO_FN(SIN1), GPIO_FN(SCIFA4_RXD), GPIO_FN(XWUP),
1071 GPIO_FN(XRTS1), GPIO_FN(SCIFA4_RTS), GPIO_FN(M03_BERCLK),
1072 GPIO_FN(XCTS1), GPIO_FN(SCIFA4_CTS),
1073
1074 /* 49-2 (FN) */
1075 GPIO_FN(HSU_IQ_AGC6), GPIO_FN(MFG2_IN2), GPIO_FN(MSIOF2_MCK0),
1076 GPIO_FN(HSU_IQ_AGC5), GPIO_FN(MFG2_IN1), GPIO_FN(MSIOF2_MCK1),
1077 GPIO_FN(HSU_IQ_AGC4), GPIO_FN(MSIOF2_RSYNC),
1078 GPIO_FN(HSU_IQ_AGC3), GPIO_FN(MFG2_OUT1), GPIO_FN(MSIOF2_RSCK),
1079 GPIO_FN(HSU_IQ_AGC2), GPIO_FN(PORT42_KEYOUT0),
1080 GPIO_FN(HSU_IQ_AGC1), GPIO_FN(PORT43_KEYOUT1),
1081 GPIO_FN(HSU_IQ_AGC0), GPIO_FN(PORT44_KEYOUT2),
1082 GPIO_FN(HSU_IQ_AGC_ST), GPIO_FN(PORT45_KEYOUT3),
1083 GPIO_FN(HSU_IQ_PDO), GPIO_FN(PORT46_KEYOUT4),
1084 GPIO_FN(HSU_IQ_PYO), GPIO_FN(PORT47_KEYOUT5),
1085 GPIO_FN(HSU_EN_TXMUX_G3MO), GPIO_FN(PORT48_KEYIN0),
1086 GPIO_FN(HSU_I_TXMUX_G3MO), GPIO_FN(PORT49_KEYIN1),
1087 GPIO_FN(HSU_Q_TXMUX_G3MO), GPIO_FN(PORT50_KEYIN2),
1088 GPIO_FN(HSU_SYO), GPIO_FN(PORT51_MSIOF2_TSYNC),
1089 GPIO_FN(HSU_SDO), GPIO_FN(PORT52_MSIOF2_TSCK),
1090 GPIO_FN(HSU_TGTTI_G3MO), GPIO_FN(PORT53_MSIOF2_TXD),
1091 GPIO_FN(B_TIME_STAMP), GPIO_FN(PORT54_MSIOF2_RXD),
1092 GPIO_FN(HSU_SDI), GPIO_FN(PORT55_KEYIN3),
1093 GPIO_FN(HSU_SCO), GPIO_FN(PORT56_KEYIN4),
1094 GPIO_FN(HSU_DREQ), GPIO_FN(PORT57_KEYIN5),
1095 GPIO_FN(HSU_DACK), GPIO_FN(PORT58_KEYIN6),
1096 GPIO_FN(HSU_CLK61M), GPIO_FN(PORT59_MSIOF2_SS1),
1097 GPIO_FN(HSU_XRST), GPIO_FN(PORT60_MSIOF2_SS2),
1098 GPIO_FN(PCMCLKO), GPIO_FN(SYNC8KO), GPIO_FN(DNPCM_A), GPIO_FN(UPPCM_A),
1099 GPIO_FN(XTALB1L),
1100 GPIO_FN(GPS_AGC1), GPIO_FN(SCIFA0_RTS),
1101 GPIO_FN(GPS_AGC2), GPIO_FN(SCIFA0_SCK),
1102 GPIO_FN(GPS_AGC3), GPIO_FN(SCIFA0_TXD),
1103 GPIO_FN(GPS_AGC4), GPIO_FN(SCIFA0_RXD),
1104 GPIO_FN(GPS_PWRD), GPIO_FN(SCIFA0_CTS),
1105 GPIO_FN(GPS_IM), GPIO_FN(GPS_IS), GPIO_FN(GPS_QM), GPIO_FN(GPS_QS),
1106 GPIO_FN(SIUBOMC), GPIO_FN(TPU2TO0),
1107 GPIO_FN(SIUCKB), GPIO_FN(TPU2TO1),
1108 GPIO_FN(SIUBOLR), GPIO_FN(BBIF2_TSYNC), GPIO_FN(TPU2TO2),
1109 GPIO_FN(SIUBOBT), GPIO_FN(BBIF2_TSCK), GPIO_FN(TPU2TO3),
1110 GPIO_FN(SIUBOSLD), GPIO_FN(BBIF2_TXD), GPIO_FN(TPU3TO0),
1111 GPIO_FN(SIUBILR), GPIO_FN(TPU3TO1),
1112 GPIO_FN(SIUBIBT), GPIO_FN(TPU3TO2),
1113 GPIO_FN(SIUBISLD), GPIO_FN(TPU3TO3),
1114 GPIO_FN(NMI), GPIO_FN(TPU4TO0),
1115 GPIO_FN(DNPCM_M), GPIO_FN(TPU4TO1), GPIO_FN(TPU4TO2), GPIO_FN(TPU4TO3),
1116 GPIO_FN(IRQ_TMPB),
1117 GPIO_FN(PWEN), GPIO_FN(MFG1_OUT1),
1118 GPIO_FN(OVCN), GPIO_FN(MFG1_IN1),
1119 GPIO_FN(OVCN2), GPIO_FN(MFG1_IN2),
1120
1121 /* 49-3 (FN) */
1122 GPIO_FN(RFSPO1), GPIO_FN(RFSPO2), GPIO_FN(RFSPO3),
1123 GPIO_FN(PORT93_VIO_CKO2),
1124 GPIO_FN(USBTERM), GPIO_FN(EXTLP), GPIO_FN(IDIN),
1125 GPIO_FN(SCIFA5_CTS), GPIO_FN(MFG0_IN1),
1126 GPIO_FN(SCIFA5_RTS), GPIO_FN(MFG0_IN2),
1127 GPIO_FN(SCIFA5_RXD),
1128 GPIO_FN(SCIFA5_TXD),
1129 GPIO_FN(SCIFA5_SCK), GPIO_FN(MFG0_OUT1),
1130 GPIO_FN(A0_EA0), GPIO_FN(BS),
1131 GPIO_FN(A14_EA14), GPIO_FN(PORT102_KEYOUT0),
1132 GPIO_FN(A15_EA15), GPIO_FN(PORT103_KEYOUT1), GPIO_FN(DV_CLKOL),
1133 GPIO_FN(A16_EA16), GPIO_FN(PORT104_KEYOUT2),
1134 GPIO_FN(DV_VSYNCL), GPIO_FN(MSIOF0_SS1),
1135 GPIO_FN(A17_EA17), GPIO_FN(PORT105_KEYOUT3),
1136 GPIO_FN(DV_HSYNCL), GPIO_FN(MSIOF0_TSYNC),
1137 GPIO_FN(A18_EA18), GPIO_FN(PORT106_KEYOUT4),
1138 GPIO_FN(DV_DL0), GPIO_FN(MSIOF0_TSCK),
1139 GPIO_FN(A19_EA19), GPIO_FN(PORT107_KEYOUT5),
1140 GPIO_FN(DV_DL1), GPIO_FN(MSIOF0_TXD),
1141 GPIO_FN(A20_EA20), GPIO_FN(PORT108_KEYIN0),
1142 GPIO_FN(DV_DL2), GPIO_FN(MSIOF0_RSCK),
1143 GPIO_FN(A21_EA21), GPIO_FN(PORT109_KEYIN1),
1144 GPIO_FN(DV_DL3), GPIO_FN(MSIOF0_RSYNC),
1145 GPIO_FN(A22_EA22), GPIO_FN(PORT110_KEYIN2),
1146 GPIO_FN(DV_DL4), GPIO_FN(MSIOF0_MCK0),
1147 GPIO_FN(A23_EA23), GPIO_FN(PORT111_KEYIN3),
1148 GPIO_FN(DV_DL5), GPIO_FN(MSIOF0_MCK1),
1149 GPIO_FN(A24_EA24), GPIO_FN(PORT112_KEYIN4),
1150 GPIO_FN(DV_DL6), GPIO_FN(MSIOF0_RXD),
1151 GPIO_FN(A25_EA25), GPIO_FN(PORT113_KEYIN5),
1152 GPIO_FN(DV_DL7), GPIO_FN(MSIOF0_SS2),
1153 GPIO_FN(A26), GPIO_FN(PORT113_KEYIN6), GPIO_FN(DV_CLKIL),
1154 GPIO_FN(D0_ED0_NAF0), GPIO_FN(D1_ED1_NAF1), GPIO_FN(D2_ED2_NAF2),
1155 GPIO_FN(D3_ED3_NAF3), GPIO_FN(D4_ED4_NAF4), GPIO_FN(D5_ED5_NAF5),
1156 GPIO_FN(D6_ED6_NAF6), GPIO_FN(D7_ED7_NAF7), GPIO_FN(D8_ED8_NAF8),
1157 GPIO_FN(D9_ED9_NAF9), GPIO_FN(D10_ED10_NAF10), GPIO_FN(D11_ED11_NAF11),
1158 GPIO_FN(D12_ED12_NAF12), GPIO_FN(D13_ED13_NAF13),
1159 GPIO_FN(D14_ED14_NAF14), GPIO_FN(D15_ED15_NAF15),
1160 GPIO_FN(CS4), GPIO_FN(CS5A), GPIO_FN(CS5B), GPIO_FN(FCE1),
1161 GPIO_FN(CS6B), GPIO_FN(XCS2), GPIO_FN(FCE0), GPIO_FN(CS6A),
1162 GPIO_FN(DACK0), GPIO_FN(WAIT), GPIO_FN(DREQ0), GPIO_FN(RD_XRD),
1163 GPIO_FN(A27), GPIO_FN(RDWR_XWE), GPIO_FN(WE0_XWR0_FWE),
1164 GPIO_FN(WE1_XWR1), GPIO_FN(FRB), GPIO_FN(CKO),
1165 GPIO_FN(NBRSTOUT), GPIO_FN(NBRST),
1166
1167 /* 49-4 (FN) */
1168 GPIO_FN(RFSPO0), GPIO_FN(PORT146_VIO_CKO2), GPIO_FN(TSTMD),
1169 GPIO_FN(VIO_VD), GPIO_FN(VIO_HD),
1170 GPIO_FN(VIO_D0), GPIO_FN(VIO_D1), GPIO_FN(VIO_D2),
1171 GPIO_FN(VIO_D3), GPIO_FN(VIO_D4), GPIO_FN(VIO_D5),
1172 GPIO_FN(VIO_D6), GPIO_FN(VIO_D7), GPIO_FN(VIO_D8),
1173 GPIO_FN(VIO_D9), GPIO_FN(VIO_D10), GPIO_FN(VIO_D11),
1174 GPIO_FN(VIO_D12), GPIO_FN(VIO_D13), GPIO_FN(VIO_D14),
1175 GPIO_FN(VIO_D15), GPIO_FN(VIO_CLK), GPIO_FN(VIO_FIELD),
1176 GPIO_FN(VIO_CKO),
1177 GPIO_FN(MFG3_IN1), GPIO_FN(MFG3_IN2),
1178 GPIO_FN(M9_SLCD_A01), GPIO_FN(MFG3_OUT1), GPIO_FN(TPU0TO0),
1179 GPIO_FN(M10_SLCD_CK1), GPIO_FN(MFG4_IN1), GPIO_FN(TPU0TO1),
1180 GPIO_FN(M11_SLCD_SO1), GPIO_FN(MFG4_IN2), GPIO_FN(TPU0TO2),
1181 GPIO_FN(M12_SLCD_CE1), GPIO_FN(MFG4_OUT1), GPIO_FN(TPU0TO3),
1182 GPIO_FN(LCDD0), GPIO_FN(PORT175_KEYOUT0), GPIO_FN(DV_D0),
1183 GPIO_FN(SIUCKA), GPIO_FN(MFG0_OUT2),
1184 GPIO_FN(LCDD1), GPIO_FN(PORT176_KEYOUT1), GPIO_FN(DV_D1),
1185 GPIO_FN(SIUAOLR), GPIO_FN(BBIF2_TSYNC1),
1186 GPIO_FN(LCDD2), GPIO_FN(PORT177_KEYOUT2), GPIO_FN(DV_D2),
1187 GPIO_FN(SIUAOBT), GPIO_FN(BBIF2_TSCK1),
1188 GPIO_FN(LCDD3), GPIO_FN(PORT178_KEYOUT3), GPIO_FN(DV_D3),
1189 GPIO_FN(SIUAOSLD), GPIO_FN(BBIF2_TXD1),
1190 GPIO_FN(LCDD4), GPIO_FN(PORT179_KEYOUT4), GPIO_FN(DV_D4),
1191 GPIO_FN(SIUAISPD), GPIO_FN(MFG1_OUT2),
1192 GPIO_FN(LCDD5), GPIO_FN(PORT180_KEYOUT5), GPIO_FN(DV_D5),
1193 GPIO_FN(SIUAILR), GPIO_FN(MFG2_OUT2),
1194 GPIO_FN(LCDD6), GPIO_FN(DV_D6),
1195 GPIO_FN(SIUAIBT), GPIO_FN(MFG3_OUT2), GPIO_FN(XWR2),
1196 GPIO_FN(LCDD7), GPIO_FN(DV_D7),
1197 GPIO_FN(SIUAISLD), GPIO_FN(MFG4_OUT2), GPIO_FN(XWR3),
1198 GPIO_FN(LCDD8), GPIO_FN(DV_D8), GPIO_FN(D16), GPIO_FN(ED16),
1199 GPIO_FN(LCDD9), GPIO_FN(DV_D9), GPIO_FN(D17), GPIO_FN(ED17),
1200 GPIO_FN(LCDD10), GPIO_FN(DV_D10), GPIO_FN(D18), GPIO_FN(ED18),
1201 GPIO_FN(LCDD11), GPIO_FN(DV_D11), GPIO_FN(D19), GPIO_FN(ED19),
1202 GPIO_FN(LCDD12), GPIO_FN(DV_D12), GPIO_FN(D20), GPIO_FN(ED20),
1203 GPIO_FN(LCDD13), GPIO_FN(DV_D13), GPIO_FN(D21), GPIO_FN(ED21),
1204 GPIO_FN(LCDD14), GPIO_FN(DV_D14), GPIO_FN(D22), GPIO_FN(ED22),
1205 GPIO_FN(LCDD15), GPIO_FN(DV_D15), GPIO_FN(D23), GPIO_FN(ED23),
1206 GPIO_FN(LCDD16), GPIO_FN(DV_HSYNC), GPIO_FN(D24), GPIO_FN(ED24),
1207 GPIO_FN(LCDD17), GPIO_FN(DV_VSYNC), GPIO_FN(D25), GPIO_FN(ED25),
1208 GPIO_FN(LCDD18), GPIO_FN(DREQ2), GPIO_FN(MSIOF0L_TSCK),
1209 GPIO_FN(D26), GPIO_FN(ED26),
1210 GPIO_FN(LCDD19), GPIO_FN(MSIOF0L_TSYNC),
1211 GPIO_FN(D27), GPIO_FN(ED27),
1212 GPIO_FN(LCDD20), GPIO_FN(TS_SPSYNC1), GPIO_FN(MSIOF0L_MCK0),
1213 GPIO_FN(D28), GPIO_FN(ED28),
1214 GPIO_FN(LCDD21), GPIO_FN(TS_SDAT1), GPIO_FN(MSIOF0L_MCK1),
1215 GPIO_FN(D29), GPIO_FN(ED29),
1216 GPIO_FN(LCDD22), GPIO_FN(TS_SDEN1), GPIO_FN(MSIOF0L_SS1),
1217 GPIO_FN(D30), GPIO_FN(ED30),
1218 GPIO_FN(LCDD23), GPIO_FN(TS_SCK1), GPIO_FN(MSIOF0L_SS2),
1219 GPIO_FN(D31), GPIO_FN(ED31),
1220 GPIO_FN(LCDDCK), GPIO_FN(LCDWR), GPIO_FN(DV_CKO), GPIO_FN(SIUAOSPD),
1221 GPIO_FN(LCDRD), GPIO_FN(DACK2), GPIO_FN(MSIOF0L_RSYNC),
1222
1223 /* 49-5 (FN) */
1224 GPIO_FN(LCDHSYN), GPIO_FN(LCDCS), GPIO_FN(LCDCS2), GPIO_FN(DACK3),
1225 GPIO_FN(LCDDISP), GPIO_FN(LCDRS), GPIO_FN(DREQ3), GPIO_FN(MSIOF0L_RSCK),
1226 GPIO_FN(LCDCSYN), GPIO_FN(LCDCSYN2), GPIO_FN(DV_CKI),
1227 GPIO_FN(LCDLCLK), GPIO_FN(DREQ1), GPIO_FN(MSIOF0L_RXD),
1228 GPIO_FN(LCDDON), GPIO_FN(LCDDON2), GPIO_FN(DACK1), GPIO_FN(MSIOF0L_TXD),
1229 GPIO_FN(VIO_DR0), GPIO_FN(VIO_DR1), GPIO_FN(VIO_DR2), GPIO_FN(VIO_DR3),
1230 GPIO_FN(VIO_DR4), GPIO_FN(VIO_DR5), GPIO_FN(VIO_DR6), GPIO_FN(VIO_DR7),
1231 GPIO_FN(VIO_VDR), GPIO_FN(VIO_HDR),
1232 GPIO_FN(VIO_CLKR), GPIO_FN(VIO_CKOR),
1233 GPIO_FN(SCIFA1_TXD), GPIO_FN(GPS_PGFA0),
1234 GPIO_FN(SCIFA1_SCK), GPIO_FN(GPS_PGFA1),
1235 GPIO_FN(SCIFA1_RTS), GPIO_FN(GPS_EPPSINMON),
1236 GPIO_FN(SCIFA1_RXD), GPIO_FN(SCIFA1_CTS),
1237 GPIO_FN(MSIOF1_TXD), GPIO_FN(SCIFA1_TXD2), GPIO_FN(GPS_TXD),
1238 GPIO_FN(MSIOF1_TSYNC), GPIO_FN(SCIFA1_CTS2), GPIO_FN(I2C_SDA2),
1239 GPIO_FN(MSIOF1_TSCK), GPIO_FN(SCIFA1_SCK2),
1240 GPIO_FN(MSIOF1_RXD), GPIO_FN(SCIFA1_RXD2), GPIO_FN(GPS_RXD),
1241 GPIO_FN(MSIOF1_RSCK), GPIO_FN(SCIFA1_RTS2),
1242 GPIO_FN(MSIOF1_RSYNC), GPIO_FN(I2C_SCL2),
1243 GPIO_FN(MSIOF1_MCK0), GPIO_FN(MSIOF1_MCK1),
1244 GPIO_FN(MSIOF1_SS1), GPIO_FN(EDBGREQ3),
1245 GPIO_FN(MSIOF1_SS2),
1246 GPIO_FN(PORT236_IROUT), GPIO_FN(IRDA_OUT),
1247 GPIO_FN(IRDA_IN), GPIO_FN(IRDA_FIRSEL),
1248 GPIO_FN(TPU1TO0), GPIO_FN(TS_SPSYNC3),
1249 GPIO_FN(TPU1TO1), GPIO_FN(TS_SDAT3),
1250 GPIO_FN(TPU1TO2), GPIO_FN(TS_SDEN3), GPIO_FN(PORT241_MSIOF2_SS1),
1251 GPIO_FN(TPU1TO3), GPIO_FN(PORT242_MSIOF2_TSCK),
1252 GPIO_FN(M13_BSW), GPIO_FN(PORT243_MSIOF2_TSYNC),
1253 GPIO_FN(M14_GSW), GPIO_FN(PORT244_MSIOF2_TXD),
1254 GPIO_FN(PORT245_IROUT), GPIO_FN(M15_RSW),
1255 GPIO_FN(SOUT3), GPIO_FN(SCIFA2_TXD1),
1256 GPIO_FN(SIN3), GPIO_FN(SCIFA2_RXD1),
1257 GPIO_FN(XRTS3), GPIO_FN(SCIFA2_RTS1), GPIO_FN(PORT248_MSIOF2_SS2),
1258 GPIO_FN(XCTS3), GPIO_FN(SCIFA2_CTS1), GPIO_FN(PORT249_MSIOF2_RXD),
1259 GPIO_FN(DINT), GPIO_FN(SCIFA2_SCK1), GPIO_FN(TS_SCK3),
1260 GPIO_FN(SDHICLK0), GPIO_FN(TCK2),
1261 GPIO_FN(SDHICD0),
1262 GPIO_FN(SDHID0_0), GPIO_FN(TMS2),
1263 GPIO_FN(SDHID0_1), GPIO_FN(TDO2),
1264 GPIO_FN(SDHID0_2), GPIO_FN(TDI2),
1265 GPIO_FN(SDHID0_3), GPIO_FN(RTCK2),
1266
1267 /* 49-6 (FN) */
1268 GPIO_FN(SDHICMD0), GPIO_FN(TRST2),
1269 GPIO_FN(SDHIWP0), GPIO_FN(EDBGREQ2),
1270 GPIO_FN(SDHICLK1), GPIO_FN(TCK3),
1271 GPIO_FN(SDHID1_0), GPIO_FN(M11_SLCD_SO2),
1272 GPIO_FN(TS_SPSYNC2), GPIO_FN(TMS3),
1273 GPIO_FN(SDHID1_1), GPIO_FN(M9_SLCD_AO2),
1274 GPIO_FN(TS_SDAT2), GPIO_FN(TDO3),
1275 GPIO_FN(SDHID1_2), GPIO_FN(M10_SLCD_CK2),
1276 GPIO_FN(TS_SDEN2), GPIO_FN(TDI3),
1277 GPIO_FN(SDHID1_3), GPIO_FN(M12_SLCD_CE2),
1278 GPIO_FN(TS_SCK2), GPIO_FN(RTCK3),
1279 GPIO_FN(SDHICMD1), GPIO_FN(TRST3),
1280 GPIO_FN(SDHICLK2), GPIO_FN(SCIFB_SCK),
1281 GPIO_FN(SDHID2_0), GPIO_FN(SCIFB_TXD),
1282 GPIO_FN(SDHID2_1), GPIO_FN(SCIFB_CTS),
1283 GPIO_FN(SDHID2_2), GPIO_FN(SCIFB_RXD),
1284 GPIO_FN(SDHID2_3), GPIO_FN(SCIFB_RTS),
1285 GPIO_FN(SDHICMD2),
1286 GPIO_FN(RESETOUTS),
1287 GPIO_FN(DIVLOCK),
1288};
1289
1290static struct pinmux_cfg_reg pinmux_config_regs[] = {
1291 PORTCR(0, 0xe6050000), /* PORT0CR */
1292 PORTCR(1, 0xe6050001), /* PORT1CR */
1293 PORTCR(2, 0xe6050002), /* PORT2CR */
1294 PORTCR(3, 0xe6050003), /* PORT3CR */
1295 PORTCR(4, 0xe6050004), /* PORT4CR */
1296 PORTCR(5, 0xe6050005), /* PORT5CR */
1297 PORTCR(6, 0xe6050006), /* PORT6CR */
1298 PORTCR(7, 0xe6050007), /* PORT7CR */
1299 PORTCR(8, 0xe6050008), /* PORT8CR */
1300 PORTCR(9, 0xe6050009), /* PORT9CR */
1301
1302 PORTCR(10, 0xe605000a), /* PORT10CR */
1303 PORTCR(11, 0xe605000b), /* PORT11CR */
1304 PORTCR(12, 0xe605000c), /* PORT12CR */
1305 PORTCR(13, 0xe605000d), /* PORT13CR */
1306 PORTCR(14, 0xe605000e), /* PORT14CR */
1307 PORTCR(15, 0xe605000f), /* PORT15CR */
1308 PORTCR(16, 0xe6050010), /* PORT16CR */
1309 PORTCR(17, 0xe6050011), /* PORT17CR */
1310 PORTCR(18, 0xe6050012), /* PORT18CR */
1311 PORTCR(19, 0xe6050013), /* PORT19CR */
1312
1313 PORTCR(20, 0xe6050014), /* PORT20CR */
1314 PORTCR(21, 0xe6050015), /* PORT21CR */
1315 PORTCR(22, 0xe6050016), /* PORT22CR */
1316 PORTCR(23, 0xe6050017), /* PORT23CR */
1317 PORTCR(24, 0xe6050018), /* PORT24CR */
1318 PORTCR(25, 0xe6050019), /* PORT25CR */
1319 PORTCR(26, 0xe605001a), /* PORT26CR */
1320 PORTCR(27, 0xe605001b), /* PORT27CR */
1321 PORTCR(28, 0xe605001c), /* PORT28CR */
1322 PORTCR(29, 0xe605001d), /* PORT29CR */
1323
1324 PORTCR(30, 0xe605001e), /* PORT30CR */
1325 PORTCR(31, 0xe605001f), /* PORT31CR */
1326 PORTCR(32, 0xe6050020), /* PORT32CR */
1327 PORTCR(33, 0xe6050021), /* PORT33CR */
1328 PORTCR(34, 0xe6050022), /* PORT34CR */
1329 PORTCR(35, 0xe6050023), /* PORT35CR */
1330 PORTCR(36, 0xe6050024), /* PORT36CR */
1331 PORTCR(37, 0xe6050025), /* PORT37CR */
1332 PORTCR(38, 0xe6050026), /* PORT38CR */
1333 PORTCR(39, 0xe6050027), /* PORT39CR */
1334
1335 PORTCR(40, 0xe6050028), /* PORT40CR */
1336 PORTCR(41, 0xe6050029), /* PORT41CR */
1337 PORTCR(42, 0xe605002a), /* PORT42CR */
1338 PORTCR(43, 0xe605002b), /* PORT43CR */
1339 PORTCR(44, 0xe605002c), /* PORT44CR */
1340 PORTCR(45, 0xe605002d), /* PORT45CR */
1341 PORTCR(46, 0xe605002e), /* PORT46CR */
1342 PORTCR(47, 0xe605002f), /* PORT47CR */
1343 PORTCR(48, 0xe6050030), /* PORT48CR */
1344 PORTCR(49, 0xe6050031), /* PORT49CR */
1345
1346 PORTCR(50, 0xe6050032), /* PORT50CR */
1347 PORTCR(51, 0xe6050033), /* PORT51CR */
1348 PORTCR(52, 0xe6050034), /* PORT52CR */
1349 PORTCR(53, 0xe6050035), /* PORT53CR */
1350 PORTCR(54, 0xe6050036), /* PORT54CR */
1351 PORTCR(55, 0xe6050037), /* PORT55CR */
1352 PORTCR(56, 0xe6050038), /* PORT56CR */
1353 PORTCR(57, 0xe6050039), /* PORT57CR */
1354 PORTCR(58, 0xe605003a), /* PORT58CR */
1355 PORTCR(59, 0xe605003b), /* PORT59CR */
1356
1357 PORTCR(60, 0xe605003c), /* PORT60CR */
1358 PORTCR(61, 0xe605003d), /* PORT61CR */
1359 PORTCR(62, 0xe605003e), /* PORT62CR */
1360 PORTCR(63, 0xe605003f), /* PORT63CR */
1361 PORTCR(64, 0xe6050040), /* PORT64CR */
1362 PORTCR(65, 0xe6050041), /* PORT65CR */
1363 PORTCR(66, 0xe6050042), /* PORT66CR */
1364 PORTCR(67, 0xe6050043), /* PORT67CR */
1365 PORTCR(68, 0xe6050044), /* PORT68CR */
1366 PORTCR(69, 0xe6050045), /* PORT69CR */
1367
1368 PORTCR(70, 0xe6050046), /* PORT70CR */
1369 PORTCR(71, 0xe6050047), /* PORT71CR */
1370 PORTCR(72, 0xe6050048), /* PORT72CR */
1371 PORTCR(73, 0xe6050049), /* PORT73CR */
1372 PORTCR(74, 0xe605004a), /* PORT74CR */
1373 PORTCR(75, 0xe605004b), /* PORT75CR */
1374 PORTCR(76, 0xe605004c), /* PORT76CR */
1375 PORTCR(77, 0xe605004d), /* PORT77CR */
1376 PORTCR(78, 0xe605004e), /* PORT78CR */
1377 PORTCR(79, 0xe605004f), /* PORT79CR */
1378
1379 PORTCR(80, 0xe6050050), /* PORT80CR */
1380 PORTCR(81, 0xe6050051), /* PORT81CR */
1381 PORTCR(82, 0xe6050052), /* PORT82CR */
1382 PORTCR(83, 0xe6050053), /* PORT83CR */
1383 PORTCR(84, 0xe6050054), /* PORT84CR */
1384 PORTCR(85, 0xe6050055), /* PORT85CR */
1385 PORTCR(86, 0xe6050056), /* PORT86CR */
1386 PORTCR(87, 0xe6050057), /* PORT87CR */
1387 PORTCR(88, 0xe6051058), /* PORT88CR */
1388 PORTCR(89, 0xe6051059), /* PORT89CR */
1389
1390 PORTCR(90, 0xe605105a), /* PORT90CR */
1391 PORTCR(91, 0xe605105b), /* PORT91CR */
1392 PORTCR(92, 0xe605105c), /* PORT92CR */
1393 PORTCR(93, 0xe605105d), /* PORT93CR */
1394 PORTCR(94, 0xe605105e), /* PORT94CR */
1395 PORTCR(95, 0xe605105f), /* PORT95CR */
1396 PORTCR(96, 0xe6051060), /* PORT96CR */
1397 PORTCR(97, 0xe6051061), /* PORT97CR */
1398 PORTCR(98, 0xe6051062), /* PORT98CR */
1399 PORTCR(99, 0xe6051063), /* PORT99CR */
1400
1401 PORTCR(100, 0xe6051064), /* PORT100CR */
1402 PORTCR(101, 0xe6051065), /* PORT101CR */
1403 PORTCR(102, 0xe6051066), /* PORT102CR */
1404 PORTCR(103, 0xe6051067), /* PORT103CR */
1405 PORTCR(104, 0xe6051068), /* PORT104CR */
1406 PORTCR(105, 0xe6051069), /* PORT105CR */
1407 PORTCR(106, 0xe605106a), /* PORT106CR */
1408 PORTCR(107, 0xe605106b), /* PORT107CR */
1409 PORTCR(108, 0xe605106c), /* PORT108CR */
1410 PORTCR(109, 0xe605106d), /* PORT109CR */
1411
1412 PORTCR(110, 0xe605106e), /* PORT110CR */
1413 PORTCR(111, 0xe605106f), /* PORT111CR */
1414 PORTCR(112, 0xe6051070), /* PORT112CR */
1415 PORTCR(113, 0xe6051071), /* PORT113CR */
1416 PORTCR(114, 0xe6051072), /* PORT114CR */
1417 PORTCR(115, 0xe6051073), /* PORT115CR */
1418 PORTCR(116, 0xe6051074), /* PORT116CR */
1419 PORTCR(117, 0xe6051075), /* PORT117CR */
1420 PORTCR(118, 0xe6051076), /* PORT118CR */
1421 PORTCR(119, 0xe6051077), /* PORT119CR */
1422
1423 PORTCR(120, 0xe6051078), /* PORT120CR */
1424 PORTCR(121, 0xe6051079), /* PORT121CR */
1425 PORTCR(122, 0xe605107a), /* PORT122CR */
1426 PORTCR(123, 0xe605107b), /* PORT123CR */
1427 PORTCR(124, 0xe605107c), /* PORT124CR */
1428 PORTCR(125, 0xe605107d), /* PORT125CR */
1429 PORTCR(126, 0xe605107e), /* PORT126CR */
1430 PORTCR(127, 0xe605107f), /* PORT127CR */
1431 PORTCR(128, 0xe6051080), /* PORT128CR */
1432 PORTCR(129, 0xe6051081), /* PORT129CR */
1433
1434 PORTCR(130, 0xe6051082), /* PORT130CR */
1435 PORTCR(131, 0xe6051083), /* PORT131CR */
1436 PORTCR(132, 0xe6051084), /* PORT132CR */
1437 PORTCR(133, 0xe6051085), /* PORT133CR */
1438 PORTCR(134, 0xe6051086), /* PORT134CR */
1439 PORTCR(135, 0xe6051087), /* PORT135CR */
1440 PORTCR(136, 0xe6051088), /* PORT136CR */
1441 PORTCR(137, 0xe6051089), /* PORT137CR */
1442 PORTCR(138, 0xe605108a), /* PORT138CR */
1443 PORTCR(139, 0xe605108b), /* PORT139CR */
1444
1445 PORTCR(140, 0xe605108c), /* PORT140CR */
1446 PORTCR(141, 0xe605108d), /* PORT141CR */
1447 PORTCR(142, 0xe605108e), /* PORT142CR */
1448 PORTCR(143, 0xe605108f), /* PORT143CR */
1449 PORTCR(144, 0xe6051090), /* PORT144CR */
1450 PORTCR(145, 0xe6051091), /* PORT145CR */
1451 PORTCR(146, 0xe6051092), /* PORT146CR */
1452 PORTCR(147, 0xe6051093), /* PORT147CR */
1453 PORTCR(148, 0xe6051094), /* PORT148CR */
1454 PORTCR(149, 0xe6051095), /* PORT149CR */
1455
1456 PORTCR(150, 0xe6051096), /* PORT150CR */
1457 PORTCR(151, 0xe6051097), /* PORT151CR */
1458 PORTCR(152, 0xe6051098), /* PORT152CR */
1459 PORTCR(153, 0xe6051099), /* PORT153CR */
1460 PORTCR(154, 0xe605109a), /* PORT154CR */
1461 PORTCR(155, 0xe605109b), /* PORT155CR */
1462 PORTCR(156, 0xe605109c), /* PORT156CR */
1463 PORTCR(157, 0xe605109d), /* PORT157CR */
1464 PORTCR(158, 0xe605109e), /* PORT158CR */
1465 PORTCR(159, 0xe605109f), /* PORT159CR */
1466
1467 PORTCR(160, 0xe60510a0), /* PORT160CR */
1468 PORTCR(161, 0xe60510a1), /* PORT161CR */
1469 PORTCR(162, 0xe60510a2), /* PORT162CR */
1470 PORTCR(163, 0xe60510a3), /* PORT163CR */
1471 PORTCR(164, 0xe60510a4), /* PORT164CR */
1472 PORTCR(165, 0xe60510a5), /* PORT165CR */
1473 PORTCR(166, 0xe60510a6), /* PORT166CR */
1474 PORTCR(167, 0xe60510a7), /* PORT167CR */
1475 PORTCR(168, 0xe60510a8), /* PORT168CR */
1476 PORTCR(169, 0xe60510a9), /* PORT169CR */
1477
1478 PORTCR(170, 0xe60510aa), /* PORT170CR */
1479 PORTCR(171, 0xe60510ab), /* PORT171CR */
1480 PORTCR(172, 0xe60510ac), /* PORT172CR */
1481 PORTCR(173, 0xe60510ad), /* PORT173CR */
1482 PORTCR(174, 0xe60510ae), /* PORT174CR */
1483 PORTCR(175, 0xe60520af), /* PORT175CR */
1484 PORTCR(176, 0xe60520b0), /* PORT176CR */
1485 PORTCR(177, 0xe60520b1), /* PORT177CR */
1486 PORTCR(178, 0xe60520b2), /* PORT178CR */
1487 PORTCR(179, 0xe60520b3), /* PORT179CR */
1488
1489 PORTCR(180, 0xe60520b4), /* PORT180CR */
1490 PORTCR(181, 0xe60520b5), /* PORT181CR */
1491 PORTCR(182, 0xe60520b6), /* PORT182CR */
1492 PORTCR(183, 0xe60520b7), /* PORT183CR */
1493 PORTCR(184, 0xe60520b8), /* PORT184CR */
1494 PORTCR(185, 0xe60520b9), /* PORT185CR */
1495 PORTCR(186, 0xe60520ba), /* PORT186CR */
1496 PORTCR(187, 0xe60520bb), /* PORT187CR */
1497 PORTCR(188, 0xe60520bc), /* PORT188CR */
1498 PORTCR(189, 0xe60520bd), /* PORT189CR */
1499
1500 PORTCR(190, 0xe60520be), /* PORT190CR */
1501 PORTCR(191, 0xe60520bf), /* PORT191CR */
1502 PORTCR(192, 0xe60520c0), /* PORT192CR */
1503 PORTCR(193, 0xe60520c1), /* PORT193CR */
1504 PORTCR(194, 0xe60520c2), /* PORT194CR */
1505 PORTCR(195, 0xe60520c3), /* PORT195CR */
1506 PORTCR(196, 0xe60520c4), /* PORT196CR */
1507 PORTCR(197, 0xe60520c5), /* PORT197CR */
1508 PORTCR(198, 0xe60520c6), /* PORT198CR */
1509 PORTCR(199, 0xe60520c7), /* PORT199CR */
1510
1511 PORTCR(200, 0xe60520c8), /* PORT200CR */
1512 PORTCR(201, 0xe60520c9), /* PORT201CR */
1513 PORTCR(202, 0xe60520ca), /* PORT202CR */
1514 PORTCR(203, 0xe60520cb), /* PORT203CR */
1515 PORTCR(204, 0xe60520cc), /* PORT204CR */
1516 PORTCR(205, 0xe60520cd), /* PORT205CR */
1517 PORTCR(206, 0xe60520ce), /* PORT206CR */
1518 PORTCR(207, 0xe60520cf), /* PORT207CR */
1519 PORTCR(208, 0xe60520d0), /* PORT208CR */
1520 PORTCR(209, 0xe60520d1), /* PORT209CR */
1521
1522 PORTCR(210, 0xe60520d2), /* PORT210CR */
1523 PORTCR(211, 0xe60520d3), /* PORT211CR */
1524 PORTCR(212, 0xe60520d4), /* PORT212CR */
1525 PORTCR(213, 0xe60520d5), /* PORT213CR */
1526 PORTCR(214, 0xe60520d6), /* PORT214CR */
1527 PORTCR(215, 0xe60520d7), /* PORT215CR */
1528 PORTCR(216, 0xe60520d8), /* PORT216CR */
1529 PORTCR(217, 0xe60520d9), /* PORT217CR */
1530 PORTCR(218, 0xe60520da), /* PORT218CR */
1531 PORTCR(219, 0xe60520db), /* PORT219CR */
1532
1533 PORTCR(220, 0xe60520dc), /* PORT220CR */
1534 PORTCR(221, 0xe60520dd), /* PORT221CR */
1535 PORTCR(222, 0xe60520de), /* PORT222CR */
1536 PORTCR(223, 0xe60520df), /* PORT223CR */
1537 PORTCR(224, 0xe60520e0), /* PORT224CR */
1538 PORTCR(225, 0xe60520e1), /* PORT225CR */
1539 PORTCR(226, 0xe60520e2), /* PORT226CR */
1540 PORTCR(227, 0xe60520e3), /* PORT227CR */
1541 PORTCR(228, 0xe60520e4), /* PORT228CR */
1542 PORTCR(229, 0xe60520e5), /* PORT229CR */
1543
1544 PORTCR(230, 0xe60520e6), /* PORT230CR */
1545 PORTCR(231, 0xe60520e7), /* PORT231CR */
1546 PORTCR(232, 0xe60520e8), /* PORT232CR */
1547 PORTCR(233, 0xe60520e9), /* PORT233CR */
1548 PORTCR(234, 0xe60520ea), /* PORT234CR */
1549 PORTCR(235, 0xe60520eb), /* PORT235CR */
1550 PORTCR(236, 0xe60530ec), /* PORT236CR */
1551 PORTCR(237, 0xe60530ed), /* PORT237CR */
1552 PORTCR(238, 0xe60530ee), /* PORT238CR */
1553 PORTCR(239, 0xe60530ef), /* PORT239CR */
1554
1555 PORTCR(240, 0xe60530f0), /* PORT240CR */
1556 PORTCR(241, 0xe60530f1), /* PORT241CR */
1557 PORTCR(242, 0xe60530f2), /* PORT242CR */
1558 PORTCR(243, 0xe60530f3), /* PORT243CR */
1559 PORTCR(244, 0xe60530f4), /* PORT244CR */
1560 PORTCR(245, 0xe60530f5), /* PORT245CR */
1561 PORTCR(246, 0xe60530f6), /* PORT246CR */
1562 PORTCR(247, 0xe60530f7), /* PORT247CR */
1563 PORTCR(248, 0xe60530f8), /* PORT248CR */
1564 PORTCR(249, 0xe60530f9), /* PORT249CR */
1565
1566 PORTCR(250, 0xe60530fa), /* PORT250CR */
1567 PORTCR(251, 0xe60530fb), /* PORT251CR */
1568 PORTCR(252, 0xe60530fc), /* PORT252CR */
1569 PORTCR(253, 0xe60530fd), /* PORT253CR */
1570 PORTCR(254, 0xe60530fe), /* PORT254CR */
1571 PORTCR(255, 0xe60530ff), /* PORT255CR */
1572 PORTCR(256, 0xe6053100), /* PORT256CR */
1573 PORTCR(257, 0xe6053101), /* PORT257CR */
1574 PORTCR(258, 0xe6053102), /* PORT258CR */
1575 PORTCR(259, 0xe6053103), /* PORT259CR */
1576
1577 PORTCR(260, 0xe6053104), /* PORT260CR */
1578 PORTCR(261, 0xe6053105), /* PORT261CR */
1579 PORTCR(262, 0xe6053106), /* PORT262CR */
1580 PORTCR(263, 0xe6053107), /* PORT263CR */
1581 PORTCR(264, 0xe6053108), /* PORT264CR */
1582 PORTCR(265, 0xe6053109), /* PORT265CR */
1583 PORTCR(266, 0xe605310a), /* PORT266CR */
1584 PORTCR(267, 0xe605310b), /* PORT267CR */
1585 PORTCR(268, 0xe605310c), /* PORT268CR */
1586 PORTCR(269, 0xe605310d), /* PORT269CR */
1587
1588 PORTCR(270, 0xe605310e), /* PORT270CR */
1589 PORTCR(271, 0xe605310f), /* PORT271CR */
1590 PORTCR(272, 0xe6053110), /* PORT272CR */
1591
1592 { PINMUX_CFG_REG("MSELBCR", 0xe6058024, 32, 1) {
1593 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1594 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1596 0, 0,
1597 0, 0,
1598 0, 0,
1599 0, 0,
1600 0, 0,
1601 MSELBCR_MSEL2_0, MSELBCR_MSEL2_1,
1602 0, 0,
1603 0, 0 }
1604 },
1605 { },
1606};
1607
1608static struct pinmux_data_reg pinmux_data_regs[] = {
1609 { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054000, 32) {
1610 PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA,
1611 PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA,
1612 PORT23_DATA, PORT22_DATA, PORT21_DATA, PORT20_DATA,
1613 PORT19_DATA, PORT18_DATA, PORT17_DATA, PORT16_DATA,
1614 PORT15_DATA, PORT14_DATA, PORT13_DATA, PORT12_DATA,
1615 PORT11_DATA, PORT10_DATA, PORT9_DATA, PORT8_DATA,
1616 PORT7_DATA, PORT6_DATA, PORT5_DATA, PORT4_DATA,
1617 PORT3_DATA, PORT2_DATA, PORT1_DATA, PORT0_DATA }
1618 },
1619 { PINMUX_DATA_REG("PORTL063_032DR", 0xe6054004, 32) {
1620 PORT63_DATA, PORT62_DATA, PORT61_DATA, PORT60_DATA,
1621 PORT59_DATA, PORT58_DATA, PORT57_DATA, PORT56_DATA,
1622 PORT55_DATA, PORT54_DATA, PORT53_DATA, PORT52_DATA,
1623 PORT51_DATA, PORT50_DATA, PORT49_DATA, PORT48_DATA,
1624 PORT47_DATA, PORT46_DATA, PORT45_DATA, PORT44_DATA,
1625 PORT43_DATA, PORT42_DATA, PORT41_DATA, PORT40_DATA,
1626 PORT39_DATA, PORT38_DATA, PORT37_DATA, PORT36_DATA,
1627 PORT35_DATA, PORT34_DATA, PORT33_DATA, PORT32_DATA }
1628 },
1629 { PINMUX_DATA_REG("PORTL095_064DR", 0xe6054008, 32) {
1630 PORT95_DATA, PORT94_DATA, PORT93_DATA, PORT92_DATA,
1631 PORT91_DATA, PORT90_DATA, PORT89_DATA, PORT88_DATA,
1632 PORT87_DATA, PORT86_DATA, PORT85_DATA, PORT84_DATA,
1633 PORT83_DATA, PORT82_DATA, PORT81_DATA, PORT80_DATA,
1634 PORT79_DATA, PORT78_DATA, PORT77_DATA, PORT76_DATA,
1635 PORT75_DATA, PORT74_DATA, PORT73_DATA, PORT72_DATA,
1636 PORT71_DATA, PORT70_DATA, PORT69_DATA, PORT68_DATA,
1637 PORT67_DATA, PORT66_DATA, PORT65_DATA, PORT64_DATA }
1638 },
1639 { PINMUX_DATA_REG("PORTD127_096DR", 0xe6055004, 32) {
1640 PORT127_DATA, PORT126_DATA, PORT125_DATA, PORT124_DATA,
1641 PORT123_DATA, PORT122_DATA, PORT121_DATA, PORT120_DATA,
1642 PORT119_DATA, PORT118_DATA, PORT117_DATA, PORT116_DATA,
1643 PORT115_DATA, PORT114_DATA, PORT113_DATA, PORT112_DATA,
1644 PORT111_DATA, PORT110_DATA, PORT109_DATA, PORT108_DATA,
1645 PORT107_DATA, PORT106_DATA, PORT105_DATA, PORT104_DATA,
1646 PORT103_DATA, PORT102_DATA, PORT101_DATA, PORT100_DATA,
1647 PORT99_DATA, PORT98_DATA, PORT97_DATA, PORT96_DATA }
1648 },
1649 { PINMUX_DATA_REG("PORTD159_128DR", 0xe6055008, 32) {
1650 PORT159_DATA, PORT158_DATA, PORT157_DATA, PORT156_DATA,
1651 PORT155_DATA, PORT154_DATA, PORT153_DATA, PORT152_DATA,
1652 PORT151_DATA, PORT150_DATA, PORT149_DATA, PORT148_DATA,
1653 PORT147_DATA, PORT146_DATA, PORT145_DATA, PORT144_DATA,
1654 PORT143_DATA, PORT142_DATA, PORT141_DATA, PORT140_DATA,
1655 PORT139_DATA, PORT138_DATA, PORT137_DATA, PORT136_DATA,
1656 PORT135_DATA, PORT134_DATA, PORT133_DATA, PORT132_DATA,
1657 PORT131_DATA, PORT130_DATA, PORT129_DATA, PORT128_DATA }
1658 },
1659 { PINMUX_DATA_REG("PORTR191_160DR", 0xe6056000, 32) {
1660 PORT191_DATA, PORT190_DATA, PORT189_DATA, PORT188_DATA,
1661 PORT187_DATA, PORT186_DATA, PORT185_DATA, PORT184_DATA,
1662 PORT183_DATA, PORT182_DATA, PORT181_DATA, PORT180_DATA,
1663 PORT179_DATA, PORT178_DATA, PORT177_DATA, PORT176_DATA,
1664 PORT175_DATA, PORT174_DATA, PORT173_DATA, PORT172_DATA,
1665 PORT171_DATA, PORT170_DATA, PORT169_DATA, PORT168_DATA,
1666 PORT167_DATA, PORT166_DATA, PORT165_DATA, PORT164_DATA,
1667 PORT163_DATA, PORT162_DATA, PORT161_DATA, PORT160_DATA }
1668 },
1669 { PINMUX_DATA_REG("PORTR223_192DR", 0xe6056004, 32) {
1670 PORT223_DATA, PORT222_DATA, PORT221_DATA, PORT220_DATA,
1671 PORT219_DATA, PORT218_DATA, PORT217_DATA, PORT216_DATA,
1672 PORT215_DATA, PORT214_DATA, PORT213_DATA, PORT212_DATA,
1673 PORT211_DATA, PORT210_DATA, PORT209_DATA, PORT208_DATA,
1674 PORT207_DATA, PORT206_DATA, PORT205_DATA, PORT204_DATA,
1675 PORT203_DATA, PORT202_DATA, PORT201_DATA, PORT200_DATA,
1676 PORT199_DATA, PORT198_DATA, PORT197_DATA, PORT196_DATA,
1677 PORT195_DATA, PORT194_DATA, PORT193_DATA, PORT192_DATA }
1678 },
1679 { PINMUX_DATA_REG("PORTU255_224DR", 0xe6057000, 32) {
1680 PORT255_DATA, PORT254_DATA, PORT253_DATA, PORT252_DATA,
1681 PORT251_DATA, PORT250_DATA, PORT249_DATA, PORT248_DATA,
1682 PORT247_DATA, PORT246_DATA, PORT245_DATA, PORT244_DATA,
1683 PORT243_DATA, PORT242_DATA, PORT241_DATA, PORT240_DATA,
1684 PORT239_DATA, PORT238_DATA, PORT237_DATA, PORT236_DATA,
1685 PORT235_DATA, PORT234_DATA, PORT233_DATA, PORT232_DATA,
1686 PORT231_DATA, PORT230_DATA, PORT229_DATA, PORT228_DATA,
1687 PORT227_DATA, PORT226_DATA, PORT225_DATA, PORT224_DATA }
1688 },
1689 { PINMUX_DATA_REG("PORTU287_256DR", 0xe6057004, 32) {
1690 0, 0, 0, 0,
1691 0, 0, 0, 0,
1692 0, 0, 0, 0,
1693 0, 0, 0, PORT272_DATA,
1694 PORT271_DATA, PORT270_DATA, PORT269_DATA, PORT268_DATA,
1695 PORT267_DATA, PORT266_DATA, PORT265_DATA, PORT264_DATA,
1696 PORT263_DATA, PORT262_DATA, PORT261_DATA, PORT260_DATA,
1697 PORT259_DATA, PORT258_DATA, PORT257_DATA, PORT256_DATA }
1698 },
1699 { },
1700};
1701
1702static struct pinmux_info sh7367_pinmux_info = {
1703 .name = "sh7367_pfc",
1704 .reserved_id = PINMUX_RESERVED,
1705 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1706 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1707 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1708 .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_END },
1709 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1710 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1711 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1712
1713 .first_gpio = GPIO_PORT0,
1714 .last_gpio = GPIO_FN_DIVLOCK,
1715
1716 .gpios = pinmux_gpios,
1717 .cfg_regs = pinmux_config_regs,
1718 .data_regs = pinmux_data_regs,
1719
1720 .gpio_data = pinmux_data,
1721 .gpio_data_size = ARRAY_SIZE(pinmux_data),
1722};
1723
1724void sh7367_pinmux_init(void)
1725{
1726 register_pinmux(&sh7367_pinmux_info);
1727}
diff --git a/arch/arm/mach-shmobile/pfc-sh7377.c b/arch/arm/mach-shmobile/pfc-sh7377.c
deleted file mode 100644
index f3117f67fa2..00000000000
--- a/arch/arm/mach-shmobile/pfc-sh7377.c
+++ /dev/null
@@ -1,1688 +0,0 @@
1/*
2 * sh7377 processor support - PFC hardware block
3 *
4 * Copyright (C) 2010 NISHIMOTO Hiroki
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of the
9 * License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/sh_pfc.h>
23#include <mach/sh7377.h>
24
25#define CPU_ALL_PORT(fn, pfx, sfx) \
26 PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
27 PORT_10(fn, pfx##10, sfx), \
28 PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \
29 PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \
30 PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \
31 PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \
32 PORT_1(fn, pfx##118, sfx), \
33 PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \
34 PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \
35 PORT_10(fn, pfx##15, sfx), \
36 PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \
37 PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \
38 PORT_1(fn, pfx##164, sfx), \
39 PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \
40 PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \
41 PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \
42 PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \
43 PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
44 PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
45 PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
46 PORT_1(fn, pfx##260, sfx), PORT_1(fn, pfx##261, sfx), \
47 PORT_1(fn, pfx##262, sfx), PORT_1(fn, pfx##263, sfx), \
48 PORT_1(fn, pfx##264, sfx)
49
50enum {
51 PINMUX_RESERVED = 0,
52
53 PINMUX_DATA_BEGIN,
54 PORT_ALL(DATA), /* PORT0_DATA -> PORT264_DATA */
55 PINMUX_DATA_END,
56
57 PINMUX_INPUT_BEGIN,
58 PORT_ALL(IN), /* PORT0_IN -> PORT264_IN */
59 PINMUX_INPUT_END,
60
61 PINMUX_INPUT_PULLUP_BEGIN,
62 PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT264_IN_PU */
63 PINMUX_INPUT_PULLUP_END,
64
65 PINMUX_INPUT_PULLDOWN_BEGIN,
66 PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT264_IN_PD */
67 PINMUX_INPUT_PULLDOWN_END,
68
69 PINMUX_OUTPUT_BEGIN,
70 PORT_ALL(OUT), /* PORT0_OUT -> PORT264_OUT */
71 PINMUX_OUTPUT_END,
72
73 PINMUX_FUNCTION_BEGIN,
74 PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT264_FN_IN */
75 PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT264_FN_OUT */
76 PORT_ALL(FN0), /* PORT0_FN0 -> PORT264_FN0 */
77 PORT_ALL(FN1), /* PORT0_FN1 -> PORT264_FN1 */
78 PORT_ALL(FN2), /* PORT0_FN2 -> PORT264_FN2 */
79 PORT_ALL(FN3), /* PORT0_FN3 -> PORT264_FN3 */
80 PORT_ALL(FN4), /* PORT0_FN4 -> PORT264_FN4 */
81 PORT_ALL(FN5), /* PORT0_FN5 -> PORT264_FN5 */
82 PORT_ALL(FN6), /* PORT0_FN6 -> PORT264_FN6 */
83 PORT_ALL(FN7), /* PORT0_FN7 -> PORT264_FN7 */
84
85 MSELBCR_MSEL17_1, MSELBCR_MSEL17_0,
86 MSELBCR_MSEL16_1, MSELBCR_MSEL16_0,
87 PINMUX_FUNCTION_END,
88
89 PINMUX_MARK_BEGIN,
90 /* Special Pull-up / Pull-down Functions */
91 PORT66_KEYIN0_PU_MARK, PORT67_KEYIN1_PU_MARK,
92 PORT68_KEYIN2_PU_MARK, PORT69_KEYIN3_PU_MARK,
93 PORT70_KEYIN4_PU_MARK, PORT71_KEYIN5_PU_MARK,
94 PORT72_KEYIN6_PU_MARK,
95
96 /* 55-1 */
97 VBUS_0_MARK,
98 CPORT0_MARK,
99 CPORT1_MARK,
100 CPORT2_MARK,
101 CPORT3_MARK,
102 CPORT4_MARK,
103 CPORT5_MARK,
104 CPORT6_MARK,
105 CPORT7_MARK,
106 CPORT8_MARK,
107 CPORT9_MARK,
108 CPORT10_MARK,
109 CPORT11_MARK, SIN2_MARK,
110 CPORT12_MARK, XCTS2_MARK,
111 CPORT13_MARK, RFSPO4_MARK,
112 CPORT14_MARK, RFSPO5_MARK,
113 CPORT15_MARK, SCIFA0_SCK_MARK, GPS_AGC2_MARK,
114 CPORT16_MARK, SCIFA0_TXD_MARK, GPS_AGC3_MARK,
115 CPORT17_IC_OE_MARK, SOUT2_MARK,
116 CPORT18_MARK, XRTS2_MARK, PORT19_VIO_CKO2_MARK,
117 CPORT19_MPORT1_MARK,
118 CPORT20_MARK, RFSPO6_MARK,
119 CPORT21_MARK, STATUS0_MARK,
120 CPORT22_MARK, STATUS1_MARK,
121 CPORT23_MARK, STATUS2_MARK, RFSPO7_MARK,
122 B_SYNLD1_MARK,
123 B_SYNLD2_MARK, SYSENMSK_MARK,
124 XMAINPS_MARK,
125 XDIVPS_MARK,
126 XIDRST_MARK,
127 IDCLK_MARK, IC_DP_MARK,
128 IDIO_MARK, IC_DM_MARK,
129 SOUT1_MARK, SCIFA4_TXD_MARK, M02_BERDAT_MARK,
130 SIN1_MARK, SCIFA4_RXD_MARK, XWUP_MARK,
131 XRTS1_MARK, SCIFA4_RTS_MARK, M03_BERCLK_MARK,
132 XCTS1_MARK, SCIFA4_CTS_MARK,
133 PCMCLKO_MARK,
134 SYNC8KO_MARK,
135
136 /* 55-2 */
137 DNPCM_A_MARK,
138 UPPCM_A_MARK,
139 VACK_MARK,
140 XTALB1L_MARK,
141 GPS_AGC1_MARK, SCIFA0_RTS_MARK,
142 GPS_AGC4_MARK, SCIFA0_RXD_MARK,
143 GPS_PWRDOWN_MARK, SCIFA0_CTS_MARK,
144 GPS_IM_MARK,
145 GPS_IS_MARK,
146 GPS_QM_MARK,
147 GPS_QS_MARK,
148 FMSOCK_MARK, PORT49_IRDA_OUT_MARK, PORT49_IROUT_MARK,
149 FMSOOLR_MARK, BBIF2_TSYNC2_MARK, TPU2TO2_MARK, IPORT3_MARK,
150 FMSIOLR_MARK,
151 FMSOOBT_MARK, BBIF2_TSCK2_MARK, TPU2TO3_MARK, OPORT1_MARK,
152 FMSIOBT_MARK,
153 FMSOSLD_MARK, BBIF2_TXD2_MARK, OPORT2_MARK,
154 FMSOILR_MARK, PORT53_IRDA_IN_MARK, TPU3TO3_MARK, OPORT3_MARK,
155 FMSIILR_MARK,
156 FMSOIBT_MARK, PORT54_IRDA_FIRSEL_MARK, TPU3TO2_MARK, FMSIIBT_MARK,
157 FMSISLD_MARK, MFG0_OUT1_MARK, TPU0TO0_MARK,
158 A0_EA0_MARK, BS_MARK,
159 A12_EA12_MARK, PORT58_VIO_CKOR_MARK, TPU4TO2_MARK,
160 A13_EA13_MARK, PORT59_IROUT_MARK, MFG0_OUT2_MARK, TPU0TO1_MARK,
161 A14_EA14_MARK, PORT60_KEYOUT5_MARK,
162 A15_EA15_MARK, PORT61_KEYOUT4_MARK,
163 A16_EA16_MARK, PORT62_KEYOUT3_MARK, MSIOF0_SS1_MARK,
164 A17_EA17_MARK, PORT63_KEYOUT2_MARK, MSIOF0_TSYNC_MARK,
165 A18_EA18_MARK, PORT64_KEYOUT1_MARK, MSIOF0_TSCK_MARK,
166 A19_EA19_MARK, PORT65_KEYOUT0_MARK, MSIOF0_TXD_MARK,
167 A20_EA20_MARK, PORT66_KEYIN0_MARK, MSIOF0_RSCK_MARK,
168 A21_EA21_MARK, PORT67_KEYIN1_MARK, MSIOF0_RSYNC_MARK,
169 A22_EA22_MARK, PORT68_KEYIN2_MARK, MSIOF0_MCK0_MARK,
170 A23_EA23_MARK, PORT69_KEYIN3_MARK, MSIOF0_MCK1_MARK,
171 A24_EA24_MARK, PORT70_KEYIN4_MARK, MSIOF0_RXD_MARK,
172 A25_EA25_MARK, PORT71_KEYIN5_MARK, MSIOF0_SS2_MARK,
173 A26_MARK, PORT72_KEYIN6_MARK,
174 D0_ED0_NAF0_MARK,
175 D1_ED1_NAF1_MARK,
176 D2_ED2_NAF2_MARK,
177 D3_ED3_NAF3_MARK,
178 D4_ED4_NAF4_MARK,
179 D5_ED5_NAF5_MARK,
180 D6_ED6_NAF6_MARK,
181 D7_ED7_NAF7_MARK,
182 D8_ED8_NAF8_MARK,
183 D9_ED9_NAF9_MARK,
184 D10_ED10_NAF10_MARK,
185 D11_ED11_NAF11_MARK,
186 D12_ED12_NAF12_MARK,
187 D13_ED13_NAF13_MARK,
188 D14_ED14_NAF14_MARK,
189 D15_ED15_NAF15_MARK,
190 CS4_MARK,
191 CS5A_MARK, FMSICK_MARK,
192 CS5B_MARK, FCE1_MARK,
193
194 /* 55-3 */
195 CS6B_MARK, XCS2_MARK, CS6A_MARK, DACK0_MARK,
196 FCE0_MARK,
197 WAIT_MARK, DREQ0_MARK,
198 RD_XRD_MARK,
199 WE0_XWR0_FWE_MARK,
200 WE1_XWR1_MARK,
201 FRB_MARK,
202 CKO_MARK,
203 NBRSTOUT_MARK,
204 NBRST_MARK,
205 GPS_EPPSIN_MARK,
206 LATCHPULSE_MARK,
207 LTESIGNAL_MARK,
208 LEGACYSTATE_MARK,
209 TCKON_MARK,
210 VIO_VD_MARK, PORT128_KEYOUT0_MARK, IPORT0_MARK,
211 VIO_HD_MARK, PORT129_KEYOUT1_MARK, IPORT1_MARK,
212 VIO_D0_MARK, PORT130_KEYOUT2_MARK, PORT130_MSIOF2_RXD_MARK,
213 VIO_D1_MARK, PORT131_KEYOUT3_MARK, PORT131_MSIOF2_SS1_MARK,
214 VIO_D2_MARK, PORT132_KEYOUT4_MARK, PORT132_MSIOF2_SS2_MARK,
215 VIO_D3_MARK, PORT133_KEYOUT5_MARK, PORT133_MSIOF2_TSYNC_MARK,
216 VIO_D4_MARK, PORT134_KEYIN0_MARK, PORT134_MSIOF2_TXD_MARK,
217 VIO_D5_MARK, PORT135_KEYIN1_MARK, PORT135_MSIOF2_TSCK_MARK,
218 VIO_D6_MARK, PORT136_KEYIN2_MARK,
219 VIO_D7_MARK, PORT137_KEYIN3_MARK,
220 VIO_D8_MARK, M9_SLCD_A01_MARK, PORT138_FSIAOMC_MARK,
221 VIO_D9_MARK, M10_SLCD_CK1_MARK, PORT139_FSIAOLR_MARK,
222 VIO_D10_MARK, M11_SLCD_SO1_MARK, TPU0TO2_MARK, PORT140_FSIAOBT_MARK,
223 VIO_D11_MARK, M12_SLCD_CE1_MARK, TPU0TO3_MARK, PORT141_FSIAOSLD_MARK,
224 VIO_D12_MARK, M13_BSW_MARK, PORT142_FSIACK_MARK,
225 VIO_D13_MARK, M14_GSW_MARK, PORT143_FSIAILR_MARK,
226 VIO_D14_MARK, M15_RSW_MARK, PORT144_FSIAIBT_MARK,
227 VIO_D15_MARK, TPU1TO3_MARK, PORT145_FSIAISLD_MARK,
228 VIO_CLK_MARK, PORT146_KEYIN4_MARK, IPORT2_MARK,
229 VIO_FIELD_MARK, PORT147_KEYIN5_MARK,
230 VIO_CKO_MARK, PORT148_KEYIN6_MARK,
231 A27_MARK, RDWR_XWE_MARK, MFG0_IN1_MARK,
232 MFG0_IN2_MARK,
233 TS_SPSYNC3_MARK, MSIOF2_RSCK_MARK,
234 TS_SDAT3_MARK, MSIOF2_RSYNC_MARK,
235 TPU1TO2_MARK, TS_SDEN3_MARK, PORT153_MSIOF2_SS1_MARK,
236 SOUT3_MARK, SCIFA2_TXD1_MARK, MSIOF2_MCK0_MARK,
237 SIN3_MARK, SCIFA2_RXD1_MARK, MSIOF2_MCK1_MARK,
238 XRTS3_MARK, SCIFA2_RTS1_MARK, PORT156_MSIOF2_SS2_MARK,
239 XCTS3_MARK, SCIFA2_CTS1_MARK, PORT157_MSIOF2_RXD_MARK,
240
241 /* 55-4 */
242 DINT_MARK, SCIFA2_SCK1_MARK, TS_SCK3_MARK,
243 PORT159_SCIFB_SCK_MARK, PORT159_SCIFA5_SCK_MARK, NMI_MARK,
244 PORT160_SCIFB_TXD_MARK, PORT160_SCIFA5_TXD_MARK, SOUT0_MARK,
245 PORT161_SCIFB_CTS_MARK, PORT161_SCIFA5_CTS_MARK, XCTS0_MARK,
246 MFG3_IN2_MARK,
247 PORT162_SCIFB_RXD_MARK, PORT162_SCIFA5_RXD_MARK, SIN0_MARK,
248 MFG3_IN1_MARK,
249 PORT163_SCIFB_RTS_MARK, PORT163_SCIFA5_RTS_MARK, XRTS0_MARK,
250 MFG3_OUT1_MARK, TPU3TO0_MARK,
251 LCDD0_MARK, PORT192_KEYOUT0_MARK, EXT_CKI_MARK,
252 LCDD1_MARK, PORT193_KEYOUT1_MARK, PORT193_SCIFA5_CTS_MARK,
253 BBIF2_TSYNC1_MARK,
254 LCDD2_MARK, PORT194_KEYOUT2_MARK, PORT194_SCIFA5_RTS_MARK,
255 BBIF2_TSCK1_MARK,
256 LCDD3_MARK, PORT195_KEYOUT3_MARK, PORT195_SCIFA5_RXD_MARK,
257 BBIF2_TXD1_MARK,
258 LCDD4_MARK, PORT196_KEYOUT4_MARK, PORT196_SCIFA5_TXD_MARK,
259 LCDD5_MARK, PORT197_KEYOUT5_MARK, PORT197_SCIFA5_SCK_MARK,
260 MFG2_OUT2_MARK,
261 TPU2TO1_MARK,
262 LCDD6_MARK, XWR2_MARK,
263 LCDD7_MARK, TPU4TO1_MARK, MFG4_OUT2_MARK, XWR3_MARK,
264 LCDD8_MARK, PORT200_KEYIN0_MARK, VIO_DR0_MARK, D16_MARK, ED16_MARK,
265 LCDD9_MARK, PORT201_KEYIN1_MARK, VIO_DR1_MARK, D17_MARK, ED17_MARK,
266 LCDD10_MARK, PORT202_KEYIN2_MARK, VIO_DR2_MARK, D18_MARK, ED18_MARK,
267 LCDD11_MARK, PORT203_KEYIN3_MARK, VIO_DR3_MARK, D19_MARK, ED19_MARK,
268 LCDD12_MARK, PORT204_KEYIN4_MARK, VIO_DR4_MARK, D20_MARK, ED20_MARK,
269 LCDD13_MARK, PORT205_KEYIN5_MARK, VIO_DR5_MARK, D21_MARK, ED21_MARK,
270 LCDD14_MARK, PORT206_KEYIN6_MARK, VIO_DR6_MARK, D22_MARK, ED22_MARK,
271 LCDD15_MARK, PORT207_MSIOF0L_SS1_MARK, PORT207_KEYOUT0_MARK,
272 VIO_DR7_MARK, D23_MARK, ED23_MARK,
273 LCDD16_MARK, PORT208_MSIOF0L_SS2_MARK, PORT208_KEYOUT1_MARK,
274 VIO_VDR_MARK, D24_MARK, ED24_MARK,
275 LCDD17_MARK, PORT209_KEYOUT2_MARK, VIO_HDR_MARK, D25_MARK, ED25_MARK,
276 LCDD18_MARK, DREQ2_MARK, PORT210_MSIOF0L_SS1_MARK, D26_MARK, ED26_MARK,
277 LCDD19_MARK, PORT211_MSIOF0L_SS2_MARK, D27_MARK, ED27_MARK,
278 LCDD20_MARK, TS_SPSYNC1_MARK, MSIOF0L_MCK0_MARK, D28_MARK, ED28_MARK,
279 LCDD21_MARK, TS_SDAT1_MARK, MSIOF0L_MCK1_MARK, D29_MARK, ED29_MARK,
280 LCDD22_MARK, TS_SDEN1_MARK, MSIOF0L_RSCK_MARK, D30_MARK, ED30_MARK,
281 LCDD23_MARK, TS_SCK1_MARK, MSIOF0L_RSYNC_MARK, D31_MARK, ED31_MARK,
282 LCDDCK_MARK, LCDWR_MARK, PORT216_KEYOUT3_MARK, VIO_CLKR_MARK,
283 LCDRD_MARK, DACK2_MARK, MSIOF0L_TSYNC_MARK,
284 LCDHSYN_MARK, LCDCS_MARK, LCDCS2_MARK, DACK3_MARK,
285 PORT218_VIO_CKOR_MARK, PORT218_KEYOUT4_MARK,
286 LCDDISP_MARK, LCDRS_MARK, DREQ3_MARK, MSIOF0L_TSCK_MARK,
287 LCDVSYN_MARK, LCDVSYN2_MARK, PORT220_KEYOUT5_MARK,
288 LCDLCLK_MARK, DREQ1_MARK, PWEN_MARK, MSIOF0L_RXD_MARK,
289 LCDDON_MARK, LCDDON2_MARK, DACK1_MARK, OVCN_MARK, MSIOF0L_TXD_MARK,
290 SCIFA1_TXD_MARK, OVCN2_MARK,
291 EXTLP_MARK, SCIFA1_SCK_MARK, USBTERM_MARK, PORT226_VIO_CKO2_MARK,
292 SCIFA1_RTS_MARK, IDIN_MARK,
293 SCIFA1_RXD_MARK,
294 SCIFA1_CTS_MARK, MFG1_IN1_MARK,
295 MSIOF1_TXD_MARK, SCIFA2_TXD2_MARK, PORT230_FSIAOMC_MARK,
296 MSIOF1_TSYNC_MARK, SCIFA2_CTS2_MARK, PORT231_FSIAOLR_MARK,
297 MSIOF1_TSCK_MARK, SCIFA2_SCK2_MARK, PORT232_FSIAOBT_MARK,
298 MSIOF1_RXD_MARK, SCIFA2_RXD2_MARK, GPS_VCOTRIG_MARK,
299 PORT233_FSIACK_MARK,
300 MSIOF1_RSCK_MARK, SCIFA2_RTS2_MARK, PORT234_FSIAOSLD_MARK,
301 MSIOF1_RSYNC_MARK, OPORT0_MARK, MFG1_IN2_MARK, PORT235_FSIAILR_MARK,
302 MSIOF1_MCK0_MARK, I2C_SDA2_MARK, PORT236_FSIAIBT_MARK,
303 MSIOF1_MCK1_MARK, I2C_SCL2_MARK, PORT237_FSIAISLD_MARK,
304 MSIOF1_SS1_MARK, EDBGREQ3_MARK,
305
306 /* 55-5 */
307 MSIOF1_SS2_MARK,
308 SCIFA6_TXD_MARK,
309 PORT241_IRDA_OUT_MARK, PORT241_IROUT_MARK, MFG4_OUT1_MARK,
310 TPU4TO0_MARK,
311 PORT242_IRDA_IN_MARK, MFG4_IN2_MARK,
312 PORT243_IRDA_FIRSEL_MARK, PORT243_VIO_CKO2_MARK,
313 PORT244_SCIFA5_CTS_MARK, MFG2_IN1_MARK, PORT244_SCIFB_CTS_MARK,
314 PORT244_MSIOF2_RXD_MARK,
315 PORT245_SCIFA5_RTS_MARK, MFG2_IN2_MARK, PORT245_SCIFB_RTS_MARK,
316 PORT245_MSIOF2_TXD_MARK,
317 PORT246_SCIFA5_RXD_MARK, MFG1_OUT1_MARK, PORT246_SCIFB_RXD_MARK,
318 TPU1TO0_MARK,
319 PORT247_SCIFA5_TXD_MARK, MFG3_OUT2_MARK, PORT247_SCIFB_TXD_MARK,
320 TPU3TO1_MARK,
321 PORT248_SCIFA5_SCK_MARK, MFG2_OUT1_MARK, PORT248_SCIFB_SCK_MARK,
322 TPU2TO0_MARK,
323 PORT248_MSIOF2_TSCK_MARK,
324 PORT249_IROUT_MARK, MFG4_IN1_MARK, PORT249_MSIOF2_TSYNC_MARK,
325 SDHICLK0_MARK, TCK2_SWCLK_MC0_MARK,
326 SDHICD0_MARK,
327 SDHID0_0_MARK, TMS2_SWDIO_MC0_MARK,
328 SDHID0_1_MARK, TDO2_SWO0_MC0_MARK,
329 SDHID0_2_MARK, TDI2_MARK,
330 SDHID0_3_MARK, RTCK2_SWO1_MC0_MARK,
331 SDHICMD0_MARK, TRST2_MARK,
332 SDHIWP0_MARK, EDBGREQ2_MARK,
333 SDHICLK1_MARK, TCK3_SWCLK_MC1_MARK,
334 SDHID1_0_MARK, M11_SLCD_SO2_MARK, TS_SPSYNC2_MARK,
335 TMS3_SWDIO_MC1_MARK,
336 SDHID1_1_MARK, M9_SLCD_A02_MARK, TS_SDAT2_MARK, TDO3_SWO0_MC1_MARK,
337 SDHID1_2_MARK, M10_SLCD_CK2_MARK, TS_SDEN2_MARK, TDI3_MARK,
338 SDHID1_3_MARK, M12_SLCD_CE2_MARK, TS_SCK2_MARK, RTCK3_SWO1_MC1_MARK,
339 SDHICMD1_MARK, TRST3_MARK,
340 RESETOUTS_MARK,
341 PINMUX_MARK_END,
342};
343
344static pinmux_enum_t pinmux_data[] = {
345 /* specify valid pin states for each pin in GPIO mode */
346 /* 55-1 (GPIO) */
347 PORT_DATA_I_PD(0), PORT_DATA_I_PU(1),
348 PORT_DATA_I_PU(2), PORT_DATA_I_PU(3),
349 PORT_DATA_I_PU(4), PORT_DATA_I_PU(5),
350 PORT_DATA_I_PU(6), PORT_DATA_I_PU(7),
351 PORT_DATA_I_PU(8), PORT_DATA_I_PU(9),
352 PORT_DATA_I_PU(10), PORT_DATA_I_PU(11),
353 PORT_DATA_IO_PU(12), PORT_DATA_IO_PU(13),
354 PORT_DATA_IO_PU_PD(14), PORT_DATA_IO_PU_PD(15),
355 PORT_DATA_O(16), PORT_DATA_IO(17),
356 PORT_DATA_O(18), PORT_DATA_O(19),
357 PORT_DATA_O(20), PORT_DATA_O(21),
358 PORT_DATA_O(22), PORT_DATA_O(23),
359 PORT_DATA_O(24), PORT_DATA_I_PD(25),
360 PORT_DATA_I_PD(26), PORT_DATA_O(27),
361 PORT_DATA_O(28), PORT_DATA_O(29),
362 PORT_DATA_IO(30), PORT_DATA_IO_PU(31),
363 PORT_DATA_IO_PD(32), PORT_DATA_I_PU(33),
364 PORT_DATA_IO_PD(34), PORT_DATA_I_PU_PD(35),
365 PORT_DATA_O(36), PORT_DATA_IO(37),
366
367 /* 55-2 (GPIO) */
368 PORT_DATA_O(38), PORT_DATA_I_PU(39),
369 PORT_DATA_I_PU_PD(40), PORT_DATA_O(41),
370 PORT_DATA_IO_PD(42), PORT_DATA_IO_PD(43),
371 PORT_DATA_IO_PD(44), PORT_DATA_I_PD(45),
372 PORT_DATA_I_PD(46), PORT_DATA_I_PD(47),
373 PORT_DATA_I_PD(48), PORT_DATA_IO_PU_PD(49),
374 PORT_DATA_IO_PD(50), PORT_DATA_IO_PD(51),
375 PORT_DATA_O(52), PORT_DATA_IO_PU_PD(53),
376 PORT_DATA_IO_PU_PD(54), PORT_DATA_IO_PD(55),
377 PORT_DATA_I_PU_PD(56), PORT_DATA_IO(57),
378 PORT_DATA_IO(58), PORT_DATA_IO(59),
379 PORT_DATA_IO(60), PORT_DATA_IO(61),
380 PORT_DATA_IO_PD(62), PORT_DATA_IO_PD(63),
381 PORT_DATA_IO_PD(64), PORT_DATA_IO_PD(65),
382 PORT_DATA_IO_PU_PD(66), PORT_DATA_IO_PU_PD(67),
383 PORT_DATA_IO_PU_PD(68), PORT_DATA_IO_PU_PD(69),
384 PORT_DATA_IO_PU_PD(70), PORT_DATA_IO_PU_PD(71),
385 PORT_DATA_IO_PU_PD(72), PORT_DATA_I_PU_PD(73),
386 PORT_DATA_IO_PU(74), PORT_DATA_IO_PU(75),
387 PORT_DATA_IO_PU(76), PORT_DATA_IO_PU(77),
388 PORT_DATA_IO_PU(78), PORT_DATA_IO_PU(79),
389 PORT_DATA_IO_PU(80), PORT_DATA_IO_PU(81),
390 PORT_DATA_IO_PU(82), PORT_DATA_IO_PU(83),
391 PORT_DATA_IO_PU(84), PORT_DATA_IO_PU(85),
392 PORT_DATA_IO_PU(86), PORT_DATA_IO_PU(87),
393 PORT_DATA_IO_PU(88), PORT_DATA_IO_PU(89),
394 PORT_DATA_O(90), PORT_DATA_IO_PU(91),
395 PORT_DATA_O(92),
396
397 /* 55-3 (GPIO) */
398 PORT_DATA_IO_PU(93),
399 PORT_DATA_O(94),
400 PORT_DATA_I_PU_PD(95),
401 PORT_DATA_IO(96), PORT_DATA_IO(97),
402 PORT_DATA_IO(98), PORT_DATA_I_PU(99),
403 PORT_DATA_O(100), PORT_DATA_O(101),
404 PORT_DATA_I_PU(102), PORT_DATA_IO_PD(103),
405 PORT_DATA_I_PD(104), PORT_DATA_I_PD(105),
406 PORT_DATA_I_PD(106), PORT_DATA_I_PD(107),
407 PORT_DATA_I_PD(108), PORT_DATA_IO_PD(109),
408 PORT_DATA_IO_PD(110), PORT_DATA_I_PD(111),
409 PORT_DATA_IO_PD(112), PORT_DATA_IO_PD(113),
410 PORT_DATA_IO_PD(114), PORT_DATA_I_PD(115),
411 PORT_DATA_I_PD(116), PORT_DATA_IO_PD(117),
412 PORT_DATA_I_PD(118), PORT_DATA_IO_PD(128),
413 PORT_DATA_IO_PD(129), PORT_DATA_IO_PD(130),
414 PORT_DATA_IO_PD(131), PORT_DATA_IO_PD(132),
415 PORT_DATA_IO_PD(133), PORT_DATA_IO_PU_PD(134),
416 PORT_DATA_IO_PU_PD(135), PORT_DATA_IO_PU_PD(136),
417 PORT_DATA_IO_PU_PD(137), PORT_DATA_IO_PD(138),
418 PORT_DATA_IO_PD(139), PORT_DATA_IO_PD(140),
419 PORT_DATA_IO_PD(141), PORT_DATA_IO_PD(142),
420 PORT_DATA_IO_PD(143), PORT_DATA_IO_PU_PD(144),
421 PORT_DATA_IO_PD(145), PORT_DATA_IO_PU_PD(146),
422 PORT_DATA_IO_PU_PD(147), PORT_DATA_IO_PU_PD(148),
423 PORT_DATA_IO_PU_PD(149), PORT_DATA_I_PD(150),
424 PORT_DATA_IO_PU_PD(151), PORT_DATA_IO_PD(152),
425 PORT_DATA_IO_PD(153), PORT_DATA_IO_PD(154),
426 PORT_DATA_I_PD(155), PORT_DATA_IO_PU_PD(156),
427 PORT_DATA_I_PD(157), PORT_DATA_IO_PD(158),
428
429 /* 55-4 (GPIO) */
430 PORT_DATA_IO_PU_PD(159), PORT_DATA_IO_PU_PD(160),
431 PORT_DATA_I_PU_PD(161), PORT_DATA_I_PU_PD(162),
432 PORT_DATA_IO_PU_PD(163), PORT_DATA_I_PU_PD(164),
433 PORT_DATA_IO_PD(192), PORT_DATA_IO_PD(193),
434 PORT_DATA_IO_PD(194), PORT_DATA_IO_PD(195),
435 PORT_DATA_IO_PD(196), PORT_DATA_IO_PD(197),
436 PORT_DATA_IO_PD(198), PORT_DATA_IO_PD(199),
437 PORT_DATA_IO_PU_PD(200), PORT_DATA_IO_PU_PD(201),
438 PORT_DATA_IO_PU_PD(202), PORT_DATA_IO_PU_PD(203),
439 PORT_DATA_IO_PU_PD(204), PORT_DATA_IO_PU_PD(205),
440 PORT_DATA_IO_PU_PD(206), PORT_DATA_IO_PD(207),
441 PORT_DATA_IO_PD(208), PORT_DATA_IO_PD(209),
442 PORT_DATA_IO_PD(210), PORT_DATA_IO_PD(211),
443 PORT_DATA_IO_PD(212), PORT_DATA_IO_PD(213),
444 PORT_DATA_IO_PD(214), PORT_DATA_IO_PD(215),
445 PORT_DATA_IO_PD(216), PORT_DATA_IO_PD(217),
446 PORT_DATA_O(218), PORT_DATA_IO_PD(219),
447 PORT_DATA_IO_PD(220), PORT_DATA_IO_PD(221),
448 PORT_DATA_IO_PU_PD(222),
449 PORT_DATA_I_PU_PD(223), PORT_DATA_I_PU_PD(224),
450 PORT_DATA_IO_PU_PD(225), PORT_DATA_O(226),
451 PORT_DATA_IO_PU_PD(227), PORT_DATA_I_PD(228),
452 PORT_DATA_I_PD(229), PORT_DATA_IO(230),
453 PORT_DATA_IO_PD(231), PORT_DATA_IO_PU_PD(232),
454 PORT_DATA_I_PD(233), PORT_DATA_IO_PU_PD(234),
455 PORT_DATA_IO_PU_PD(235), PORT_DATA_IO_PU_PD(236),
456 PORT_DATA_IO_PD(237), PORT_DATA_IO_PU_PD(238),
457
458 /* 55-5 (GPIO) */
459 PORT_DATA_IO_PU_PD(239), PORT_DATA_IO_PU_PD(240),
460 PORT_DATA_O(241), PORT_DATA_I_PD(242),
461 PORT_DATA_IO_PU_PD(243), PORT_DATA_IO_PU_PD(244),
462 PORT_DATA_IO_PU_PD(245), PORT_DATA_IO_PU_PD(246),
463 PORT_DATA_IO_PU_PD(247), PORT_DATA_IO_PU_PD(248),
464 PORT_DATA_IO_PU_PD(249), PORT_DATA_IO_PD(250),
465 PORT_DATA_IO_PU_PD(251), PORT_DATA_IO_PU_PD(252),
466 PORT_DATA_IO_PU_PD(253), PORT_DATA_IO_PU_PD(254),
467 PORT_DATA_IO_PU_PD(255), PORT_DATA_IO_PU_PD(256),
468 PORT_DATA_IO_PU_PD(257), PORT_DATA_IO_PD(258),
469 PORT_DATA_IO_PU_PD(259), PORT_DATA_IO_PU_PD(260),
470 PORT_DATA_IO_PU_PD(261), PORT_DATA_IO_PU_PD(262),
471 PORT_DATA_IO_PU_PD(263),
472
473 /* Special Pull-up / Pull-down Functions */
474 PINMUX_DATA(PORT66_KEYIN0_PU_MARK, MSELBCR_MSEL17_0, MSELBCR_MSEL16_0,
475 PORT66_FN2, PORT66_IN_PU),
476 PINMUX_DATA(PORT67_KEYIN1_PU_MARK, MSELBCR_MSEL17_0, MSELBCR_MSEL16_0,
477 PORT67_FN2, PORT67_IN_PU),
478 PINMUX_DATA(PORT68_KEYIN2_PU_MARK, MSELBCR_MSEL17_0, MSELBCR_MSEL16_0,
479 PORT68_FN2, PORT68_IN_PU),
480 PINMUX_DATA(PORT69_KEYIN3_PU_MARK, MSELBCR_MSEL17_0, MSELBCR_MSEL16_0,
481 PORT69_FN2, PORT69_IN_PU),
482 PINMUX_DATA(PORT70_KEYIN4_PU_MARK, MSELBCR_MSEL17_0, MSELBCR_MSEL16_0,
483 PORT70_FN2, PORT70_IN_PU),
484 PINMUX_DATA(PORT71_KEYIN5_PU_MARK, MSELBCR_MSEL17_0, MSELBCR_MSEL16_0,
485 PORT71_FN2, PORT71_IN_PU),
486 PINMUX_DATA(PORT72_KEYIN6_PU_MARK, MSELBCR_MSEL17_0, MSELBCR_MSEL16_0,
487 PORT72_FN2, PORT72_IN_PU),
488
489
490 /* 55-1 (FN) */
491 PINMUX_DATA(VBUS_0_MARK, PORT0_FN1),
492 PINMUX_DATA(CPORT0_MARK, PORT1_FN1),
493 PINMUX_DATA(CPORT1_MARK, PORT2_FN1),
494 PINMUX_DATA(CPORT2_MARK, PORT3_FN1),
495 PINMUX_DATA(CPORT3_MARK, PORT4_FN1),
496 PINMUX_DATA(CPORT4_MARK, PORT5_FN1),
497 PINMUX_DATA(CPORT5_MARK, PORT6_FN1),
498 PINMUX_DATA(CPORT6_MARK, PORT7_FN1),
499 PINMUX_DATA(CPORT7_MARK, PORT8_FN1),
500 PINMUX_DATA(CPORT8_MARK, PORT9_FN1),
501 PINMUX_DATA(CPORT9_MARK, PORT10_FN1),
502 PINMUX_DATA(CPORT10_MARK, PORT11_FN1),
503 PINMUX_DATA(CPORT11_MARK, PORT12_FN1),
504 PINMUX_DATA(SIN2_MARK, PORT12_FN2),
505 PINMUX_DATA(CPORT12_MARK, PORT13_FN1),
506 PINMUX_DATA(XCTS2_MARK, PORT13_FN2),
507 PINMUX_DATA(CPORT13_MARK, PORT14_FN1),
508 PINMUX_DATA(RFSPO4_MARK, PORT14_FN2),
509 PINMUX_DATA(CPORT14_MARK, PORT15_FN1),
510 PINMUX_DATA(RFSPO5_MARK, PORT15_FN2),
511 PINMUX_DATA(CPORT15_MARK, PORT16_FN1),
512 PINMUX_DATA(SCIFA0_SCK_MARK, PORT16_FN2),
513 PINMUX_DATA(GPS_AGC2_MARK, PORT16_FN3),
514 PINMUX_DATA(CPORT16_MARK, PORT17_FN1),
515 PINMUX_DATA(SCIFA0_TXD_MARK, PORT17_FN2),
516 PINMUX_DATA(GPS_AGC3_MARK, PORT17_FN3),
517 PINMUX_DATA(CPORT17_IC_OE_MARK, PORT18_FN1),
518 PINMUX_DATA(SOUT2_MARK, PORT18_FN2),
519 PINMUX_DATA(CPORT18_MARK, PORT19_FN1),
520 PINMUX_DATA(XRTS2_MARK, PORT19_FN2),
521 PINMUX_DATA(PORT19_VIO_CKO2_MARK, PORT19_FN3),
522 PINMUX_DATA(CPORT19_MPORT1_MARK, PORT20_FN1),
523 PINMUX_DATA(CPORT20_MARK, PORT21_FN1),
524 PINMUX_DATA(RFSPO6_MARK, PORT21_FN2),
525 PINMUX_DATA(CPORT21_MARK, PORT22_FN1),
526 PINMUX_DATA(STATUS0_MARK, PORT22_FN2),
527 PINMUX_DATA(CPORT22_MARK, PORT23_FN1),
528 PINMUX_DATA(STATUS1_MARK, PORT23_FN2),
529 PINMUX_DATA(CPORT23_MARK, PORT24_FN1),
530 PINMUX_DATA(STATUS2_MARK, PORT24_FN2),
531 PINMUX_DATA(RFSPO7_MARK, PORT24_FN3),
532 PINMUX_DATA(B_SYNLD1_MARK, PORT25_FN1),
533 PINMUX_DATA(B_SYNLD2_MARK, PORT26_FN1),
534 PINMUX_DATA(SYSENMSK_MARK, PORT26_FN2),
535 PINMUX_DATA(XMAINPS_MARK, PORT27_FN1),
536 PINMUX_DATA(XDIVPS_MARK, PORT28_FN1),
537 PINMUX_DATA(XIDRST_MARK, PORT29_FN1),
538 PINMUX_DATA(IDCLK_MARK, PORT30_FN1),
539 PINMUX_DATA(IC_DP_MARK, PORT30_FN2),
540 PINMUX_DATA(IDIO_MARK, PORT31_FN1),
541 PINMUX_DATA(IC_DM_MARK, PORT31_FN2),
542 PINMUX_DATA(SOUT1_MARK, PORT32_FN1),
543 PINMUX_DATA(SCIFA4_TXD_MARK, PORT32_FN2),
544 PINMUX_DATA(M02_BERDAT_MARK, PORT32_FN3),
545 PINMUX_DATA(SIN1_MARK, PORT33_FN1),
546 PINMUX_DATA(SCIFA4_RXD_MARK, PORT33_FN2),
547 PINMUX_DATA(XWUP_MARK, PORT33_FN3),
548 PINMUX_DATA(XRTS1_MARK, PORT34_FN1),
549 PINMUX_DATA(SCIFA4_RTS_MARK, PORT34_FN2),
550 PINMUX_DATA(M03_BERCLK_MARK, PORT34_FN3),
551 PINMUX_DATA(XCTS1_MARK, PORT35_FN1),
552 PINMUX_DATA(SCIFA4_CTS_MARK, PORT35_FN2),
553 PINMUX_DATA(PCMCLKO_MARK, PORT36_FN1),
554 PINMUX_DATA(SYNC8KO_MARK, PORT37_FN1),
555
556 /* 55-2 (FN) */
557 PINMUX_DATA(DNPCM_A_MARK, PORT38_FN1),
558 PINMUX_DATA(UPPCM_A_MARK, PORT39_FN1),
559 PINMUX_DATA(VACK_MARK, PORT40_FN1),
560 PINMUX_DATA(XTALB1L_MARK, PORT41_FN1),
561 PINMUX_DATA(GPS_AGC1_MARK, PORT42_FN1),
562 PINMUX_DATA(SCIFA0_RTS_MARK, PORT42_FN2),
563 PINMUX_DATA(GPS_AGC4_MARK, PORT43_FN1),
564 PINMUX_DATA(SCIFA0_RXD_MARK, PORT43_FN2),
565 PINMUX_DATA(GPS_PWRDOWN_MARK, PORT44_FN1),
566 PINMUX_DATA(SCIFA0_CTS_MARK, PORT44_FN2),
567 PINMUX_DATA(GPS_IM_MARK, PORT45_FN1),
568 PINMUX_DATA(GPS_IS_MARK, PORT46_FN1),
569 PINMUX_DATA(GPS_QM_MARK, PORT47_FN1),
570 PINMUX_DATA(GPS_QS_MARK, PORT48_FN1),
571 PINMUX_DATA(FMSOCK_MARK, PORT49_FN1),
572 PINMUX_DATA(PORT49_IRDA_OUT_MARK, PORT49_FN2),
573 PINMUX_DATA(PORT49_IROUT_MARK, PORT49_FN3),
574 PINMUX_DATA(FMSOOLR_MARK, PORT50_FN1),
575 PINMUX_DATA(BBIF2_TSYNC2_MARK, PORT50_FN2),
576 PINMUX_DATA(TPU2TO2_MARK, PORT50_FN3),
577 PINMUX_DATA(IPORT3_MARK, PORT50_FN4),
578 PINMUX_DATA(FMSIOLR_MARK, PORT50_FN5),
579 PINMUX_DATA(FMSOOBT_MARK, PORT51_FN1),
580 PINMUX_DATA(BBIF2_TSCK2_MARK, PORT51_FN2),
581 PINMUX_DATA(TPU2TO3_MARK, PORT51_FN3),
582 PINMUX_DATA(OPORT1_MARK, PORT51_FN4),
583 PINMUX_DATA(FMSIOBT_MARK, PORT51_FN5),
584 PINMUX_DATA(FMSOSLD_MARK, PORT52_FN1),
585 PINMUX_DATA(BBIF2_TXD2_MARK, PORT52_FN2),
586 PINMUX_DATA(OPORT2_MARK, PORT52_FN3),
587 PINMUX_DATA(FMSOILR_MARK, PORT53_FN1),
588 PINMUX_DATA(PORT53_IRDA_IN_MARK, PORT53_FN2),
589 PINMUX_DATA(TPU3TO3_MARK, PORT53_FN3),
590 PINMUX_DATA(OPORT3_MARK, PORT53_FN4),
591 PINMUX_DATA(FMSIILR_MARK, PORT53_FN5),
592 PINMUX_DATA(FMSOIBT_MARK, PORT54_FN1),
593 PINMUX_DATA(PORT54_IRDA_FIRSEL_MARK, PORT54_FN2),
594 PINMUX_DATA(TPU3TO2_MARK, PORT54_FN3),
595 PINMUX_DATA(FMSIIBT_MARK, PORT54_FN4),
596 PINMUX_DATA(FMSISLD_MARK, PORT55_FN1),
597 PINMUX_DATA(MFG0_OUT1_MARK, PORT55_FN2),
598 PINMUX_DATA(TPU0TO0_MARK, PORT55_FN3),
599 PINMUX_DATA(A0_EA0_MARK, PORT57_FN1),
600 PINMUX_DATA(BS_MARK, PORT57_FN2),
601 PINMUX_DATA(A12_EA12_MARK, PORT58_FN1),
602 PINMUX_DATA(PORT58_VIO_CKOR_MARK, PORT58_FN2),
603 PINMUX_DATA(TPU4TO2_MARK, PORT58_FN3),
604 PINMUX_DATA(A13_EA13_MARK, PORT59_FN1),
605 PINMUX_DATA(PORT59_IROUT_MARK, PORT59_FN2),
606 PINMUX_DATA(MFG0_OUT2_MARK, PORT59_FN3),
607 PINMUX_DATA(TPU0TO1_MARK, PORT59_FN4),
608 PINMUX_DATA(A14_EA14_MARK, PORT60_FN1),
609 PINMUX_DATA(PORT60_KEYOUT5_MARK, PORT60_FN2),
610 PINMUX_DATA(A15_EA15_MARK, PORT61_FN1),
611 PINMUX_DATA(PORT61_KEYOUT4_MARK, PORT61_FN2),
612 PINMUX_DATA(A16_EA16_MARK, PORT62_FN1),
613 PINMUX_DATA(PORT62_KEYOUT3_MARK, PORT62_FN2),
614 PINMUX_DATA(MSIOF0_SS1_MARK, PORT62_FN3),
615 PINMUX_DATA(A17_EA17_MARK, PORT63_FN1),
616 PINMUX_DATA(PORT63_KEYOUT2_MARK, PORT63_FN2),
617 PINMUX_DATA(MSIOF0_TSYNC_MARK, PORT63_FN3),
618 PINMUX_DATA(A18_EA18_MARK, PORT64_FN1),
619 PINMUX_DATA(PORT64_KEYOUT1_MARK, PORT64_FN2),
620 PINMUX_DATA(MSIOF0_TSCK_MARK, PORT64_FN3),
621 PINMUX_DATA(A19_EA19_MARK, PORT65_FN1),
622 PINMUX_DATA(PORT65_KEYOUT0_MARK, PORT65_FN2),
623 PINMUX_DATA(MSIOF0_TXD_MARK, PORT65_FN3),
624 PINMUX_DATA(A20_EA20_MARK, PORT66_FN1),
625 PINMUX_DATA(PORT66_KEYIN0_MARK, PORT66_FN2),
626 PINMUX_DATA(MSIOF0_RSCK_MARK, PORT66_FN3),
627 PINMUX_DATA(A21_EA21_MARK, PORT67_FN1),
628 PINMUX_DATA(PORT67_KEYIN1_MARK, PORT67_FN2),
629 PINMUX_DATA(MSIOF0_RSYNC_MARK, PORT67_FN3),
630 PINMUX_DATA(A22_EA22_MARK, PORT68_FN1),
631 PINMUX_DATA(PORT68_KEYIN2_MARK, PORT68_FN2),
632 PINMUX_DATA(MSIOF0_MCK0_MARK, PORT68_FN3),
633 PINMUX_DATA(A23_EA23_MARK, PORT69_FN1),
634 PINMUX_DATA(PORT69_KEYIN3_MARK, PORT69_FN2),
635 PINMUX_DATA(MSIOF0_MCK1_MARK, PORT69_FN3),
636 PINMUX_DATA(A24_EA24_MARK, PORT70_FN1),
637 PINMUX_DATA(PORT70_KEYIN4_MARK, PORT70_FN2),
638 PINMUX_DATA(MSIOF0_RXD_MARK, PORT70_FN3),
639 PINMUX_DATA(A25_EA25_MARK, PORT71_FN1),
640 PINMUX_DATA(PORT71_KEYIN5_MARK, PORT71_FN2),
641 PINMUX_DATA(MSIOF0_SS2_MARK, PORT71_FN3),
642 PINMUX_DATA(A26_MARK, PORT72_FN1),
643 PINMUX_DATA(PORT72_KEYIN6_MARK, PORT72_FN2),
644 PINMUX_DATA(D0_ED0_NAF0_MARK, PORT74_FN1),
645 PINMUX_DATA(D1_ED1_NAF1_MARK, PORT75_FN1),
646 PINMUX_DATA(D2_ED2_NAF2_MARK, PORT76_FN1),
647 PINMUX_DATA(D3_ED3_NAF3_MARK, PORT77_FN1),
648 PINMUX_DATA(D4_ED4_NAF4_MARK, PORT78_FN1),
649 PINMUX_DATA(D5_ED5_NAF5_MARK, PORT79_FN1),
650 PINMUX_DATA(D6_ED6_NAF6_MARK, PORT80_FN1),
651 PINMUX_DATA(D7_ED7_NAF7_MARK, PORT81_FN1),
652 PINMUX_DATA(D8_ED8_NAF8_MARK, PORT82_FN1),
653 PINMUX_DATA(D9_ED9_NAF9_MARK, PORT83_FN1),
654 PINMUX_DATA(D10_ED10_NAF10_MARK, PORT84_FN1),
655 PINMUX_DATA(D11_ED11_NAF11_MARK, PORT85_FN1),
656 PINMUX_DATA(D12_ED12_NAF12_MARK, PORT86_FN1),
657 PINMUX_DATA(D13_ED13_NAF13_MARK, PORT87_FN1),
658 PINMUX_DATA(D14_ED14_NAF14_MARK, PORT88_FN1),
659 PINMUX_DATA(D15_ED15_NAF15_MARK, PORT89_FN1),
660 PINMUX_DATA(CS4_MARK, PORT90_FN1),
661 PINMUX_DATA(CS5A_MARK, PORT91_FN1),
662 PINMUX_DATA(FMSICK_MARK, PORT91_FN2),
663 PINMUX_DATA(CS5B_MARK, PORT92_FN1),
664 PINMUX_DATA(FCE1_MARK, PORT92_FN2),
665
666 /* 55-3 (FN) */
667 PINMUX_DATA(CS6B_MARK, PORT93_FN1),
668 PINMUX_DATA(XCS2_MARK, PORT93_FN2),
669 PINMUX_DATA(CS6A_MARK, PORT93_FN3),
670 PINMUX_DATA(DACK0_MARK, PORT93_FN4),
671 PINMUX_DATA(FCE0_MARK, PORT94_FN1),
672 PINMUX_DATA(WAIT_MARK, PORT95_FN1),
673 PINMUX_DATA(DREQ0_MARK, PORT95_FN2),
674 PINMUX_DATA(RD_XRD_MARK, PORT96_FN1),
675 PINMUX_DATA(WE0_XWR0_FWE_MARK, PORT97_FN1),
676 PINMUX_DATA(WE1_XWR1_MARK, PORT98_FN1),
677 PINMUX_DATA(FRB_MARK, PORT99_FN1),
678 PINMUX_DATA(CKO_MARK, PORT100_FN1),
679 PINMUX_DATA(NBRSTOUT_MARK, PORT101_FN1),
680 PINMUX_DATA(NBRST_MARK, PORT102_FN1),
681 PINMUX_DATA(GPS_EPPSIN_MARK, PORT106_FN1),
682 PINMUX_DATA(LATCHPULSE_MARK, PORT110_FN1),
683 PINMUX_DATA(LTESIGNAL_MARK, PORT111_FN1),
684 PINMUX_DATA(LEGACYSTATE_MARK, PORT112_FN1),
685 PINMUX_DATA(TCKON_MARK, PORT118_FN1),
686 PINMUX_DATA(VIO_VD_MARK, PORT128_FN1),
687 PINMUX_DATA(PORT128_KEYOUT0_MARK, PORT128_FN2),
688 PINMUX_DATA(IPORT0_MARK, PORT128_FN3),
689 PINMUX_DATA(VIO_HD_MARK, PORT129_FN1),
690 PINMUX_DATA(PORT129_KEYOUT1_MARK, PORT129_FN2),
691 PINMUX_DATA(IPORT1_MARK, PORT129_FN3),
692 PINMUX_DATA(VIO_D0_MARK, PORT130_FN1),
693 PINMUX_DATA(PORT130_KEYOUT2_MARK, PORT130_FN2),
694 PINMUX_DATA(PORT130_MSIOF2_RXD_MARK, PORT130_FN3),
695 PINMUX_DATA(VIO_D1_MARK, PORT131_FN1),
696 PINMUX_DATA(PORT131_KEYOUT3_MARK, PORT131_FN2),
697 PINMUX_DATA(PORT131_MSIOF2_SS1_MARK, PORT131_FN3),
698 PINMUX_DATA(VIO_D2_MARK, PORT132_FN1),
699 PINMUX_DATA(PORT132_KEYOUT4_MARK, PORT132_FN2),
700 PINMUX_DATA(PORT132_MSIOF2_SS2_MARK, PORT132_FN3),
701 PINMUX_DATA(VIO_D3_MARK, PORT133_FN1),
702 PINMUX_DATA(PORT133_KEYOUT5_MARK, PORT133_FN2),
703 PINMUX_DATA(PORT133_MSIOF2_TSYNC_MARK, PORT133_FN3),
704 PINMUX_DATA(VIO_D4_MARK, PORT134_FN1),
705 PINMUX_DATA(PORT134_KEYIN0_MARK, PORT134_FN2),
706 PINMUX_DATA(PORT134_MSIOF2_TXD_MARK, PORT134_FN3),
707 PINMUX_DATA(VIO_D5_MARK, PORT135_FN1),
708 PINMUX_DATA(PORT135_KEYIN1_MARK, PORT135_FN2),
709 PINMUX_DATA(PORT135_MSIOF2_TSCK_MARK, PORT135_FN3),
710 PINMUX_DATA(VIO_D6_MARK, PORT136_FN1),
711 PINMUX_DATA(PORT136_KEYIN2_MARK, PORT136_FN2),
712 PINMUX_DATA(VIO_D7_MARK, PORT137_FN1),
713 PINMUX_DATA(PORT137_KEYIN3_MARK, PORT137_FN2),
714 PINMUX_DATA(VIO_D8_MARK, PORT138_FN1),
715 PINMUX_DATA(M9_SLCD_A01_MARK, PORT138_FN2),
716 PINMUX_DATA(PORT138_FSIAOMC_MARK, PORT138_FN3),
717 PINMUX_DATA(VIO_D9_MARK, PORT139_FN1),
718 PINMUX_DATA(M10_SLCD_CK1_MARK, PORT139_FN2),
719 PINMUX_DATA(PORT139_FSIAOLR_MARK, PORT139_FN3),
720 PINMUX_DATA(VIO_D10_MARK, PORT140_FN1),
721 PINMUX_DATA(M11_SLCD_SO1_MARK, PORT140_FN2),
722 PINMUX_DATA(TPU0TO2_MARK, PORT140_FN3),
723 PINMUX_DATA(PORT140_FSIAOBT_MARK, PORT140_FN4),
724 PINMUX_DATA(VIO_D11_MARK, PORT141_FN1),
725 PINMUX_DATA(M12_SLCD_CE1_MARK, PORT141_FN2),
726 PINMUX_DATA(TPU0TO3_MARK, PORT141_FN3),
727 PINMUX_DATA(PORT141_FSIAOSLD_MARK, PORT141_FN4),
728 PINMUX_DATA(VIO_D12_MARK, PORT142_FN1),
729 PINMUX_DATA(M13_BSW_MARK, PORT142_FN2),
730 PINMUX_DATA(PORT142_FSIACK_MARK, PORT142_FN3),
731 PINMUX_DATA(VIO_D13_MARK, PORT143_FN1),
732 PINMUX_DATA(M14_GSW_MARK, PORT143_FN2),
733 PINMUX_DATA(PORT143_FSIAILR_MARK, PORT143_FN3),
734 PINMUX_DATA(VIO_D14_MARK, PORT144_FN1),
735 PINMUX_DATA(M15_RSW_MARK, PORT144_FN2),
736 PINMUX_DATA(PORT144_FSIAIBT_MARK, PORT144_FN3),
737 PINMUX_DATA(VIO_D15_MARK, PORT145_FN1),
738 PINMUX_DATA(TPU1TO3_MARK, PORT145_FN2),
739 PINMUX_DATA(PORT145_FSIAISLD_MARK, PORT145_FN3),
740 PINMUX_DATA(VIO_CLK_MARK, PORT146_FN1),
741 PINMUX_DATA(PORT146_KEYIN4_MARK, PORT146_FN2),
742 PINMUX_DATA(IPORT2_MARK, PORT146_FN3),
743 PINMUX_DATA(VIO_FIELD_MARK, PORT147_FN1),
744 PINMUX_DATA(PORT147_KEYIN5_MARK, PORT147_FN2),
745 PINMUX_DATA(VIO_CKO_MARK, PORT148_FN1),
746 PINMUX_DATA(PORT148_KEYIN6_MARK, PORT148_FN2),
747 PINMUX_DATA(A27_MARK, PORT149_FN1),
748 PINMUX_DATA(RDWR_XWE_MARK, PORT149_FN2),
749 PINMUX_DATA(MFG0_IN1_MARK, PORT149_FN3),
750 PINMUX_DATA(MFG0_IN2_MARK, PORT150_FN1),
751 PINMUX_DATA(TS_SPSYNC3_MARK, PORT151_FN1),
752 PINMUX_DATA(MSIOF2_RSCK_MARK, PORT151_FN2),
753 PINMUX_DATA(TS_SDAT3_MARK, PORT152_FN1),
754 PINMUX_DATA(MSIOF2_RSYNC_MARK, PORT152_FN2),
755 PINMUX_DATA(TPU1TO2_MARK, PORT153_FN1),
756 PINMUX_DATA(TS_SDEN3_MARK, PORT153_FN2),
757 PINMUX_DATA(PORT153_MSIOF2_SS1_MARK, PORT153_FN3),
758 PINMUX_DATA(SOUT3_MARK, PORT154_FN1),
759 PINMUX_DATA(SCIFA2_TXD1_MARK, PORT154_FN2),
760 PINMUX_DATA(MSIOF2_MCK0_MARK, PORT154_FN3),
761 PINMUX_DATA(SIN3_MARK, PORT155_FN1),
762 PINMUX_DATA(SCIFA2_RXD1_MARK, PORT155_FN2),
763 PINMUX_DATA(MSIOF2_MCK1_MARK, PORT155_FN3),
764 PINMUX_DATA(XRTS3_MARK, PORT156_FN1),
765 PINMUX_DATA(SCIFA2_RTS1_MARK, PORT156_FN2),
766 PINMUX_DATA(PORT156_MSIOF2_SS2_MARK, PORT156_FN3),
767 PINMUX_DATA(XCTS3_MARK, PORT157_FN1),
768 PINMUX_DATA(SCIFA2_CTS1_MARK, PORT157_FN2),
769 PINMUX_DATA(PORT157_MSIOF2_RXD_MARK, PORT157_FN3),
770
771 /* 55-4 (FN) */
772 PINMUX_DATA(DINT_MARK, PORT158_FN1),
773 PINMUX_DATA(SCIFA2_SCK1_MARK, PORT158_FN2),
774 PINMUX_DATA(TS_SCK3_MARK, PORT158_FN3),
775 PINMUX_DATA(PORT159_SCIFB_SCK_MARK, PORT159_FN1),
776 PINMUX_DATA(PORT159_SCIFA5_SCK_MARK, PORT159_FN2),
777 PINMUX_DATA(NMI_MARK, PORT159_FN3),
778 PINMUX_DATA(PORT160_SCIFB_TXD_MARK, PORT160_FN1),
779 PINMUX_DATA(PORT160_SCIFA5_TXD_MARK, PORT160_FN2),
780 PINMUX_DATA(SOUT0_MARK, PORT160_FN3),
781 PINMUX_DATA(PORT161_SCIFB_CTS_MARK, PORT161_FN1),
782 PINMUX_DATA(PORT161_SCIFA5_CTS_MARK, PORT161_FN2),
783 PINMUX_DATA(XCTS0_MARK, PORT161_FN3),
784 PINMUX_DATA(MFG3_IN2_MARK, PORT161_FN4),
785 PINMUX_DATA(PORT162_SCIFB_RXD_MARK, PORT162_FN1),
786 PINMUX_DATA(PORT162_SCIFA5_RXD_MARK, PORT162_FN2),
787 PINMUX_DATA(SIN0_MARK, PORT162_FN3),
788 PINMUX_DATA(MFG3_IN1_MARK, PORT162_FN4),
789 PINMUX_DATA(PORT163_SCIFB_RTS_MARK, PORT163_FN1),
790 PINMUX_DATA(PORT163_SCIFA5_RTS_MARK, PORT163_FN2),
791 PINMUX_DATA(XRTS0_MARK, PORT163_FN3),
792 PINMUX_DATA(MFG3_OUT1_MARK, PORT163_FN4),
793 PINMUX_DATA(TPU3TO0_MARK, PORT163_FN5),
794 PINMUX_DATA(LCDD0_MARK, PORT192_FN1),
795 PINMUX_DATA(PORT192_KEYOUT0_MARK, PORT192_FN2),
796 PINMUX_DATA(EXT_CKI_MARK, PORT192_FN3),
797 PINMUX_DATA(LCDD1_MARK, PORT193_FN1),
798 PINMUX_DATA(PORT193_KEYOUT1_MARK, PORT193_FN2),
799 PINMUX_DATA(PORT193_SCIFA5_CTS_MARK, PORT193_FN3),
800 PINMUX_DATA(BBIF2_TSYNC1_MARK, PORT193_FN4),
801 PINMUX_DATA(LCDD2_MARK, PORT194_FN1),
802 PINMUX_DATA(PORT194_KEYOUT2_MARK, PORT194_FN2),
803 PINMUX_DATA(PORT194_SCIFA5_RTS_MARK, PORT194_FN3),
804 PINMUX_DATA(BBIF2_TSCK1_MARK, PORT194_FN4),
805 PINMUX_DATA(LCDD3_MARK, PORT195_FN1),
806 PINMUX_DATA(PORT195_KEYOUT3_MARK, PORT195_FN2),
807 PINMUX_DATA(PORT195_SCIFA5_RXD_MARK, PORT195_FN3),
808 PINMUX_DATA(BBIF2_TXD1_MARK, PORT195_FN4),
809 PINMUX_DATA(LCDD4_MARK, PORT196_FN1),
810 PINMUX_DATA(PORT196_KEYOUT4_MARK, PORT196_FN2),
811 PINMUX_DATA(PORT196_SCIFA5_TXD_MARK, PORT196_FN3),
812 PINMUX_DATA(LCDD5_MARK, PORT197_FN1),
813 PINMUX_DATA(PORT197_KEYOUT5_MARK, PORT197_FN2),
814 PINMUX_DATA(PORT197_SCIFA5_SCK_MARK, PORT197_FN3),
815 PINMUX_DATA(MFG2_OUT2_MARK, PORT197_FN4),
816 PINMUX_DATA(LCDD6_MARK, PORT198_FN1),
817 PINMUX_DATA(LCDD7_MARK, PORT199_FN1),
818 PINMUX_DATA(TPU4TO1_MARK, PORT199_FN2),
819 PINMUX_DATA(MFG4_OUT2_MARK, PORT199_FN3),
820 PINMUX_DATA(LCDD8_MARK, PORT200_FN1),
821 PINMUX_DATA(PORT200_KEYIN0_MARK, PORT200_FN2),
822 PINMUX_DATA(VIO_DR0_MARK, PORT200_FN3),
823 PINMUX_DATA(D16_MARK, PORT200_FN4),
824 PINMUX_DATA(LCDD9_MARK, PORT201_FN1),
825 PINMUX_DATA(PORT201_KEYIN1_MARK, PORT201_FN2),
826 PINMUX_DATA(VIO_DR1_MARK, PORT201_FN3),
827 PINMUX_DATA(D17_MARK, PORT201_FN4),
828 PINMUX_DATA(LCDD10_MARK, PORT202_FN1),
829 PINMUX_DATA(PORT202_KEYIN2_MARK, PORT202_FN2),
830 PINMUX_DATA(VIO_DR2_MARK, PORT202_FN3),
831 PINMUX_DATA(D18_MARK, PORT202_FN4),
832 PINMUX_DATA(LCDD11_MARK, PORT203_FN1),
833 PINMUX_DATA(PORT203_KEYIN3_MARK, PORT203_FN2),
834 PINMUX_DATA(VIO_DR3_MARK, PORT203_FN3),
835 PINMUX_DATA(D19_MARK, PORT203_FN4),
836 PINMUX_DATA(LCDD12_MARK, PORT204_FN1),
837 PINMUX_DATA(PORT204_KEYIN4_MARK, PORT204_FN2),
838 PINMUX_DATA(VIO_DR4_MARK, PORT204_FN3),
839 PINMUX_DATA(D20_MARK, PORT204_FN4),
840 PINMUX_DATA(LCDD13_MARK, PORT205_FN1),
841 PINMUX_DATA(PORT205_KEYIN5_MARK, PORT205_FN2),
842 PINMUX_DATA(VIO_DR5_MARK, PORT205_FN3),
843 PINMUX_DATA(D21_MARK, PORT205_FN4),
844 PINMUX_DATA(LCDD14_MARK, PORT206_FN1),
845 PINMUX_DATA(PORT206_KEYIN6_MARK, PORT206_FN2),
846 PINMUX_DATA(VIO_DR6_MARK, PORT206_FN3),
847 PINMUX_DATA(D22_MARK, PORT206_FN4),
848 PINMUX_DATA(LCDD15_MARK, PORT207_FN1),
849 PINMUX_DATA(PORT207_MSIOF0L_SS1_MARK, PORT207_FN2),
850 PINMUX_DATA(PORT207_KEYOUT0_MARK, PORT207_FN3),
851 PINMUX_DATA(VIO_DR7_MARK, PORT207_FN4),
852 PINMUX_DATA(D23_MARK, PORT207_FN5),
853 PINMUX_DATA(LCDD16_MARK, PORT208_FN1),
854 PINMUX_DATA(PORT208_MSIOF0L_SS2_MARK, PORT208_FN2),
855 PINMUX_DATA(PORT208_KEYOUT1_MARK, PORT208_FN3),
856 PINMUX_DATA(VIO_VDR_MARK, PORT208_FN4),
857 PINMUX_DATA(D24_MARK, PORT208_FN5),
858 PINMUX_DATA(LCDD17_MARK, PORT209_FN1),
859 PINMUX_DATA(PORT209_KEYOUT2_MARK, PORT209_FN2),
860 PINMUX_DATA(VIO_HDR_MARK, PORT209_FN3),
861 PINMUX_DATA(D25_MARK, PORT209_FN4),
862 PINMUX_DATA(LCDD18_MARK, PORT210_FN1),
863 PINMUX_DATA(DREQ2_MARK, PORT210_FN2),
864 PINMUX_DATA(PORT210_MSIOF0L_SS1_MARK, PORT210_FN3),
865 PINMUX_DATA(D26_MARK, PORT210_FN4),
866 PINMUX_DATA(LCDD19_MARK, PORT211_FN1),
867 PINMUX_DATA(PORT211_MSIOF0L_SS2_MARK, PORT211_FN2),
868 PINMUX_DATA(D27_MARK, PORT211_FN3),
869 PINMUX_DATA(LCDD20_MARK, PORT212_FN1),
870 PINMUX_DATA(TS_SPSYNC1_MARK, PORT212_FN2),
871 PINMUX_DATA(MSIOF0L_MCK0_MARK, PORT212_FN3),
872 PINMUX_DATA(D28_MARK, PORT212_FN4),
873 PINMUX_DATA(LCDD21_MARK, PORT213_FN1),
874 PINMUX_DATA(TS_SDAT1_MARK, PORT213_FN2),
875 PINMUX_DATA(MSIOF0L_MCK1_MARK, PORT213_FN3),
876 PINMUX_DATA(D29_MARK, PORT213_FN4),
877 PINMUX_DATA(LCDD22_MARK, PORT214_FN1),
878 PINMUX_DATA(TS_SDEN1_MARK, PORT214_FN2),
879 PINMUX_DATA(MSIOF0L_RSCK_MARK, PORT214_FN3),
880 PINMUX_DATA(D30_MARK, PORT214_FN4),
881 PINMUX_DATA(LCDD23_MARK, PORT215_FN1),
882 PINMUX_DATA(TS_SCK1_MARK, PORT215_FN2),
883 PINMUX_DATA(MSIOF0L_RSYNC_MARK, PORT215_FN3),
884 PINMUX_DATA(D31_MARK, PORT215_FN4),
885 PINMUX_DATA(LCDDCK_MARK, PORT216_FN1),
886 PINMUX_DATA(LCDWR_MARK, PORT216_FN2),
887 PINMUX_DATA(PORT216_KEYOUT3_MARK, PORT216_FN3),
888 PINMUX_DATA(VIO_CLKR_MARK, PORT216_FN4),
889 PINMUX_DATA(LCDRD_MARK, PORT217_FN1),
890 PINMUX_DATA(DACK2_MARK, PORT217_FN2),
891 PINMUX_DATA(MSIOF0L_TSYNC_MARK, PORT217_FN3),
892 PINMUX_DATA(LCDHSYN_MARK, PORT218_FN1),
893 PINMUX_DATA(LCDCS_MARK, PORT218_FN2),
894 PINMUX_DATA(LCDCS2_MARK, PORT218_FN3),
895 PINMUX_DATA(DACK3_MARK, PORT218_FN4),
896 PINMUX_DATA(PORT218_VIO_CKOR_MARK, PORT218_FN5),
897 PINMUX_DATA(PORT218_KEYOUT4_MARK, PORT218_FN6),
898 PINMUX_DATA(LCDDISP_MARK, PORT219_FN1),
899 PINMUX_DATA(LCDRS_MARK, PORT219_FN2),
900 PINMUX_DATA(DREQ3_MARK, PORT219_FN3),
901 PINMUX_DATA(MSIOF0L_TSCK_MARK, PORT219_FN4),
902 PINMUX_DATA(LCDVSYN_MARK, PORT220_FN1),
903 PINMUX_DATA(LCDVSYN2_MARK, PORT220_FN2),
904 PINMUX_DATA(PORT220_KEYOUT5_MARK, PORT220_FN3),
905 PINMUX_DATA(LCDLCLK_MARK, PORT221_FN1),
906 PINMUX_DATA(DREQ1_MARK, PORT221_FN2),
907 PINMUX_DATA(PWEN_MARK, PORT221_FN3),
908 PINMUX_DATA(MSIOF0L_RXD_MARK, PORT221_FN4),
909 PINMUX_DATA(LCDDON_MARK, PORT222_FN1),
910 PINMUX_DATA(LCDDON2_MARK, PORT222_FN2),
911 PINMUX_DATA(DACK1_MARK, PORT222_FN3),
912 PINMUX_DATA(OVCN_MARK, PORT222_FN4),
913 PINMUX_DATA(MSIOF0L_TXD_MARK, PORT222_FN5),
914 PINMUX_DATA(SCIFA1_TXD_MARK, PORT225_FN1),
915 PINMUX_DATA(OVCN2_MARK, PORT225_FN2),
916 PINMUX_DATA(EXTLP_MARK, PORT226_FN1),
917 PINMUX_DATA(SCIFA1_SCK_MARK, PORT226_FN2),
918 PINMUX_DATA(USBTERM_MARK, PORT226_FN3),
919 PINMUX_DATA(PORT226_VIO_CKO2_MARK, PORT226_FN4),
920 PINMUX_DATA(SCIFA1_RTS_MARK, PORT227_FN1),
921 PINMUX_DATA(IDIN_MARK, PORT227_FN2),
922 PINMUX_DATA(SCIFA1_RXD_MARK, PORT228_FN1),
923 PINMUX_DATA(SCIFA1_CTS_MARK, PORT229_FN1),
924 PINMUX_DATA(MFG1_IN1_MARK, PORT229_FN2),
925 PINMUX_DATA(MSIOF1_TXD_MARK, PORT230_FN1),
926 PINMUX_DATA(SCIFA2_TXD2_MARK, PORT230_FN2),
927 PINMUX_DATA(PORT230_FSIAOMC_MARK, PORT230_FN3),
928 PINMUX_DATA(MSIOF1_TSYNC_MARK, PORT231_FN1),
929 PINMUX_DATA(SCIFA2_CTS2_MARK, PORT231_FN2),
930 PINMUX_DATA(PORT231_FSIAOLR_MARK, PORT231_FN3),
931 PINMUX_DATA(MSIOF1_TSCK_MARK, PORT232_FN1),
932 PINMUX_DATA(SCIFA2_SCK2_MARK, PORT232_FN2),
933 PINMUX_DATA(PORT232_FSIAOBT_MARK, PORT232_FN3),
934 PINMUX_DATA(MSIOF1_RXD_MARK, PORT233_FN1),
935 PINMUX_DATA(SCIFA2_RXD2_MARK, PORT233_FN2),
936 PINMUX_DATA(GPS_VCOTRIG_MARK, PORT233_FN3),
937 PINMUX_DATA(PORT233_FSIACK_MARK, PORT233_FN4),
938 PINMUX_DATA(MSIOF1_RSCK_MARK, PORT234_FN1),
939 PINMUX_DATA(SCIFA2_RTS2_MARK, PORT234_FN2),
940 PINMUX_DATA(PORT234_FSIAOSLD_MARK, PORT234_FN3),
941 PINMUX_DATA(MSIOF1_RSYNC_MARK, PORT235_FN1),
942 PINMUX_DATA(OPORT0_MARK, PORT235_FN2),
943 PINMUX_DATA(MFG1_IN2_MARK, PORT235_FN3),
944 PINMUX_DATA(PORT235_FSIAILR_MARK, PORT235_FN4),
945 PINMUX_DATA(MSIOF1_MCK0_MARK, PORT236_FN1),
946 PINMUX_DATA(I2C_SDA2_MARK, PORT236_FN2),
947 PINMUX_DATA(PORT236_FSIAIBT_MARK, PORT236_FN3),
948 PINMUX_DATA(MSIOF1_MCK1_MARK, PORT237_FN1),
949 PINMUX_DATA(I2C_SCL2_MARK, PORT237_FN2),
950 PINMUX_DATA(PORT237_FSIAISLD_MARK, PORT237_FN3),
951 PINMUX_DATA(MSIOF1_SS1_MARK, PORT238_FN1),
952 PINMUX_DATA(EDBGREQ3_MARK, PORT238_FN2),
953
954 /* 55-5 (FN) */
955 PINMUX_DATA(MSIOF1_SS2_MARK, PORT239_FN1),
956 PINMUX_DATA(SCIFA6_TXD_MARK, PORT240_FN1),
957 PINMUX_DATA(PORT241_IRDA_OUT_MARK, PORT241_FN1),
958 PINMUX_DATA(PORT241_IROUT_MARK, PORT241_FN2),
959 PINMUX_DATA(MFG4_OUT1_MARK, PORT241_FN3),
960 PINMUX_DATA(TPU4TO0_MARK, PORT241_FN4),
961 PINMUX_DATA(PORT242_IRDA_IN_MARK, PORT242_FN1),
962 PINMUX_DATA(MFG4_IN2_MARK, PORT242_FN2),
963 PINMUX_DATA(PORT243_IRDA_FIRSEL_MARK, PORT243_FN1),
964 PINMUX_DATA(PORT243_VIO_CKO2_MARK, PORT243_FN2),
965 PINMUX_DATA(PORT244_SCIFA5_CTS_MARK, PORT244_FN1),
966 PINMUX_DATA(MFG2_IN1_MARK, PORT244_FN2),
967 PINMUX_DATA(PORT244_SCIFB_CTS_MARK, PORT244_FN3),
968 PINMUX_DATA(PORT245_SCIFA5_RTS_MARK, PORT245_FN1),
969 PINMUX_DATA(MFG2_IN2_MARK, PORT245_FN2),
970 PINMUX_DATA(PORT245_SCIFB_RTS_MARK, PORT245_FN3),
971 PINMUX_DATA(PORT246_SCIFA5_RXD_MARK, PORT246_FN1),
972 PINMUX_DATA(MFG1_OUT1_MARK, PORT246_FN2),
973 PINMUX_DATA(PORT246_SCIFB_RXD_MARK, PORT246_FN3),
974 PINMUX_DATA(TPU1TO0_MARK, PORT246_FN4),
975 PINMUX_DATA(PORT247_SCIFA5_TXD_MARK, PORT247_FN1),
976 PINMUX_DATA(MFG3_OUT2_MARK, PORT247_FN2),
977 PINMUX_DATA(PORT247_SCIFB_TXD_MARK, PORT247_FN3),
978 PINMUX_DATA(TPU3TO1_MARK, PORT247_FN4),
979 PINMUX_DATA(PORT248_SCIFA5_SCK_MARK, PORT248_FN1),
980 PINMUX_DATA(MFG2_OUT1_MARK, PORT248_FN2),
981 PINMUX_DATA(PORT248_SCIFB_SCK_MARK, PORT248_FN3),
982 PINMUX_DATA(TPU2TO0_MARK, PORT248_FN4),
983 PINMUX_DATA(PORT249_IROUT_MARK, PORT249_FN1),
984 PINMUX_DATA(MFG4_IN1_MARK, PORT249_FN2),
985 PINMUX_DATA(SDHICLK0_MARK, PORT250_FN1),
986 PINMUX_DATA(TCK2_SWCLK_MC0_MARK, PORT250_FN2),
987 PINMUX_DATA(SDHICD0_MARK, PORT251_FN1),
988 PINMUX_DATA(SDHID0_0_MARK, PORT252_FN1),
989 PINMUX_DATA(TMS2_SWDIO_MC0_MARK, PORT252_FN2),
990 PINMUX_DATA(SDHID0_1_MARK, PORT253_FN1),
991 PINMUX_DATA(TDO2_SWO0_MC0_MARK, PORT253_FN2),
992 PINMUX_DATA(SDHID0_2_MARK, PORT254_FN1),
993 PINMUX_DATA(TDI2_MARK, PORT254_FN2),
994 PINMUX_DATA(SDHID0_3_MARK, PORT255_FN1),
995 PINMUX_DATA(RTCK2_SWO1_MC0_MARK, PORT255_FN2),
996 PINMUX_DATA(SDHICMD0_MARK, PORT256_FN1),
997 PINMUX_DATA(TRST2_MARK, PORT256_FN2),
998 PINMUX_DATA(SDHIWP0_MARK, PORT257_FN1),
999 PINMUX_DATA(EDBGREQ2_MARK, PORT257_FN2),
1000 PINMUX_DATA(SDHICLK1_MARK, PORT258_FN1),
1001 PINMUX_DATA(TCK3_SWCLK_MC1_MARK, PORT258_FN2),
1002 PINMUX_DATA(SDHID1_0_MARK, PORT259_FN1),
1003 PINMUX_DATA(M11_SLCD_SO2_MARK, PORT259_FN2),
1004 PINMUX_DATA(TS_SPSYNC2_MARK, PORT259_FN3),
1005 PINMUX_DATA(TMS3_SWDIO_MC1_MARK, PORT259_FN4),
1006 PINMUX_DATA(SDHID1_1_MARK, PORT260_FN1),
1007 PINMUX_DATA(M9_SLCD_A02_MARK, PORT260_FN2),
1008 PINMUX_DATA(TS_SDAT2_MARK, PORT260_FN3),
1009 PINMUX_DATA(TDO3_SWO0_MC1_MARK, PORT260_FN4),
1010 PINMUX_DATA(SDHID1_2_MARK, PORT261_FN1),
1011 PINMUX_DATA(M10_SLCD_CK2_MARK, PORT261_FN2),
1012 PINMUX_DATA(TS_SDEN2_MARK, PORT261_FN3),
1013 PINMUX_DATA(TDI3_MARK, PORT261_FN4),
1014 PINMUX_DATA(SDHID1_3_MARK, PORT262_FN1),
1015 PINMUX_DATA(M12_SLCD_CE2_MARK, PORT262_FN2),
1016 PINMUX_DATA(TS_SCK2_MARK, PORT262_FN3),
1017 PINMUX_DATA(RTCK3_SWO1_MC1_MARK, PORT262_FN4),
1018 PINMUX_DATA(SDHICMD1_MARK, PORT263_FN1),
1019 PINMUX_DATA(TRST3_MARK, PORT263_FN2),
1020 PINMUX_DATA(RESETOUTS_MARK, PORT264_FN1),
1021};
1022
1023static struct pinmux_gpio pinmux_gpios[] = {
1024 /* 55-1 -> 55-5 (GPIO) */
1025 GPIO_PORT_ALL(),
1026
1027 /* Special Pull-up / Pull-down Functions */
1028 GPIO_FN(PORT66_KEYIN0_PU), GPIO_FN(PORT67_KEYIN1_PU),
1029 GPIO_FN(PORT68_KEYIN2_PU), GPIO_FN(PORT69_KEYIN3_PU),
1030 GPIO_FN(PORT70_KEYIN4_PU), GPIO_FN(PORT71_KEYIN5_PU),
1031 GPIO_FN(PORT72_KEYIN6_PU),
1032
1033 /* 55-1 (FN) */
1034 GPIO_FN(VBUS_0),
1035 GPIO_FN(CPORT0),
1036 GPIO_FN(CPORT1),
1037 GPIO_FN(CPORT2),
1038 GPIO_FN(CPORT3),
1039 GPIO_FN(CPORT4),
1040 GPIO_FN(CPORT5),
1041 GPIO_FN(CPORT6),
1042 GPIO_FN(CPORT7),
1043 GPIO_FN(CPORT8),
1044 GPIO_FN(CPORT9),
1045 GPIO_FN(CPORT10),
1046 GPIO_FN(CPORT11), GPIO_FN(SIN2),
1047 GPIO_FN(CPORT12), GPIO_FN(XCTS2),
1048 GPIO_FN(CPORT13), GPIO_FN(RFSPO4),
1049 GPIO_FN(CPORT14), GPIO_FN(RFSPO5),
1050 GPIO_FN(CPORT15), GPIO_FN(SCIFA0_SCK), GPIO_FN(GPS_AGC2),
1051 GPIO_FN(CPORT16), GPIO_FN(SCIFA0_TXD), GPIO_FN(GPS_AGC3),
1052 GPIO_FN(CPORT17_IC_OE), GPIO_FN(SOUT2),
1053 GPIO_FN(CPORT18), GPIO_FN(XRTS2), GPIO_FN(PORT19_VIO_CKO2),
1054 GPIO_FN(CPORT19_MPORT1),
1055 GPIO_FN(CPORT20), GPIO_FN(RFSPO6),
1056 GPIO_FN(CPORT21), GPIO_FN(STATUS0),
1057 GPIO_FN(CPORT22), GPIO_FN(STATUS1),
1058 GPIO_FN(CPORT23), GPIO_FN(STATUS2), GPIO_FN(RFSPO7),
1059 GPIO_FN(B_SYNLD1),
1060 GPIO_FN(B_SYNLD2), GPIO_FN(SYSENMSK),
1061 GPIO_FN(XMAINPS),
1062 GPIO_FN(XDIVPS),
1063 GPIO_FN(XIDRST),
1064 GPIO_FN(IDCLK), GPIO_FN(IC_DP),
1065 GPIO_FN(IDIO), GPIO_FN(IC_DM),
1066 GPIO_FN(SOUT1), GPIO_FN(SCIFA4_TXD), GPIO_FN(M02_BERDAT),
1067 GPIO_FN(SIN1), GPIO_FN(SCIFA4_RXD), GPIO_FN(XWUP),
1068 GPIO_FN(XRTS1), GPIO_FN(SCIFA4_RTS), GPIO_FN(M03_BERCLK),
1069 GPIO_FN(XCTS1), GPIO_FN(SCIFA4_CTS),
1070 GPIO_FN(PCMCLKO),
1071 GPIO_FN(SYNC8KO),
1072
1073 /* 55-2 (FN) */
1074 GPIO_FN(DNPCM_A),
1075 GPIO_FN(UPPCM_A),
1076 GPIO_FN(VACK),
1077 GPIO_FN(XTALB1L),
1078 GPIO_FN(GPS_AGC1), GPIO_FN(SCIFA0_RTS),
1079 GPIO_FN(GPS_AGC4), GPIO_FN(SCIFA0_RXD),
1080 GPIO_FN(GPS_PWRDOWN), GPIO_FN(SCIFA0_CTS),
1081 GPIO_FN(GPS_IM),
1082 GPIO_FN(GPS_IS),
1083 GPIO_FN(GPS_QM),
1084 GPIO_FN(GPS_QS),
1085 GPIO_FN(FMSOCK), GPIO_FN(PORT49_IRDA_OUT), GPIO_FN(PORT49_IROUT),
1086 GPIO_FN(FMSOOLR), GPIO_FN(BBIF2_TSYNC2), GPIO_FN(TPU2TO2),
1087 GPIO_FN(IPORT3), GPIO_FN(FMSIOLR),
1088 GPIO_FN(FMSOOBT), GPIO_FN(BBIF2_TSCK2), GPIO_FN(TPU2TO3),
1089 GPIO_FN(OPORT1), GPIO_FN(FMSIOBT),
1090 GPIO_FN(FMSOSLD), GPIO_FN(BBIF2_TXD2), GPIO_FN(OPORT2),
1091 GPIO_FN(FMSOILR), GPIO_FN(PORT53_IRDA_IN), GPIO_FN(TPU3TO3),
1092 GPIO_FN(OPORT3), GPIO_FN(FMSIILR),
1093 GPIO_FN(FMSOIBT), GPIO_FN(PORT54_IRDA_FIRSEL), GPIO_FN(TPU3TO2),
1094 GPIO_FN(FMSIIBT),
1095 GPIO_FN(FMSISLD), GPIO_FN(MFG0_OUT1), GPIO_FN(TPU0TO0),
1096 GPIO_FN(A0_EA0), GPIO_FN(BS),
1097 GPIO_FN(A12_EA12), GPIO_FN(PORT58_VIO_CKOR), GPIO_FN(TPU4TO2),
1098 GPIO_FN(A13_EA13), GPIO_FN(PORT59_IROUT), GPIO_FN(MFG0_OUT2),
1099 GPIO_FN(TPU0TO1),
1100 GPIO_FN(A14_EA14), GPIO_FN(PORT60_KEYOUT5),
1101 GPIO_FN(A15_EA15), GPIO_FN(PORT61_KEYOUT4),
1102 GPIO_FN(A16_EA16), GPIO_FN(PORT62_KEYOUT3), GPIO_FN(MSIOF0_SS1),
1103 GPIO_FN(A17_EA17), GPIO_FN(PORT63_KEYOUT2), GPIO_FN(MSIOF0_TSYNC),
1104 GPIO_FN(A18_EA18), GPIO_FN(PORT64_KEYOUT1), GPIO_FN(MSIOF0_TSCK),
1105 GPIO_FN(A19_EA19), GPIO_FN(PORT65_KEYOUT0), GPIO_FN(MSIOF0_TXD),
1106 GPIO_FN(A20_EA20), GPIO_FN(PORT66_KEYIN0), GPIO_FN(MSIOF0_RSCK),
1107 GPIO_FN(A21_EA21), GPIO_FN(PORT67_KEYIN1), GPIO_FN(MSIOF0_RSYNC),
1108 GPIO_FN(A22_EA22), GPIO_FN(PORT68_KEYIN2), GPIO_FN(MSIOF0_MCK0),
1109 GPIO_FN(A23_EA23), GPIO_FN(PORT69_KEYIN3), GPIO_FN(MSIOF0_MCK1),
1110 GPIO_FN(A24_EA24), GPIO_FN(PORT70_KEYIN4), GPIO_FN(MSIOF0_RXD),
1111 GPIO_FN(A25_EA25), GPIO_FN(PORT71_KEYIN5), GPIO_FN(MSIOF0_SS2),
1112 GPIO_FN(A26), GPIO_FN(PORT72_KEYIN6),
1113 GPIO_FN(D0_ED0_NAF0),
1114 GPIO_FN(D1_ED1_NAF1),
1115 GPIO_FN(D2_ED2_NAF2),
1116 GPIO_FN(D3_ED3_NAF3),
1117 GPIO_FN(D4_ED4_NAF4),
1118 GPIO_FN(D5_ED5_NAF5),
1119 GPIO_FN(D6_ED6_NAF6),
1120 GPIO_FN(D7_ED7_NAF7),
1121 GPIO_FN(D8_ED8_NAF8),
1122 GPIO_FN(D9_ED9_NAF9),
1123 GPIO_FN(D10_ED10_NAF10),
1124 GPIO_FN(D11_ED11_NAF11),
1125 GPIO_FN(D12_ED12_NAF12),
1126 GPIO_FN(D13_ED13_NAF13),
1127 GPIO_FN(D14_ED14_NAF14),
1128 GPIO_FN(D15_ED15_NAF15),
1129 GPIO_FN(CS4),
1130 GPIO_FN(CS5A), GPIO_FN(FMSICK),
1131
1132 /* 55-3 (FN) */
1133 GPIO_FN(CS5B), GPIO_FN(FCE1),
1134 GPIO_FN(CS6B), GPIO_FN(XCS2), GPIO_FN(CS6A), GPIO_FN(DACK0),
1135 GPIO_FN(FCE0),
1136 GPIO_FN(WAIT), GPIO_FN(DREQ0),
1137 GPIO_FN(RD_XRD),
1138 GPIO_FN(WE0_XWR0_FWE),
1139 GPIO_FN(WE1_XWR1),
1140 GPIO_FN(FRB),
1141 GPIO_FN(CKO),
1142 GPIO_FN(NBRSTOUT),
1143 GPIO_FN(NBRST),
1144 GPIO_FN(GPS_EPPSIN),
1145 GPIO_FN(LATCHPULSE),
1146 GPIO_FN(LTESIGNAL),
1147 GPIO_FN(LEGACYSTATE),
1148 GPIO_FN(TCKON),
1149 GPIO_FN(VIO_VD), GPIO_FN(PORT128_KEYOUT0), GPIO_FN(IPORT0),
1150 GPIO_FN(VIO_HD), GPIO_FN(PORT129_KEYOUT1), GPIO_FN(IPORT1),
1151 GPIO_FN(VIO_D0), GPIO_FN(PORT130_KEYOUT2), GPIO_FN(PORT130_MSIOF2_RXD),
1152 GPIO_FN(VIO_D1), GPIO_FN(PORT131_KEYOUT3), GPIO_FN(PORT131_MSIOF2_SS1),
1153 GPIO_FN(VIO_D2), GPIO_FN(PORT132_KEYOUT4), GPIO_FN(PORT132_MSIOF2_SS2),
1154 GPIO_FN(VIO_D3), GPIO_FN(PORT133_KEYOUT5),
1155 GPIO_FN(PORT133_MSIOF2_TSYNC),
1156 GPIO_FN(VIO_D4), GPIO_FN(PORT134_KEYIN0), GPIO_FN(PORT134_MSIOF2_TXD),
1157 GPIO_FN(VIO_D5), GPIO_FN(PORT135_KEYIN1), GPIO_FN(PORT135_MSIOF2_TSCK),
1158 GPIO_FN(VIO_D6), GPIO_FN(PORT136_KEYIN2),
1159 GPIO_FN(VIO_D7), GPIO_FN(PORT137_KEYIN3),
1160 GPIO_FN(VIO_D8), GPIO_FN(M9_SLCD_A01), GPIO_FN(PORT138_FSIAOMC),
1161 GPIO_FN(VIO_D9), GPIO_FN(M10_SLCD_CK1), GPIO_FN(PORT139_FSIAOLR),
1162 GPIO_FN(VIO_D10), GPIO_FN(M11_SLCD_SO1), GPIO_FN(TPU0TO2),
1163 GPIO_FN(PORT140_FSIAOBT),
1164 GPIO_FN(VIO_D11), GPIO_FN(M12_SLCD_CE1), GPIO_FN(TPU0TO3),
1165 GPIO_FN(PORT141_FSIAOSLD),
1166 GPIO_FN(VIO_D12), GPIO_FN(M13_BSW), GPIO_FN(PORT142_FSIACK),
1167 GPIO_FN(VIO_D13), GPIO_FN(M14_GSW), GPIO_FN(PORT143_FSIAILR),
1168 GPIO_FN(VIO_D14), GPIO_FN(M15_RSW), GPIO_FN(PORT144_FSIAIBT),
1169 GPIO_FN(VIO_D15), GPIO_FN(TPU1TO3), GPIO_FN(PORT145_FSIAISLD),
1170 GPIO_FN(VIO_CLK), GPIO_FN(PORT146_KEYIN4), GPIO_FN(IPORT2),
1171 GPIO_FN(VIO_FIELD), GPIO_FN(PORT147_KEYIN5),
1172 GPIO_FN(VIO_CKO), GPIO_FN(PORT148_KEYIN6),
1173 GPIO_FN(A27), GPIO_FN(RDWR_XWE), GPIO_FN(MFG0_IN1),
1174 GPIO_FN(MFG0_IN2),
1175 GPIO_FN(TS_SPSYNC3), GPIO_FN(MSIOF2_RSCK),
1176 GPIO_FN(TS_SDAT3), GPIO_FN(MSIOF2_RSYNC),
1177 GPIO_FN(TPU1TO2), GPIO_FN(TS_SDEN3), GPIO_FN(PORT153_MSIOF2_SS1),
1178 GPIO_FN(SOUT3), GPIO_FN(SCIFA2_TXD1), GPIO_FN(MSIOF2_MCK0),
1179 GPIO_FN(SIN3), GPIO_FN(SCIFA2_RXD1), GPIO_FN(MSIOF2_MCK1),
1180 GPIO_FN(XRTS3), GPIO_FN(SCIFA2_RTS1), GPIO_FN(PORT156_MSIOF2_SS2),
1181 GPIO_FN(XCTS3), GPIO_FN(SCIFA2_CTS1), GPIO_FN(PORT157_MSIOF2_RXD),
1182
1183 /* 55-4 (FN) */
1184 GPIO_FN(DINT), GPIO_FN(SCIFA2_SCK1), GPIO_FN(TS_SCK3),
1185 GPIO_FN(PORT159_SCIFB_SCK), GPIO_FN(PORT159_SCIFA5_SCK), GPIO_FN(NMI),
1186 GPIO_FN(PORT160_SCIFB_TXD), GPIO_FN(PORT160_SCIFA5_TXD), GPIO_FN(SOUT0),
1187 GPIO_FN(PORT161_SCIFB_CTS), GPIO_FN(PORT161_SCIFA5_CTS), GPIO_FN(XCTS0),
1188 GPIO_FN(MFG3_IN2),
1189 GPIO_FN(PORT162_SCIFB_RXD), GPIO_FN(PORT162_SCIFA5_RXD), GPIO_FN(SIN0),
1190 GPIO_FN(MFG3_IN1),
1191 GPIO_FN(PORT163_SCIFB_RTS), GPIO_FN(PORT163_SCIFA5_RTS), GPIO_FN(XRTS0),
1192 GPIO_FN(MFG3_OUT1), GPIO_FN(TPU3TO0),
1193 GPIO_FN(LCDD0), GPIO_FN(PORT192_KEYOUT0), GPIO_FN(EXT_CKI),
1194 GPIO_FN(LCDD1), GPIO_FN(PORT193_KEYOUT1), GPIO_FN(PORT193_SCIFA5_CTS),
1195 GPIO_FN(BBIF2_TSYNC1),
1196 GPIO_FN(LCDD2), GPIO_FN(PORT194_KEYOUT2), GPIO_FN(PORT194_SCIFA5_RTS),
1197 GPIO_FN(BBIF2_TSCK1),
1198 GPIO_FN(LCDD3), GPIO_FN(PORT195_KEYOUT3), GPIO_FN(PORT195_SCIFA5_RXD),
1199 GPIO_FN(BBIF2_TXD1),
1200 GPIO_FN(LCDD4), GPIO_FN(PORT196_KEYOUT4), GPIO_FN(PORT196_SCIFA5_TXD),
1201 GPIO_FN(LCDD5), GPIO_FN(PORT197_KEYOUT5), GPIO_FN(PORT197_SCIFA5_SCK),
1202 GPIO_FN(MFG2_OUT2),
1203 GPIO_FN(LCDD6),
1204 GPIO_FN(LCDD7), GPIO_FN(TPU4TO1), GPIO_FN(MFG4_OUT2),
1205 GPIO_FN(LCDD8), GPIO_FN(PORT200_KEYIN0), GPIO_FN(VIO_DR0),
1206 GPIO_FN(D16),
1207 GPIO_FN(LCDD9), GPIO_FN(PORT201_KEYIN1), GPIO_FN(VIO_DR1),
1208 GPIO_FN(D17),
1209 GPIO_FN(LCDD10), GPIO_FN(PORT202_KEYIN2), GPIO_FN(VIO_DR2),
1210 GPIO_FN(D18),
1211 GPIO_FN(LCDD11), GPIO_FN(PORT203_KEYIN3), GPIO_FN(VIO_DR3),
1212 GPIO_FN(D19),
1213 GPIO_FN(LCDD12), GPIO_FN(PORT204_KEYIN4), GPIO_FN(VIO_DR4),
1214 GPIO_FN(D20),
1215 GPIO_FN(LCDD13), GPIO_FN(PORT205_KEYIN5), GPIO_FN(VIO_DR5),
1216 GPIO_FN(D21),
1217 GPIO_FN(LCDD14), GPIO_FN(PORT206_KEYIN6), GPIO_FN(VIO_DR6),
1218 GPIO_FN(D22),
1219 GPIO_FN(LCDD15), GPIO_FN(PORT207_MSIOF0L_SS1), GPIO_FN(PORT207_KEYOUT0),
1220 GPIO_FN(VIO_DR7), GPIO_FN(D23),
1221 GPIO_FN(LCDD16), GPIO_FN(PORT208_MSIOF0L_SS2), GPIO_FN(PORT208_KEYOUT1),
1222 GPIO_FN(VIO_VDR), GPIO_FN(D24),
1223 GPIO_FN(LCDD17), GPIO_FN(PORT209_KEYOUT2), GPIO_FN(VIO_HDR),
1224 GPIO_FN(D25),
1225 GPIO_FN(LCDD18), GPIO_FN(DREQ2), GPIO_FN(PORT210_MSIOF0L_SS1),
1226 GPIO_FN(D26),
1227 GPIO_FN(LCDD19), GPIO_FN(PORT211_MSIOF0L_SS2), GPIO_FN(D27),
1228 GPIO_FN(LCDD20), GPIO_FN(TS_SPSYNC1), GPIO_FN(MSIOF0L_MCK0),
1229 GPIO_FN(D28),
1230 GPIO_FN(LCDD21), GPIO_FN(TS_SDAT1), GPIO_FN(MSIOF0L_MCK1),
1231 GPIO_FN(D29),
1232 GPIO_FN(LCDD22), GPIO_FN(TS_SDEN1), GPIO_FN(MSIOF0L_RSCK),
1233 GPIO_FN(D30),
1234 GPIO_FN(LCDD23), GPIO_FN(TS_SCK1), GPIO_FN(MSIOF0L_RSYNC),
1235 GPIO_FN(D31),
1236 GPIO_FN(LCDDCK), GPIO_FN(LCDWR), GPIO_FN(PORT216_KEYOUT3),
1237 GPIO_FN(VIO_CLKR),
1238 GPIO_FN(LCDRD), GPIO_FN(DACK2), GPIO_FN(MSIOF0L_TSYNC),
1239 GPIO_FN(LCDHSYN), GPIO_FN(LCDCS), GPIO_FN(LCDCS2), GPIO_FN(DACK3),
1240 GPIO_FN(PORT218_VIO_CKOR), GPIO_FN(PORT218_KEYOUT4),
1241 GPIO_FN(LCDDISP), GPIO_FN(LCDRS), GPIO_FN(DREQ3), GPIO_FN(MSIOF0L_TSCK),
1242 GPIO_FN(LCDVSYN), GPIO_FN(LCDVSYN2), GPIO_FN(PORT220_KEYOUT5),
1243 GPIO_FN(LCDLCLK), GPIO_FN(DREQ1), GPIO_FN(PWEN), GPIO_FN(MSIOF0L_RXD),
1244 GPIO_FN(LCDDON), GPIO_FN(LCDDON2), GPIO_FN(DACK1), GPIO_FN(OVCN),
1245 GPIO_FN(MSIOF0L_TXD),
1246 GPIO_FN(SCIFA1_TXD), GPIO_FN(OVCN2),
1247 GPIO_FN(EXTLP), GPIO_FN(SCIFA1_SCK), GPIO_FN(USBTERM),
1248 GPIO_FN(PORT226_VIO_CKO2),
1249 GPIO_FN(SCIFA1_RTS), GPIO_FN(IDIN),
1250 GPIO_FN(SCIFA1_RXD),
1251 GPIO_FN(SCIFA1_CTS), GPIO_FN(MFG1_IN1),
1252 GPIO_FN(MSIOF1_TXD), GPIO_FN(SCIFA2_TXD2), GPIO_FN(PORT230_FSIAOMC),
1253 GPIO_FN(MSIOF1_TSYNC), GPIO_FN(SCIFA2_CTS2), GPIO_FN(PORT231_FSIAOLR),
1254 GPIO_FN(MSIOF1_TSCK), GPIO_FN(SCIFA2_SCK2), GPIO_FN(PORT232_FSIAOBT),
1255 GPIO_FN(MSIOF1_RXD), GPIO_FN(SCIFA2_RXD2), GPIO_FN(GPS_VCOTRIG),
1256 GPIO_FN(PORT233_FSIACK),
1257 GPIO_FN(MSIOF1_RSCK), GPIO_FN(SCIFA2_RTS2), GPIO_FN(PORT234_FSIAOSLD),
1258 GPIO_FN(MSIOF1_RSYNC), GPIO_FN(OPORT0), GPIO_FN(MFG1_IN2),
1259 GPIO_FN(PORT235_FSIAILR),
1260 GPIO_FN(MSIOF1_MCK0), GPIO_FN(I2C_SDA2), GPIO_FN(PORT236_FSIAIBT),
1261 GPIO_FN(MSIOF1_MCK1), GPIO_FN(I2C_SCL2), GPIO_FN(PORT237_FSIAISLD),
1262 GPIO_FN(MSIOF1_SS1), GPIO_FN(EDBGREQ3),
1263
1264 /* 55-5 (FN) */
1265 GPIO_FN(MSIOF1_SS2),
1266 GPIO_FN(SCIFA6_TXD),
1267 GPIO_FN(PORT241_IRDA_OUT), GPIO_FN(PORT241_IROUT), GPIO_FN(MFG4_OUT1),
1268 GPIO_FN(TPU4TO0),
1269 GPIO_FN(PORT242_IRDA_IN), GPIO_FN(MFG4_IN2),
1270 GPIO_FN(PORT243_IRDA_FIRSEL), GPIO_FN(PORT243_VIO_CKO2),
1271 GPIO_FN(PORT244_SCIFA5_CTS), GPIO_FN(MFG2_IN1),
1272 GPIO_FN(PORT244_SCIFB_CTS),
1273 GPIO_FN(PORT245_SCIFA5_RTS), GPIO_FN(MFG2_IN2),
1274 GPIO_FN(PORT245_SCIFB_RTS),
1275 GPIO_FN(PORT246_SCIFA5_RXD), GPIO_FN(MFG1_OUT1),
1276 GPIO_FN(PORT246_SCIFB_RXD), GPIO_FN(TPU1TO0),
1277 GPIO_FN(PORT247_SCIFA5_TXD), GPIO_FN(MFG3_OUT2),
1278 GPIO_FN(PORT247_SCIFB_TXD), GPIO_FN(TPU3TO1),
1279 GPIO_FN(PORT248_SCIFA5_SCK), GPIO_FN(MFG2_OUT1),
1280 GPIO_FN(PORT248_SCIFB_SCK), GPIO_FN(TPU2TO0),
1281 GPIO_FN(PORT249_IROUT), GPIO_FN(MFG4_IN1),
1282 GPIO_FN(SDHICLK0), GPIO_FN(TCK2_SWCLK_MC0),
1283 GPIO_FN(SDHICD0),
1284 GPIO_FN(SDHID0_0), GPIO_FN(TMS2_SWDIO_MC0),
1285 GPIO_FN(SDHID0_1), GPIO_FN(TDO2_SWO0_MC0),
1286 GPIO_FN(SDHID0_2), GPIO_FN(TDI2),
1287 GPIO_FN(SDHID0_3), GPIO_FN(RTCK2_SWO1_MC0),
1288 GPIO_FN(SDHICMD0), GPIO_FN(TRST2),
1289 GPIO_FN(SDHIWP0), GPIO_FN(EDBGREQ2),
1290 GPIO_FN(SDHICLK1), GPIO_FN(TCK3_SWCLK_MC1),
1291 GPIO_FN(SDHID1_0), GPIO_FN(M11_SLCD_SO2), GPIO_FN(TS_SPSYNC2),
1292 GPIO_FN(TMS3_SWDIO_MC1),
1293 GPIO_FN(SDHID1_1), GPIO_FN(M9_SLCD_A02), GPIO_FN(TS_SDAT2),
1294 GPIO_FN(TDO3_SWO0_MC1),
1295 GPIO_FN(SDHID1_2), GPIO_FN(M10_SLCD_CK2), GPIO_FN(TS_SDEN2),
1296 GPIO_FN(TDI3),
1297 GPIO_FN(SDHID1_3), GPIO_FN(M12_SLCD_CE2), GPIO_FN(TS_SCK2),
1298 GPIO_FN(RTCK3_SWO1_MC1),
1299 GPIO_FN(SDHICMD1), GPIO_FN(TRST3),
1300 GPIO_FN(RESETOUTS),
1301};
1302
1303static struct pinmux_cfg_reg pinmux_config_regs[] = {
1304 PORTCR(0, 0xe6050000), /* PORT0CR */
1305 PORTCR(1, 0xe6050001), /* PORT1CR */
1306 PORTCR(2, 0xe6050002), /* PORT2CR */
1307 PORTCR(3, 0xe6050003), /* PORT3CR */
1308 PORTCR(4, 0xe6050004), /* PORT4CR */
1309 PORTCR(5, 0xe6050005), /* PORT5CR */
1310 PORTCR(6, 0xe6050006), /* PORT6CR */
1311 PORTCR(7, 0xe6050007), /* PORT7CR */
1312 PORTCR(8, 0xe6050008), /* PORT8CR */
1313 PORTCR(9, 0xe6050009), /* PORT9CR */
1314
1315 PORTCR(10, 0xe605000a), /* PORT10CR */
1316 PORTCR(11, 0xe605000b), /* PORT11CR */
1317 PORTCR(12, 0xe605000c), /* PORT12CR */
1318 PORTCR(13, 0xe605000d), /* PORT13CR */
1319 PORTCR(14, 0xe605000e), /* PORT14CR */
1320 PORTCR(15, 0xe605000f), /* PORT15CR */
1321 PORTCR(16, 0xe6050010), /* PORT16CR */
1322 PORTCR(17, 0xe6050011), /* PORT17CR */
1323 PORTCR(18, 0xe6050012), /* PORT18CR */
1324 PORTCR(19, 0xe6050013), /* PORT19CR */
1325
1326 PORTCR(20, 0xe6050014), /* PORT20CR */
1327 PORTCR(21, 0xe6050015), /* PORT21CR */
1328 PORTCR(22, 0xe6050016), /* PORT22CR */
1329 PORTCR(23, 0xe6050017), /* PORT23CR */
1330 PORTCR(24, 0xe6050018), /* PORT24CR */
1331 PORTCR(25, 0xe6050019), /* PORT25CR */
1332 PORTCR(26, 0xe605001a), /* PORT26CR */
1333 PORTCR(27, 0xe605001b), /* PORT27CR */
1334 PORTCR(28, 0xe605001c), /* PORT28CR */
1335 PORTCR(29, 0xe605001d), /* PORT29CR */
1336
1337 PORTCR(30, 0xe605001e), /* PORT30CR */
1338 PORTCR(31, 0xe605001f), /* PORT31CR */
1339 PORTCR(32, 0xe6050020), /* PORT32CR */
1340 PORTCR(33, 0xe6050021), /* PORT33CR */
1341 PORTCR(34, 0xe6050022), /* PORT34CR */
1342 PORTCR(35, 0xe6050023), /* PORT35CR */
1343 PORTCR(36, 0xe6050024), /* PORT36CR */
1344 PORTCR(37, 0xe6050025), /* PORT37CR */
1345 PORTCR(38, 0xe6050026), /* PORT38CR */
1346 PORTCR(39, 0xe6050027), /* PORT39CR */
1347
1348 PORTCR(40, 0xe6050028), /* PORT40CR */
1349 PORTCR(41, 0xe6050029), /* PORT41CR */
1350 PORTCR(42, 0xe605002a), /* PORT42CR */
1351 PORTCR(43, 0xe605002b), /* PORT43CR */
1352 PORTCR(44, 0xe605002c), /* PORT44CR */
1353 PORTCR(45, 0xe605002d), /* PORT45CR */
1354 PORTCR(46, 0xe605002e), /* PORT46CR */
1355 PORTCR(47, 0xe605002f), /* PORT47CR */
1356 PORTCR(48, 0xe6050030), /* PORT48CR */
1357 PORTCR(49, 0xe6050031), /* PORT49CR */
1358
1359 PORTCR(50, 0xe6050032), /* PORT50CR */
1360 PORTCR(51, 0xe6050033), /* PORT51CR */
1361 PORTCR(52, 0xe6050034), /* PORT52CR */
1362 PORTCR(53, 0xe6050035), /* PORT53CR */
1363 PORTCR(54, 0xe6050036), /* PORT54CR */
1364 PORTCR(55, 0xe6050037), /* PORT55CR */
1365 PORTCR(56, 0xe6050038), /* PORT56CR */
1366 PORTCR(57, 0xe6050039), /* PORT57CR */
1367 PORTCR(58, 0xe605003a), /* PORT58CR */
1368 PORTCR(59, 0xe605003b), /* PORT59CR */
1369
1370 PORTCR(60, 0xe605003c), /* PORT60CR */
1371 PORTCR(61, 0xe605003d), /* PORT61CR */
1372 PORTCR(62, 0xe605003e), /* PORT62CR */
1373 PORTCR(63, 0xe605003f), /* PORT63CR */
1374 PORTCR(64, 0xe6050040), /* PORT64CR */
1375 PORTCR(65, 0xe6050041), /* PORT65CR */
1376 PORTCR(66, 0xe6050042), /* PORT66CR */
1377 PORTCR(67, 0xe6050043), /* PORT67CR */
1378 PORTCR(68, 0xe6050044), /* PORT68CR */
1379 PORTCR(69, 0xe6050045), /* PORT69CR */
1380
1381 PORTCR(70, 0xe6050046), /* PORT70CR */
1382 PORTCR(71, 0xe6050047), /* PORT71CR */
1383 PORTCR(72, 0xe6050048), /* PORT72CR */
1384 PORTCR(73, 0xe6050049), /* PORT73CR */
1385 PORTCR(74, 0xe605004a), /* PORT74CR */
1386 PORTCR(75, 0xe605004b), /* PORT75CR */
1387 PORTCR(76, 0xe605004c), /* PORT76CR */
1388 PORTCR(77, 0xe605004d), /* PORT77CR */
1389 PORTCR(78, 0xe605004e), /* PORT78CR */
1390 PORTCR(79, 0xe605004f), /* PORT79CR */
1391
1392 PORTCR(80, 0xe6050050), /* PORT80CR */
1393 PORTCR(81, 0xe6050051), /* PORT81CR */
1394 PORTCR(82, 0xe6050052), /* PORT82CR */
1395 PORTCR(83, 0xe6050053), /* PORT83CR */
1396 PORTCR(84, 0xe6050054), /* PORT84CR */
1397 PORTCR(85, 0xe6050055), /* PORT85CR */
1398 PORTCR(86, 0xe6050056), /* PORT86CR */
1399 PORTCR(87, 0xe6050057), /* PORT87CR */
1400 PORTCR(88, 0xe6050058), /* PORT88CR */
1401 PORTCR(89, 0xe6050059), /* PORT89CR */
1402
1403 PORTCR(90, 0xe605005a), /* PORT90CR */
1404 PORTCR(91, 0xe605005b), /* PORT91CR */
1405 PORTCR(92, 0xe605005c), /* PORT92CR */
1406 PORTCR(93, 0xe605005d), /* PORT93CR */
1407 PORTCR(94, 0xe605005e), /* PORT94CR */
1408 PORTCR(95, 0xe605005f), /* PORT95CR */
1409 PORTCR(96, 0xe6050060), /* PORT96CR */
1410 PORTCR(97, 0xe6050061), /* PORT97CR */
1411 PORTCR(98, 0xe6050062), /* PORT98CR */
1412 PORTCR(99, 0xe6050063), /* PORT99CR */
1413
1414 PORTCR(100, 0xe6050064), /* PORT100CR */
1415 PORTCR(101, 0xe6050065), /* PORT101CR */
1416 PORTCR(102, 0xe6050066), /* PORT102CR */
1417 PORTCR(103, 0xe6050067), /* PORT103CR */
1418 PORTCR(104, 0xe6050068), /* PORT104CR */
1419 PORTCR(105, 0xe6050069), /* PORT105CR */
1420 PORTCR(106, 0xe605006a), /* PORT106CR */
1421 PORTCR(107, 0xe605006b), /* PORT107CR */
1422 PORTCR(108, 0xe605006c), /* PORT108CR */
1423 PORTCR(109, 0xe605006d), /* PORT109CR */
1424
1425 PORTCR(110, 0xe605006e), /* PORT110CR */
1426 PORTCR(111, 0xe605006f), /* PORT111CR */
1427 PORTCR(112, 0xe6050070), /* PORT112CR */
1428 PORTCR(113, 0xe6050071), /* PORT113CR */
1429 PORTCR(114, 0xe6050072), /* PORT114CR */
1430 PORTCR(115, 0xe6050073), /* PORT115CR */
1431 PORTCR(116, 0xe6050074), /* PORT116CR */
1432 PORTCR(117, 0xe6050075), /* PORT117CR */
1433 PORTCR(118, 0xe6050076), /* PORT118CR */
1434
1435 PORTCR(128, 0xe6051080), /* PORT128CR */
1436 PORTCR(129, 0xe6051081), /* PORT129CR */
1437
1438 PORTCR(130, 0xe6051082), /* PORT130CR */
1439 PORTCR(131, 0xe6051083), /* PORT131CR */
1440 PORTCR(132, 0xe6051084), /* PORT132CR */
1441 PORTCR(133, 0xe6051085), /* PORT133CR */
1442 PORTCR(134, 0xe6051086), /* PORT134CR */
1443 PORTCR(135, 0xe6051087), /* PORT135CR */
1444 PORTCR(136, 0xe6051088), /* PORT136CR */
1445 PORTCR(137, 0xe6051089), /* PORT137CR */
1446 PORTCR(138, 0xe605108a), /* PORT138CR */
1447 PORTCR(139, 0xe605108b), /* PORT139CR */
1448
1449 PORTCR(140, 0xe605108c), /* PORT140CR */
1450 PORTCR(141, 0xe605108d), /* PORT141CR */
1451 PORTCR(142, 0xe605108e), /* PORT142CR */
1452 PORTCR(143, 0xe605108f), /* PORT143CR */
1453 PORTCR(144, 0xe6051090), /* PORT144CR */
1454 PORTCR(145, 0xe6051091), /* PORT145CR */
1455 PORTCR(146, 0xe6051092), /* PORT146CR */
1456 PORTCR(147, 0xe6051093), /* PORT147CR */
1457 PORTCR(148, 0xe6051094), /* PORT148CR */
1458 PORTCR(149, 0xe6051095), /* PORT149CR */
1459
1460 PORTCR(150, 0xe6051096), /* PORT150CR */
1461 PORTCR(151, 0xe6051097), /* PORT151CR */
1462 PORTCR(152, 0xe6051098), /* PORT152CR */
1463 PORTCR(153, 0xe6051099), /* PORT153CR */
1464 PORTCR(154, 0xe605109a), /* PORT154CR */
1465 PORTCR(155, 0xe605109b), /* PORT155CR */
1466 PORTCR(156, 0xe605109c), /* PORT156CR */
1467 PORTCR(157, 0xe605109d), /* PORT157CR */
1468 PORTCR(158, 0xe605109e), /* PORT158CR */
1469 PORTCR(159, 0xe605109f), /* PORT159CR */
1470
1471 PORTCR(160, 0xe60510a0), /* PORT160CR */
1472 PORTCR(161, 0xe60510a1), /* PORT161CR */
1473 PORTCR(162, 0xe60510a2), /* PORT162CR */
1474 PORTCR(163, 0xe60510a3), /* PORT163CR */
1475 PORTCR(164, 0xe60510a4), /* PORT164CR */
1476
1477 PORTCR(192, 0xe60520c0), /* PORT192CR */
1478 PORTCR(193, 0xe60520c1), /* PORT193CR */
1479 PORTCR(194, 0xe60520c2), /* PORT194CR */
1480 PORTCR(195, 0xe60520c3), /* PORT195CR */
1481 PORTCR(196, 0xe60520c4), /* PORT196CR */
1482 PORTCR(197, 0xe60520c5), /* PORT197CR */
1483 PORTCR(198, 0xe60520c6), /* PORT198CR */
1484 PORTCR(199, 0xe60520c7), /* PORT199CR */
1485
1486 PORTCR(200, 0xe60520c8), /* PORT200CR */
1487 PORTCR(201, 0xe60520c9), /* PORT201CR */
1488 PORTCR(202, 0xe60520ca), /* PORT202CR */
1489 PORTCR(203, 0xe60520cb), /* PORT203CR */
1490 PORTCR(204, 0xe60520cc), /* PORT204CR */
1491 PORTCR(205, 0xe60520cd), /* PORT205CR */
1492 PORTCR(206, 0xe60520ce), /* PORT206CR */
1493 PORTCR(207, 0xe60520cf), /* PORT207CR */
1494 PORTCR(208, 0xe60520d0), /* PORT208CR */
1495 PORTCR(209, 0xe60520d1), /* PORT209CR */
1496
1497 PORTCR(210, 0xe60520d2), /* PORT210CR */
1498 PORTCR(211, 0xe60520d3), /* PORT211CR */
1499 PORTCR(212, 0xe60520d4), /* PORT212CR */
1500 PORTCR(213, 0xe60520d5), /* PORT213CR */
1501 PORTCR(214, 0xe60520d6), /* PORT214CR */
1502 PORTCR(215, 0xe60520d7), /* PORT215CR */
1503 PORTCR(216, 0xe60520d8), /* PORT216CR */
1504 PORTCR(217, 0xe60520d9), /* PORT217CR */
1505 PORTCR(218, 0xe60520da), /* PORT218CR */
1506 PORTCR(219, 0xe60520db), /* PORT219CR */
1507
1508 PORTCR(220, 0xe60520dc), /* PORT220CR */
1509 PORTCR(221, 0xe60520dd), /* PORT221CR */
1510 PORTCR(222, 0xe60520de), /* PORT222CR */
1511 PORTCR(223, 0xe60520df), /* PORT223CR */
1512 PORTCR(224, 0xe60520e0), /* PORT224CR */
1513 PORTCR(225, 0xe60520e1), /* PORT225CR */
1514 PORTCR(226, 0xe60520e2), /* PORT226CR */
1515 PORTCR(227, 0xe60520e3), /* PORT227CR */
1516 PORTCR(228, 0xe60520e4), /* PORT228CR */
1517 PORTCR(229, 0xe60520e5), /* PORT229CR */
1518
1519 PORTCR(230, 0xe60520e6), /* PORT230CR */
1520 PORTCR(231, 0xe60520e7), /* PORT231CR */
1521 PORTCR(232, 0xe60520e8), /* PORT232CR */
1522 PORTCR(233, 0xe60520e9), /* PORT233CR */
1523 PORTCR(234, 0xe60520ea), /* PORT234CR */
1524 PORTCR(235, 0xe60520eb), /* PORT235CR */
1525 PORTCR(236, 0xe60520ec), /* PORT236CR */
1526 PORTCR(237, 0xe60520ed), /* PORT237CR */
1527 PORTCR(238, 0xe60520ee), /* PORT238CR */
1528 PORTCR(239, 0xe60520ef), /* PORT239CR */
1529
1530 PORTCR(240, 0xe60520f0), /* PORT240CR */
1531 PORTCR(241, 0xe60520f1), /* PORT241CR */
1532 PORTCR(242, 0xe60520f2), /* PORT242CR */
1533 PORTCR(243, 0xe60520f3), /* PORT243CR */
1534 PORTCR(244, 0xe60520f4), /* PORT244CR */
1535 PORTCR(245, 0xe60520f5), /* PORT245CR */
1536 PORTCR(246, 0xe60520f6), /* PORT246CR */
1537 PORTCR(247, 0xe60520f7), /* PORT247CR */
1538 PORTCR(248, 0xe60520f8), /* PORT248CR */
1539 PORTCR(249, 0xe60520f9), /* PORT249CR */
1540
1541 PORTCR(250, 0xe60520fa), /* PORT250CR */
1542 PORTCR(251, 0xe60520fb), /* PORT251CR */
1543 PORTCR(252, 0xe60520fc), /* PORT252CR */
1544 PORTCR(253, 0xe60520fd), /* PORT253CR */
1545 PORTCR(254, 0xe60520fe), /* PORT254CR */
1546 PORTCR(255, 0xe60520ff), /* PORT255CR */
1547 PORTCR(256, 0xe6052100), /* PORT256CR */
1548 PORTCR(257, 0xe6052101), /* PORT257CR */
1549 PORTCR(258, 0xe6052102), /* PORT258CR */
1550 PORTCR(259, 0xe6052103), /* PORT259CR */
1551
1552 PORTCR(260, 0xe6052104), /* PORT260CR */
1553 PORTCR(261, 0xe6052105), /* PORT261CR */
1554 PORTCR(262, 0xe6052106), /* PORT262CR */
1555 PORTCR(263, 0xe6052107), /* PORT263CR */
1556 PORTCR(264, 0xe6052108), /* PORT264CR */
1557
1558 { PINMUX_CFG_REG("MSELBCR", 0xe6058024, 32, 1) {
1559 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1560 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1561 MSELBCR_MSEL17_0, MSELBCR_MSEL17_1,
1562 MSELBCR_MSEL16_0, MSELBCR_MSEL16_1,
1563 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1564 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
1565 },
1566 { },
1567};
1568
1569static struct pinmux_data_reg pinmux_data_regs[] = {
1570 { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054000, 32) {
1571 PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA,
1572 PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA,
1573 PORT23_DATA, PORT22_DATA, PORT21_DATA, PORT20_DATA,
1574 PORT19_DATA, PORT18_DATA, PORT17_DATA, PORT16_DATA,
1575 PORT15_DATA, PORT14_DATA, PORT13_DATA, PORT12_DATA,
1576 PORT11_DATA, PORT10_DATA, PORT9_DATA, PORT8_DATA,
1577 PORT7_DATA, PORT6_DATA, PORT5_DATA, PORT4_DATA,
1578 PORT3_DATA, PORT2_DATA, PORT1_DATA, PORT0_DATA }
1579 },
1580 { PINMUX_DATA_REG("PORTL063_032DR", 0xe6054004, 32) {
1581 PORT63_DATA, PORT62_DATA, PORT61_DATA, PORT60_DATA,
1582 PORT59_DATA, PORT58_DATA, PORT57_DATA, PORT56_DATA,
1583 PORT55_DATA, PORT54_DATA, PORT53_DATA, PORT52_DATA,
1584 PORT51_DATA, PORT50_DATA, PORT49_DATA, PORT48_DATA,
1585 PORT47_DATA, PORT46_DATA, PORT45_DATA, PORT44_DATA,
1586 PORT43_DATA, PORT42_DATA, PORT41_DATA, PORT40_DATA,
1587 PORT39_DATA, PORT38_DATA, PORT37_DATA, PORT36_DATA,
1588 PORT35_DATA, PORT34_DATA, PORT33_DATA, PORT32_DATA }
1589 },
1590 { PINMUX_DATA_REG("PORTL095_064DR", 0xe6054008, 32) {
1591 PORT95_DATA, PORT94_DATA, PORT93_DATA, PORT92_DATA,
1592 PORT91_DATA, PORT90_DATA, PORT89_DATA, PORT88_DATA,
1593 PORT87_DATA, PORT86_DATA, PORT85_DATA, PORT84_DATA,
1594 PORT83_DATA, PORT82_DATA, PORT81_DATA, PORT80_DATA,
1595 PORT79_DATA, PORT78_DATA, PORT77_DATA, PORT76_DATA,
1596 PORT75_DATA, PORT74_DATA, PORT73_DATA, PORT72_DATA,
1597 PORT71_DATA, PORT70_DATA, PORT69_DATA, PORT68_DATA,
1598 PORT67_DATA, PORT66_DATA, PORT65_DATA, PORT64_DATA }
1599 },
1600 { PINMUX_DATA_REG("PORTD127_096DR", 0xe605400C, 32) {
1601 0, 0, 0, 0,
1602 0, 0, 0, 0,
1603 0, PORT118_DATA, PORT117_DATA, PORT116_DATA,
1604 PORT115_DATA, PORT114_DATA, PORT113_DATA, PORT112_DATA,
1605 PORT111_DATA, PORT110_DATA, PORT109_DATA, PORT108_DATA,
1606 PORT107_DATA, PORT106_DATA, PORT105_DATA, PORT104_DATA,
1607 PORT103_DATA, PORT102_DATA, PORT101_DATA, PORT100_DATA,
1608 PORT99_DATA, PORT98_DATA, PORT97_DATA, PORT96_DATA }
1609 },
1610 { PINMUX_DATA_REG("PORTD159_128DR", 0xe6055000, 32) {
1611 PORT159_DATA, PORT158_DATA, PORT157_DATA, PORT156_DATA,
1612 PORT155_DATA, PORT154_DATA, PORT153_DATA, PORT152_DATA,
1613 PORT151_DATA, PORT150_DATA, PORT149_DATA, PORT148_DATA,
1614 PORT147_DATA, PORT146_DATA, PORT145_DATA, PORT144_DATA,
1615 PORT143_DATA, PORT142_DATA, PORT141_DATA, PORT140_DATA,
1616 PORT139_DATA, PORT138_DATA, PORT137_DATA, PORT136_DATA,
1617 PORT135_DATA, PORT134_DATA, PORT133_DATA, PORT132_DATA,
1618 PORT131_DATA, PORT130_DATA, PORT129_DATA, PORT128_DATA }
1619 },
1620 { PINMUX_DATA_REG("PORTR191_160DR", 0xe6055004, 32) {
1621 0, 0, 0, 0,
1622 0, 0, 0, 0,
1623 0, 0, 0, 0,
1624 0, 0, 0, 0,
1625 0, 0, 0, 0,
1626 0, 0, 0, 0,
1627 0, 0, 0, PORT164_DATA,
1628 PORT163_DATA, PORT162_DATA, PORT161_DATA, PORT160_DATA }
1629 },
1630 { PINMUX_DATA_REG("PORTR223_192DR", 0xe6056000, 32) {
1631 PORT223_DATA, PORT222_DATA, PORT221_DATA, PORT220_DATA,
1632 PORT219_DATA, PORT218_DATA, PORT217_DATA, PORT216_DATA,
1633 PORT215_DATA, PORT214_DATA, PORT213_DATA, PORT212_DATA,
1634 PORT211_DATA, PORT210_DATA, PORT209_DATA, PORT208_DATA,
1635 PORT207_DATA, PORT206_DATA, PORT205_DATA, PORT204_DATA,
1636 PORT203_DATA, PORT202_DATA, PORT201_DATA, PORT200_DATA,
1637 PORT199_DATA, PORT198_DATA, PORT197_DATA, PORT196_DATA,
1638 PORT195_DATA, PORT194_DATA, PORT193_DATA, PORT192_DATA }
1639 },
1640 { PINMUX_DATA_REG("PORTU255_224DR", 0xe6056004, 32) {
1641 PORT255_DATA, PORT254_DATA, PORT253_DATA, PORT252_DATA,
1642 PORT251_DATA, PORT250_DATA, PORT249_DATA, PORT248_DATA,
1643 PORT247_DATA, PORT246_DATA, PORT245_DATA, PORT244_DATA,
1644 PORT243_DATA, PORT242_DATA, PORT241_DATA, PORT240_DATA,
1645 PORT239_DATA, PORT238_DATA, PORT237_DATA, PORT236_DATA,
1646 PORT235_DATA, PORT234_DATA, PORT233_DATA, PORT232_DATA,
1647 PORT231_DATA, PORT230_DATA, PORT229_DATA, PORT228_DATA,
1648 PORT227_DATA, PORT226_DATA, PORT225_DATA, PORT224_DATA }
1649 },
1650 { PINMUX_DATA_REG("PORTU287_256DR", 0xe6056008, 32) {
1651 0, 0, 0, 0,
1652 0, 0, 0, 0,
1653 0, 0, 0, 0,
1654 0, 0, 0, 0,
1655 0, 0, 0, 0,
1656 0, 0, 0, PORT264_DATA,
1657 PORT263_DATA, PORT262_DATA, PORT261_DATA, PORT260_DATA,
1658 PORT259_DATA, PORT258_DATA, PORT257_DATA, PORT256_DATA }
1659 },
1660 { },
1661};
1662
1663static struct pinmux_info sh7377_pinmux_info = {
1664 .name = "sh7377_pfc",
1665 .reserved_id = PINMUX_RESERVED,
1666 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1667 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1668 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1669 .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_END },
1670 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1671 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1672 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1673
1674 .first_gpio = GPIO_PORT0,
1675 .last_gpio = GPIO_FN_RESETOUTS,
1676
1677 .gpios = pinmux_gpios,
1678 .cfg_regs = pinmux_config_regs,
1679 .data_regs = pinmux_data_regs,
1680
1681 .gpio_data = pinmux_data,
1682 .gpio_data_size = ARRAY_SIZE(pinmux_data),
1683};
1684
1685void sh7377_pinmux_init(void)
1686{
1687 register_pinmux(&sh7377_pinmux_info);
1688}
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 11bb1d98419..095222469d0 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -66,12 +66,6 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
66void __init r8a7740_map_io(void) 66void __init r8a7740_map_io(void)
67{ 67{
68 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 68 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
69
70 /*
71 * DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
72 * enough to allocate the frame buffer memory.
73 */
74 init_consistent_dma_size(12 << 20);
75} 69}
76 70
77/* SCIFA0 */ 71/* SCIFA0 */
@@ -590,6 +584,21 @@ static struct platform_device i2c1_device = {
590 .num_resources = ARRAY_SIZE(i2c1_resources), 584 .num_resources = ARRAY_SIZE(i2c1_resources),
591}; 585};
592 586
587static struct resource pmu_resources[] = {
588 [0] = {
589 .start = evt2irq(0x19a0),
590 .end = evt2irq(0x19a0),
591 .flags = IORESOURCE_IRQ,
592 },
593};
594
595static struct platform_device pmu_device = {
596 .name = "arm-pmu",
597 .id = -1,
598 .num_resources = ARRAY_SIZE(pmu_resources),
599 .resource = pmu_resources,
600};
601
593static struct platform_device *r8a7740_late_devices[] __initdata = { 602static struct platform_device *r8a7740_late_devices[] __initdata = {
594 &i2c0_device, 603 &i2c0_device,
595 &i2c1_device, 604 &i2c1_device,
@@ -597,6 +606,7 @@ static struct platform_device *r8a7740_late_devices[] __initdata = {
597 &dma1_device, 606 &dma1_device,
598 &dma2_device, 607 &dma2_device,
599 &usb_dma_device, 608 &usb_dma_device,
609 &pmu_device,
600}; 610};
601 611
602/* 612/*
@@ -747,7 +757,7 @@ static const char *r8a7740_boards_compat_dt[] __initdata = {
747 NULL, 757 NULL,
748}; 758};
749 759
750DT_MACHINE_START(SH7372_DT, "Generic R8A7740 (Flattened Device Tree)") 760DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
751 .map_io = r8a7740_map_io, 761 .map_io = r8a7740_map_io,
752 .init_early = r8a7740_add_early_devices_dt, 762 .init_early = r8a7740_add_early_devices_dt,
753 .init_irq = r8a7740_init_irq, 763 .init_irq = r8a7740_init_irq,
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index ebbffc25f24..7a1ad4f3853 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -229,6 +229,79 @@ static struct platform_device tmu01_device = {
229 .num_resources = ARRAY_SIZE(tmu01_resources), 229 .num_resources = ARRAY_SIZE(tmu01_resources),
230}; 230};
231 231
232/* I2C */
233static struct resource rcar_i2c0_res[] = {
234 {
235 .start = 0xffc70000,
236 .end = 0xffc70fff,
237 .flags = IORESOURCE_MEM,
238 }, {
239 .start = gic_spi(79),
240 .flags = IORESOURCE_IRQ,
241 },
242};
243
244static struct platform_device i2c0_device = {
245 .name = "i2c-rcar",
246 .id = 0,
247 .resource = rcar_i2c0_res,
248 .num_resources = ARRAY_SIZE(rcar_i2c0_res),
249};
250
251static struct resource rcar_i2c1_res[] = {
252 {
253 .start = 0xffc71000,
254 .end = 0xffc71fff,
255 .flags = IORESOURCE_MEM,
256 }, {
257 .start = gic_spi(82),
258 .flags = IORESOURCE_IRQ,
259 },
260};
261
262static struct platform_device i2c1_device = {
263 .name = "i2c-rcar",
264 .id = 1,
265 .resource = rcar_i2c1_res,
266 .num_resources = ARRAY_SIZE(rcar_i2c1_res),
267};
268
269static struct resource rcar_i2c2_res[] = {
270 {
271 .start = 0xffc72000,
272 .end = 0xffc72fff,
273 .flags = IORESOURCE_MEM,
274 }, {
275 .start = gic_spi(80),
276 .flags = IORESOURCE_IRQ,
277 },
278};
279
280static struct platform_device i2c2_device = {
281 .name = "i2c-rcar",
282 .id = 2,
283 .resource = rcar_i2c2_res,
284 .num_resources = ARRAY_SIZE(rcar_i2c2_res),
285};
286
287static struct resource rcar_i2c3_res[] = {
288 {
289 .start = 0xffc73000,
290 .end = 0xffc73fff,
291 .flags = IORESOURCE_MEM,
292 }, {
293 .start = gic_spi(81),
294 .flags = IORESOURCE_IRQ,
295 },
296};
297
298static struct platform_device i2c3_device = {
299 .name = "i2c-rcar",
300 .id = 3,
301 .resource = rcar_i2c3_res,
302 .num_resources = ARRAY_SIZE(rcar_i2c3_res),
303};
304
232static struct platform_device *r8a7779_early_devices[] __initdata = { 305static struct platform_device *r8a7779_early_devices[] __initdata = {
233 &scif0_device, 306 &scif0_device,
234 &scif1_device, 307 &scif1_device,
@@ -238,6 +311,10 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
238 &scif5_device, 311 &scif5_device,
239 &tmu00_device, 312 &tmu00_device,
240 &tmu01_device, 313 &tmu01_device,
314 &i2c0_device,
315 &i2c1_device,
316 &i2c2_device,
317 &i2c3_device,
241}; 318};
242 319
243static struct platform_device *r8a7779_late_devices[] __initdata = { 320static struct platform_device *r8a7779_late_devices[] __initdata = {
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c
deleted file mode 100644
index e647f541087..00000000000
--- a/arch/arm/mach-shmobile/setup-sh7367.c
+++ /dev/null
@@ -1,481 +0,0 @@
1/*
2 * sh7367 processor support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/uio_driver.h>
26#include <linux/delay.h>
27#include <linux/input.h>
28#include <linux/io.h>
29#include <linux/serial_sci.h>
30#include <linux/sh_timer.h>
31#include <mach/hardware.h>
32#include <mach/common.h>
33#include <mach/irqs.h>
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/time.h>
38
39static struct map_desc sh7367_io_desc[] __initdata = {
40 /* create a 1:1 entity map for 0xe6xxxxxx
41 * used by CPGA, INTC and PFC.
42 */
43 {
44 .virtual = 0xe6000000,
45 .pfn = __phys_to_pfn(0xe6000000),
46 .length = 256 << 20,
47 .type = MT_DEVICE_NONSHARED
48 },
49};
50
51void __init sh7367_map_io(void)
52{
53 iotable_init(sh7367_io_desc, ARRAY_SIZE(sh7367_io_desc));
54}
55
56/* SCIFA0 */
57static struct plat_sci_port scif0_platform_data = {
58 .mapbase = 0xe6c40000,
59 .flags = UPF_BOOT_AUTOCONF,
60 .scscr = SCSCR_RE | SCSCR_TE,
61 .scbrr_algo_id = SCBRR_ALGO_4,
62 .type = PORT_SCIFA,
63 .irqs = { evt2irq(0xc00), evt2irq(0xc00),
64 evt2irq(0xc00), evt2irq(0xc00) },
65};
66
67static struct platform_device scif0_device = {
68 .name = "sh-sci",
69 .id = 0,
70 .dev = {
71 .platform_data = &scif0_platform_data,
72 },
73};
74
75/* SCIFA1 */
76static struct plat_sci_port scif1_platform_data = {
77 .mapbase = 0xe6c50000,
78 .flags = UPF_BOOT_AUTOCONF,
79 .scscr = SCSCR_RE | SCSCR_TE,
80 .scbrr_algo_id = SCBRR_ALGO_4,
81 .type = PORT_SCIFA,
82 .irqs = { evt2irq(0xc20), evt2irq(0xc20),
83 evt2irq(0xc20), evt2irq(0xc20) },
84};
85
86static struct platform_device scif1_device = {
87 .name = "sh-sci",
88 .id = 1,
89 .dev = {
90 .platform_data = &scif1_platform_data,
91 },
92};
93
94/* SCIFA2 */
95static struct plat_sci_port scif2_platform_data = {
96 .mapbase = 0xe6c60000,
97 .flags = UPF_BOOT_AUTOCONF,
98 .scscr = SCSCR_RE | SCSCR_TE,
99 .scbrr_algo_id = SCBRR_ALGO_4,
100 .type = PORT_SCIFA,
101 .irqs = { evt2irq(0xc40), evt2irq(0xc40),
102 evt2irq(0xc40), evt2irq(0xc40) },
103};
104
105static struct platform_device scif2_device = {
106 .name = "sh-sci",
107 .id = 2,
108 .dev = {
109 .platform_data = &scif2_platform_data,
110 },
111};
112
113/* SCIFA3 */
114static struct plat_sci_port scif3_platform_data = {
115 .mapbase = 0xe6c70000,
116 .flags = UPF_BOOT_AUTOCONF,
117 .scscr = SCSCR_RE | SCSCR_TE,
118 .scbrr_algo_id = SCBRR_ALGO_4,
119 .type = PORT_SCIFA,
120 .irqs = { evt2irq(0xc60), evt2irq(0xc60),
121 evt2irq(0xc60), evt2irq(0xc60) },
122};
123
124static struct platform_device scif3_device = {
125 .name = "sh-sci",
126 .id = 3,
127 .dev = {
128 .platform_data = &scif3_platform_data,
129 },
130};
131
132/* SCIFA4 */
133static struct plat_sci_port scif4_platform_data = {
134 .mapbase = 0xe6c80000,
135 .flags = UPF_BOOT_AUTOCONF,
136 .scscr = SCSCR_RE | SCSCR_TE,
137 .scbrr_algo_id = SCBRR_ALGO_4,
138 .type = PORT_SCIFA,
139 .irqs = { evt2irq(0xd20), evt2irq(0xd20),
140 evt2irq(0xd20), evt2irq(0xd20) },
141};
142
143static struct platform_device scif4_device = {
144 .name = "sh-sci",
145 .id = 4,
146 .dev = {
147 .platform_data = &scif4_platform_data,
148 },
149};
150
151/* SCIFA5 */
152static struct plat_sci_port scif5_platform_data = {
153 .mapbase = 0xe6cb0000,
154 .flags = UPF_BOOT_AUTOCONF,
155 .scscr = SCSCR_RE | SCSCR_TE,
156 .scbrr_algo_id = SCBRR_ALGO_4,
157 .type = PORT_SCIFA,
158 .irqs = { evt2irq(0xd40), evt2irq(0xd40),
159 evt2irq(0xd40), evt2irq(0xd40) },
160};
161
162static struct platform_device scif5_device = {
163 .name = "sh-sci",
164 .id = 5,
165 .dev = {
166 .platform_data = &scif5_platform_data,
167 },
168};
169
170/* SCIFB */
171static struct plat_sci_port scif6_platform_data = {
172 .mapbase = 0xe6c30000,
173 .flags = UPF_BOOT_AUTOCONF,
174 .scscr = SCSCR_RE | SCSCR_TE,
175 .scbrr_algo_id = SCBRR_ALGO_4,
176 .type = PORT_SCIFB,
177 .irqs = { evt2irq(0xd60), evt2irq(0xd60),
178 evt2irq(0xd60), evt2irq(0xd60) },
179};
180
181static struct platform_device scif6_device = {
182 .name = "sh-sci",
183 .id = 6,
184 .dev = {
185 .platform_data = &scif6_platform_data,
186 },
187};
188
189static struct sh_timer_config cmt10_platform_data = {
190 .name = "CMT10",
191 .channel_offset = 0x10,
192 .timer_bit = 0,
193 .clockevent_rating = 125,
194 .clocksource_rating = 125,
195};
196
197static struct resource cmt10_resources[] = {
198 [0] = {
199 .name = "CMT10",
200 .start = 0xe6138010,
201 .end = 0xe613801b,
202 .flags = IORESOURCE_MEM,
203 },
204 [1] = {
205 .start = evt2irq(0xb00), /* CMT1_CMT10 */
206 .flags = IORESOURCE_IRQ,
207 },
208};
209
210static struct platform_device cmt10_device = {
211 .name = "sh_cmt",
212 .id = 10,
213 .dev = {
214 .platform_data = &cmt10_platform_data,
215 },
216 .resource = cmt10_resources,
217 .num_resources = ARRAY_SIZE(cmt10_resources),
218};
219
220/* VPU */
221static struct uio_info vpu_platform_data = {
222 .name = "VPU5",
223 .version = "0",
224 .irq = intcs_evt2irq(0x980),
225};
226
227static struct resource vpu_resources[] = {
228 [0] = {
229 .name = "VPU",
230 .start = 0xfe900000,
231 .end = 0xfe902807,
232 .flags = IORESOURCE_MEM,
233 },
234};
235
236static struct platform_device vpu_device = {
237 .name = "uio_pdrv_genirq",
238 .id = 0,
239 .dev = {
240 .platform_data = &vpu_platform_data,
241 },
242 .resource = vpu_resources,
243 .num_resources = ARRAY_SIZE(vpu_resources),
244};
245
246/* VEU0 */
247static struct uio_info veu0_platform_data = {
248 .name = "VEU0",
249 .version = "0",
250 .irq = intcs_evt2irq(0x700),
251};
252
253static struct resource veu0_resources[] = {
254 [0] = {
255 .name = "VEU0",
256 .start = 0xfe920000,
257 .end = 0xfe9200b7,
258 .flags = IORESOURCE_MEM,
259 },
260};
261
262static struct platform_device veu0_device = {
263 .name = "uio_pdrv_genirq",
264 .id = 1,
265 .dev = {
266 .platform_data = &veu0_platform_data,
267 },
268 .resource = veu0_resources,
269 .num_resources = ARRAY_SIZE(veu0_resources),
270};
271
272/* VEU1 */
273static struct uio_info veu1_platform_data = {
274 .name = "VEU1",
275 .version = "0",
276 .irq = intcs_evt2irq(0x720),
277};
278
279static struct resource veu1_resources[] = {
280 [0] = {
281 .name = "VEU1",
282 .start = 0xfe924000,
283 .end = 0xfe9240b7,
284 .flags = IORESOURCE_MEM,
285 },
286};
287
288static struct platform_device veu1_device = {
289 .name = "uio_pdrv_genirq",
290 .id = 2,
291 .dev = {
292 .platform_data = &veu1_platform_data,
293 },
294 .resource = veu1_resources,
295 .num_resources = ARRAY_SIZE(veu1_resources),
296};
297
298/* VEU2 */
299static struct uio_info veu2_platform_data = {
300 .name = "VEU2",
301 .version = "0",
302 .irq = intcs_evt2irq(0x740),
303};
304
305static struct resource veu2_resources[] = {
306 [0] = {
307 .name = "VEU2",
308 .start = 0xfe928000,
309 .end = 0xfe9280b7,
310 .flags = IORESOURCE_MEM,
311 },
312};
313
314static struct platform_device veu2_device = {
315 .name = "uio_pdrv_genirq",
316 .id = 3,
317 .dev = {
318 .platform_data = &veu2_platform_data,
319 },
320 .resource = veu2_resources,
321 .num_resources = ARRAY_SIZE(veu2_resources),
322};
323
324/* VEU3 */
325static struct uio_info veu3_platform_data = {
326 .name = "VEU3",
327 .version = "0",
328 .irq = intcs_evt2irq(0x760),
329};
330
331static struct resource veu3_resources[] = {
332 [0] = {
333 .name = "VEU3",
334 .start = 0xfe92c000,
335 .end = 0xfe92c0b7,
336 .flags = IORESOURCE_MEM,
337 },
338};
339
340static struct platform_device veu3_device = {
341 .name = "uio_pdrv_genirq",
342 .id = 4,
343 .dev = {
344 .platform_data = &veu3_platform_data,
345 },
346 .resource = veu3_resources,
347 .num_resources = ARRAY_SIZE(veu3_resources),
348};
349
350/* VEU2H */
351static struct uio_info veu2h_platform_data = {
352 .name = "VEU2H",
353 .version = "0",
354 .irq = intcs_evt2irq(0x520),
355};
356
357static struct resource veu2h_resources[] = {
358 [0] = {
359 .name = "VEU2H",
360 .start = 0xfe93c000,
361 .end = 0xfe93c27b,
362 .flags = IORESOURCE_MEM,
363 },
364};
365
366static struct platform_device veu2h_device = {
367 .name = "uio_pdrv_genirq",
368 .id = 5,
369 .dev = {
370 .platform_data = &veu2h_platform_data,
371 },
372 .resource = veu2h_resources,
373 .num_resources = ARRAY_SIZE(veu2h_resources),
374};
375
376/* JPU */
377static struct uio_info jpu_platform_data = {
378 .name = "JPU",
379 .version = "0",
380 .irq = intcs_evt2irq(0x560),
381};
382
383static struct resource jpu_resources[] = {
384 [0] = {
385 .name = "JPU",
386 .start = 0xfe980000,
387 .end = 0xfe9902d3,
388 .flags = IORESOURCE_MEM,
389 },
390};
391
392static struct platform_device jpu_device = {
393 .name = "uio_pdrv_genirq",
394 .id = 6,
395 .dev = {
396 .platform_data = &jpu_platform_data,
397 },
398 .resource = jpu_resources,
399 .num_resources = ARRAY_SIZE(jpu_resources),
400};
401
402/* SPU1 */
403static struct uio_info spu1_platform_data = {
404 .name = "SPU1",
405 .version = "0",
406 .irq = evt2irq(0xfc0),
407};
408
409static struct resource spu1_resources[] = {
410 [0] = {
411 .name = "SPU1",
412 .start = 0xfe300000,
413 .end = 0xfe3fffff,
414 .flags = IORESOURCE_MEM,
415 },
416};
417
418static struct platform_device spu1_device = {
419 .name = "uio_pdrv_genirq",
420 .id = 7,
421 .dev = {
422 .platform_data = &spu1_platform_data,
423 },
424 .resource = spu1_resources,
425 .num_resources = ARRAY_SIZE(spu1_resources),
426};
427
428static struct platform_device *sh7367_early_devices[] __initdata = {
429 &scif0_device,
430 &scif1_device,
431 &scif2_device,
432 &scif3_device,
433 &scif4_device,
434 &scif5_device,
435 &scif6_device,
436 &cmt10_device,
437};
438
439static struct platform_device *sh7367_devices[] __initdata = {
440 &vpu_device,
441 &veu0_device,
442 &veu1_device,
443 &veu2_device,
444 &veu3_device,
445 &veu2h_device,
446 &jpu_device,
447 &spu1_device,
448};
449
450void __init sh7367_add_standard_devices(void)
451{
452 platform_add_devices(sh7367_early_devices,
453 ARRAY_SIZE(sh7367_early_devices));
454
455 platform_add_devices(sh7367_devices,
456 ARRAY_SIZE(sh7367_devices));
457}
458
459static void __init sh7367_earlytimer_init(void)
460{
461 sh7367_clock_init();
462 shmobile_earlytimer_init();
463}
464
465#define SYMSTPCR2 IOMEM(0xe6158048)
466#define SYMSTPCR2_CMT1 (1 << 29)
467
468void __init sh7367_add_early_devices(void)
469{
470 /* enable clock to CMT1 */
471 __raw_writel(__raw_readl(SYMSTPCR2) & ~SYMSTPCR2_CMT1, SYMSTPCR2);
472
473 early_platform_add_devices(sh7367_early_devices,
474 ARRAY_SIZE(sh7367_early_devices));
475
476 /* setup early console here as well */
477 shmobile_setup_console();
478
479 /* override timer setup with soc-specific code */
480 shmobile_timer.init = sh7367_earlytimer_init;
481}
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index a07954fbcd2..c917882424a 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -58,12 +58,6 @@ static struct map_desc sh7372_io_desc[] __initdata = {
58void __init sh7372_map_io(void) 58void __init sh7372_map_io(void)
59{ 59{
60 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc)); 60 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
61
62 /*
63 * DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
64 * enough to allocate the frame buffer memory.
65 */
66 init_consistent_dma_size(12 << 20);
67} 61}
68 62
69/* SCIFA0 */ 63/* SCIFA0 */
@@ -408,6 +402,26 @@ static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
408 .chcr = CHCR_RX(XMIT_SZ_8BIT), 402 .chcr = CHCR_RX(XMIT_SZ_8BIT),
409 .mid_rid = 0x3e, 403 .mid_rid = 0x3e,
410 }, { 404 }, {
405 .slave_id = SHDMA_SLAVE_FLCTL0_TX,
406 .addr = 0xe6a30050,
407 .chcr = CHCR_TX(XMIT_SZ_32BIT),
408 .mid_rid = 0x83,
409 }, {
410 .slave_id = SHDMA_SLAVE_FLCTL0_RX,
411 .addr = 0xe6a30050,
412 .chcr = CHCR_RX(XMIT_SZ_32BIT),
413 .mid_rid = 0x83,
414 }, {
415 .slave_id = SHDMA_SLAVE_FLCTL1_TX,
416 .addr = 0xe6a30060,
417 .chcr = CHCR_TX(XMIT_SZ_32BIT),
418 .mid_rid = 0x87,
419 }, {
420 .slave_id = SHDMA_SLAVE_FLCTL1_RX,
421 .addr = 0xe6a30060,
422 .chcr = CHCR_RX(XMIT_SZ_32BIT),
423 .mid_rid = 0x87,
424 }, {
411 .slave_id = SHDMA_SLAVE_SDHI0_TX, 425 .slave_id = SHDMA_SLAVE_SDHI0_TX,
412 .addr = 0xe6850030, 426 .addr = 0xe6850030,
413 .chcr = CHCR_TX(XMIT_SZ_16BIT), 427 .chcr = CHCR_TX(XMIT_SZ_16BIT),
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c
deleted file mode 100644
index edcf98bb701..00000000000
--- a/arch/arm/mach-shmobile/setup-sh7377.c
+++ /dev/null
@@ -1,549 +0,0 @@
1/*
2 * sh7377 processor support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/of_platform.h>
26#include <linux/uio_driver.h>
27#include <linux/delay.h>
28#include <linux/input.h>
29#include <linux/io.h>
30#include <linux/serial_sci.h>
31#include <linux/sh_intc.h>
32#include <linux/sh_timer.h>
33#include <mach/hardware.h>
34#include <mach/common.h>
35#include <asm/mach/map.h>
36#include <mach/irqs.h>
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/mach/time.h>
40
41static struct map_desc sh7377_io_desc[] __initdata = {
42 /* create a 1:1 entity map for 0xe6xxxxxx
43 * used by CPGA, INTC and PFC.
44 */
45 {
46 .virtual = 0xe6000000,
47 .pfn = __phys_to_pfn(0xe6000000),
48 .length = 256 << 20,
49 .type = MT_DEVICE_NONSHARED
50 },
51};
52
53void __init sh7377_map_io(void)
54{
55 iotable_init(sh7377_io_desc, ARRAY_SIZE(sh7377_io_desc));
56}
57
58/* SCIFA0 */
59static struct plat_sci_port scif0_platform_data = {
60 .mapbase = 0xe6c40000,
61 .flags = UPF_BOOT_AUTOCONF,
62 .scscr = SCSCR_RE | SCSCR_TE,
63 .scbrr_algo_id = SCBRR_ALGO_4,
64 .type = PORT_SCIFA,
65 .irqs = { evt2irq(0xc00), evt2irq(0xc00),
66 evt2irq(0xc00), evt2irq(0xc00) },
67};
68
69static struct platform_device scif0_device = {
70 .name = "sh-sci",
71 .id = 0,
72 .dev = {
73 .platform_data = &scif0_platform_data,
74 },
75};
76
77/* SCIFA1 */
78static struct plat_sci_port scif1_platform_data = {
79 .mapbase = 0xe6c50000,
80 .flags = UPF_BOOT_AUTOCONF,
81 .scscr = SCSCR_RE | SCSCR_TE,
82 .scbrr_algo_id = SCBRR_ALGO_4,
83 .type = PORT_SCIFA,
84 .irqs = { evt2irq(0xc20), evt2irq(0xc20),
85 evt2irq(0xc20), evt2irq(0xc20) },
86};
87
88static struct platform_device scif1_device = {
89 .name = "sh-sci",
90 .id = 1,
91 .dev = {
92 .platform_data = &scif1_platform_data,
93 },
94};
95
96/* SCIFA2 */
97static struct plat_sci_port scif2_platform_data = {
98 .mapbase = 0xe6c60000,
99 .flags = UPF_BOOT_AUTOCONF,
100 .scscr = SCSCR_RE | SCSCR_TE,
101 .scbrr_algo_id = SCBRR_ALGO_4,
102 .type = PORT_SCIFA,
103 .irqs = { evt2irq(0xc40), evt2irq(0xc40),
104 evt2irq(0xc40), evt2irq(0xc40) },
105};
106
107static struct platform_device scif2_device = {
108 .name = "sh-sci",
109 .id = 2,
110 .dev = {
111 .platform_data = &scif2_platform_data,
112 },
113};
114
115/* SCIFA3 */
116static struct plat_sci_port scif3_platform_data = {
117 .mapbase = 0xe6c70000,
118 .flags = UPF_BOOT_AUTOCONF,
119 .scscr = SCSCR_RE | SCSCR_TE,
120 .scbrr_algo_id = SCBRR_ALGO_4,
121 .type = PORT_SCIFA,
122 .irqs = { evt2irq(0xc60), evt2irq(0xc60),
123 evt2irq(0xc60), evt2irq(0xc60) },
124};
125
126static struct platform_device scif3_device = {
127 .name = "sh-sci",
128 .id = 3,
129 .dev = {
130 .platform_data = &scif3_platform_data,
131 },
132};
133
134/* SCIFA4 */
135static struct plat_sci_port scif4_platform_data = {
136 .mapbase = 0xe6c80000,
137 .flags = UPF_BOOT_AUTOCONF,
138 .scscr = SCSCR_RE | SCSCR_TE,
139 .scbrr_algo_id = SCBRR_ALGO_4,
140 .type = PORT_SCIFA,
141 .irqs = { evt2irq(0xd20), evt2irq(0xd20),
142 evt2irq(0xd20), evt2irq(0xd20) },
143};
144
145static struct platform_device scif4_device = {
146 .name = "sh-sci",
147 .id = 4,
148 .dev = {
149 .platform_data = &scif4_platform_data,
150 },
151};
152
153/* SCIFA5 */
154static struct plat_sci_port scif5_platform_data = {
155 .mapbase = 0xe6cb0000,
156 .flags = UPF_BOOT_AUTOCONF,
157 .scscr = SCSCR_RE | SCSCR_TE,
158 .scbrr_algo_id = SCBRR_ALGO_4,
159 .type = PORT_SCIFA,
160 .irqs = { evt2irq(0xd40), evt2irq(0xd40),
161 evt2irq(0xd40), evt2irq(0xd40) },
162};
163
164static struct platform_device scif5_device = {
165 .name = "sh-sci",
166 .id = 5,
167 .dev = {
168 .platform_data = &scif5_platform_data,
169 },
170};
171
172/* SCIFA6 */
173static struct plat_sci_port scif6_platform_data = {
174 .mapbase = 0xe6cc0000,
175 .flags = UPF_BOOT_AUTOCONF,
176 .scscr = SCSCR_RE | SCSCR_TE,
177 .scbrr_algo_id = SCBRR_ALGO_4,
178 .type = PORT_SCIFA,
179 .irqs = { intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80),
180 intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80) },
181};
182
183static struct platform_device scif6_device = {
184 .name = "sh-sci",
185 .id = 6,
186 .dev = {
187 .platform_data = &scif6_platform_data,
188 },
189};
190
191/* SCIFB */
192static struct plat_sci_port scif7_platform_data = {
193 .mapbase = 0xe6c30000,
194 .flags = UPF_BOOT_AUTOCONF,
195 .scscr = SCSCR_RE | SCSCR_TE,
196 .scbrr_algo_id = SCBRR_ALGO_4,
197 .type = PORT_SCIFB,
198 .irqs = { evt2irq(0xd60), evt2irq(0xd60),
199 evt2irq(0xd60), evt2irq(0xd60) },
200};
201
202static struct platform_device scif7_device = {
203 .name = "sh-sci",
204 .id = 7,
205 .dev = {
206 .platform_data = &scif7_platform_data,
207 },
208};
209
210static struct sh_timer_config cmt10_platform_data = {
211 .name = "CMT10",
212 .channel_offset = 0x10,
213 .timer_bit = 0,
214 .clockevent_rating = 125,
215 .clocksource_rating = 125,
216};
217
218static struct resource cmt10_resources[] = {
219 [0] = {
220 .name = "CMT10",
221 .start = 0xe6138010,
222 .end = 0xe613801b,
223 .flags = IORESOURCE_MEM,
224 },
225 [1] = {
226 .start = evt2irq(0xb00), /* CMT1_CMT10 */
227 .flags = IORESOURCE_IRQ,
228 },
229};
230
231static struct platform_device cmt10_device = {
232 .name = "sh_cmt",
233 .id = 10,
234 .dev = {
235 .platform_data = &cmt10_platform_data,
236 },
237 .resource = cmt10_resources,
238 .num_resources = ARRAY_SIZE(cmt10_resources),
239};
240
241/* VPU */
242static struct uio_info vpu_platform_data = {
243 .name = "VPU5HG",
244 .version = "0",
245 .irq = intcs_evt2irq(0x980),
246};
247
248static struct resource vpu_resources[] = {
249 [0] = {
250 .name = "VPU",
251 .start = 0xfe900000,
252 .end = 0xfe900157,
253 .flags = IORESOURCE_MEM,
254 },
255};
256
257static struct platform_device vpu_device = {
258 .name = "uio_pdrv_genirq",
259 .id = 0,
260 .dev = {
261 .platform_data = &vpu_platform_data,
262 },
263 .resource = vpu_resources,
264 .num_resources = ARRAY_SIZE(vpu_resources),
265};
266
267/* VEU0 */
268static struct uio_info veu0_platform_data = {
269 .name = "VEU0",
270 .version = "0",
271 .irq = intcs_evt2irq(0x700),
272};
273
274static struct resource veu0_resources[] = {
275 [0] = {
276 .name = "VEU0",
277 .start = 0xfe920000,
278 .end = 0xfe9200cb,
279 .flags = IORESOURCE_MEM,
280 },
281};
282
283static struct platform_device veu0_device = {
284 .name = "uio_pdrv_genirq",
285 .id = 1,
286 .dev = {
287 .platform_data = &veu0_platform_data,
288 },
289 .resource = veu0_resources,
290 .num_resources = ARRAY_SIZE(veu0_resources),
291};
292
293/* VEU1 */
294static struct uio_info veu1_platform_data = {
295 .name = "VEU1",
296 .version = "0",
297 .irq = intcs_evt2irq(0x720),
298};
299
300static struct resource veu1_resources[] = {
301 [0] = {
302 .name = "VEU1",
303 .start = 0xfe924000,
304 .end = 0xfe9240cb,
305 .flags = IORESOURCE_MEM,
306 },
307};
308
309static struct platform_device veu1_device = {
310 .name = "uio_pdrv_genirq",
311 .id = 2,
312 .dev = {
313 .platform_data = &veu1_platform_data,
314 },
315 .resource = veu1_resources,
316 .num_resources = ARRAY_SIZE(veu1_resources),
317};
318
319/* VEU2 */
320static struct uio_info veu2_platform_data = {
321 .name = "VEU2",
322 .version = "0",
323 .irq = intcs_evt2irq(0x740),
324};
325
326static struct resource veu2_resources[] = {
327 [0] = {
328 .name = "VEU2",
329 .start = 0xfe928000,
330 .end = 0xfe928307,
331 .flags = IORESOURCE_MEM,
332 },
333};
334
335static struct platform_device veu2_device = {
336 .name = "uio_pdrv_genirq",
337 .id = 3,
338 .dev = {
339 .platform_data = &veu2_platform_data,
340 },
341 .resource = veu2_resources,
342 .num_resources = ARRAY_SIZE(veu2_resources),
343};
344
345/* VEU3 */
346static struct uio_info veu3_platform_data = {
347 .name = "VEU3",
348 .version = "0",
349 .irq = intcs_evt2irq(0x760),
350};
351
352static struct resource veu3_resources[] = {
353 [0] = {
354 .name = "VEU3",
355 .start = 0xfe92c000,
356 .end = 0xfe92c307,
357 .flags = IORESOURCE_MEM,
358 },
359};
360
361static struct platform_device veu3_device = {
362 .name = "uio_pdrv_genirq",
363 .id = 4,
364 .dev = {
365 .platform_data = &veu3_platform_data,
366 },
367 .resource = veu3_resources,
368 .num_resources = ARRAY_SIZE(veu3_resources),
369};
370
371/* JPU */
372static struct uio_info jpu_platform_data = {
373 .name = "JPU",
374 .version = "0",
375 .irq = intcs_evt2irq(0x560),
376};
377
378static struct resource jpu_resources[] = {
379 [0] = {
380 .name = "JPU",
381 .start = 0xfe980000,
382 .end = 0xfe9902d3,
383 .flags = IORESOURCE_MEM,
384 },
385};
386
387static struct platform_device jpu_device = {
388 .name = "uio_pdrv_genirq",
389 .id = 5,
390 .dev = {
391 .platform_data = &jpu_platform_data,
392 },
393 .resource = jpu_resources,
394 .num_resources = ARRAY_SIZE(jpu_resources),
395};
396
397/* SPU2DSP0 */
398static struct uio_info spu0_platform_data = {
399 .name = "SPU2DSP0",
400 .version = "0",
401 .irq = evt2irq(0x1800),
402};
403
404static struct resource spu0_resources[] = {
405 [0] = {
406 .name = "SPU2DSP0",
407 .start = 0xfe200000,
408 .end = 0xfe2fffff,
409 .flags = IORESOURCE_MEM,
410 },
411};
412
413static struct platform_device spu0_device = {
414 .name = "uio_pdrv_genirq",
415 .id = 6,
416 .dev = {
417 .platform_data = &spu0_platform_data,
418 },
419 .resource = spu0_resources,
420 .num_resources = ARRAY_SIZE(spu0_resources),
421};
422
423/* SPU2DSP1 */
424static struct uio_info spu1_platform_data = {
425 .name = "SPU2DSP1",
426 .version = "0",
427 .irq = evt2irq(0x1820),
428};
429
430static struct resource spu1_resources[] = {
431 [0] = {
432 .name = "SPU2DSP1",
433 .start = 0xfe300000,
434 .end = 0xfe3fffff,
435 .flags = IORESOURCE_MEM,
436 },
437};
438
439static struct platform_device spu1_device = {
440 .name = "uio_pdrv_genirq",
441 .id = 7,
442 .dev = {
443 .platform_data = &spu1_platform_data,
444 },
445 .resource = spu1_resources,
446 .num_resources = ARRAY_SIZE(spu1_resources),
447};
448
449static struct platform_device *sh7377_early_devices[] __initdata = {
450 &scif0_device,
451 &scif1_device,
452 &scif2_device,
453 &scif3_device,
454 &scif4_device,
455 &scif5_device,
456 &scif6_device,
457 &scif7_device,
458 &cmt10_device,
459};
460
461static struct platform_device *sh7377_devices[] __initdata = {
462 &vpu_device,
463 &veu0_device,
464 &veu1_device,
465 &veu2_device,
466 &veu3_device,
467 &jpu_device,
468 &spu0_device,
469 &spu1_device,
470};
471
472void __init sh7377_add_standard_devices(void)
473{
474 platform_add_devices(sh7377_early_devices,
475 ARRAY_SIZE(sh7377_early_devices));
476
477 platform_add_devices(sh7377_devices,
478 ARRAY_SIZE(sh7377_devices));
479}
480
481static void __init sh7377_earlytimer_init(void)
482{
483 sh7377_clock_init();
484 shmobile_earlytimer_init();
485}
486
487#define SMSTPCR3 IOMEM(0xe615013c)
488#define SMSTPCR3_CMT1 (1 << 29)
489
490void __init sh7377_add_early_devices(void)
491{
492 /* enable clock to CMT1 */
493 __raw_writel(__raw_readl(SMSTPCR3) & ~SMSTPCR3_CMT1, SMSTPCR3);
494
495 early_platform_add_devices(sh7377_early_devices,
496 ARRAY_SIZE(sh7377_early_devices));
497
498 /* setup early console here as well */
499 shmobile_setup_console();
500
501 /* override timer setup with soc-specific code */
502 shmobile_timer.init = sh7377_earlytimer_init;
503}
504
505#ifdef CONFIG_USE_OF
506
507void __init sh7377_add_early_devices_dt(void)
508{
509 shmobile_setup_delay(600, 1, 3); /* Cortex-A8 @ 600MHz */
510
511 early_platform_add_devices(sh7377_early_devices,
512 ARRAY_SIZE(sh7377_early_devices));
513
514 /* setup early console here as well */
515 shmobile_setup_console();
516}
517
518static const struct of_dev_auxdata sh7377_auxdata_lookup[] __initconst = {
519 { }
520};
521
522void __init sh7377_add_standard_devices_dt(void)
523{
524 /* clocks are setup late during boot in the case of DT */
525 sh7377_clock_init();
526
527 platform_add_devices(sh7377_early_devices,
528 ARRAY_SIZE(sh7377_early_devices));
529
530 of_platform_populate(NULL, of_default_bus_match_table,
531 sh7377_auxdata_lookup, NULL);
532}
533
534static const char *sh7377_boards_compat_dt[] __initdata = {
535 "renesas,sh7377",
536 NULL,
537};
538
539DT_MACHINE_START(SH7377_DT, "Generic SH7377 (Flattened Device Tree)")
540 .map_io = sh7377_map_io,
541 .init_early = sh7377_add_early_devices_dt,
542 .init_irq = sh7377_init_irq,
543 .handle_irq = shmobile_handle_irq_intc,
544 .init_machine = sh7377_add_standard_devices_dt,
545 .timer = &shmobile_timer,
546 .dt_compat = sh7377_boards_compat_dt,
547MACHINE_END
548
549#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index f6745628628..535426c306b 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -32,24 +32,8 @@
32 32
33#define EMEV2_SCU_BASE 0x1e000000 33#define EMEV2_SCU_BASE 0x1e000000
34 34
35static DEFINE_SPINLOCK(scu_lock);
36static void __iomem *scu_base; 35static void __iomem *scu_base;
37 36
38static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
39{
40 unsigned long tmp;
41
42 /* we assume this code is running on a different cpu
43 * than the one that is changing coherency setting */
44 spin_lock(&scu_lock);
45 tmp = readl(scu_base + 8);
46 tmp &= ~clr;
47 tmp |= set;
48 writel(tmp, scu_base + 8);
49 spin_unlock(&scu_lock);
50
51}
52
53static unsigned int __init emev2_get_core_count(void) 37static unsigned int __init emev2_get_core_count(void)
54{ 38{
55 if (!scu_base) { 39 if (!scu_base) {
@@ -95,7 +79,7 @@ static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *
95 cpu = cpu_logical_map(cpu); 79 cpu = cpu_logical_map(cpu);
96 80
97 /* enable cache coherency */ 81 /* enable cache coherency */
98 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 82 scu_power_mode(scu_base, 0);
99 83
100 /* Tell ROM loader about our vector (in headsmp.S) */ 84 /* Tell ROM loader about our vector (in headsmp.S) */
101 emev2_set_boot_vector(__pa(shmobile_secondary_vector)); 85 emev2_set_boot_vector(__pa(shmobile_secondary_vector));
@@ -106,12 +90,10 @@ static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *
106 90
107static void __init emev2_smp_prepare_cpus(unsigned int max_cpus) 91static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
108{ 92{
109 int cpu = cpu_logical_map(0);
110
111 scu_enable(scu_base); 93 scu_enable(scu_base);
112 94
113 /* enable cache coherency on CPU0 */ 95 /* enable cache coherency on CPU0 */
114 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 96 scu_power_mode(scu_base, 0);
115} 97}
116 98
117static void __init emev2_smp_init_cpus(void) 99static void __init emev2_smp_init_cpus(void)
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 2ce6af9a6a3..9def0f22bf2 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -61,9 +61,6 @@ static void __iomem *scu_base_addr(void)
61 return (void __iomem *)0xf0000000; 61 return (void __iomem *)0xf0000000;
62} 62}
63 63
64static DEFINE_SPINLOCK(scu_lock);
65static unsigned long tmp;
66
67#ifdef CONFIG_HAVE_ARM_TWD 64#ifdef CONFIG_HAVE_ARM_TWD
68static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 65static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
69 66
@@ -73,20 +70,6 @@ void __init r8a7779_register_twd(void)
73} 70}
74#endif 71#endif
75 72
76static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
77{
78 void __iomem *scu_base = scu_base_addr();
79
80 spin_lock(&scu_lock);
81 tmp = __raw_readl(scu_base + 8);
82 tmp &= ~clr;
83 tmp |= set;
84 spin_unlock(&scu_lock);
85
86 /* disable cache coherency after releasing the lock */
87 __raw_writel(tmp, scu_base + 8);
88}
89
90static unsigned int __init r8a7779_get_core_count(void) 73static unsigned int __init r8a7779_get_core_count(void)
91{ 74{
92 void __iomem *scu_base = scu_base_addr(); 75 void __iomem *scu_base = scu_base_addr();
@@ -102,7 +85,7 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
102 cpu = cpu_logical_map(cpu); 85 cpu = cpu_logical_map(cpu);
103 86
104 /* disable cache coherency */ 87 /* disable cache coherency */
105 modify_scu_cpu_psr(3 << (cpu * 8), 0); 88 scu_power_mode(scu_base_addr(), 3);
106 89
107 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 90 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
108 ch = r8a7779_ch_cpu[cpu]; 91 ch = r8a7779_ch_cpu[cpu];
@@ -145,7 +128,7 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
145 cpu = cpu_logical_map(cpu); 128 cpu = cpu_logical_map(cpu);
146 129
147 /* enable cache coherency */ 130 /* enable cache coherency */
148 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 131 scu_power_mode(scu_base_addr(), 0);
149 132
150 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 133 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
151 ch = r8a7779_ch_cpu[cpu]; 134 ch = r8a7779_ch_cpu[cpu];
@@ -158,15 +141,13 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
158 141
159static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus) 142static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
160{ 143{
161 int cpu = cpu_logical_map(0);
162
163 scu_enable(scu_base_addr()); 144 scu_enable(scu_base_addr());
164 145
165 /* Map the reset vector (in headsmp.S) */ 146 /* Map the reset vector (in headsmp.S) */
166 __raw_writel(__pa(shmobile_secondary_vector), AVECR); 147 __raw_writel(__pa(shmobile_secondary_vector), AVECR);
167 148
168 /* enable cache coherency on CPU0 */ 149 /* enable cache coherency on CPU0 */
169 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 150 scu_power_mode(scu_base_addr(), 0);
170 151
171 r8a7779_pm_init(); 152 r8a7779_pm_init();
172 153
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 624f00f70ab..96ddb97babb 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -41,9 +41,6 @@ static void __iomem *scu_base_addr(void)
41 return (void __iomem *)0xf0000000; 41 return (void __iomem *)0xf0000000;
42} 42}
43 43
44static DEFINE_SPINLOCK(scu_lock);
45static unsigned long tmp;
46
47#ifdef CONFIG_HAVE_ARM_TWD 44#ifdef CONFIG_HAVE_ARM_TWD
48static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 45static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
49void __init sh73a0_register_twd(void) 46void __init sh73a0_register_twd(void)
@@ -52,20 +49,6 @@ void __init sh73a0_register_twd(void)
52} 49}
53#endif 50#endif
54 51
55static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
56{
57 void __iomem *scu_base = scu_base_addr();
58
59 spin_lock(&scu_lock);
60 tmp = __raw_readl(scu_base + 8);
61 tmp &= ~clr;
62 tmp |= set;
63 spin_unlock(&scu_lock);
64
65 /* disable cache coherency after releasing the lock */
66 __raw_writel(tmp, scu_base + 8);
67}
68
69static unsigned int __init sh73a0_get_core_count(void) 52static unsigned int __init sh73a0_get_core_count(void)
70{ 53{
71 void __iomem *scu_base = scu_base_addr(); 54 void __iomem *scu_base = scu_base_addr();
@@ -83,7 +66,7 @@ static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct
83 cpu = cpu_logical_map(cpu); 66 cpu = cpu_logical_map(cpu);
84 67
85 /* enable cache coherency */ 68 /* enable cache coherency */
86 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 69 scu_power_mode(scu_base_addr(), 0);
87 70
88 if (((__raw_readl(PSTR) >> (4 * cpu)) & 3) == 3) 71 if (((__raw_readl(PSTR) >> (4 * cpu)) & 3) == 3)
89 __raw_writel(1 << cpu, WUPCR); /* wake up */ 72 __raw_writel(1 << cpu, WUPCR); /* wake up */
@@ -95,8 +78,6 @@ static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct
95 78
96static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus) 79static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
97{ 80{
98 int cpu = cpu_logical_map(0);
99
100 scu_enable(scu_base_addr()); 81 scu_enable(scu_base_addr());
101 82
102 /* Map the reset vector (in headsmp.S) */ 83 /* Map the reset vector (in headsmp.S) */
@@ -104,7 +85,7 @@ static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
104 __raw_writel(__pa(shmobile_secondary_vector), SBAR); 85 __raw_writel(__pa(shmobile_secondary_vector), SBAR);
105 86
106 /* enable cache coherency on CPU0 */ 87 /* enable cache coherency on CPU0 */
107 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 88 scu_power_mode(scu_base_addr(), 0);
108} 89}
109 90
110static void __init sh73a0_smp_init_cpus(void) 91static void __init sh73a0_smp_init_cpus(void)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
new file mode 100644
index 00000000000..3fdd0085e30
--- /dev/null
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -0,0 +1,9 @@
1config ARCH_SUNXI
2 bool "Allwinner A1X SOCs" if ARCH_MULTI_V7
3 select CLKSRC_MMIO
4 select COMMON_CLK
5 select GENERIC_CLOCKEVENTS
6 select GENERIC_IRQ_CHIP
7 select PINCTRL
8 select SPARSE_IRQ
9 select SUNXI_TIMER
diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
new file mode 100644
index 00000000000..93bebfc3ff9
--- /dev/null
+++ b/arch/arm/mach-sunxi/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
diff --git a/arch/arm/mach-sunxi/Makefile.boot b/arch/arm/mach-sunxi/Makefile.boot
new file mode 100644
index 00000000000..46d4cf0841c
--- /dev/null
+++ b/arch/arm/mach-sunxi/Makefile.boot
@@ -0,0 +1 @@
zreladdr-$(CONFIG_ARCH_SUNXI) += 0x40008000
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
new file mode 100644
index 00000000000..9be910f7920
--- /dev/null
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -0,0 +1,96 @@
1/*
2 * Device Tree support for Allwinner A1X SoCs
3 *
4 * Copyright (C) 2012 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/delay.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/of_address.h>
17#include <linux/of_irq.h>
18#include <linux/of_platform.h>
19#include <linux/io.h>
20#include <linux/sunxi_timer.h>
21
22#include <linux/irqchip/sunxi.h>
23
24#include <asm/hardware/vic.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28
29#include "sunxi.h"
30
31#define WATCHDOG_CTRL_REG 0x00
32#define WATCHDOG_MODE_REG 0x04
33
34static void __iomem *wdt_base;
35
36static void sunxi_setup_restart(void)
37{
38 struct device_node *np = of_find_compatible_node(NULL, NULL,
39 "allwinner,sunxi-wdt");
40 if (WARN(!np, "unable to setup watchdog restart"))
41 return;
42
43 wdt_base = of_iomap(np, 0);
44 WARN(!wdt_base, "failed to map watchdog base address");
45}
46
47static void sunxi_restart(char mode, const char *cmd)
48{
49 if (!wdt_base)
50 return;
51
52 /* Enable timer and set reset bit in the watchdog */
53 writel(3, wdt_base + WATCHDOG_MODE_REG);
54 writel(0xa57 << 1 | 1, wdt_base + WATCHDOG_CTRL_REG);
55 while(1) {
56 mdelay(5);
57 writel(3, wdt_base + WATCHDOG_MODE_REG);
58 }
59}
60
61static struct map_desc sunxi_io_desc[] __initdata = {
62 {
63 .virtual = (unsigned long) SUNXI_REGS_VIRT_BASE,
64 .pfn = __phys_to_pfn(SUNXI_REGS_PHYS_BASE),
65 .length = SUNXI_REGS_SIZE,
66 .type = MT_DEVICE,
67 },
68};
69
70void __init sunxi_map_io(void)
71{
72 iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc));
73}
74
75static void __init sunxi_dt_init(void)
76{
77 sunxi_setup_restart();
78
79 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
80}
81
82static const char * const sunxi_board_dt_compat[] = {
83 "allwinner,sun4i",
84 "allwinner,sun5i",
85 NULL,
86};
87
88DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
89 .init_machine = sunxi_dt_init,
90 .map_io = sunxi_map_io,
91 .init_irq = sunxi_init_irq,
92 .handle_irq = sunxi_handle_irq,
93 .restart = sunxi_restart,
94 .timer = &sunxi_timer,
95 .dt_compat = sunxi_board_dt_compat,
96MACHINE_END
diff --git a/arch/arm/mach-sunxi/sunxi.h b/arch/arm/mach-sunxi/sunxi.h
new file mode 100644
index 00000000000..33b58712ade
--- /dev/null
+++ b/arch/arm/mach-sunxi/sunxi.h
@@ -0,0 +1,20 @@
1/*
2 * Generic definitions for Allwinner SunXi SoCs
3 *
4 * Copyright (C) 2012 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef __MACH_SUNXI_H
14#define __MACH_SUNXI_H
15
16#define SUNXI_REGS_PHYS_BASE 0x01c00000
17#define SUNXI_REGS_VIRT_BASE IOMEM(0xf1c00000)
18#define SUNXI_REGS_SIZE (SZ_2M + SZ_1M)
19
20#endif /* __MACH_SUNXI_H */
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 9ff6f6ea361..b442f15fd01 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -55,58 +55,7 @@ config TEGRA_AHB
55 help 55 help
56 Adds AHB configuration functionality for NVIDIA Tegra SoCs, 56 Adds AHB configuration functionality for NVIDIA Tegra SoCs,
57 which controls AHB bus master arbitration and some 57 which controls AHB bus master arbitration and some
58 perfomance parameters(priority, prefech size). 58 performance parameters(priority, prefech size).
59
60choice
61 prompt "Default low-level debug console UART"
62 default TEGRA_DEBUG_UART_NONE
63
64config TEGRA_DEBUG_UART_NONE
65 bool "None"
66
67config TEGRA_DEBUG_UARTA
68 bool "UART-A"
69
70config TEGRA_DEBUG_UARTB
71 bool "UART-B"
72
73config TEGRA_DEBUG_UARTC
74 bool "UART-C"
75
76config TEGRA_DEBUG_UARTD
77 bool "UART-D"
78
79config TEGRA_DEBUG_UARTE
80 bool "UART-E"
81
82endchoice
83
84choice
85 prompt "Automatic low-level debug console UART"
86 default TEGRA_DEBUG_UART_AUTO_NONE
87
88config TEGRA_DEBUG_UART_AUTO_NONE
89 bool "None"
90
91config TEGRA_DEBUG_UART_AUTO_ODMDATA
92 bool "Via ODMDATA"
93 help
94 Automatically determines which UART to use for low-level debug based
95 on the ODMDATA value. This value is part of the BCT, and is written
96 to the boot memory device using nvflash, or other flashing tool.
97 When bits 19:18 are 3, then bits 17:15 indicate which UART to use;
98 0/1/2/3/4 are UART A/B/C/D/E.
99
100config TEGRA_DEBUG_UART_AUTO_SCRATCH
101 bool "Via UART scratch register"
102 help
103 Automatically determines which UART to use for low-level debug based
104 on the UART scratch register value. Some bootloaders put ASCII 'D'
105 in this register when they initialize their own console UART output.
106 Using this option allows the kernel to automatically pick the same
107 UART.
108
109endchoice
110 59
111config TEGRA_EMC_SCALING_ENABLE 60config TEGRA_EMC_SCALING_ENABLE
112 bool "Enable scaling the memory frequency" 61 bool "Enable scaling the memory frequency"
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 9aa653b3eb3..0979e8bba78 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -8,15 +8,24 @@ obj-y += pmc.o
8obj-y += flowctrl.o 8obj-y += flowctrl.o
9obj-y += powergate.o 9obj-y += powergate.o
10obj-y += apbio.o 10obj-y += apbio.o
11obj-y += pm.o
11obj-$(CONFIG_CPU_IDLE) += cpuidle.o 12obj-$(CONFIG_CPU_IDLE) += cpuidle.o
12obj-$(CONFIG_CPU_IDLE) += sleep.o 13obj-$(CONFIG_CPU_IDLE) += sleep.o
13obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_clocks.o 14obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_clocks.o
14obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_clocks_data.o 15obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_clocks_data.o
16obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o
15obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o 17obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o
16obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += sleep-t20.o 18obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += sleep-tegra20.o
19ifeq ($(CONFIG_CPU_IDLE),y)
20obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += cpuidle-tegra20.o
21endif
17obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o 22obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o
18obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks_data.o 23obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks_data.o
19obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += sleep-t30.o 24obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_speedo.o
25obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += sleep-tegra30.o
26ifeq ($(CONFIG_CPU_IDLE),y)
27obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += cpuidle-tegra30.o
28endif
20obj-$(CONFIG_SMP) += platsmp.o headsmp.o 29obj-$(CONFIG_SMP) += platsmp.o headsmp.o
21obj-$(CONFIG_SMP) += reset.o 30obj-$(CONFIG_SMP) += reset.o
22obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 31obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c
index b5015d0f191..d091675ba37 100644
--- a/arch/arm/mach-tegra/apbio.c
+++ b/arch/arm/mach-tegra/apbio.c
@@ -15,7 +15,6 @@
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <mach/iomap.h>
19#include <linux/of.h> 18#include <linux/of.h>
20#include <linux/dmaengine.h> 19#include <linux/dmaengine.h>
21#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
@@ -24,9 +23,8 @@
24#include <linux/sched.h> 23#include <linux/sched.h>
25#include <linux/mutex.h> 24#include <linux/mutex.h>
26 25
27#include <mach/dma.h>
28
29#include "apbio.h" 26#include "apbio.h"
27#include "iomap.h"
30 28
31#if defined(CONFIG_TEGRA20_APB_DMA) 29#if defined(CONFIG_TEGRA20_APB_DMA)
32static DEFINE_MUTEX(tegra_apb_dma_lock); 30static DEFINE_MUTEX(tegra_apb_dma_lock);
@@ -71,7 +69,6 @@ bool tegra_apb_dma_init(void)
71 69
72 dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 70 dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
73 dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 71 dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
74 dma_sconfig.slave_id = TEGRA_DMA_REQ_SEL_CNTR;
75 dma_sconfig.src_maxburst = 1; 72 dma_sconfig.src_maxburst = 1;
76 dma_sconfig.dst_maxburst = 1; 73 dma_sconfig.dst_maxburst = 1;
77 74
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index aa5325cd1c4..734d9cc87f2 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -40,12 +40,10 @@
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <asm/setup.h> 41#include <asm/setup.h>
42 42
43#include <mach/iomap.h>
44#include <mach/irqs.h>
45
46#include "board.h" 43#include "board.h"
47#include "clock.h" 44#include "clock.h"
48#include "common.h" 45#include "common.h"
46#include "iomap.h"
49 47
50struct tegra_ehci_platform_data tegra_ehci1_pdata = { 48struct tegra_ehci_platform_data tegra_ehci1_pdata = {
51 .operating_mode = TEGRA_USB_OTG, 49 .operating_mode = TEGRA_USB_OTG,
@@ -91,6 +89,17 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
91 &tegra_ehci3_pdata), 89 &tegra_ehci3_pdata),
92 OF_DEV_AUXDATA("nvidia,tegra20-apbdma", TEGRA_APB_DMA_BASE, "tegra-apbdma", NULL), 90 OF_DEV_AUXDATA("nvidia,tegra20-apbdma", TEGRA_APB_DMA_BASE, "tegra-apbdma", NULL),
93 OF_DEV_AUXDATA("nvidia,tegra20-pwm", TEGRA_PWFM_BASE, "tegra-pwm", NULL), 91 OF_DEV_AUXDATA("nvidia,tegra20-pwm", TEGRA_PWFM_BASE, "tegra-pwm", NULL),
92 OF_DEV_AUXDATA("nvidia,tegra20-sflash", 0x7000c380, "spi", NULL),
93 OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D400, "spi_tegra.0", NULL),
94 OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D600, "spi_tegra.1", NULL),
95 OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D800, "spi_tegra.2", NULL),
96 OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000DA00, "spi_tegra.3", NULL),
97 OF_DEV_AUXDATA("nvidia,tegra20-host1x", 0x50000000, "host1x", NULL),
98 OF_DEV_AUXDATA("nvidia,tegra20-dc", 0x54200000, "tegradc.0", NULL),
99 OF_DEV_AUXDATA("nvidia,tegra20-dc", 0x54240000, "tegradc.1", NULL),
100 OF_DEV_AUXDATA("nvidia,tegra20-hdmi", 0x54280000, "hdmi", NULL),
101 OF_DEV_AUXDATA("nvidia,tegra20-dsi", 0x54300000, "dsi", NULL),
102 OF_DEV_AUXDATA("nvidia,tegra20-tvo", 0x542c0000, "tvo", NULL),
94 {} 103 {}
95}; 104};
96 105
@@ -104,8 +113,20 @@ static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
104 { "pll_a", "pll_p_out1", 56448000, true }, 113 { "pll_a", "pll_p_out1", 56448000, true },
105 { "pll_a_out0", "pll_a", 11289600, true }, 114 { "pll_a_out0", "pll_a", 11289600, true },
106 { "cdev1", NULL, 0, true }, 115 { "cdev1", NULL, 0, true },
116 { "blink", "clk_32k", 32768, true },
107 { "i2s1", "pll_a_out0", 11289600, false}, 117 { "i2s1", "pll_a_out0", 11289600, false},
108 { "i2s2", "pll_a_out0", 11289600, false}, 118 { "i2s2", "pll_a_out0", 11289600, false},
119 { "sdmmc1", "pll_p", 48000000, false},
120 { "sdmmc3", "pll_p", 48000000, false},
121 { "sdmmc4", "pll_p", 48000000, false},
122 { "spi", "pll_p", 20000000, false },
123 { "sbc1", "pll_p", 100000000, false },
124 { "sbc2", "pll_p", 100000000, false },
125 { "sbc3", "pll_p", 100000000, false },
126 { "sbc4", "pll_p", 100000000, false },
127 { "host1x", "pll_c", 150000000, false },
128 { "disp1", "pll_p", 600000000, false },
129 { "disp2", "pll_p", 600000000, false },
109 { NULL, NULL, 0, 0}, 130 { NULL, NULL, 0, 0},
110}; 131};
111 132
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index 5e92a81f9a2..6497d1236b0 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -33,11 +33,10 @@
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
35 35
36#include <mach/iomap.h>
37
38#include "board.h" 36#include "board.h"
39#include "clock.h" 37#include "clock.h"
40#include "common.h" 38#include "common.h"
39#include "iomap.h"
41 40
42struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = { 41struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
43 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL), 42 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL),
@@ -52,6 +51,18 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
52 OF_DEV_AUXDATA("nvidia,tegra30-ahub", 0x70080000, "tegra30-ahub", NULL), 51 OF_DEV_AUXDATA("nvidia,tegra30-ahub", 0x70080000, "tegra30-ahub", NULL),
53 OF_DEV_AUXDATA("nvidia,tegra30-apbdma", 0x6000a000, "tegra-apbdma", NULL), 52 OF_DEV_AUXDATA("nvidia,tegra30-apbdma", 0x6000a000, "tegra-apbdma", NULL),
54 OF_DEV_AUXDATA("nvidia,tegra30-pwm", TEGRA_PWFM_BASE, "tegra-pwm", NULL), 53 OF_DEV_AUXDATA("nvidia,tegra30-pwm", TEGRA_PWFM_BASE, "tegra-pwm", NULL),
54 OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000D400, "spi_tegra.0", NULL),
55 OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000D600, "spi_tegra.1", NULL),
56 OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000D800, "spi_tegra.2", NULL),
57 OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DA00, "spi_tegra.3", NULL),
58 OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DC00, "spi_tegra.4", NULL),
59 OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DE00, "spi_tegra.5", NULL),
60 OF_DEV_AUXDATA("nvidia,tegra30-host1x", 0x50000000, "host1x", NULL),
61 OF_DEV_AUXDATA("nvidia,tegra30-dc", 0x54200000, "tegradc.0", NULL),
62 OF_DEV_AUXDATA("nvidia,tegra30-dc", 0x54240000, "tegradc.1", NULL),
63 OF_DEV_AUXDATA("nvidia,tegra30-hdmi", 0x54280000, "hdmi", NULL),
64 OF_DEV_AUXDATA("nvidia,tegra30-dsi", 0x54300000, "dsi", NULL),
65 OF_DEV_AUXDATA("nvidia,tegra30-tvo", 0x542c0000, "tvo", NULL),
55 {} 66 {}
56}; 67};
57 68
@@ -62,11 +73,24 @@ static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
62 { "pll_a_out0", "pll_a", 11289600, true }, 73 { "pll_a_out0", "pll_a", 11289600, true },
63 { "extern1", "pll_a_out0", 0, true }, 74 { "extern1", "pll_a_out0", 0, true },
64 { "clk_out_1", "extern1", 0, true }, 75 { "clk_out_1", "extern1", 0, true },
76 { "blink", "clk_32k", 32768, true },
65 { "i2s0", "pll_a_out0", 11289600, false}, 77 { "i2s0", "pll_a_out0", 11289600, false},
66 { "i2s1", "pll_a_out0", 11289600, false}, 78 { "i2s1", "pll_a_out0", 11289600, false},
67 { "i2s2", "pll_a_out0", 11289600, false}, 79 { "i2s2", "pll_a_out0", 11289600, false},
68 { "i2s3", "pll_a_out0", 11289600, false}, 80 { "i2s3", "pll_a_out0", 11289600, false},
69 { "i2s4", "pll_a_out0", 11289600, false}, 81 { "i2s4", "pll_a_out0", 11289600, false},
82 { "sdmmc1", "pll_p", 48000000, false},
83 { "sdmmc3", "pll_p", 48000000, false},
84 { "sdmmc4", "pll_p", 48000000, false},
85 { "sbc1", "pll_p", 100000000, false},
86 { "sbc2", "pll_p", 100000000, false},
87 { "sbc3", "pll_p", 100000000, false},
88 { "sbc4", "pll_p", 100000000, false},
89 { "sbc5", "pll_p", 100000000, false},
90 { "sbc6", "pll_p", 100000000, false},
91 { "host1x", "pll_c", 150000000, false},
92 { "disp1", "pll_p", 600000000, false},
93 { "disp2", "pll_p", 600000000, false},
70 { NULL, NULL, 0, 0}, 94 { NULL, NULL, 0, 0},
71}; 95};
72 96
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index fd82085eca5..867bf8bf556 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -27,8 +27,6 @@
27#include <linux/seq_file.h> 27#include <linux/seq_file.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
30#include <mach/clk.h>
31
32#include "board.h" 30#include "board.h"
33#include "clock.h" 31#include "clock.h"
34#include "tegra_cpu_car.h" 32#include "tegra_cpu_car.h"
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 0b0a5f556d3..0816562725f 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -26,16 +26,17 @@
26#include <asm/hardware/cache-l2x0.h> 26#include <asm/hardware/cache-l2x0.h>
27#include <asm/hardware/gic.h> 27#include <asm/hardware/gic.h>
28 28
29#include <mach/iomap.h>
30#include <mach/powergate.h> 29#include <mach/powergate.h>
31 30
32#include "board.h" 31#include "board.h"
33#include "clock.h" 32#include "clock.h"
34#include "common.h" 33#include "common.h"
35#include "fuse.h" 34#include "fuse.h"
35#include "iomap.h"
36#include "pmc.h" 36#include "pmc.h"
37#include "apbio.h" 37#include "apbio.h"
38#include "sleep.h" 38#include "sleep.h"
39#include "pm.h"
39 40
40/* 41/*
41 * Storage for debug-macro.S's state. 42 * Storage for debug-macro.S's state.
@@ -44,14 +45,15 @@
44 * kernel is loaded. The data is declared here rather than debug-macro.S so 45 * kernel is loaded. The data is declared here rather than debug-macro.S so
45 * that multiple inclusions of debug-macro.S point at the same data. 46 * that multiple inclusions of debug-macro.S point at the same data.
46 */ 47 */
47#define TEGRA_DEBUG_UART_OFFSET (TEGRA_DEBUG_UART_BASE & 0xFFFF) 48u32 tegra_uart_config[4] = {
48u32 tegra_uart_config[3] = {
49 /* Debug UART initialization required */ 49 /* Debug UART initialization required */
50 1, 50 1,
51 /* Debug UART physical address */ 51 /* Debug UART physical address */
52 (u32)(IO_APB_PHYS + TEGRA_DEBUG_UART_OFFSET), 52 0,
53 /* Debug UART virtual address */ 53 /* Debug UART virtual address */
54 (u32)(IO_APB_VIRT + TEGRA_DEBUG_UART_OFFSET), 54 0,
55 /* Scratch space for debug macro */
56 0,
55}; 57};
56 58
57#ifdef CONFIG_OF 59#ifdef CONFIG_OF
@@ -104,25 +106,30 @@ static __initdata struct tegra_clk_init_table tegra30_clk_init_table[] = {
104 { "clk_m", NULL, 0, true }, 106 { "clk_m", NULL, 0, true },
105 { "pll_p", "clk_m", 408000000, true }, 107 { "pll_p", "clk_m", 408000000, true },
106 { "pll_p_out1", "pll_p", 9600000, true }, 108 { "pll_p_out1", "pll_p", 9600000, true },
109 { "pll_p_out4", "pll_p", 102000000, true },
110 { "sclk", "pll_p_out4", 102000000, true },
111 { "hclk", "sclk", 102000000, true },
112 { "pclk", "hclk", 51000000, true },
113 { "csite", NULL, 0, true },
107 { NULL, NULL, 0, 0}, 114 { NULL, NULL, 0, 0},
108}; 115};
109#endif 116#endif
110 117
111 118
112static void __init tegra_init_cache(u32 tag_latency, u32 data_latency) 119static void __init tegra_init_cache(void)
113{ 120{
114#ifdef CONFIG_CACHE_L2X0 121#ifdef CONFIG_CACHE_L2X0
122 int ret;
115 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000; 123 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
116 u32 aux_ctrl, cache_type; 124 u32 aux_ctrl, cache_type;
117 125
118 writel_relaxed(tag_latency, p + L2X0_TAG_LATENCY_CTRL);
119 writel_relaxed(data_latency, p + L2X0_DATA_LATENCY_CTRL);
120
121 cache_type = readl(p + L2X0_CACHE_TYPE); 126 cache_type = readl(p + L2X0_CACHE_TYPE);
122 aux_ctrl = (cache_type & 0x700) << (17-8); 127 aux_ctrl = (cache_type & 0x700) << (17-8);
123 aux_ctrl |= 0x6C000001; 128 aux_ctrl |= 0x7C400001;
124 129
125 l2x0_init(p, aux_ctrl, 0x8200c3fe); 130 ret = l2x0_of_init(aux_ctrl, 0x8200c3fe);
131 if (!ret)
132 l2x0_saved_regs_addr = virt_to_phys(&l2x0_saved_regs);
126#endif 133#endif
127 134
128} 135}
@@ -134,7 +141,7 @@ void __init tegra20_init_early(void)
134 tegra_init_fuse(); 141 tegra_init_fuse();
135 tegra2_init_clocks(); 142 tegra2_init_clocks();
136 tegra_clk_init_from_table(tegra20_clk_init_table); 143 tegra_clk_init_from_table(tegra20_clk_init_table);
137 tegra_init_cache(0x331, 0x441); 144 tegra_init_cache();
138 tegra_pmc_init(); 145 tegra_pmc_init();
139 tegra_powergate_init(); 146 tegra_powergate_init();
140 tegra20_hotplug_init(); 147 tegra20_hotplug_init();
@@ -147,7 +154,7 @@ void __init tegra30_init_early(void)
147 tegra_init_fuse(); 154 tegra_init_fuse();
148 tegra30_init_clocks(); 155 tegra30_init_clocks();
149 tegra_clk_init_from_table(tegra30_clk_init_table); 156 tegra_clk_init_from_table(tegra30_clk_init_table);
150 tegra_init_cache(0x441, 0x551); 157 tegra_init_cache();
151 tegra_pmc_init(); 158 tegra_pmc_init();
152 tegra_powergate_init(); 159 tegra_powergate_init();
153 tegra30_hotplug_init(); 160 tegra30_hotplug_init();
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
index 627bf0f4262..a74d3c7d2e2 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -30,9 +30,6 @@
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/suspend.h> 31#include <linux/suspend.h>
32 32
33
34#include <mach/clk.h>
35
36/* Frequency table index must be sequential starting at 0 */ 33/* Frequency table index must be sequential starting at 0 */
37static struct cpufreq_frequency_table freq_table[] = { 34static struct cpufreq_frequency_table freq_table[] = {
38 { 0, 216000 }, 35 { 0, 216000 },
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
new file mode 100644
index 00000000000..d32e8b0dbd4
--- /dev/null
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -0,0 +1,66 @@
1/*
2 * CPU idle driver for Tegra CPUs
3 *
4 * Copyright (c) 2010-2012, NVIDIA Corporation.
5 * Copyright (c) 2011 Google, Inc.
6 * Author: Colin Cross <ccross@android.com>
7 * Gary King <gking@nvidia.com>
8 *
9 * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 */
21
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/cpuidle.h>
25
26#include <asm/cpuidle.h>
27
28static struct cpuidle_driver tegra_idle_driver = {
29 .name = "tegra_idle",
30 .owner = THIS_MODULE,
31 .en_core_tk_irqen = 1,
32 .state_count = 1,
33 .states = {
34 [0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
35 },
36};
37
38static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
39
40int __init tegra20_cpuidle_init(void)
41{
42 int ret;
43 unsigned int cpu;
44 struct cpuidle_device *dev;
45 struct cpuidle_driver *drv = &tegra_idle_driver;
46
47 ret = cpuidle_register_driver(&tegra_idle_driver);
48 if (ret) {
49 pr_err("CPUidle driver registration failed\n");
50 return ret;
51 }
52
53 for_each_possible_cpu(cpu) {
54 dev = &per_cpu(tegra_idle_device, cpu);
55 dev->cpu = cpu;
56
57 dev->state_count = drv->state_count;
58 ret = cpuidle_register_device(dev);
59 if (ret) {
60 pr_err("CPU%u: CPUidle device registration failed\n",
61 cpu);
62 return ret;
63 }
64 }
65 return 0;
66}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c
new file mode 100644
index 00000000000..5e8cbf5b799
--- /dev/null
+++ b/arch/arm/mach-tegra/cpuidle-tegra30.c
@@ -0,0 +1,188 @@
1/*
2 * CPU idle driver for Tegra CPUs
3 *
4 * Copyright (c) 2010-2012, NVIDIA Corporation.
5 * Copyright (c) 2011 Google, Inc.
6 * Author: Colin Cross <ccross@android.com>
7 * Gary King <gking@nvidia.com>
8 *
9 * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 */
21
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/cpuidle.h>
25#include <linux/cpu_pm.h>
26#include <linux/clockchips.h>
27
28#include <asm/cpuidle.h>
29#include <asm/proc-fns.h>
30#include <asm/suspend.h>
31#include <asm/smp_plat.h>
32
33#include "pm.h"
34#include "sleep.h"
35#include "tegra_cpu_car.h"
36
37#ifdef CONFIG_PM_SLEEP
38static int tegra30_idle_lp2(struct cpuidle_device *dev,
39 struct cpuidle_driver *drv,
40 int index);
41#endif
42
43static struct cpuidle_driver tegra_idle_driver = {
44 .name = "tegra_idle",
45 .owner = THIS_MODULE,
46 .en_core_tk_irqen = 1,
47#ifdef CONFIG_PM_SLEEP
48 .state_count = 2,
49#else
50 .state_count = 1,
51#endif
52 .states = {
53 [0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
54#ifdef CONFIG_PM_SLEEP
55 [1] = {
56 .enter = tegra30_idle_lp2,
57 .exit_latency = 2000,
58 .target_residency = 2200,
59 .power_usage = 0,
60 .flags = CPUIDLE_FLAG_TIME_VALID,
61 .name = "powered-down",
62 .desc = "CPU power gated",
63 },
64#endif
65 },
66};
67
68static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
69
70#ifdef CONFIG_PM_SLEEP
71static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
72 struct cpuidle_driver *drv,
73 int index)
74{
75 struct cpuidle_state *state = &drv->states[index];
76 u32 cpu_on_time = state->exit_latency;
77 u32 cpu_off_time = state->target_residency - state->exit_latency;
78
79 /* All CPUs entering LP2 is not working.
80 * Don't let CPU0 enter LP2 when any secondary CPU is online.
81 */
82 if (num_online_cpus() > 1 || !tegra_cpu_rail_off_ready()) {
83 cpu_do_idle();
84 return false;
85 }
86
87 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
88
89 tegra_idle_lp2_last(cpu_on_time, cpu_off_time);
90
91 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
92
93 return true;
94}
95
96#ifdef CONFIG_SMP
97static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
98 struct cpuidle_driver *drv,
99 int index)
100{
101 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
102
103 smp_wmb();
104
105 save_cpu_arch_register();
106
107 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
108
109 restore_cpu_arch_register();
110
111 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
112
113 return true;
114}
115#else
116static inline bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
117 struct cpuidle_driver *drv,
118 int index)
119{
120 return true;
121}
122#endif
123
124static int __cpuinit tegra30_idle_lp2(struct cpuidle_device *dev,
125 struct cpuidle_driver *drv,
126 int index)
127{
128 u32 cpu = is_smp() ? cpu_logical_map(dev->cpu) : dev->cpu;
129 bool entered_lp2 = false;
130 bool last_cpu;
131
132 local_fiq_disable();
133
134 last_cpu = tegra_set_cpu_in_lp2(cpu);
135 cpu_pm_enter();
136
137 if (cpu == 0) {
138 if (last_cpu)
139 entered_lp2 = tegra30_cpu_cluster_power_down(dev, drv,
140 index);
141 else
142 cpu_do_idle();
143 } else {
144 entered_lp2 = tegra30_cpu_core_power_down(dev, drv, index);
145 }
146
147 cpu_pm_exit();
148 tegra_clear_cpu_in_lp2(cpu);
149
150 local_fiq_enable();
151
152 smp_rmb();
153
154 return (entered_lp2) ? index : 0;
155}
156#endif
157
158int __init tegra30_cpuidle_init(void)
159{
160 int ret;
161 unsigned int cpu;
162 struct cpuidle_device *dev;
163 struct cpuidle_driver *drv = &tegra_idle_driver;
164
165#ifdef CONFIG_PM_SLEEP
166 tegra_tear_down_cpu = tegra30_tear_down_cpu;
167#endif
168
169 ret = cpuidle_register_driver(&tegra_idle_driver);
170 if (ret) {
171 pr_err("CPUidle driver registration failed\n");
172 return ret;
173 }
174
175 for_each_possible_cpu(cpu) {
176 dev = &per_cpu(tegra_idle_device, cpu);
177 dev->cpu = cpu;
178
179 dev->state_count = drv->state_count;
180 ret = cpuidle_register_device(dev);
181 if (ret) {
182 pr_err("CPU%u: CPUidle device registration failed\n",
183 cpu);
184 return ret;
185 }
186 }
187 return 0;
188}
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
index 566e2f88899..d0651397aec 100644
--- a/arch/arm/mach-tegra/cpuidle.c
+++ b/arch/arm/mach-tegra/cpuidle.c
@@ -23,85 +23,26 @@
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/cpu.h>
27#include <linux/cpuidle.h>
28#include <linux/hrtimer.h>
29 26
30#include <asm/proc-fns.h> 27#include "fuse.h"
31 28#include "cpuidle.h"
32#include <mach/iomap.h>
33
34static int tegra_idle_enter_lp3(struct cpuidle_device *dev,
35 struct cpuidle_driver *drv, int index);
36
37struct cpuidle_driver tegra_idle_driver = {
38 .name = "tegra_idle",
39 .owner = THIS_MODULE,
40 .state_count = 1,
41 .states = {
42 [0] = {
43 .enter = tegra_idle_enter_lp3,
44 .exit_latency = 10,
45 .target_residency = 10,
46 .power_usage = 600,
47 .flags = CPUIDLE_FLAG_TIME_VALID,
48 .name = "LP3",
49 .desc = "CPU flow-controlled",
50 },
51 },
52};
53
54static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
55
56static int tegra_idle_enter_lp3(struct cpuidle_device *dev,
57 struct cpuidle_driver *drv, int index)
58{
59 ktime_t enter, exit;
60 s64 us;
61
62 local_irq_disable();
63 local_fiq_disable();
64
65 enter = ktime_get();
66
67 cpu_do_idle();
68
69 exit = ktime_sub(ktime_get(), enter);
70 us = ktime_to_us(exit);
71
72 local_fiq_enable();
73 local_irq_enable();
74
75 dev->last_residency = us;
76
77 return index;
78}
79 29
80static int __init tegra_cpuidle_init(void) 30static int __init tegra_cpuidle_init(void)
81{ 31{
82 int ret; 32 int ret;
83 unsigned int cpu;
84 struct cpuidle_device *dev;
85 struct cpuidle_driver *drv = &tegra_idle_driver;
86 33
87 ret = cpuidle_register_driver(&tegra_idle_driver); 34 switch (tegra_chip_id) {
88 if (ret) { 35 case TEGRA20:
89 pr_err("CPUidle driver registration failed\n"); 36 ret = tegra20_cpuidle_init();
90 return ret; 37 break;
38 case TEGRA30:
39 ret = tegra30_cpuidle_init();
40 break;
41 default:
42 ret = -ENODEV;
43 break;
91 } 44 }
92 45
93 for_each_possible_cpu(cpu) { 46 return ret;
94 dev = &per_cpu(tegra_idle_device, cpu);
95 dev->cpu = cpu;
96
97 dev->state_count = drv->state_count;
98 ret = cpuidle_register_device(dev);
99 if (ret) {
100 pr_err("CPU%u: CPUidle device registration failed\n",
101 cpu);
102 return ret;
103 }
104 }
105 return 0;
106} 47}
107device_initcall(tegra_cpuidle_init); 48device_initcall(tegra_cpuidle_init);
diff --git a/arch/arm/mach-tegra/cpuidle.h b/arch/arm/mach-tegra/cpuidle.h
new file mode 100644
index 00000000000..496204d34e5
--- /dev/null
+++ b/arch/arm/mach-tegra/cpuidle.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2012, NVIDIA Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __MACH_TEGRA_CPUIDLE_H
18#define __MACH_TEGRA_CPUIDLE_H
19
20#ifdef CONFIG_ARCH_TEGRA_2x_SOC
21int tegra20_cpuidle_init(void);
22#else
23static inline int tegra20_cpuidle_init(void) { return -ENODEV; }
24#endif
25
26#ifdef CONFIG_ARCH_TEGRA_3x_SOC
27int tegra30_cpuidle_init(void);
28#else
29static inline int tegra30_cpuidle_init(void) { return -ENODEV; }
30#endif
31
32#endif
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
index f07488e0bd3..a2250ddae79 100644
--- a/arch/arm/mach-tegra/flowctrl.c
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -21,10 +21,10 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24#include <linux/cpumask.h>
25#include <mach/iomap.h>
26 25
27#include "flowctrl.h" 26#include "flowctrl.h"
27#include "iomap.h"
28 28
29u8 flowctrl_offset_halt_cpu[] = { 29u8 flowctrl_offset_halt_cpu[] = {
30 FLOW_CTRL_HALT_CPU0_EVENTS, 30 FLOW_CTRL_HALT_CPU0_EVENTS,
@@ -51,6 +51,14 @@ static void flowctrl_update(u8 offset, u32 value)
51 readl_relaxed(addr); 51 readl_relaxed(addr);
52} 52}
53 53
54u32 flowctrl_read_cpu_csr(unsigned int cpuid)
55{
56 u8 offset = flowctrl_offset_cpu_csr[cpuid];
57 void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset;
58
59 return readl(addr);
60}
61
54void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) 62void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
55{ 63{
56 return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); 64 return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value);
@@ -60,3 +68,41 @@ void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value)
60{ 68{
61 return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); 69 return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value);
62} 70}
71
72void flowctrl_cpu_suspend_enter(unsigned int cpuid)
73{
74 unsigned int reg;
75 int i;
76
77 reg = flowctrl_read_cpu_csr(cpuid);
78 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP; /* clear wfe bitmap */
79 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFI_BITMAP; /* clear wfi bitmap */
80 reg |= FLOW_CTRL_CSR_INTR_FLAG; /* clear intr flag */
81 reg |= FLOW_CTRL_CSR_EVENT_FLAG; /* clear event flag */
82 reg |= TEGRA30_FLOW_CTRL_CSR_WFI_CPU0 << cpuid; /* pwr gating on wfi */
83 reg |= FLOW_CTRL_CSR_ENABLE; /* pwr gating */
84 flowctrl_write_cpu_csr(cpuid, reg);
85
86 for (i = 0; i < num_possible_cpus(); i++) {
87 if (i == cpuid)
88 continue;
89 reg = flowctrl_read_cpu_csr(i);
90 reg |= FLOW_CTRL_CSR_EVENT_FLAG;
91 reg |= FLOW_CTRL_CSR_INTR_FLAG;
92 flowctrl_write_cpu_csr(i, reg);
93 }
94}
95
96void flowctrl_cpu_suspend_exit(unsigned int cpuid)
97{
98 unsigned int reg;
99
100 /* Disable powergating via flow controller for CPU0 */
101 reg = flowctrl_read_cpu_csr(cpuid);
102 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP; /* clear wfe bitmap */
103 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFI_BITMAP; /* clear wfi bitmap */
104 reg &= ~FLOW_CTRL_CSR_ENABLE; /* clear enable */
105 reg |= FLOW_CTRL_CSR_INTR_FLAG; /* clear intr */
106 reg |= FLOW_CTRL_CSR_EVENT_FLAG; /* clear event */
107 flowctrl_write_cpu_csr(cpuid, reg);
108}
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h
index 19428173855..0798dec1832 100644
--- a/arch/arm/mach-tegra/flowctrl.h
+++ b/arch/arm/mach-tegra/flowctrl.h
@@ -34,9 +34,17 @@
34#define FLOW_CTRL_HALT_CPU1_EVENTS 0x14 34#define FLOW_CTRL_HALT_CPU1_EVENTS 0x14
35#define FLOW_CTRL_CPU1_CSR 0x18 35#define FLOW_CTRL_CPU1_CSR 0x18
36 36
37#define TEGRA30_FLOW_CTRL_CSR_WFI_CPU0 (1 << 8)
38#define TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP (0xF << 4)
39#define TEGRA30_FLOW_CTRL_CSR_WFI_BITMAP (0xF << 8)
40
37#ifndef __ASSEMBLY__ 41#ifndef __ASSEMBLY__
42u32 flowctrl_read_cpu_csr(unsigned int cpuid);
38void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value); 43void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value);
39void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value); 44void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
45
46void flowctrl_cpu_suspend_enter(unsigned int cpuid);
47void flowctrl_cpu_suspend_exit(unsigned int cpuid);
40#endif 48#endif
41 49
42#endif 50#endif
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index 0b7db174a5d..8121742711f 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -21,22 +21,28 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/export.h> 22#include <linux/export.h>
23 23
24#include <mach/iomap.h>
25
26#include "fuse.h" 24#include "fuse.h"
25#include "iomap.h"
27#include "apbio.h" 26#include "apbio.h"
28 27
29#define FUSE_UID_LOW 0x108 28#define FUSE_UID_LOW 0x108
30#define FUSE_UID_HIGH 0x10c 29#define FUSE_UID_HIGH 0x10c
31#define FUSE_SKU_INFO 0x110 30#define FUSE_SKU_INFO 0x110
32#define FUSE_SPARE_BIT 0x200 31
32#define TEGRA20_FUSE_SPARE_BIT 0x200
33#define TEGRA30_FUSE_SPARE_BIT 0x244
33 34
34int tegra_sku_id; 35int tegra_sku_id;
35int tegra_cpu_process_id; 36int tegra_cpu_process_id;
36int tegra_core_process_id; 37int tegra_core_process_id;
37int tegra_chip_id; 38int tegra_chip_id;
39int tegra_cpu_speedo_id; /* only exist in Tegra30 and later */
40int tegra_soc_speedo_id;
38enum tegra_revision tegra_revision; 41enum tegra_revision tegra_revision;
39 42
43static int tegra_fuse_spare_bit;
44static void (*tegra_init_speedo_data)(void);
45
40/* The BCT to use at boot is specified by board straps that can be read 46/* The BCT to use at boot is specified by board straps that can be read
41 * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs. 47 * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs.
42 */ 48 */
@@ -57,14 +63,14 @@ static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
57 [TEGRA_REVISION_A04] = "A04", 63 [TEGRA_REVISION_A04] = "A04",
58}; 64};
59 65
60static inline u32 tegra_fuse_readl(unsigned long offset) 66u32 tegra_fuse_readl(unsigned long offset)
61{ 67{
62 return tegra_apb_readl(TEGRA_FUSE_BASE + offset); 68 return tegra_apb_readl(TEGRA_FUSE_BASE + offset);
63} 69}
64 70
65static inline bool get_spare_fuse(int bit) 71bool tegra_spare_fuse(int bit)
66{ 72{
67 return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4); 73 return tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4);
68} 74}
69 75
70static enum tegra_revision tegra_get_revision(u32 id) 76static enum tegra_revision tegra_get_revision(u32 id)
@@ -78,7 +84,7 @@ static enum tegra_revision tegra_get_revision(u32 id)
78 return TEGRA_REVISION_A02; 84 return TEGRA_REVISION_A02;
79 case 3: 85 case 3:
80 if (tegra_chip_id == TEGRA20 && 86 if (tegra_chip_id == TEGRA20 &&
81 (get_spare_fuse(18) || get_spare_fuse(19))) 87 (tegra_spare_fuse(18) || tegra_spare_fuse(19)))
82 return TEGRA_REVISION_A03p; 88 return TEGRA_REVISION_A03p;
83 else 89 else
84 return TEGRA_REVISION_A03; 90 return TEGRA_REVISION_A03;
@@ -89,6 +95,16 @@ static enum tegra_revision tegra_get_revision(u32 id)
89 } 95 }
90} 96}
91 97
98static void tegra_get_process_id(void)
99{
100 u32 reg;
101
102 reg = tegra_fuse_readl(tegra_fuse_spare_bit);
103 tegra_cpu_process_id = (reg >> 6) & 3;
104 reg = tegra_fuse_readl(tegra_fuse_spare_bit);
105 tegra_core_process_id = (reg >> 12) & 3;
106}
107
92void tegra_init_fuse(void) 108void tegra_init_fuse(void)
93{ 109{
94 u32 id; 110 u32 id;
@@ -100,19 +116,29 @@ void tegra_init_fuse(void)
100 reg = tegra_fuse_readl(FUSE_SKU_INFO); 116 reg = tegra_fuse_readl(FUSE_SKU_INFO);
101 tegra_sku_id = reg & 0xFF; 117 tegra_sku_id = reg & 0xFF;
102 118
103 reg = tegra_fuse_readl(FUSE_SPARE_BIT);
104 tegra_cpu_process_id = (reg >> 6) & 3;
105
106 reg = tegra_fuse_readl(FUSE_SPARE_BIT);
107 tegra_core_process_id = (reg >> 12) & 3;
108
109 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT); 119 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
110 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT; 120 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
111 121
112 id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804); 122 id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
113 tegra_chip_id = (id >> 8) & 0xff; 123 tegra_chip_id = (id >> 8) & 0xff;
114 124
125 switch (tegra_chip_id) {
126 case TEGRA20:
127 tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT;
128 tegra_init_speedo_data = &tegra20_init_speedo_data;
129 break;
130 case TEGRA30:
131 tegra_fuse_spare_bit = TEGRA30_FUSE_SPARE_BIT;
132 tegra_init_speedo_data = &tegra30_init_speedo_data;
133 break;
134 default:
135 pr_warn("Tegra: unknown chip id %d\n", tegra_chip_id);
136 tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT;
137 tegra_init_speedo_data = &tegra_get_process_id;
138 }
139
115 tegra_revision = tegra_get_revision(id); 140 tegra_revision = tegra_get_revision(id);
141 tegra_init_speedo_data();
116 142
117 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", 143 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n",
118 tegra_revision_name[tegra_revision], 144 tegra_revision_name[tegra_revision],
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index d2107b2cb85..ff1383dd61a 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -42,11 +42,27 @@ extern int tegra_sku_id;
42extern int tegra_cpu_process_id; 42extern int tegra_cpu_process_id;
43extern int tegra_core_process_id; 43extern int tegra_core_process_id;
44extern int tegra_chip_id; 44extern int tegra_chip_id;
45extern int tegra_cpu_speedo_id; /* only exist in Tegra30 and later */
46extern int tegra_soc_speedo_id;
45extern enum tegra_revision tegra_revision; 47extern enum tegra_revision tegra_revision;
46 48
47extern int tegra_bct_strapping; 49extern int tegra_bct_strapping;
48 50
49unsigned long long tegra_chip_uid(void); 51unsigned long long tegra_chip_uid(void);
50void tegra_init_fuse(void); 52void tegra_init_fuse(void);
53bool tegra_spare_fuse(int bit);
54u32 tegra_fuse_readl(unsigned long offset);
55
56#ifdef CONFIG_ARCH_TEGRA_2x_SOC
57void tegra20_init_speedo_data(void);
58#else
59static inline void tegra20_init_speedo_data(void) {}
60#endif
61
62#ifdef CONFIG_ARCH_TEGRA_3x_SOC
63void tegra30_init_speedo_data(void);
64#else
65static inline void tegra30_init_speedo_data(void) {}
66#endif
51 67
52#endif 68#endif
diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
index 6addc78cb6b..4a317fae686 100644
--- a/arch/arm/mach-tegra/headsmp.S
+++ b/arch/arm/mach-tegra/headsmp.S
@@ -2,10 +2,11 @@
2#include <linux/init.h> 2#include <linux/init.h>
3 3
4#include <asm/cache.h> 4#include <asm/cache.h>
5 5#include <asm/asm-offsets.h>
6#include <mach/iomap.h> 6#include <asm/hardware/cache-l2x0.h>
7 7
8#include "flowctrl.h" 8#include "flowctrl.h"
9#include "iomap.h"
9#include "reset.h" 10#include "reset.h"
10#include "sleep.h" 11#include "sleep.h"
11 12
@@ -69,6 +70,64 @@ ENTRY(tegra_secondary_startup)
69 b secondary_startup 70 b secondary_startup
70ENDPROC(tegra_secondary_startup) 71ENDPROC(tegra_secondary_startup)
71 72
73#ifdef CONFIG_PM_SLEEP
74/*
75 * tegra_resume
76 *
77 * CPU boot vector when restarting the a CPU following
78 * an LP2 transition. Also branched to by LP0 and LP1 resume after
79 * re-enabling sdram.
80 */
81ENTRY(tegra_resume)
82 bl v7_invalidate_l1
83 /* Enable coresight */
84 mov32 r0, 0xC5ACCE55
85 mcr p14, 0, r0, c7, c12, 6
86
87 cpu_id r0
88 cmp r0, #0 @ CPU0?
89 bne cpu_resume @ no
90
91#ifdef CONFIG_ARCH_TEGRA_3x_SOC
92 /* Are we on Tegra20? */
93 mov32 r6, TEGRA_APB_MISC_BASE
94 ldr r0, [r6, #APB_MISC_GP_HIDREV]
95 and r0, r0, #0xff00
96 cmp r0, #(0x20 << 8)
97 beq 1f @ Yes
98 /* Clear the flow controller flags for this CPU. */
99 mov32 r2, TEGRA_FLOW_CTRL_BASE + FLOW_CTRL_CPU0_CSR @ CPU0 CSR
100 ldr r1, [r2]
101 /* Clear event & intr flag */
102 orr r1, r1, \
103 #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
104 movw r0, #0x0FFD @ enable, cluster_switch, immed, & bitmaps
105 bic r1, r1, r0
106 str r1, [r2]
1071:
108#endif
109
110#ifdef CONFIG_HAVE_ARM_SCU
111 /* enable SCU */
112 mov32 r0, TEGRA_ARM_PERIF_BASE
113 ldr r1, [r0]
114 orr r1, r1, #1
115 str r1, [r0]
116#endif
117
118 /* L2 cache resume & re-enable */
119 l2_cache_resume r0, r1, r2, l2x0_saved_regs_addr
120
121 b cpu_resume
122ENDPROC(tegra_resume)
123#endif
124
125#ifdef CONFIG_CACHE_L2X0
126 .globl l2x0_saved_regs_addr
127l2x0_saved_regs_addr:
128 .long 0
129#endif
130
72 .align L1_CACHE_SHIFT 131 .align L1_CACHE_SHIFT
73ENTRY(__tegra_cpu_reset_handler_start) 132ENTRY(__tegra_cpu_reset_handler_start)
74 133
@@ -122,6 +181,17 @@ ENTRY(__tegra_cpu_reset_handler)
1221: 1811:
123#endif 182#endif
124 183
184 /* Waking up from LP2? */
185 ldr r9, [r12, #RESET_DATA(MASK_LP2)]
186 tst r9, r11 @ if in_lp2
187 beq __is_not_lp2
188 ldr lr, [r12, #RESET_DATA(STARTUP_LP2)]
189 cmp lr, #0
190 bleq __die @ no LP2 startup handler
191 bx lr
192
193__is_not_lp2:
194
125#ifdef CONFIG_SMP 195#ifdef CONFIG_SMP
126 /* 196 /*
127 * Can only be secondary boot (initial or hotplug) but CPU 0 197 * Can only be secondary boot (initial or hotplug) but CPU 0
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S
deleted file mode 100644
index 8ce0661b8a3..00000000000
--- a/arch/arm/mach-tegra/include/mach/debug-macro.S
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/debug-macro.S
3 *
4 * Copyright (C) 2010,2011 Google, Inc.
5 * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved.
6 *
7 * Author:
8 * Colin Cross <ccross@google.com>
9 * Erik Gilling <konkers@google.com>
10 * Doug Anderson <dianders@chromium.org>
11 * Stephen Warren <swarren@nvidia.com>
12 *
13 * Portions based on mach-omap2's debug-macro.S
14 * Copyright (C) 1994-1999 Russell King
15 *
16 * This software is licensed under the terms of the GNU General Public
17 * License version 2, as published by the Free Software Foundation, and
18 * may be copied, distributed, and modified under those terms.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 */
26
27#include <linux/serial_reg.h>
28
29#include <mach/iomap.h>
30#include <mach/irammap.h>
31
32 .macro addruart, rp, rv, tmp
33 adr \rp, 99f @ actual addr of 99f
34 ldr \rv, [\rp] @ linked addr is stored there
35 sub \rv, \rv, \rp @ offset between the two
36 ldr \rp, [\rp, #4] @ linked tegra_uart_config
37 sub \tmp, \rp, \rv @ actual tegra_uart_config
38 ldr \rp, [\tmp] @ Load tegra_uart_config
39 cmp \rp, #1 @ needs intitialization?
40 bne 100f @ no; go load the addresses
41 mov \rv, #0 @ yes; record init is done
42 str \rv, [\tmp]
43 mov \rp, #TEGRA_IRAM_BASE @ See if cookie is in IRAM
44 ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET]
45 movw \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE & 0xffff
46 movt \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE >> 16
47 cmp \rv, \rp @ Cookie present?
48 bne 100f @ No, use default UART
49 mov \rp, #TEGRA_IRAM_BASE @ Load UART address from IRAM
50 ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET + 4]
51 str \rv, [\tmp, #4] @ Store in tegra_uart_phys
52 sub \rv, \rv, #IO_APB_PHYS @ Calculate virt address
53 add \rv, \rv, #IO_APB_VIRT
54 str \rv, [\tmp, #8] @ Store in tegra_uart_virt
55 b 100f
56
57 .align
5899: .word .
59 .word tegra_uart_config
60 .ltorg
61
62100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys
63 ldr \rv, [\tmp, #8] @ Load tegra_uart_virt
64 .endm
65
66#define UART_SHIFT 2
67
68/*
69 * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra
70 * check to make sure that we aren't in the CONFIG_TEGRA_DEBUG_UART_NONE case.
71 * We use the fact that all 5 valid UART addresses all have something in the
72 * 2nd-to-lowest byte.
73 */
74
75 .macro senduart, rd, rx
76 tst \rx, #0x0000ff00
77 strneb \rd, [\rx, #UART_TX << UART_SHIFT]
781001:
79 .endm
80
81 .macro busyuart, rd, rx
82 tst \rx, #0x0000ff00
83 beq 1002f
841001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
85 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
86 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
87 bne 1001b
881002:
89 .endm
90
91 .macro waituart, rd, rx
92#ifdef FLOW_CONTROL
93 tst \rx, #0x0000ff00
94 beq 1002f
951001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT]
96 tst \rd, #UART_MSR_CTS
97 beq 1001b
981002:
99#endif
100 .endm
diff --git a/arch/arm/mach-tegra/include/mach/dma.h b/arch/arm/mach-tegra/include/mach/dma.h
deleted file mode 100644
index 3081cc6dda3..00000000000
--- a/arch/arm/mach-tegra/include/mach/dma.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/dma.h
3 *
4 * Copyright (c) 2008-2009, 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 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __MACH_TEGRA_DMA_H
22#define __MACH_TEGRA_DMA_H
23
24#include <linux/list.h>
25
26#define TEGRA_DMA_REQ_SEL_CNTR 0
27#define TEGRA_DMA_REQ_SEL_I2S_2 1
28#define TEGRA_DMA_REQ_SEL_I2S_1 2
29#define TEGRA_DMA_REQ_SEL_SPD_I 3
30#define TEGRA_DMA_REQ_SEL_UI_I 4
31#define TEGRA_DMA_REQ_SEL_MIPI 5
32#define TEGRA_DMA_REQ_SEL_I2S2_2 6
33#define TEGRA_DMA_REQ_SEL_I2S2_1 7
34#define TEGRA_DMA_REQ_SEL_UARTA 8
35#define TEGRA_DMA_REQ_SEL_UARTB 9
36#define TEGRA_DMA_REQ_SEL_UARTC 10
37#define TEGRA_DMA_REQ_SEL_SPI 11
38#define TEGRA_DMA_REQ_SEL_AC97 12
39#define TEGRA_DMA_REQ_SEL_ACMODEM 13
40#define TEGRA_DMA_REQ_SEL_SL4B 14
41#define TEGRA_DMA_REQ_SEL_SL2B1 15
42#define TEGRA_DMA_REQ_SEL_SL2B2 16
43#define TEGRA_DMA_REQ_SEL_SL2B3 17
44#define TEGRA_DMA_REQ_SEL_SL2B4 18
45#define TEGRA_DMA_REQ_SEL_UARTD 19
46#define TEGRA_DMA_REQ_SEL_UARTE 20
47#define TEGRA_DMA_REQ_SEL_I2C 21
48#define TEGRA_DMA_REQ_SEL_I2C2 22
49#define TEGRA_DMA_REQ_SEL_I2C3 23
50#define TEGRA_DMA_REQ_SEL_DVC_I2C 24
51#define TEGRA_DMA_REQ_SEL_OWR 25
52#define TEGRA_DMA_REQ_SEL_INVALID 31
53
54#endif
diff --git a/arch/arm/mach-tegra/include/mach/irqs.h b/arch/arm/mach-tegra/include/mach/irqs.h
deleted file mode 100644
index aad1a2c1d71..00000000000
--- a/arch/arm/mach-tegra/include/mach/irqs.h
+++ /dev/null
@@ -1,182 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/irqs.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Colin Cross <ccross@google.com>
8 * Erik Gilling <konkers@google.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#ifndef __MACH_TEGRA_IRQS_H
22#define __MACH_TEGRA_IRQS_H
23
24#define INT_GIC_BASE 0
25
26#define IRQ_LOCALTIMER 29
27
28/* Primary Interrupt Controller */
29#define INT_PRI_BASE (INT_GIC_BASE + 32)
30#define INT_TMR1 (INT_PRI_BASE + 0)
31#define INT_TMR2 (INT_PRI_BASE + 1)
32#define INT_RTC (INT_PRI_BASE + 2)
33#define INT_I2S2 (INT_PRI_BASE + 3)
34#define INT_SHR_SEM_INBOX_IBF (INT_PRI_BASE + 4)
35#define INT_SHR_SEM_INBOX_IBE (INT_PRI_BASE + 5)
36#define INT_SHR_SEM_OUTBOX_IBF (INT_PRI_BASE + 6)
37#define INT_SHR_SEM_OUTBOX_IBE (INT_PRI_BASE + 7)
38#define INT_VDE_UCQ_ERROR (INT_PRI_BASE + 8)
39#define INT_VDE_SYNC_TOKEN (INT_PRI_BASE + 9)
40#define INT_VDE_BSE_V (INT_PRI_BASE + 10)
41#define INT_VDE_BSE_A (INT_PRI_BASE + 11)
42#define INT_VDE_SXE (INT_PRI_BASE + 12)
43#define INT_I2S1 (INT_PRI_BASE + 13)
44#define INT_SDMMC1 (INT_PRI_BASE + 14)
45#define INT_SDMMC2 (INT_PRI_BASE + 15)
46#define INT_XIO (INT_PRI_BASE + 16)
47#define INT_VDE (INT_PRI_BASE + 17)
48#define INT_AVP_UCQ (INT_PRI_BASE + 18)
49#define INT_SDMMC3 (INT_PRI_BASE + 19)
50#define INT_USB (INT_PRI_BASE + 20)
51#define INT_USB2 (INT_PRI_BASE + 21)
52#define INT_PRI_RES_22 (INT_PRI_BASE + 22)
53#define INT_EIDE (INT_PRI_BASE + 23)
54#define INT_NANDFLASH (INT_PRI_BASE + 24)
55#define INT_VCP (INT_PRI_BASE + 25)
56#define INT_APB_DMA (INT_PRI_BASE + 26)
57#define INT_AHB_DMA (INT_PRI_BASE + 27)
58#define INT_GNT_0 (INT_PRI_BASE + 28)
59#define INT_GNT_1 (INT_PRI_BASE + 29)
60#define INT_OWR (INT_PRI_BASE + 30)
61#define INT_SDMMC4 (INT_PRI_BASE + 31)
62
63/* Secondary Interrupt Controller */
64#define INT_SEC_BASE (INT_PRI_BASE + 32)
65#define INT_GPIO1 (INT_SEC_BASE + 0)
66#define INT_GPIO2 (INT_SEC_BASE + 1)
67#define INT_GPIO3 (INT_SEC_BASE + 2)
68#define INT_GPIO4 (INT_SEC_BASE + 3)
69#define INT_UARTA (INT_SEC_BASE + 4)
70#define INT_UARTB (INT_SEC_BASE + 5)
71#define INT_I2C (INT_SEC_BASE + 6)
72#define INT_SPI (INT_SEC_BASE + 7)
73#define INT_TWC (INT_SEC_BASE + 8)
74#define INT_TMR3 (INT_SEC_BASE + 9)
75#define INT_TMR4 (INT_SEC_BASE + 10)
76#define INT_FLOW_RSM0 (INT_SEC_BASE + 11)
77#define INT_FLOW_RSM1 (INT_SEC_BASE + 12)
78#define INT_SPDIF (INT_SEC_BASE + 13)
79#define INT_UARTC (INT_SEC_BASE + 14)
80#define INT_MIPI (INT_SEC_BASE + 15)
81#define INT_EVENTA (INT_SEC_BASE + 16)
82#define INT_EVENTB (INT_SEC_BASE + 17)
83#define INT_EVENTC (INT_SEC_BASE + 18)
84#define INT_EVENTD (INT_SEC_BASE + 19)
85#define INT_VFIR (INT_SEC_BASE + 20)
86#define INT_DVC (INT_SEC_BASE + 21)
87#define INT_SYS_STATS_MON (INT_SEC_BASE + 22)
88#define INT_GPIO5 (INT_SEC_BASE + 23)
89#define INT_CPU0_PMU_INTR (INT_SEC_BASE + 24)
90#define INT_CPU1_PMU_INTR (INT_SEC_BASE + 25)
91#define INT_SEC_RES_26 (INT_SEC_BASE + 26)
92#define INT_S_LINK1 (INT_SEC_BASE + 27)
93#define INT_APB_DMA_COP (INT_SEC_BASE + 28)
94#define INT_AHB_DMA_COP (INT_SEC_BASE + 29)
95#define INT_DMA_TX (INT_SEC_BASE + 30)
96#define INT_DMA_RX (INT_SEC_BASE + 31)
97
98/* Tertiary Interrupt Controller */
99#define INT_TRI_BASE (INT_SEC_BASE + 32)
100#define INT_HOST1X_COP_SYNCPT (INT_TRI_BASE + 0)
101#define INT_HOST1X_MPCORE_SYNCPT (INT_TRI_BASE + 1)
102#define INT_HOST1X_COP_GENERAL (INT_TRI_BASE + 2)
103#define INT_HOST1X_MPCORE_GENERAL (INT_TRI_BASE + 3)
104#define INT_MPE_GENERAL (INT_TRI_BASE + 4)
105#define INT_VI_GENERAL (INT_TRI_BASE + 5)
106#define INT_EPP_GENERAL (INT_TRI_BASE + 6)
107#define INT_ISP_GENERAL (INT_TRI_BASE + 7)
108#define INT_2D_GENERAL (INT_TRI_BASE + 8)
109#define INT_DISPLAY_GENERAL (INT_TRI_BASE + 9)
110#define INT_DISPLAY_B_GENERAL (INT_TRI_BASE + 10)
111#define INT_HDMI (INT_TRI_BASE + 11)
112#define INT_TVO_GENERAL (INT_TRI_BASE + 12)
113#define INT_MC_GENERAL (INT_TRI_BASE + 13)
114#define INT_EMC_GENERAL (INT_TRI_BASE + 14)
115#define INT_TRI_RES_15 (INT_TRI_BASE + 15)
116#define INT_TRI_RES_16 (INT_TRI_BASE + 16)
117#define INT_AC97 (INT_TRI_BASE + 17)
118#define INT_SPI_2 (INT_TRI_BASE + 18)
119#define INT_SPI_3 (INT_TRI_BASE + 19)
120#define INT_I2C2 (INT_TRI_BASE + 20)
121#define INT_KBC (INT_TRI_BASE + 21)
122#define INT_EXTERNAL_PMU (INT_TRI_BASE + 22)
123#define INT_GPIO6 (INT_TRI_BASE + 23)
124#define INT_TVDAC (INT_TRI_BASE + 24)
125#define INT_GPIO7 (INT_TRI_BASE + 25)
126#define INT_UARTD (INT_TRI_BASE + 26)
127#define INT_UARTE (INT_TRI_BASE + 27)
128#define INT_I2C3 (INT_TRI_BASE + 28)
129#define INT_SPI_4 (INT_TRI_BASE + 29)
130#define INT_TRI_RES_30 (INT_TRI_BASE + 30)
131#define INT_SW_RESERVED (INT_TRI_BASE + 31)
132
133/* Quaternary Interrupt Controller */
134#define INT_QUAD_BASE (INT_TRI_BASE + 32)
135#define INT_SNOR (INT_QUAD_BASE + 0)
136#define INT_USB3 (INT_QUAD_BASE + 1)
137#define INT_PCIE_INTR (INT_QUAD_BASE + 2)
138#define INT_PCIE_MSI (INT_QUAD_BASE + 3)
139#define INT_QUAD_RES_4 (INT_QUAD_BASE + 4)
140#define INT_QUAD_RES_5 (INT_QUAD_BASE + 5)
141#define INT_QUAD_RES_6 (INT_QUAD_BASE + 6)
142#define INT_QUAD_RES_7 (INT_QUAD_BASE + 7)
143#define INT_APB_DMA_CH0 (INT_QUAD_BASE + 8)
144#define INT_APB_DMA_CH1 (INT_QUAD_BASE + 9)
145#define INT_APB_DMA_CH2 (INT_QUAD_BASE + 10)
146#define INT_APB_DMA_CH3 (INT_QUAD_BASE + 11)
147#define INT_APB_DMA_CH4 (INT_QUAD_BASE + 12)
148#define INT_APB_DMA_CH5 (INT_QUAD_BASE + 13)
149#define INT_APB_DMA_CH6 (INT_QUAD_BASE + 14)
150#define INT_APB_DMA_CH7 (INT_QUAD_BASE + 15)
151#define INT_APB_DMA_CH8 (INT_QUAD_BASE + 16)
152#define INT_APB_DMA_CH9 (INT_QUAD_BASE + 17)
153#define INT_APB_DMA_CH10 (INT_QUAD_BASE + 18)
154#define INT_APB_DMA_CH11 (INT_QUAD_BASE + 19)
155#define INT_APB_DMA_CH12 (INT_QUAD_BASE + 20)
156#define INT_APB_DMA_CH13 (INT_QUAD_BASE + 21)
157#define INT_APB_DMA_CH14 (INT_QUAD_BASE + 22)
158#define INT_APB_DMA_CH15 (INT_QUAD_BASE + 23)
159#define INT_QUAD_RES_24 (INT_QUAD_BASE + 24)
160#define INT_QUAD_RES_25 (INT_QUAD_BASE + 25)
161#define INT_QUAD_RES_26 (INT_QUAD_BASE + 26)
162#define INT_QUAD_RES_27 (INT_QUAD_BASE + 27)
163#define INT_QUAD_RES_28 (INT_QUAD_BASE + 28)
164#define INT_QUAD_RES_29 (INT_QUAD_BASE + 29)
165#define INT_QUAD_RES_30 (INT_QUAD_BASE + 30)
166#define INT_QUAD_RES_31 (INT_QUAD_BASE + 31)
167
168/* Tegra30 has 5 banks of 32 IRQs */
169#define INT_MAIN_NR (32 * 5)
170#define INT_GPIO_BASE (INT_PRI_BASE + INT_MAIN_NR)
171
172/* Tegra30 has 8 banks of 32 GPIOs */
173#define INT_GPIO_NR (32 * 8)
174
175#define TEGRA_NR_IRQS (INT_GPIO_BASE + INT_GPIO_NR)
176
177#define INT_BOARD_BASE TEGRA_NR_IRQS
178#define NR_BOARD_IRQS 32
179
180#define NR_IRQS (INT_BOARD_BASE + NR_BOARD_IRQS)
181
182#endif
diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
index 4752b1a68f3..06763fe7529 100644
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ b/arch/arm/mach-tegra/include/mach/powergate.h
@@ -20,6 +20,8 @@
20#ifndef _MACH_TEGRA_POWERGATE_H_ 20#ifndef _MACH_TEGRA_POWERGATE_H_
21#define _MACH_TEGRA_POWERGATE_H_ 21#define _MACH_TEGRA_POWERGATE_H_
22 22
23struct clk;
24
23#define TEGRA_POWERGATE_CPU 0 25#define TEGRA_POWERGATE_CPU 0
24#define TEGRA_POWERGATE_3D 1 26#define TEGRA_POWERGATE_3D 1
25#define TEGRA_POWERGATE_VENC 2 27#define TEGRA_POWERGATE_VENC 2
diff --git a/arch/arm/mach-tegra/include/mach/tegra-ahb.h b/arch/arm/mach-tegra/include/mach/tegra-ahb.h
deleted file mode 100644
index e0f8c84b1d8..00000000000
--- a/arch/arm/mach-tegra/include/mach/tegra-ahb.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef __MACH_TEGRA_AHB_H__
15#define __MACH_TEGRA_AHB_H__
16
17extern int tegra_ahb_enable_smmu(struct device_node *ahb);
18
19#endif /* __MACH_TEGRA_AHB_H__ */
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h
index 937c4c50219..485003f9b63 100644
--- a/arch/arm/mach-tegra/include/mach/uncompress.h
+++ b/arch/arm/mach-tegra/include/mach/uncompress.h
@@ -28,8 +28,7 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/serial_reg.h> 29#include <linux/serial_reg.h>
30 30
31#include <mach/iomap.h> 31#include "../../iomap.h"
32#include <mach/irammap.h>
33 32
34#define BIT(x) (1 << (x)) 33#define BIT(x) (1 << (x))
35#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 34#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
@@ -52,17 +51,6 @@ static inline void flush(void)
52{ 51{
53} 52}
54 53
55static inline void save_uart_address(void)
56{
57 u32 *buf = (u32 *)(TEGRA_IRAM_BASE + TEGRA_IRAM_DEBUG_UART_OFFSET);
58
59 if (uart) {
60 buf[0] = TEGRA_IRAM_DEBUG_UART_COOKIE;
61 buf[1] = (u32)uart;
62 } else
63 buf[0] = 0;
64}
65
66static const struct { 54static const struct {
67 u32 base; 55 u32 base;
68 u32 reset_reg; 56 u32 reset_reg;
@@ -139,51 +127,19 @@ int auto_odmdata(void)
139} 127}
140#endif 128#endif
141 129
142#ifdef CONFIG_TEGRA_DEBUG_UART_AUTO_SCRATCH
143int auto_scratch(void)
144{
145 int i;
146
147 /*
148 * Look for the first UART that:
149 * a) Is not in reset.
150 * b) Is clocked.
151 * c) Has a 'D' in the scratchpad register.
152 *
153 * Note that on Tegra30, the first two conditions are required, since
154 * if not true, accesses to the UART scratch register will hang.
155 * Tegra20 doesn't have this issue.
156 *
157 * The intent is that the bootloader will tell the kernel which UART
158 * to use by setting up those conditions. If nothing found, we'll fall
159 * back to what's specified in TEGRA_DEBUG_UART_BASE.
160 */
161 for (i = 0; i < ARRAY_SIZE(uarts); i++) {
162 if (!uart_clocked(i))
163 continue;
164
165 uart = (volatile u8 *)uarts[i].base;
166 if (uart[UART_SCR << DEBUG_UART_SHIFT] != 'D')
167 continue;
168
169 return i;
170 }
171
172 return -1;
173}
174#endif
175
176/* 130/*
177 * Setup before decompression. This is where we do UART selection for 131 * Setup before decompression. This is where we do UART selection for
178 * earlyprintk and init the uart_base register. 132 * earlyprintk and init the uart_base register.
179 */ 133 */
180static inline void arch_decomp_setup(void) 134static inline void arch_decomp_setup(void)
181{ 135{
182 int uart_id, auto_uart_id; 136 int uart_id;
183 volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE; 137 volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE;
184 u32 chip, div; 138 u32 chip, div;
185 139
186#if defined(CONFIG_TEGRA_DEBUG_UARTA) 140#if defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
141 uart_id = auto_odmdata();
142#elif defined(CONFIG_TEGRA_DEBUG_UARTA)
187 uart_id = 0; 143 uart_id = 0;
188#elif defined(CONFIG_TEGRA_DEBUG_UARTB) 144#elif defined(CONFIG_TEGRA_DEBUG_UARTB)
189 uart_id = 1; 145 uart_id = 1;
@@ -193,19 +149,7 @@ static inline void arch_decomp_setup(void)
193 uart_id = 3; 149 uart_id = 3;
194#elif defined(CONFIG_TEGRA_DEBUG_UARTE) 150#elif defined(CONFIG_TEGRA_DEBUG_UARTE)
195 uart_id = 4; 151 uart_id = 4;
196#else
197 uart_id = -1;
198#endif
199
200#if defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
201 auto_uart_id = auto_odmdata();
202#elif defined(CONFIG_TEGRA_DEBUG_UART_AUTO_SCRATCH)
203 auto_uart_id = auto_scratch();
204#else
205 auto_uart_id = -1;
206#endif 152#endif
207 if (auto_uart_id != -1)
208 uart_id = auto_uart_id;
209 153
210 if (uart_id < 0 || uart_id >= ARRAY_SIZE(uarts) || 154 if (uart_id < 0 || uart_id >= ARRAY_SIZE(uarts) ||
211 !uart_clocked(uart_id)) 155 !uart_clocked(uart_id))
@@ -213,7 +157,6 @@ static inline void arch_decomp_setup(void)
213 else 157 else
214 uart = (volatile u8 *)uarts[uart_id].base; 158 uart = (volatile u8 *)uarts[uart_id].base;
215 159
216 save_uart_address();
217 if (uart == NULL) 160 if (uart == NULL)
218 return; 161 return;
219 162
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
index 58b4baf9c48..bb9c9c29d18 100644
--- a/arch/arm/mach-tegra/io.c
+++ b/arch/arm/mach-tegra/io.c
@@ -26,9 +26,9 @@
26 26
27#include <asm/page.h> 27#include <asm/page.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <mach/iomap.h>
30 29
31#include "board.h" 30#include "board.h"
31#include "iomap.h"
32 32
33static struct map_desc tegra_io_desc[] __initdata = { 33static struct map_desc tegra_io_desc[] __initdata = {
34 { 34 {
@@ -59,5 +59,6 @@ static struct map_desc tegra_io_desc[] __initdata = {
59 59
60void __init tegra_map_common_io(void) 60void __init tegra_map_common_io(void)
61{ 61{
62 debug_ll_io_init();
62 iotable_init(tegra_io_desc, ARRAY_SIZE(tegra_io_desc)); 63 iotable_init(tegra_io_desc, ARRAY_SIZE(tegra_io_desc));
63} 64}
diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/iomap.h
index fee3a94c454..db8be51cad8 100644
--- a/arch/arm/mach-tegra/include/mach/iomap.h
+++ b/arch/arm/mach-tegra/iomap.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/arm/mach-tegra/include/mach/iomap.h
3 *
4 * Copyright (C) 2010 Google, Inc. 2 * Copyright (C) 2010 Google, Inc.
5 * 3 *
6 * Author: 4 * Author:
@@ -263,20 +261,6 @@
263#define TEGRA_SDMMC4_BASE 0xC8000600 261#define TEGRA_SDMMC4_BASE 0xC8000600
264#define TEGRA_SDMMC4_SIZE SZ_512 262#define TEGRA_SDMMC4_SIZE SZ_512
265 263
266#if defined(CONFIG_TEGRA_DEBUG_UART_NONE)
267# define TEGRA_DEBUG_UART_BASE 0
268#elif defined(CONFIG_TEGRA_DEBUG_UARTA)
269# define TEGRA_DEBUG_UART_BASE TEGRA_UARTA_BASE
270#elif defined(CONFIG_TEGRA_DEBUG_UARTB)
271# define TEGRA_DEBUG_UART_BASE TEGRA_UARTB_BASE
272#elif defined(CONFIG_TEGRA_DEBUG_UARTC)
273# define TEGRA_DEBUG_UART_BASE TEGRA_UARTC_BASE
274#elif defined(CONFIG_TEGRA_DEBUG_UARTD)
275# define TEGRA_DEBUG_UART_BASE TEGRA_UARTD_BASE
276#elif defined(CONFIG_TEGRA_DEBUG_UARTE)
277# define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE
278#endif
279
280/* On TEGRA, many peripherals are very closely packed in 264/* On TEGRA, many peripherals are very closely packed in
281 * two 256MB io windows (that actually only use about 64KB 265 * two 256MB io windows (that actually only use about 64KB
282 * at the start of each). 266 * at the start of each).
diff --git a/arch/arm/mach-tegra/include/mach/irammap.h b/arch/arm/mach-tegra/irammap.h
index 0cbe6326185..501952a8434 100644
--- a/arch/arm/mach-tegra/include/mach/irammap.h
+++ b/arch/arm/mach-tegra/irammap.h
@@ -23,13 +23,4 @@
23#define TEGRA_IRAM_RESET_HANDLER_OFFSET 0 23#define TEGRA_IRAM_RESET_HANDLER_OFFSET 0
24#define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K 24#define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K
25 25
26/*
27 * These locations are written to by uncompress.h, and read by debug-macro.S.
28 * The first word holds the cookie value if the data is valid. The second
29 * word holds the UART physical address.
30 */
31#define TEGRA_IRAM_DEBUG_UART_OFFSET SZ_1K
32#define TEGRA_IRAM_DEBUG_UART_SIZE 8
33#define TEGRA_IRAM_DEBUG_UART_COOKIE 0x55415254
34
35#endif 26#endif
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index 2f5bd2db8e1..b7886f18351 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -25,9 +25,8 @@
25 25
26#include <asm/hardware/gic.h> 26#include <asm/hardware/gic.h>
27 27
28#include <mach/iomap.h>
29
30#include "board.h" 28#include "board.h"
29#include "iomap.h"
31 30
32#define ICTLR_CPU_IEP_VFIQ 0x08 31#define ICTLR_CPU_IEP_VFIQ 0x08
33#define ICTLR_CPU_IEP_FIR 0x14 32#define ICTLR_CPU_IEP_FIR 0x14
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index a8dba6489c9..53d08587179 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -37,11 +37,14 @@
37#include <asm/sizes.h> 37#include <asm/sizes.h>
38#include <asm/mach/pci.h> 38#include <asm/mach/pci.h>
39 39
40#include <mach/iomap.h>
41#include <mach/clk.h> 40#include <mach/clk.h>
42#include <mach/powergate.h> 41#include <mach/powergate.h>
43 42
44#include "board.h" 43#include "board.h"
44#include "iomap.h"
45
46/* Hack - need to parse this from DT */
47#define INT_PCIE_INTR 130
45 48
46/* register definitions */ 49/* register definitions */
47#define AFI_OFFSET 0x3800 50#define AFI_OFFSET 0x3800
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 81cb26591ac..1b926df99c4 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -24,8 +24,6 @@
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
26 26
27#include <mach/clk.h>
28#include <mach/iomap.h>
29#include <mach/powergate.h> 27#include <mach/powergate.h>
30 28
31#include "fuse.h" 29#include "fuse.h"
@@ -34,6 +32,7 @@
34#include "tegra_cpu_car.h" 32#include "tegra_cpu_car.h"
35 33
36#include "common.h" 34#include "common.h"
35#include "iomap.h"
37 36
38extern void tegra_secondary_startup(void); 37extern void tegra_secondary_startup(void);
39 38
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
new file mode 100644
index 00000000000..1b11707eaca
--- /dev/null
+++ b/arch/arm/mach-tegra/pm.c
@@ -0,0 +1,216 @@
1/*
2 * CPU complex suspend & resume functions for Tegra SoCs
3 *
4 * Copyright (c) 2009-2012, NVIDIA Corporation. All rights reserved.
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 * 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 for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/kernel.h>
20#include <linux/spinlock.h>
21#include <linux/io.h>
22#include <linux/cpumask.h>
23#include <linux/delay.h>
24#include <linux/cpu_pm.h>
25#include <linux/clk.h>
26#include <linux/err.h>
27
28#include <asm/smp_plat.h>
29#include <asm/cacheflush.h>
30#include <asm/suspend.h>
31#include <asm/idmap.h>
32#include <asm/proc-fns.h>
33#include <asm/tlbflush.h>
34
35#include "iomap.h"
36#include "reset.h"
37#include "flowctrl.h"
38#include "sleep.h"
39#include "tegra_cpu_car.h"
40
41#define TEGRA_POWER_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */
42
43#define PMC_CTRL 0x0
44#define PMC_CPUPWRGOOD_TIMER 0xc8
45#define PMC_CPUPWROFF_TIMER 0xcc
46
47#ifdef CONFIG_PM_SLEEP
48static unsigned int g_diag_reg;
49static DEFINE_SPINLOCK(tegra_lp2_lock);
50static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
51static struct clk *tegra_pclk;
52void (*tegra_tear_down_cpu)(void);
53
54void save_cpu_arch_register(void)
55{
56 /* read diagnostic register */
57 asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc");
58 return;
59}
60
61void restore_cpu_arch_register(void)
62{
63 /* write diagnostic register */
64 asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc");
65 return;
66}
67
68static void set_power_timers(unsigned long us_on, unsigned long us_off)
69{
70 unsigned long long ticks;
71 unsigned long long pclk;
72 unsigned long rate;
73 static unsigned long tegra_last_pclk;
74
75 if (tegra_pclk == NULL) {
76 tegra_pclk = clk_get_sys(NULL, "pclk");
77 WARN_ON(IS_ERR(tegra_pclk));
78 }
79
80 rate = clk_get_rate(tegra_pclk);
81
82 if (WARN_ON_ONCE(rate <= 0))
83 pclk = 100000000;
84 else
85 pclk = rate;
86
87 if ((rate != tegra_last_pclk)) {
88 ticks = (us_on * pclk) + 999999ull;
89 do_div(ticks, 1000000);
90 writel((unsigned long)ticks, pmc + PMC_CPUPWRGOOD_TIMER);
91
92 ticks = (us_off * pclk) + 999999ull;
93 do_div(ticks, 1000000);
94 writel((unsigned long)ticks, pmc + PMC_CPUPWROFF_TIMER);
95 wmb();
96 }
97 tegra_last_pclk = pclk;
98}
99
100/*
101 * restore_cpu_complex
102 *
103 * restores cpu clock setting, clears flow controller
104 *
105 * Always called on CPU 0.
106 */
107static void restore_cpu_complex(void)
108{
109 int cpu = smp_processor_id();
110
111 BUG_ON(cpu != 0);
112
113#ifdef CONFIG_SMP
114 cpu = cpu_logical_map(cpu);
115#endif
116
117 /* Restore the CPU clock settings */
118 tegra_cpu_clock_resume();
119
120 flowctrl_cpu_suspend_exit(cpu);
121
122 restore_cpu_arch_register();
123}
124
125/*
126 * suspend_cpu_complex
127 *
128 * saves pll state for use by restart_plls, prepares flow controller for
129 * transition to suspend state
130 *
131 * Must always be called on cpu 0.
132 */
133static void suspend_cpu_complex(void)
134{
135 int cpu = smp_processor_id();
136
137 BUG_ON(cpu != 0);
138
139#ifdef CONFIG_SMP
140 cpu = cpu_logical_map(cpu);
141#endif
142
143 /* Save the CPU clock settings */
144 tegra_cpu_clock_suspend();
145
146 flowctrl_cpu_suspend_enter(cpu);
147
148 save_cpu_arch_register();
149}
150
151void __cpuinit tegra_clear_cpu_in_lp2(int phy_cpu_id)
152{
153 u32 *cpu_in_lp2 = tegra_cpu_lp2_mask;
154
155 spin_lock(&tegra_lp2_lock);
156
157 BUG_ON(!(*cpu_in_lp2 & BIT(phy_cpu_id)));
158 *cpu_in_lp2 &= ~BIT(phy_cpu_id);
159
160 spin_unlock(&tegra_lp2_lock);
161}
162
163bool __cpuinit tegra_set_cpu_in_lp2(int phy_cpu_id)
164{
165 bool last_cpu = false;
166 cpumask_t *cpu_lp2_mask = tegra_cpu_lp2_mask;
167 u32 *cpu_in_lp2 = tegra_cpu_lp2_mask;
168
169 spin_lock(&tegra_lp2_lock);
170
171 BUG_ON((*cpu_in_lp2 & BIT(phy_cpu_id)));
172 *cpu_in_lp2 |= BIT(phy_cpu_id);
173
174 if ((phy_cpu_id == 0) && cpumask_equal(cpu_lp2_mask, cpu_online_mask))
175 last_cpu = true;
176
177 spin_unlock(&tegra_lp2_lock);
178 return last_cpu;
179}
180
181static int tegra_sleep_cpu(unsigned long v2p)
182{
183 /* Switch to the identity mapping. */
184 cpu_switch_mm(idmap_pgd, &init_mm);
185
186 /* Flush the TLB. */
187 local_flush_tlb_all();
188
189 tegra_sleep_cpu_finish(v2p);
190
191 /* should never here */
192 BUG();
193
194 return 0;
195}
196
197void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time)
198{
199 u32 mode;
200
201 /* Only the last cpu down does the final suspend steps */
202 mode = readl(pmc + PMC_CTRL);
203 mode |= TEGRA_POWER_CPU_PWRREQ_OE;
204 writel(mode, pmc + PMC_CTRL);
205
206 set_power_timers(cpu_on_time, cpu_off_time);
207
208 cpu_cluster_pm_enter();
209 suspend_cpu_complex();
210
211 cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
212
213 restore_cpu_complex();
214 cpu_cluster_pm_exit();
215}
216#endif
diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h
new file mode 100644
index 00000000000..787335cc964
--- /dev/null
+++ b/arch/arm/mach-tegra/pm.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 * Copyright (c) 2010-2012 NVIDIA Corporation. All rights reserved.
4 *
5 * Author:
6 * Colin Cross <ccross@google.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef _MACH_TEGRA_PM_H_
22#define _MACH_TEGRA_PM_H_
23
24extern unsigned long l2x0_saved_regs_addr;
25
26void save_cpu_arch_register(void);
27void restore_cpu_arch_register(void);
28
29void tegra_clear_cpu_in_lp2(int phy_cpu_id);
30bool tegra_set_cpu_in_lp2(int phy_cpu_id);
31
32void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time);
33extern void (*tegra_tear_down_cpu)(void);
34
35#endif /* _MACH_TEGRA_PM_H_ */
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index 7af6a54404b..d4fdb5fcec2 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -19,7 +19,7 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/of.h> 20#include <linux/of.h>
21 21
22#include <mach/iomap.h> 22#include "iomap.h"
23 23
24#define PMC_CTRL 0x0 24#define PMC_CTRL 0x0
25#define PMC_CTRL_INTR_LOW (1 << 17) 25#define PMC_CTRL_INTR_LOW (1 << 17)
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index de0662de28a..2cc1185d902 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -28,10 +28,10 @@
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29 29
30#include <mach/clk.h> 30#include <mach/clk.h>
31#include <mach/iomap.h>
32#include <mach/powergate.h> 31#include <mach/powergate.h>
33 32
34#include "fuse.h" 33#include "fuse.h"
34#include "iomap.h"
35 35
36#define PWRGATE_TOGGLE 0x30 36#define PWRGATE_TOGGLE 0x30
37#define PWRGATE_TOGGLE_START (1 << 8) 37#define PWRGATE_TOGGLE_START (1 << 8)
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index 5beb7ebe294..3fd89ecd158 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -22,10 +22,10 @@
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 24
25#include <mach/iomap.h> 25#include "iomap.h"
26#include <mach/irammap.h> 26#include "irammap.h"
27
28#include "reset.h" 27#include "reset.h"
28#include "sleep.h"
29#include "fuse.h" 29#include "fuse.h"
30 30
31#define TEGRA_IRAM_RESET_BASE (TEGRA_IRAM_BASE + \ 31#define TEGRA_IRAM_RESET_BASE (TEGRA_IRAM_BASE + \
@@ -80,5 +80,10 @@ void __init tegra_cpu_reset_handler_init(void)
80 virt_to_phys((void *)tegra_secondary_startup); 80 virt_to_phys((void *)tegra_secondary_startup);
81#endif 81#endif
82 82
83#ifdef CONFIG_PM_SLEEP
84 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP2] =
85 virt_to_phys((void *)tegra_resume);
86#endif
87
83 tegra_cpu_reset_handler_enable(); 88 tegra_cpu_reset_handler_enable();
84} 89}
diff --git a/arch/arm/mach-tegra/reset.h b/arch/arm/mach-tegra/reset.h
index de88bf851dd..c90d8e9c4ad 100644
--- a/arch/arm/mach-tegra/reset.h
+++ b/arch/arm/mach-tegra/reset.h
@@ -29,6 +29,8 @@
29 29
30#ifndef __ASSEMBLY__ 30#ifndef __ASSEMBLY__
31 31
32#include "irammap.h"
33
32extern unsigned long __tegra_cpu_reset_handler_data[TEGRA_RESET_DATA_SIZE]; 34extern unsigned long __tegra_cpu_reset_handler_data[TEGRA_RESET_DATA_SIZE];
33 35
34void __tegra_cpu_reset_handler_start(void); 36void __tegra_cpu_reset_handler_start(void);
@@ -36,6 +38,13 @@ void __tegra_cpu_reset_handler(void);
36void __tegra_cpu_reset_handler_end(void); 38void __tegra_cpu_reset_handler_end(void);
37void tegra_secondary_startup(void); 39void tegra_secondary_startup(void);
38 40
41#ifdef CONFIG_PM_SLEEP
42#define tegra_cpu_lp2_mask \
43 (IO_ADDRESS(TEGRA_IRAM_BASE + TEGRA_IRAM_RESET_HANDLER_OFFSET + \
44 ((u32)&__tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_LP2] - \
45 (u32)__tegra_cpu_reset_handler_start)))
46#endif
47
39#define tegra_cpu_reset_handler_offset \ 48#define tegra_cpu_reset_handler_offset \
40 ((u32)__tegra_cpu_reset_handler - \ 49 ((u32)__tegra_cpu_reset_handler - \
41 (u32)__tegra_cpu_reset_handler_start) 50 (u32)__tegra_cpu_reset_handler_start)
diff --git a/arch/arm/mach-tegra/sleep-t20.S b/arch/arm/mach-tegra/sleep-tegra20.S
index a36ae413e2b..72ce709799d 100644
--- a/arch/arm/mach-tegra/sleep-t20.S
+++ b/arch/arm/mach-tegra/sleep-tegra20.S
@@ -22,8 +22,6 @@
22 22
23#include <asm/assembler.h> 23#include <asm/assembler.h>
24 24
25#include <mach/iomap.h>
26
27#include "sleep.h" 25#include "sleep.h"
28#include "flowctrl.h" 26#include "flowctrl.h"
29 27
diff --git a/arch/arm/mach-tegra/sleep-t30.S b/arch/arm/mach-tegra/sleep-tegra30.S
index 777d9cee8b9..562a8e7e413 100644
--- a/arch/arm/mach-tegra/sleep-t30.S
+++ b/arch/arm/mach-tegra/sleep-tegra30.S
@@ -17,8 +17,7 @@
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18 18
19#include <asm/assembler.h> 19#include <asm/assembler.h>
20 20#include <asm/asm-offsets.h>
21#include <mach/iomap.h>
22 21
23#include "sleep.h" 22#include "sleep.h"
24#include "flowctrl.h" 23#include "flowctrl.h"
@@ -82,6 +81,7 @@ delay_1:
82 ldr r3, [r1] @ read CSR 81 ldr r3, [r1] @ read CSR
83 str r3, [r1] @ clear CSR 82 str r3, [r1] @ clear CSR
84 tst r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN 83 tst r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN
84 moveq r3, #FLOW_CTRL_WAIT_FOR_INTERRUPT @ For LP2
85 movne r3, #FLOW_CTRL_WAITEVENT @ For hotplug 85 movne r3, #FLOW_CTRL_WAITEVENT @ For hotplug
86 str r3, [r2] 86 str r3, [r2]
87 ldr r0, [r2] 87 ldr r0, [r2]
@@ -105,3 +105,67 @@ wfe_war:
105 105
106ENDPROC(tegra30_cpu_shutdown) 106ENDPROC(tegra30_cpu_shutdown)
107#endif 107#endif
108
109#ifdef CONFIG_PM_SLEEP
110/*
111 * tegra30_sleep_cpu_secondary_finish(unsigned long v2p)
112 *
113 * Enters LP2 on secondary CPU by exiting coherency and powergating the CPU.
114 */
115ENTRY(tegra30_sleep_cpu_secondary_finish)
116 mov r7, lr
117
118 /* Flush and disable the L1 data cache */
119 bl tegra_disable_clean_inv_dcache
120
121 /* Powergate this CPU. */
122 mov r0, #0 @ power mode flags (!hotplug)
123 bl tegra30_cpu_shutdown
124 mov r0, #1 @ never return here
125 mov pc, r7
126ENDPROC(tegra30_sleep_cpu_secondary_finish)
127
128/*
129 * tegra30_tear_down_cpu
130 *
131 * Switches the CPU to enter sleep.
132 */
133ENTRY(tegra30_tear_down_cpu)
134 mov32 r6, TEGRA_FLOW_CTRL_BASE
135
136 b tegra30_enter_sleep
137ENDPROC(tegra30_tear_down_cpu)
138
139/*
140 * tegra30_enter_sleep
141 *
142 * uses flow controller to enter sleep state
143 * executes from IRAM with SDRAM in selfrefresh when target state is LP0 or LP1
144 * executes from SDRAM with target state is LP2
145 * r6 = TEGRA_FLOW_CTRL_BASE
146 */
147tegra30_enter_sleep:
148 cpu_id r1
149
150 cpu_to_csr_reg r2, r1
151 ldr r0, [r6, r2]
152 orr r0, r0, #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
153 orr r0, r0, #FLOW_CTRL_CSR_ENABLE
154 str r0, [r6, r2]
155
156 mov r0, #FLOW_CTRL_WAIT_FOR_INTERRUPT
157 orr r0, r0, #FLOW_CTRL_HALT_CPU_IRQ | FLOW_CTRL_HALT_CPU_FIQ
158 cpu_to_halt_reg r2, r1
159 str r0, [r6, r2]
160 dsb
161 ldr r0, [r6, r2] /* memory barrier */
162
163halted:
164 isb
165 dsb
166 wfi /* CPU should be power gated here */
167
168 /* !!!FIXME!!! Implement halt failure handler */
169 b halted
170
171#endif
diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S
index ea81554c483..26afa7cbed1 100644
--- a/arch/arm/mach-tegra/sleep.S
+++ b/arch/arm/mach-tegra/sleep.S
@@ -25,9 +25,87 @@
25#include <linux/linkage.h> 25#include <linux/linkage.h>
26 26
27#include <asm/assembler.h> 27#include <asm/assembler.h>
28#include <asm/cache.h>
29#include <asm/cp15.h>
30#include <asm/hardware/cache-l2x0.h>
28 31
29#include <mach/iomap.h> 32#include "iomap.h"
30 33
31#include "flowctrl.h" 34#include "flowctrl.h"
32#include "sleep.h" 35#include "sleep.h"
33 36
37#ifdef CONFIG_PM_SLEEP
38/*
39 * tegra_disable_clean_inv_dcache
40 *
41 * disable, clean & invalidate the D-cache
42 *
43 * Corrupted registers: r1-r3, r6, r8, r9-r11
44 */
45ENTRY(tegra_disable_clean_inv_dcache)
46 stmfd sp!, {r0, r4-r5, r7, r9-r11, lr}
47 dmb @ ensure ordering
48
49 /* Disable the D-cache */
50 mrc p15, 0, r2, c1, c0, 0
51 bic r2, r2, #CR_C
52 mcr p15, 0, r2, c1, c0, 0
53 isb
54
55 /* Flush the D-cache */
56 bl v7_flush_dcache_louis
57
58 /* Trun off coherency */
59 exit_smp r4, r5
60
61 ldmfd sp!, {r0, r4-r5, r7, r9-r11, pc}
62ENDPROC(tegra_disable_clean_inv_dcache)
63
64/*
65 * tegra_sleep_cpu_finish(unsigned long v2p)
66 *
67 * enters suspend in LP2 by turning off the mmu and jumping to
68 * tegra?_tear_down_cpu
69 */
70ENTRY(tegra_sleep_cpu_finish)
71 /* Flush and disable the L1 data cache */
72 bl tegra_disable_clean_inv_dcache
73
74 mov32 r6, tegra_tear_down_cpu
75 ldr r1, [r6]
76 add r1, r1, r0
77
78 mov32 r3, tegra_shut_off_mmu
79 add r3, r3, r0
80 mov r0, r1
81
82 mov pc, r3
83ENDPROC(tegra_sleep_cpu_finish)
84
85/*
86 * tegra_shut_off_mmu
87 *
88 * r0 = physical address to jump to with mmu off
89 *
90 * called with VA=PA mapping
91 * turns off MMU, icache, dcache and branch prediction
92 */
93 .align L1_CACHE_SHIFT
94 .pushsection .idmap.text, "ax"
95ENTRY(tegra_shut_off_mmu)
96 mrc p15, 0, r3, c1, c0, 0
97 movw r2, #CR_I | CR_Z | CR_C | CR_M
98 bic r3, r3, r2
99 dsb
100 mcr p15, 0, r3, c1, c0, 0
101 isb
102#ifdef CONFIG_CACHE_L2X0
103 /* Disable L2 cache */
104 mov32 r4, TEGRA_ARM_PERIF_BASE + 0x3000
105 mov r5, #0
106 str r5, [r4, #L2X0_CTRL]
107#endif
108 mov pc, r0
109ENDPROC(tegra_shut_off_mmu)
110 .popsection
111#endif
diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h
index e25a7cd703d..9821ee72542 100644
--- a/arch/arm/mach-tegra/sleep.h
+++ b/arch/arm/mach-tegra/sleep.h
@@ -17,7 +17,7 @@
17#ifndef __MACH_TEGRA_SLEEP_H 17#ifndef __MACH_TEGRA_SLEEP_H
18#define __MACH_TEGRA_SLEEP_H 18#define __MACH_TEGRA_SLEEP_H
19 19
20#include <mach/iomap.h> 20#include "iomap.h"
21 21
22#define TEGRA_ARM_PERIF_VIRT (TEGRA_ARM_PERIF_BASE - IO_CPU_PHYS \ 22#define TEGRA_ARM_PERIF_VIRT (TEGRA_ARM_PERIF_BASE - IO_CPU_PHYS \
23 + IO_CPU_VIRT) 23 + IO_CPU_VIRT)
@@ -71,7 +71,41 @@
71 str \tmp2, [\tmp1] @ invalidate SCU tags for CPU 71 str \tmp2, [\tmp1] @ invalidate SCU tags for CPU
72 dsb 72 dsb
73.endm 73.endm
74
75/* Macro to resume & re-enable L2 cache */
76#ifndef L2X0_CTRL_EN
77#define L2X0_CTRL_EN 1
78#endif
79
80#ifdef CONFIG_CACHE_L2X0
81.macro l2_cache_resume, tmp1, tmp2, tmp3, phys_l2x0_saved_regs
82 adr \tmp1, \phys_l2x0_saved_regs
83 ldr \tmp1, [\tmp1]
84 ldr \tmp2, [\tmp1, #L2X0_R_PHY_BASE]
85 ldr \tmp3, [\tmp2, #L2X0_CTRL]
86 tst \tmp3, #L2X0_CTRL_EN
87 bne exit_l2_resume
88 ldr \tmp3, [\tmp1, #L2X0_R_TAG_LATENCY]
89 str \tmp3, [\tmp2, #L2X0_TAG_LATENCY_CTRL]
90 ldr \tmp3, [\tmp1, #L2X0_R_DATA_LATENCY]
91 str \tmp3, [\tmp2, #L2X0_DATA_LATENCY_CTRL]
92 ldr \tmp3, [\tmp1, #L2X0_R_PREFETCH_CTRL]
93 str \tmp3, [\tmp2, #L2X0_PREFETCH_CTRL]
94 ldr \tmp3, [\tmp1, #L2X0_R_PWR_CTRL]
95 str \tmp3, [\tmp2, #L2X0_POWER_CTRL]
96 ldr \tmp3, [\tmp1, #L2X0_R_AUX_CTRL]
97 str \tmp3, [\tmp2, #L2X0_AUX_CTRL]
98 mov \tmp3, #L2X0_CTRL_EN
99 str \tmp3, [\tmp2, #L2X0_CTRL]
100exit_l2_resume:
101.endm
102#else /* CONFIG_CACHE_L2X0 */
103.macro l2_cache_resume, tmp1, tmp2, tmp3, phys_l2x0_saved_regs
104.endm
105#endif /* CONFIG_CACHE_L2X0 */
74#else 106#else
107void tegra_resume(void);
108int tegra_sleep_cpu_finish(unsigned long);
75 109
76#ifdef CONFIG_HOTPLUG_CPU 110#ifdef CONFIG_HOTPLUG_CPU
77void tegra20_hotplug_init(void); 111void tegra20_hotplug_init(void);
@@ -81,5 +115,8 @@ static inline void tegra20_hotplug_init(void) {}
81static inline void tegra30_hotplug_init(void) {} 115static inline void tegra30_hotplug_init(void) {}
82#endif 116#endif
83 117
118int tegra30_sleep_cpu_secondary_finish(unsigned long);
119void tegra30_tear_down_cpu(void);
120
84#endif 121#endif
85#endif 122#endif
diff --git a/arch/arm/mach-tegra/tegra20_clocks.c b/arch/arm/mach-tegra/tegra20_clocks.c
index deb873fb12b..4eb6bc81a87 100644
--- a/arch/arm/mach-tegra/tegra20_clocks.c
+++ b/arch/arm/mach-tegra/tegra20_clocks.c
@@ -27,10 +27,9 @@
27#include <linux/clkdev.h> 27#include <linux/clkdev.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29 29
30#include <mach/iomap.h>
31
32#include "clock.h" 30#include "clock.h"
33#include "fuse.h" 31#include "fuse.h"
32#include "iomap.h"
34#include "tegra2_emc.h" 33#include "tegra2_emc.h"
35#include "tegra_cpu_car.h" 34#include "tegra_cpu_car.h"
36 35
diff --git a/arch/arm/mach-tegra/tegra20_clocks_data.c b/arch/arm/mach-tegra/tegra20_clocks_data.c
index 8d398a33adf..a23a0734e35 100644
--- a/arch/arm/mach-tegra/tegra20_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra20_clocks_data.c
@@ -27,8 +27,6 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29 29
30#include <mach/iomap.h>
31
32#include "clock.h" 30#include "clock.h"
33#include "fuse.h" 31#include "fuse.h"
34#include "tegra2_emc.h" 32#include "tegra2_emc.h"
@@ -248,11 +246,16 @@ static struct clk_pll_freq_table tegra_pll_d_freq_table[] = {
248 { 19200000, 216000000, 135, 12, 1, 3}, 246 { 19200000, 216000000, 135, 12, 1, 3},
249 { 26000000, 216000000, 216, 26, 1, 4}, 247 { 26000000, 216000000, 216, 26, 1, 4},
250 248
249 { 12000000, 297000000, 99, 4, 1, 4 },
250 { 12000000, 339000000, 113, 4, 1, 4 },
251
251 { 12000000, 594000000, 594, 12, 1, 8}, 252 { 12000000, 594000000, 594, 12, 1, 8},
252 { 13000000, 594000000, 594, 13, 1, 8}, 253 { 13000000, 594000000, 594, 13, 1, 8},
253 { 19200000, 594000000, 495, 16, 1, 8}, 254 { 19200000, 594000000, 495, 16, 1, 8},
254 { 26000000, 594000000, 594, 26, 1, 8}, 255 { 26000000, 594000000, 594, 26, 1, 8},
255 256
257 { 12000000, 616000000, 616, 12, 1, 8},
258
256 { 12000000, 1000000000, 1000, 12, 1, 12}, 259 { 12000000, 1000000000, 1000, 12, 1, 12},
257 { 13000000, 1000000000, 1000, 13, 1, 12}, 260 { 13000000, 1000000000, 1000, 13, 1, 12},
258 { 19200000, 1000000000, 625, 12, 1, 8}, 261 { 19200000, 1000000000, 625, 12, 1, 8},
@@ -1038,9 +1041,6 @@ static struct clk_duplicate tegra_clk_duplicates[] = {
1038 CLK_DUPLICATE("usbd", "utmip-pad", NULL), 1041 CLK_DUPLICATE("usbd", "utmip-pad", NULL),
1039 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL), 1042 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL),
1040 CLK_DUPLICATE("usbd", "tegra-otg", NULL), 1043 CLK_DUPLICATE("usbd", "tegra-otg", NULL),
1041 CLK_DUPLICATE("hdmi", "tegradc.0", "hdmi"),
1042 CLK_DUPLICATE("hdmi", "tegradc.1", "hdmi"),
1043 CLK_DUPLICATE("host1x", "tegra_grhost", "host1x"),
1044 CLK_DUPLICATE("2d", "tegra_grhost", "gr2d"), 1044 CLK_DUPLICATE("2d", "tegra_grhost", "gr2d"),
1045 CLK_DUPLICATE("3d", "tegra_grhost", "gr3d"), 1045 CLK_DUPLICATE("3d", "tegra_grhost", "gr3d"),
1046 CLK_DUPLICATE("epp", "tegra_grhost", "epp"), 1046 CLK_DUPLICATE("epp", "tegra_grhost", "epp"),
@@ -1053,6 +1053,9 @@ static struct clk_duplicate tegra_clk_duplicates[] = {
1053 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"), 1053 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"),
1054 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"), 1054 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"),
1055 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"), 1055 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"),
1056 CLK_DUPLICATE("pll_p", "tegradc.0", "parent"),
1057 CLK_DUPLICATE("pll_p", "tegradc.1", "parent"),
1058 CLK_DUPLICATE("pll_d_out0", "hdmi", "parent"),
1056}; 1059};
1057 1060
1058#define CLK(dev, con, ck) \ 1061#define CLK(dev, con, ck) \
diff --git a/arch/arm/mach-tegra/tegra20_speedo.c b/arch/arm/mach-tegra/tegra20_speedo.c
new file mode 100644
index 00000000000..fa6eb570623
--- /dev/null
+++ b/arch/arm/mach-tegra/tegra20_speedo.c
@@ -0,0 +1,109 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kernel.h>
18#include <linux/bug.h>
19
20#include "fuse.h"
21
22#define CPU_SPEEDO_LSBIT 20
23#define CPU_SPEEDO_MSBIT 29
24#define CPU_SPEEDO_REDUND_LSBIT 30
25#define CPU_SPEEDO_REDUND_MSBIT 39
26#define CPU_SPEEDO_REDUND_OFFS (CPU_SPEEDO_REDUND_MSBIT - CPU_SPEEDO_MSBIT)
27
28#define CORE_SPEEDO_LSBIT 40
29#define CORE_SPEEDO_MSBIT 47
30#define CORE_SPEEDO_REDUND_LSBIT 48
31#define CORE_SPEEDO_REDUND_MSBIT 55
32#define CORE_SPEEDO_REDUND_OFFS (CORE_SPEEDO_REDUND_MSBIT - CORE_SPEEDO_MSBIT)
33
34#define SPEEDO_MULT 4
35
36#define PROCESS_CORNERS_NUM 4
37
38#define SPEEDO_ID_SELECT_0(rev) ((rev) <= 2)
39#define SPEEDO_ID_SELECT_1(sku) \
40 (((sku) != 20) && ((sku) != 23) && ((sku) != 24) && \
41 ((sku) != 27) && ((sku) != 28))
42
43enum {
44 SPEEDO_ID_0,
45 SPEEDO_ID_1,
46 SPEEDO_ID_2,
47 SPEEDO_ID_COUNT,
48};
49
50static const u32 cpu_process_speedos[][PROCESS_CORNERS_NUM] = {
51 {315, 366, 420, UINT_MAX},
52 {303, 368, 419, UINT_MAX},
53 {316, 331, 383, UINT_MAX},
54};
55
56static const u32 core_process_speedos[][PROCESS_CORNERS_NUM] = {
57 {165, 195, 224, UINT_MAX},
58 {165, 195, 224, UINT_MAX},
59 {165, 195, 224, UINT_MAX},
60};
61
62void tegra20_init_speedo_data(void)
63{
64 u32 reg;
65 u32 val;
66 int i;
67
68 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) != SPEEDO_ID_COUNT);
69 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) != SPEEDO_ID_COUNT);
70
71 if (SPEEDO_ID_SELECT_0(tegra_revision))
72 tegra_soc_speedo_id = SPEEDO_ID_0;
73 else if (SPEEDO_ID_SELECT_1(tegra_sku_id))
74 tegra_soc_speedo_id = SPEEDO_ID_1;
75 else
76 tegra_soc_speedo_id = SPEEDO_ID_2;
77
78 val = 0;
79 for (i = CPU_SPEEDO_MSBIT; i >= CPU_SPEEDO_LSBIT; i--) {
80 reg = tegra_spare_fuse(i) |
81 tegra_spare_fuse(i + CPU_SPEEDO_REDUND_OFFS);
82 val = (val << 1) | (reg & 0x1);
83 }
84 val = val * SPEEDO_MULT;
85 pr_debug("%s CPU speedo value %u\n", __func__, val);
86
87 for (i = 0; i < (PROCESS_CORNERS_NUM - 1); i++) {
88 if (val <= cpu_process_speedos[tegra_soc_speedo_id][i])
89 break;
90 }
91 tegra_cpu_process_id = i;
92
93 val = 0;
94 for (i = CORE_SPEEDO_MSBIT; i >= CORE_SPEEDO_LSBIT; i--) {
95 reg = tegra_spare_fuse(i) |
96 tegra_spare_fuse(i + CORE_SPEEDO_REDUND_OFFS);
97 val = (val << 1) | (reg & 0x1);
98 }
99 val = val * SPEEDO_MULT;
100 pr_debug("%s Core speedo value %u\n", __func__, val);
101
102 for (i = 0; i < (PROCESS_CORNERS_NUM - 1); i++) {
103 if (val <= core_process_speedos[tegra_soc_speedo_id][i])
104 break;
105 }
106 tegra_core_process_id = i;
107
108 pr_info("Tegra20 Soc Speedo ID %d", tegra_soc_speedo_id);
109}
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index 5070d833bdd..837c7b9ea63 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -25,8 +25,6 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/platform_data/tegra_emc.h> 26#include <linux/platform_data/tegra_emc.h>
27 27
28#include <mach/iomap.h>
29
30#include "tegra2_emc.h" 28#include "tegra2_emc.h"
31#include "fuse.h" 29#include "fuse.h"
32 30
diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c
index e9de5dfd94e..efc000e32e1 100644
--- a/arch/arm/mach-tegra/tegra30_clocks.c
+++ b/arch/arm/mach-tegra/tegra30_clocks.c
@@ -31,10 +31,11 @@
31 31
32#include <asm/clkdev.h> 32#include <asm/clkdev.h>
33 33
34#include <mach/iomap.h> 34#include <mach/powergate.h>
35 35
36#include "clock.h" 36#include "clock.h"
37#include "fuse.h" 37#include "fuse.h"
38#include "iomap.h"
38#include "tegra_cpu_car.h" 39#include "tegra_cpu_car.h"
39 40
40#define USE_PLL_LOCK_BITS 0 41#define USE_PLL_LOCK_BITS 0
@@ -310,6 +311,31 @@
310#define CPU_CLOCK(cpu) (0x1 << (8 + cpu)) 311#define CPU_CLOCK(cpu) (0x1 << (8 + cpu))
311#define CPU_RESET(cpu) (0x1111ul << (cpu)) 312#define CPU_RESET(cpu) (0x1111ul << (cpu))
312 313
314#define CLK_RESET_CCLK_BURST 0x20
315#define CLK_RESET_CCLK_DIVIDER 0x24
316#define CLK_RESET_PLLX_BASE 0xe0
317#define CLK_RESET_PLLX_MISC 0xe4
318
319#define CLK_RESET_SOURCE_CSITE 0x1d4
320
321#define CLK_RESET_CCLK_BURST_POLICY_SHIFT 28
322#define CLK_RESET_CCLK_RUN_POLICY_SHIFT 4
323#define CLK_RESET_CCLK_IDLE_POLICY_SHIFT 0
324#define CLK_RESET_CCLK_IDLE_POLICY 1
325#define CLK_RESET_CCLK_RUN_POLICY 2
326#define CLK_RESET_CCLK_BURST_POLICY_PLLX 8
327
328#ifdef CONFIG_PM_SLEEP
329static struct cpu_clk_suspend_context {
330 u32 pllx_misc;
331 u32 pllx_base;
332
333 u32 cpu_burst;
334 u32 clk_csite_src;
335 u32 cclk_divider;
336} tegra30_cpu_clk_sctx;
337#endif
338
313/** 339/**
314* Structure defining the fields for USB UTMI clocks Parameters. 340* Structure defining the fields for USB UTMI clocks Parameters.
315*/ 341*/
@@ -792,6 +818,112 @@ struct clk_ops tegra30_twd_ops = {
792 .recalc_rate = tegra30_twd_clk_recalc_rate, 818 .recalc_rate = tegra30_twd_clk_recalc_rate,
793}; 819};
794 820
821/* bus clock functions */
822static int tegra30_bus_clk_is_enabled(struct clk_hw *hw)
823{
824 struct clk_tegra *c = to_clk_tegra(hw);
825 u32 val = clk_readl(c->reg);
826
827 c->state = ((val >> c->reg_shift) & BUS_CLK_DISABLE) ? OFF : ON;
828 return c->state;
829}
830
831static int tegra30_bus_clk_enable(struct clk_hw *hw)
832{
833 struct clk_tegra *c = to_clk_tegra(hw);
834 u32 val;
835
836 val = clk_readl(c->reg);
837 val &= ~(BUS_CLK_DISABLE << c->reg_shift);
838 clk_writel(val, c->reg);
839
840 return 0;
841}
842
843static void tegra30_bus_clk_disable(struct clk_hw *hw)
844{
845 struct clk_tegra *c = to_clk_tegra(hw);
846 u32 val;
847
848 val = clk_readl(c->reg);
849 val |= BUS_CLK_DISABLE << c->reg_shift;
850 clk_writel(val, c->reg);
851}
852
853static unsigned long tegra30_bus_clk_recalc_rate(struct clk_hw *hw,
854 unsigned long prate)
855{
856 struct clk_tegra *c = to_clk_tegra(hw);
857 u32 val = clk_readl(c->reg);
858 u64 rate = prate;
859
860 c->div = ((val >> c->reg_shift) & BUS_CLK_DIV_MASK) + 1;
861 c->mul = 1;
862
863 if (c->mul != 0 && c->div != 0) {
864 rate *= c->mul;
865 rate += c->div - 1; /* round up */
866 do_div(rate, c->div);
867 }
868 return rate;
869}
870
871static int tegra30_bus_clk_set_rate(struct clk_hw *hw, unsigned long rate,
872 unsigned long parent_rate)
873{
874 struct clk_tegra *c = to_clk_tegra(hw);
875 int ret = -EINVAL;
876 u32 val;
877 int i;
878
879 val = clk_readl(c->reg);
880 for (i = 1; i <= 4; i++) {
881 if (rate == parent_rate / i) {
882 val &= ~(BUS_CLK_DIV_MASK << c->reg_shift);
883 val |= (i - 1) << c->reg_shift;
884 clk_writel(val, c->reg);
885 c->div = i;
886 c->mul = 1;
887 ret = 0;
888 break;
889 }
890 }
891
892 return ret;
893}
894
895static long tegra30_bus_clk_round_rate(struct clk_hw *hw, unsigned long rate,
896 unsigned long *prate)
897{
898 unsigned long parent_rate = *prate;
899 s64 divider;
900
901 if (rate >= parent_rate)
902 return parent_rate;
903
904 divider = parent_rate;
905 divider += rate - 1;
906 do_div(divider, rate);
907
908 if (divider < 0)
909 return divider;
910
911 if (divider > 4)
912 divider = 4;
913 do_div(parent_rate, divider);
914
915 return parent_rate;
916}
917
918struct clk_ops tegra30_bus_ops = {
919 .is_enabled = tegra30_bus_clk_is_enabled,
920 .enable = tegra30_bus_clk_enable,
921 .disable = tegra30_bus_clk_disable,
922 .set_rate = tegra30_bus_clk_set_rate,
923 .round_rate = tegra30_bus_clk_round_rate,
924 .recalc_rate = tegra30_bus_clk_recalc_rate,
925};
926
795/* Blink output functions */ 927/* Blink output functions */
796static int tegra30_blink_clk_is_enabled(struct clk_hw *hw) 928static int tegra30_blink_clk_is_enabled(struct clk_hw *hw)
797{ 929{
@@ -2281,12 +2413,93 @@ static void tegra30_disable_cpu_clock(u32 cpu)
2281 reg_clk_base + TEGRA_CLK_RST_CONTROLLER_CLK_CPU_CMPLX); 2413 reg_clk_base + TEGRA_CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
2282} 2414}
2283 2415
2416#ifdef CONFIG_PM_SLEEP
2417static bool tegra30_cpu_rail_off_ready(void)
2418{
2419 unsigned int cpu_rst_status;
2420 int cpu_pwr_status;
2421
2422 cpu_rst_status = readl(reg_clk_base +
2423 TEGRA30_CLK_RST_CONTROLLER_CPU_CMPLX_STATUS);
2424 cpu_pwr_status = tegra_powergate_is_powered(TEGRA_POWERGATE_CPU1) ||
2425 tegra_powergate_is_powered(TEGRA_POWERGATE_CPU2) ||
2426 tegra_powergate_is_powered(TEGRA_POWERGATE_CPU3);
2427
2428 if (((cpu_rst_status & 0xE) != 0xE) || cpu_pwr_status)
2429 return false;
2430
2431 return true;
2432}
2433
2434static void tegra30_cpu_clock_suspend(void)
2435{
2436 /* switch coresite to clk_m, save off original source */
2437 tegra30_cpu_clk_sctx.clk_csite_src =
2438 readl(reg_clk_base + CLK_RESET_SOURCE_CSITE);
2439 writel(3<<30, reg_clk_base + CLK_RESET_SOURCE_CSITE);
2440
2441 tegra30_cpu_clk_sctx.cpu_burst =
2442 readl(reg_clk_base + CLK_RESET_CCLK_BURST);
2443 tegra30_cpu_clk_sctx.pllx_base =
2444 readl(reg_clk_base + CLK_RESET_PLLX_BASE);
2445 tegra30_cpu_clk_sctx.pllx_misc =
2446 readl(reg_clk_base + CLK_RESET_PLLX_MISC);
2447 tegra30_cpu_clk_sctx.cclk_divider =
2448 readl(reg_clk_base + CLK_RESET_CCLK_DIVIDER);
2449}
2450
2451static void tegra30_cpu_clock_resume(void)
2452{
2453 unsigned int reg, policy;
2454
2455 /* Is CPU complex already running on PLLX? */
2456 reg = readl(reg_clk_base + CLK_RESET_CCLK_BURST);
2457 policy = (reg >> CLK_RESET_CCLK_BURST_POLICY_SHIFT) & 0xF;
2458
2459 if (policy == CLK_RESET_CCLK_IDLE_POLICY)
2460 reg = (reg >> CLK_RESET_CCLK_IDLE_POLICY_SHIFT) & 0xF;
2461 else if (policy == CLK_RESET_CCLK_RUN_POLICY)
2462 reg = (reg >> CLK_RESET_CCLK_RUN_POLICY_SHIFT) & 0xF;
2463 else
2464 BUG();
2465
2466 if (reg != CLK_RESET_CCLK_BURST_POLICY_PLLX) {
2467 /* restore PLLX settings if CPU is on different PLL */
2468 writel(tegra30_cpu_clk_sctx.pllx_misc,
2469 reg_clk_base + CLK_RESET_PLLX_MISC);
2470 writel(tegra30_cpu_clk_sctx.pllx_base,
2471 reg_clk_base + CLK_RESET_PLLX_BASE);
2472
2473 /* wait for PLL stabilization if PLLX was enabled */
2474 if (tegra30_cpu_clk_sctx.pllx_base & (1 << 30))
2475 udelay(300);
2476 }
2477
2478 /*
2479 * Restore original burst policy setting for calls resulting from CPU
2480 * LP2 in idle or system suspend.
2481 */
2482 writel(tegra30_cpu_clk_sctx.cclk_divider,
2483 reg_clk_base + CLK_RESET_CCLK_DIVIDER);
2484 writel(tegra30_cpu_clk_sctx.cpu_burst,
2485 reg_clk_base + CLK_RESET_CCLK_BURST);
2486
2487 writel(tegra30_cpu_clk_sctx.clk_csite_src,
2488 reg_clk_base + CLK_RESET_SOURCE_CSITE);
2489}
2490#endif
2491
2284static struct tegra_cpu_car_ops tegra30_cpu_car_ops = { 2492static struct tegra_cpu_car_ops tegra30_cpu_car_ops = {
2285 .wait_for_reset = tegra30_wait_cpu_in_reset, 2493 .wait_for_reset = tegra30_wait_cpu_in_reset,
2286 .put_in_reset = tegra30_put_cpu_in_reset, 2494 .put_in_reset = tegra30_put_cpu_in_reset,
2287 .out_of_reset = tegra30_cpu_out_of_reset, 2495 .out_of_reset = tegra30_cpu_out_of_reset,
2288 .enable_clock = tegra30_enable_cpu_clock, 2496 .enable_clock = tegra30_enable_cpu_clock,
2289 .disable_clock = tegra30_disable_cpu_clock, 2497 .disable_clock = tegra30_disable_cpu_clock,
2498#ifdef CONFIG_PM_SLEEP
2499 .rail_off_ready = tegra30_cpu_rail_off_ready,
2500 .suspend = tegra30_cpu_clock_suspend,
2501 .resume = tegra30_cpu_clock_resume,
2502#endif
2290}; 2503};
2291 2504
2292void __init tegra30_cpu_car_ops_init(void) 2505void __init tegra30_cpu_car_ops_init(void)
diff --git a/arch/arm/mach-tegra/tegra30_clocks.h b/arch/arm/mach-tegra/tegra30_clocks.h
index f2f88fef6b8..7a34adb2f72 100644
--- a/arch/arm/mach-tegra/tegra30_clocks.h
+++ b/arch/arm/mach-tegra/tegra30_clocks.h
@@ -34,6 +34,7 @@ extern struct clk_ops tegra_clk_out_ops;
34extern struct clk_ops tegra30_super_ops; 34extern struct clk_ops tegra30_super_ops;
35extern struct clk_ops tegra30_blink_clk_ops; 35extern struct clk_ops tegra30_blink_clk_ops;
36extern struct clk_ops tegra30_twd_ops; 36extern struct clk_ops tegra30_twd_ops;
37extern struct clk_ops tegra30_bus_ops;
37extern struct clk_ops tegra30_periph_clk_ops; 38extern struct clk_ops tegra30_periph_clk_ops;
38extern struct clk_ops tegra30_dsib_clk_ops; 39extern struct clk_ops tegra30_dsib_clk_ops;
39extern struct clk_ops tegra_nand_clk_ops; 40extern struct clk_ops tegra_nand_clk_ops;
diff --git a/arch/arm/mach-tegra/tegra30_clocks_data.c b/arch/arm/mach-tegra/tegra30_clocks_data.c
index 3d2e5532a9e..6942c7add3b 100644
--- a/arch/arm/mach-tegra/tegra30_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra30_clocks_data.c
@@ -711,6 +711,50 @@ static struct clk tegra_clk_sclk = {
711 .num_parents = ARRAY_SIZE(mux_sclk), 711 .num_parents = ARRAY_SIZE(mux_sclk),
712}; 712};
713 713
714static const char *tegra_hclk_parent_names[] = {
715 "tegra_sclk",
716};
717
718static struct clk *tegra_hclk_parents[] = {
719 &tegra_clk_sclk,
720};
721
722static struct clk tegra_hclk;
723static struct clk_tegra tegra_hclk_hw = {
724 .hw = {
725 .clk = &tegra_hclk,
726 },
727 .flags = DIV_BUS,
728 .reg = 0x30,
729 .reg_shift = 4,
730 .max_rate = 378000000,
731 .min_rate = 12000000,
732};
733DEFINE_CLK_TEGRA(hclk, 0, &tegra30_bus_ops, 0, tegra_hclk_parent_names,
734 tegra_hclk_parents, &tegra_clk_sclk);
735
736static const char *tegra_pclk_parent_names[] = {
737 "tegra_hclk",
738};
739
740static struct clk *tegra_pclk_parents[] = {
741 &tegra_hclk,
742};
743
744static struct clk tegra_pclk;
745static struct clk_tegra tegra_pclk_hw = {
746 .hw = {
747 .clk = &tegra_pclk,
748 },
749 .flags = DIV_BUS,
750 .reg = 0x30,
751 .reg_shift = 0,
752 .max_rate = 167000000,
753 .min_rate = 12000000,
754};
755DEFINE_CLK_TEGRA(pclk, 0, &tegra30_bus_ops, 0, tegra_pclk_parent_names,
756 tegra_pclk_parents, &tegra_hclk);
757
714static const char *mux_blink[] = { 758static const char *mux_blink[] = {
715 "clk_32k", 759 "clk_32k",
716}; 760};
@@ -1254,8 +1298,6 @@ struct clk_duplicate tegra_clk_duplicates[] = {
1254 CLK_DUPLICATE("usbd", "utmip-pad", NULL), 1298 CLK_DUPLICATE("usbd", "utmip-pad", NULL),
1255 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL), 1299 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL),
1256 CLK_DUPLICATE("usbd", "tegra-otg", NULL), 1300 CLK_DUPLICATE("usbd", "tegra-otg", NULL),
1257 CLK_DUPLICATE("hdmi", "tegradc.0", "hdmi"),
1258 CLK_DUPLICATE("hdmi", "tegradc.1", "hdmi"),
1259 CLK_DUPLICATE("dsib", "tegradc.0", "dsib"), 1301 CLK_DUPLICATE("dsib", "tegradc.0", "dsib"),
1260 CLK_DUPLICATE("dsia", "tegradc.1", "dsia"), 1302 CLK_DUPLICATE("dsia", "tegradc.1", "dsia"),
1261 CLK_DUPLICATE("bsev", "tegra-avp", "bsev"), 1303 CLK_DUPLICATE("bsev", "tegra-avp", "bsev"),
@@ -1293,6 +1335,9 @@ struct clk_duplicate tegra_clk_duplicates[] = {
1293 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"), 1335 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"),
1294 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"), 1336 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"),
1295 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.4", "fast-clk"), 1337 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.4", "fast-clk"),
1338 CLK_DUPLICATE("pll_p", "tegradc.0", "parent"),
1339 CLK_DUPLICATE("pll_p", "tegradc.1", "parent"),
1340 CLK_DUPLICATE("pll_d2_out0", "hdmi", "parent"),
1296}; 1341};
1297 1342
1298struct clk *tegra_ptr_clks[] = { 1343struct clk *tegra_ptr_clks[] = {
@@ -1325,6 +1370,8 @@ struct clk *tegra_ptr_clks[] = {
1325 &tegra_cml1, 1370 &tegra_cml1,
1326 &tegra_pciex, 1371 &tegra_pciex,
1327 &tegra_clk_sclk, 1372 &tegra_clk_sclk,
1373 &tegra_hclk,
1374 &tegra_pclk,
1328 &tegra_clk_blink, 1375 &tegra_clk_blink,
1329 &tegra30_clk_twd, 1376 &tegra30_clk_twd,
1330}; 1377};
diff --git a/arch/arm/mach-tegra/tegra30_speedo.c b/arch/arm/mach-tegra/tegra30_speedo.c
new file mode 100644
index 00000000000..125cb16424a
--- /dev/null
+++ b/arch/arm/mach-tegra/tegra30_speedo.c
@@ -0,0 +1,292 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kernel.h>
18#include <linux/bug.h>
19
20#include "fuse.h"
21
22#define CORE_PROCESS_CORNERS_NUM 1
23#define CPU_PROCESS_CORNERS_NUM 6
24
25#define FUSE_SPEEDO_CALIB_0 0x114
26#define FUSE_PACKAGE_INFO 0X1FC
27#define FUSE_TEST_PROG_VER 0X128
28
29#define G_SPEEDO_BIT_MINUS1 58
30#define G_SPEEDO_BIT_MINUS1_R 59
31#define G_SPEEDO_BIT_MINUS2 60
32#define G_SPEEDO_BIT_MINUS2_R 61
33#define LP_SPEEDO_BIT_MINUS1 62
34#define LP_SPEEDO_BIT_MINUS1_R 63
35#define LP_SPEEDO_BIT_MINUS2 64
36#define LP_SPEEDO_BIT_MINUS2_R 65
37
38enum {
39 THRESHOLD_INDEX_0,
40 THRESHOLD_INDEX_1,
41 THRESHOLD_INDEX_2,
42 THRESHOLD_INDEX_3,
43 THRESHOLD_INDEX_4,
44 THRESHOLD_INDEX_5,
45 THRESHOLD_INDEX_6,
46 THRESHOLD_INDEX_7,
47 THRESHOLD_INDEX_8,
48 THRESHOLD_INDEX_9,
49 THRESHOLD_INDEX_10,
50 THRESHOLD_INDEX_11,
51 THRESHOLD_INDEX_COUNT,
52};
53
54static const u32 core_process_speedos[][CORE_PROCESS_CORNERS_NUM] = {
55 {180},
56 {170},
57 {195},
58 {180},
59 {168},
60 {192},
61 {180},
62 {170},
63 {195},
64 {180},
65 {180},
66 {180},
67};
68
69static const u32 cpu_process_speedos[][CPU_PROCESS_CORNERS_NUM] = {
70 {306, 338, 360, 376, UINT_MAX},
71 {295, 336, 358, 375, UINT_MAX},
72 {325, 325, 358, 375, UINT_MAX},
73 {325, 325, 358, 375, UINT_MAX},
74 {292, 324, 348, 364, UINT_MAX},
75 {324, 324, 348, 364, UINT_MAX},
76 {324, 324, 348, 364, UINT_MAX},
77 {295, 336, 358, 375, UINT_MAX},
78 {358, 358, 358, 358, 397, UINT_MAX},
79 {364, 364, 364, 364, 397, UINT_MAX},
80 {295, 336, 358, 375, 391, UINT_MAX},
81 {295, 336, 358, 375, 391, UINT_MAX},
82};
83
84static int threshold_index;
85static int package_id;
86
87static void fuse_speedo_calib(u32 *speedo_g, u32 *speedo_lp)
88{
89 u32 reg;
90 int ate_ver;
91 int bit_minus1;
92 int bit_minus2;
93
94 reg = tegra_fuse_readl(FUSE_SPEEDO_CALIB_0);
95
96 *speedo_lp = (reg & 0xFFFF) * 4;
97 *speedo_g = ((reg >> 16) & 0xFFFF) * 4;
98
99 ate_ver = tegra_fuse_readl(FUSE_TEST_PROG_VER);
100 pr_info("%s: ATE prog ver %d.%d\n", __func__, ate_ver/10, ate_ver%10);
101
102 if (ate_ver >= 26) {
103 bit_minus1 = tegra_spare_fuse(LP_SPEEDO_BIT_MINUS1);
104 bit_minus1 |= tegra_spare_fuse(LP_SPEEDO_BIT_MINUS1_R);
105 bit_minus2 = tegra_spare_fuse(LP_SPEEDO_BIT_MINUS2);
106 bit_minus2 |= tegra_spare_fuse(LP_SPEEDO_BIT_MINUS2_R);
107 *speedo_lp |= (bit_minus1 << 1) | bit_minus2;
108
109 bit_minus1 = tegra_spare_fuse(G_SPEEDO_BIT_MINUS1);
110 bit_minus1 |= tegra_spare_fuse(G_SPEEDO_BIT_MINUS1_R);
111 bit_minus2 = tegra_spare_fuse(G_SPEEDO_BIT_MINUS2);
112 bit_minus2 |= tegra_spare_fuse(G_SPEEDO_BIT_MINUS2_R);
113 *speedo_g |= (bit_minus1 << 1) | bit_minus2;
114 } else {
115 *speedo_lp |= 0x3;
116 *speedo_g |= 0x3;
117 }
118}
119
120static void rev_sku_to_speedo_ids(int rev, int sku)
121{
122 switch (rev) {
123 case TEGRA_REVISION_A01:
124 tegra_cpu_speedo_id = 0;
125 tegra_soc_speedo_id = 0;
126 threshold_index = THRESHOLD_INDEX_0;
127 break;
128 case TEGRA_REVISION_A02:
129 case TEGRA_REVISION_A03:
130 switch (sku) {
131 case 0x87:
132 case 0x82:
133 tegra_cpu_speedo_id = 1;
134 tegra_soc_speedo_id = 1;
135 threshold_index = THRESHOLD_INDEX_1;
136 break;
137 case 0x81:
138 switch (package_id) {
139 case 1:
140 tegra_cpu_speedo_id = 2;
141 tegra_soc_speedo_id = 2;
142 threshold_index = THRESHOLD_INDEX_2;
143 break;
144 case 2:
145 tegra_cpu_speedo_id = 4;
146 tegra_soc_speedo_id = 1;
147 threshold_index = THRESHOLD_INDEX_7;
148 break;
149 default:
150 pr_err("Tegra30: Unknown pkg %d\n", package_id);
151 BUG();
152 break;
153 }
154 break;
155 case 0x80:
156 switch (package_id) {
157 case 1:
158 tegra_cpu_speedo_id = 5;
159 tegra_soc_speedo_id = 2;
160 threshold_index = THRESHOLD_INDEX_8;
161 break;
162 case 2:
163 tegra_cpu_speedo_id = 6;
164 tegra_soc_speedo_id = 2;
165 threshold_index = THRESHOLD_INDEX_9;
166 break;
167 default:
168 pr_err("Tegra30: Unknown pkg %d\n", package_id);
169 BUG();
170 break;
171 }
172 break;
173 case 0x83:
174 switch (package_id) {
175 case 1:
176 tegra_cpu_speedo_id = 7;
177 tegra_soc_speedo_id = 1;
178 threshold_index = THRESHOLD_INDEX_10;
179 break;
180 case 2:
181 tegra_cpu_speedo_id = 3;
182 tegra_soc_speedo_id = 2;
183 threshold_index = THRESHOLD_INDEX_3;
184 break;
185 default:
186 pr_err("Tegra30: Unknown pkg %d\n", package_id);
187 BUG();
188 break;
189 }
190 break;
191 case 0x8F:
192 tegra_cpu_speedo_id = 8;
193 tegra_soc_speedo_id = 1;
194 threshold_index = THRESHOLD_INDEX_11;
195 break;
196 case 0x08:
197 tegra_cpu_speedo_id = 1;
198 tegra_soc_speedo_id = 1;
199 threshold_index = THRESHOLD_INDEX_4;
200 break;
201 case 0x02:
202 tegra_cpu_speedo_id = 2;
203 tegra_soc_speedo_id = 2;
204 threshold_index = THRESHOLD_INDEX_5;
205 break;
206 case 0x04:
207 tegra_cpu_speedo_id = 3;
208 tegra_soc_speedo_id = 2;
209 threshold_index = THRESHOLD_INDEX_6;
210 break;
211 case 0:
212 switch (package_id) {
213 case 1:
214 tegra_cpu_speedo_id = 2;
215 tegra_soc_speedo_id = 2;
216 threshold_index = THRESHOLD_INDEX_2;
217 break;
218 case 2:
219 tegra_cpu_speedo_id = 3;
220 tegra_soc_speedo_id = 2;
221 threshold_index = THRESHOLD_INDEX_3;
222 break;
223 default:
224 pr_err("Tegra30: Unknown pkg %d\n", package_id);
225 BUG();
226 break;
227 }
228 break;
229 default:
230 pr_warn("Tegra30: Unknown SKU %d\n", sku);
231 tegra_cpu_speedo_id = 0;
232 tegra_soc_speedo_id = 0;
233 threshold_index = THRESHOLD_INDEX_0;
234 break;
235 }
236 break;
237 default:
238 pr_warn("Tegra30: Unknown chip rev %d\n", rev);
239 tegra_cpu_speedo_id = 0;
240 tegra_soc_speedo_id = 0;
241 threshold_index = THRESHOLD_INDEX_0;
242 break;
243 }
244}
245
246void tegra30_init_speedo_data(void)
247{
248 u32 cpu_speedo_val;
249 u32 core_speedo_val;
250 int i;
251
252 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) !=
253 THRESHOLD_INDEX_COUNT);
254 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) !=
255 THRESHOLD_INDEX_COUNT);
256
257 package_id = tegra_fuse_readl(FUSE_PACKAGE_INFO) & 0x0F;
258
259 rev_sku_to_speedo_ids(tegra_revision, tegra_sku_id);
260 fuse_speedo_calib(&cpu_speedo_val, &core_speedo_val);
261 pr_debug("%s CPU speedo value %u\n", __func__, cpu_speedo_val);
262 pr_debug("%s Core speedo value %u\n", __func__, core_speedo_val);
263
264 for (i = 0; i < CPU_PROCESS_CORNERS_NUM; i++) {
265 if (cpu_speedo_val < cpu_process_speedos[threshold_index][i])
266 break;
267 }
268 tegra_cpu_process_id = i - 1;
269
270 if (tegra_cpu_process_id == -1) {
271 pr_warn("Tegra30: CPU speedo value %3d out of range",
272 cpu_speedo_val);
273 tegra_cpu_process_id = 0;
274 tegra_cpu_speedo_id = 1;
275 }
276
277 for (i = 0; i < CORE_PROCESS_CORNERS_NUM; i++) {
278 if (core_speedo_val < core_process_speedos[threshold_index][i])
279 break;
280 }
281 tegra_core_process_id = i - 1;
282
283 if (tegra_core_process_id == -1) {
284 pr_warn("Tegra30: CORE speedo value %3d out of range",
285 core_speedo_val);
286 tegra_core_process_id = 0;
287 tegra_soc_speedo_id = 1;
288 }
289
290 pr_info("Tegra30: CPU Speedo ID %d, Soc Speedo ID %d",
291 tegra_cpu_speedo_id, tegra_soc_speedo_id);
292}
diff --git a/arch/arm/mach-tegra/tegra_cpu_car.h b/arch/arm/mach-tegra/tegra_cpu_car.h
index 30d063ad2be..9764d31032b 100644
--- a/arch/arm/mach-tegra/tegra_cpu_car.h
+++ b/arch/arm/mach-tegra/tegra_cpu_car.h
@@ -30,6 +30,12 @@
30 * CPU clock un-gate 30 * CPU clock un-gate
31 * disable_clock: 31 * disable_clock:
32 * CPU clock gate 32 * CPU clock gate
33 * rail_off_ready:
34 * CPU is ready for rail off
35 * suspend:
36 * save the clock settings when CPU go into low-power state
37 * resume:
38 * restore the clock settings when CPU exit low-power state
33 */ 39 */
34struct tegra_cpu_car_ops { 40struct tegra_cpu_car_ops {
35 void (*wait_for_reset)(u32 cpu); 41 void (*wait_for_reset)(u32 cpu);
@@ -37,6 +43,11 @@ struct tegra_cpu_car_ops {
37 void (*out_of_reset)(u32 cpu); 43 void (*out_of_reset)(u32 cpu);
38 void (*enable_clock)(u32 cpu); 44 void (*enable_clock)(u32 cpu);
39 void (*disable_clock)(u32 cpu); 45 void (*disable_clock)(u32 cpu);
46#ifdef CONFIG_PM_SLEEP
47 bool (*rail_off_ready)(void);
48 void (*suspend)(void);
49 void (*resume)(void);
50#endif
40}; 51};
41 52
42extern struct tegra_cpu_car_ops *tegra_cpu_car_ops; 53extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
@@ -81,6 +92,32 @@ static inline void tegra_disable_cpu_clock(u32 cpu)
81 tegra_cpu_car_ops->disable_clock(cpu); 92 tegra_cpu_car_ops->disable_clock(cpu);
82} 93}
83 94
95#ifdef CONFIG_PM_SLEEP
96static inline bool tegra_cpu_rail_off_ready(void)
97{
98 if (WARN_ON(!tegra_cpu_car_ops->rail_off_ready))
99 return false;
100
101 return tegra_cpu_car_ops->rail_off_ready();
102}
103
104static inline void tegra_cpu_clock_suspend(void)
105{
106 if (WARN_ON(!tegra_cpu_car_ops->suspend))
107 return;
108
109 tegra_cpu_car_ops->suspend();
110}
111
112static inline void tegra_cpu_clock_resume(void)
113{
114 if (WARN_ON(!tegra_cpu_car_ops->resume))
115 return;
116
117 tegra_cpu_car_ops->resume();
118}
119#endif
120
84void tegra20_cpu_car_ops_init(void); 121void tegra20_cpu_car_ops_init(void);
85void tegra30_cpu_car_ops_init(void); 122void tegra30_cpu_car_ops_init(void);
86 123
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index d3b8c8e7368..e4863f3e9ee 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -26,16 +26,14 @@
26#include <linux/clocksource.h> 26#include <linux/clocksource.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/of_address.h>
30#include <linux/of_irq.h>
29 31
30#include <asm/mach/time.h> 32#include <asm/mach/time.h>
31#include <asm/smp_twd.h> 33#include <asm/smp_twd.h>
32#include <asm/sched_clock.h> 34#include <asm/sched_clock.h>
33 35
34#include <mach/iomap.h>
35#include <mach/irqs.h>
36
37#include "board.h" 36#include "board.h"
38#include "clock.h"
39 37
40#define RTC_SECONDS 0x08 38#define RTC_SECONDS 0x08
41#define RTC_SHADOW_SECONDS 0x0c 39#define RTC_SHADOW_SECONDS 0x0c
@@ -53,8 +51,8 @@
53#define TIMER_PTV 0x0 51#define TIMER_PTV 0x0
54#define TIMER_PCR 0x4 52#define TIMER_PCR 0x4
55 53
56static void __iomem *timer_reg_base = IO_ADDRESS(TEGRA_TMR1_BASE); 54static void __iomem *timer_reg_base;
57static void __iomem *rtc_base = IO_ADDRESS(TEGRA_RTC_BASE); 55static void __iomem *rtc_base;
58 56
59static struct timespec persistent_ts; 57static struct timespec persistent_ts;
60static u64 persistent_ms, last_persistent_ms; 58static u64 persistent_ms, last_persistent_ms;
@@ -158,40 +156,66 @@ static struct irqaction tegra_timer_irq = {
158 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_TRIGGER_HIGH, 156 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_TRIGGER_HIGH,
159 .handler = tegra_timer_interrupt, 157 .handler = tegra_timer_interrupt,
160 .dev_id = &tegra_clockevent, 158 .dev_id = &tegra_clockevent,
161 .irq = INT_TMR3,
162}; 159};
163 160
164#ifdef CONFIG_HAVE_ARM_TWD 161static const struct of_device_id timer_match[] __initconst = {
165static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 162 { .compatible = "nvidia,tegra20-timer" },
166 TEGRA_ARM_PERIF_BASE + 0x600, 163 {}
167 IRQ_LOCALTIMER); 164};
168 165
169static void __init tegra_twd_init(void) 166static const struct of_device_id rtc_match[] __initconst = {
170{ 167 { .compatible = "nvidia,tegra20-rtc" },
171 int err = twd_local_timer_register(&twd_local_timer); 168 {}
172 if (err) 169};
173 pr_err("twd_local_timer_register failed %d\n", err);
174}
175#else
176#define tegra_twd_init() do {} while(0)
177#endif
178 170
179static void __init tegra_init_timer(void) 171static void __init tegra_init_timer(void)
180{ 172{
173 struct device_node *np;
181 struct clk *clk; 174 struct clk *clk;
182 unsigned long rate; 175 unsigned long rate;
183 int ret; 176 int ret;
184 177
178 np = of_find_matching_node(NULL, timer_match);
179 if (!np) {
180 pr_err("Failed to find timer DT node\n");
181 BUG();
182 }
183
184 timer_reg_base = of_iomap(np, 0);
185 if (!timer_reg_base) {
186 pr_err("Can't map timer registers");
187 BUG();
188 }
189
190 tegra_timer_irq.irq = irq_of_parse_and_map(np, 2);
191 if (tegra_timer_irq.irq <= 0) {
192 pr_err("Failed to map timer IRQ\n");
193 BUG();
194 }
195
185 clk = clk_get_sys("timer", NULL); 196 clk = clk_get_sys("timer", NULL);
186 if (IS_ERR(clk)) { 197 if (IS_ERR(clk)) {
187 pr_warn("Unable to get timer clock." 198 pr_warn("Unable to get timer clock. Assuming 12Mhz input clock.\n");
188 " Assuming 12Mhz input clock.\n");
189 rate = 12000000; 199 rate = 12000000;
190 } else { 200 } else {
191 clk_prepare_enable(clk); 201 clk_prepare_enable(clk);
192 rate = clk_get_rate(clk); 202 rate = clk_get_rate(clk);
193 } 203 }
194 204
205 of_node_put(np);
206
207 np = of_find_matching_node(NULL, rtc_match);
208 if (!np) {
209 pr_err("Failed to find RTC DT node\n");
210 BUG();
211 }
212
213 rtc_base = of_iomap(np, 0);
214 if (!rtc_base) {
215 pr_err("Can't map RTC registers");
216 BUG();
217 }
218
195 /* 219 /*
196 * rtc registers are used by read_persistent_clock, keep the rtc clock 220 * rtc registers are used by read_persistent_clock, keep the rtc clock
197 * enabled 221 * enabled
@@ -202,6 +226,8 @@ static void __init tegra_init_timer(void)
202 else 226 else
203 clk_prepare_enable(clk); 227 clk_prepare_enable(clk);
204 228
229 of_node_put(np);
230
205 switch (rate) { 231 switch (rate) {
206 case 12000000: 232 case 12000000:
207 timer_writel(0x000b, TIMERUS_USEC_CFG); 233 timer_writel(0x000b, TIMERUS_USEC_CFG);
@@ -223,13 +249,13 @@ static void __init tegra_init_timer(void)
223 249
224 if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US, 250 if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
225 "timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) { 251 "timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) {
226 printk(KERN_ERR "Failed to register clocksource\n"); 252 pr_err("Failed to register clocksource\n");
227 BUG(); 253 BUG();
228 } 254 }
229 255
230 ret = setup_irq(tegra_timer_irq.irq, &tegra_timer_irq); 256 ret = setup_irq(tegra_timer_irq.irq, &tegra_timer_irq);
231 if (ret) { 257 if (ret) {
232 printk(KERN_ERR "Failed to register timer IRQ: %d\n", ret); 258 pr_err("Failed to register timer IRQ: %d\n", ret);
233 BUG(); 259 BUG();
234 } 260 }
235 261
@@ -241,7 +267,9 @@ static void __init tegra_init_timer(void)
241 tegra_clockevent.cpumask = cpu_all_mask; 267 tegra_clockevent.cpumask = cpu_all_mask;
242 tegra_clockevent.irq = tegra_timer_irq.irq; 268 tegra_clockevent.irq = tegra_timer_irq.irq;
243 clockevents_register_device(&tegra_clockevent); 269 clockevents_register_device(&tegra_clockevent);
244 tegra_twd_init(); 270#ifdef CONFIG_HAVE_ARM_TWD
271 twd_local_timer_of_register();
272#endif
245 register_persistent_clock(NULL, tegra_read_persistent_clock); 273 register_persistent_clock(NULL, tegra_read_persistent_clock);
246} 274}
247 275
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index b8efac4daed..12f3994c43d 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -82,8 +82,6 @@ static struct map_desc u300_io_desc[] __initdata = {
82static void __init u300_map_io(void) 82static void __init u300_map_io(void)
83{ 83{
84 iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc)); 84 iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc));
85 /* We enable a real big DMA buffer if need be. */
86 init_consistent_dma_size(SZ_4M);
87} 85}
88 86
89/* 87/*
@@ -1445,8 +1443,6 @@ static struct platform_device pinctrl_device = {
1445static struct u300_gpio_platform u300_gpio_plat = { 1443static struct u300_gpio_platform u300_gpio_plat = {
1446 .ports = 7, 1444 .ports = 7,
1447 .gpio_base = 0, 1445 .gpio_base = 0,
1448 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1449 .pinctrl_device = &pinctrl_device,
1450}; 1446};
1451 1447
1452static struct platform_device gpio_device = { 1448static struct platform_device gpio_device = {
@@ -1590,6 +1586,7 @@ static struct platform_device *platform_devs[] __initdata = {
1590 &i2c1_device, 1586 &i2c1_device,
1591 &keypad_device, 1587 &keypad_device,
1592 &rtc_device, 1588 &rtc_device,
1589 &pinctrl_device,
1593 &gpio_device, 1590 &gpio_device,
1594 &nand_device, 1591 &nand_device,
1595 &wdog_device, 1592 &wdog_device,
@@ -1804,7 +1801,7 @@ MACHINE_START(U300, "Ericsson AB U335 S335/B335 Prototype Board")
1804 /* Maintainer: Linus Walleij <linus.walleij@stericsson.com> */ 1801 /* Maintainer: Linus Walleij <linus.walleij@stericsson.com> */
1805 .atag_offset = 0x100, 1802 .atag_offset = 0x100,
1806 .map_io = u300_map_io, 1803 .map_io = u300_map_io,
1807 .nr_irqs = NR_IRQS_U300, 1804 .nr_irqs = 0,
1808 .init_irq = u300_init_irq, 1805 .init_irq = u300_init_irq,
1809 .handle_irq = vic_handle_irq, 1806 .handle_irq = vic_handle_irq,
1810 .timer = &u300_timer, 1807 .timer = &u300_timer,
diff --git a/arch/arm/mach-u300/include/mach/irqs.h b/arch/arm/mach-u300/include/mach/irqs.h
index e27425a63fa..21d5e76a6cd 100644
--- a/arch/arm/mach-u300/include/mach/irqs.h
+++ b/arch/arm/mach-u300/include/mach/irqs.h
@@ -12,79 +12,69 @@
12#ifndef __MACH_IRQS_H 12#ifndef __MACH_IRQS_H
13#define __MACH_IRQS_H 13#define __MACH_IRQS_H
14 14
15#define IRQ_U300_INTCON0_START 1 15#define IRQ_U300_INTCON0_START 32
16#define IRQ_U300_INTCON1_START 33 16#define IRQ_U300_INTCON1_START 64
17/* These are on INTCON0 - 30 lines */ 17/* These are on INTCON0 - 30 lines */
18#define IRQ_U300_IRQ0_EXT 1 18#define IRQ_U300_IRQ0_EXT 32
19#define IRQ_U300_IRQ1_EXT 2 19#define IRQ_U300_IRQ1_EXT 33
20#define IRQ_U300_DMA 3 20#define IRQ_U300_DMA 34
21#define IRQ_U300_VIDEO_ENC_0 4 21#define IRQ_U300_VIDEO_ENC_0 35
22#define IRQ_U300_VIDEO_ENC_1 5 22#define IRQ_U300_VIDEO_ENC_1 36
23#define IRQ_U300_AAIF_RX 6 23#define IRQ_U300_AAIF_RX 37
24#define IRQ_U300_AAIF_TX 7 24#define IRQ_U300_AAIF_TX 38
25#define IRQ_U300_AAIF_VGPIO 8 25#define IRQ_U300_AAIF_VGPIO 39
26#define IRQ_U300_AAIF_WAKEUP 9 26#define IRQ_U300_AAIF_WAKEUP 40
27#define IRQ_U300_PCM_I2S0_FRAME 10 27#define IRQ_U300_PCM_I2S0_FRAME 41
28#define IRQ_U300_PCM_I2S0_FIFO 11 28#define IRQ_U300_PCM_I2S0_FIFO 42
29#define IRQ_U300_PCM_I2S1_FRAME 12 29#define IRQ_U300_PCM_I2S1_FRAME 43
30#define IRQ_U300_PCM_I2S1_FIFO 13 30#define IRQ_U300_PCM_I2S1_FIFO 44
31#define IRQ_U300_XGAM_GAMCON 14 31#define IRQ_U300_XGAM_GAMCON 45
32#define IRQ_U300_XGAM_CDI 15 32#define IRQ_U300_XGAM_CDI 46
33#define IRQ_U300_XGAM_CDICON 16 33#define IRQ_U300_XGAM_CDICON 47
34#define IRQ_U300_XGAM_PDI 18 34#define IRQ_U300_XGAM_PDI 49
35#define IRQ_U300_XGAM_PDICON 19 35#define IRQ_U300_XGAM_PDICON 50
36#define IRQ_U300_XGAM_GAMEACC 20 36#define IRQ_U300_XGAM_GAMEACC 51
37#define IRQ_U300_XGAM_MCIDCT 21 37#define IRQ_U300_XGAM_MCIDCT 52
38#define IRQ_U300_APEX 22 38#define IRQ_U300_APEX 53
39#define IRQ_U300_UART0 23 39#define IRQ_U300_UART0 54
40#define IRQ_U300_SPI 24 40#define IRQ_U300_SPI 55
41#define IRQ_U300_TIMER_APP_OS 25 41#define IRQ_U300_TIMER_APP_OS 56
42#define IRQ_U300_TIMER_APP_DD 26 42#define IRQ_U300_TIMER_APP_DD 57
43#define IRQ_U300_TIMER_APP_GP1 27 43#define IRQ_U300_TIMER_APP_GP1 58
44#define IRQ_U300_TIMER_APP_GP2 28 44#define IRQ_U300_TIMER_APP_GP2 59
45#define IRQ_U300_TIMER_OS 29 45#define IRQ_U300_TIMER_OS 60
46#define IRQ_U300_TIMER_MS 30 46#define IRQ_U300_TIMER_MS 61
47#define IRQ_U300_KEYPAD_KEYBF 31 47#define IRQ_U300_KEYPAD_KEYBF 62
48#define IRQ_U300_KEYPAD_KEYBR 32 48#define IRQ_U300_KEYPAD_KEYBR 63
49/* These are on INTCON1 - 32 lines */ 49/* These are on INTCON1 - 32 lines */
50#define IRQ_U300_GPIO_PORT0 33 50#define IRQ_U300_GPIO_PORT0 64
51#define IRQ_U300_GPIO_PORT1 34 51#define IRQ_U300_GPIO_PORT1 65
52#define IRQ_U300_GPIO_PORT2 35 52#define IRQ_U300_GPIO_PORT2 66
53 53
54/* These are for DB3150, DB3200 and DB3350 */ 54/* These are for DB3150, DB3200 and DB3350 */
55#define IRQ_U300_WDOG 36 55#define IRQ_U300_WDOG 67
56#define IRQ_U300_EVHIST 37 56#define IRQ_U300_EVHIST 68
57#define IRQ_U300_MSPRO 38 57#define IRQ_U300_MSPRO 69
58#define IRQ_U300_MMCSD_MCIINTR0 39 58#define IRQ_U300_MMCSD_MCIINTR0 70
59#define IRQ_U300_MMCSD_MCIINTR1 40 59#define IRQ_U300_MMCSD_MCIINTR1 71
60#define IRQ_U300_I2C0 41 60#define IRQ_U300_I2C0 72
61#define IRQ_U300_I2C1 42 61#define IRQ_U300_I2C1 73
62#define IRQ_U300_RTC 43 62#define IRQ_U300_RTC 74
63#define IRQ_U300_NFIF 44 63#define IRQ_U300_NFIF 75
64#define IRQ_U300_NFIF2 45 64#define IRQ_U300_NFIF2 76
65 65
66/* The DB3350-specific interrupt lines */ 66/* The DB3350-specific interrupt lines */
67#define IRQ_U300_ISP_F0 46 67#define IRQ_U300_ISP_F0 77
68#define IRQ_U300_ISP_F1 47 68#define IRQ_U300_ISP_F1 78
69#define IRQ_U300_ISP_F2 48 69#define IRQ_U300_ISP_F2 79
70#define IRQ_U300_ISP_F3 49 70#define IRQ_U300_ISP_F3 80
71#define IRQ_U300_ISP_F4 50 71#define IRQ_U300_ISP_F4 81
72#define IRQ_U300_GPIO_PORT3 51 72#define IRQ_U300_GPIO_PORT3 82
73#define IRQ_U300_SYSCON_PLL_LOCK 52 73#define IRQ_U300_SYSCON_PLL_LOCK 83
74#define IRQ_U300_UART1 53 74#define IRQ_U300_UART1 84
75#define IRQ_U300_GPIO_PORT4 54 75#define IRQ_U300_GPIO_PORT4 85
76#define IRQ_U300_GPIO_PORT5 55 76#define IRQ_U300_GPIO_PORT5 86
77#define IRQ_U300_GPIO_PORT6 56 77#define IRQ_U300_GPIO_PORT6 87
78#define U300_VIC_IRQS_END 57 78#define U300_VIC_IRQS_END 88
79
80/* Maximum 8*7 GPIO lines */
81#ifdef CONFIG_PINCTRL_COH901
82#define IRQ_U300_GPIO_BASE (U300_VIC_IRQS_END)
83#define IRQ_U300_GPIO_END (IRQ_U300_GPIO_BASE + 56)
84#else
85#define IRQ_U300_GPIO_END (U300_VIC_IRQS_END)
86#endif
87
88#define NR_IRQS_U300 (IRQ_U300_GPIO_END - IRQ_U300_INTCON0_START)
89 79
90#endif 80#endif
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index e8c3f0d70ca..5dea90636d9 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -7,8 +7,8 @@ config UX500_SOC_COMMON
7 select ARM_ERRATA_764369 if SMP 7 select ARM_ERRATA_764369 if SMP
8 select ARM_GIC 8 select ARM_GIC
9 select CACHE_L2X0 9 select CACHE_L2X0
10 select CLKSRC_NOMADIK_MTU
10 select COMMON_CLK 11 select COMMON_CLK
11 select HAS_MTU
12 select PINCTRL 12 select PINCTRL
13 select PINCTRL_NOMADIK 13 select PINCTRL_NOMADIK
14 select PL310_ERRATA_753970 if CACHE_PL310 14 select PL310_ERRATA_753970 if CACHE_PL310
diff --git a/arch/arm/mach-ux500/board-mop500-audio.c b/arch/arm/mach-ux500/board-mop500-audio.c
index 070629a9562..7209db7cdc7 100644
--- a/arch/arm/mach-ux500/board-mop500-audio.c
+++ b/arch/arm/mach-ux500/board-mop500-audio.c
@@ -7,10 +7,8 @@
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 10#include <linux/platform_data/pinctrl-nomadik.h>
11#include <plat/gpio-nomadik.h> 11#include <linux/platform_data/dma-ste-dma40.h>
12#include <plat/pincfg.h>
13#include <plat/ste_dma40.h>
14 12
15#include <mach/devices.h> 13#include <mach/devices.h>
16#include <mach/hardware.h> 14#include <mach/hardware.h>
@@ -150,15 +148,6 @@ static struct platform_device snd_soc_mop500 = {
150 }, 148 },
151}; 149};
152 150
153/* Platform device for Ux500-PCM */
154static struct platform_device ux500_pcm = {
155 .name = "ux500-pcm",
156 .id = 0,
157 .dev = {
158 .platform_data = NULL,
159 },
160};
161
162struct msp_i2s_platform_data msp2_platform_data = { 151struct msp_i2s_platform_data msp2_platform_data = {
163 .id = MSP_I2S_2, 152 .id = MSP_I2S_2,
164 .msp_i2s_dma_rx = &msp2_dma_rx, 153 .msp_i2s_dma_rx = &msp2_dma_rx,
@@ -186,10 +175,3 @@ void mop500_audio_init(struct device *parent)
186 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, 175 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
187 &msp3_platform_data); 176 &msp3_platform_data);
188} 177}
189
190/* Due for removal once the MSP driver has been fully DT:ed. */
191void mop500_of_audio_init(struct device *parent)
192{
193 pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__);
194 platform_device_register(&ux500_pcm);
195}
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index a267c6d30e3..0a3f30df1eb 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -9,10 +9,9 @@
9#include <linux/bug.h> 9#include <linux/bug.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pinctrl/machine.h> 11#include <linux/pinctrl/machine.h>
12#include <linux/platform_data/pinctrl-nomadik.h>
12 13
13#include <asm/mach-types.h> 14#include <asm/mach-types.h>
14#include <plat/pincfg.h>
15#include <plat/gpio-nomadik.h>
16 15
17#include <mach/hardware.h> 16#include <mach/hardware.h>
18 17
@@ -34,8 +33,6 @@ BIAS(in_nopull, PIN_INPUT_NOPULL);
34BIAS(in_nopull_slpm_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE); 33BIAS(in_nopull_slpm_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE);
35BIAS(in_pu, PIN_INPUT_PULLUP); 34BIAS(in_pu, PIN_INPUT_PULLUP);
36BIAS(in_pd, PIN_INPUT_PULLDOWN); 35BIAS(in_pd, PIN_INPUT_PULLDOWN);
37BIAS(in_pd_slpm_in_pu, PIN_INPUT_PULLDOWN|PIN_SLPM_INPUT_PULLUP);
38BIAS(in_pu_slpm_out_lo, PIN_INPUT_PULLUP|PIN_SLPM_OUTPUT_LOW);
39BIAS(out_hi, PIN_OUTPUT_HIGH); 36BIAS(out_hi, PIN_OUTPUT_HIGH);
40BIAS(out_lo, PIN_OUTPUT_LOW); 37BIAS(out_lo, PIN_OUTPUT_LOW);
41BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE); 38BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE);
@@ -47,14 +44,34 @@ BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SL
47BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED); 44BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED);
48BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED); 45BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED);
49/* Sleep modes */ 46/* Sleep modes */
50BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 47BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED|
51BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED|PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); 48 PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE);
52BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 49BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|
53BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 50 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
54BIAS(slpm_out_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 51BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|
55BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE); 52 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
56BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 53BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED|
57BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 54 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED);
55BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED|
56 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE);
57BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|
58 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
59BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|
60 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
61BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|
62 PIN_SLPM_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
63BIAS(slpm_in_pu_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_PULLUP|
64 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
65BIAS(slpm_out_wkup_pdis, PIN_SLEEPMODE_ENABLED|
66 PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
67BIAS(out_lo_wkup_pdis, PIN_SLPM_OUTPUT_LOW|
68 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
69BIAS(in_wkup_pdis_en, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
70 PIN_SLPM_PDIS_ENABLED);
71BIAS(in_wkup_pdis, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
72 PIN_SLPM_PDIS_DISABLED);
73BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|
74 PIN_SLPM_PDIS_DISABLED);
58 75
59/* We use these to define hog settings that are always done on boot */ 76/* We use these to define hog settings that are always done on boot */
60#define DB8500_MUX_HOG(group,func) \ 77#define DB8500_MUX_HOG(group,func) \
@@ -70,13 +87,16 @@ BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_NOPULL|PIN_S
70 PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func) 87 PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func)
71#define DB8500_PIN(pin,conf,dev) \ 88#define DB8500_PIN(pin,conf,dev) \
72 PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf) 89 PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf)
73#define DB8500_PIN_SLEEP(pin, conf, dev) \ 90#define DB8500_PIN_IDLE(pin, conf, dev) \
74 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ 91 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_IDLE, "pinctrl-db8500", \
75 pin, conf) 92 pin, conf)
76 93#define DB8500_PIN_SLEEP(pin, conf, dev) \
77#define DB8500_PIN_SLEEP(pin,conf,dev) \
78 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ 94 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \
79 pin, conf) 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)
80 100
81/* Pin control settings */ 101/* Pin control settings */
82static struct pinctrl_map __initdata mop500_family_pinmap[] = { 102static struct pinctrl_map __initdata mop500_family_pinmap[] = {
@@ -113,7 +133,7 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
113 * UART0, we do not mux in u0 here. 133 * UART0, we do not mux in u0 here.
114 * uart-0 pins gpio configuration should be kept intact to prevent 134 * uart-0 pins gpio configuration should be kept intact to prevent
115 * a glitch in tx line when the tty dev is opened. Later these pins 135 * a glitch in tx line when the tty dev is opened. Later these pins
116 * are configured to uart mop500_pins_uart0 136 * are configured by uart driver
117 */ 137 */
118 DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */ 138 DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */
119 DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */ 139 DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */
@@ -124,12 +144,13 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
124 * TODO: is this used on U8500 variants and Snowball really? 144 * TODO: is this used on U8500 variants and Snowball really?
125 * The setting on GPIO31 conflicts with magnetometer use on hrefv60 145 * The setting on GPIO31 conflicts with magnetometer use on hrefv60
126 */ 146 */
127 DB8500_MUX_HOG("u2rxtx_c_1", "u2"), 147 /* default state for UART2 */
128 DB8500_MUX_HOG("u2ctsrts_c_1", "u2"), 148 DB8500_MUX("u2rxtx_c_1", "u2", "uart2"),
129 DB8500_PIN_HOG("GPIO29_W2", in_pu), /* RXD */ 149 DB8500_PIN("GPIO29_W2", in_pu, "uart2"), /* RXD */
130 DB8500_PIN_HOG("GPIO30_W3", out_hi), /* TXD */ 150 DB8500_PIN("GPIO30_W3", out_hi, "uart2"), /* TXD */
131 DB8500_PIN_HOG("GPIO31_V3", in_pu), /* CTS */ 151 /* Sleep state for UART2 */
132 DB8500_PIN_HOG("GPIO32_V2", out_hi), /* RTS */ 152 DB8500_PIN_SLEEP("GPIO29_W2", in_wkup_pdis, "uart2"),
153 DB8500_PIN_SLEEP("GPIO30_W3", out_wkup_pdis, "uart2"),
133 /* 154 /*
134 * The following pin sets were known as "runtime pins" before being 155 * The following pin sets were known as "runtime pins" before being
135 * converted to the pinctrl model. Here we model them as "default" 156 * converted to the pinctrl model. Here we model them as "default"
@@ -141,11 +162,18 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
141 DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */ 162 DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */
142 DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */ 163 DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */
143 DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */ 164 DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */
144 /* UART0 sleep state */ 165 /* Sleep state for UART0 */
145 DB8500_PIN_SLEEP("GPIO0_AJ5", slpm_in_wkup_pdis, "uart0"), 166 DB8500_PIN_SLEEP("GPIO0_AJ5", slpm_in_wkup_pdis, "uart0"),
146 DB8500_PIN_SLEEP("GPIO1_AJ3", slpm_out_hi_wkup_pdis, "uart0"), 167 DB8500_PIN_SLEEP("GPIO1_AJ3", slpm_out_hi_wkup_pdis, "uart0"),
147 DB8500_PIN_SLEEP("GPIO2_AH4", slpm_in_wkup_pdis, "uart0"), 168 DB8500_PIN_SLEEP("GPIO2_AH4", slpm_in_wkup_pdis, "uart0"),
148 DB8500_PIN_SLEEP("GPIO3_AH3", slpm_out_wkup_pdis, "uart0"), 169 DB8500_PIN_SLEEP("GPIO3_AH3", slpm_out_wkup_pdis, "uart0"),
170 /* Mux in UART1 after initialization */
171 DB8500_MUX("u1rxtx_a_1", "u1", "uart1"),
172 DB8500_PIN("GPIO4_AH6", in_pu, "uart1"), /* RXD */
173 DB8500_PIN("GPIO5_AG6", out_hi, "uart1"), /* TXD */
174 /* Sleep state for UART1 */
175 DB8500_PIN_SLEEP("GPIO4_AH6", slpm_in_wkup_pdis, "uart1"),
176 DB8500_PIN_SLEEP("GPIO5_AG6", slpm_out_wkup_pdis, "uart1"),
149 /* MSP1 for ALSA codec */ 177 /* MSP1 for ALSA codec */
150 DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"), 178 DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"),
151 DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"), 179 DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"),
@@ -162,7 +190,10 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
162 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"), 190 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"),
163 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"), 191 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"),
164 /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */ 192 /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */
165 DB8500_MUX("lcdvsi1_a_1", "lcd", "av8100-hdmi"), 193 DB8500_MUX("lcdvsi1_a_1", "lcd", "0-0070"),
194 DB8500_PIN("GPIO69_E2", in_pu, "0-0070"),
195 /* LCD VSI1 sleep state */
196 DB8500_PIN_SLEEP("GPIO69_E2", slpm_in_wkup_pdis, "0-0070"),
166 /* Mux in i2c0 block, default state */ 197 /* Mux in i2c0 block, default state */
167 DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"), 198 DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"),
168 /* i2c0 sleep state */ 199 /* i2c0 sleep state */
@@ -195,6 +226,18 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
195 DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */ 226 DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */
196 DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */ 227 DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */
197 DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */ 228 DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */
229 /* SDI0 sleep state */
230 DB8500_PIN_SLEEP("GPIO18_AC2", slpm_out_hi_wkup_pdis, "sdi0"),
231 DB8500_PIN_SLEEP("GPIO19_AC1", slpm_out_hi_wkup_pdis, "sdi0"),
232 DB8500_PIN_SLEEP("GPIO20_AB4", slpm_out_hi_wkup_pdis, "sdi0"),
233 DB8500_PIN_SLEEP("GPIO22_AA3", slpm_in_wkup_pdis, "sdi0"),
234 DB8500_PIN_SLEEP("GPIO23_AA4", slpm_out_lo_wkup_pdis, "sdi0"),
235 DB8500_PIN_SLEEP("GPIO24_AB2", slpm_in_wkup_pdis, "sdi0"),
236 DB8500_PIN_SLEEP("GPIO25_Y4", slpm_in_wkup_pdis, "sdi0"),
237 DB8500_PIN_SLEEP("GPIO26_Y2", slpm_in_wkup_pdis, "sdi0"),
238 DB8500_PIN_SLEEP("GPIO27_AA2", slpm_in_wkup_pdis, "sdi0"),
239 DB8500_PIN_SLEEP("GPIO28_AA1", slpm_in_wkup_pdis, "sdi0"),
240
198 /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */ 241 /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */
199 DB8500_MUX("mc1_a_1", "mc1", "sdi1"), 242 DB8500_MUX("mc1_a_1", "mc1", "sdi1"),
200 DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */ 243 DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */
@@ -204,6 +247,15 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
204 DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */ 247 DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */
205 DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */ 248 DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */
206 DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */ 249 DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */
250 /* SDI1 sleep state */
251 DB8500_PIN_SLEEP("GPIO208_AH16", slpm_out_lo_wkup_pdis, "sdi1"), /* CLK */
252 DB8500_PIN_SLEEP("GPIO209_AG15", slpm_in_wkup_pdis, "sdi1"), /* FBCLK */
253 DB8500_PIN_SLEEP("GPIO210_AJ15", slpm_in_wkup_pdis, "sdi1"), /* CMD */
254 DB8500_PIN_SLEEP("GPIO211_AG14", slpm_in_wkup_pdis, "sdi1"), /* DAT0 */
255 DB8500_PIN_SLEEP("GPIO212_AF13", slpm_in_wkup_pdis, "sdi1"), /* DAT1 */
256 DB8500_PIN_SLEEP("GPIO213_AG13", slpm_in_wkup_pdis, "sdi1"), /* DAT2 */
257 DB8500_PIN_SLEEP("GPIO214_AH15", slpm_in_wkup_pdis, "sdi1"), /* DAT3 */
258
207 /* Mux in SDI2 (here called MC2) used for for PoP eMMC */ 259 /* Mux in SDI2 (here called MC2) used for for PoP eMMC */
208 DB8500_MUX("mc2_a_1", "mc2", "sdi2"), 260 DB8500_MUX("mc2_a_1", "mc2", "sdi2"),
209 DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */ 261 DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */
@@ -217,6 +269,19 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
217 DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */ 269 DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */
218 DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */ 270 DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */
219 DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */ 271 DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */
272 /* SDI2 sleep state */
273 DB8500_PIN_SLEEP("GPIO128_A5", out_lo_wkup_pdis, "sdi2"), /* CLK */
274 DB8500_PIN_SLEEP("GPIO129_B4", in_wkup_pdis_en, "sdi2"), /* CMD */
275 DB8500_PIN_SLEEP("GPIO130_C8", in_wkup_pdis_en, "sdi2"), /* FBCLK */
276 DB8500_PIN_SLEEP("GPIO131_A12", in_wkup_pdis, "sdi2"), /* DAT0 */
277 DB8500_PIN_SLEEP("GPIO132_C10", in_wkup_pdis, "sdi2"), /* DAT1 */
278 DB8500_PIN_SLEEP("GPIO133_B10", in_wkup_pdis, "sdi2"), /* DAT2 */
279 DB8500_PIN_SLEEP("GPIO134_B9", in_wkup_pdis, "sdi2"), /* DAT3 */
280 DB8500_PIN_SLEEP("GPIO135_A9", in_wkup_pdis, "sdi2"), /* DAT4 */
281 DB8500_PIN_SLEEP("GPIO136_C7", in_wkup_pdis, "sdi2"), /* DAT5 */
282 DB8500_PIN_SLEEP("GPIO137_A7", in_wkup_pdis, "sdi2"), /* DAT6 */
283 DB8500_PIN_SLEEP("GPIO138_C5", in_wkup_pdis, "sdi2"), /* DAT7 */
284
220 /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */ 285 /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */
221 DB8500_MUX("mc4_a_1", "mc4", "sdi4"), 286 DB8500_MUX("mc4_a_1", "mc4", "sdi4"),
222 DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */ 287 DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */
@@ -230,6 +295,19 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
230 DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */ 295 DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */
231 DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */ 296 DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */
232 DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */ 297 DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */
298 /*SDI4 sleep state */
299 DB8500_PIN_SLEEP("GPIO197_AH24", slpm_in_wkup_pdis, "sdi4"), /* DAT3 */
300 DB8500_PIN_SLEEP("GPIO198_AG25", slpm_in_wkup_pdis, "sdi4"), /* DAT2 */
301 DB8500_PIN_SLEEP("GPIO199_AH23", slpm_in_wkup_pdis, "sdi4"), /* DAT1 */
302 DB8500_PIN_SLEEP("GPIO200_AH26", slpm_in_wkup_pdis, "sdi4"), /* DAT0 */
303 DB8500_PIN_SLEEP("GPIO201_AF24", slpm_in_wkup_pdis, "sdi4"), /* CMD */
304 DB8500_PIN_SLEEP("GPIO202_AF25", slpm_in_wkup_pdis, "sdi4"), /* FBCLK */
305 DB8500_PIN_SLEEP("GPIO203_AE23", slpm_out_lo_wkup_pdis, "sdi4"), /* CLK */
306 DB8500_PIN_SLEEP("GPIO204_AF23", slpm_in_wkup_pdis, "sdi4"), /* DAT7 */
307 DB8500_PIN_SLEEP("GPIO205_AG23", slpm_in_wkup_pdis, "sdi4"), /* DAT6 */
308 DB8500_PIN_SLEEP("GPIO206_AG24", slpm_in_wkup_pdis, "sdi4"), /* DAT5 */
309 DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */
310
233 /* Mux in USB pins, drive STP high */ 311 /* Mux in USB pins, drive STP high */
234 DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), 312 DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"),
235 DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ 313 DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */
@@ -239,10 +317,232 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
239 DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */ 317 DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */
240 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ 318 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */
241 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ 319 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */
320 /* SPI2 idle state */
321 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
322 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
323 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
242 /* SPI2 sleep state */ 324 /* SPI2 sleep state */
325 DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */
243 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ 326 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
244 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ 327 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
245 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ 328 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
329
330 /* ske default state */
331 DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
332 DB8500_PIN("GPIO153_B17", in_pd, "nmk-ske-keypad"), /* I7 */
333 DB8500_PIN("GPIO154_C16", in_pd, "nmk-ske-keypad"), /* I6 */
334 DB8500_PIN("GPIO155_C19", in_pd, "nmk-ske-keypad"), /* I5 */
335 DB8500_PIN("GPIO156_C17", in_pd, "nmk-ske-keypad"), /* I4 */
336 DB8500_PIN("GPIO161_D21", in_pd, "nmk-ske-keypad"), /* I3 */
337 DB8500_PIN("GPIO162_D20", in_pd, "nmk-ske-keypad"), /* I2 */
338 DB8500_PIN("GPIO163_C20", in_pd, "nmk-ske-keypad"), /* I1 */
339 DB8500_PIN("GPIO164_B21", in_pd, "nmk-ske-keypad"), /* I0 */
340 DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
341 DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
342 DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
343 DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
344 DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
345 DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
346 DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
347 DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
348 /* ske sleep state */
349 DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
350 DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
351 DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
352 DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
353 DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
354 DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
355 DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
356 DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
357 DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
358 DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
359 DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
360 DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
361 DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
362 DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
363 DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
364 DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
365
366 /* STM APE pins states */
367 DB8500_MUX_STATE("stmape_c_1", "stmape",
368 "stm", "ape_mipi34"),
369 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
370 "stm", "ape_mipi34"), /* clk */
371 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
372 "stm", "ape_mipi34"), /* dat3 */
373 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
374 "stm", "ape_mipi34"), /* dat2 */
375 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
376 "stm", "ape_mipi34"), /* dat1 */
377 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
378 "stm", "ape_mipi34"), /* dat0 */
379
380 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
381 "stm", "ape_mipi34_sleep"), /* clk */
382 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
383 "stm", "ape_mipi34_sleep"), /* dat3 */
384 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
385 "stm", "ape_mipi34_sleep"), /* dat2 */
386 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
387 "stm", "ape_mipi34_sleep"), /* dat1 */
388 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
389 "stm", "ape_mipi34_sleep"), /* dat0 */
390
391 DB8500_MUX_STATE("stmape_oc1_1", "stmape",
392 "stm", "ape_microsd"),
393 DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
394 "stm", "ape_microsd"), /* clk */
395 DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
396 "stm", "ape_microsd"), /* dat0 */
397 DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
398 "stm", "ape_microsd"), /* dat1 */
399 DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
400 "stm", "ape_microsd"), /* dat2 */
401 DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
402 "stm", "ape_microsd"), /* dat3 */
403
404 DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
405 "stm", "ape_microsd_sleep"), /* clk */
406 DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
407 "stm", "ape_microsd_sleep"), /* dat0 */
408 DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
409 "stm", "ape_microsd_sleep"), /* dat1 */
410 DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
411 "stm", "ape_microsd_sleep"), /* dat2 */
412 DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
413 "stm", "ape_microsd_sleep"), /* dat3 */
414
415 /* STM Modem pins states */
416 DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
417 "stm", "mod_mipi34"),
418 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
419 "stm", "mod_mipi34"),
420 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
421 "stm", "mod_mipi34"),
422 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
423 "stm", "mod_mipi34"), /* clk */
424 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
425 "stm", "mod_mipi34"), /* dat3 */
426 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
427 "stm", "mod_mipi34"), /* dat2 */
428 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
429 "stm", "mod_mipi34"), /* dat1 */
430 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
431 "stm", "mod_mipi34"), /* dat0 */
432 DB8500_PIN_STATE("GPIO75_H2", in_pu,
433 "stm", "mod_mipi34"), /* uartmod rx */
434 DB8500_PIN_STATE("GPIO76_J2", out_lo,
435 "stm", "mod_mipi34"), /* uartmod tx */
436
437 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
438 "stm", "mod_mipi34_sleep"), /* clk */
439 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
440 "stm", "mod_mipi34_sleep"), /* dat3 */
441 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
442 "stm", "mod_mipi34_sleep"), /* dat2 */
443 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
444 "stm", "mod_mipi34_sleep"), /* dat1 */
445 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
446 "stm", "mod_mipi34_sleep"), /* dat0 */
447 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
448 "stm", "mod_mipi34_sleep"), /* uartmod rx */
449 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
450 "stm", "mod_mipi34_sleep"), /* uartmod tx */
451
452 DB8500_MUX_STATE("stmmod_b_1", "stmmod",
453 "stm", "mod_microsd"),
454 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
455 "stm", "mod_microsd"),
456 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
457 "stm", "mod_microsd"),
458 DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
459 "stm", "mod_microsd"), /* clk */
460 DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
461 "stm", "mod_microsd"), /* dat0 */
462 DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
463 "stm", "mod_microsd"), /* dat1 */
464 DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
465 "stm", "mod_microsd"), /* dat2 */
466 DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
467 "stm", "mod_microsd"), /* dat3 */
468 DB8500_PIN_STATE("GPIO75_H2", in_pu,
469 "stm", "mod_microsd"), /* uartmod rx */
470 DB8500_PIN_STATE("GPIO76_J2", out_lo,
471 "stm", "mod_microsd"), /* uartmod tx */
472
473 DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
474 "stm", "mod_microsd_sleep"), /* clk */
475 DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
476 "stm", "mod_microsd_sleep"), /* dat0 */
477 DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
478 "stm", "mod_microsd_sleep"), /* dat1 */
479 DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
480 "stm", "mod_microsd_sleep"), /* dat2 */
481 DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
482 "stm", "mod_microsd_sleep"), /* dat3 */
483 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
484 "stm", "mod_microsd_sleep"), /* uartmod rx */
485 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
486 "stm", "mod_microsd_sleep"), /* uartmod tx */
487
488 /* STM dual Modem/APE pins state */
489 DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
490 "stm", "mod_mipi34_ape_mipi60"),
491 DB8500_MUX_STATE("stmape_c_2", "stmape",
492 "stm", "mod_mipi34_ape_mipi60"),
493 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
494 "stm", "mod_mipi34_ape_mipi60"),
495 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
496 "stm", "mod_mipi34_ape_mipi60"),
497 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
498 "stm", "mod_mipi34_ape_mipi60"), /* clk */
499 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
500 "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
501 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
502 "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
503 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
504 "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
505 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
506 "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
507 DB8500_PIN_STATE("GPIO75_H2", in_pu,
508 "stm", "mod_mipi34_ape_mipi60"), /* uartmod rx */
509 DB8500_PIN_STATE("GPIO76_J2", out_lo,
510 "stm", "mod_mipi34_ape_mipi60"), /* uartmod tx */
511 DB8500_PIN_STATE("GPIO155_C19", in_nopull,
512 "stm", "mod_mipi34_ape_mipi60"), /* clk */
513 DB8500_PIN_STATE("GPIO156_C17", in_nopull,
514 "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
515 DB8500_PIN_STATE("GPIO157_A18", in_nopull,
516 "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
517 DB8500_PIN_STATE("GPIO158_C18", in_nopull,
518 "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
519 DB8500_PIN_STATE("GPIO159_B19", in_nopull,
520 "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
521
522 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
523 "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
524 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
525 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
526 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
527 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
528 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
529 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
530 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
531 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
532 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
533 "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod rx */
534 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
535 "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod tx */
536 DB8500_PIN_STATE("GPIO155_C19", slpm_in_wkup_pdis,
537 "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
538 DB8500_PIN_STATE("GPIO156_C17", slpm_in_wkup_pdis,
539 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
540 DB8500_PIN_STATE("GPIO157_A18", slpm_in_wkup_pdis,
541 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
542 DB8500_PIN_STATE("GPIO158_C18", slpm_in_wkup_pdis,
543 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
544 DB8500_PIN_STATE("GPIO159_B19", slpm_in_wkup_pdis,
545 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
246}; 546};
247 547
248/* 548/*
@@ -268,32 +568,48 @@ static struct pinctrl_map __initdata mop500_pinmap[] = {
268 DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu), 568 DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu),
269 /* Mux in UART1 and set the pull-ups */ 569 /* Mux in UART1 and set the pull-ups */
270 DB8500_MUX_HOG("u1rxtx_a_1", "u1"), 570 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
271 DB8500_MUX_HOG("u1ctsrts_a_1", "u1"),
272 DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */ 571 DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */
273 DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */ 572 DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */
274 DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* CTS */
275 DB8500_PIN_HOG("GPIO7_AG5", out_hi), /* RTS */
276 /* 573 /*
277 * Runtime stuff: make it possible to mux in the SKE keypad 574 * Runtime stuff: make it possible to mux in the SKE keypad
278 * and bias the pins 575 * and bias the pins
279 */ 576 */
280 DB8500_MUX("kp_a_2", "kp", "ske"), 577 /* ske default state */
281 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */ 578 DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
282 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */ 579 DB8500_PIN("GPIO153_B17", in_pu, "nmk-ske-keypad"), /* I7 */
283 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */ 580 DB8500_PIN("GPIO154_C16", in_pu, "nmk-ske-keypad"), /* I6 */
284 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */ 581 DB8500_PIN("GPIO155_C19", in_pu, "nmk-ske-keypad"), /* I5 */
285 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */ 582 DB8500_PIN("GPIO156_C17", in_pu, "nmk-ske-keypad"), /* I4 */
286 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */ 583 DB8500_PIN("GPIO161_D21", in_pu, "nmk-ske-keypad"), /* I3 */
287 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */ 584 DB8500_PIN("GPIO162_D20", in_pu, "nmk-ske-keypad"), /* I2 */
288 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */ 585 DB8500_PIN("GPIO163_C20", in_pu, "nmk-ske-keypad"), /* I1 */
289 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */ 586 DB8500_PIN("GPIO164_B21", in_pu, "nmk-ske-keypad"), /* I0 */
290 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */ 587 DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
291 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */ 588 DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
292 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */ 589 DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
293 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */ 590 DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
294 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */ 591 DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
295 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */ 592 DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
296 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */ 593 DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
594 DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
595 /* ske sleep state */
596 DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
597 DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
598 DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
599 DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
600 DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
601 DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
602 DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
603 DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
604 DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
605 DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
606 DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
607 DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
608 DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
609 DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
610 DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
611 DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
612
297 /* Mux in and drive the SDI0 DAT31DIR line high at runtime */ 613 /* Mux in and drive the SDI0 DAT31DIR line high at runtime */
298 DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"), 614 DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"),
299 DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"), 615 DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"),
@@ -396,28 +712,6 @@ static struct pinctrl_map __initdata hrefv60_pinmap[] = {
396 DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"), 712 DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
397 DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"), 713 DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"),
398 DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"), 714 DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
399 /*
400 * Make it possible to mux in the SKE keypad and bias the pins
401 * FIXME: what's the point with this on HREFv60? KP/SKE is already
402 * muxed in at another place! Enabling this will bork.
403 */
404 DB8500_MUX("kp_a_2", "kp", "ske"),
405 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */
406 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */
407 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */
408 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */
409 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */
410 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */
411 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */
412 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */
413 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */
414 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */
415 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */
416 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */
417 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */
418 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */
419 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */
420 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */
421}; 715};
422 716
423static struct pinctrl_map __initdata u9500_pinmap[] = { 717static struct pinctrl_map __initdata u9500_pinmap[] = {
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 9c8e4a9e83e..051b62c2710 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -11,9 +11,9 @@
11#include <linux/amba/mmci.h> 11#include <linux/amba/mmci.h>
12#include <linux/mmc/host.h> 12#include <linux/mmc/host.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/platform_data/dma-ste-dma40.h>
14 15
15#include <asm/mach-types.h> 16#include <asm/mach-types.h>
16#include <plat/ste_dma40.h>
17#include <mach/devices.h> 17#include <mach/devices.h>
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
diff --git a/arch/arm/mach-ux500/board-mop500-stuib.c b/arch/arm/mach-ux500/board-mop500-stuib.c
index 8c979770d87..564f57d5d8a 100644
--- a/arch/arm/mach-ux500/board-mop500-stuib.c
+++ b/arch/arm/mach-ux500/board-mop500-stuib.c
@@ -162,18 +162,6 @@ static struct bu21013_platform_device tsc_plat_device = {
162 .y_flip = true, 162 .y_flip = true,
163}; 163};
164 164
165static struct bu21013_platform_device tsc_plat2_device = {
166 .cs_en = bu21013_gpio_board_init,
167 .cs_dis = bu21013_gpio_board_exit,
168 .irq_read_val = bu21013_read_pin_val,
169 .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN),
170 .touch_x_max = TOUCH_XMAX,
171 .touch_y_max = TOUCH_YMAX,
172 .ext_clk = false,
173 .x_flip = false,
174 .y_flip = true,
175};
176
177static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = { 165static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = {
178 { 166 {
179 I2C_BOARD_INFO("bu21013_tp", 0x5C), 167 I2C_BOARD_INFO("bu21013_tp", 0x5C),
@@ -181,21 +169,17 @@ static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = {
181 }, 169 },
182 { 170 {
183 I2C_BOARD_INFO("bu21013_tp", 0x5D), 171 I2C_BOARD_INFO("bu21013_tp", 0x5D),
184 .platform_data = &tsc_plat2_device, 172 .platform_data = &tsc_plat_device,
185 }, 173 },
186 174
187}; 175};
188 176
189void __init mop500_stuib_init(void) 177void __init mop500_stuib_init(void)
190{ 178{
191 if (machine_is_hrefv60()) { 179 if (machine_is_hrefv60())
192 tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO; 180 tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
193 tsc_plat2_device.cs_pin = HREFV60_TOUCH_RST_GPIO; 181 else
194 } else {
195 tsc_plat_device.cs_pin = GPIO_BU21013_CS; 182 tsc_plat_device.cs_pin = GPIO_BU21013_CS;
196 tsc_plat2_device.cs_pin = GPIO_BU21013_CS;
197
198 }
199 183
200 mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib, 184 mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib,
201 ARRAY_SIZE(mop500_i2c0_devices_stuib)); 185 ARRAY_SIZE(mop500_i2c0_devices_stuib));
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 416d436111f..d453522edb0 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -1,6 +1,5 @@
1
2/* 1/*
3 * Copyright (C) 2008-2009 ST-Ericsson 2 * Copyright (C) 2008-2012 ST-Ericsson
4 * 3 *
5 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> 4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
6 * 5 *
@@ -16,6 +15,7 @@
16#include <linux/io.h> 15#include <linux/io.h>
17#include <linux/i2c.h> 16#include <linux/i2c.h>
18#include <linux/platform_data/i2c-nomadik.h> 17#include <linux/platform_data/i2c-nomadik.h>
18#include <linux/platform_data/db8500_thermal.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/amba/bus.h> 20#include <linux/amba/bus.h>
21#include <linux/amba/pl022.h> 21#include <linux/amba/pl022.h>
@@ -33,18 +33,15 @@
33#include <linux/smsc911x.h> 33#include <linux/smsc911x.h>
34#include <linux/gpio_keys.h> 34#include <linux/gpio_keys.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/of.h>
37#include <linux/of_platform.h>
38#include <linux/leds.h> 36#include <linux/leds.h>
39#include <linux/pinctrl/consumer.h> 37#include <linux/pinctrl/consumer.h>
38#include <linux/platform_data/pinctrl-nomadik.h>
39#include <linux/platform_data/dma-ste-dma40.h>
40 40
41#include <asm/mach-types.h> 41#include <asm/mach-types.h>
42#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
43#include <asm/hardware/gic.h> 43#include <asm/hardware/gic.h>
44 44
45#include <plat/ste_dma40.h>
46#include <plat/gpio-nomadik.h>
47
48#include <mach/hardware.h> 45#include <mach/hardware.h>
49#include <mach/setup.h> 46#include <mach/setup.h>
50#include <mach/devices.h> 47#include <mach/devices.h>
@@ -229,6 +226,67 @@ static struct ab8500_platform_data ab8500_platdata = {
229}; 226};
230 227
231/* 228/*
229 * Thermal Sensor
230 */
231
232static struct resource db8500_thsens_resources[] = {
233 {
234 .name = "IRQ_HOTMON_LOW",
235 .start = IRQ_PRCMU_HOTMON_LOW,
236 .end = IRQ_PRCMU_HOTMON_LOW,
237 .flags = IORESOURCE_IRQ,
238 },
239 {
240 .name = "IRQ_HOTMON_HIGH",
241 .start = IRQ_PRCMU_HOTMON_HIGH,
242 .end = IRQ_PRCMU_HOTMON_HIGH,
243 .flags = IORESOURCE_IRQ,
244 },
245};
246
247static struct db8500_thsens_platform_data db8500_thsens_data = {
248 .trip_points[0] = {
249 .temp = 70000,
250 .type = THERMAL_TRIP_ACTIVE,
251 .cdev_name = {
252 [0] = "thermal-cpufreq-0",
253 },
254 },
255 .trip_points[1] = {
256 .temp = 75000,
257 .type = THERMAL_TRIP_ACTIVE,
258 .cdev_name = {
259 [0] = "thermal-cpufreq-0",
260 },
261 },
262 .trip_points[2] = {
263 .temp = 80000,
264 .type = THERMAL_TRIP_ACTIVE,
265 .cdev_name = {
266 [0] = "thermal-cpufreq-0",
267 },
268 },
269 .trip_points[3] = {
270 .temp = 85000,
271 .type = THERMAL_TRIP_CRITICAL,
272 },
273 .num_trips = 4,
274};
275
276static struct platform_device u8500_thsens_device = {
277 .name = "db8500-thermal",
278 .resource = db8500_thsens_resources,
279 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
280 .dev = {
281 .platform_data = &db8500_thsens_data,
282 },
283};
284
285static struct platform_device u8500_cpufreq_cooling_device = {
286 .name = "db8500-cpufreq-cooling",
287};
288
289/*
232 * TPS61052 290 * TPS61052
233 */ 291 */
234 292
@@ -464,7 +522,7 @@ static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
464}; 522};
465#endif 523#endif
466 524
467static struct pl022_ssp_controller ssp0_plat = { 525struct pl022_ssp_controller ssp0_plat = {
468 .bus_id = 0, 526 .bus_id = 0,
469#ifdef CONFIG_STE_DMA40 527#ifdef CONFIG_STE_DMA40
470 .enable_dma = 1, 528 .enable_dma = 1,
@@ -541,7 +599,7 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
541}; 599};
542#endif 600#endif
543 601
544static struct amba_pl011_data uart0_plat = { 602struct amba_pl011_data uart0_plat = {
545#ifdef CONFIG_STE_DMA40 603#ifdef CONFIG_STE_DMA40
546 .dma_filter = stedma40_filter, 604 .dma_filter = stedma40_filter,
547 .dma_rx_param = &uart0_dma_cfg_rx, 605 .dma_rx_param = &uart0_dma_cfg_rx,
@@ -549,7 +607,7 @@ static struct amba_pl011_data uart0_plat = {
549#endif 607#endif
550}; 608};
551 609
552static struct amba_pl011_data uart1_plat = { 610struct amba_pl011_data uart1_plat = {
553#ifdef CONFIG_STE_DMA40 611#ifdef CONFIG_STE_DMA40
554 .dma_filter = stedma40_filter, 612 .dma_filter = stedma40_filter,
555 .dma_rx_param = &uart1_dma_cfg_rx, 613 .dma_rx_param = &uart1_dma_cfg_rx,
@@ -557,7 +615,7 @@ static struct amba_pl011_data uart1_plat = {
557#endif 615#endif
558}; 616};
559 617
560static struct amba_pl011_data uart2_plat = { 618struct amba_pl011_data uart2_plat = {
561#ifdef CONFIG_STE_DMA40 619#ifdef CONFIG_STE_DMA40
562 .dma_filter = stedma40_filter, 620 .dma_filter = stedma40_filter,
563 .dma_rx_param = &uart2_dma_cfg_rx, 621 .dma_rx_param = &uart2_dma_cfg_rx,
@@ -583,6 +641,8 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
583 &snowball_key_dev, 641 &snowball_key_dev,
584 &snowball_sbnet_dev, 642 &snowball_sbnet_dev,
585 &snowball_gpio_en_3v3_regulator_dev, 643 &snowball_gpio_en_3v3_regulator_dev,
644 &u8500_thsens_device,
645 &u8500_cpufreq_cooling_device,
586}; 646};
587 647
588static void __init mop500_init_machine(void) 648static void __init mop500_init_machine(void)
@@ -618,8 +678,6 @@ static void __init mop500_init_machine(void)
618 678
619 /* This board has full regulator constraints */ 679 /* This board has full regulator constraints */
620 regulator_has_full_constraints(); 680 regulator_has_full_constraints();
621
622 mop500_uib_init();
623} 681}
624 682
625static void __init snowball_init_machine(void) 683static void __init snowball_init_machine(void)
@@ -684,8 +742,6 @@ static void __init hrefv60_init_machine(void)
684 742
685 /* This board has full regulator constraints */ 743 /* This board has full regulator constraints */
686 regulator_has_full_constraints(); 744 regulator_has_full_constraints();
687
688 mop500_uib_init();
689} 745}
690 746
691MACHINE_START(U8500, "ST-Ericsson MOP500 platform") 747MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
@@ -701,155 +757,35 @@ MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
701 .init_late = ux500_init_late, 757 .init_late = ux500_init_late,
702MACHINE_END 758MACHINE_END
703 759
704MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") 760MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
705 .atag_offset = 0x100, 761 .atag_offset = 0x100,
706 .smp = smp_ops(ux500_smp_ops),
707 .map_io = u8500_map_io, 762 .map_io = u8500_map_io,
708 .init_irq = ux500_init_irq, 763 .init_irq = ux500_init_irq,
709 .timer = &ux500_timer, 764 .timer = &ux500_timer,
710 .handle_irq = gic_handle_irq, 765 .handle_irq = gic_handle_irq,
711 .init_machine = hrefv60_init_machine, 766 .init_machine = mop500_init_machine,
712 .init_late = ux500_init_late, 767 .init_late = ux500_init_late,
713MACHINE_END 768MACHINE_END
714 769
715MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") 770MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
716 .atag_offset = 0x100, 771 .atag_offset = 0x100,
717 .smp = smp_ops(ux500_smp_ops), 772 .smp = smp_ops(ux500_smp_ops),
718 .map_io = u8500_map_io, 773 .map_io = u8500_map_io,
719 .init_irq = ux500_init_irq, 774 .init_irq = ux500_init_irq,
720 /* we re-use nomadik timer here */
721 .timer = &ux500_timer, 775 .timer = &ux500_timer,
722 .handle_irq = gic_handle_irq, 776 .handle_irq = gic_handle_irq,
723 .init_machine = snowball_init_machine, 777 .init_machine = hrefv60_init_machine,
724 .init_late = ux500_init_late, 778 .init_late = ux500_init_late,
725MACHINE_END 779MACHINE_END
726 780
727#ifdef CONFIG_MACH_UX500_DT 781MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
728 782 .atag_offset = 0x100,
729struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
730 /* Requires call-back bindings. */
731 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
732 /* Requires DMA and call-back bindings. */
733 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
734 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
735 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
736 /* Requires DMA bindings. */
737 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
738 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
739 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data),
740 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data),
741 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
742 /* Requires clock name bindings. */
743 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
744 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
745 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
746 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
747 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
748 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
749 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
750 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
751 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
752 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
753 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
754 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
755 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
756 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
757 /* Requires device name bindings. */
758 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
759 /* Requires clock name and DMA bindings. */
760 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
761 "ux500-msp-i2s.0", &msp0_platform_data),
762 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
763 "ux500-msp-i2s.1", &msp1_platform_data),
764 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
765 "ux500-msp-i2s.2", &msp2_platform_data),
766 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
767 "ux500-msp-i2s.3", &msp3_platform_data),
768 {},
769};
770
771static const struct of_device_id u8500_local_bus_nodes[] = {
772 /* only create devices below soc node */
773 { .compatible = "stericsson,db8500", },
774 { .compatible = "stericsson,db8500-prcmu", },
775 { .compatible = "simple-bus"},
776 { },
777};
778
779static void __init u8500_init_machine(void)
780{
781 struct device *parent = NULL;
782 int i2c0_devs;
783 int i;
784
785 /* Pinmaps must be in place before devices register */
786 if (of_machine_is_compatible("st-ericsson,mop500"))
787 mop500_pinmaps_init();
788 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
789 snowball_pinmaps_init();
790 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
791 hrefv60_pinmaps_init();
792
793 parent = u8500_of_init_devices();
794
795 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
796 mop500_platform_devs[i]->dev.parent = parent;
797
798 /* automatically probe child nodes of db8500 device */
799 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
800
801 if (of_machine_is_compatible("st-ericsson,mop500")) {
802 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
803
804 platform_add_devices(mop500_platform_devs,
805 ARRAY_SIZE(mop500_platform_devs));
806
807 mop500_sdi_init(parent);
808 mop500_audio_init(parent);
809 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
810 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
811 i2c_register_board_info(2, mop500_i2c2_devices,
812 ARRAY_SIZE(mop500_i2c2_devices));
813
814 mop500_uib_init();
815
816 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
817 mop500_of_audio_init(parent);
818 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
819 /*
820 * The HREFv60 board removed a GPIO expander and routed
821 * all these GPIO pins to the internal GPIO controller
822 * instead.
823 */
824 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
825 platform_add_devices(mop500_platform_devs,
826 ARRAY_SIZE(mop500_platform_devs));
827
828 mop500_uib_init();
829 }
830
831 /* This board has full regulator constraints */
832 regulator_has_full_constraints();
833}
834
835static const char * u8500_dt_board_compat[] = {
836 "calaosystems,snowball-a9500",
837 "st-ericsson,hrefv60+",
838 "st-ericsson,u8500",
839 "st-ericsson,mop500",
840 NULL,
841};
842
843
844DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
845 .smp = smp_ops(ux500_smp_ops), 783 .smp = smp_ops(ux500_smp_ops),
846 .map_io = u8500_map_io, 784 .map_io = u8500_map_io,
847 .init_irq = ux500_init_irq, 785 .init_irq = ux500_init_irq,
848 /* we re-use nomadik timer here */ 786 /* we re-use nomadik timer here */
849 .timer = &ux500_timer, 787 .timer = &ux500_timer,
850 .handle_irq = gic_handle_irq, 788 .handle_irq = gic_handle_irq,
851 .init_machine = u8500_init_machine, 789 .init_machine = snowball_init_machine,
852 .init_late = ux500_init_late, 790 .init_late = NULL,
853 .dt_compat = u8500_dt_board_compat,
854MACHINE_END 791MACHINE_END
855#endif
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index aca39a68712..eaa605f5d90 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -89,6 +89,10 @@ extern struct msp_i2s_platform_data msp1_platform_data;
89extern struct msp_i2s_platform_data msp2_platform_data; 89extern struct msp_i2s_platform_data msp2_platform_data;
90extern struct msp_i2s_platform_data msp3_platform_data; 90extern struct msp_i2s_platform_data msp3_platform_data;
91extern struct arm_pmu_platdata db8500_pmu_platdata; 91extern struct arm_pmu_platdata db8500_pmu_platdata;
92extern struct amba_pl011_data uart0_plat;
93extern struct amba_pl011_data uart1_plat;
94extern struct amba_pl011_data uart2_plat;
95extern struct pl022_ssp_controller ssp0_plat;
92 96
93extern void mop500_sdi_init(struct device *parent); 97extern void mop500_sdi_init(struct device *parent);
94extern void snowball_sdi_init(struct device *parent); 98extern void snowball_sdi_init(struct device *parent);
@@ -100,14 +104,8 @@ void __init mop500_pinmaps_init(void);
100void __init snowball_pinmaps_init(void); 104void __init snowball_pinmaps_init(void);
101void __init hrefv60_pinmaps_init(void); 105void __init hrefv60_pinmaps_init(void);
102void mop500_audio_init(struct device *parent); 106void mop500_audio_init(struct device *parent);
103/* Due for removal once the MSP driver has been fully DT:ed. */
104void mop500_of_audio_init(struct device *parent);
105 107
106int __init mop500_uib_init(void); 108int __init mop500_uib_init(void);
107void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, 109void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
108 unsigned n); 110 unsigned n);
109
110/* TODO: Once all pieces are DT:ed, remove completely. */
111struct device * __init u8500_of_init_devices(void);
112
113#endif 111#endif
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index bcdfe6b1d45..db0bb75e2c7 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -17,18 +17,27 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/mfd/abx500/ab8500.h> 19#include <linux/mfd/abx500/ab8500.h>
20#include <linux/mfd/dbx500-prcmu.h>
21#include <linux/of.h>
22#include <linux/of_platform.h>
23#include <linux/regulator/machine.h>
24#include <linux/platform_data/pinctrl-nomadik.h>
25#include <linux/random.h>
20 26
21#include <asm/pmu.h> 27#include <asm/pmu.h>
22#include <asm/mach/map.h> 28#include <asm/mach/map.h>
23#include <plat/gpio-nomadik.h> 29#include <asm/mach/arch.h>
30#include <asm/hardware/gic.h>
31
24#include <mach/hardware.h> 32#include <mach/hardware.h>
25#include <mach/setup.h> 33#include <mach/setup.h>
26#include <mach/devices.h> 34#include <mach/devices.h>
27#include <linux/platform_data/usb-musb-ux500.h>
28#include <mach/db8500-regs.h> 35#include <mach/db8500-regs.h>
36#include <mach/irqs.h>
29 37
30#include "devices-db8500.h" 38#include "devices-db8500.h"
31#include "ste-dma40-db8500.h" 39#include "ste-dma40-db8500.h"
40#include "board-mop500.h"
32 41
33/* minimum static i/o mapping required to boot U8500 platforms */ 42/* minimum static i/o mapping required to boot U8500 platforms */
34static struct map_desc u8500_uart_io_desc[] __initdata = { 43static struct map_desc u8500_uart_io_desc[] __initdata = {
@@ -158,7 +167,7 @@ static void __init db8500_add_gpios(struct device *parent)
158 167
159 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base), 168 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base),
160 IRQ_DB8500_GPIO0, &pdata); 169 IRQ_DB8500_GPIO0, &pdata);
161 dbx500_add_pinctrl(parent, "pinctrl-db8500"); 170 dbx500_add_pinctrl(parent, "pinctrl-db8500", U8500_PRCMU_BASE);
162} 171}
163 172
164static int usb_db8500_rx_dma_cfg[] = { 173static int usb_db8500_rx_dma_cfg[] = {
@@ -187,6 +196,8 @@ static const char *db8500_read_soc_id(void)
187{ 196{
188 void __iomem *uid = __io_address(U8500_BB_UID_BASE); 197 void __iomem *uid = __io_address(U8500_BB_UID_BASE);
189 198
199 /* Throw these device-specific numbers into the entropy pool */
200 add_device_randomness(uid, 0x14);
190 return kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x", 201 return kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x",
191 readl((u32 *)uid+1), 202 readl((u32 *)uid+1),
192 readl((u32 *)uid+1), readl((u32 *)uid+2), 203 readl((u32 *)uid+1), readl((u32 *)uid+2),
@@ -214,9 +225,6 @@ struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500)
214 db8500_add_gpios(parent); 225 db8500_add_gpios(parent);
215 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 226 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
216 227
217 platform_device_register_data(parent,
218 "cpufreq-u8500", -1, NULL, 0);
219
220 for (i = 0; i < ARRAY_SIZE(platform_devs); i++) 228 for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
221 platform_devs[i]->dev.parent = parent; 229 platform_devs[i]->dev.parent = parent;
222 230
@@ -227,18 +235,15 @@ struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500)
227 return parent; 235 return parent;
228} 236}
229 237
238#ifdef CONFIG_MACH_UX500_DT
239
230/* TODO: Once all pieces are DT:ed, remove completely. */ 240/* TODO: Once all pieces are DT:ed, remove completely. */
231struct device * __init u8500_of_init_devices(void) 241static struct device * __init u8500_of_init_devices(void)
232{ 242{
233 struct device *parent; 243 struct device *parent = db8500_soc_device_init();
234
235 parent = db8500_soc_device_init();
236 244
237 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 245 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
238 246
239 platform_device_register_data(parent,
240 "cpufreq-u8500", -1, NULL, 0);
241
242 u8500_dma40_device.dev.parent = parent; 247 u8500_dma40_device.dev.parent = parent;
243 248
244 /* 249 /*
@@ -251,3 +256,95 @@ struct device * __init u8500_of_init_devices(void)
251 256
252 return parent; 257 return parent;
253} 258}
259
260static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
261 /* Requires call-back bindings. */
262 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
263 /* Requires DMA bindings. */
264 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
265 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
266 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
267 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
268 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
269 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data),
270 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data),
271 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
272 /* Requires clock name bindings. */
273 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
274 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
275 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
276 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
277 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
278 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
279 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
280 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
281 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
282 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
283 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
284 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
285 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
286 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
287 /* Requires device name bindings. */
288 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
289 /* Requires clock name and DMA bindings. */
290 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
291 "ux500-msp-i2s.0", &msp0_platform_data),
292 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
293 "ux500-msp-i2s.1", &msp1_platform_data),
294 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
295 "ux500-msp-i2s.2", &msp2_platform_data),
296 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
297 "ux500-msp-i2s.3", &msp3_platform_data),
298 {},
299};
300
301static const struct of_device_id u8500_local_bus_nodes[] = {
302 /* only create devices below soc node */
303 { .compatible = "stericsson,db8500", },
304 { .compatible = "stericsson,db8500-prcmu", },
305 { .compatible = "simple-bus"},
306 { },
307};
308
309static void __init u8500_init_machine(void)
310{
311 struct device *parent = NULL;
312
313 /* Pinmaps must be in place before devices register */
314 if (of_machine_is_compatible("st-ericsson,mop500"))
315 mop500_pinmaps_init();
316 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
317 snowball_pinmaps_init();
318 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
319 hrefv60_pinmaps_init();
320 else if (of_machine_is_compatible("st-ericsson,ccu9540")) {}
321 /* TODO: Add pinmaps for ccu9540 board. */
322
323 /* TODO: Export SoC, USB, cpu-freq and DMA40 */
324 parent = u8500_of_init_devices();
325
326 /* automatically probe child nodes of db8500 device */
327 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
328}
329
330static const char * stericsson_dt_platform_compat[] = {
331 "st-ericsson,u8500",
332 "st-ericsson,u8540",
333 "st-ericsson,u9500",
334 "st-ericsson,u9540",
335 NULL,
336};
337
338DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)")
339 .smp = smp_ops(ux500_smp_ops),
340 .map_io = u8500_map_io,
341 .init_irq = ux500_init_irq,
342 /* we re-use nomadik timer here */
343 .timer = &ux500_timer,
344 .handle_irq = gic_handle_irq,
345 .init_machine = u8500_init_machine,
346 .init_late = NULL,
347 .dt_compat = stericsson_dt_platform_compat,
348MACHINE_END
349
350#endif
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index 1f3fbc2bb77..721e7b4275f 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -26,6 +26,8 @@
26#include <mach/setup.h> 26#include <mach/setup.h>
27#include <mach/devices.h> 27#include <mach/devices.h>
28 28
29#include "board-mop500.h"
30
29void __iomem *_PRCMU_BASE; 31void __iomem *_PRCMU_BASE;
30 32
31/* 33/*
@@ -82,6 +84,7 @@ void __init ux500_init_irq(void)
82 84
83void __init ux500_init_late(void) 85void __init ux500_init_late(void)
84{ 86{
87 mop500_uib_init();
85} 88}
86 89
87static const char * __init ux500_get_machine(void) 90static const char * __init ux500_get_machine(void)
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index dfdd4a54668..16b5f71e697 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -11,10 +11,10 @@
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14 14#include <linux/platform_data/pinctrl-nomadik.h>
15#include <plat/gpio-nomadik.h>
16 15
17#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <mach/irqs.h>
18 18
19#include "devices-common.h" 19#include "devices-common.h"
20 20
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index 7fbf0ba336e..96fa4ac89e2 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -129,12 +129,18 @@ void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
129 int irq, struct nmk_gpio_platform_data *pdata); 129 int irq, struct nmk_gpio_platform_data *pdata);
130 130
131static inline void 131static inline void
132dbx500_add_pinctrl(struct device *parent, const char *name) 132dbx500_add_pinctrl(struct device *parent, const char *name,
133 resource_size_t base)
133{ 134{
135 struct resource res[] = {
136 DEFINE_RES_MEM(base, SZ_8K),
137 };
134 struct platform_device_info pdevinfo = { 138 struct platform_device_info pdevinfo = {
135 .parent = parent, 139 .parent = parent,
136 .name = name, 140 .name = name,
137 .id = -1, 141 .id = -1,
142 .res = res,
143 .num_res = ARRAY_SIZE(res),
138 }; 144 };
139 145
140 platform_device_register_full(&pdevinfo); 146 platform_device_register_full(&pdevinfo);
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index 91754a8a0d4..318d4902089 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -12,11 +12,11 @@
12#include <linux/gpio.h> 12#include <linux/gpio.h>
13#include <linux/amba/bus.h> 13#include <linux/amba/bus.h>
14#include <linux/amba/pl022.h> 14#include <linux/amba/pl022.h>
15 15#include <linux/platform_data/dma-ste-dma40.h>
16#include <plat/ste_dma40.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19#include <mach/setup.h> 18#include <mach/setup.h>
19#include <mach/irqs.h>
20 20
21#include "ste-dma40-db8500.h" 21#include "ste-dma40-db8500.h"
22 22
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
index 3c8010f4fb3..4b24c999265 100644
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -8,6 +8,7 @@
8#ifndef __DEVICES_DB8500_H 8#ifndef __DEVICES_DB8500_H
9#define __DEVICES_DB8500_H 9#define __DEVICES_DB8500_H
10 10
11#include <mach/irqs.h>
11#include "devices-common.h" 12#include "devices-common.h"
12 13
13struct ske_keypad_platform_data; 14struct ske_keypad_platform_data;
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index e8928548b6a..fc77b4274c8 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -46,6 +46,6 @@
46#include <mach/irqs-board-mop500.h> 46#include <mach/irqs-board-mop500.h>
47#endif 47#endif
48 48
49#define NR_IRQS IRQ_BOARD_END 49#define UX500_NR_IRQS IRQ_BOARD_END
50 50
51#endif /* ASM_ARCH_IRQS_H */ 51#endif /* ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-ux500/include/mach/msp.h b/arch/arm/mach-ux500/include/mach/msp.h
index 3cc7142eee0..9991aea3d57 100644
--- a/arch/arm/mach-ux500/include/mach/msp.h
+++ b/arch/arm/mach-ux500/include/mach/msp.h
@@ -8,7 +8,7 @@
8#ifndef __MSP_H 8#ifndef __MSP_H
9#define __MSP_H 9#define __MSP_H
10 10
11#include <plat/ste_dma40.h> 11#include <linux/platform_data/dma-ste-dma40.h>
12 12
13enum msp_i2s_id { 13enum msp_i2s_id {
14 MSP_I2S_0 = 0, 14 MSP_I2S_0 = 0,
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index 6f39731951b..875309acb02 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -9,11 +9,10 @@
9#include <linux/clksrc-dbx500-prcmu.h> 9#include <linux/clksrc-dbx500-prcmu.h>
10#include <linux/of.h> 10#include <linux/of.h>
11#include <linux/of_address.h> 11#include <linux/of_address.h>
12#include <linux/platform_data/clocksource-nomadik-mtu.h>
12 13
13#include <asm/smp_twd.h> 14#include <asm/smp_twd.h>
14 15
15#include <plat/mtu.h>
16
17#include <mach/setup.h> 16#include <mach/setup.h>
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19#include <mach/irqs.h> 18#include <mach/irqs.h>
@@ -96,7 +95,7 @@ dt_fail:
96 * 95 *
97 */ 96 */
98 97
99 nmdk_timer_init(mtu_timer_base); 98 nmdk_timer_init(mtu_timer_base, IRQ_MTU0);
100 clksrc_dbx500_prcmu_init(prcmu_timer_base); 99 clksrc_dbx500_prcmu_init(prcmu_timer_base);
101 ux500_twd_init(); 100 ux500_twd_init();
102} 101}
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
index 145482e7441..78ac65f62e8 100644
--- a/arch/arm/mach-ux500/usb.c
+++ b/arch/arm/mach-ux500/usb.c
@@ -7,10 +7,10 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/usb/musb.h> 8#include <linux/usb/musb.h>
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <linux/platform_data/usb-musb-ux500.h>
11#include <linux/platform_data/dma-ste-dma40.h>
10 12
11#include <plat/ste_dma40.h>
12#include <mach/hardware.h> 13#include <mach/hardware.h>
13#include <linux/platform_data/usb-musb-ux500.h>
14 14
15#define MUSB_DMA40_RX_CH { \ 15#define MUSB_DMA40_RX_CH { \
16 .mode = STEDMA40_MODE_LOGICAL, \ 16 .mode = STEDMA40_MODE_LOGICAL, \
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 5b5c1eeb5b5..5d592945036 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -32,6 +32,7 @@
32#include <linux/amba/mmci.h> 32#include <linux/amba/mmci.h>
33#include <linux/amba/pl022.h> 33#include <linux/amba/pl022.h>
34#include <linux/io.h> 34#include <linux/io.h>
35#include <linux/irqchip/versatile-fpga.h>
35#include <linux/gfp.h> 36#include <linux/gfp.h>
36#include <linux/clkdev.h> 37#include <linux/clkdev.h>
37#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
@@ -51,7 +52,6 @@
51#include <asm/hardware/timer-sp.h> 52#include <asm/hardware/timer-sp.h>
52 53
53#include <plat/clcd.h> 54#include <plat/clcd.h>
54#include <plat/fpga-irq.h>
55#include <plat/sched_clock.h> 55#include <plat/sched_clock.h>
56 56
57#include "core.h" 57#include "core.h"
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index c9529606620..99e63f5f99d 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -1,11 +1,12 @@
1config ARCH_VEXPRESS 1config ARCH_VEXPRESS
2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7 2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7
3 select ARCH_WANT_OPTIONAL_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_AMBA 4 select ARM_AMBA
5 select ARM_GIC 5 select ARM_GIC
6 select ARM_TIMER_SP804 6 select ARM_TIMER_SP804
7 select CLKDEV_LOOKUP 7 select CLKDEV_LOOKUP
8 select COMMON_CLK 8 select COMMON_CLK
9 select COMMON_CLK_VERSATILE
9 select CPU_V7 10 select CPU_V7
10 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
11 select HAVE_CLK 12 select HAVE_CLK
@@ -17,6 +18,7 @@ config ARCH_VEXPRESS
17 select PLAT_VERSATILE 18 select PLAT_VERSATILE
18 select PLAT_VERSATILE_CLCD 19 select PLAT_VERSATILE_CLCD
19 select REGULATOR_FIXED_VOLTAGE if REGULATOR 20 select REGULATOR_FIXED_VOLTAGE if REGULATOR
21 select VEXPRESS_CONFIG
20 help 22 help
21 This option enables support for systems using Cortex processor based 23 This option enables support for systems using Cortex processor based
22 ARM core and logic (FPGA) tiles on the Versatile Express motherboard, 24 ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
diff --git a/arch/arm/mach-vexpress/Makefile b/arch/arm/mach-vexpress/Makefile
index 42703e8b4d3..80b64971fbd 100644
--- a/arch/arm/mach-vexpress/Makefile
+++ b/arch/arm/mach-vexpress/Makefile
@@ -4,7 +4,7 @@
4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ 4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
5 -I$(srctree)/arch/arm/plat-versatile/include 5 -I$(srctree)/arch/arm/plat-versatile/include
6 6
7obj-y := v2m.o 7obj-y := v2m.o reset.o
8obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o 8obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o
9obj-$(CONFIG_SMP) += platsmp.o 9obj-$(CONFIG_SMP) += platsmp.o
10obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 10obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 4f471fa3e3c..60838ddb856 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -9,6 +9,7 @@
9#include <linux/amba/bus.h> 9#include <linux/amba/bus.h>
10#include <linux/amba/clcd.h> 10#include <linux/amba/clcd.h>
11#include <linux/clkdev.h> 11#include <linux/clkdev.h>
12#include <linux/vexpress.h>
12 13
13#include <asm/hardware/arm_timer.h> 14#include <asm/hardware/arm_timer.h>
14#include <asm/hardware/cache-l2x0.h> 15#include <asm/hardware/cache-l2x0.h>
@@ -64,19 +65,6 @@ static void __init ct_ca9x4_init_irq(void)
64 ca9x4_twd_init(); 65 ca9x4_twd_init();
65} 66}
66 67
67static void ct_ca9x4_clcd_enable(struct clcd_fb *fb)
68{
69 u32 site = v2m_get_master_site();
70
71 /*
72 * Old firmware was using the "site" component of the command
73 * to control the DVI muxer (while it should be always 0 ie. MB).
74 * Newer firmware uses the data register. Keep both for compatibility.
75 */
76 v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE(site), site);
77 v2m_cfg_write(SYS_CFG_DVIMODE | SYS_CFG_SITE(SYS_CFG_SITE_MB), 2);
78}
79
80static int ct_ca9x4_clcd_setup(struct clcd_fb *fb) 68static int ct_ca9x4_clcd_setup(struct clcd_fb *fb)
81{ 69{
82 unsigned long framesize = 1024 * 768 * 2; 70 unsigned long framesize = 1024 * 768 * 2;
@@ -93,7 +81,6 @@ static struct clcd_board ct_ca9x4_clcd_data = {
93 .caps = CLCD_CAP_5551 | CLCD_CAP_565, 81 .caps = CLCD_CAP_5551 | CLCD_CAP_565,
94 .check = clcdfb_check, 82 .check = clcdfb_check,
95 .decode = clcdfb_decode, 83 .decode = clcdfb_decode,
96 .enable = ct_ca9x4_clcd_enable,
97 .setup = ct_ca9x4_clcd_setup, 84 .setup = ct_ca9x4_clcd_setup,
98 .mmap = versatile_clcd_mmap_dma, 85 .mmap = versatile_clcd_mmap_dma,
99 .remove = versatile_clcd_remove_dma, 86 .remove = versatile_clcd_remove_dma,
@@ -111,14 +98,6 @@ static struct amba_device *ct_ca9x4_amba_devs[] __initdata = {
111 &gpio_device, 98 &gpio_device,
112}; 99};
113 100
114
115static struct v2m_osc ct_osc1 = {
116 .osc = 1,
117 .rate_min = 10000000,
118 .rate_max = 80000000,
119 .rate_default = 23750000,
120};
121
122static struct resource pmu_resources[] = { 101static struct resource pmu_resources[] = {
123 [0] = { 102 [0] = {
124 .start = IRQ_CT_CA9X4_PMU_CPU0, 103 .start = IRQ_CT_CA9X4_PMU_CPU0,
@@ -149,10 +128,18 @@ static struct platform_device pmu_device = {
149 .resource = pmu_resources, 128 .resource = pmu_resources,
150}; 129};
151 130
131static struct platform_device osc1_device = {
132 .name = "vexpress-osc",
133 .id = 1,
134 .num_resources = 1,
135 .resource = (struct resource []) {
136 VEXPRESS_RES_FUNC(0xf, 1),
137 },
138};
139
152static void __init ct_ca9x4_init(void) 140static void __init ct_ca9x4_init(void)
153{ 141{
154 int i; 142 int i;
155 struct clk *clk;
156 143
157#ifdef CONFIG_CACHE_L2X0 144#ifdef CONFIG_CACHE_L2X0
158 void __iomem *l2x0_base = ioremap(CT_CA9X4_L2CC, SZ_4K); 145 void __iomem *l2x0_base = ioremap(CT_CA9X4_L2CC, SZ_4K);
@@ -164,14 +151,14 @@ static void __init ct_ca9x4_init(void)
164 l2x0_init(l2x0_base, 0x00400000, 0xfe0fffff); 151 l2x0_init(l2x0_base, 0x00400000, 0xfe0fffff);
165#endif 152#endif
166 153
167 ct_osc1.site = v2m_get_master_site();
168 clk = v2m_osc_register("ct:osc1", &ct_osc1);
169 clk_register_clkdev(clk, NULL, "ct:clcd");
170
171 for (i = 0; i < ARRAY_SIZE(ct_ca9x4_amba_devs); i++) 154 for (i = 0; i < ARRAY_SIZE(ct_ca9x4_amba_devs); i++)
172 amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource); 155 amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);
173 156
174 platform_device_register(&pmu_device); 157 platform_device_register(&pmu_device);
158 platform_device_register(&osc1_device);
159
160 WARN_ON(clk_register_clkdev(vexpress_osc_setup(&osc1_device.dev),
161 NULL, "ct:clcd"));
175} 162}
176 163
177#ifdef CONFIG_SMP 164#ifdef CONFIG_SMP
diff --git a/arch/arm/mach-vexpress/include/mach/motherboard.h b/arch/arm/mach-vexpress/include/mach/motherboard.h
index 1e388c7bf4d..68abc8b7278 100644
--- a/arch/arm/mach-vexpress/include/mach/motherboard.h
+++ b/arch/arm/mach-vexpress/include/mach/motherboard.h
@@ -1,8 +1,6 @@
1#ifndef __MACH_MOTHERBOARD_H 1#ifndef __MACH_MOTHERBOARD_H
2#define __MACH_MOTHERBOARD_H 2#define __MACH_MOTHERBOARD_H
3 3
4#include <linux/clk-provider.h>
5
6/* 4/*
7 * Physical addresses, offset from V2M_PA_CS0-3 5 * Physical addresses, offset from V2M_PA_CS0-3
8 */ 6 */
@@ -41,31 +39,6 @@
41#define V2M_CF (V2M_PA_CS7 + 0x0001a000) 39#define V2M_CF (V2M_PA_CS7 + 0x0001a000)
42#define V2M_CLCD (V2M_PA_CS7 + 0x0001f000) 40#define V2M_CLCD (V2M_PA_CS7 + 0x0001f000)
43 41
44/*
45 * Offsets from SYSREGS base
46 */
47#define V2M_SYS_ID 0x000
48#define V2M_SYS_SW 0x004
49#define V2M_SYS_LED 0x008
50#define V2M_SYS_100HZ 0x024
51#define V2M_SYS_FLAGS 0x030
52#define V2M_SYS_FLAGSSET 0x030
53#define V2M_SYS_FLAGSCLR 0x034
54#define V2M_SYS_NVFLAGS 0x038
55#define V2M_SYS_NVFLAGSSET 0x038
56#define V2M_SYS_NVFLAGSCLR 0x03c
57#define V2M_SYS_MCI 0x048
58#define V2M_SYS_FLASH 0x03c
59#define V2M_SYS_CFGSW 0x058
60#define V2M_SYS_24MHZ 0x05c
61#define V2M_SYS_MISC 0x060
62#define V2M_SYS_DMA 0x064
63#define V2M_SYS_PROCID0 0x084
64#define V2M_SYS_PROCID1 0x088
65#define V2M_SYS_CFGDATA 0x0a0
66#define V2M_SYS_CFGCTRL 0x0a4
67#define V2M_SYS_CFGSTAT 0x0a8
68
69 42
70/* 43/*
71 * Interrupts. Those in {} are for AMBA devices 44 * Interrupts. Those in {} are for AMBA devices
@@ -91,43 +64,6 @@
91 64
92 65
93/* 66/*
94 * Configuration
95 */
96#define SYS_CFG_START (1 << 31)
97#define SYS_CFG_WRITE (1 << 30)
98#define SYS_CFG_OSC (1 << 20)
99#define SYS_CFG_VOLT (2 << 20)
100#define SYS_CFG_AMP (3 << 20)
101#define SYS_CFG_TEMP (4 << 20)
102#define SYS_CFG_RESET (5 << 20)
103#define SYS_CFG_SCC (6 << 20)
104#define SYS_CFG_MUXFPGA (7 << 20)
105#define SYS_CFG_SHUTDOWN (8 << 20)
106#define SYS_CFG_REBOOT (9 << 20)
107#define SYS_CFG_DVIMODE (11 << 20)
108#define SYS_CFG_POWER (12 << 20)
109#define SYS_CFG_SITE(n) ((n) << 16)
110#define SYS_CFG_SITE_MB 0
111#define SYS_CFG_SITE_DB1 1
112#define SYS_CFG_SITE_DB2 2
113#define SYS_CFG_STACK(n) ((n) << 12)
114
115#define SYS_CFG_ERR (1 << 1)
116#define SYS_CFG_COMPLETE (1 << 0)
117
118int v2m_cfg_write(u32 devfn, u32 data);
119int v2m_cfg_read(u32 devfn, u32 *data);
120void v2m_flags_set(u32 data);
121
122/*
123 * Miscellaneous
124 */
125#define SYS_MISC_MASTERSITE (1 << 14)
126#define SYS_PROCIDx_HBI_MASK 0xfff
127
128int v2m_get_master_site(void);
129
130/*
131 * Core tile IDs 67 * Core tile IDs
132 */ 68 */
133#define V2M_CT_ID_CA9 0x0c000191 69#define V2M_CT_ID_CA9 0x0c000191
@@ -149,21 +85,4 @@ struct ct_desc {
149 85
150extern struct ct_desc *ct_desc; 86extern struct ct_desc *ct_desc;
151 87
152/*
153 * OSC clock provider
154 */
155struct v2m_osc {
156 struct clk_hw hw;
157 u8 site; /* 0 = motherboard, 1 = site 1, 2 = site 2 */
158 u8 stack; /* board stack position */
159 u16 osc;
160 unsigned long rate_min;
161 unsigned long rate_max;
162 unsigned long rate_default;
163};
164
165#define to_v2m_osc(osc) container_of(osc, struct v2m_osc, hw)
166
167struct clk *v2m_osc_register(const char *name, struct v2m_osc *osc);
168
169#endif 88#endif
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 7db27c8c05c..c5d70de9bb4 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -13,6 +13,7 @@
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/of_fdt.h> 15#include <linux/of_fdt.h>
16#include <linux/vexpress.h>
16 17
17#include <asm/smp_scu.h> 18#include <asm/smp_scu.h>
18#include <asm/hardware/gic.h> 19#include <asm/hardware/gic.h>
@@ -193,7 +194,7 @@ static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
193 * until it receives a soft interrupt, and then the 194 * until it receives a soft interrupt, and then the
194 * secondary CPU branches to this address. 195 * secondary CPU branches to this address.
195 */ 196 */
196 v2m_flags_set(virt_to_phys(versatile_secondary_startup)); 197 vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
197} 198}
198 199
199struct smp_operations __initdata vexpress_smp_ops = { 200struct smp_operations __initdata vexpress_smp_ops = {
diff --git a/arch/arm/mach-vexpress/reset.c b/arch/arm/mach-vexpress/reset.c
new file mode 100644
index 00000000000..465923aa381
--- /dev/null
+++ b/arch/arm/mach-vexpress/reset.c
@@ -0,0 +1,141 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 */
13
14#include <linux/jiffies.h>
15#include <linux/of.h>
16#include <linux/of_device.h>
17#include <linux/platform_device.h>
18#include <linux/stat.h>
19#include <linux/vexpress.h>
20
21static void vexpress_reset_do(struct device *dev, const char *what)
22{
23 int err = -ENOENT;
24 struct vexpress_config_func *func =
25 vexpress_config_func_get_by_dev(dev);
26
27 if (func) {
28 unsigned long timeout;
29
30 err = vexpress_config_write(func, 0, 0);
31
32 timeout = jiffies + HZ;
33 while (time_before(jiffies, timeout))
34 cpu_relax();
35 }
36
37 dev_emerg(dev, "Unable to %s (%d)\n", what, err);
38}
39
40static struct device *vexpress_power_off_device;
41
42void vexpress_power_off(void)
43{
44 vexpress_reset_do(vexpress_power_off_device, "power off");
45}
46
47static struct device *vexpress_restart_device;
48
49void vexpress_restart(char str, const char *cmd)
50{
51 vexpress_reset_do(vexpress_restart_device, "restart");
52}
53
54static ssize_t vexpress_reset_active_show(struct device *dev,
55 struct device_attribute *attr, char *buf)
56{
57 return sprintf(buf, "%d\n", vexpress_restart_device == dev);
58}
59
60static ssize_t vexpress_reset_active_store(struct device *dev,
61 struct device_attribute *attr, const char *buf, size_t count)
62{
63 long value;
64 int err = kstrtol(buf, 0, &value);
65
66 if (!err && value)
67 vexpress_restart_device = dev;
68
69 return err ? err : count;
70}
71
72DEVICE_ATTR(active, S_IRUGO | S_IWUSR, vexpress_reset_active_show,
73 vexpress_reset_active_store);
74
75
76enum vexpress_reset_func { FUNC_RESET, FUNC_SHUTDOWN, FUNC_REBOOT };
77
78static struct of_device_id vexpress_reset_of_match[] = {
79 {
80 .compatible = "arm,vexpress-reset",
81 .data = (void *)FUNC_RESET,
82 }, {
83 .compatible = "arm,vexpress-shutdown",
84 .data = (void *)FUNC_SHUTDOWN
85 }, {
86 .compatible = "arm,vexpress-reboot",
87 .data = (void *)FUNC_REBOOT
88 },
89 {}
90};
91
92static int vexpress_reset_probe(struct platform_device *pdev)
93{
94 enum vexpress_reset_func func;
95 const struct of_device_id *match =
96 of_match_device(vexpress_reset_of_match, &pdev->dev);
97
98 if (match)
99 func = (enum vexpress_reset_func)match->data;
100 else
101 func = pdev->id_entry->driver_data;
102
103 switch (func) {
104 case FUNC_SHUTDOWN:
105 vexpress_power_off_device = &pdev->dev;
106 break;
107 case FUNC_RESET:
108 if (!vexpress_restart_device)
109 vexpress_restart_device = &pdev->dev;
110 device_create_file(&pdev->dev, &dev_attr_active);
111 break;
112 case FUNC_REBOOT:
113 vexpress_restart_device = &pdev->dev;
114 device_create_file(&pdev->dev, &dev_attr_active);
115 break;
116 };
117
118 return 0;
119}
120
121static const struct platform_device_id vexpress_reset_id_table[] = {
122 { .name = "vexpress-reset", .driver_data = FUNC_RESET, },
123 { .name = "vexpress-shutdown", .driver_data = FUNC_SHUTDOWN, },
124 { .name = "vexpress-reboot", .driver_data = FUNC_REBOOT, },
125 {}
126};
127
128static struct platform_driver vexpress_reset_driver = {
129 .probe = vexpress_reset_probe,
130 .driver = {
131 .name = "vexpress-reset",
132 .of_match_table = vexpress_reset_of_match,
133 },
134 .id_table = vexpress_reset_id_table,
135};
136
137static int __init vexpress_reset_init(void)
138{
139 return platform_driver_register(&vexpress_reset_driver);
140}
141device_initcall(vexpress_reset_init);
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 560e0df728f..011661a6c5c 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -16,11 +16,10 @@
16#include <linux/smsc911x.h> 16#include <linux/smsc911x.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/usb/isp1760.h> 18#include <linux/usb/isp1760.h>
19#include <linux/clkdev.h>
20#include <linux/clk-provider.h>
21#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
22#include <linux/regulator/fixed.h> 20#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22#include <linux/vexpress.h>
24 23
25#include <asm/arch_timer.h> 24#include <asm/arch_timer.h>
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -33,7 +32,6 @@
33#include <asm/hardware/cache-l2x0.h> 32#include <asm/hardware/cache-l2x0.h>
34#include <asm/hardware/gic.h> 33#include <asm/hardware/gic.h>
35#include <asm/hardware/timer-sp.h> 34#include <asm/hardware/timer-sp.h>
36#include <asm/hardware/sp810.h>
37 35
38#include <mach/ct-ca9x4.h> 36#include <mach/ct-ca9x4.h>
39#include <mach/motherboard.h> 37#include <mach/motherboard.h>
@@ -58,22 +56,6 @@ static struct map_desc v2m_io_desc[] __initdata = {
58 }, 56 },
59}; 57};
60 58
61static void __iomem *v2m_sysreg_base;
62
63static void __init v2m_sysctl_init(void __iomem *base)
64{
65 u32 scctrl;
66
67 if (WARN_ON(!base))
68 return;
69
70 /* Select 1MHz TIMCLK as the reference clock for SP804 timers */
71 scctrl = readl(base + SCCTRL);
72 scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK;
73 scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK;
74 writel(scctrl, base + SCCTRL);
75}
76
77static void __init v2m_sp804_init(void __iomem *base, unsigned int irq) 59static void __init v2m_sp804_init(void __iomem *base, unsigned int irq)
78{ 60{
79 if (WARN_ON(!base || irq == NO_IRQ)) 61 if (WARN_ON(!base || irq == NO_IRQ))
@@ -87,69 +69,6 @@ static void __init v2m_sp804_init(void __iomem *base, unsigned int irq)
87} 69}
88 70
89 71
90static DEFINE_SPINLOCK(v2m_cfg_lock);
91
92int v2m_cfg_write(u32 devfn, u32 data)
93{
94 /* Configuration interface broken? */
95 u32 val;
96
97 printk("%s: writing %08x to %08x\n", __func__, data, devfn);
98
99 devfn |= SYS_CFG_START | SYS_CFG_WRITE;
100
101 spin_lock(&v2m_cfg_lock);
102 val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT);
103 writel(val & ~SYS_CFG_COMPLETE, v2m_sysreg_base + V2M_SYS_CFGSTAT);
104
105 writel(data, v2m_sysreg_base + V2M_SYS_CFGDATA);
106 writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL);
107
108 do {
109 val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT);
110 } while (val == 0);
111 spin_unlock(&v2m_cfg_lock);
112
113 return !!(val & SYS_CFG_ERR);
114}
115
116int v2m_cfg_read(u32 devfn, u32 *data)
117{
118 u32 val;
119
120 devfn |= SYS_CFG_START;
121
122 spin_lock(&v2m_cfg_lock);
123 writel(0, v2m_sysreg_base + V2M_SYS_CFGSTAT);
124 writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL);
125
126 mb();
127
128 do {
129 cpu_relax();
130 val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT);
131 } while (val == 0);
132
133 *data = readl(v2m_sysreg_base + V2M_SYS_CFGDATA);
134 spin_unlock(&v2m_cfg_lock);
135
136 return !!(val & SYS_CFG_ERR);
137}
138
139void __init v2m_flags_set(u32 data)
140{
141 writel(~0, v2m_sysreg_base + V2M_SYS_FLAGSCLR);
142 writel(data, v2m_sysreg_base + V2M_SYS_FLAGSSET);
143}
144
145int v2m_get_master_site(void)
146{
147 u32 misc = readl(v2m_sysreg_base + V2M_SYS_MISC);
148
149 return misc & SYS_MISC_MASTERSITE ? SYS_CFG_SITE_DB2 : SYS_CFG_SITE_DB1;
150}
151
152
153static struct resource v2m_pcie_i2c_resource = { 72static struct resource v2m_pcie_i2c_resource = {
154 .start = V2M_SERIAL_BUS_PCI, 73 .start = V2M_SERIAL_BUS_PCI,
155 .end = V2M_SERIAL_BUS_PCI + SZ_4K - 1, 74 .end = V2M_SERIAL_BUS_PCI + SZ_4K - 1,
@@ -237,14 +156,8 @@ static struct platform_device v2m_usb_device = {
237 .dev.platform_data = &v2m_usb_config, 156 .dev.platform_data = &v2m_usb_config,
238}; 157};
239 158
240static void v2m_flash_set_vpp(struct platform_device *pdev, int on)
241{
242 writel(on != 0, v2m_sysreg_base + V2M_SYS_FLASH);
243}
244
245static struct physmap_flash_data v2m_flash_data = { 159static struct physmap_flash_data v2m_flash_data = {
246 .width = 4, 160 .width = 4,
247 .set_vpp = v2m_flash_set_vpp,
248}; 161};
249 162
250static struct resource v2m_flash_resources[] = { 163static struct resource v2m_flash_resources[] = {
@@ -291,14 +204,61 @@ static struct platform_device v2m_cf_device = {
291 .dev.platform_data = &v2m_pata_data, 204 .dev.platform_data = &v2m_pata_data,
292}; 205};
293 206
294static unsigned int v2m_mmci_status(struct device *dev)
295{
296 return readl(v2m_sysreg_base + V2M_SYS_MCI) & (1 << 0);
297}
298
299static struct mmci_platform_data v2m_mmci_data = { 207static struct mmci_platform_data v2m_mmci_data = {
300 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 208 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
301 .status = v2m_mmci_status, 209 .gpio_wp = VEXPRESS_GPIO_MMC_WPROT,
210 .gpio_cd = VEXPRESS_GPIO_MMC_CARDIN,
211};
212
213static struct resource v2m_sysreg_resources[] = {
214 {
215 .start = V2M_SYSREGS,
216 .end = V2M_SYSREGS + 0xfff,
217 .flags = IORESOURCE_MEM,
218 },
219};
220
221static struct platform_device v2m_sysreg_device = {
222 .name = "vexpress-sysreg",
223 .id = -1,
224 .resource = v2m_sysreg_resources,
225 .num_resources = ARRAY_SIZE(v2m_sysreg_resources),
226};
227
228static struct platform_device v2m_muxfpga_device = {
229 .name = "vexpress-muxfpga",
230 .id = 0,
231 .num_resources = 1,
232 .resource = (struct resource []) {
233 VEXPRESS_RES_FUNC(0, 7),
234 }
235};
236
237static struct platform_device v2m_shutdown_device = {
238 .name = "vexpress-shutdown",
239 .id = 0,
240 .num_resources = 1,
241 .resource = (struct resource []) {
242 VEXPRESS_RES_FUNC(0, 8),
243 }
244};
245
246static struct platform_device v2m_reboot_device = {
247 .name = "vexpress-reboot",
248 .id = 0,
249 .num_resources = 1,
250 .resource = (struct resource []) {
251 VEXPRESS_RES_FUNC(0, 9),
252 }
253};
254
255static struct platform_device v2m_dvimode_device = {
256 .name = "vexpress-dvimode",
257 .id = 0,
258 .num_resources = 1,
259 .resource = (struct resource []) {
260 VEXPRESS_RES_FUNC(0, 11),
261 }
302}; 262};
303 263
304static AMBA_APB_DEVICE(aaci, "mb:aaci", 0, V2M_AACI, IRQ_V2M_AACI, NULL); 264static AMBA_APB_DEVICE(aaci, "mb:aaci", 0, V2M_AACI, IRQ_V2M_AACI, NULL);
@@ -325,123 +285,9 @@ static struct amba_device *v2m_amba_devs[] __initdata = {
325 &rtc_device, 285 &rtc_device,
326}; 286};
327 287
328
329static unsigned long v2m_osc_recalc_rate(struct clk_hw *hw,
330 unsigned long parent_rate)
331{
332 struct v2m_osc *osc = to_v2m_osc(hw);
333
334 return !parent_rate ? osc->rate_default : parent_rate;
335}
336
337static long v2m_osc_round_rate(struct clk_hw *hw, unsigned long rate,
338 unsigned long *parent_rate)
339{
340 struct v2m_osc *osc = to_v2m_osc(hw);
341
342 if (WARN_ON(rate < osc->rate_min))
343 rate = osc->rate_min;
344
345 if (WARN_ON(rate > osc->rate_max))
346 rate = osc->rate_max;
347
348 return rate;
349}
350
351static int v2m_osc_set_rate(struct clk_hw *hw, unsigned long rate,
352 unsigned long parent_rate)
353{
354 struct v2m_osc *osc = to_v2m_osc(hw);
355
356 v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE(osc->site) |
357 SYS_CFG_STACK(osc->stack) | osc->osc, rate);
358
359 return 0;
360}
361
362static struct clk_ops v2m_osc_ops = {
363 .recalc_rate = v2m_osc_recalc_rate,
364 .round_rate = v2m_osc_round_rate,
365 .set_rate = v2m_osc_set_rate,
366};
367
368struct clk * __init v2m_osc_register(const char *name, struct v2m_osc *osc)
369{
370 struct clk_init_data init;
371
372 WARN_ON(osc->site > 2);
373 WARN_ON(osc->stack > 15);
374 WARN_ON(osc->osc > 4095);
375
376 init.name = name;
377 init.ops = &v2m_osc_ops;
378 init.flags = CLK_IS_ROOT;
379 init.num_parents = 0;
380
381 osc->hw.init = &init;
382
383 return clk_register(NULL, &osc->hw);
384}
385
386static struct v2m_osc v2m_mb_osc1 = {
387 .site = SYS_CFG_SITE_MB,
388 .osc = 1,
389 .rate_min = 23750000,
390 .rate_max = 63500000,
391 .rate_default = 23750000,
392};
393
394static const char *v2m_ref_clk_periphs[] __initconst = {
395 "mb:wdt", "1000f000.wdt", "1c0f0000.wdt", /* SP805 WDT */
396};
397
398static const char *v2m_osc1_periphs[] __initconst = {
399 "mb:clcd", "1001f000.clcd", "1c1f0000.clcd", /* PL111 CLCD */
400};
401
402static const char *v2m_osc2_periphs[] __initconst = {
403 "mb:mmci", "10005000.mmci", "1c050000.mmci", /* PL180 MMCI */
404 "mb:kmi0", "10006000.kmi", "1c060000.kmi", /* PL050 KMI0 */
405 "mb:kmi1", "10007000.kmi", "1c070000.kmi", /* PL050 KMI1 */
406 "mb:uart0", "10009000.uart", "1c090000.uart", /* PL011 UART0 */
407 "mb:uart1", "1000a000.uart", "1c0a0000.uart", /* PL011 UART1 */
408 "mb:uart2", "1000b000.uart", "1c0b0000.uart", /* PL011 UART2 */
409 "mb:uart3", "1000c000.uart", "1c0c0000.uart", /* PL011 UART3 */
410};
411
412static void __init v2m_clk_init(void)
413{
414 struct clk *clk;
415 int i;
416
417 clk = clk_register_fixed_rate(NULL, "dummy_apb_pclk", NULL,
418 CLK_IS_ROOT, 0);
419 WARN_ON(clk_register_clkdev(clk, "apb_pclk", NULL));
420
421 clk = clk_register_fixed_rate(NULL, "mb:ref_clk", NULL,
422 CLK_IS_ROOT, 32768);
423 for (i = 0; i < ARRAY_SIZE(v2m_ref_clk_periphs); i++)
424 WARN_ON(clk_register_clkdev(clk, NULL, v2m_ref_clk_periphs[i]));
425
426 clk = clk_register_fixed_rate(NULL, "mb:sp804_clk", NULL,
427 CLK_IS_ROOT, 1000000);
428 WARN_ON(clk_register_clkdev(clk, "v2m-timer0", "sp804"));
429 WARN_ON(clk_register_clkdev(clk, "v2m-timer1", "sp804"));
430
431 clk = v2m_osc_register("mb:osc1", &v2m_mb_osc1);
432 for (i = 0; i < ARRAY_SIZE(v2m_osc1_periphs); i++)
433 WARN_ON(clk_register_clkdev(clk, NULL, v2m_osc1_periphs[i]));
434
435 clk = clk_register_fixed_rate(NULL, "mb:osc2", NULL,
436 CLK_IS_ROOT, 24000000);
437 for (i = 0; i < ARRAY_SIZE(v2m_osc2_periphs); i++)
438 WARN_ON(clk_register_clkdev(clk, NULL, v2m_osc2_periphs[i]));
439}
440
441static void __init v2m_timer_init(void) 288static void __init v2m_timer_init(void)
442{ 289{
443 v2m_sysctl_init(ioremap(V2M_SYSCTL, SZ_4K)); 290 vexpress_clk_init(ioremap(V2M_SYSCTL, SZ_4K));
444 v2m_clk_init();
445 v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0); 291 v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0);
446} 292}
447 293
@@ -453,19 +299,7 @@ static void __init v2m_init_early(void)
453{ 299{
454 if (ct_desc->init_early) 300 if (ct_desc->init_early)
455 ct_desc->init_early(); 301 ct_desc->init_early();
456 versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000); 302 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
457}
458
459static void v2m_power_off(void)
460{
461 if (v2m_cfg_write(SYS_CFG_SHUTDOWN | SYS_CFG_SITE(SYS_CFG_SITE_MB), 0))
462 printk(KERN_EMERG "Unable to shutdown\n");
463}
464
465static void v2m_restart(char str, const char *cmd)
466{
467 if (v2m_cfg_write(SYS_CFG_REBOOT | SYS_CFG_SITE(SYS_CFG_SITE_MB), 0))
468 printk(KERN_EMERG "Unable to reboot\n");
469} 303}
470 304
471struct ct_desc *ct_desc; 305struct ct_desc *ct_desc;
@@ -482,7 +316,7 @@ static void __init v2m_populate_ct_desc(void)
482 u32 current_tile_id; 316 u32 current_tile_id;
483 317
484 ct_desc = NULL; 318 ct_desc = NULL;
485 current_tile_id = readl(v2m_sysreg_base + V2M_SYS_PROCID0) 319 current_tile_id = vexpress_get_procid(VEXPRESS_SITE_MASTER)
486 & V2M_CT_ID_MASK; 320 & V2M_CT_ID_MASK;
487 321
488 for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i) 322 for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i)
@@ -498,7 +332,7 @@ static void __init v2m_populate_ct_desc(void)
498static void __init v2m_map_io(void) 332static void __init v2m_map_io(void)
499{ 333{
500 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); 334 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
501 v2m_sysreg_base = ioremap(V2M_SYSREGS, SZ_4K); 335 vexpress_sysreg_early_init(ioremap(V2M_SYSREGS, SZ_4K));
502 v2m_populate_ct_desc(); 336 v2m_populate_ct_desc();
503 ct_desc->map_io(); 337 ct_desc->map_io();
504} 338}
@@ -515,6 +349,12 @@ static void __init v2m_init(void)
515 regulator_register_fixed(0, v2m_eth_supplies, 349 regulator_register_fixed(0, v2m_eth_supplies,
516 ARRAY_SIZE(v2m_eth_supplies)); 350 ARRAY_SIZE(v2m_eth_supplies));
517 351
352 platform_device_register(&v2m_muxfpga_device);
353 platform_device_register(&v2m_shutdown_device);
354 platform_device_register(&v2m_reboot_device);
355 platform_device_register(&v2m_dvimode_device);
356
357 platform_device_register(&v2m_sysreg_device);
518 platform_device_register(&v2m_pcie_i2c_device); 358 platform_device_register(&v2m_pcie_i2c_device);
519 platform_device_register(&v2m_ddc_i2c_device); 359 platform_device_register(&v2m_ddc_i2c_device);
520 platform_device_register(&v2m_flash_device); 360 platform_device_register(&v2m_flash_device);
@@ -525,7 +365,7 @@ static void __init v2m_init(void)
525 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++) 365 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
526 amba_device_register(v2m_amba_devs[i], &iomem_resource); 366 amba_device_register(v2m_amba_devs[i], &iomem_resource);
527 367
528 pm_power_off = v2m_power_off; 368 pm_power_off = vexpress_power_off;
529 369
530 ct_desc->init_tile(); 370 ct_desc->init_tile();
531} 371}
@@ -539,7 +379,7 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express")
539 .timer = &v2m_timer, 379 .timer = &v2m_timer,
540 .handle_irq = gic_handle_irq, 380 .handle_irq = gic_handle_irq,
541 .init_machine = v2m_init, 381 .init_machine = v2m_init,
542 .restart = v2m_restart, 382 .restart = vexpress_restart,
543MACHINE_END 383MACHINE_END
544 384
545static struct map_desc v2m_rs1_io_desc __initdata = { 385static struct map_desc v2m_rs1_io_desc __initdata = {
@@ -580,20 +420,13 @@ void __init v2m_dt_map_io(void)
580 420
581void __init v2m_dt_init_early(void) 421void __init v2m_dt_init_early(void)
582{ 422{
583 struct device_node *node;
584 u32 dt_hbi; 423 u32 dt_hbi;
585 424
586 node = of_find_compatible_node(NULL, NULL, "arm,vexpress-sysreg"); 425 vexpress_sysreg_of_early_init();
587 v2m_sysreg_base = of_iomap(node, 0);
588 if (WARN_ON(!v2m_sysreg_base))
589 return;
590 426
591 /* Confirm board type against DT property, if available */ 427 /* Confirm board type against DT property, if available */
592 if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) { 428 if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
593 int site = v2m_get_master_site(); 429 u32 hbi = vexpress_get_hbi(VEXPRESS_SITE_MASTER);
594 u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ?
595 V2M_SYS_PROCID1 : V2M_SYS_PROCID0));
596 u32 hbi = id & SYS_PROCIDx_HBI_MASK;
597 430
598 if (WARN_ON(dt_hbi != hbi)) 431 if (WARN_ON(dt_hbi != hbi))
599 pr_warning("vexpress: DT HBI (%x) is not matching " 432 pr_warning("vexpress: DT HBI (%x) is not matching "
@@ -613,51 +446,47 @@ static void __init v2m_dt_init_irq(void)
613 446
614static void __init v2m_dt_timer_init(void) 447static void __init v2m_dt_timer_init(void)
615{ 448{
616 struct device_node *node; 449 struct device_node *node = NULL;
617 const char *path;
618 int err;
619 450
620 node = of_find_compatible_node(NULL, NULL, "arm,sp810"); 451 vexpress_clk_of_init();
621 v2m_sysctl_init(of_iomap(node, 0));
622 452
623 v2m_clk_init(); 453 do {
454 node = of_find_compatible_node(node, NULL, "arm,sp804");
455 } while (node && vexpress_get_site_by_node(node) != VEXPRESS_SITE_MB);
456 if (node) {
457 pr_info("Using SP804 '%s' as a clock & events source\n",
458 node->full_name);
459 v2m_sp804_init(of_iomap(node, 0),
460 irq_of_parse_and_map(node, 0));
461 }
624 462
625 err = of_property_read_string(of_aliases, "arm,v2m_timer", &path);
626 if (WARN_ON(err))
627 return;
628 node = of_find_node_by_path(path);
629 v2m_sp804_init(of_iomap(node, 0), irq_of_parse_and_map(node, 0));
630 if (arch_timer_of_register() != 0) 463 if (arch_timer_of_register() != 0)
631 twd_local_timer_of_register(); 464 twd_local_timer_of_register();
632 465
633 if (arch_timer_sched_clock_init() != 0) 466 if (arch_timer_sched_clock_init() != 0)
634 versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000); 467 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
468 24000000);
635} 469}
636 470
637static struct sys_timer v2m_dt_timer = { 471static struct sys_timer v2m_dt_timer = {
638 .init = v2m_dt_timer_init, 472 .init = v2m_dt_timer_init,
639}; 473};
640 474
641static struct of_dev_auxdata v2m_dt_auxdata_lookup[] __initdata = { 475static const struct of_device_id v2m_dt_bus_match[] __initconst = {
642 OF_DEV_AUXDATA("arm,vexpress-flash", V2M_NOR0, "physmap-flash", 476 { .compatible = "simple-bus", },
643 &v2m_flash_data), 477 { .compatible = "arm,amba-bus", },
644 OF_DEV_AUXDATA("arm,primecell", V2M_MMCI, "mb:mmci", &v2m_mmci_data), 478 { .compatible = "arm,vexpress,config-bus", },
645 /* RS1 memory map */
646 OF_DEV_AUXDATA("arm,vexpress-flash", 0x08000000, "physmap-flash",
647 &v2m_flash_data),
648 OF_DEV_AUXDATA("arm,primecell", 0x1c050000, "mb:mmci", &v2m_mmci_data),
649 {} 479 {}
650}; 480};
651 481
652static void __init v2m_dt_init(void) 482static void __init v2m_dt_init(void)
653{ 483{
654 l2x0_of_init(0x00400000, 0xfe0fffff); 484 l2x0_of_init(0x00400000, 0xfe0fffff);
655 of_platform_populate(NULL, of_default_bus_match_table, 485 of_platform_populate(NULL, v2m_dt_bus_match, NULL, NULL);
656 v2m_dt_auxdata_lookup, NULL); 486 pm_power_off = vexpress_power_off;
657 pm_power_off = v2m_power_off;
658} 487}
659 488
660const static char *v2m_dt_match[] __initconst = { 489static const char * const v2m_dt_match[] __initconst = {
661 "arm,vexpress", 490 "arm,vexpress",
662 "xen,xenvm", 491 "xen,xenvm",
663 NULL, 492 NULL,
@@ -672,5 +501,5 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
672 .timer = &v2m_dt_timer, 501 .timer = &v2m_dt_timer,
673 .init_machine = v2m_dt_init, 502 .init_machine = v2m_dt_init,
674 .handle_irq = gic_handle_irq, 503 .handle_irq = gic_handle_irq,
675 .restart = v2m_restart, 504 .restart = vexpress_restart,
676MACHINE_END 505MACHINE_END
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig
new file mode 100644
index 00000000000..2ed0b7d95db
--- /dev/null
+++ b/arch/arm/mach-vt8500/Kconfig
@@ -0,0 +1,12 @@
1config ARCH_VT8500
2 bool "VIA/WonderMedia 85xx" if ARCH_MULTI_V5
3 default ARCH_VT8500_SINGLE
4 select ARCH_HAS_CPUFREQ
5 select ARCH_REQUIRE_GPIOLIB
6 select CLKDEV_LOOKUP
7 select CPU_ARM926T
8 select GENERIC_CLOCKEVENTS
9 select GENERIC_GPIO
10 select HAVE_CLK
11 help
12 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
diff --git a/arch/arm/mach-vt8500/common.h b/arch/arm/mach-vt8500/common.h
index 2b2419646e9..6f2b843115d 100644
--- a/arch/arm/mach-vt8500/common.h
+++ b/arch/arm/mach-vt8500/common.h
@@ -25,4 +25,7 @@ int __init vt8500_irq_init(struct device_node *node,
25/* defined in drivers/clk/clk-vt8500.c */ 25/* defined in drivers/clk/clk-vt8500.c */
26void __init vtwm_clk_init(void __iomem *pmc_base); 26void __init vtwm_clk_init(void __iomem *pmc_base);
27 27
28/* defined in irq.c */
29asmlinkage void vt8500_handle_irq(struct pt_regs *regs);
30
28#endif 31#endif
diff --git a/arch/arm/mach-vt8500/include/mach/entry-macro.S b/arch/arm/mach-vt8500/include/mach/entry-macro.S
deleted file mode 100644
index 367d1b55fb9..00000000000
--- a/arch/arm/mach-vt8500/include/mach/entry-macro.S
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for VIA VT8500
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 .macro get_irqnr_preamble, base, tmp
12 @ physical 0xd8140000 is virtual 0xf8140000
13 mov \base, #0xf8000000
14 orr \base, \base, #0x00140000
15 .endm
16
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18 ldr \irqnr, [\base]
19 cmp \irqnr, #63 @ may be false positive, check interrupt status
20 bne 1001f
21 ldr \irqstat, [\base, #0x84]
22 ands \irqstat, #0x80000000
23 moveq \irqnr, #0
241001:
25 .endm
26
diff --git a/arch/arm/mach-vt8500/include/mach/hardware.h b/arch/arm/mach-vt8500/include/mach/hardware.h
deleted file mode 100644
index db4163f72c3..00000000000
--- a/arch/arm/mach-vt8500/include/mach/hardware.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/* arch/arm/mach-vt8500/include/mach/hardware.h
2 *
3 * This software is licensed under the terms of the GNU General Public
4 * License version 2, as published by the Free Software Foundation, and
5 * may be copied, distributed, and modified under those terms.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
diff --git a/arch/arm/mach-vt8500/include/mach/i8042.h b/arch/arm/mach-vt8500/include/mach/i8042.h
deleted file mode 100644
index cd7143cad6f..00000000000
--- a/arch/arm/mach-vt8500/include/mach/i8042.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* arch/arm/mach-vt8500/include/mach/i8042.h
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16extern unsigned long wmt_i8042_base __initdata;
17extern int wmt_i8042_kbd_irq;
18extern int wmt_i8042_aux_irq;
diff --git a/arch/arm/mach-vt8500/include/mach/irqs.h b/arch/arm/mach-vt8500/include/mach/irqs.h
deleted file mode 100644
index a129fd1222f..00000000000
--- a/arch/arm/mach-vt8500/include/mach/irqs.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/irqs.h
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/* This value is just to make the core happy, never used otherwise */
22#define NR_IRQS 128
diff --git a/arch/arm/mach-vt8500/include/mach/restart.h b/arch/arm/mach-vt8500/include/mach/restart.h
deleted file mode 100644
index 738979518ac..00000000000
--- a/arch/arm/mach-vt8500/include/mach/restart.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* linux/arch/arm/mach-vt8500/restart.h
2 *
3 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16void vt8500_setup_restart(void);
17void vt8500_restart(char mode, const char *cmd);
diff --git a/arch/arm/mach-vt8500/irq.c b/arch/arm/mach-vt8500/irq.c
index f8f9ab9bc56..b9cf5ce9efb 100644
--- a/arch/arm/mach-vt8500/irq.c
+++ b/arch/arm/mach-vt8500/irq.c
@@ -36,7 +36,7 @@
36#include <linux/of_address.h> 36#include <linux/of_address.h>
37 37
38#include <asm/irq.h> 38#include <asm/irq.h>
39 39#include <asm/exception.h>
40 40
41#define VT8500_ICPC_IRQ 0x20 41#define VT8500_ICPC_IRQ 0x20
42#define VT8500_ICPC_FIQ 0x24 42#define VT8500_ICPC_FIQ 0x24
@@ -66,30 +66,34 @@
66#define VT8500_EDGE ( VT8500_TRIGGER_RISING \ 66#define VT8500_EDGE ( VT8500_TRIGGER_RISING \
67 | VT8500_TRIGGER_FALLING) 67 | VT8500_TRIGGER_FALLING)
68 68
69static int irq_cnt; 69/* vt8500 has 1 intc, wm8505 and wm8650 have 2 */
70#define VT8500_INTC_MAX 2
70 71
71struct vt8500_irq_priv { 72struct vt8500_irq_data {
72 void __iomem *base; 73 void __iomem *base; /* IO Memory base address */
74 struct irq_domain *domain; /* Domain for this controller */
73}; 75};
74 76
77/* Global variable for accessing io-mem addresses */
78static struct vt8500_irq_data intc[VT8500_INTC_MAX];
79static u32 active_cnt = 0;
80
75static void vt8500_irq_mask(struct irq_data *d) 81static void vt8500_irq_mask(struct irq_data *d)
76{ 82{
77 struct vt8500_irq_priv *priv = 83 struct vt8500_irq_data *priv = d->domain->host_data;
78 (struct vt8500_irq_priv *)(d->domain->host_data);
79 void __iomem *base = priv->base; 84 void __iomem *base = priv->base;
80 u8 edge; 85 void __iomem *stat_reg = base + VT8500_ICIS + (d->hwirq < 32 ? 0 : 4);
86 u8 edge, dctr;
87 u32 status;
81 88
82 edge = readb(base + VT8500_ICDC + d->hwirq) & VT8500_EDGE; 89 edge = readb(base + VT8500_ICDC + d->hwirq) & VT8500_EDGE;
83 if (edge) { 90 if (edge) {
84 void __iomem *stat_reg = base + VT8500_ICIS 91 status = readl(stat_reg);
85 + (d->hwirq < 32 ? 0 : 4);
86 unsigned status = readl(stat_reg);
87 92
88 status |= (1 << (d->hwirq & 0x1f)); 93 status |= (1 << (d->hwirq & 0x1f));
89 writel(status, stat_reg); 94 writel(status, stat_reg);
90 } else { 95 } else {
91 u8 dctr = readb(base + VT8500_ICDC + d->hwirq); 96 dctr = readb(base + VT8500_ICDC + d->hwirq);
92
93 dctr &= ~VT8500_INT_ENABLE; 97 dctr &= ~VT8500_INT_ENABLE;
94 writeb(dctr, base + VT8500_ICDC + d->hwirq); 98 writeb(dctr, base + VT8500_ICDC + d->hwirq);
95 } 99 }
@@ -97,8 +101,7 @@ static void vt8500_irq_mask(struct irq_data *d)
97 101
98static void vt8500_irq_unmask(struct irq_data *d) 102static void vt8500_irq_unmask(struct irq_data *d)
99{ 103{
100 struct vt8500_irq_priv *priv = 104 struct vt8500_irq_data *priv = d->domain->host_data;
101 (struct vt8500_irq_priv *)(d->domain->host_data);
102 void __iomem *base = priv->base; 105 void __iomem *base = priv->base;
103 u8 dctr; 106 u8 dctr;
104 107
@@ -109,8 +112,7 @@ static void vt8500_irq_unmask(struct irq_data *d)
109 112
110static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type) 113static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type)
111{ 114{
112 struct vt8500_irq_priv *priv = 115 struct vt8500_irq_data *priv = d->domain->host_data;
113 (struct vt8500_irq_priv *)(d->domain->host_data);
114 void __iomem *base = priv->base; 116 void __iomem *base = priv->base;
115 u8 dctr; 117 u8 dctr;
116 118
@@ -148,17 +150,15 @@ static struct irq_chip vt8500_irq_chip = {
148 150
149static void __init vt8500_init_irq_hw(void __iomem *base) 151static void __init vt8500_init_irq_hw(void __iomem *base)
150{ 152{
151 unsigned int i; 153 u32 i;
152 154
153 /* Enable rotating priority for IRQ */ 155 /* Enable rotating priority for IRQ */
154 writel(ICPC_ROTATE, base + VT8500_ICPC_IRQ); 156 writel(ICPC_ROTATE, base + VT8500_ICPC_IRQ);
155 writel(0x00, base + VT8500_ICPC_FIQ); 157 writel(0x00, base + VT8500_ICPC_FIQ);
156 158
157 for (i = 0; i < 64; i++) { 159 /* Disable all interrupts and route them to IRQ */
158 /* Disable all interrupts and route them to IRQ */ 160 for (i = 0; i < 64; i++)
159 writeb(VT8500_INT_DISABLE | ICDC_IRQ, 161 writeb(VT8500_INT_DISABLE | ICDC_IRQ, base + VT8500_ICDC + i);
160 base + VT8500_ICDC + i);
161 }
162} 162}
163 163
164static int vt8500_irq_map(struct irq_domain *h, unsigned int virq, 164static int vt8500_irq_map(struct irq_domain *h, unsigned int virq,
@@ -175,33 +175,67 @@ static struct irq_domain_ops vt8500_irq_domain_ops = {
175 .xlate = irq_domain_xlate_onecell, 175 .xlate = irq_domain_xlate_onecell,
176}; 176};
177 177
178asmlinkage void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs)
179{
180 u32 stat, i;
181 int irqnr, virq;
182 void __iomem *base;
183
184 /* Loop through each active controller */
185 for (i=0; i<active_cnt; i++) {
186 base = intc[i].base;
187 irqnr = readl_relaxed(base) & 0x3F;
188 /*
189 Highest Priority register default = 63, so check that this
190 is a real interrupt by checking the status register
191 */
192 if (irqnr == 63) {
193 stat = readl_relaxed(base + VT8500_ICIS + 4);
194 if (!(stat & BIT(31)))
195 continue;
196 }
197
198 virq = irq_find_mapping(intc[i].domain, irqnr);
199 handle_IRQ(virq, regs);
200 }
201}
202
178int __init vt8500_irq_init(struct device_node *node, struct device_node *parent) 203int __init vt8500_irq_init(struct device_node *node, struct device_node *parent)
179{ 204{
180 struct irq_domain *vt8500_irq_domain;
181 struct vt8500_irq_priv *priv;
182 int irq, i; 205 int irq, i;
183 struct device_node *np = node; 206 struct device_node *np = node;
184 207
185 priv = kzalloc(sizeof(struct vt8500_irq_priv), GFP_KERNEL); 208 if (active_cnt == VT8500_INTC_MAX) {
186 priv->base = of_iomap(np, 0); 209 pr_err("%s: Interrupt controllers > VT8500_INTC_MAX\n",
210 __func__);
211 goto out;
212 }
213
214 intc[active_cnt].base = of_iomap(np, 0);
215 intc[active_cnt].domain = irq_domain_add_linear(node, 64,
216 &vt8500_irq_domain_ops, &intc[active_cnt]);
187 217
188 vt8500_irq_domain = irq_domain_add_legacy(node, 64, irq_cnt, 0, 218 if (!intc[active_cnt].base) {
189 &vt8500_irq_domain_ops, priv); 219 pr_err("%s: Unable to map IO memory\n", __func__);
190 if (!vt8500_irq_domain) 220 goto out;
191 pr_err("%s: Unable to add wmt irq domain!\n", __func__); 221 }
222
223 if (!intc[active_cnt].domain) {
224 pr_err("%s: Unable to add irq domain!\n", __func__);
225 goto out;
226 }
192 227
193 irq_set_default_host(vt8500_irq_domain); 228 vt8500_init_irq_hw(intc[active_cnt].base);
194 229
195 vt8500_init_irq_hw(priv->base); 230 pr_info("vt8500-irq: Added interrupt controller\n");
196 231
197 pr_info("Added IRQ Controller @ %x [virq_base = %d]\n", 232 active_cnt++;
198 (u32)(priv->base), irq_cnt);
199 233
200 /* check if this is a slaved controller */ 234 /* check if this is a slaved controller */
201 if (of_irq_count(np) != 0) { 235 if (of_irq_count(np) != 0) {
202 /* check that we have the correct number of interrupts */ 236 /* check that we have the correct number of interrupts */
203 if (of_irq_count(np) != 8) { 237 if (of_irq_count(np) != 8) {
204 pr_err("%s: Incorrect IRQ map for slave controller\n", 238 pr_err("%s: Incorrect IRQ map for slaved controller\n",
205 __func__); 239 __func__);
206 return -EINVAL; 240 return -EINVAL;
207 } 241 }
@@ -213,9 +247,7 @@ int __init vt8500_irq_init(struct device_node *node, struct device_node *parent)
213 247
214 pr_info("vt8500-irq: Enabled slave->parent interrupts\n"); 248 pr_info("vt8500-irq: Enabled slave->parent interrupts\n");
215 } 249 }
216 250out:
217 irq_cnt += 64;
218
219 return 0; 251 return 0;
220} 252}
221 253
diff --git a/arch/arm/mach-vt8500/timer.c b/arch/arm/mach-vt8500/timer.c
index 050e1833f2d..3dd21a47881 100644
--- a/arch/arm/mach-vt8500/timer.c
+++ b/arch/arm/mach-vt8500/timer.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-vt8500/timer_dt.c 2 * arch/arm/mach-vt8500/timer.c
3 * 3 *
4 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> 4 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
5 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> 5 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 8d3871f110a..3c66d48ea08 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -31,8 +31,6 @@
31#include <linux/of_irq.h> 31#include <linux/of_irq.h>
32#include <linux/of_platform.h> 32#include <linux/of_platform.h>
33 33
34#include <mach/restart.h>
35
36#include "common.h" 34#include "common.h"
37 35
38#define LEGACY_GPIO_BASE 0xD8110000 36#define LEGACY_GPIO_BASE 0xD8110000
@@ -194,5 +192,6 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
194 .timer = &vt8500_timer, 192 .timer = &vt8500_timer,
195 .init_machine = vt8500_init, 193 .init_machine = vt8500_init,
196 .restart = vt8500_restart, 194 .restart = vt8500_restart,
195 .handle_irq = vt8500_handle_irq,
197MACHINE_END 196MACHINE_END
198 197
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
new file mode 100644
index 00000000000..adb6c0ea0e5
--- /dev/null
+++ b/arch/arm/mach-zynq/Kconfig
@@ -0,0 +1,13 @@
1config ARCH_ZYNQ
2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7
3 select ARM_AMBA
4 select ARM_GIC
5 select COMMON_CLK
6 select CPU_V7
7 select GENERIC_CLOCKEVENTS
8 select ICST
9 select MIGHT_HAVE_CACHE_L2X0
10 select USE_OF
11 select SPARSE_IRQ
12 help
13 Support for Xilinx Zynq ARM Cortex A9 Platform
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index ab5cfddc0d7..e16d4bed0f7 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -19,19 +19,21 @@
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/clk/zynq.h>
23#include <linux/of_address.h>
22#include <linux/of_irq.h> 24#include <linux/of_irq.h>
23#include <linux/of_platform.h> 25#include <linux/of_platform.h>
24#include <linux/of.h> 26#include <linux/of.h>
25 27
26#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <asm/mach/time.h>
28#include <asm/mach-types.h> 31#include <asm/mach-types.h>
29#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/pgtable.h>
30#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
31#include <asm/hardware/cache-l2x0.h> 35#include <asm/hardware/cache-l2x0.h>
32 36
33#include <mach/zynq_soc.h>
34#include <mach/clkdev.h>
35#include "common.h" 37#include "common.h"
36 38
37static struct of_device_id zynq_of_bus_ids[] __initdata = { 39static struct of_device_id zynq_of_bus_ids[] __initdata = {
@@ -45,55 +47,57 @@ static struct of_device_id zynq_of_bus_ids[] __initdata = {
45 */ 47 */
46static void __init xilinx_init_machine(void) 48static void __init xilinx_init_machine(void)
47{ 49{
48#ifdef CONFIG_CACHE_L2X0
49 /* 50 /*
50 * 64KB way size, 8-way associativity, parity disabled 51 * 64KB way size, 8-way associativity, parity disabled
51 */ 52 */
52 l2x0_init(PL310_L2CC_BASE, 0x02060000, 0xF0F0FFFF); 53 l2x0_of_init(0x02060000, 0xF0F0FFFF);
53#endif
54 54
55 of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL); 55 of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
56} 56}
57 57
58static struct of_device_id irq_match[] __initdata = {
59 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
60 { }
61};
62
58/** 63/**
59 * xilinx_irq_init() - Interrupt controller initialization for the GIC. 64 * xilinx_irq_init() - Interrupt controller initialization for the GIC.
60 */ 65 */
61static void __init xilinx_irq_init(void) 66static void __init xilinx_irq_init(void)
62{ 67{
63 gic_init(0, 29, SCU_GIC_DIST_BASE, SCU_GIC_CPU_BASE); 68 of_irq_init(irq_match);
64} 69}
65 70
66/* The minimum devices needed to be mapped before the VM system is up and 71#define SCU_PERIPH_PHYS 0xF8F00000
67 * running include the GIC, UART and Timer Counter. 72#define SCU_PERIPH_SIZE SZ_8K
68 */ 73#define SCU_PERIPH_VIRT (VMALLOC_END - SCU_PERIPH_SIZE)
74
75static struct map_desc scu_desc __initdata = {
76 .virtual = SCU_PERIPH_VIRT,
77 .pfn = __phys_to_pfn(SCU_PERIPH_PHYS),
78 .length = SCU_PERIPH_SIZE,
79 .type = MT_DEVICE,
80};
81
82static void __init xilinx_zynq_timer_init(void)
83{
84 struct device_node *np;
85 void __iomem *slcr;
86
87 np = of_find_compatible_node(NULL, NULL, "xlnx,zynq-slcr");
88 slcr = of_iomap(np, 0);
89 WARN_ON(!slcr);
90
91 xilinx_zynq_clocks_init(slcr);
69 92
70static struct map_desc io_desc[] __initdata = { 93 xttcpss_timer_init();
71 { 94}
72 .virtual = TTC0_VIRT,
73 .pfn = __phys_to_pfn(TTC0_PHYS),
74 .length = SZ_4K,
75 .type = MT_DEVICE,
76 }, {
77 .virtual = SCU_PERIPH_VIRT,
78 .pfn = __phys_to_pfn(SCU_PERIPH_PHYS),
79 .length = SZ_8K,
80 .type = MT_DEVICE,
81 }, {
82 .virtual = PL310_L2CC_VIRT,
83 .pfn = __phys_to_pfn(PL310_L2CC_PHYS),
84 .length = SZ_4K,
85 .type = MT_DEVICE,
86 },
87
88#ifdef CONFIG_DEBUG_LL
89 {
90 .virtual = UART0_VIRT,
91 .pfn = __phys_to_pfn(UART0_PHYS),
92 .length = SZ_4K,
93 .type = MT_DEVICE,
94 },
95#endif
96 95
96/*
97 * Instantiate and initialize the system timer structure
98 */
99static struct sys_timer xttcpss_sys_timer = {
100 .init = xilinx_zynq_timer_init,
97}; 101};
98 102
99/** 103/**
@@ -101,11 +105,13 @@ static struct map_desc io_desc[] __initdata = {
101 */ 105 */
102static void __init xilinx_map_io(void) 106static void __init xilinx_map_io(void)
103{ 107{
104 iotable_init(io_desc, ARRAY_SIZE(io_desc)); 108 debug_ll_io_init();
109 iotable_init(&scu_desc, 1);
105} 110}
106 111
107static const char *xilinx_dt_match[] = { 112static const char *xilinx_dt_match[] = {
108 "xlnx,zynq-ep107", 113 "xlnx,zynq-zc702",
114 "xlnx,zynq-7000",
109 NULL 115 NULL
110}; 116};
111 117
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index a009644a155..954b91c13c9 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -17,8 +17,6 @@
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
20#include <asm/mach/time.h> 20void __init xttcpss_timer_init(void);
21
22extern struct sys_timer xttcpss_sys_timer;
23 21
24#endif 22#endif
diff --git a/arch/arm/mach-zynq/include/mach/clkdev.h b/arch/arm/mach-zynq/include/mach/clkdev.h
deleted file mode 100644
index c6e73d81a45..00000000000
--- a/arch/arm/mach-zynq/include/mach/clkdev.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * arch/arm/mach-zynq/include/mach/clkdev.h
3 *
4 * Copyright (C) 2011 Xilinx, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __MACH_CLKDEV_H__
18#define __MACH_CLKDEV_H__
19
20#include <plat/clock.h>
21
22struct clk {
23 unsigned long rate;
24 const struct clk_ops *ops;
25 const struct icst_params *params;
26 void __iomem *vcoreg;
27};
28
29#define __clk_get(clk) ({ 1; })
30#define __clk_put(clk) do { } while (0)
31
32#endif
diff --git a/arch/arm/mach-zynq/include/mach/hardware.h b/arch/arm/mach-zynq/include/mach/hardware.h
deleted file mode 100644
index d558d8a94be..00000000000
--- a/arch/arm/mach-zynq/include/mach/hardware.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/hardware.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_HARDWARE_H__
16#define __MACH_HARDWARE_H__
17
18#endif
diff --git a/arch/arm/mach-zynq/include/mach/irqs.h b/arch/arm/mach-zynq/include/mach/irqs.h
deleted file mode 100644
index 5fb04fd3bac..00000000000
--- a/arch/arm/mach-zynq/include/mach/irqs.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/irqs.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_IRQS_H
16#define __MACH_IRQS_H
17
18#define ARCH_NR_GPIOS 118
19#define NR_IRQS (128 + ARCH_NR_GPIOS)
20
21#endif
diff --git a/arch/arm/mach-zynq/include/mach/timex.h b/arch/arm/mach-zynq/include/mach/timex.h
deleted file mode 100644
index 6c0245e42a5..00000000000
--- a/arch/arm/mach-zynq/include/mach/timex.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/timex.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_TIMEX_H__
16#define __MACH_TIMEX_H__
17
18/* the following is needed for the system to build but will be removed
19 in the future, the value is not important but won't hurt
20*/
21#define CLOCK_TICK_RATE (100 * HZ)
22
23#endif
diff --git a/arch/arm/mach-zynq/include/mach/uart.h b/arch/arm/mach-zynq/include/mach/uart.h
deleted file mode 100644
index 5c47c97156f..00000000000
--- a/arch/arm/mach-zynq/include/mach/uart.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/uart.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_UART_H__
16#define __MACH_UART_H__
17
18#define UART_CR_OFFSET 0x00 /* Control Register [8:0] */
19#define UART_SR_OFFSET 0x2C /* Channel Status [11:0] */
20#define UART_FIFO_OFFSET 0x30 /* FIFO [15:0] or [7:0] */
21
22#define UART_SR_TXFULL 0x00000010 /* TX FIFO full */
23#define UART_SR_TXEMPTY 0x00000008 /* TX FIFO empty */
24
25#endif
diff --git a/arch/arm/mach-zynq/include/mach/uncompress.h b/arch/arm/mach-zynq/include/mach/uncompress.h
deleted file mode 100644
index af4e8447bfa..00000000000
--- a/arch/arm/mach-zynq/include/mach/uncompress.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/uncompress.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_UNCOMPRESS_H__
16#define __MACH_UNCOMPRESS_H__
17
18#include <linux/io.h>
19#include <asm/processor.h>
20#include <mach/zynq_soc.h>
21#include <mach/uart.h>
22
23void arch_decomp_setup(void)
24{
25}
26
27static inline void flush(void)
28{
29 /*
30 * Wait while the FIFO is not empty
31 */
32 while (!(__raw_readl(IOMEM(LL_UART_PADDR + UART_SR_OFFSET)) &
33 UART_SR_TXEMPTY))
34 cpu_relax();
35}
36
37#define arch_decomp_wdog()
38
39static void putc(char ch)
40{
41 /*
42 * Wait for room in the FIFO, then write the char into the FIFO
43 */
44 while (__raw_readl(IOMEM(LL_UART_PADDR + UART_SR_OFFSET)) &
45 UART_SR_TXFULL)
46 cpu_relax();
47
48 __raw_writel(ch, IOMEM(LL_UART_PADDR + UART_FIFO_OFFSET));
49}
50
51#endif
diff --git a/arch/arm/mach-zynq/include/mach/zynq_soc.h b/arch/arm/mach-zynq/include/mach/zynq_soc.h
deleted file mode 100644
index d0d3f8fb06d..00000000000
--- a/arch/arm/mach-zynq/include/mach/zynq_soc.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/zynq_soc.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_XILINX_SOC_H__
16#define __MACH_XILINX_SOC_H__
17
18#define PERIPHERAL_CLOCK_RATE 2500000
19
20/* For now, all mappings are flat (physical = virtual)
21 */
22#define UART0_PHYS 0xE0000000
23#define UART0_VIRT UART0_PHYS
24
25#define TTC0_PHYS 0xF8001000
26#define TTC0_VIRT TTC0_PHYS
27
28#define PL310_L2CC_PHYS 0xF8F02000
29#define PL310_L2CC_VIRT PL310_L2CC_PHYS
30
31#define SCU_PERIPH_PHYS 0xF8F00000
32#define SCU_PERIPH_VIRT SCU_PERIPH_PHYS
33
34/* The following are intended for the devices that are mapped early */
35
36#define TTC0_BASE IOMEM(TTC0_VIRT)
37#define SCU_PERIPH_BASE IOMEM(SCU_PERIPH_VIRT)
38#define SCU_GIC_CPU_BASE (SCU_PERIPH_BASE + 0x100)
39#define SCU_GIC_DIST_BASE (SCU_PERIPH_BASE + 0x1000)
40#define PL310_L2CC_BASE IOMEM(PL310_L2CC_VIRT)
41
42/*
43 * Mandatory for CONFIG_LL_DEBUG, UART is mapped virtual = physical
44 */
45#define LL_UART_PADDR UART0_PHYS
46#define LL_UART_VADDR UART0_VIRT
47
48#endif
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c
index c2c96cc7d6e..de3df283da7 100644
--- a/arch/arm/mach-zynq/timer.c
+++ b/arch/arm/mach-zynq/timer.c
@@ -23,32 +23,14 @@
23#include <linux/clocksource.h> 23#include <linux/clocksource.h>
24#include <linux/clockchips.h> 24#include <linux/clockchips.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/of.h>
27#include <linux/of_address.h>
28#include <linux/of_irq.h>
29#include <linux/slab.h>
30#include <linux/clk-provider.h>
26 31
27#include <asm/mach/time.h>
28#include <mach/zynq_soc.h>
29#include "common.h" 32#include "common.h"
30 33
31#define IRQ_TIMERCOUNTER0 42
32
33/*
34 * This driver configures the 2 16-bit count-up timers as follows:
35 *
36 * T1: Timer 1, clocksource for generic timekeeping
37 * T2: Timer 2, clockevent source for hrtimers
38 * T3: Timer 3, <unused>
39 *
40 * The input frequency to the timer module for emulation is 2.5MHz which is
41 * common to all the timer channels (T1, T2, and T3). With a pre-scaler of 32,
42 * the timers are clocked at 78.125KHz (12.8 us resolution).
43 *
44 * The input frequency to the timer module in silicon will be 200MHz. With the
45 * pre-scaler of 32, the timers are clocked at 6.25MHz (160ns resolution).
46 */
47#define XTTCPSS_CLOCKSOURCE 0 /* Timer 1 as a generic timekeeping */
48#define XTTCPSS_CLOCKEVENT 1 /* Timer 2 as a clock event */
49
50#define XTTCPSS_TIMER_BASE TTC0_BASE
51#define XTTCPCC_EVENT_TIMER_IRQ (IRQ_TIMERCOUNTER0 + 1)
52/* 34/*
53 * Timer Register Offset Definitions of Timer 1, Increment base address by 4 35 * Timer Register Offset Definitions of Timer 1, Increment base address by 4
54 * and use same offsets for Timer 2 36 * and use same offsets for Timer 2
@@ -65,9 +47,14 @@
65 47
66#define XTTCPSS_CNT_CNTRL_DISABLE_MASK 0x1 48#define XTTCPSS_CNT_CNTRL_DISABLE_MASK 0x1
67 49
68/* Setup the timers to use pre-scaling */ 50/* Setup the timers to use pre-scaling, using a fixed value for now that will
69 51 * work across most input frequency, but it may need to be more dynamic
70#define TIMER_RATE (PERIPHERAL_CLOCK_RATE / 32) 52 */
53#define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */
54#define PRESCALE 2048 /* The exponent must match this */
55#define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1)
56#define CLK_CNTRL_PRESCALE_EN 1
57#define CNT_CNTRL_RESET (1<<4)
71 58
72/** 59/**
73 * struct xttcpss_timer - This definition defines local timer structure 60 * struct xttcpss_timer - This definition defines local timer structure
@@ -75,11 +62,25 @@
75 * @base_addr: Base address of timer 62 * @base_addr: Base address of timer
76 **/ 63 **/
77struct xttcpss_timer { 64struct xttcpss_timer {
78 void __iomem *base_addr; 65 void __iomem *base_addr;
79}; 66};
80 67
81static struct xttcpss_timer timers[2]; 68struct xttcpss_timer_clocksource {
82static struct clock_event_device xttcpss_clockevent; 69 struct xttcpss_timer xttc;
70 struct clocksource cs;
71};
72
73#define to_xttcpss_timer_clksrc(x) \
74 container_of(x, struct xttcpss_timer_clocksource, cs)
75
76struct xttcpss_timer_clockevent {
77 struct xttcpss_timer xttc;
78 struct clock_event_device ce;
79 struct clk *clk;
80};
81
82#define to_xttcpss_timer_clkevent(x) \
83 container_of(x, struct xttcpss_timer_clockevent, ce)
83 84
84/** 85/**
85 * xttcpss_set_interval - Set the timer interval value 86 * xttcpss_set_interval - Set the timer interval value
@@ -101,7 +102,7 @@ static void xttcpss_set_interval(struct xttcpss_timer *timer,
101 102
102 /* Reset the counter (0x10) so that it starts from 0, one-shot 103 /* Reset the counter (0x10) so that it starts from 0, one-shot
103 mode makes this needed for timing to be right. */ 104 mode makes this needed for timing to be right. */
104 ctrl_reg |= 0x10; 105 ctrl_reg |= CNT_CNTRL_RESET;
105 ctrl_reg &= ~XTTCPSS_CNT_CNTRL_DISABLE_MASK; 106 ctrl_reg &= ~XTTCPSS_CNT_CNTRL_DISABLE_MASK;
106 __raw_writel(ctrl_reg, timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET); 107 __raw_writel(ctrl_reg, timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
107} 108}
@@ -116,90 +117,31 @@ static void xttcpss_set_interval(struct xttcpss_timer *timer,
116 **/ 117 **/
117static irqreturn_t xttcpss_clock_event_interrupt(int irq, void *dev_id) 118static irqreturn_t xttcpss_clock_event_interrupt(int irq, void *dev_id)
118{ 119{
119 struct clock_event_device *evt = &xttcpss_clockevent; 120 struct xttcpss_timer_clockevent *xttce = dev_id;
120 struct xttcpss_timer *timer = dev_id; 121 struct xttcpss_timer *timer = &xttce->xttc;
121 122
122 /* Acknowledge the interrupt and call event handler */ 123 /* Acknowledge the interrupt and call event handler */
123 __raw_writel(__raw_readl(timer->base_addr + XTTCPSS_ISR_OFFSET), 124 __raw_writel(__raw_readl(timer->base_addr + XTTCPSS_ISR_OFFSET),
124 timer->base_addr + XTTCPSS_ISR_OFFSET); 125 timer->base_addr + XTTCPSS_ISR_OFFSET);
125 126
126 evt->event_handler(evt); 127 xttce->ce.event_handler(&xttce->ce);
127 128
128 return IRQ_HANDLED; 129 return IRQ_HANDLED;
129} 130}
130 131
131static struct irqaction event_timer_irq = {
132 .name = "xttcpss clockevent",
133 .flags = IRQF_DISABLED | IRQF_TIMER,
134 .handler = xttcpss_clock_event_interrupt,
135};
136
137/** 132/**
138 * xttcpss_timer_hardware_init - Initialize the timer hardware 133 * __xttc_clocksource_read - Reads the timer counter register
139 *
140 * Initialize the hardware to start the clock source, get the clock
141 * event timer ready to use, and hook up the interrupt.
142 **/
143static void __init xttcpss_timer_hardware_init(void)
144{
145 /* Setup the clock source counter to be an incrementing counter
146 * with no interrupt and it rolls over at 0xFFFF. Pre-scale
147 it by 32 also. Let it start running now.
148 */
149 timers[XTTCPSS_CLOCKSOURCE].base_addr = XTTCPSS_TIMER_BASE;
150
151 __raw_writel(0x0, timers[XTTCPSS_CLOCKSOURCE].base_addr +
152 XTTCPSS_IER_OFFSET);
153 __raw_writel(0x9, timers[XTTCPSS_CLOCKSOURCE].base_addr +
154 XTTCPSS_CLK_CNTRL_OFFSET);
155 __raw_writel(0x10, timers[XTTCPSS_CLOCKSOURCE].base_addr +
156 XTTCPSS_CNT_CNTRL_OFFSET);
157
158 /* Setup the clock event timer to be an interval timer which
159 * is prescaled by 32 using the interval interrupt. Leave it
160 * disabled for now.
161 */
162
163 timers[XTTCPSS_CLOCKEVENT].base_addr = XTTCPSS_TIMER_BASE + 4;
164
165 __raw_writel(0x23, timers[XTTCPSS_CLOCKEVENT].base_addr +
166 XTTCPSS_CNT_CNTRL_OFFSET);
167 __raw_writel(0x9, timers[XTTCPSS_CLOCKEVENT].base_addr +
168 XTTCPSS_CLK_CNTRL_OFFSET);
169 __raw_writel(0x1, timers[XTTCPSS_CLOCKEVENT].base_addr +
170 XTTCPSS_IER_OFFSET);
171
172 /* Setup IRQ the clock event timer */
173 event_timer_irq.dev_id = &timers[XTTCPSS_CLOCKEVENT];
174 setup_irq(XTTCPCC_EVENT_TIMER_IRQ, &event_timer_irq);
175}
176
177/**
178 * __raw_readl_cycles - Reads the timer counter register
179 * 134 *
180 * returns: Current timer counter register value 135 * returns: Current timer counter register value
181 **/ 136 **/
182static cycle_t __raw_readl_cycles(struct clocksource *cs) 137static cycle_t __xttc_clocksource_read(struct clocksource *cs)
183{ 138{
184 struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKSOURCE]; 139 struct xttcpss_timer *timer = &to_xttcpss_timer_clksrc(cs)->xttc;
185 140
186 return (cycle_t)__raw_readl(timer->base_addr + 141 return (cycle_t)__raw_readl(timer->base_addr +
187 XTTCPSS_COUNT_VAL_OFFSET); 142 XTTCPSS_COUNT_VAL_OFFSET);
188} 143}
189 144
190
191/*
192 * Instantiate and initialize the clock source structure
193 */
194static struct clocksource clocksource_xttcpss = {
195 .name = "xttcpss_timer1",
196 .rating = 200, /* Reasonable clock source */
197 .read = __raw_readl_cycles,
198 .mask = CLOCKSOURCE_MASK(16),
199 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
200};
201
202
203/** 145/**
204 * xttcpss_set_next_event - Sets the time interval for next event 146 * xttcpss_set_next_event - Sets the time interval for next event
205 * 147 *
@@ -211,7 +153,8 @@ static struct clocksource clocksource_xttcpss = {
211static int xttcpss_set_next_event(unsigned long cycles, 153static int xttcpss_set_next_event(unsigned long cycles,
212 struct clock_event_device *evt) 154 struct clock_event_device *evt)
213{ 155{
214 struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKEVENT]; 156 struct xttcpss_timer_clockevent *xttce = to_xttcpss_timer_clkevent(evt);
157 struct xttcpss_timer *timer = &xttce->xttc;
215 158
216 xttcpss_set_interval(timer, cycles); 159 xttcpss_set_interval(timer, cycles);
217 return 0; 160 return 0;
@@ -226,12 +169,15 @@ static int xttcpss_set_next_event(unsigned long cycles,
226static void xttcpss_set_mode(enum clock_event_mode mode, 169static void xttcpss_set_mode(enum clock_event_mode mode,
227 struct clock_event_device *evt) 170 struct clock_event_device *evt)
228{ 171{
229 struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKEVENT]; 172 struct xttcpss_timer_clockevent *xttce = to_xttcpss_timer_clkevent(evt);
173 struct xttcpss_timer *timer = &xttce->xttc;
230 u32 ctrl_reg; 174 u32 ctrl_reg;
231 175
232 switch (mode) { 176 switch (mode) {
233 case CLOCK_EVT_MODE_PERIODIC: 177 case CLOCK_EVT_MODE_PERIODIC:
234 xttcpss_set_interval(timer, TIMER_RATE / HZ); 178 xttcpss_set_interval(timer,
179 DIV_ROUND_CLOSEST(clk_get_rate(xttce->clk),
180 PRESCALE * HZ));
235 break; 181 break;
236 case CLOCK_EVT_MODE_ONESHOT: 182 case CLOCK_EVT_MODE_ONESHOT:
237 case CLOCK_EVT_MODE_UNUSED: 183 case CLOCK_EVT_MODE_UNUSED:
@@ -252,15 +198,106 @@ static void xttcpss_set_mode(enum clock_event_mode mode,
252 } 198 }
253} 199}
254 200
255/* 201static void __init zynq_ttc_setup_clocksource(struct device_node *np,
256 * Instantiate and initialize the clock event structure 202 void __iomem *base)
257 */ 203{
258static struct clock_event_device xttcpss_clockevent = { 204 struct xttcpss_timer_clocksource *ttccs;
259 .name = "xttcpss_timer2", 205 struct clk *clk;
260 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 206 int err;
261 .set_next_event = xttcpss_set_next_event, 207 u32 reg;
262 .set_mode = xttcpss_set_mode, 208
263 .rating = 200, 209 ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL);
210 if (WARN_ON(!ttccs))
211 return;
212
213 err = of_property_read_u32(np, "reg", &reg);
214 if (WARN_ON(err))
215 return;
216
217 clk = of_clk_get_by_name(np, "cpu_1x");
218 if (WARN_ON(IS_ERR(clk)))
219 return;
220
221 err = clk_prepare_enable(clk);
222 if (WARN_ON(err))
223 return;
224
225 ttccs->xttc.base_addr = base + reg * 4;
226
227 ttccs->cs.name = np->name;
228 ttccs->cs.rating = 200;
229 ttccs->cs.read = __xttc_clocksource_read;
230 ttccs->cs.mask = CLOCKSOURCE_MASK(16);
231 ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS;
232
233 __raw_writel(0x0, ttccs->xttc.base_addr + XTTCPSS_IER_OFFSET);
234 __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN,
235 ttccs->xttc.base_addr + XTTCPSS_CLK_CNTRL_OFFSET);
236 __raw_writel(CNT_CNTRL_RESET,
237 ttccs->xttc.base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
238
239 err = clocksource_register_hz(&ttccs->cs, clk_get_rate(clk) / PRESCALE);
240 if (WARN_ON(err))
241 return;
242}
243
244static void __init zynq_ttc_setup_clockevent(struct device_node *np,
245 void __iomem *base)
246{
247 struct xttcpss_timer_clockevent *ttcce;
248 int err, irq;
249 u32 reg;
250
251 ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL);
252 if (WARN_ON(!ttcce))
253 return;
254
255 err = of_property_read_u32(np, "reg", &reg);
256 if (WARN_ON(err))
257 return;
258
259 ttcce->xttc.base_addr = base + reg * 4;
260
261 ttcce->clk = of_clk_get_by_name(np, "cpu_1x");
262 if (WARN_ON(IS_ERR(ttcce->clk)))
263 return;
264
265 err = clk_prepare_enable(ttcce->clk);
266 if (WARN_ON(err))
267 return;
268
269 irq = irq_of_parse_and_map(np, 0);
270 if (WARN_ON(!irq))
271 return;
272
273 ttcce->ce.name = np->name;
274 ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
275 ttcce->ce.set_next_event = xttcpss_set_next_event;
276 ttcce->ce.set_mode = xttcpss_set_mode;
277 ttcce->ce.rating = 200;
278 ttcce->ce.irq = irq;
279
280 __raw_writel(0x23, ttcce->xttc.base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
281 __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN,
282 ttcce->xttc.base_addr + XTTCPSS_CLK_CNTRL_OFFSET);
283 __raw_writel(0x1, ttcce->xttc.base_addr + XTTCPSS_IER_OFFSET);
284
285 err = request_irq(irq, xttcpss_clock_event_interrupt, IRQF_TIMER,
286 np->name, ttcce);
287 if (WARN_ON(err))
288 return;
289
290 clockevents_config_and_register(&ttcce->ce,
291 clk_get_rate(ttcce->clk) / PRESCALE,
292 1, 0xfffe);
293}
294
295static const __initconst struct of_device_id zynq_ttc_match[] = {
296 { .compatible = "xlnx,ttc-counter-clocksource",
297 .data = zynq_ttc_setup_clocksource, },
298 { .compatible = "xlnx,ttc-counter-clockevent",
299 .data = zynq_ttc_setup_clockevent, },
300 {}
264}; 301};
265 302
266/** 303/**
@@ -269,30 +306,27 @@ static struct clock_event_device xttcpss_clockevent = {
269 * Initializes the timer hardware and register the clock source and clock event 306 * Initializes the timer hardware and register the clock source and clock event
270 * timers with Linux kernal timer framework 307 * timers with Linux kernal timer framework
271 **/ 308 **/
272static void __init xttcpss_timer_init(void) 309void __init xttcpss_timer_init(void)
273{ 310{
274 xttcpss_timer_hardware_init(); 311 struct device_node *np;
275 clocksource_register_hz(&clocksource_xttcpss, TIMER_RATE); 312
276 313 for_each_compatible_node(np, NULL, "xlnx,ttc") {
277 /* Calculate the parameters to allow the clockevent to operate using 314 struct device_node *np_chld;
278 integer math 315 void __iomem *base;
279 */ 316
280 clockevents_calc_mult_shift(&xttcpss_clockevent, TIMER_RATE, 4); 317 base = of_iomap(np, 0);
281 318 if (WARN_ON(!base))
282 xttcpss_clockevent.max_delta_ns = 319 return;
283 clockevent_delta2ns(0xfffe, &xttcpss_clockevent); 320
284 xttcpss_clockevent.min_delta_ns = 321 for_each_available_child_of_node(np, np_chld) {
285 clockevent_delta2ns(1, &xttcpss_clockevent); 322 int (*cb)(struct device_node *np, void __iomem *base);
286 323 const struct of_device_id *match;
287 /* Indicate that clock event is on 1st CPU as SMP boot needs it */ 324
288 325 match = of_match_node(zynq_ttc_match, np_chld);
289 xttcpss_clockevent.cpumask = cpumask_of(0); 326 if (match) {
290 clockevents_register_device(&xttcpss_clockevent); 327 cb = match->data;
328 cb(np_chld, base);
329 }
330 }
331 }
291} 332}
292
293/*
294 * Instantiate and initialize the system timer structure
295 */
296struct sys_timer xttcpss_sys_timer = {
297 .init = xttcpss_timer_init,
298};
diff --git a/arch/arm/mm/cache-aurora-l2.h b/arch/arm/mm/cache-aurora-l2.h
new file mode 100644
index 00000000000..c8612476983
--- /dev/null
+++ b/arch/arm/mm/cache-aurora-l2.h
@@ -0,0 +1,55 @@
1/*
2 * AURORA shared L2 cache controller support
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Yehuda Yitschak <yehuday@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
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#ifndef __ASM_ARM_HARDWARE_AURORA_L2_H
15#define __ASM_ARM_HARDWARE_AURORA_L2_H
16
17#define AURORA_SYNC_REG 0x700
18#define AURORA_RANGE_BASE_ADDR_REG 0x720
19#define AURORA_FLUSH_PHY_ADDR_REG 0x7f0
20#define AURORA_INVAL_RANGE_REG 0x774
21#define AURORA_CLEAN_RANGE_REG 0x7b4
22#define AURORA_FLUSH_RANGE_REG 0x7f4
23
24#define AURORA_ACR_REPLACEMENT_OFFSET 27
25#define AURORA_ACR_REPLACEMENT_MASK \
26 (0x3 << AURORA_ACR_REPLACEMENT_OFFSET)
27#define AURORA_ACR_REPLACEMENT_TYPE_WAYRR \
28 (0 << AURORA_ACR_REPLACEMENT_OFFSET)
29#define AURORA_ACR_REPLACEMENT_TYPE_LFSR \
30 (1 << AURORA_ACR_REPLACEMENT_OFFSET)
31#define AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU \
32 (3 << AURORA_ACR_REPLACEMENT_OFFSET)
33
34#define AURORA_ACR_FORCE_WRITE_POLICY_OFFSET 0
35#define AURORA_ACR_FORCE_WRITE_POLICY_MASK \
36 (0x3 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
37#define AURORA_ACR_FORCE_WRITE_POLICY_DIS \
38 (0 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
39#define AURORA_ACR_FORCE_WRITE_BACK_POLICY \
40 (1 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
41#define AURORA_ACR_FORCE_WRITE_THRO_POLICY \
42 (2 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
43
44#define MAX_RANGE_SIZE 1024
45
46#define AURORA_WAY_SIZE_SHIFT 2
47
48#define AURORA_CTRL_FW 0x100
49
50/* chose a number outside L2X0_CACHE_ID_PART_MASK to be sure to make
51 * the distinction between a number coming from hardware and a number
52 * coming from the device tree */
53#define AURORA_CACHE_ID 0x100
54
55#endif /* __ASM_ARM_HARDWARE_AURORA_L2_H */
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 8a97e6443c6..6911b8b2745 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-aurora-l2.h"
28 29
29#define CACHE_LINE_SIZE 32 30#define CACHE_LINE_SIZE 32
30 31
@@ -34,14 +35,20 @@ static u32 l2x0_way_mask; /* Bitmask of active ways */
34static u32 l2x0_size; 35static u32 l2x0_size;
35static unsigned long sync_reg_offset = L2X0_CACHE_SYNC; 36static unsigned long sync_reg_offset = L2X0_CACHE_SYNC;
36 37
38/* Aurora don't have the cache ID register available, so we have to
39 * pass it though the device tree */
40static u32 cache_id_part_number_from_dt;
41
37struct l2x0_regs l2x0_saved_regs; 42struct l2x0_regs l2x0_saved_regs;
38 43
39struct l2x0_of_data { 44struct l2x0_of_data {
40 void (*setup)(const struct device_node *, u32 *, u32 *); 45 void (*setup)(const struct device_node *, u32 *, u32 *);
41 void (*save)(void); 46 void (*save)(void);
42 void (*resume)(void); 47 struct outer_cache_fns outer_cache;
43}; 48};
44 49
50static bool of_init = false;
51
45static inline void cache_wait_way(void __iomem *reg, unsigned long mask) 52static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
46{ 53{
47 /* wait for cache operation by line or way to complete */ 54 /* wait for cache operation by line or way to complete */
@@ -168,7 +175,7 @@ static void l2x0_inv_all(void)
168 /* invalidate all ways */ 175 /* invalidate all ways */
169 raw_spin_lock_irqsave(&l2x0_lock, flags); 176 raw_spin_lock_irqsave(&l2x0_lock, flags);
170 /* Invalidating when L2 is enabled is a nono */ 177 /* Invalidating when L2 is enabled is a nono */
171 BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1); 178 BUG_ON(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN);
172 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); 179 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
173 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask); 180 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
174 cache_sync(); 181 cache_sync();
@@ -292,11 +299,18 @@ static void l2x0_unlock(u32 cache_id)
292 int lockregs; 299 int lockregs;
293 int i; 300 int i;
294 301
295 if (cache_id == L2X0_CACHE_ID_PART_L310) 302 switch (cache_id) {
303 case L2X0_CACHE_ID_PART_L310:
296 lockregs = 8; 304 lockregs = 8;
297 else 305 break;
306 case AURORA_CACHE_ID:
307 lockregs = 4;
308 break;
309 default:
298 /* L210 and unknown types */ 310 /* L210 and unknown types */
299 lockregs = 1; 311 lockregs = 1;
312 break;
313 }
300 314
301 for (i = 0; i < lockregs; i++) { 315 for (i = 0; i < lockregs; i++) {
302 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE + 316 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE +
@@ -312,18 +326,22 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
312 u32 cache_id; 326 u32 cache_id;
313 u32 way_size = 0; 327 u32 way_size = 0;
314 int ways; 328 int ways;
329 int way_size_shift = L2X0_WAY_SIZE_SHIFT;
315 const char *type; 330 const char *type;
316 331
317 l2x0_base = base; 332 l2x0_base = base;
318 333 if (cache_id_part_number_from_dt)
319 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID); 334 cache_id = cache_id_part_number_from_dt;
335 else
336 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID)
337 & L2X0_CACHE_ID_PART_MASK;
320 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); 338 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
321 339
322 aux &= aux_mask; 340 aux &= aux_mask;
323 aux |= aux_val; 341 aux |= aux_val;
324 342
325 /* Determine the number of ways */ 343 /* Determine the number of ways */
326 switch (cache_id & L2X0_CACHE_ID_PART_MASK) { 344 switch (cache_id) {
327 case L2X0_CACHE_ID_PART_L310: 345 case L2X0_CACHE_ID_PART_L310:
328 if (aux & (1 << 16)) 346 if (aux & (1 << 16))
329 ways = 16; 347 ways = 16;
@@ -340,6 +358,14 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
340 ways = (aux >> 13) & 0xf; 358 ways = (aux >> 13) & 0xf;
341 type = "L210"; 359 type = "L210";
342 break; 360 break;
361
362 case AURORA_CACHE_ID:
363 sync_reg_offset = AURORA_SYNC_REG;
364 ways = (aux >> 13) & 0xf;
365 ways = 2 << ((ways + 1) >> 2);
366 way_size_shift = AURORA_WAY_SIZE_SHIFT;
367 type = "Aurora";
368 break;
343 default: 369 default:
344 /* Assume unknown chips have 8 ways */ 370 /* Assume unknown chips have 8 ways */
345 ways = 8; 371 ways = 8;
@@ -353,7 +379,8 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
353 * L2 cache Size = Way size * Number of ways 379 * L2 cache Size = Way size * Number of ways
354 */ 380 */
355 way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17; 381 way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17;
356 way_size = 1 << (way_size + 3); 382 way_size = 1 << (way_size + way_size_shift);
383
357 l2x0_size = ways * way_size * SZ_1K; 384 l2x0_size = ways * way_size * SZ_1K;
358 385
359 /* 386 /*
@@ -361,7 +388,7 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
361 * If you are booting from non-secure mode 388 * If you are booting from non-secure mode
362 * accessing the below registers will fault. 389 * accessing the below registers will fault.
363 */ 390 */
364 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 391 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
365 /* Make sure that I&D is not locked down when starting */ 392 /* Make sure that I&D is not locked down when starting */
366 l2x0_unlock(cache_id); 393 l2x0_unlock(cache_id);
367 394
@@ -371,7 +398,7 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
371 l2x0_inv_all(); 398 l2x0_inv_all();
372 399
373 /* enable L2X0 */ 400 /* enable L2X0 */
374 writel_relaxed(1, l2x0_base + L2X0_CTRL); 401 writel_relaxed(L2X0_CTRL_EN, l2x0_base + L2X0_CTRL);
375 } 402 }
376 403
377 /* Re-read it in case some bits are reserved. */ 404 /* Re-read it in case some bits are reserved. */
@@ -380,13 +407,15 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
380 /* Save the value for resuming. */ 407 /* Save the value for resuming. */
381 l2x0_saved_regs.aux_ctrl = aux; 408 l2x0_saved_regs.aux_ctrl = aux;
382 409
383 outer_cache.inv_range = l2x0_inv_range; 410 if (!of_init) {
384 outer_cache.clean_range = l2x0_clean_range; 411 outer_cache.inv_range = l2x0_inv_range;
385 outer_cache.flush_range = l2x0_flush_range; 412 outer_cache.clean_range = l2x0_clean_range;
386 outer_cache.sync = l2x0_cache_sync; 413 outer_cache.flush_range = l2x0_flush_range;
387 outer_cache.flush_all = l2x0_flush_all; 414 outer_cache.sync = l2x0_cache_sync;
388 outer_cache.inv_all = l2x0_inv_all; 415 outer_cache.flush_all = l2x0_flush_all;
389 outer_cache.disable = l2x0_disable; 416 outer_cache.inv_all = l2x0_inv_all;
417 outer_cache.disable = l2x0_disable;
418 }
390 419
391 printk(KERN_INFO "%s cache controller enabled\n", type); 420 printk(KERN_INFO "%s cache controller enabled\n", type);
392 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 421 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
@@ -394,6 +423,100 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
394} 423}
395 424
396#ifdef CONFIG_OF 425#ifdef CONFIG_OF
426static int l2_wt_override;
427
428/*
429 * Note that the end addresses passed to Linux primitives are
430 * noninclusive, while the hardware cache range operations use
431 * inclusive start and end addresses.
432 */
433static unsigned long calc_range_end(unsigned long start, unsigned long end)
434{
435 /*
436 * Limit the number of cache lines processed at once,
437 * since cache range operations stall the CPU pipeline
438 * until completion.
439 */
440 if (end > start + MAX_RANGE_SIZE)
441 end = start + MAX_RANGE_SIZE;
442
443 /*
444 * Cache range operations can't straddle a page boundary.
445 */
446 if (end > PAGE_ALIGN(start+1))
447 end = PAGE_ALIGN(start+1);
448
449 return end;
450}
451
452/*
453 * Make sure 'start' and 'end' reference the same page, as L2 is PIPT
454 * and range operations only do a TLB lookup on the start address.
455 */
456static void aurora_pa_range(unsigned long start, unsigned long end,
457 unsigned long offset)
458{
459 unsigned long flags;
460
461 raw_spin_lock_irqsave(&l2x0_lock, flags);
462 writel(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG);
463 writel(end, l2x0_base + offset);
464 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
465
466 cache_sync();
467}
468
469static void aurora_inv_range(unsigned long start, unsigned long end)
470{
471 /*
472 * round start and end adresses up to cache line size
473 */
474 start &= ~(CACHE_LINE_SIZE - 1);
475 end = ALIGN(end, CACHE_LINE_SIZE);
476
477 /*
478 * Invalidate all full cache lines between 'start' and 'end'.
479 */
480 while (start < end) {
481 unsigned long range_end = calc_range_end(start, end);
482 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
483 AURORA_INVAL_RANGE_REG);
484 start = range_end;
485 }
486}
487
488static void aurora_clean_range(unsigned long start, unsigned long end)
489{
490 /*
491 * If L2 is forced to WT, the L2 will always be clean and we
492 * don't need to do anything here.
493 */
494 if (!l2_wt_override) {
495 start &= ~(CACHE_LINE_SIZE - 1);
496 end = ALIGN(end, CACHE_LINE_SIZE);
497 while (start != end) {
498 unsigned long range_end = calc_range_end(start, end);
499 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
500 AURORA_CLEAN_RANGE_REG);
501 start = range_end;
502 }
503 }
504}
505
506static void aurora_flush_range(unsigned long start, unsigned long end)
507{
508 if (!l2_wt_override) {
509 start &= ~(CACHE_LINE_SIZE - 1);
510 end = ALIGN(end, CACHE_LINE_SIZE);
511 while (start != end) {
512 unsigned long range_end = calc_range_end(start, end);
513 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
514 AURORA_FLUSH_RANGE_REG);
515 start = range_end;
516 }
517 }
518}
519
397static void __init l2x0_of_setup(const struct device_node *np, 520static void __init l2x0_of_setup(const struct device_node *np,
398 u32 *aux_val, u32 *aux_mask) 521 u32 *aux_val, u32 *aux_mask)
399{ 522{
@@ -491,9 +614,15 @@ static void __init pl310_save(void)
491 } 614 }
492} 615}
493 616
617static void aurora_save(void)
618{
619 l2x0_saved_regs.ctrl = readl_relaxed(l2x0_base + L2X0_CTRL);
620 l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
621}
622
494static void l2x0_resume(void) 623static void l2x0_resume(void)
495{ 624{
496 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 625 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
497 /* restore aux ctrl and enable l2 */ 626 /* restore aux ctrl and enable l2 */
498 l2x0_unlock(readl_relaxed(l2x0_base + L2X0_CACHE_ID)); 627 l2x0_unlock(readl_relaxed(l2x0_base + L2X0_CACHE_ID));
499 628
@@ -502,7 +631,7 @@ static void l2x0_resume(void)
502 631
503 l2x0_inv_all(); 632 l2x0_inv_all();
504 633
505 writel_relaxed(1, l2x0_base + L2X0_CTRL); 634 writel_relaxed(L2X0_CTRL_EN, l2x0_base + L2X0_CTRL);
506 } 635 }
507} 636}
508 637
@@ -510,7 +639,7 @@ static void pl310_resume(void)
510{ 639{
511 u32 l2x0_revision; 640 u32 l2x0_revision;
512 641
513 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 642 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
514 /* restore pl310 setup */ 643 /* restore pl310 setup */
515 writel_relaxed(l2x0_saved_regs.tag_latency, 644 writel_relaxed(l2x0_saved_regs.tag_latency,
516 l2x0_base + L2X0_TAG_LATENCY_CTRL); 645 l2x0_base + L2X0_TAG_LATENCY_CTRL);
@@ -536,22 +665,108 @@ static void pl310_resume(void)
536 l2x0_resume(); 665 l2x0_resume();
537} 666}
538 667
668static void aurora_resume(void)
669{
670 if (!(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
671 writel(l2x0_saved_regs.aux_ctrl, l2x0_base + L2X0_AUX_CTRL);
672 writel(l2x0_saved_regs.ctrl, l2x0_base + L2X0_CTRL);
673 }
674}
675
676static void __init aurora_broadcast_l2_commands(void)
677{
678 __u32 u;
679 /* Enable Broadcasting of cache commands to L2*/
680 __asm__ __volatile__("mrc p15, 1, %0, c15, c2, 0" : "=r"(u));
681 u |= AURORA_CTRL_FW; /* Set the FW bit */
682 __asm__ __volatile__("mcr p15, 1, %0, c15, c2, 0\n" : : "r"(u));
683 isb();
684}
685
686static void __init aurora_of_setup(const struct device_node *np,
687 u32 *aux_val, u32 *aux_mask)
688{
689 u32 val = AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU;
690 u32 mask = AURORA_ACR_REPLACEMENT_MASK;
691
692 of_property_read_u32(np, "cache-id-part",
693 &cache_id_part_number_from_dt);
694
695 /* Determine and save the write policy */
696 l2_wt_override = of_property_read_bool(np, "wt-override");
697
698 if (l2_wt_override) {
699 val |= AURORA_ACR_FORCE_WRITE_THRO_POLICY;
700 mask |= AURORA_ACR_FORCE_WRITE_POLICY_MASK;
701 }
702
703 *aux_val &= ~mask;
704 *aux_val |= val;
705 *aux_mask &= ~mask;
706}
707
539static const struct l2x0_of_data pl310_data = { 708static const struct l2x0_of_data pl310_data = {
540 pl310_of_setup, 709 .setup = pl310_of_setup,
541 pl310_save, 710 .save = pl310_save,
542 pl310_resume, 711 .outer_cache = {
712 .resume = pl310_resume,
713 .inv_range = l2x0_inv_range,
714 .clean_range = l2x0_clean_range,
715 .flush_range = l2x0_flush_range,
716 .sync = l2x0_cache_sync,
717 .flush_all = l2x0_flush_all,
718 .inv_all = l2x0_inv_all,
719 .disable = l2x0_disable,
720 .set_debug = pl310_set_debug,
721 },
543}; 722};
544 723
545static const struct l2x0_of_data l2x0_data = { 724static const struct l2x0_of_data l2x0_data = {
546 l2x0_of_setup, 725 .setup = l2x0_of_setup,
547 NULL, 726 .save = NULL,
548 l2x0_resume, 727 .outer_cache = {
728 .resume = l2x0_resume,
729 .inv_range = l2x0_inv_range,
730 .clean_range = l2x0_clean_range,
731 .flush_range = l2x0_flush_range,
732 .sync = l2x0_cache_sync,
733 .flush_all = l2x0_flush_all,
734 .inv_all = l2x0_inv_all,
735 .disable = l2x0_disable,
736 },
737};
738
739static const struct l2x0_of_data aurora_with_outer_data = {
740 .setup = aurora_of_setup,
741 .save = aurora_save,
742 .outer_cache = {
743 .resume = aurora_resume,
744 .inv_range = aurora_inv_range,
745 .clean_range = aurora_clean_range,
746 .flush_range = aurora_flush_range,
747 .sync = l2x0_cache_sync,
748 .flush_all = l2x0_flush_all,
749 .inv_all = l2x0_inv_all,
750 .disable = l2x0_disable,
751 },
752};
753
754static const struct l2x0_of_data aurora_no_outer_data = {
755 .setup = aurora_of_setup,
756 .save = aurora_save,
757 .outer_cache = {
758 .resume = aurora_resume,
759 },
549}; 760};
550 761
551static const struct of_device_id l2x0_ids[] __initconst = { 762static const struct of_device_id l2x0_ids[] __initconst = {
552 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data }, 763 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
553 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data }, 764 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
554 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data }, 765 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
766 { .compatible = "marvell,aurora-system-cache",
767 .data = (void *)&aurora_no_outer_data},
768 { .compatible = "marvell,aurora-outer-cache",
769 .data = (void *)&aurora_with_outer_data},
555 {} 770 {}
556}; 771};
557 772
@@ -577,17 +792,24 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
577 data = of_match_node(l2x0_ids, np)->data; 792 data = of_match_node(l2x0_ids, np)->data;
578 793
579 /* L2 configuration can only be changed if the cache is disabled */ 794 /* L2 configuration can only be changed if the cache is disabled */
580 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 795 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
581 if (data->setup) 796 if (data->setup)
582 data->setup(np, &aux_val, &aux_mask); 797 data->setup(np, &aux_val, &aux_mask);
798
799 /* For aurora cache in no outer mode select the
800 * correct mode using the coprocessor*/
801 if (data == &aurora_no_outer_data)
802 aurora_broadcast_l2_commands();
583 } 803 }
584 804
585 if (data->save) 805 if (data->save)
586 data->save(); 806 data->save();
587 807
808 of_init = true;
588 l2x0_init(l2x0_base, aux_val, aux_mask); 809 l2x0_init(l2x0_base, aux_val, aux_mask);
589 810
590 outer_cache.resume = data->resume; 811 memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache));
812
591 return 0; 813 return 0;
592} 814}
593#endif 815#endif
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index 4e07eec1270..bc4a5e9ebb7 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -2,6 +2,9 @@
2 * linux/arch/arm/mm/context.c 2 * linux/arch/arm/mm/context.c
3 * 3 *
4 * Copyright (C) 2002-2003 Deep Blue Solutions Ltd, all rights reserved. 4 * Copyright (C) 2002-2003 Deep Blue Solutions Ltd, all rights reserved.
5 * Copyright (C) 2012 ARM Limited
6 *
7 * Author: Will Deacon <will.deacon@arm.com>
5 * 8 *
6 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -14,14 +17,40 @@
14#include <linux/percpu.h> 17#include <linux/percpu.h>
15 18
16#include <asm/mmu_context.h> 19#include <asm/mmu_context.h>
20#include <asm/smp_plat.h>
17#include <asm/thread_notify.h> 21#include <asm/thread_notify.h>
18#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
19 23
24/*
25 * On ARMv6, we have the following structure in the Context ID:
26 *
27 * 31 7 0
28 * +-------------------------+-----------+
29 * | process ID | ASID |
30 * +-------------------------+-----------+
31 * | context ID |
32 * +-------------------------------------+
33 *
34 * The ASID is used to tag entries in the CPU caches and TLBs.
35 * The context ID is used by debuggers and trace logic, and
36 * should be unique within all running processes.
37 */
38#define ASID_FIRST_VERSION (1ULL << ASID_BITS)
39#define NUM_USER_ASIDS (ASID_FIRST_VERSION - 1)
40
41#define ASID_TO_IDX(asid) ((asid & ~ASID_MASK) - 1)
42#define IDX_TO_ASID(idx) ((idx + 1) & ~ASID_MASK)
43
20static DEFINE_RAW_SPINLOCK(cpu_asid_lock); 44static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
21unsigned int cpu_last_asid = ASID_FIRST_VERSION; 45static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
46static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
47
48static DEFINE_PER_CPU(atomic64_t, active_asids);
49static DEFINE_PER_CPU(u64, reserved_asids);
50static cpumask_t tlb_flush_pending;
22 51
23#ifdef CONFIG_ARM_LPAE 52#ifdef CONFIG_ARM_LPAE
24void cpu_set_reserved_ttbr0(void) 53static void cpu_set_reserved_ttbr0(void)
25{ 54{
26 unsigned long ttbl = __pa(swapper_pg_dir); 55 unsigned long ttbl = __pa(swapper_pg_dir);
27 unsigned long ttbh = 0; 56 unsigned long ttbh = 0;
@@ -37,7 +66,7 @@ void cpu_set_reserved_ttbr0(void)
37 isb(); 66 isb();
38} 67}
39#else 68#else
40void cpu_set_reserved_ttbr0(void) 69static void cpu_set_reserved_ttbr0(void)
41{ 70{
42 u32 ttb; 71 u32 ttb;
43 /* Copy TTBR1 into TTBR0 */ 72 /* Copy TTBR1 into TTBR0 */
@@ -84,124 +113,104 @@ static int __init contextidr_notifier_init(void)
84arch_initcall(contextidr_notifier_init); 113arch_initcall(contextidr_notifier_init);
85#endif 114#endif
86 115
87/* 116static void flush_context(unsigned int cpu)
88 * We fork()ed a process, and we need a new context for the child
89 * to run in.
90 */
91void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
92{ 117{
93 mm->context.id = 0; 118 int i;
94 raw_spin_lock_init(&mm->context.id_lock); 119 u64 asid;
95} 120
121 /* Update the list of reserved ASIDs and the ASID bitmap. */
122 bitmap_clear(asid_map, 0, NUM_USER_ASIDS);
123 for_each_possible_cpu(i) {
124 if (i == cpu) {
125 asid = 0;
126 } else {
127 asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
128 __set_bit(ASID_TO_IDX(asid), asid_map);
129 }
130 per_cpu(reserved_asids, i) = asid;
131 }
96 132
97static void flush_context(void) 133 /* Queue a TLB invalidate and flush the I-cache if necessary. */
98{ 134 if (!tlb_ops_need_broadcast())
99 cpu_set_reserved_ttbr0(); 135 cpumask_set_cpu(cpu, &tlb_flush_pending);
100 local_flush_tlb_all(); 136 else
101 if (icache_is_vivt_asid_tagged()) { 137 cpumask_setall(&tlb_flush_pending);
138
139 if (icache_is_vivt_asid_tagged())
102 __flush_icache_all(); 140 __flush_icache_all();
103 dsb();
104 }
105} 141}
106 142
107#ifdef CONFIG_SMP 143static int is_reserved_asid(u64 asid)
144{
145 int cpu;
146 for_each_possible_cpu(cpu)
147 if (per_cpu(reserved_asids, cpu) == asid)
148 return 1;
149 return 0;
150}
108 151
109static void set_mm_context(struct mm_struct *mm, unsigned int asid) 152static void new_context(struct mm_struct *mm, unsigned int cpu)
110{ 153{
111 unsigned long flags; 154 u64 asid = mm->context.id;
155 u64 generation = atomic64_read(&asid_generation);
112 156
113 /* 157 if (asid != 0 && is_reserved_asid(asid)) {
114 * Locking needed for multi-threaded applications where the
115 * same mm->context.id could be set from different CPUs during
116 * the broadcast. This function is also called via IPI so the
117 * mm->context.id_lock has to be IRQ-safe.
118 */
119 raw_spin_lock_irqsave(&mm->context.id_lock, flags);
120 if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) {
121 /* 158 /*
122 * Old version of ASID found. Set the new one and 159 * Our current ASID was active during a rollover, we can
123 * reset mm_cpumask(mm). 160 * continue to use it and this was just a false alarm.
124 */ 161 */
125 mm->context.id = asid; 162 asid = generation | (asid & ~ASID_MASK);
163 } else {
164 /*
165 * Allocate a free ASID. If we can't find one, take a
166 * note of the currently active ASIDs and mark the TLBs
167 * as requiring flushes.
168 */
169 asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS);
170 if (asid == NUM_USER_ASIDS) {
171 generation = atomic64_add_return(ASID_FIRST_VERSION,
172 &asid_generation);
173 flush_context(cpu);
174 asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS);
175 }
176 __set_bit(asid, asid_map);
177 asid = generation | IDX_TO_ASID(asid);
126 cpumask_clear(mm_cpumask(mm)); 178 cpumask_clear(mm_cpumask(mm));
127 } 179 }
128 raw_spin_unlock_irqrestore(&mm->context.id_lock, flags);
129 180
130 /* 181 mm->context.id = asid;
131 * Set the mm_cpumask(mm) bit for the current CPU.
132 */
133 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
134} 182}
135 183
136/* 184void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
137 * Reset the ASID on the current CPU. This function call is broadcast
138 * from the CPU handling the ASID rollover and holding cpu_asid_lock.
139 */
140static void reset_context(void *info)
141{ 185{
142 unsigned int asid; 186 unsigned long flags;
143 unsigned int cpu = smp_processor_id(); 187 unsigned int cpu = smp_processor_id();
144 struct mm_struct *mm = current->active_mm;
145 188
146 smp_rmb(); 189 if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))
147 asid = cpu_last_asid + cpu + 1; 190 __check_vmalloc_seq(mm);
148 191
149 flush_context(); 192 /*
150 set_mm_context(mm, asid); 193 * Required during context switch to avoid speculative page table
151 194 * walking with the wrong TTBR.
152 /* set the new ASID */ 195 */
153 cpu_switch_mm(mm->pgd, mm); 196 cpu_set_reserved_ttbr0();
154}
155 197
156#else 198 if (!((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS)
199 && atomic64_xchg(&per_cpu(active_asids, cpu), mm->context.id))
200 goto switch_mm_fastpath;
157 201
158static inline void set_mm_context(struct mm_struct *mm, unsigned int asid) 202 raw_spin_lock_irqsave(&cpu_asid_lock, flags);
159{ 203 /* Check that our ASID belongs to the current generation. */
160 mm->context.id = asid; 204 if ((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS)
161 cpumask_copy(mm_cpumask(mm), cpumask_of(smp_processor_id())); 205 new_context(mm, cpu);
162}
163 206
164#endif 207 atomic64_set(&per_cpu(active_asids, cpu), mm->context.id);
208 cpumask_set_cpu(cpu, mm_cpumask(mm));
165 209
166void __new_context(struct mm_struct *mm) 210 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending))
167{ 211 local_flush_tlb_all();
168 unsigned int asid; 212 raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
169 213
170 raw_spin_lock(&cpu_asid_lock); 214switch_mm_fastpath:
171#ifdef CONFIG_SMP 215 cpu_switch_mm(mm->pgd, mm);
172 /*
173 * Check the ASID again, in case the change was broadcast from
174 * another CPU before we acquired the lock.
175 */
176 if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) {
177 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
178 raw_spin_unlock(&cpu_asid_lock);
179 return;
180 }
181#endif
182 /*
183 * At this point, it is guaranteed that the current mm (with
184 * an old ASID) isn't active on any other CPU since the ASIDs
185 * are changed simultaneously via IPI.
186 */
187 asid = ++cpu_last_asid;
188 if (asid == 0)
189 asid = cpu_last_asid = ASID_FIRST_VERSION;
190
191 /*
192 * If we've used up all our ASIDs, we need
193 * to start a new version and flush the TLB.
194 */
195 if (unlikely((asid & ~ASID_MASK) == 0)) {
196 asid = cpu_last_asid + smp_processor_id() + 1;
197 flush_context();
198#ifdef CONFIG_SMP
199 smp_wmb();
200 smp_call_function(reset_context, NULL, 1);
201#endif
202 cpu_last_asid += NR_CPUS;
203 }
204
205 set_mm_context(mm, asid);
206 raw_spin_unlock(&cpu_asid_lock);
207} 216}
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index ab88ed4f8e0..99db769307e 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -92,6 +92,9 @@ static int __init init_static_idmap(void)
92 (long long)idmap_start, (long long)idmap_end); 92 (long long)idmap_start, (long long)idmap_end);
93 identity_mapping_add(idmap_pgd, idmap_start, idmap_end); 93 identity_mapping_add(idmap_pgd, idmap_start, idmap_end);
94 94
95 /* Flush L1 for the hardware to see this page table content */
96 flush_cache_louis();
97
95 return 0; 98 return 0;
96} 99}
97early_initcall(init_static_idmap); 100early_initcall(init_static_idmap);
@@ -103,12 +106,15 @@ early_initcall(init_static_idmap);
103 */ 106 */
104void setup_mm_for_reboot(void) 107void setup_mm_for_reboot(void)
105{ 108{
106 /* Clean and invalidate L1. */
107 flush_cache_all();
108
109 /* Switch to the identity mapping. */ 109 /* Switch to the identity mapping. */
110 cpu_switch_mm(idmap_pgd, &init_mm); 110 cpu_switch_mm(idmap_pgd, &init_mm);
111 111
112 /* Flush the TLB. */ 112#ifdef CONFIG_CPU_HAS_ASID
113 /*
114 * We don't have a clean ASID for the identity mapping, which
115 * may clash with virtual addresses of the previous page tables
116 * and therefore potentially in the TLB.
117 */
113 local_flush_tlb_all(); 118 local_flush_tlb_all();
119#endif
114} 120}
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 5dcc2fd46c4..88fd86cf3d9 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -47,18 +47,18 @@ int ioremap_page(unsigned long virt, unsigned long phys,
47} 47}
48EXPORT_SYMBOL(ioremap_page); 48EXPORT_SYMBOL(ioremap_page);
49 49
50void __check_kvm_seq(struct mm_struct *mm) 50void __check_vmalloc_seq(struct mm_struct *mm)
51{ 51{
52 unsigned int seq; 52 unsigned int seq;
53 53
54 do { 54 do {
55 seq = init_mm.context.kvm_seq; 55 seq = init_mm.context.vmalloc_seq;
56 memcpy(pgd_offset(mm, VMALLOC_START), 56 memcpy(pgd_offset(mm, VMALLOC_START),
57 pgd_offset_k(VMALLOC_START), 57 pgd_offset_k(VMALLOC_START),
58 sizeof(pgd_t) * (pgd_index(VMALLOC_END) - 58 sizeof(pgd_t) * (pgd_index(VMALLOC_END) -
59 pgd_index(VMALLOC_START))); 59 pgd_index(VMALLOC_START)));
60 mm->context.kvm_seq = seq; 60 mm->context.vmalloc_seq = seq;
61 } while (seq != init_mm.context.kvm_seq); 61 } while (seq != init_mm.context.vmalloc_seq);
62} 62}
63 63
64#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE) 64#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE)
@@ -89,13 +89,13 @@ static void unmap_area_sections(unsigned long virt, unsigned long size)
89 if (!pmd_none(pmd)) { 89 if (!pmd_none(pmd)) {
90 /* 90 /*
91 * Clear the PMD from the page table, and 91 * Clear the PMD from the page table, and
92 * increment the kvm sequence so others 92 * increment the vmalloc sequence so others
93 * notice this change. 93 * notice this change.
94 * 94 *
95 * Note: this is still racy on SMP machines. 95 * Note: this is still racy on SMP machines.
96 */ 96 */
97 pmd_clear(pmdp); 97 pmd_clear(pmdp);
98 init_mm.context.kvm_seq++; 98 init_mm.context.vmalloc_seq++;
99 99
100 /* 100 /*
101 * Free the page table, if there was one. 101 * Free the page table, if there was one.
@@ -112,8 +112,8 @@ static void unmap_area_sections(unsigned long virt, unsigned long size)
112 * Ensure that the active_mm is up to date - we want to 112 * Ensure that the active_mm is up to date - we want to
113 * catch any use-after-iounmap cases. 113 * catch any use-after-iounmap cases.
114 */ 114 */
115 if (current->active_mm->context.kvm_seq != init_mm.context.kvm_seq) 115 if (current->active_mm->context.vmalloc_seq != init_mm.context.vmalloc_seq)
116 __check_kvm_seq(current->active_mm); 116 __check_vmalloc_seq(current->active_mm);
117 117
118 flush_tlb_kernel_range(virt, end); 118 flush_tlb_kernel_range(virt, end);
119} 119}
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index ce8cb1970d7..10062ceadd1 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -11,18 +11,6 @@
11#include <linux/random.h> 11#include <linux/random.h>
12#include <asm/cachetype.h> 12#include <asm/cachetype.h>
13 13
14static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
15 unsigned long pgoff)
16{
17 unsigned long base = addr & ~(SHMLBA-1);
18 unsigned long off = (pgoff << PAGE_SHIFT) & (SHMLBA-1);
19
20 if (base + off <= addr)
21 return base + off;
22
23 return base - off;
24}
25
26#define COLOUR_ALIGN(addr,pgoff) \ 14#define COLOUR_ALIGN(addr,pgoff) \
27 ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \ 15 ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \
28 (((pgoff)<<PAGE_SHIFT) & (SHMLBA-1))) 16 (((pgoff)<<PAGE_SHIFT) & (SHMLBA-1)))
@@ -69,9 +57,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
69{ 57{
70 struct mm_struct *mm = current->mm; 58 struct mm_struct *mm = current->mm;
71 struct vm_area_struct *vma; 59 struct vm_area_struct *vma;
72 unsigned long start_addr;
73 int do_align = 0; 60 int do_align = 0;
74 int aliasing = cache_is_vipt_aliasing(); 61 int aliasing = cache_is_vipt_aliasing();
62 struct vm_unmapped_area_info info;
75 63
76 /* 64 /*
77 * We only need to do colour alignment if either the I or D 65 * We only need to do colour alignment if either the I or D
@@ -104,46 +92,14 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
104 (!vma || addr + len <= vma->vm_start)) 92 (!vma || addr + len <= vma->vm_start))
105 return addr; 93 return addr;
106 } 94 }
107 if (len > mm->cached_hole_size) {
108 start_addr = addr = mm->free_area_cache;
109 } else {
110 start_addr = addr = mm->mmap_base;
111 mm->cached_hole_size = 0;
112 }
113 95
114full_search: 96 info.flags = 0;
115 if (do_align) 97 info.length = len;
116 addr = COLOUR_ALIGN(addr, pgoff); 98 info.low_limit = mm->mmap_base;
117 else 99 info.high_limit = TASK_SIZE;
118 addr = PAGE_ALIGN(addr); 100 info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
119 101 info.align_offset = pgoff << PAGE_SHIFT;
120 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) { 102 return vm_unmapped_area(&info);
121 /* At this point: (!vma || addr < vma->vm_end). */
122 if (TASK_SIZE - len < addr) {
123 /*
124 * Start a new search - just in case we missed
125 * some holes.
126 */
127 if (start_addr != TASK_UNMAPPED_BASE) {
128 start_addr = addr = TASK_UNMAPPED_BASE;
129 mm->cached_hole_size = 0;
130 goto full_search;
131 }
132 return -ENOMEM;
133 }
134 if (!vma || addr + len <= vma->vm_start) {
135 /*
136 * Remember the place where we stopped the search:
137 */
138 mm->free_area_cache = addr + len;
139 return addr;
140 }
141 if (addr + mm->cached_hole_size < vma->vm_start)
142 mm->cached_hole_size = vma->vm_start - addr;
143 addr = vma->vm_end;
144 if (do_align)
145 addr = COLOUR_ALIGN(addr, pgoff);
146 }
147} 103}
148 104
149unsigned long 105unsigned long
@@ -156,6 +112,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
156 unsigned long addr = addr0; 112 unsigned long addr = addr0;
157 int do_align = 0; 113 int do_align = 0;
158 int aliasing = cache_is_vipt_aliasing(); 114 int aliasing = cache_is_vipt_aliasing();
115 struct vm_unmapped_area_info info;
159 116
160 /* 117 /*
161 * We only need to do colour alignment if either the I or D 118 * We only need to do colour alignment if either the I or D
@@ -187,70 +144,27 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
187 return addr; 144 return addr;
188 } 145 }
189 146
190 /* check if free_area_cache is useful for us */ 147 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
191 if (len <= mm->cached_hole_size) { 148 info.length = len;
192 mm->cached_hole_size = 0; 149 info.low_limit = PAGE_SIZE;
193 mm->free_area_cache = mm->mmap_base; 150 info.high_limit = mm->mmap_base;
194 } 151 info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
195 152 info.align_offset = pgoff << PAGE_SHIFT;
196 /* either no address requested or can't fit in requested address hole */ 153 addr = vm_unmapped_area(&info);
197 addr = mm->free_area_cache;
198 if (do_align) {
199 unsigned long base = COLOUR_ALIGN_DOWN(addr - len, pgoff);
200 addr = base + len;
201 }
202
203 /* make sure it can fit in the remaining address space */
204 if (addr > len) {
205 vma = find_vma(mm, addr-len);
206 if (!vma || addr <= vma->vm_start)
207 /* remember the address as a hint for next time */
208 return (mm->free_area_cache = addr-len);
209 }
210
211 if (mm->mmap_base < len)
212 goto bottomup;
213
214 addr = mm->mmap_base - len;
215 if (do_align)
216 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
217
218 do {
219 /*
220 * Lookup failure means no vma is above this address,
221 * else if new region fits below vma->vm_start,
222 * return with success:
223 */
224 vma = find_vma(mm, addr);
225 if (!vma || addr+len <= vma->vm_start)
226 /* remember the address as a hint for next time */
227 return (mm->free_area_cache = addr);
228 154
229 /* remember the largest hole we saw so far */
230 if (addr + mm->cached_hole_size < vma->vm_start)
231 mm->cached_hole_size = vma->vm_start - addr;
232
233 /* try just below the current vma->vm_start */
234 addr = vma->vm_start - len;
235 if (do_align)
236 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
237 } while (len < vma->vm_start);
238
239bottomup:
240 /* 155 /*
241 * A failed mmap() very likely causes application failure, 156 * A failed mmap() very likely causes application failure,
242 * so fall back to the bottom-up function here. This scenario 157 * so fall back to the bottom-up function here. This scenario
243 * can happen with large stack limits and large mmap() 158 * can happen with large stack limits and large mmap()
244 * allocations. 159 * allocations.
245 */ 160 */
246 mm->cached_hole_size = ~0UL; 161 if (addr & ~PAGE_MASK) {
247 mm->free_area_cache = TASK_UNMAPPED_BASE; 162 VM_BUG_ON(addr != -ENOMEM);
248 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags); 163 info.flags = 0;
249 /* 164 info.low_limit = mm->mmap_base;
250 * Restore the topdown base: 165 info.high_limit = TASK_SIZE;
251 */ 166 addr = vm_unmapped_area(&info);
252 mm->free_area_cache = mm->mmap_base; 167 }
253 mm->cached_hole_size = ~0UL;
254 168
255 return addr; 169 return addr;
256} 170}
@@ -279,7 +193,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
279 * You really shouldn't be using read() or write() on /dev/mem. This 193 * You really shouldn't be using read() or write() on /dev/mem. This
280 * might go away in the future. 194 * might go away in the future.
281 */ 195 */
282int valid_phys_addr_range(unsigned long addr, size_t size) 196int valid_phys_addr_range(phys_addr_t addr, size_t size)
283{ 197{
284 if (addr < PHYS_OFFSET) 198 if (addr < PHYS_OFFSET)
285 return 0; 199 return 0;
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 941dfb9e9a7..9f0610243bd 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -488,7 +488,7 @@ static void __init build_mem_type_table(void)
488#endif 488#endif
489 489
490 for (i = 0; i < 16; i++) { 490 for (i = 0; i < 16; i++) {
491 unsigned long v = pgprot_val(protection_map[i]); 491 pteval_t v = pgprot_val(protection_map[i]);
492 protection_map[i] = __pgprot(v | user_pgprot); 492 protection_map[i] = __pgprot(v | user_pgprot);
493 } 493 }
494 494
@@ -876,6 +876,22 @@ static void __init pci_reserve_io(void)
876#define pci_reserve_io() do { } while (0) 876#define pci_reserve_io() do { } while (0)
877#endif 877#endif
878 878
879#ifdef CONFIG_DEBUG_LL
880void __init debug_ll_io_init(void)
881{
882 struct map_desc map;
883
884 debug_ll_addr(&map.pfn, &map.virtual);
885 if (!map.pfn || !map.virtual)
886 return;
887 map.pfn = __phys_to_pfn(map.pfn);
888 map.virtual &= PAGE_MASK;
889 map.length = PAGE_SIZE;
890 map.type = MT_DEVICE;
891 create_mapping(&map);
892}
893#endif
894
879static void * __initdata vmalloc_min = 895static void * __initdata vmalloc_min =
880 (void *)(VMALLOC_END - (240 << 20) - VMALLOC_OFFSET); 896 (void *)(VMALLOC_END - (240 << 20) - VMALLOC_OFFSET);
881 897
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index b29a2265af0..eb6aa73bc8b 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -167,6 +167,10 @@
167 tst r1, #L_PTE_YOUNG 167 tst r1, #L_PTE_YOUNG
168 tstne r1, #L_PTE_PRESENT 168 tstne r1, #L_PTE_PRESENT
169 moveq r3, #0 169 moveq r3, #0
170#ifndef CONFIG_CPU_USE_DOMAINS
171 tstne r1, #L_PTE_NONE
172 movne r3, #0
173#endif
170 174
171 str r3, [r0] 175 str r3, [r0]
172 mcr p15, 0, r0, c7, c10, 1 @ flush_pte 176 mcr p15, 0, r0, c7, c10, 1 @ flush_pte
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 86b8b480634..09c5233f4df 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -89,7 +89,7 @@ ENTRY(cpu_v6_dcache_clean_area)
89 mov pc, lr 89 mov pc, lr
90 90
91/* 91/*
92 * cpu_arm926_switch_mm(pgd_phys, tsk) 92 * cpu_v6_switch_mm(pgd_phys, tsk)
93 * 93 *
94 * Set the translation table base pointer to be pgd_phys 94 * Set the translation table base pointer to be pgd_phys
95 * 95 *
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index fd045e70639..6d98c13ab82 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -100,7 +100,11 @@ ENTRY(cpu_v7_set_pte_ext)
100 orrne r3, r3, #PTE_EXT_XN 100 orrne r3, r3, #PTE_EXT_XN
101 101
102 tst r1, #L_PTE_YOUNG 102 tst r1, #L_PTE_YOUNG
103 tstne r1, #L_PTE_PRESENT 103 tstne r1, #L_PTE_VALID
104#ifndef CONFIG_CPU_USE_DOMAINS
105 eorne r1, r1, #L_PTE_NONE
106 tstne r1, #L_PTE_NONE
107#endif
104 moveq r3, #0 108 moveq r3, #0
105 109
106 ARM( str r3, [r0, #2048]! ) 110 ARM( str r3, [r0, #2048]! )
@@ -161,11 +165,11 @@ ENDPROC(cpu_v7_set_pte_ext)
161 * TFR EV X F I D LR S 165 * TFR EV X F I D LR S
162 * .EEE ..EE PUI. .T.T 4RVI ZWRS BLDP WCAM 166 * .EEE ..EE PUI. .T.T 4RVI ZWRS BLDP WCAM
163 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced 167 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced
164 * 1 0 110 0011 1100 .111 1101 < we want 168 * 01 0 110 0011 1100 .111 1101 < we want
165 */ 169 */
166 .align 2 170 .align 2
167 .type v7_crval, #object 171 .type v7_crval, #object
168v7_crval: 172v7_crval:
169 crval clear=0x0120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c 173 crval clear=0x2120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c
170 174
171 .previous 175 .previous
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 8de0f1dd154..7b56386f949 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -65,8 +65,11 @@ ENDPROC(cpu_v7_switch_mm)
65 */ 65 */
66ENTRY(cpu_v7_set_pte_ext) 66ENTRY(cpu_v7_set_pte_ext)
67#ifdef CONFIG_MMU 67#ifdef CONFIG_MMU
68 tst r2, #L_PTE_PRESENT 68 tst r2, #L_PTE_VALID
69 beq 1f 69 beq 1f
70 tst r3, #1 << (57 - 32) @ L_PTE_NONE
71 bicne r2, #L_PTE_VALID
72 bne 1f
70 tst r3, #1 << (55 - 32) @ L_PTE_DIRTY 73 tst r3, #1 << (55 - 32) @ L_PTE_DIRTY
71 orreq r2, #L_PTE_RDONLY 74 orreq r2, #L_PTE_RDONLY
721: strd r2, r3, [r0] 751: strd r2, r3, [r0]
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 846d279f317..42cc833aa02 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -57,7 +57,7 @@ ENTRY(cpu_v7_reset)
57 THUMB( bic r1, r1, #1 << 30 ) @ SCTLR.TE (Thumb exceptions) 57 THUMB( bic r1, r1, #1 << 30 ) @ SCTLR.TE (Thumb exceptions)
58 mcr p15, 0, r1, c1, c0, 0 @ disable MMU 58 mcr p15, 0, r1, c1, c0, 0 @ disable MMU
59 isb 59 isb
60 mov pc, r0 60 bx r0
61ENDPROC(cpu_v7_reset) 61ENDPROC(cpu_v7_reset)
62 .popsection 62 .popsection
63 63
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index c641fb68501..a34f1e21411 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -16,6 +16,7 @@
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/if_vlan.h>
19#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
20#include <asm/hwcap.h> 21#include <asm/hwcap.h>
21 22
@@ -42,7 +43,7 @@
42#define r_skb_hl ARM_R8 43#define r_skb_hl ARM_R8
43 44
44#define SCRATCH_SP_OFFSET 0 45#define SCRATCH_SP_OFFSET 0
45#define SCRATCH_OFF(k) (SCRATCH_SP_OFFSET + (k)) 46#define SCRATCH_OFF(k) (SCRATCH_SP_OFFSET + 4 * (k))
46 47
47#define SEEN_MEM ((1 << BPF_MEMWORDS) - 1) 48#define SEEN_MEM ((1 << BPF_MEMWORDS) - 1)
48#define SEEN_MEM_WORD(k) (1 << (k)) 49#define SEEN_MEM_WORD(k) (1 << (k))
@@ -168,6 +169,8 @@ static inline bool is_load_to_a(u16 inst)
168 case BPF_S_ANC_MARK: 169 case BPF_S_ANC_MARK:
169 case BPF_S_ANC_PROTOCOL: 170 case BPF_S_ANC_PROTOCOL:
170 case BPF_S_ANC_RXHASH: 171 case BPF_S_ANC_RXHASH:
172 case BPF_S_ANC_VLAN_TAG:
173 case BPF_S_ANC_VLAN_TAG_PRESENT:
171 case BPF_S_ANC_QUEUE: 174 case BPF_S_ANC_QUEUE:
172 return true; 175 return true;
173 default: 176 default:
@@ -646,6 +649,16 @@ load_ind:
646 update_on_xread(ctx); 649 update_on_xread(ctx);
647 emit(ARM_ORR_R(r_A, r_A, r_X), ctx); 650 emit(ARM_ORR_R(r_A, r_A, r_X), ctx);
648 break; 651 break;
652 case BPF_S_ALU_XOR_K:
653 /* A ^= K; */
654 OP_IMM3(ARM_EOR, r_A, r_A, k, ctx);
655 break;
656 case BPF_S_ANC_ALU_XOR_X:
657 case BPF_S_ALU_XOR_X:
658 /* A ^= X */
659 update_on_xread(ctx);
660 emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
661 break;
649 case BPF_S_ALU_AND_K: 662 case BPF_S_ALU_AND_K:
650 /* A &= K */ 663 /* A &= K */
651 OP_IMM3(ARM_AND, r_A, r_A, k, ctx); 664 OP_IMM3(ARM_AND, r_A, r_A, k, ctx);
@@ -762,11 +775,6 @@ b_epilogue:
762 update_on_xread(ctx); 775 update_on_xread(ctx);
763 emit(ARM_MOV_R(r_A, r_X), ctx); 776 emit(ARM_MOV_R(r_A, r_X), ctx);
764 break; 777 break;
765 case BPF_S_ANC_ALU_XOR_X:
766 /* A ^= X */
767 update_on_xread(ctx);
768 emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
769 break;
770 case BPF_S_ANC_PROTOCOL: 778 case BPF_S_ANC_PROTOCOL:
771 /* A = ntohs(skb->protocol) */ 779 /* A = ntohs(skb->protocol) */
772 ctx->seen |= SEEN_SKB; 780 ctx->seen |= SEEN_SKB;
@@ -810,6 +818,17 @@ b_epilogue:
810 off = offsetof(struct sk_buff, rxhash); 818 off = offsetof(struct sk_buff, rxhash);
811 emit(ARM_LDR_I(r_A, r_skb, off), ctx); 819 emit(ARM_LDR_I(r_A, r_skb, off), ctx);
812 break; 820 break;
821 case BPF_S_ANC_VLAN_TAG:
822 case BPF_S_ANC_VLAN_TAG_PRESENT:
823 ctx->seen |= SEEN_SKB;
824 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
825 off = offsetof(struct sk_buff, vlan_tci);
826 emit(ARM_LDRH_I(r_A, r_skb, off), ctx);
827 if (inst->code == BPF_S_ANC_VLAN_TAG)
828 OP_IMM3(ARM_AND, r_A, r_A, VLAN_VID_MASK, ctx);
829 else
830 OP_IMM3(ARM_AND, r_A, r_A, VLAN_TAG_PRESENT, ctx);
831 break;
813 case BPF_S_ANC_QUEUE: 832 case BPF_S_ANC_QUEUE:
814 ctx->seen |= SEEN_SKB; 833 ctx->seen |= SEEN_SKB;
815 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 834 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
@@ -845,7 +864,7 @@ void bpf_jit_compile(struct sk_filter *fp)
845 ctx.skf = fp; 864 ctx.skf = fp;
846 ctx.ret0_fp_idx = -1; 865 ctx.ret0_fp_idx = -1;
847 866
848 ctx.offsets = kzalloc(GFP_KERNEL, 4 * (ctx.skf->len + 1)); 867 ctx.offsets = kzalloc(4 * (ctx.skf->len + 1), GFP_KERNEL);
849 if (ctx.offsets == NULL) 868 if (ctx.offsets == NULL)
850 return; 869 return;
851 870
@@ -864,7 +883,7 @@ void bpf_jit_compile(struct sk_filter *fp)
864 883
865 ctx.idx += ctx.imm_count; 884 ctx.idx += ctx.imm_count;
866 if (ctx.imm_count) { 885 if (ctx.imm_count) {
867 ctx.imms = kzalloc(GFP_KERNEL, 4 * ctx.imm_count); 886 ctx.imms = kzalloc(4 * ctx.imm_count, GFP_KERNEL);
868 if (ctx.imms == NULL) 887 if (ctx.imms == NULL)
869 goto out; 888 goto out;
870 } 889 }
diff --git a/arch/arm/net/bpf_jit_32.h b/arch/arm/net/bpf_jit_32.h
index 7fa2f7d3cb9..afb84621ff6 100644
--- a/arch/arm/net/bpf_jit_32.h
+++ b/arch/arm/net/bpf_jit_32.h
@@ -69,6 +69,7 @@
69#define ARM_INST_CMP_I 0x03500000 69#define ARM_INST_CMP_I 0x03500000
70 70
71#define ARM_INST_EOR_R 0x00200000 71#define ARM_INST_EOR_R 0x00200000
72#define ARM_INST_EOR_I 0x02200000
72 73
73#define ARM_INST_LDRB_I 0x05d00000 74#define ARM_INST_LDRB_I 0x05d00000
74#define ARM_INST_LDRB_R 0x07d00000 75#define ARM_INST_LDRB_R 0x07d00000
@@ -135,6 +136,7 @@
135#define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm) 136#define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm)
136 137
137#define ARM_EOR_R(rd, rn, rm) _AL3_R(ARM_INST_EOR, rd, rn, rm) 138#define ARM_EOR_R(rd, rn, rm) _AL3_R(ARM_INST_EOR, rd, rn, rm)
139#define ARM_EOR_I(rd, rn, imm) _AL3_I(ARM_INST_EOR, rd, rn, imm)
138 140
139#define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \ 141#define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \
140 | (off)) 142 | (off))
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
deleted file mode 100644
index 88e1e2e7a20..00000000000
--- a/arch/arm/plat-mxc/Kconfig
+++ /dev/null
@@ -1,89 +0,0 @@
1if ARCH_MXC
2
3source "arch/arm/plat-mxc/devices/Kconfig"
4
5menu "Freescale MXC Implementations"
6
7choice
8 prompt "Freescale CPU family:"
9 default ARCH_IMX_V6_V7
10
11config ARCH_IMX_V4_V5
12 bool "i.MX1, i.MX21, i.MX25, i.MX27"
13 select ARM_PATCH_PHYS_VIRT
14 select AUTO_ZRELADDR if !ZBOOT_ROM
15 help
16 This enables support for systems based on the Freescale i.MX ARMv4
17 and ARMv5 SoCs
18
19config ARCH_IMX_V6_V7
20 bool "i.MX3, i.MX5, i.MX6"
21 select ARM_PATCH_PHYS_VIRT
22 select AUTO_ZRELADDR if !ZBOOT_ROM
23 select MIGHT_HAVE_CACHE_L2X0
24 help
25 This enables support for systems based on the Freescale i.MX3, i.MX5
26 and i.MX6 family.
27
28endchoice
29
30source "arch/arm/mach-imx/Kconfig"
31
32endmenu
33
34config MXC_IRQ_PRIOR
35 bool "Use IRQ priority"
36 help
37 Select this if you want to use prioritized IRQ handling.
38 This feature prevents higher priority ISR to be interrupted
39 by lower priority IRQ even IRQF_DISABLED flag is not set.
40 This may be useful in embedded applications, where are strong
41 requirements for timing.
42 Say N here, unless you have a specialized requirement.
43
44config MXC_TZIC
45 bool
46
47config MXC_AVIC
48 bool
49
50config MXC_DEBUG_BOARD
51 bool "Enable MXC debug board(for 3-stack)"
52 help
53 The debug board is an integral part of the MXC 3-stack(PDK)
54 platforms, it can be attached or removed from the peripheral
55 board. On debug board, several debug devices(ethernet, UART,
56 buttons, LEDs and JTAG) are implemented. Between the MCU and
57 these devices, a CPLD is added as a bridge which performs
58 data/address de-multiplexing and decode, signal level shift,
59 interrupt control and various board functions.
60
61config HAVE_EPIT
62 bool
63
64config MXC_USE_EPIT
65 bool "Use EPIT instead of GPT"
66 depends on HAVE_EPIT
67 help
68 Use EPIT as the system timer on systems that have it. Normally you
69 don't have a reason to do so as the EPIT has the same features and
70 uses the same clocks as the GPT. Anyway, on some systems the GPT
71 may be in use for other purposes.
72
73config MXC_ULPI
74 bool
75
76config ARCH_HAS_RNGA
77 bool
78
79config IMX_HAVE_IOMUX_V1
80 bool
81
82config ARCH_MXC_IOMUX_V3
83 bool
84
85config IRAM_ALLOC
86 bool
87 select GENERIC_ALLOCATOR
88
89endif
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
deleted file mode 100644
index 149237e2485..00000000000
--- a/arch/arm/plat-mxc/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Common support
6obj-y := time.o devices.o cpu.o system.o irq-common.o
7
8obj-$(CONFIG_MXC_TZIC) += tzic.o
9obj-$(CONFIG_MXC_AVIC) += avic.o
10
11obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
12obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
13obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
14obj-$(CONFIG_MXC_ULPI) += ulpi.o
15obj-$(CONFIG_MXC_USE_EPIT) += epit.o
16obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
17obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
18obj-$(CONFIG_CPU_IDLE) += cpuidle.o
19ifdef CONFIG_SND_IMX_SOC
20obj-y += ssi-fiq.o
21obj-y += ssi-fiq-ksym.o
22endif
23
24obj-y += devices/
diff --git a/arch/arm/plat-mxc/devices/platform-mx2-emma.c b/arch/arm/plat-mxc/devices/platform-mx2-emma.c
new file mode 100644
index 00000000000..508404ddd4e
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-mx2-emma.c
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/hardware.h>
10#include <mach/devices-common.h>
11
12#define imx_mx2_emmaprp_data_entry_single(soc) \
13 { \
14 .iobase = soc ## _EMMAPRP_BASE_ADDR, \
15 .iosize = SZ_32, \
16 .irq = soc ## _INT_EMMAPRP, \
17 }
18
19#ifdef CONFIG_SOC_IMX27
20const struct imx_mx2_emma_data imx27_mx2_emmaprp_data __initconst =
21 imx_mx2_emmaprp_data_entry_single(MX27);
22#endif /* ifdef CONFIG_SOC_IMX27 */
23
24struct platform_device *__init imx_add_mx2_emmaprp(
25 const struct imx_mx2_emma_data *data)
26{
27 struct resource res[] = {
28 {
29 .start = data->iobase,
30 .end = data->iobase + data->iosize - 1,
31 .flags = IORESOURCE_MEM,
32 }, {
33 .start = data->irq,
34 .end = data->irq,
35 .flags = IORESOURCE_IRQ,
36 },
37 };
38 return imx_add_platform_device_dmamask("m2m-emmaprp", 0,
39 res, 2, NULL, 0, DMA_BIT_MASK(32));
40}
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
deleted file mode 100644
index 761e45f9456..00000000000
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ /dev/null
@@ -1,51 +0,0 @@
1/* arch/arm/mach-imx/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#include <mach/hardware.h>
14
15#ifdef CONFIG_DEBUG_IMX1_UART
16#define UART_PADDR MX1_UART1_BASE_ADDR
17#elif defined (CONFIG_DEBUG_IMX25_UART)
18#define UART_PADDR MX25_UART1_BASE_ADDR
19#elif defined (CONFIG_DEBUG_IMX21_IMX27_UART)
20#define UART_PADDR MX2x_UART1_BASE_ADDR
21#elif defined (CONFIG_DEBUG_IMX31_IMX35_UART)
22#define UART_PADDR MX3x_UART1_BASE_ADDR
23#elif defined (CONFIG_DEBUG_IMX51_UART)
24#define UART_PADDR MX51_UART1_BASE_ADDR
25#elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
26#define UART_PADDR MX53_UART1_BASE_ADDR
27#elif defined (CONFIG_DEBUG_IMX6Q_UART2)
28#define UART_PADDR MX6Q_UART2_BASE_ADDR
29#elif defined (CONFIG_DEBUG_IMX6Q_UART4)
30#define UART_PADDR MX6Q_UART4_BASE_ADDR
31#endif
32
33#define UART_VADDR IMX_IO_ADDRESS(UART_PADDR)
34
35 .macro addruart, rp, rv, tmp
36 ldr \rp, =UART_PADDR @ physical
37 ldr \rv, =UART_VADDR @ virtual
38 .endm
39
40 .macro senduart,rd,rx
41 str \rd, [\rx, #0x40] @ TXDATA
42 .endm
43
44 .macro waituart,rd,rx
45 .endm
46
47 .macro busyuart,rd,rx
481002: ldr \rd, [\rx, #0x98] @ SR2
49 tst \rd, #1 << 3 @ TXDC
50 beq 1002b @ wait until transmit done
51 .endm
diff --git a/arch/arm/plat-mxc/include/mach/ipu.h b/arch/arm/plat-mxc/include/mach/ipu.h
deleted file mode 100644
index 539e559d18b..00000000000
--- a/arch/arm/plat-mxc/include/mach/ipu.h
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2 * Copyright (C) 2008
3 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
4 *
5 * Copyright (C) 2005-2007 Freescale Semiconductor, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _IPU_H_
13#define _IPU_H_
14
15#include <linux/types.h>
16#include <linux/dmaengine.h>
17
18/* IPU DMA Controller channel definitions. */
19enum ipu_channel {
20 IDMAC_IC_0 = 0, /* IC (encoding task) to memory */
21 IDMAC_IC_1 = 1, /* IC (viewfinder task) to memory */
22 IDMAC_ADC_0 = 1,
23 IDMAC_IC_2 = 2,
24 IDMAC_ADC_1 = 2,
25 IDMAC_IC_3 = 3,
26 IDMAC_IC_4 = 4,
27 IDMAC_IC_5 = 5,
28 IDMAC_IC_6 = 6,
29 IDMAC_IC_7 = 7, /* IC (sensor data) to memory */
30 IDMAC_IC_8 = 8,
31 IDMAC_IC_9 = 9,
32 IDMAC_IC_10 = 10,
33 IDMAC_IC_11 = 11,
34 IDMAC_IC_12 = 12,
35 IDMAC_IC_13 = 13,
36 IDMAC_SDC_0 = 14, /* Background synchronous display data */
37 IDMAC_SDC_1 = 15, /* Foreground data (overlay) */
38 IDMAC_SDC_2 = 16,
39 IDMAC_SDC_3 = 17,
40 IDMAC_ADC_2 = 18,
41 IDMAC_ADC_3 = 19,
42 IDMAC_ADC_4 = 20,
43 IDMAC_ADC_5 = 21,
44 IDMAC_ADC_6 = 22,
45 IDMAC_ADC_7 = 23,
46 IDMAC_PF_0 = 24,
47 IDMAC_PF_1 = 25,
48 IDMAC_PF_2 = 26,
49 IDMAC_PF_3 = 27,
50 IDMAC_PF_4 = 28,
51 IDMAC_PF_5 = 29,
52 IDMAC_PF_6 = 30,
53 IDMAC_PF_7 = 31,
54};
55
56/* Order significant! */
57enum ipu_channel_status {
58 IPU_CHANNEL_FREE,
59 IPU_CHANNEL_INITIALIZED,
60 IPU_CHANNEL_READY,
61 IPU_CHANNEL_ENABLED,
62};
63
64#define IPU_CHANNELS_NUM 32
65
66enum pixel_fmt {
67 /* 1 byte */
68 IPU_PIX_FMT_GENERIC,
69 IPU_PIX_FMT_RGB332,
70 IPU_PIX_FMT_YUV420P,
71 IPU_PIX_FMT_YUV422P,
72 IPU_PIX_FMT_YUV420P2,
73 IPU_PIX_FMT_YVU422P,
74 /* 2 bytes */
75 IPU_PIX_FMT_RGB565,
76 IPU_PIX_FMT_RGB666,
77 IPU_PIX_FMT_BGR666,
78 IPU_PIX_FMT_YUYV,
79 IPU_PIX_FMT_UYVY,
80 /* 3 bytes */
81 IPU_PIX_FMT_RGB24,
82 IPU_PIX_FMT_BGR24,
83 /* 4 bytes */
84 IPU_PIX_FMT_GENERIC_32,
85 IPU_PIX_FMT_RGB32,
86 IPU_PIX_FMT_BGR32,
87 IPU_PIX_FMT_ABGR32,
88 IPU_PIX_FMT_BGRA32,
89 IPU_PIX_FMT_RGBA32,
90};
91
92enum ipu_color_space {
93 IPU_COLORSPACE_RGB,
94 IPU_COLORSPACE_YCBCR,
95 IPU_COLORSPACE_YUV
96};
97
98/*
99 * Enumeration of IPU rotation modes
100 */
101enum ipu_rotate_mode {
102 /* Note the enum values correspond to BAM value */
103 IPU_ROTATE_NONE = 0,
104 IPU_ROTATE_VERT_FLIP = 1,
105 IPU_ROTATE_HORIZ_FLIP = 2,
106 IPU_ROTATE_180 = 3,
107 IPU_ROTATE_90_RIGHT = 4,
108 IPU_ROTATE_90_RIGHT_VFLIP = 5,
109 IPU_ROTATE_90_RIGHT_HFLIP = 6,
110 IPU_ROTATE_90_LEFT = 7,
111};
112
113/*
114 * Enumeration of DI ports for ADC.
115 */
116enum display_port {
117 DISP0,
118 DISP1,
119 DISP2,
120 DISP3
121};
122
123struct idmac_video_param {
124 unsigned short in_width;
125 unsigned short in_height;
126 uint32_t in_pixel_fmt;
127 unsigned short out_width;
128 unsigned short out_height;
129 uint32_t out_pixel_fmt;
130 unsigned short out_stride;
131 bool graphics_combine_en;
132 bool global_alpha_en;
133 bool key_color_en;
134 enum display_port disp;
135 unsigned short out_left;
136 unsigned short out_top;
137};
138
139/*
140 * Union of initialization parameters for a logical channel. So far only video
141 * parameters are used.
142 */
143union ipu_channel_param {
144 struct idmac_video_param video;
145};
146
147struct idmac_tx_desc {
148 struct dma_async_tx_descriptor txd;
149 struct scatterlist *sg; /* scatterlist for this */
150 unsigned int sg_len; /* tx-descriptor. */
151 struct list_head list;
152};
153
154struct idmac_channel {
155 struct dma_chan dma_chan;
156 dma_cookie_t completed; /* last completed cookie */
157 union ipu_channel_param params;
158 enum ipu_channel link; /* input channel, linked to the output */
159 enum ipu_channel_status status;
160 void *client; /* Only one client per channel */
161 unsigned int n_tx_desc;
162 struct idmac_tx_desc *desc; /* allocated tx-descriptors */
163 struct scatterlist *sg[2]; /* scatterlist elements in buffer-0 and -1 */
164 struct list_head free_list; /* free tx-descriptors */
165 struct list_head queue; /* queued tx-descriptors */
166 spinlock_t lock; /* protects sg[0,1], queue */
167 struct mutex chan_mutex; /* protects status, cookie, free_list */
168 bool sec_chan_en;
169 int active_buffer;
170 unsigned int eof_irq;
171 char eof_name[16]; /* EOF IRQ name for request_irq() */
172};
173
174#define to_tx_desc(tx) container_of(tx, struct idmac_tx_desc, txd)
175#define to_idmac_chan(c) container_of(c, struct idmac_channel, dma_chan)
176
177#endif
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
deleted file mode 100644
index d73f5e8ea9c..00000000000
--- a/arch/arm/plat-mxc/include/mach/irqs.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
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_MXC_IRQS_H__
12#define __ASM_ARCH_MXC_IRQS_H__
13
14extern int imx_irq_set_priority(unsigned char irq, unsigned char prio);
15
16/* all normal IRQs can be FIQs */
17#define FIQ_START 0
18/* switch between IRQ and FIQ */
19extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);
20
21#endif /* __ASM_ARCH_MXC_IRQS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-mxc/include/mach/timex.h
deleted file mode 100644
index 10343d1f87e..00000000000
--- a/arch/arm/plat-mxc/include/mach/timex.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __ASM_ARCH_MXC_TIMEX_H__
17#define __ASM_ARCH_MXC_TIMEX_H__
18
19/* Bogus value */
20#define CLOCK_TICK_RATE 12345678
21
22#endif /* __ASM_ARCH_MXC_TIMEX_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
deleted file mode 100644
index 477971b0093..00000000000
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * arch/arm/plat-mxc/include/mach/uncompress.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) Shane Nay (shane@minirl.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * 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#ifndef __ASM_ARCH_MXC_UNCOMPRESS_H__
18#define __ASM_ARCH_MXC_UNCOMPRESS_H__
19
20#define __MXC_BOOT_UNCOMPRESS
21
22#include <asm/mach-types.h>
23
24unsigned long uart_base;
25
26#define UART(x) (*(volatile unsigned long *)(uart_base + (x)))
27
28#define USR2 0x98
29#define USR2_TXFE (1<<14)
30#define TXR 0x40
31#define UCR1 0x80
32#define UCR1_UARTEN 1
33
34/*
35 * The following code assumes the serial port has already been
36 * initialized by the bootloader. We search for the first enabled
37 * port in the most probable order. If you didn't setup a port in
38 * your bootloader then nothing will appear (which might be desired).
39 *
40 * This does not append a newline
41 */
42
43static void putc(int ch)
44{
45 if (!uart_base)
46 return;
47 if (!(UART(UCR1) & UCR1_UARTEN))
48 return;
49
50 while (!(UART(USR2) & USR2_TXFE))
51 barrier();
52
53 UART(TXR) = ch;
54}
55
56static inline void flush(void)
57{
58}
59
60#define MX1_UART1_BASE_ADDR 0x00206000
61#define MX25_UART1_BASE_ADDR 0x43f90000
62#define MX2X_UART1_BASE_ADDR 0x1000a000
63#define MX3X_UART1_BASE_ADDR 0x43F90000
64#define MX3X_UART2_BASE_ADDR 0x43F94000
65#define MX3X_UART5_BASE_ADDR 0x43FB4000
66#define MX51_UART1_BASE_ADDR 0x73fbc000
67#define MX50_UART1_BASE_ADDR 0x53fbc000
68#define MX53_UART1_BASE_ADDR 0x53fbc000
69
70static __inline__ void __arch_decomp_setup(unsigned long arch_id)
71{
72 switch (arch_id) {
73 case MACH_TYPE_MX1ADS:
74 case MACH_TYPE_SCB9328:
75 uart_base = MX1_UART1_BASE_ADDR;
76 break;
77 case MACH_TYPE_MX25_3DS:
78 uart_base = MX25_UART1_BASE_ADDR;
79 break;
80 case MACH_TYPE_IMX27LITE:
81 case MACH_TYPE_MX27_3DS:
82 case MACH_TYPE_MX27ADS:
83 case MACH_TYPE_PCM038:
84 case MACH_TYPE_MX21ADS:
85 case MACH_TYPE_PCA100:
86 case MACH_TYPE_MXT_TD60:
87 case MACH_TYPE_IMX27IPCAM:
88 uart_base = MX2X_UART1_BASE_ADDR;
89 break;
90 case MACH_TYPE_MX31LITE:
91 case MACH_TYPE_ARMADILLO5X0:
92 case MACH_TYPE_MX31MOBOARD:
93 case MACH_TYPE_QONG:
94 case MACH_TYPE_MX31_3DS:
95 case MACH_TYPE_PCM037:
96 case MACH_TYPE_MX31ADS:
97 case MACH_TYPE_MX35_3DS:
98 case MACH_TYPE_PCM043:
99 case MACH_TYPE_LILLY1131:
100 case MACH_TYPE_VPR200:
101 case MACH_TYPE_EUKREA_CPUIMX35SD:
102 uart_base = MX3X_UART1_BASE_ADDR;
103 break;
104 case MACH_TYPE_MAGX_ZN5:
105 uart_base = MX3X_UART2_BASE_ADDR;
106 break;
107 case MACH_TYPE_BUG:
108 uart_base = MX3X_UART5_BASE_ADDR;
109 break;
110 case MACH_TYPE_MX51_BABBAGE:
111 case MACH_TYPE_EUKREA_CPUIMX51SD:
112 case MACH_TYPE_MX51_3DS:
113 uart_base = MX51_UART1_BASE_ADDR;
114 break;
115 case MACH_TYPE_MX50_RDP:
116 uart_base = MX50_UART1_BASE_ADDR;
117 break;
118 case MACH_TYPE_MX53_EVK:
119 case MACH_TYPE_MX53_LOCO:
120 case MACH_TYPE_MX53_SMD:
121 case MACH_TYPE_MX53_ARD:
122 uart_base = MX53_UART1_BASE_ADDR;
123 break;
124 default:
125 break;
126 }
127}
128
129#define arch_decomp_setup() __arch_decomp_setup(arch_id)
130#define arch_decomp_wdog()
131
132#endif /* __ASM_ARCH_MXC_UNCOMPRESS_H__ */
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
deleted file mode 100644
index 19f55cae5d7..00000000000
--- a/arch/arm/plat-nomadik/Kconfig
+++ /dev/null
@@ -1,29 +0,0 @@
1# We keep common IP's here for Nomadik and other similar
2# familiy of processors from ST-Ericsson. At the moment we have
3# just MTU, others to follow soon.
4
5config PLAT_NOMADIK
6 bool
7 depends on ARCH_NOMADIK || ARCH_U8500
8 default y
9 select CLKSRC_MMIO
10 help
11 Common platform code for Nomadik and other ST-Ericsson
12 platforms.
13
14if PLAT_NOMADIK
15
16config HAS_MTU
17 bool
18 help
19 Support for Multi Timer Unit. MTU provides access
20 to multiple interrupt generating programmable
21 32-bit free running decrementing counters.
22
23config NOMADIK_MTU_SCHED_CLOCK
24 bool
25 depends on HAS_MTU
26 help
27 Use the Multi Timer Unit as the sched_clock.
28
29endif
diff --git a/arch/arm/plat-nomadik/Makefile b/arch/arm/plat-nomadik/Makefile
deleted file mode 100644
index 37c7cdd0f8f..00000000000
--- a/arch/arm/plat-nomadik/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1# arch/arm/plat-nomadik/Makefile
2# Copyright 2009 ST-Ericsson
3# Licensed under GPLv2
4
5obj-$(CONFIG_HAS_MTU) += timer.o
diff --git a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
deleted file mode 100644
index c08a54d9d88..00000000000
--- a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Structures and registers for GPIO access in the Nomadik SoC
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 * Author: Prafulla WADASKAR <prafulla.wadaskar@st.com>
6 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __PLAT_NOMADIK_GPIO
14#define __PLAT_NOMADIK_GPIO
15
16/*
17 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
18 * the "gpio" namespace for generic and cross-machine functions
19 */
20
21/* Register in the logic block */
22#define NMK_GPIO_DAT 0x00
23#define NMK_GPIO_DATS 0x04
24#define NMK_GPIO_DATC 0x08
25#define NMK_GPIO_PDIS 0x0c
26#define NMK_GPIO_DIR 0x10
27#define NMK_GPIO_DIRS 0x14
28#define NMK_GPIO_DIRC 0x18
29#define NMK_GPIO_SLPC 0x1c
30#define NMK_GPIO_AFSLA 0x20
31#define NMK_GPIO_AFSLB 0x24
32#define NMK_GPIO_LOWEMI 0x28
33
34#define NMK_GPIO_RIMSC 0x40
35#define NMK_GPIO_FIMSC 0x44
36#define NMK_GPIO_IS 0x48
37#define NMK_GPIO_IC 0x4c
38#define NMK_GPIO_RWIMSC 0x50
39#define NMK_GPIO_FWIMSC 0x54
40#define NMK_GPIO_WKS 0x58
41
42/* Alternate functions: function C is set in hw by setting both A and B */
43#define NMK_GPIO_ALT_GPIO 0
44#define NMK_GPIO_ALT_A 1
45#define NMK_GPIO_ALT_B 2
46#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
47
48#define NMK_GPIO_ALT_CX_SHIFT 2
49#define NMK_GPIO_ALT_C1 ((1<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
50#define NMK_GPIO_ALT_C2 ((2<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
51#define NMK_GPIO_ALT_C3 ((3<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
52#define NMK_GPIO_ALT_C4 ((4<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
53
54/* Pull up/down values */
55enum nmk_gpio_pull {
56 NMK_GPIO_PULL_NONE,
57 NMK_GPIO_PULL_UP,
58 NMK_GPIO_PULL_DOWN,
59};
60
61/* Sleep mode */
62enum nmk_gpio_slpm {
63 NMK_GPIO_SLPM_INPUT,
64 NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT,
65 NMK_GPIO_SLPM_NOCHANGE,
66 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
67};
68
69extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
70extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
71#ifdef CONFIG_PINCTRL_NOMADIK
72extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
73#else
74static inline int nmk_gpio_set_mode(int gpio, int gpio_mode)
75{
76 return -ENODEV;
77}
78#endif
79extern int nmk_gpio_get_mode(int gpio);
80
81extern void nmk_gpio_wakeups_suspend(void);
82extern void nmk_gpio_wakeups_resume(void);
83
84extern void nmk_gpio_clocks_enable(void);
85extern void nmk_gpio_clocks_disable(void);
86
87extern void nmk_gpio_read_pull(int gpio_bank, u32 *pull_up);
88
89/*
90 * Platform data to register a block: only the initial gpio/irq number.
91 */
92struct nmk_gpio_platform_data {
93 char *name;
94 int first_gpio;
95 int first_irq;
96 int num_gpio;
97 u32 (*get_secondary_status)(unsigned int bank);
98 void (*set_ioforce)(bool enable);
99 bool supports_sleepmode;
100};
101
102#endif /* __PLAT_NOMADIK_GPIO */
diff --git a/arch/arm/plat-nomadik/include/plat/mtu.h b/arch/arm/plat-nomadik/include/plat/mtu.h
deleted file mode 100644
index 582641f3dc0..00000000000
--- a/arch/arm/plat-nomadik/include/plat/mtu.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __PLAT_MTU_H
2#define __PLAT_MTU_H
3
4void nmdk_timer_init(void __iomem *base);
5void nmdk_clkevt_reset(void);
6void nmdk_clksrc_reset(void);
7
8#endif /* __PLAT_MTU_H */
9
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h
deleted file mode 100644
index 3b8ec60af35..00000000000
--- a/arch/arm/plat-nomadik/include/plat/pincfg.h
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
6 *
7 * Based on arch/arm/mach-pxa/include/mach/mfp.h:
8 * Copyright (C) 2007 Marvell International Ltd.
9 * eric miao <eric.miao@marvell.com>
10 */
11
12#ifndef __PLAT_PINCFG_H
13#define __PLAT_PINCFG_H
14
15/*
16 * pin configurations are represented by 32-bit integers:
17 *
18 * bit 0.. 8 - Pin Number (512 Pins Maximum)
19 * bit 9..10 - Alternate Function Selection
20 * bit 11..12 - Pull up/down state
21 * bit 13 - Sleep mode behaviour
22 * bit 14 - Direction
23 * bit 15 - Value (if output)
24 * bit 16..18 - SLPM pull up/down state
25 * bit 19..20 - SLPM direction
26 * bit 21..22 - SLPM Value (if output)
27 * bit 23..25 - PDIS value (if input)
28 * bit 26 - Gpio mode
29 * bit 27 - Sleep mode
30 *
31 * to facilitate the definition, the following macros are provided
32 *
33 * PIN_CFG_DEFAULT - default config (0):
34 * pull up/down = disabled
35 * sleep mode = input/wakeup
36 * direction = input
37 * value = low
38 * SLPM direction = same as normal
39 * SLPM pull = same as normal
40 * SLPM value = same as normal
41 *
42 * PIN_CFG - default config with alternate function
43 */
44
45typedef unsigned long pin_cfg_t;
46
47#define PIN_NUM_MASK 0x1ff
48#define PIN_NUM(x) ((x) & PIN_NUM_MASK)
49
50#define PIN_ALT_SHIFT 9
51#define PIN_ALT_MASK (0x3 << PIN_ALT_SHIFT)
52#define PIN_ALT(x) (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
53#define PIN_GPIO (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
54#define PIN_ALT_A (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
55#define PIN_ALT_B (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
56#define PIN_ALT_C (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
57
58#define PIN_PULL_SHIFT 11
59#define PIN_PULL_MASK (0x3 << PIN_PULL_SHIFT)
60#define PIN_PULL(x) (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
61#define PIN_PULL_NONE (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
62#define PIN_PULL_UP (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
63#define PIN_PULL_DOWN (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
64
65#define PIN_SLPM_SHIFT 13
66#define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT)
67#define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
68#define PIN_SLPM_MAKE_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
69#define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
70/* These two replace the above in DB8500v2+ */
71#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
72#define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
73#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP PIN_SLPM_WAKEUP_DISABLE
74
75#define PIN_SLPM_GPIO PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
76#define PIN_SLPM_ALTFUNC PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
77
78#define PIN_DIR_SHIFT 14
79#define PIN_DIR_MASK (0x1 << PIN_DIR_SHIFT)
80#define PIN_DIR(x) (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)
81#define PIN_DIR_INPUT (0 << PIN_DIR_SHIFT)
82#define PIN_DIR_OUTPUT (1 << PIN_DIR_SHIFT)
83
84#define PIN_VAL_SHIFT 15
85#define PIN_VAL_MASK (0x1 << PIN_VAL_SHIFT)
86#define PIN_VAL(x) (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)
87#define PIN_VAL_LOW (0 << PIN_VAL_SHIFT)
88#define PIN_VAL_HIGH (1 << PIN_VAL_SHIFT)
89
90#define PIN_SLPM_PULL_SHIFT 16
91#define PIN_SLPM_PULL_MASK (0x7 << PIN_SLPM_PULL_SHIFT)
92#define PIN_SLPM_PULL(x) \
93 (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)
94#define PIN_SLPM_PULL_NONE \
95 ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)
96#define PIN_SLPM_PULL_UP \
97 ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)
98#define PIN_SLPM_PULL_DOWN \
99 ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)
100
101#define PIN_SLPM_DIR_SHIFT 19
102#define PIN_SLPM_DIR_MASK (0x3 << PIN_SLPM_DIR_SHIFT)
103#define PIN_SLPM_DIR(x) \
104 (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)
105#define PIN_SLPM_DIR_INPUT ((1 + 0) << PIN_SLPM_DIR_SHIFT)
106#define PIN_SLPM_DIR_OUTPUT ((1 + 1) << PIN_SLPM_DIR_SHIFT)
107
108#define PIN_SLPM_VAL_SHIFT 21
109#define PIN_SLPM_VAL_MASK (0x3 << PIN_SLPM_VAL_SHIFT)
110#define PIN_SLPM_VAL(x) \
111 (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)
112#define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT)
113#define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT)
114
115#define PIN_SLPM_PDIS_SHIFT 23
116#define PIN_SLPM_PDIS_MASK (0x3 << PIN_SLPM_PDIS_SHIFT)
117#define PIN_SLPM_PDIS(x) \
118 (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
119#define PIN_SLPM_PDIS_NO_CHANGE (0 << PIN_SLPM_PDIS_SHIFT)
120#define PIN_SLPM_PDIS_DISABLED (1 << PIN_SLPM_PDIS_SHIFT)
121#define PIN_SLPM_PDIS_ENABLED (2 << PIN_SLPM_PDIS_SHIFT)
122
123#define PIN_LOWEMI_SHIFT 25
124#define PIN_LOWEMI_MASK (0x1 << PIN_LOWEMI_SHIFT)
125#define PIN_LOWEMI(x) (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
126#define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT)
127#define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT)
128
129#define PIN_GPIOMODE_SHIFT 26
130#define PIN_GPIOMODE_MASK (0x1 << PIN_GPIOMODE_SHIFT)
131#define PIN_GPIOMODE(x) (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
132#define PIN_GPIOMODE_DISABLED (0 << PIN_GPIOMODE_SHIFT)
133#define PIN_GPIOMODE_ENABLED (1 << PIN_GPIOMODE_SHIFT)
134
135#define PIN_SLEEPMODE_SHIFT 27
136#define PIN_SLEEPMODE_MASK (0x1 << PIN_SLEEPMODE_SHIFT)
137#define PIN_SLEEPMODE(x) (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
138#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
139#define PIN_SLEEPMODE_ENABLED (1 << PIN_SLEEPMODE_SHIFT)
140
141
142/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */
143#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN)
144#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP)
145#define PIN_INPUT_NOPULL (PIN_DIR_INPUT | PIN_PULL_NONE)
146#define PIN_OUTPUT_LOW (PIN_DIR_OUTPUT | PIN_VAL_LOW)
147#define PIN_OUTPUT_HIGH (PIN_DIR_OUTPUT | PIN_VAL_HIGH)
148
149#define PIN_SLPM_INPUT_PULLDOWN (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)
150#define PIN_SLPM_INPUT_PULLUP (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)
151#define PIN_SLPM_INPUT_NOPULL (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)
152#define PIN_SLPM_OUTPUT_LOW (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)
153#define PIN_SLPM_OUTPUT_HIGH (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)
154
155#define PIN_CFG_DEFAULT (0)
156
157#define PIN_CFG(num, alt) \
158 (PIN_CFG_DEFAULT |\
159 (PIN_NUM(num) | PIN_##alt))
160
161#define PIN_CFG_INPUT(num, alt, pull) \
162 (PIN_CFG_DEFAULT |\
163 (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull))
164
165#define PIN_CFG_OUTPUT(num, alt, val) \
166 (PIN_CFG_DEFAULT |\
167 (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val))
168
169extern int nmk_config_pin(pin_cfg_t cfg, bool sleep);
170extern int nmk_config_pins(pin_cfg_t *cfgs, int num);
171extern int nmk_config_pins_sleep(pin_cfg_t *cfgs, int num);
172
173#endif
diff --git a/arch/arm/plat-nomadik/include/plat/ste_dma40.h b/arch/arm/plat-nomadik/include/plat/ste_dma40.h
deleted file mode 100644
index 9ff93b06568..00000000000
--- a/arch/arm/plat-nomadik/include/plat/ste_dma40.h
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2007-2010
3 * Author: Per Forlin <per.forlin@stericsson.com> for ST-Ericsson
4 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8
9#ifndef STE_DMA40_H
10#define STE_DMA40_H
11
12#include <linux/dmaengine.h>
13#include <linux/scatterlist.h>
14#include <linux/workqueue.h>
15#include <linux/interrupt.h>
16
17/*
18 * Maxium size for a single dma descriptor
19 * Size is limited to 16 bits.
20 * Size is in the units of addr-widths (1,2,4,8 bytes)
21 * Larger transfers will be split up to multiple linked desc
22 */
23#define STEDMA40_MAX_SEG_SIZE 0xFFFF
24
25/* dev types for memcpy */
26#define STEDMA40_DEV_DST_MEMORY (-1)
27#define STEDMA40_DEV_SRC_MEMORY (-1)
28
29enum stedma40_mode {
30 STEDMA40_MODE_LOGICAL = 0,
31 STEDMA40_MODE_PHYSICAL,
32 STEDMA40_MODE_OPERATION,
33};
34
35enum stedma40_mode_opt {
36 STEDMA40_PCHAN_BASIC_MODE = 0,
37 STEDMA40_LCHAN_SRC_LOG_DST_LOG = 0,
38 STEDMA40_PCHAN_MODULO_MODE,
39 STEDMA40_PCHAN_DOUBLE_DST_MODE,
40 STEDMA40_LCHAN_SRC_PHY_DST_LOG,
41 STEDMA40_LCHAN_SRC_LOG_DST_PHY,
42};
43
44#define STEDMA40_ESIZE_8_BIT 0x0
45#define STEDMA40_ESIZE_16_BIT 0x1
46#define STEDMA40_ESIZE_32_BIT 0x2
47#define STEDMA40_ESIZE_64_BIT 0x3
48
49/* The value 4 indicates that PEN-reg shall be set to 0 */
50#define STEDMA40_PSIZE_PHY_1 0x4
51#define STEDMA40_PSIZE_PHY_2 0x0
52#define STEDMA40_PSIZE_PHY_4 0x1
53#define STEDMA40_PSIZE_PHY_8 0x2
54#define STEDMA40_PSIZE_PHY_16 0x3
55
56/*
57 * The number of elements differ in logical and
58 * physical mode
59 */
60#define STEDMA40_PSIZE_LOG_1 STEDMA40_PSIZE_PHY_2
61#define STEDMA40_PSIZE_LOG_4 STEDMA40_PSIZE_PHY_4
62#define STEDMA40_PSIZE_LOG_8 STEDMA40_PSIZE_PHY_8
63#define STEDMA40_PSIZE_LOG_16 STEDMA40_PSIZE_PHY_16
64
65/* Maximum number of possible physical channels */
66#define STEDMA40_MAX_PHYS 32
67
68enum stedma40_flow_ctrl {
69 STEDMA40_NO_FLOW_CTRL,
70 STEDMA40_FLOW_CTRL,
71};
72
73enum stedma40_periph_data_width {
74 STEDMA40_BYTE_WIDTH = STEDMA40_ESIZE_8_BIT,
75 STEDMA40_HALFWORD_WIDTH = STEDMA40_ESIZE_16_BIT,
76 STEDMA40_WORD_WIDTH = STEDMA40_ESIZE_32_BIT,
77 STEDMA40_DOUBLEWORD_WIDTH = STEDMA40_ESIZE_64_BIT
78};
79
80enum stedma40_xfer_dir {
81 STEDMA40_MEM_TO_MEM = 1,
82 STEDMA40_MEM_TO_PERIPH,
83 STEDMA40_PERIPH_TO_MEM,
84 STEDMA40_PERIPH_TO_PERIPH
85};
86
87
88/**
89 * struct stedma40_chan_cfg - dst/src channel configuration
90 *
91 * @big_endian: true if the src/dst should be read as big endian
92 * @data_width: Data width of the src/dst hardware
93 * @p_size: Burst size
94 * @flow_ctrl: Flow control on/off.
95 */
96struct stedma40_half_channel_info {
97 bool big_endian;
98 enum stedma40_periph_data_width data_width;
99 int psize;
100 enum stedma40_flow_ctrl flow_ctrl;
101};
102
103/**
104 * struct stedma40_chan_cfg - Structure to be filled by client drivers.
105 *
106 * @dir: MEM 2 MEM, PERIPH 2 MEM , MEM 2 PERIPH, PERIPH 2 PERIPH
107 * @high_priority: true if high-priority
108 * @realtime: true if realtime mode is to be enabled. Only available on DMA40
109 * version 3+, i.e DB8500v2+
110 * @mode: channel mode: physical, logical, or operation
111 * @mode_opt: options for the chosen channel mode
112 * @src_dev_type: Src device type
113 * @dst_dev_type: Dst device type
114 * @src_info: Parameters for dst half channel
115 * @dst_info: Parameters for dst half channel
116 * @use_fixed_channel: if true, use physical channel specified by phy_channel
117 * @phy_channel: physical channel to use, only if use_fixed_channel is true
118 *
119 * This structure has to be filled by the client drivers.
120 * It is recommended to do all dma configurations for clients in the machine.
121 *
122 */
123struct stedma40_chan_cfg {
124 enum stedma40_xfer_dir dir;
125 bool high_priority;
126 bool realtime;
127 enum stedma40_mode mode;
128 enum stedma40_mode_opt mode_opt;
129 int src_dev_type;
130 int dst_dev_type;
131 struct stedma40_half_channel_info src_info;
132 struct stedma40_half_channel_info dst_info;
133
134 bool use_fixed_channel;
135 int phy_channel;
136};
137
138/**
139 * struct stedma40_platform_data - Configuration struct for the dma device.
140 *
141 * @dev_len: length of dev_tx and dev_rx
142 * @dev_tx: mapping between destination event line and io address
143 * @dev_rx: mapping between source event line and io address
144 * @memcpy: list of memcpy event lines
145 * @memcpy_len: length of memcpy
146 * @memcpy_conf_phy: default configuration of physical channel memcpy
147 * @memcpy_conf_log: default configuration of logical channel memcpy
148 * @disabled_channels: A vector, ending with -1, that marks physical channels
149 * that are for different reasons not available for the driver.
150 */
151struct stedma40_platform_data {
152 u32 dev_len;
153 const dma_addr_t *dev_tx;
154 const dma_addr_t *dev_rx;
155 int *memcpy;
156 u32 memcpy_len;
157 struct stedma40_chan_cfg *memcpy_conf_phy;
158 struct stedma40_chan_cfg *memcpy_conf_log;
159 int disabled_channels[STEDMA40_MAX_PHYS];
160 bool use_esram_lcla;
161};
162
163#ifdef CONFIG_STE_DMA40
164
165/**
166 * stedma40_filter() - Provides stedma40_chan_cfg to the
167 * ste_dma40 dma driver via the dmaengine framework.
168 * does some checking of what's provided.
169 *
170 * Never directly called by client. It used by dmaengine.
171 * @chan: dmaengine handle.
172 * @data: Must be of type: struct stedma40_chan_cfg and is
173 * the configuration of the framework.
174 *
175 *
176 */
177
178bool stedma40_filter(struct dma_chan *chan, void *data);
179
180/**
181 * stedma40_slave_mem() - Transfers a raw data buffer to or from a slave
182 * (=device)
183 *
184 * @chan: dmaengine handle
185 * @addr: source or destination physicall address.
186 * @size: bytes to transfer
187 * @direction: direction of transfer
188 * @flags: is actually enum dma_ctrl_flags. See dmaengine.h
189 */
190
191static inline struct
192dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
193 dma_addr_t addr,
194 unsigned int size,
195 enum dma_transfer_direction direction,
196 unsigned long flags)
197{
198 struct scatterlist sg;
199 sg_init_table(&sg, 1);
200 sg.dma_address = addr;
201 sg.length = size;
202
203 return dmaengine_prep_slave_sg(chan, &sg, 1, direction, flags);
204}
205
206#else
207static inline bool stedma40_filter(struct dma_chan *chan, void *data)
208{
209 return false;
210}
211
212static inline struct
213dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
214 dma_addr_t addr,
215 unsigned int size,
216 enum dma_transfer_direction direction,
217 unsigned long flags)
218{
219 return NULL;
220}
221#endif
222
223#endif
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
deleted file mode 100644
index 9222e5522a4..00000000000
--- a/arch/arm/plat-nomadik/timer.c
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * linux/arch/arm/plat-nomadik/timer.c
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 * Copyright (C) 2010 Alessandro Rubini
6 * Copyright (C) 2010 Linus Walleij for ST-Ericsson
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2, as
10 * published by the Free Software Foundation.
11 */
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/irq.h>
15#include <linux/io.h>
16#include <linux/clockchips.h>
17#include <linux/clk.h>
18#include <linux/jiffies.h>
19#include <linux/err.h>
20#include <asm/mach/time.h>
21#include <asm/sched_clock.h>
22
23/*
24 * The MTU device hosts four different counters, with 4 set of
25 * registers. These are register names.
26 */
27
28#define MTU_IMSC 0x00 /* Interrupt mask set/clear */
29#define MTU_RIS 0x04 /* Raw interrupt status */
30#define MTU_MIS 0x08 /* Masked interrupt status */
31#define MTU_ICR 0x0C /* Interrupt clear register */
32
33/* per-timer registers take 0..3 as argument */
34#define MTU_LR(x) (0x10 + 0x10 * (x) + 0x00) /* Load value */
35#define MTU_VAL(x) (0x10 + 0x10 * (x) + 0x04) /* Current value */
36#define MTU_CR(x) (0x10 + 0x10 * (x) + 0x08) /* Control reg */
37#define MTU_BGLR(x) (0x10 + 0x10 * (x) + 0x0c) /* At next overflow */
38
39/* bits for the control register */
40#define MTU_CRn_ENA 0x80
41#define MTU_CRn_PERIODIC 0x40 /* if 0 = free-running */
42#define MTU_CRn_PRESCALE_MASK 0x0c
43#define MTU_CRn_PRESCALE_1 0x00
44#define MTU_CRn_PRESCALE_16 0x04
45#define MTU_CRn_PRESCALE_256 0x08
46#define MTU_CRn_32BITS 0x02
47#define MTU_CRn_ONESHOT 0x01 /* if 0 = wraps reloading from BGLR*/
48
49/* Other registers are usual amba/primecell registers, currently not used */
50#define MTU_ITCR 0xff0
51#define MTU_ITOP 0xff4
52
53#define MTU_PERIPH_ID0 0xfe0
54#define MTU_PERIPH_ID1 0xfe4
55#define MTU_PERIPH_ID2 0xfe8
56#define MTU_PERIPH_ID3 0xfeC
57
58#define MTU_PCELL0 0xff0
59#define MTU_PCELL1 0xff4
60#define MTU_PCELL2 0xff8
61#define MTU_PCELL3 0xffC
62
63static void __iomem *mtu_base;
64static bool clkevt_periodic;
65static u32 clk_prescale;
66static u32 nmdk_cycle; /* write-once */
67
68#ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK
69/*
70 * Override the global weak sched_clock symbol with this
71 * local implementation which uses the clocksource to get some
72 * better resolution when scheduling the kernel.
73 */
74static u32 notrace nomadik_read_sched_clock(void)
75{
76 if (unlikely(!mtu_base))
77 return 0;
78
79 return -readl(mtu_base + MTU_VAL(0));
80}
81#endif
82
83/* Clockevent device: use one-shot mode */
84static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev)
85{
86 writel(1 << 1, mtu_base + MTU_IMSC);
87 writel(evt, mtu_base + MTU_LR(1));
88 /* Load highest value, enable device, enable interrupts */
89 writel(MTU_CRn_ONESHOT | clk_prescale |
90 MTU_CRn_32BITS | MTU_CRn_ENA,
91 mtu_base + MTU_CR(1));
92
93 return 0;
94}
95
96void nmdk_clkevt_reset(void)
97{
98 if (clkevt_periodic) {
99 /* Timer: configure load and background-load, and fire it up */
100 writel(nmdk_cycle, mtu_base + MTU_LR(1));
101 writel(nmdk_cycle, mtu_base + MTU_BGLR(1));
102
103 writel(MTU_CRn_PERIODIC | clk_prescale |
104 MTU_CRn_32BITS | MTU_CRn_ENA,
105 mtu_base + MTU_CR(1));
106 writel(1 << 1, mtu_base + MTU_IMSC);
107 } else {
108 /* Generate an interrupt to start the clockevent again */
109 (void) nmdk_clkevt_next(nmdk_cycle, NULL);
110 }
111}
112
113static void nmdk_clkevt_mode(enum clock_event_mode mode,
114 struct clock_event_device *dev)
115{
116 switch (mode) {
117 case CLOCK_EVT_MODE_PERIODIC:
118 clkevt_periodic = true;
119 nmdk_clkevt_reset();
120 break;
121 case CLOCK_EVT_MODE_ONESHOT:
122 clkevt_periodic = false;
123 break;
124 case CLOCK_EVT_MODE_SHUTDOWN:
125 case CLOCK_EVT_MODE_UNUSED:
126 writel(0, mtu_base + MTU_IMSC);
127 /* disable timer */
128 writel(0, mtu_base + MTU_CR(1));
129 /* load some high default value */
130 writel(0xffffffff, mtu_base + MTU_LR(1));
131 break;
132 case CLOCK_EVT_MODE_RESUME:
133 break;
134 }
135}
136
137static struct clock_event_device nmdk_clkevt = {
138 .name = "mtu_1",
139 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
140 .rating = 200,
141 .set_mode = nmdk_clkevt_mode,
142 .set_next_event = nmdk_clkevt_next,
143};
144
145/*
146 * IRQ Handler for timer 1 of the MTU block.
147 */
148static irqreturn_t nmdk_timer_interrupt(int irq, void *dev_id)
149{
150 struct clock_event_device *evdev = dev_id;
151
152 writel(1 << 1, mtu_base + MTU_ICR); /* Interrupt clear reg */
153 evdev->event_handler(evdev);
154 return IRQ_HANDLED;
155}
156
157static struct irqaction nmdk_timer_irq = {
158 .name = "Nomadik Timer Tick",
159 .flags = IRQF_DISABLED | IRQF_TIMER,
160 .handler = nmdk_timer_interrupt,
161 .dev_id = &nmdk_clkevt,
162};
163
164void nmdk_clksrc_reset(void)
165{
166 /* Disable */
167 writel(0, mtu_base + MTU_CR(0));
168
169 /* ClockSource: configure load and background-load, and fire it up */
170 writel(nmdk_cycle, mtu_base + MTU_LR(0));
171 writel(nmdk_cycle, mtu_base + MTU_BGLR(0));
172
173 writel(clk_prescale | MTU_CRn_32BITS | MTU_CRn_ENA,
174 mtu_base + MTU_CR(0));
175}
176
177void __init nmdk_timer_init(void __iomem *base)
178{
179 unsigned long rate;
180 struct clk *clk0;
181
182 mtu_base = base;
183 clk0 = clk_get_sys("mtu0", NULL);
184 BUG_ON(IS_ERR(clk0));
185 BUG_ON(clk_prepare(clk0) < 0);
186 BUG_ON(clk_enable(clk0) < 0);
187
188 /*
189 * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz
190 * for ux500.
191 * Use a divide-by-16 counter if the tick rate is more than 32MHz.
192 * At 32 MHz, the timer (with 32 bit counter) can be programmed
193 * to wake-up at a max 127s a head in time. Dividing a 2.4 MHz timer
194 * with 16 gives too low timer resolution.
195 */
196 rate = clk_get_rate(clk0);
197 if (rate > 32000000) {
198 rate /= 16;
199 clk_prescale = MTU_CRn_PRESCALE_16;
200 } else {
201 clk_prescale = MTU_CRn_PRESCALE_1;
202 }
203
204 nmdk_cycle = (rate + HZ/2) / HZ;
205
206
207 /* Timer 0 is the free running clocksource */
208 nmdk_clksrc_reset();
209
210 if (clocksource_mmio_init(mtu_base + MTU_VAL(0), "mtu_0",
211 rate, 200, 32, clocksource_mmio_readl_down))
212 pr_err("timer: failed to initialize clock source %s\n",
213 "mtu_0");
214
215#ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK
216 setup_sched_clock(nomadik_read_sched_clock, 32, rate);
217#endif
218
219 /* Timer 1 is used for events, register irq and clockevents */
220 setup_irq(IRQ_MTU0, &nmdk_timer_irq);
221 nmdk_clkevt.cpumask = cpumask_of(0);
222 clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU);
223}
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 82fcb206b5b..665870dce3c 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -154,6 +154,12 @@ config OMAP_32K_TIMER
154 intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is 154 intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
155 currently only available for OMAP16XX, 24XX, 34XX and OMAP4/5. 155 currently only available for OMAP16XX, 24XX, 34XX and OMAP4/5.
156 156
157 On OMAP2PLUS this value is only used for CONFIG_HZ and
158 CLOCK_TICK_RATE compile time calculation.
159 The actual timer selection is done in the board file
160 through the (DT_)MACHINE_START structure.
161
162
157config OMAP3_L2_AUX_SECURE_SAVE_RESTORE 163config OMAP3_L2_AUX_SECURE_SAVE_RESTORE
158 bool "OMAP3 HS/EMU save and restore for L2 AUX control register" 164 bool "OMAP3 HS/EMU save and restore for L2 AUX control register"
159 depends on ARCH_OMAP3 && PM 165 depends on ARCH_OMAP3 && PM
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index dacaee009a4..8d885848600 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -3,13 +3,12 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := common.o sram.o clock.o dma.o fb.o counter_32k.o 6obj-y := sram.o dma.o fb.o counter_32k.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
10 10
11# omap_device support (OMAP2+ only at the moment) 11# omap_device support (OMAP2+ only at the moment)
12obj-$(CONFIG_ARCH_OMAP2PLUS) += omap_device.o
13 12
14obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o 13obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
15obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o 14obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
@@ -20,4 +19,3 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
20# OMAP mailbox framework 19# OMAP mailbox framework
21obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o 20obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
22 21
23obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
deleted file mode 100644
index 9d7ac20ef8f..00000000000
--- a/arch/arm/plat-omap/clock.c
+++ /dev/null
@@ -1,544 +0,0 @@
1/*
2 * linux/arch/arm/plat-omap/clock.c
3 *
4 * Copyright (C) 2004 - 2008 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 *
7 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/export.h>
18#include <linux/err.h>
19#include <linux/string.h>
20#include <linux/clk.h>
21#include <linux/mutex.h>
22#include <linux/cpufreq.h>
23#include <linux/io.h>
24
25#include <plat/clock.h>
26
27static LIST_HEAD(clocks);
28static DEFINE_MUTEX(clocks_mutex);
29static DEFINE_SPINLOCK(clockfw_lock);
30
31static struct clk_functions *arch_clock;
32
33/*
34 * Standard clock functions defined in include/linux/clk.h
35 */
36
37int clk_enable(struct clk *clk)
38{
39 unsigned long flags;
40 int ret;
41
42 if (clk == NULL || IS_ERR(clk))
43 return -EINVAL;
44
45 if (!arch_clock || !arch_clock->clk_enable)
46 return -EINVAL;
47
48 spin_lock_irqsave(&clockfw_lock, flags);
49 ret = arch_clock->clk_enable(clk);
50 spin_unlock_irqrestore(&clockfw_lock, flags);
51
52 return ret;
53}
54EXPORT_SYMBOL(clk_enable);
55
56void clk_disable(struct clk *clk)
57{
58 unsigned long flags;
59
60 if (clk == NULL || IS_ERR(clk))
61 return;
62
63 if (!arch_clock || !arch_clock->clk_disable)
64 return;
65
66 spin_lock_irqsave(&clockfw_lock, flags);
67 if (clk->usecount == 0) {
68 pr_err("Trying disable clock %s with 0 usecount\n",
69 clk->name);
70 WARN_ON(1);
71 goto out;
72 }
73
74 arch_clock->clk_disable(clk);
75
76out:
77 spin_unlock_irqrestore(&clockfw_lock, flags);
78}
79EXPORT_SYMBOL(clk_disable);
80
81unsigned long clk_get_rate(struct clk *clk)
82{
83 unsigned long flags;
84 unsigned long ret;
85
86 if (clk == NULL || IS_ERR(clk))
87 return 0;
88
89 spin_lock_irqsave(&clockfw_lock, flags);
90 ret = clk->rate;
91 spin_unlock_irqrestore(&clockfw_lock, flags);
92
93 return ret;
94}
95EXPORT_SYMBOL(clk_get_rate);
96
97/*
98 * Optional clock functions defined in include/linux/clk.h
99 */
100
101long clk_round_rate(struct clk *clk, unsigned long rate)
102{
103 unsigned long flags;
104 long ret;
105
106 if (clk == NULL || IS_ERR(clk))
107 return 0;
108
109 if (!arch_clock || !arch_clock->clk_round_rate)
110 return 0;
111
112 spin_lock_irqsave(&clockfw_lock, flags);
113 ret = arch_clock->clk_round_rate(clk, rate);
114 spin_unlock_irqrestore(&clockfw_lock, flags);
115
116 return ret;
117}
118EXPORT_SYMBOL(clk_round_rate);
119
120int clk_set_rate(struct clk *clk, unsigned long rate)
121{
122 unsigned long flags;
123 int ret = -EINVAL;
124
125 if (clk == NULL || IS_ERR(clk))
126 return ret;
127
128 if (!arch_clock || !arch_clock->clk_set_rate)
129 return ret;
130
131 spin_lock_irqsave(&clockfw_lock, flags);
132 ret = arch_clock->clk_set_rate(clk, rate);
133 if (ret == 0)
134 propagate_rate(clk);
135 spin_unlock_irqrestore(&clockfw_lock, flags);
136
137 return ret;
138}
139EXPORT_SYMBOL(clk_set_rate);
140
141int clk_set_parent(struct clk *clk, struct clk *parent)
142{
143 unsigned long flags;
144 int ret = -EINVAL;
145
146 if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
147 return ret;
148
149 if (!arch_clock || !arch_clock->clk_set_parent)
150 return ret;
151
152 spin_lock_irqsave(&clockfw_lock, flags);
153 if (clk->usecount == 0) {
154 ret = arch_clock->clk_set_parent(clk, parent);
155 if (ret == 0)
156 propagate_rate(clk);
157 } else
158 ret = -EBUSY;
159 spin_unlock_irqrestore(&clockfw_lock, flags);
160
161 return ret;
162}
163EXPORT_SYMBOL(clk_set_parent);
164
165struct clk *clk_get_parent(struct clk *clk)
166{
167 return clk->parent;
168}
169EXPORT_SYMBOL(clk_get_parent);
170
171/*
172 * OMAP specific clock functions shared between omap1 and omap2
173 */
174
175int __initdata mpurate;
176
177/*
178 * By default we use the rate set by the bootloader.
179 * You can override this with mpurate= cmdline option.
180 */
181static int __init omap_clk_setup(char *str)
182{
183 get_option(&str, &mpurate);
184
185 if (!mpurate)
186 return 1;
187
188 if (mpurate < 1000)
189 mpurate *= 1000000;
190
191 return 1;
192}
193__setup("mpurate=", omap_clk_setup);
194
195/* Used for clocks that always have same value as the parent clock */
196unsigned long followparent_recalc(struct clk *clk)
197{
198 return clk->parent->rate;
199}
200
201/*
202 * Used for clocks that have the same value as the parent clock,
203 * divided by some factor
204 */
205unsigned long omap_fixed_divisor_recalc(struct clk *clk)
206{
207 WARN_ON(!clk->fixed_div);
208
209 return clk->parent->rate / clk->fixed_div;
210}
211
212void clk_reparent(struct clk *child, struct clk *parent)
213{
214 list_del_init(&child->sibling);
215 if (parent)
216 list_add(&child->sibling, &parent->children);
217 child->parent = parent;
218
219 /* now do the debugfs renaming to reattach the child
220 to the proper parent */
221}
222
223/* Propagate rate to children */
224void propagate_rate(struct clk *tclk)
225{
226 struct clk *clkp;
227
228 list_for_each_entry(clkp, &tclk->children, sibling) {
229 if (clkp->recalc)
230 clkp->rate = clkp->recalc(clkp);
231 propagate_rate(clkp);
232 }
233}
234
235static LIST_HEAD(root_clks);
236
237/**
238 * recalculate_root_clocks - recalculate and propagate all root clocks
239 *
240 * Recalculates all root clocks (clocks with no parent), which if the
241 * clock's .recalc is set correctly, should also propagate their rates.
242 * Called at init.
243 */
244void recalculate_root_clocks(void)
245{
246 struct clk *clkp;
247
248 list_for_each_entry(clkp, &root_clks, sibling) {
249 if (clkp->recalc)
250 clkp->rate = clkp->recalc(clkp);
251 propagate_rate(clkp);
252 }
253}
254
255/**
256 * clk_preinit - initialize any fields in the struct clk before clk init
257 * @clk: struct clk * to initialize
258 *
259 * Initialize any struct clk fields needed before normal clk initialization
260 * can run. No return value.
261 */
262void clk_preinit(struct clk *clk)
263{
264 INIT_LIST_HEAD(&clk->children);
265}
266
267int clk_register(struct clk *clk)
268{
269 if (clk == NULL || IS_ERR(clk))
270 return -EINVAL;
271
272 /*
273 * trap out already registered clocks
274 */
275 if (clk->node.next || clk->node.prev)
276 return 0;
277
278 mutex_lock(&clocks_mutex);
279 if (clk->parent)
280 list_add(&clk->sibling, &clk->parent->children);
281 else
282 list_add(&clk->sibling, &root_clks);
283
284 list_add(&clk->node, &clocks);
285 if (clk->init)
286 clk->init(clk);
287 mutex_unlock(&clocks_mutex);
288
289 return 0;
290}
291EXPORT_SYMBOL(clk_register);
292
293void clk_unregister(struct clk *clk)
294{
295 if (clk == NULL || IS_ERR(clk))
296 return;
297
298 mutex_lock(&clocks_mutex);
299 list_del(&clk->sibling);
300 list_del(&clk->node);
301 mutex_unlock(&clocks_mutex);
302}
303EXPORT_SYMBOL(clk_unregister);
304
305void clk_enable_init_clocks(void)
306{
307 struct clk *clkp;
308
309 list_for_each_entry(clkp, &clocks, node) {
310 if (clkp->flags & ENABLE_ON_INIT)
311 clk_enable(clkp);
312 }
313}
314
315int omap_clk_enable_autoidle_all(void)
316{
317 struct clk *c;
318 unsigned long flags;
319
320 spin_lock_irqsave(&clockfw_lock, flags);
321
322 list_for_each_entry(c, &clocks, node)
323 if (c->ops->allow_idle)
324 c->ops->allow_idle(c);
325
326 spin_unlock_irqrestore(&clockfw_lock, flags);
327
328 return 0;
329}
330
331int omap_clk_disable_autoidle_all(void)
332{
333 struct clk *c;
334 unsigned long flags;
335
336 spin_lock_irqsave(&clockfw_lock, flags);
337
338 list_for_each_entry(c, &clocks, node)
339 if (c->ops->deny_idle)
340 c->ops->deny_idle(c);
341
342 spin_unlock_irqrestore(&clockfw_lock, flags);
343
344 return 0;
345}
346
347/*
348 * Low level helpers
349 */
350static int clkll_enable_null(struct clk *clk)
351{
352 return 0;
353}
354
355static void clkll_disable_null(struct clk *clk)
356{
357}
358
359const struct clkops clkops_null = {
360 .enable = clkll_enable_null,
361 .disable = clkll_disable_null,
362};
363
364/*
365 * Dummy clock
366 *
367 * Used for clock aliases that are needed on some OMAPs, but not others
368 */
369struct clk dummy_ck = {
370 .name = "dummy",
371 .ops = &clkops_null,
372};
373
374/*
375 *
376 */
377
378#ifdef CONFIG_OMAP_RESET_CLOCKS
379/*
380 * Disable any unused clocks left on by the bootloader
381 */
382static int __init clk_disable_unused(void)
383{
384 struct clk *ck;
385 unsigned long flags;
386
387 if (!arch_clock || !arch_clock->clk_disable_unused)
388 return 0;
389
390 pr_info("clock: disabling unused clocks to save power\n");
391
392 spin_lock_irqsave(&clockfw_lock, flags);
393 list_for_each_entry(ck, &clocks, node) {
394 if (ck->ops == &clkops_null)
395 continue;
396
397 if (ck->usecount > 0 || !ck->enable_reg)
398 continue;
399
400 arch_clock->clk_disable_unused(ck);
401 }
402 spin_unlock_irqrestore(&clockfw_lock, flags);
403
404 return 0;
405}
406late_initcall(clk_disable_unused);
407late_initcall(omap_clk_enable_autoidle_all);
408#endif
409
410int __init clk_init(struct clk_functions * custom_clocks)
411{
412 if (!custom_clocks) {
413 pr_err("No custom clock functions registered\n");
414 BUG();
415 }
416
417 arch_clock = custom_clocks;
418
419 return 0;
420}
421
422#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
423/*
424 * debugfs support to trace clock tree hierarchy and attributes
425 */
426
427#include <linux/debugfs.h>
428#include <linux/seq_file.h>
429
430static struct dentry *clk_debugfs_root;
431
432static int clk_dbg_show_summary(struct seq_file *s, void *unused)
433{
434 struct clk *c;
435 struct clk *pa;
436
437 mutex_lock(&clocks_mutex);
438 seq_printf(s, "%-30s %-30s %-10s %s\n",
439 "clock-name", "parent-name", "rate", "use-count");
440
441 list_for_each_entry(c, &clocks, node) {
442 pa = c->parent;
443 seq_printf(s, "%-30s %-30s %-10lu %d\n",
444 c->name, pa ? pa->name : "none", c->rate, c->usecount);
445 }
446 mutex_unlock(&clocks_mutex);
447
448 return 0;
449}
450
451static int clk_dbg_open(struct inode *inode, struct file *file)
452{
453 return single_open(file, clk_dbg_show_summary, inode->i_private);
454}
455
456static const struct file_operations debug_clock_fops = {
457 .open = clk_dbg_open,
458 .read = seq_read,
459 .llseek = seq_lseek,
460 .release = single_release,
461};
462
463static int clk_debugfs_register_one(struct clk *c)
464{
465 int err;
466 struct dentry *d;
467 struct clk *pa = c->parent;
468
469 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
470 if (!d)
471 return -ENOMEM;
472 c->dent = d;
473
474 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
475 if (!d) {
476 err = -ENOMEM;
477 goto err_out;
478 }
479 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
480 if (!d) {
481 err = -ENOMEM;
482 goto err_out;
483 }
484 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
485 if (!d) {
486 err = -ENOMEM;
487 goto err_out;
488 }
489 return 0;
490
491err_out:
492 debugfs_remove_recursive(c->dent);
493 return err;
494}
495
496static int clk_debugfs_register(struct clk *c)
497{
498 int err;
499 struct clk *pa = c->parent;
500
501 if (pa && !pa->dent) {
502 err = clk_debugfs_register(pa);
503 if (err)
504 return err;
505 }
506
507 if (!c->dent) {
508 err = clk_debugfs_register_one(c);
509 if (err)
510 return err;
511 }
512 return 0;
513}
514
515static int __init clk_debugfs_init(void)
516{
517 struct clk *c;
518 struct dentry *d;
519 int err;
520
521 d = debugfs_create_dir("clock", NULL);
522 if (!d)
523 return -ENOMEM;
524 clk_debugfs_root = d;
525
526 list_for_each_entry(c, &clocks, node) {
527 err = clk_debugfs_register(c);
528 if (err)
529 goto err_out;
530 }
531
532 d = debugfs_create_file("summary", S_IRUGO,
533 d, NULL, &debug_clock_fops);
534 if (!d)
535 return -ENOMEM;
536
537 return 0;
538err_out:
539 debugfs_remove_recursive(clk_debugfs_root);
540 return err;
541}
542late_initcall(clk_debugfs_init);
543
544#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
deleted file mode 100644
index 111315a6935..00000000000
--- a/arch/arm/plat-omap/common.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/arch/arm/plat-omap/common.c
3 *
4 * Code common to all OMAP machines.
5 * The file is created by Tony Lindgren <tony@atomide.com>
6 *
7 * Copyright (C) 2009 Texas Instruments
8 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/io.h>
17#include <linux/dma-mapping.h>
18
19#include <plat/common.h>
20#include <plat/vram.h>
21#include <linux/platform_data/dsp-omap.h>
22#include <plat/dma.h>
23
24#include <plat/omap-secure.h>
25
26void __init omap_reserve(void)
27{
28 omap_vram_reserve_sdram_memblock();
29 omap_dsp_reserve_sdram_memblock();
30 omap_secure_ram_reserve_memblock();
31 omap_barrier_reserve_memblock();
32}
33
34void __init omap_init_consistent_dma_size(void)
35{
36#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
37 init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20);
38#endif
39}
40
41/*
42 * Stub function for OMAP2 so that common files
43 * continue to build when custom builds are used
44 */
45int __weak omap_secure_ram_reserve_memblock(void)
46{
47 return 0;
48}
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 87ba8dd0d79..f3771cdb983 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -22,9 +22,6 @@
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23#include <asm/sched_clock.h> 23#include <asm/sched_clock.h>
24 24
25#include <plat/common.h>
26#include <plat/clock.h>
27
28/* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */ 25/* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */
29#define OMAP2_32KSYNCNT_REV_OFF 0x0 26#define OMAP2_32KSYNCNT_REV_OFF 0x0
30#define OMAP2_32KSYNCNT_REV_SCHEME (0x3 << 30) 27#define OMAP2_32KSYNCNT_REV_SCHEME (0x3 << 30)
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
index 5a4678edd65..a609e216181 100644
--- a/arch/arm/plat-omap/debug-devices.c
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -15,8 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17 17
18#include <mach/hardware.h> 18#include <plat/debug-devices.h>
19#include "../mach-omap2/debug-devices.h"
20 19
21/* Many OMAP development platforms reuse the same "debug board"; these 20/* Many OMAP development platforms reuse the same "debug board"; these
22 * platforms include H2, H3, H4, and Perseus2. 21 * platforms include H2, H3, H4, and Perseus2.
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index ea29bbe8e5c..aa7ebc6bcd6 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -17,16 +17,33 @@
17#include <linux/platform_data/gpio-omap.h> 17#include <linux/platform_data/gpio-omap.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19 19
20#include <mach/hardware.h>
21#include <asm/mach-types.h> 20#include <asm/mach-types.h>
22 21
23#include <plat/fpga.h>
24
25/* Many OMAP development platforms reuse the same "debug board"; these 22/* Many OMAP development platforms reuse the same "debug board"; these
26 * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the 23 * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the
27 * debug board (all green), accessed through FPGA registers. 24 * debug board (all green), accessed through FPGA registers.
28 */ 25 */
29 26
27/* NOTE: most boards don't have a static mapping for the FPGA ... */
28struct h2p2_dbg_fpga {
29 /* offset 0x00 */
30 u16 smc91x[8];
31 /* offset 0x10 */
32 u16 fpga_rev;
33 u16 board_rev;
34 u16 gpio_outputs;
35 u16 leds;
36 /* offset 0x18 */
37 u16 misc_inputs;
38 u16 lan_status;
39 u16 lan_reset;
40 u16 reserved0;
41 /* offset 0x20 */
42 u16 ps2_data;
43 u16 ps2_ctrl;
44 /* plus also 4 rs232 ports ... */
45};
46
30static struct h2p2_dbg_fpga __iomem *fpga; 47static struct h2p2_dbg_fpga __iomem *fpga;
31 48
32static u16 fpga_led_state; 49static u16 fpga_led_state;
@@ -94,7 +111,7 @@ static int fpga_probe(struct platform_device *pdev)
94 if (!iomem) 111 if (!iomem)
95 return -ENODEV; 112 return -ENODEV;
96 113
97 fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); 114 fpga = ioremap(iomem->start, resource_size(iomem));
98 __raw_writew(0xff, &fpga->leds); 115 __raw_writew(0xff, &fpga->leds);
99 116
100 for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) { 117 for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) {
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index c76ed8bff83..37a488aaa2b 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -36,9 +36,7 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38 38
39#include <plat/cpu.h> 39#include <linux/omap-dma.h>
40#include <plat/dma.h>
41#include <plat/tc.h>
42 40
43/* 41/*
44 * MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA 42 * MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA
@@ -175,12 +173,13 @@ static inline void set_gdma_dev(int req, int dev)
175#define omap_writel(val, reg) do {} while (0) 173#define omap_writel(val, reg) do {} while (0)
176#endif 174#endif
177 175
176#ifdef CONFIG_ARCH_OMAP1
178void omap_set_dma_priority(int lch, int dst_port, int priority) 177void omap_set_dma_priority(int lch, int dst_port, int priority)
179{ 178{
180 unsigned long reg; 179 unsigned long reg;
181 u32 l; 180 u32 l;
182 181
183 if (cpu_class_is_omap1()) { 182 if (dma_omap1()) {
184 switch (dst_port) { 183 switch (dst_port) {
185 case OMAP_DMA_PORT_OCP_T1: /* FFFECC00 */ 184 case OMAP_DMA_PORT_OCP_T1: /* FFFECC00 */
186 reg = OMAP_TC_OCPT1_PRIOR; 185 reg = OMAP_TC_OCPT1_PRIOR;
@@ -203,18 +202,22 @@ void omap_set_dma_priority(int lch, int dst_port, int priority)
203 l |= (priority & 0xf) << 8; 202 l |= (priority & 0xf) << 8;
204 omap_writel(l, reg); 203 omap_writel(l, reg);
205 } 204 }
205}
206#endif
206 207
207 if (cpu_class_is_omap2()) { 208#ifdef CONFIG_ARCH_OMAP2PLUS
208 u32 ccr; 209void omap_set_dma_priority(int lch, int dst_port, int priority)
210{
211 u32 ccr;
209 212
210 ccr = p->dma_read(CCR, lch); 213 ccr = p->dma_read(CCR, lch);
211 if (priority) 214 if (priority)
212 ccr |= (1 << 6); 215 ccr |= (1 << 6);
213 else 216 else
214 ccr &= ~(1 << 6); 217 ccr &= ~(1 << 6);
215 p->dma_write(ccr, CCR, lch); 218 p->dma_write(ccr, CCR, lch);
216 }
217} 219}
220#endif
218EXPORT_SYMBOL(omap_set_dma_priority); 221EXPORT_SYMBOL(omap_set_dma_priority);
219 222
220void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, 223void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
@@ -228,7 +231,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
228 l |= data_type; 231 l |= data_type;
229 p->dma_write(l, CSDP, lch); 232 p->dma_write(l, CSDP, lch);
230 233
231 if (cpu_class_is_omap1()) { 234 if (dma_omap1()) {
232 u16 ccr; 235 u16 ccr;
233 236
234 ccr = p->dma_read(CCR, lch); 237 ccr = p->dma_read(CCR, lch);
@@ -244,7 +247,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
244 p->dma_write(ccr, CCR2, lch); 247 p->dma_write(ccr, CCR2, lch);
245 } 248 }
246 249
247 if (cpu_class_is_omap2() && dma_trigger) { 250 if (dma_omap2plus() && dma_trigger) {
248 u32 val; 251 u32 val;
249 252
250 val = p->dma_read(CCR, lch); 253 val = p->dma_read(CCR, lch);
@@ -284,7 +287,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
284{ 287{
285 BUG_ON(omap_dma_in_1510_mode()); 288 BUG_ON(omap_dma_in_1510_mode());
286 289
287 if (cpu_class_is_omap1()) { 290 if (dma_omap1()) {
288 u16 w; 291 u16 w;
289 292
290 w = p->dma_read(CCR2, lch); 293 w = p->dma_read(CCR2, lch);
@@ -314,7 +317,7 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
314 p->dma_write(w, LCH_CTRL, lch); 317 p->dma_write(w, LCH_CTRL, lch);
315 } 318 }
316 319
317 if (cpu_class_is_omap2()) { 320 if (dma_omap2plus()) {
318 u32 val; 321 u32 val;
319 322
320 val = p->dma_read(CCR, lch); 323 val = p->dma_read(CCR, lch);
@@ -342,7 +345,7 @@ EXPORT_SYMBOL(omap_set_dma_color_mode);
342 345
343void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) 346void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode)
344{ 347{
345 if (cpu_class_is_omap2()) { 348 if (dma_omap2plus()) {
346 u32 csdp; 349 u32 csdp;
347 350
348 csdp = p->dma_read(CSDP, lch); 351 csdp = p->dma_read(CSDP, lch);
@@ -355,7 +358,7 @@ EXPORT_SYMBOL(omap_set_dma_write_mode);
355 358
356void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode) 359void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode)
357{ 360{
358 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) { 361 if (dma_omap1() && !dma_omap15xx()) {
359 u32 l; 362 u32 l;
360 363
361 l = p->dma_read(LCH_CTRL, lch); 364 l = p->dma_read(LCH_CTRL, lch);
@@ -373,7 +376,7 @@ void omap_set_dma_src_params(int lch, int src_port, int src_amode,
373{ 376{
374 u32 l; 377 u32 l;
375 378
376 if (cpu_class_is_omap1()) { 379 if (dma_omap1()) {
377 u16 w; 380 u16 w;
378 381
379 w = p->dma_read(CSDP, lch); 382 w = p->dma_read(CSDP, lch);
@@ -415,7 +418,7 @@ EXPORT_SYMBOL(omap_set_dma_params);
415 418
416void omap_set_dma_src_index(int lch, int eidx, int fidx) 419void omap_set_dma_src_index(int lch, int eidx, int fidx)
417{ 420{
418 if (cpu_class_is_omap2()) 421 if (dma_omap2plus())
419 return; 422 return;
420 423
421 p->dma_write(eidx, CSEI, lch); 424 p->dma_write(eidx, CSEI, lch);
@@ -447,13 +450,13 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
447 case OMAP_DMA_DATA_BURST_DIS: 450 case OMAP_DMA_DATA_BURST_DIS:
448 break; 451 break;
449 case OMAP_DMA_DATA_BURST_4: 452 case OMAP_DMA_DATA_BURST_4:
450 if (cpu_class_is_omap2()) 453 if (dma_omap2plus())
451 burst = 0x1; 454 burst = 0x1;
452 else 455 else
453 burst = 0x2; 456 burst = 0x2;
454 break; 457 break;
455 case OMAP_DMA_DATA_BURST_8: 458 case OMAP_DMA_DATA_BURST_8:
456 if (cpu_class_is_omap2()) { 459 if (dma_omap2plus()) {
457 burst = 0x2; 460 burst = 0x2;
458 break; 461 break;
459 } 462 }
@@ -463,7 +466,7 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
463 * fall through 466 * fall through
464 */ 467 */
465 case OMAP_DMA_DATA_BURST_16: 468 case OMAP_DMA_DATA_BURST_16:
466 if (cpu_class_is_omap2()) { 469 if (dma_omap2plus()) {
467 burst = 0x3; 470 burst = 0x3;
468 break; 471 break;
469 } 472 }
@@ -487,7 +490,7 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
487{ 490{
488 u32 l; 491 u32 l;
489 492
490 if (cpu_class_is_omap1()) { 493 if (dma_omap1()) {
491 l = p->dma_read(CSDP, lch); 494 l = p->dma_read(CSDP, lch);
492 l &= ~(0x1f << 9); 495 l &= ~(0x1f << 9);
493 l |= dest_port << 9; 496 l |= dest_port << 9;
@@ -508,7 +511,7 @@ EXPORT_SYMBOL(omap_set_dma_dest_params);
508 511
509void omap_set_dma_dest_index(int lch, int eidx, int fidx) 512void omap_set_dma_dest_index(int lch, int eidx, int fidx)
510{ 513{
511 if (cpu_class_is_omap2()) 514 if (dma_omap2plus())
512 return; 515 return;
513 516
514 p->dma_write(eidx, CDEI, lch); 517 p->dma_write(eidx, CDEI, lch);
@@ -540,19 +543,19 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
540 case OMAP_DMA_DATA_BURST_DIS: 543 case OMAP_DMA_DATA_BURST_DIS:
541 break; 544 break;
542 case OMAP_DMA_DATA_BURST_4: 545 case OMAP_DMA_DATA_BURST_4:
543 if (cpu_class_is_omap2()) 546 if (dma_omap2plus())
544 burst = 0x1; 547 burst = 0x1;
545 else 548 else
546 burst = 0x2; 549 burst = 0x2;
547 break; 550 break;
548 case OMAP_DMA_DATA_BURST_8: 551 case OMAP_DMA_DATA_BURST_8:
549 if (cpu_class_is_omap2()) 552 if (dma_omap2plus())
550 burst = 0x2; 553 burst = 0x2;
551 else 554 else
552 burst = 0x3; 555 burst = 0x3;
553 break; 556 break;
554 case OMAP_DMA_DATA_BURST_16: 557 case OMAP_DMA_DATA_BURST_16:
555 if (cpu_class_is_omap2()) { 558 if (dma_omap2plus()) {
556 burst = 0x3; 559 burst = 0x3;
557 break; 560 break;
558 } 561 }
@@ -573,7 +576,7 @@ EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
573static inline void omap_enable_channel_irq(int lch) 576static inline void omap_enable_channel_irq(int lch)
574{ 577{
575 /* Clear CSR */ 578 /* Clear CSR */
576 if (cpu_class_is_omap1()) 579 if (dma_omap1())
577 p->dma_read(CSR, lch); 580 p->dma_read(CSR, lch);
578 else 581 else
579 p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch); 582 p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch);
@@ -587,7 +590,7 @@ static inline void omap_disable_channel_irq(int lch)
587 /* disable channel interrupts */ 590 /* disable channel interrupts */
588 p->dma_write(0, CICR, lch); 591 p->dma_write(0, CICR, lch);
589 /* Clear CSR */ 592 /* Clear CSR */
590 if (cpu_class_is_omap1()) 593 if (dma_omap1())
591 p->dma_read(CSR, lch); 594 p->dma_read(CSR, lch);
592 else 595 else
593 p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch); 596 p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch);
@@ -611,7 +614,7 @@ static inline void enable_lnk(int lch)
611 614
612 l = p->dma_read(CLNK_CTRL, lch); 615 l = p->dma_read(CLNK_CTRL, lch);
613 616
614 if (cpu_class_is_omap1()) 617 if (dma_omap1())
615 l &= ~(1 << 14); 618 l &= ~(1 << 14);
616 619
617 /* Set the ENABLE_LNK bits */ 620 /* Set the ENABLE_LNK bits */
@@ -619,7 +622,7 @@ static inline void enable_lnk(int lch)
619 l = dma_chan[lch].next_lch | (1 << 15); 622 l = dma_chan[lch].next_lch | (1 << 15);
620 623
621#ifndef CONFIG_ARCH_OMAP1 624#ifndef CONFIG_ARCH_OMAP1
622 if (cpu_class_is_omap2()) 625 if (dma_omap2plus())
623 if (dma_chan[lch].next_linked_ch != -1) 626 if (dma_chan[lch].next_linked_ch != -1)
624 l = dma_chan[lch].next_linked_ch | (1 << 15); 627 l = dma_chan[lch].next_linked_ch | (1 << 15);
625#endif 628#endif
@@ -636,12 +639,12 @@ static inline void disable_lnk(int lch)
636 /* Disable interrupts */ 639 /* Disable interrupts */
637 omap_disable_channel_irq(lch); 640 omap_disable_channel_irq(lch);
638 641
639 if (cpu_class_is_omap1()) { 642 if (dma_omap1()) {
640 /* Set the STOP_LNK bit */ 643 /* Set the STOP_LNK bit */
641 l |= 1 << 14; 644 l |= 1 << 14;
642 } 645 }
643 646
644 if (cpu_class_is_omap2()) { 647 if (dma_omap2plus()) {
645 /* Clear the ENABLE_LNK bit */ 648 /* Clear the ENABLE_LNK bit */
646 l &= ~(1 << 15); 649 l &= ~(1 << 15);
647 } 650 }
@@ -655,7 +658,7 @@ static inline void omap2_enable_irq_lch(int lch)
655 u32 val; 658 u32 val;
656 unsigned long flags; 659 unsigned long flags;
657 660
658 if (!cpu_class_is_omap2()) 661 if (dma_omap1())
659 return; 662 return;
660 663
661 spin_lock_irqsave(&dma_chan_lock, flags); 664 spin_lock_irqsave(&dma_chan_lock, flags);
@@ -673,7 +676,7 @@ static inline void omap2_disable_irq_lch(int lch)
673 u32 val; 676 u32 val;
674 unsigned long flags; 677 unsigned long flags;
675 678
676 if (!cpu_class_is_omap2()) 679 if (dma_omap1())
677 return; 680 return;
678 681
679 spin_lock_irqsave(&dma_chan_lock, flags); 682 spin_lock_irqsave(&dma_chan_lock, flags);
@@ -712,7 +715,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
712 if (p->clear_lch_regs) 715 if (p->clear_lch_regs)
713 p->clear_lch_regs(free_ch); 716 p->clear_lch_regs(free_ch);
714 717
715 if (cpu_class_is_omap2()) 718 if (dma_omap2plus())
716 omap_clear_dma(free_ch); 719 omap_clear_dma(free_ch);
717 720
718 spin_unlock_irqrestore(&dma_chan_lock, flags); 721 spin_unlock_irqrestore(&dma_chan_lock, flags);
@@ -723,7 +726,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
723 chan->flags = 0; 726 chan->flags = 0;
724 727
725#ifndef CONFIG_ARCH_OMAP1 728#ifndef CONFIG_ARCH_OMAP1
726 if (cpu_class_is_omap2()) { 729 if (dma_omap2plus()) {
727 chan->chain_id = -1; 730 chan->chain_id = -1;
728 chan->next_linked_ch = -1; 731 chan->next_linked_ch = -1;
729 } 732 }
@@ -731,13 +734,13 @@ int omap_request_dma(int dev_id, const char *dev_name,
731 734
732 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; 735 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
733 736
734 if (cpu_class_is_omap1()) 737 if (dma_omap1())
735 chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ; 738 chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ;
736 else if (cpu_class_is_omap2()) 739 else if (dma_omap2plus())
737 chan->enabled_irqs |= OMAP2_DMA_MISALIGNED_ERR_IRQ | 740 chan->enabled_irqs |= OMAP2_DMA_MISALIGNED_ERR_IRQ |
738 OMAP2_DMA_TRANS_ERR_IRQ; 741 OMAP2_DMA_TRANS_ERR_IRQ;
739 742
740 if (cpu_is_omap16xx()) { 743 if (dma_omap16xx()) {
741 /* If the sync device is set, configure it dynamically. */ 744 /* If the sync device is set, configure it dynamically. */
742 if (dev_id != 0) { 745 if (dev_id != 0) {
743 set_gdma_dev(free_ch + 1, dev_id); 746 set_gdma_dev(free_ch + 1, dev_id);
@@ -748,11 +751,11 @@ int omap_request_dma(int dev_id, const char *dev_name,
748 * id. 751 * id.
749 */ 752 */
750 p->dma_write(dev_id | (1 << 10), CCR, free_ch); 753 p->dma_write(dev_id | (1 << 10), CCR, free_ch);
751 } else if (cpu_is_omap7xx() || cpu_is_omap15xx()) { 754 } else if (dma_omap1()) {
752 p->dma_write(dev_id, CCR, free_ch); 755 p->dma_write(dev_id, CCR, free_ch);
753 } 756 }
754 757
755 if (cpu_class_is_omap2()) { 758 if (dma_omap2plus()) {
756 omap_enable_channel_irq(free_ch); 759 omap_enable_channel_irq(free_ch);
757 omap2_enable_irq_lch(free_ch); 760 omap2_enable_irq_lch(free_ch);
758 } 761 }
@@ -774,7 +777,7 @@ void omap_free_dma(int lch)
774 } 777 }
775 778
776 /* Disable interrupt for logical channel */ 779 /* Disable interrupt for logical channel */
777 if (cpu_class_is_omap2()) 780 if (dma_omap2plus())
778 omap2_disable_irq_lch(lch); 781 omap2_disable_irq_lch(lch);
779 782
780 /* Disable all DMA interrupts for the channel. */ 783 /* Disable all DMA interrupts for the channel. */
@@ -784,7 +787,7 @@ void omap_free_dma(int lch)
784 p->dma_write(0, CCR, lch); 787 p->dma_write(0, CCR, lch);
785 788
786 /* Clear registers */ 789 /* Clear registers */
787 if (cpu_class_is_omap2()) 790 if (dma_omap2plus())
788 omap_clear_dma(lch); 791 omap_clear_dma(lch);
789 792
790 spin_lock_irqsave(&dma_chan_lock, flags); 793 spin_lock_irqsave(&dma_chan_lock, flags);
@@ -810,7 +813,7 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
810{ 813{
811 u32 reg; 814 u32 reg;
812 815
813 if (!cpu_class_is_omap2()) { 816 if (dma_omap1()) {
814 printk(KERN_ERR "FIXME: no %s on 15xx/16xx\n", __func__); 817 printk(KERN_ERR "FIXME: no %s on 15xx/16xx\n", __func__);
815 return; 818 return;
816 } 819 }
@@ -849,7 +852,7 @@ omap_dma_set_prio_lch(int lch, unsigned char read_prio,
849 } 852 }
850 l = p->dma_read(CCR, lch); 853 l = p->dma_read(CCR, lch);
851 l &= ~((1 << 6) | (1 << 26)); 854 l &= ~((1 << 6) | (1 << 26));
852 if (cpu_class_is_omap2() && !cpu_is_omap242x()) 855 if (d->dev_caps & IS_RW_PRIORITY)
853 l |= ((read_prio & 0x1) << 6) | ((write_prio & 0x1) << 26); 856 l |= ((read_prio & 0x1) << 6) | ((write_prio & 0x1) << 26);
854 else 857 else
855 l |= ((read_prio & 0x1) << 6); 858 l |= ((read_prio & 0x1) << 6);
@@ -882,7 +885,7 @@ void omap_start_dma(int lch)
882 * The CPC/CDAC register needs to be initialized to zero 885 * The CPC/CDAC register needs to be initialized to zero
883 * before starting dma transfer. 886 * before starting dma transfer.
884 */ 887 */
885 if (cpu_is_omap15xx()) 888 if (dma_omap15xx())
886 p->dma_write(0, CPC, lch); 889 p->dma_write(0, CPC, lch);
887 else 890 else
888 p->dma_write(0, CDAC, lch); 891 p->dma_write(0, CDAC, lch);
@@ -1045,7 +1048,7 @@ dma_addr_t omap_get_dma_src_pos(int lch)
1045{ 1048{
1046 dma_addr_t offset = 0; 1049 dma_addr_t offset = 0;
1047 1050
1048 if (cpu_is_omap15xx()) 1051 if (dma_omap15xx())
1049 offset = p->dma_read(CPC, lch); 1052 offset = p->dma_read(CPC, lch);
1050 else 1053 else
1051 offset = p->dma_read(CSAC, lch); 1054 offset = p->dma_read(CSAC, lch);
@@ -1053,7 +1056,7 @@ dma_addr_t omap_get_dma_src_pos(int lch)
1053 if (IS_DMA_ERRATA(DMA_ERRATA_3_3) && offset == 0) 1056 if (IS_DMA_ERRATA(DMA_ERRATA_3_3) && offset == 0)
1054 offset = p->dma_read(CSAC, lch); 1057 offset = p->dma_read(CSAC, lch);
1055 1058
1056 if (!cpu_is_omap15xx()) { 1059 if (!dma_omap15xx()) {
1057 /* 1060 /*
1058 * CDAC == 0 indicates that the DMA transfer on the channel has 1061 * CDAC == 0 indicates that the DMA transfer on the channel has
1059 * not been started (no data has been transferred so far). 1062 * not been started (no data has been transferred so far).
@@ -1065,7 +1068,7 @@ dma_addr_t omap_get_dma_src_pos(int lch)
1065 offset = p->dma_read(CSSA, lch); 1068 offset = p->dma_read(CSSA, lch);
1066 } 1069 }
1067 1070
1068 if (cpu_class_is_omap1()) 1071 if (dma_omap1())
1069 offset |= (p->dma_read(CSSA, lch) & 0xFFFF0000); 1072 offset |= (p->dma_read(CSSA, lch) & 0xFFFF0000);
1070 1073
1071 return offset; 1074 return offset;
@@ -1084,7 +1087,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
1084{ 1087{
1085 dma_addr_t offset = 0; 1088 dma_addr_t offset = 0;
1086 1089
1087 if (cpu_is_omap15xx()) 1090 if (dma_omap15xx())
1088 offset = p->dma_read(CPC, lch); 1091 offset = p->dma_read(CPC, lch);
1089 else 1092 else
1090 offset = p->dma_read(CDAC, lch); 1093 offset = p->dma_read(CDAC, lch);
@@ -1093,7 +1096,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
1093 * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is 1096 * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
1094 * read before the DMA controller finished disabling the channel. 1097 * read before the DMA controller finished disabling the channel.
1095 */ 1098 */
1096 if (!cpu_is_omap15xx() && offset == 0) { 1099 if (!dma_omap15xx() && offset == 0) {
1097 offset = p->dma_read(CDAC, lch); 1100 offset = p->dma_read(CDAC, lch);
1098 /* 1101 /*
1099 * CDAC == 0 indicates that the DMA transfer on the channel has 1102 * CDAC == 0 indicates that the DMA transfer on the channel has
@@ -1104,7 +1107,7 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
1104 offset = p->dma_read(CDSA, lch); 1107 offset = p->dma_read(CDSA, lch);
1105 } 1108 }
1106 1109
1107 if (cpu_class_is_omap1()) 1110 if (dma_omap1())
1108 offset |= (p->dma_read(CDSA, lch) & 0xFFFF0000); 1111 offset |= (p->dma_read(CDSA, lch) & 0xFFFF0000);
1109 1112
1110 return offset; 1113 return offset;
@@ -1121,7 +1124,7 @@ int omap_dma_running(void)
1121{ 1124{
1122 int lch; 1125 int lch;
1123 1126
1124 if (cpu_class_is_omap1()) 1127 if (dma_omap1())
1125 if (omap_lcd_dma_running()) 1128 if (omap_lcd_dma_running())
1126 return 1; 1129 return 1;
1127 1130
@@ -2024,7 +2027,7 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
2024 dma_chan = d->chan; 2027 dma_chan = d->chan;
2025 enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; 2028 enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
2026 2029
2027 if (cpu_class_is_omap2()) { 2030 if (dma_omap2plus()) {
2028 dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * 2031 dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
2029 dma_lch_count, GFP_KERNEL); 2032 dma_lch_count, GFP_KERNEL);
2030 if (!dma_linked_lch) { 2033 if (!dma_linked_lch) {
@@ -2036,7 +2039,7 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
2036 spin_lock_init(&dma_chan_lock); 2039 spin_lock_init(&dma_chan_lock);
2037 for (ch = 0; ch < dma_chan_count; ch++) { 2040 for (ch = 0; ch < dma_chan_count; ch++) {
2038 omap_clear_dma(ch); 2041 omap_clear_dma(ch);
2039 if (cpu_class_is_omap2()) 2042 if (dma_omap2plus())
2040 omap2_disable_irq_lch(ch); 2043 omap2_disable_irq_lch(ch);
2041 2044
2042 dma_chan[ch].dev_id = -1; 2045 dma_chan[ch].dev_id = -1;
@@ -2045,7 +2048,7 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
2045 if (ch >= 6 && enable_1510_mode) 2048 if (ch >= 6 && enable_1510_mode)
2046 continue; 2049 continue;
2047 2050
2048 if (cpu_class_is_omap1()) { 2051 if (dma_omap1()) {
2049 /* 2052 /*
2050 * request_irq() doesn't like dev_id (ie. ch) being 2053 * request_irq() doesn't like dev_id (ie. ch) being
2051 * zero, so we have to kludge around this. 2054 * zero, so we have to kludge around this.
@@ -2070,11 +2073,11 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
2070 } 2073 }
2071 } 2074 }
2072 2075
2073 if (cpu_class_is_omap2() && !cpu_is_omap242x()) 2076 if (d->dev_caps & IS_RW_PRIORITY)
2074 omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE, 2077 omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE,
2075 DMA_DEFAULT_FIFO_DEPTH, 0); 2078 DMA_DEFAULT_FIFO_DEPTH, 0);
2076 2079
2077 if (cpu_class_is_omap2()) { 2080 if (dma_omap2plus()) {
2078 strcpy(irq_name, "0"); 2081 strcpy(irq_name, "0");
2079 dma_irq = platform_get_irq_byname(pdev, irq_name); 2082 dma_irq = platform_get_irq_byname(pdev, irq_name);
2080 if (dma_irq < 0) { 2083 if (dma_irq < 0) {
@@ -2089,9 +2092,8 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev)
2089 } 2092 }
2090 } 2093 }
2091 2094
2092 /* reserve dma channels 0 and 1 in high security devices */ 2095 /* reserve dma channels 0 and 1 in high security devices on 34xx */
2093 if (cpu_is_omap34xx() && 2096 if (d->dev_caps & HS_CHANNELS_RESERVED) {
2094 (omap_type() != OMAP2_DEVICE_TYPE_GP)) {
2095 pr_info("Reserving DMA channels 0 and 1 for HS ROM code\n"); 2097 pr_info("Reserving DMA channels 0 and 1 for HS ROM code\n");
2096 dma_chan[0].dev_id = 0; 2098 dma_chan[0].dev_id = 0;
2097 dma_chan[1].dev_id = 1; 2099 dma_chan[1].dev_id = 1;
@@ -2118,7 +2120,7 @@ static int __devexit omap_system_dma_remove(struct platform_device *pdev)
2118{ 2120{
2119 int dma_irq; 2121 int dma_irq;
2120 2122
2121 if (cpu_class_is_omap2()) { 2123 if (dma_omap2plus()) {
2122 char irq_name[4]; 2124 char irq_name[4];
2123 strcpy(irq_name, "0"); 2125 strcpy(irq_name, "0");
2124 dma_irq = platform_get_irq_byname(pdev, irq_name); 2126 dma_irq = platform_get_irq_byname(pdev, irq_name);
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 938b50a3343..89585c29355 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -35,16 +35,18 @@
35 * 675 Mass Ave, Cambridge, MA 02139, USA. 35 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 */ 36 */
37 37
38#include <linux/clk.h>
38#include <linux/module.h> 39#include <linux/module.h>
39#include <linux/io.h> 40#include <linux/io.h>
40#include <linux/device.h> 41#include <linux/device.h>
41#include <linux/err.h> 42#include <linux/err.h>
42#include <linux/pm_runtime.h> 43#include <linux/pm_runtime.h>
44#include <linux/of.h>
45#include <linux/of_device.h>
46#include <linux/platform_device.h>
47#include <linux/platform_data/dmtimer-omap.h>
43 48
44#include <plat/dmtimer.h> 49#include <plat/dmtimer.h>
45#include <plat/omap-pm.h>
46
47#include <mach/hardware.h>
48 50
49static u32 omap_reserved_systimers; 51static u32 omap_reserved_systimers;
50static LIST_HEAD(omap_timer_list); 52static LIST_HEAD(omap_timer_list);
@@ -84,10 +86,6 @@ static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,
84 86
85static void omap_timer_restore_context(struct omap_dm_timer *timer) 87static void omap_timer_restore_context(struct omap_dm_timer *timer)
86{ 88{
87 if (timer->revision == 1)
88 __raw_writel(timer->context.tistat, timer->sys_stat);
89
90 __raw_writel(timer->context.tisr, timer->irq_stat);
91 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, 89 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG,
92 timer->context.twer); 90 timer->context.twer);
93 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, 91 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG,
@@ -103,39 +101,38 @@ static void omap_timer_restore_context(struct omap_dm_timer *timer)
103 timer->context.tclr); 101 timer->context.tclr);
104} 102}
105 103
106static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer) 104static int omap_dm_timer_reset(struct omap_dm_timer *timer)
107{ 105{
108 int c; 106 u32 l, timeout = 100000;
109 107
110 if (!timer->sys_stat) 108 if (timer->revision != 1)
111 return; 109 return -EINVAL;
112 110
113 c = 0; 111 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06);
114 while (!(__raw_readl(timer->sys_stat) & 1)) {
115 c++;
116 if (c > 100000) {
117 printk(KERN_ERR "Timer failed to reset\n");
118 return;
119 }
120 }
121}
122 112
123static void omap_dm_timer_reset(struct omap_dm_timer *timer) 113 do {
124{ 114 l = __omap_dm_timer_read(timer,
125 omap_dm_timer_enable(timer); 115 OMAP_TIMER_V1_SYS_STAT_OFFSET, 0);
126 if (timer->pdev->id != 1) { 116 } while (!l && timeout--);
127 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06); 117
128 omap_dm_timer_wait_for_reset(timer); 118 if (!timeout) {
119 dev_err(&timer->pdev->dev, "Timer failed to reset\n");
120 return -ETIMEDOUT;
129 } 121 }
130 122
131 __omap_dm_timer_reset(timer, 0, 0); 123 /* Configure timer for smart-idle mode */
132 omap_dm_timer_disable(timer); 124 l = __omap_dm_timer_read(timer, OMAP_TIMER_OCP_CFG_OFFSET, 0);
133 timer->posted = 1; 125 l |= 0x2 << 0x3;
126 __omap_dm_timer_write(timer, OMAP_TIMER_OCP_CFG_OFFSET, l, 0);
127
128 timer->posted = 0;
129
130 return 0;
134} 131}
135 132
136int omap_dm_timer_prepare(struct omap_dm_timer *timer) 133static int omap_dm_timer_prepare(struct omap_dm_timer *timer)
137{ 134{
138 int ret; 135 int rc;
139 136
140 /* 137 /*
141 * FIXME: OMAP1 devices do not use the clock framework for dmtimers so 138 * FIXME: OMAP1 devices do not use the clock framework for dmtimers so
@@ -150,13 +147,20 @@ int omap_dm_timer_prepare(struct omap_dm_timer *timer)
150 } 147 }
151 } 148 }
152 149
153 if (timer->capability & OMAP_TIMER_NEEDS_RESET) 150 omap_dm_timer_enable(timer);
154 omap_dm_timer_reset(timer);
155 151
156 ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ); 152 if (timer->capability & OMAP_TIMER_NEEDS_RESET) {
153 rc = omap_dm_timer_reset(timer);
154 if (rc) {
155 omap_dm_timer_disable(timer);
156 return rc;
157 }
158 }
157 159
158 timer->posted = 1; 160 __omap_dm_timer_enable_posted(timer);
159 return ret; 161 omap_dm_timer_disable(timer);
162
163 return omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
160} 164}
161 165
162static inline u32 omap_dm_timer_reserved_systimer(int id) 166static inline u32 omap_dm_timer_reserved_systimer(int id)
@@ -212,6 +216,13 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
212 unsigned long flags; 216 unsigned long flags;
213 int ret = 0; 217 int ret = 0;
214 218
219 /* Requesting timer by ID is not supported when device tree is used */
220 if (of_have_populated_dt()) {
221 pr_warn("%s: Please use omap_dm_timer_request_by_cap()\n",
222 __func__);
223 return NULL;
224 }
225
215 spin_lock_irqsave(&dm_timer_lock, flags); 226 spin_lock_irqsave(&dm_timer_lock, flags);
216 list_for_each_entry(t, &omap_timer_list, node) { 227 list_for_each_entry(t, &omap_timer_list, node) {
217 if (t->pdev->id == id && !t->reserved) { 228 if (t->pdev->id == id && !t->reserved) {
@@ -237,6 +248,58 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
237} 248}
238EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific); 249EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific);
239 250
251/**
252 * omap_dm_timer_request_by_cap - Request a timer by capability
253 * @cap: Bit mask of capabilities to match
254 *
255 * Find a timer based upon capabilities bit mask. Callers of this function
256 * should use the definitions found in the plat/dmtimer.h file under the
257 * comment "timer capabilities used in hwmod database". Returns pointer to
258 * timer handle on success and a NULL pointer on failure.
259 */
260struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap)
261{
262 struct omap_dm_timer *timer = NULL, *t;
263 unsigned long flags;
264
265 if (!cap)
266 return NULL;
267
268 spin_lock_irqsave(&dm_timer_lock, flags);
269 list_for_each_entry(t, &omap_timer_list, node) {
270 if ((!t->reserved) && ((t->capability & cap) == cap)) {
271 /*
272 * If timer is not NULL, we have already found one timer
273 * but it was not an exact match because it had more
274 * capabilites that what was required. Therefore,
275 * unreserve the last timer found and see if this one
276 * is a better match.
277 */
278 if (timer)
279 timer->reserved = 0;
280
281 timer = t;
282 timer->reserved = 1;
283
284 /* Exit loop early if we find an exact match */
285 if (t->capability == cap)
286 break;
287 }
288 }
289 spin_unlock_irqrestore(&dm_timer_lock, flags);
290
291 if (timer && omap_dm_timer_prepare(timer)) {
292 timer->reserved = 0;
293 timer = NULL;
294 }
295
296 if (!timer)
297 pr_debug("%s: timer request failed!\n", __func__);
298
299 return timer;
300}
301EXPORT_SYMBOL_GPL(omap_dm_timer_request_by_cap);
302
240int omap_dm_timer_free(struct omap_dm_timer *timer) 303int omap_dm_timer_free(struct omap_dm_timer *timer)
241{ 304{
242 if (unlikely(!timer)) 305 if (unlikely(!timer))
@@ -271,7 +334,7 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
271EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq); 334EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
272 335
273#if defined(CONFIG_ARCH_OMAP1) 336#if defined(CONFIG_ARCH_OMAP1)
274 337#include <mach/hardware.h>
275/** 338/**
276 * omap_dm_timer_modify_idlect_mask - Check if any running timers use ARMXOR 339 * omap_dm_timer_modify_idlect_mask - Check if any running timers use ARMXOR
277 * @inputmask: current value of idlect mask 340 * @inputmask: current value of idlect mask
@@ -348,7 +411,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
348 omap_dm_timer_enable(timer); 411 omap_dm_timer_enable(timer);
349 412
350 if (!(timer->capability & OMAP_TIMER_ALWON)) { 413 if (!(timer->capability & OMAP_TIMER_ALWON)) {
351 if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) != 414 if (timer->get_context_loss_count &&
415 timer->get_context_loss_count(&timer->pdev->dev) !=
352 timer->ctx_loss_count) 416 timer->ctx_loss_count)
353 omap_timer_restore_context(timer); 417 omap_timer_restore_context(timer);
354 } 418 }
@@ -377,9 +441,11 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
377 441
378 __omap_dm_timer_stop(timer, timer->posted, rate); 442 __omap_dm_timer_stop(timer, timer->posted, rate);
379 443
380 if (!(timer->capability & OMAP_TIMER_ALWON)) 444 if (!(timer->capability & OMAP_TIMER_ALWON)) {
381 timer->ctx_loss_count = 445 if (timer->get_context_loss_count)
382 omap_pm_get_dev_context_loss_count(&timer->pdev->dev); 446 timer->ctx_loss_count =
447 timer->get_context_loss_count(&timer->pdev->dev);
448 }
383 449
384 /* 450 /*
385 * Since the register values are computed and written within 451 * Since the register values are computed and written within
@@ -388,7 +454,6 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
388 */ 454 */
389 timer->context.tclr = 455 timer->context.tclr =
390 omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 456 omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
391 timer->context.tisr = __raw_readl(timer->irq_stat);
392 omap_dm_timer_disable(timer); 457 omap_dm_timer_disable(timer);
393 return 0; 458 return 0;
394} 459}
@@ -398,7 +463,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
398{ 463{
399 int ret; 464 int ret;
400 char *parent_name = NULL; 465 char *parent_name = NULL;
401 struct clk *fclk, *parent; 466 struct clk *parent;
402 struct dmtimer_platform_data *pdata; 467 struct dmtimer_platform_data *pdata;
403 468
404 if (unlikely(!timer)) 469 if (unlikely(!timer))
@@ -414,14 +479,11 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
414 * use the clock framework to set the parent clock. To be removed 479 * use the clock framework to set the parent clock. To be removed
415 * once OMAP1 migrated to using clock framework for dmtimers 480 * once OMAP1 migrated to using clock framework for dmtimers
416 */ 481 */
417 if (pdata->set_timer_src) 482 if (pdata && pdata->set_timer_src)
418 return pdata->set_timer_src(timer->pdev, source); 483 return pdata->set_timer_src(timer->pdev, source);
419 484
420 fclk = clk_get(&timer->pdev->dev, "fck"); 485 if (!timer->fclk)
421 if (IS_ERR_OR_NULL(fclk)) {
422 pr_err("%s: fck not found\n", __func__);
423 return -EINVAL; 486 return -EINVAL;
424 }
425 487
426 switch (source) { 488 switch (source) {
427 case OMAP_TIMER_SRC_SYS_CLK: 489 case OMAP_TIMER_SRC_SYS_CLK:
@@ -440,18 +502,15 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
440 parent = clk_get(&timer->pdev->dev, parent_name); 502 parent = clk_get(&timer->pdev->dev, parent_name);
441 if (IS_ERR_OR_NULL(parent)) { 503 if (IS_ERR_OR_NULL(parent)) {
442 pr_err("%s: %s not found\n", __func__, parent_name); 504 pr_err("%s: %s not found\n", __func__, parent_name);
443 ret = -EINVAL; 505 return -EINVAL;
444 goto out;
445 } 506 }
446 507
447 ret = clk_set_parent(fclk, parent); 508 ret = clk_set_parent(timer->fclk, parent);
448 if (IS_ERR_VALUE(ret)) 509 if (IS_ERR_VALUE(ret))
449 pr_err("%s: failed to set %s as parent\n", __func__, 510 pr_err("%s: failed to set %s as parent\n", __func__,
450 parent_name); 511 parent_name);
451 512
452 clk_put(parent); 513 clk_put(parent);
453out:
454 clk_put(fclk);
455 514
456 return ret; 515 return ret;
457} 516}
@@ -495,7 +554,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
495 omap_dm_timer_enable(timer); 554 omap_dm_timer_enable(timer);
496 555
497 if (!(timer->capability & OMAP_TIMER_ALWON)) { 556 if (!(timer->capability & OMAP_TIMER_ALWON)) {
498 if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) != 557 if (timer->get_context_loss_count &&
558 timer->get_context_loss_count(&timer->pdev->dev) !=
499 timer->ctx_loss_count) 559 timer->ctx_loss_count)
500 omap_timer_restore_context(timer); 560 omap_timer_restore_context(timer);
501 } 561 }
@@ -533,8 +593,8 @@ int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
533 l |= OMAP_TIMER_CTRL_CE; 593 l |= OMAP_TIMER_CTRL_CE;
534 else 594 else
535 l &= ~OMAP_TIMER_CTRL_CE; 595 l &= ~OMAP_TIMER_CTRL_CE;
536 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
537 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match); 596 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match);
597 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
538 598
539 /* Save the context */ 599 /* Save the context */
540 timer->context.tclr = l; 600 timer->context.tclr = l;
@@ -610,6 +670,37 @@ int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
610} 670}
611EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable); 671EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable);
612 672
673/**
674 * omap_dm_timer_set_int_disable - disable timer interrupts
675 * @timer: pointer to timer handle
676 * @mask: bit mask of interrupts to be disabled
677 *
678 * Disables the specified timer interrupts for a timer.
679 */
680int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
681{
682 u32 l = mask;
683
684 if (unlikely(!timer))
685 return -EINVAL;
686
687 omap_dm_timer_enable(timer);
688
689 if (timer->revision == 1)
690 l = __raw_readl(timer->irq_ena) & ~mask;
691
692 __raw_writel(l, timer->irq_dis);
693 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_WAKEUP_EN_REG) & ~mask;
694 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, l);
695
696 /* Save the context */
697 timer->context.tier &= ~mask;
698 timer->context.twer &= ~mask;
699 omap_dm_timer_disable(timer);
700 return 0;
701}
702EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_disable);
703
613unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer) 704unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
614{ 705{
615 unsigned int l; 706 unsigned int l;
@@ -631,8 +722,7 @@ int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
631 return -EINVAL; 722 return -EINVAL;
632 723
633 __omap_dm_timer_write_status(timer, value); 724 __omap_dm_timer_write_status(timer, value);
634 /* Save the context */ 725
635 timer->context.tisr = value;
636 return 0; 726 return 0;
637} 727}
638EXPORT_SYMBOL_GPL(omap_dm_timer_write_status); 728EXPORT_SYMBOL_GPL(omap_dm_timer_write_status);
@@ -695,7 +785,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
695 struct device *dev = &pdev->dev; 785 struct device *dev = &pdev->dev;
696 struct dmtimer_platform_data *pdata = pdev->dev.platform_data; 786 struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
697 787
698 if (!pdata) { 788 if (!pdata && !dev->of_node) {
699 dev_err(dev, "%s: no platform data.\n", __func__); 789 dev_err(dev, "%s: no platform data.\n", __func__);
700 return -ENODEV; 790 return -ENODEV;
701 } 791 }
@@ -724,11 +814,25 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
724 return -ENOMEM; 814 return -ENOMEM;
725 } 815 }
726 816
727 timer->id = pdev->id; 817 if (dev->of_node) {
818 if (of_find_property(dev->of_node, "ti,timer-alwon", NULL))
819 timer->capability |= OMAP_TIMER_ALWON;
820 if (of_find_property(dev->of_node, "ti,timer-dsp", NULL))
821 timer->capability |= OMAP_TIMER_HAS_DSP_IRQ;
822 if (of_find_property(dev->of_node, "ti,timer-pwm", NULL))
823 timer->capability |= OMAP_TIMER_HAS_PWM;
824 if (of_find_property(dev->of_node, "ti,timer-secure", NULL))
825 timer->capability |= OMAP_TIMER_SECURE;
826 } else {
827 timer->id = pdev->id;
828 timer->errata = pdata->timer_errata;
829 timer->capability = pdata->timer_capability;
830 timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
831 timer->get_context_loss_count = pdata->get_context_loss_count;
832 }
833
728 timer->irq = irq->start; 834 timer->irq = irq->start;
729 timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
730 timer->pdev = pdev; 835 timer->pdev = pdev;
731 timer->capability = pdata->timer_capability;
732 836
733 /* Skip pm_runtime_enable for OMAP1 */ 837 /* Skip pm_runtime_enable for OMAP1 */
734 if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) { 838 if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
@@ -768,7 +872,8 @@ static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
768 872
769 spin_lock_irqsave(&dm_timer_lock, flags); 873 spin_lock_irqsave(&dm_timer_lock, flags);
770 list_for_each_entry(timer, &omap_timer_list, node) 874 list_for_each_entry(timer, &omap_timer_list, node)
771 if (timer->pdev->id == pdev->id) { 875 if (!strcmp(dev_name(&timer->pdev->dev),
876 dev_name(&pdev->dev))) {
772 list_del(&timer->node); 877 list_del(&timer->node);
773 ret = 0; 878 ret = 0;
774 break; 879 break;
@@ -778,11 +883,18 @@ static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
778 return ret; 883 return ret;
779} 884}
780 885
886static const struct of_device_id omap_timer_match[] = {
887 { .compatible = "ti,omap2-timer", },
888 {},
889};
890MODULE_DEVICE_TABLE(of, omap_timer_match);
891
781static struct platform_driver omap_dm_timer_driver = { 892static struct platform_driver omap_dm_timer_driver = {
782 .probe = omap_dm_timer_probe, 893 .probe = omap_dm_timer_probe,
783 .remove = __devexit_p(omap_dm_timer_remove), 894 .remove = __devexit_p(omap_dm_timer_remove),
784 .driver = { 895 .driver = {
785 .name = "omap_timer", 896 .name = "omap_timer",
897 .of_match_table = of_match_ptr(omap_timer_match),
786 }, 898 },
787}; 899};
788 900
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index bcbb9d5dc29..3a77b30f53d 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -30,9 +30,69 @@
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/omapfb.h> 31#include <linux/omapfb.h>
32 32
33#include <mach/hardware.h>
34#include <asm/mach/map.h> 33#include <asm/mach/map.h>
35 34
35#include <plat/cpu.h>
36
37#ifdef CONFIG_OMAP2_VRFB
38
39/*
40 * The first memory resource is the register region for VRFB,
41 * the rest are VRFB virtual memory areas for each VRFB context.
42 */
43
44static const struct resource omap2_vrfb_resources[] = {
45 DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"),
46 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
47 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
48 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
49 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
50};
51
52static const struct resource omap3_vrfb_resources[] = {
53 DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"),
54 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
55 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
56 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
57 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
58 DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"),
59 DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"),
60 DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"),
61 DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"),
62 DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"),
63 DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"),
64 DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"),
65 DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"),
66};
67
68static int __init omap_init_vrfb(void)
69{
70 struct platform_device *pdev;
71 const struct resource *res;
72 unsigned int num_res;
73
74 if (cpu_is_omap24xx()) {
75 res = omap2_vrfb_resources;
76 num_res = ARRAY_SIZE(omap2_vrfb_resources);
77 } else if (cpu_is_omap34xx()) {
78 res = omap3_vrfb_resources;
79 num_res = ARRAY_SIZE(omap3_vrfb_resources);
80 } else {
81 return 0;
82 }
83
84 pdev = platform_device_register_resndata(NULL, "omapvrfb", -1,
85 res, num_res, NULL, 0);
86
87 if (IS_ERR(pdev))
88 return PTR_ERR(pdev);
89 else
90 return 0;
91}
92
93arch_initcall(omap_init_vrfb);
94#endif
95
36#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 96#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
37 97
38static bool omapfb_lcd_configured; 98static bool omapfb_lcd_configured;
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 6013831a043..f9df624d108 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -31,176 +31,13 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/clk.h> 32#include <linux/clk.h>
33 33
34#include <mach/irqs.h>
35#include <plat/i2c.h> 34#include <plat/i2c.h>
36#include <plat/omap-pm.h>
37#include <plat/omap_device.h>
38 35
39#define OMAP_I2C_SIZE 0x3f
40#define OMAP1_I2C_BASE 0xfffb3800
41#define OMAP1_INT_I2C (32 + 4)
42
43static const char name[] = "omap_i2c";
44
45#define I2C_RESOURCE_BUILDER(base, irq) \
46 { \
47 .start = (base), \
48 .end = (base) + OMAP_I2C_SIZE, \
49 .flags = IORESOURCE_MEM, \
50 }, \
51 { \
52 .start = (irq), \
53 .flags = IORESOURCE_IRQ, \
54 },
55
56static struct resource i2c_resources[][2] = {
57 { I2C_RESOURCE_BUILDER(0, 0) },
58};
59
60#define I2C_DEV_BUILDER(bus_id, res, data) \
61 { \
62 .id = (bus_id), \
63 .name = name, \
64 .num_resources = ARRAY_SIZE(res), \
65 .resource = (res), \
66 .dev = { \
67 .platform_data = (data), \
68 }, \
69 }
70
71#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
72#define OMAP_I2C_MAX_CONTROLLERS 4 36#define OMAP_I2C_MAX_CONTROLLERS 4
73static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS]; 37static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS];
74static struct platform_device omap_i2c_devices[] = {
75 I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]),
76};
77 38
78#define OMAP_I2C_CMDLINE_SETUP (BIT(31)) 39#define OMAP_I2C_CMDLINE_SETUP (BIT(31))
79 40
80static int __init omap_i2c_nr_ports(void)
81{
82 int ports = 0;
83
84 if (cpu_class_is_omap1())
85 ports = 1;
86 else if (cpu_is_omap24xx())
87 ports = 2;
88 else if (cpu_is_omap34xx())
89 ports = 3;
90 else if (cpu_is_omap44xx())
91 ports = 4;
92
93 return ports;
94}
95
96static inline int omap1_i2c_add_bus(int bus_id)
97{
98 struct platform_device *pdev;
99 struct omap_i2c_bus_platform_data *pdata;
100 struct resource *res;
101
102 omap1_i2c_mux_pins(bus_id);
103
104 pdev = &omap_i2c_devices[bus_id - 1];
105 res = pdev->resource;
106 res[0].start = OMAP1_I2C_BASE;
107 res[0].end = res[0].start + OMAP_I2C_SIZE;
108 res[1].start = OMAP1_INT_I2C;
109 pdata = &i2c_pdata[bus_id - 1];
110
111 /* all OMAP1 have IP version 1 register set */
112 pdata->rev = OMAP_I2C_IP_VERSION_1;
113
114 /* all OMAP1 I2C are implemented like this */
115 pdata->flags = OMAP_I2C_FLAG_NO_FIFO |
116 OMAP_I2C_FLAG_SIMPLE_CLOCK |
117 OMAP_I2C_FLAG_16BIT_DATA_REG |
118 OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK;
119
120 /* how the cpu bus is wired up differs for 7xx only */
121
122 if (cpu_is_omap7xx())
123 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_1;
124 else
125 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2;
126
127 return platform_device_register(pdev);
128}
129
130
131#ifdef CONFIG_ARCH_OMAP2PLUS
132/*
133 * XXX This function is a temporary compatibility wrapper - only
134 * needed until the I2C driver can be converted to call
135 * omap_pm_set_max_dev_wakeup_lat() and handle a return code.
136 */
137static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
138{
139 omap_pm_set_max_mpu_wakeup_lat(dev, t);
140}
141
142static inline int omap2_i2c_add_bus(int bus_id)
143{
144 int l;
145 struct omap_hwmod *oh;
146 struct platform_device *pdev;
147 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
148 struct omap_i2c_bus_platform_data *pdata;
149 struct omap_i2c_dev_attr *dev_attr;
150
151 omap2_i2c_mux_pins(bus_id);
152
153 l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
154 WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
155 "String buffer overflow in I2C%d device setup\n", bus_id);
156 oh = omap_hwmod_lookup(oh_name);
157 if (!oh) {
158 pr_err("Could not look up %s\n", oh_name);
159 return -EEXIST;
160 }
161
162 pdata = &i2c_pdata[bus_id - 1];
163 /*
164 * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
165 * use, and functionality implementation flags, up to the OMAP I2C
166 * driver via platform data
167 */
168 pdata->rev = oh->class->rev;
169
170 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
171 pdata->flags = dev_attr->flags;
172
173 /*
174 * When waiting for completion of a i2c transfer, we need to
175 * set a wake up latency constraint for the MPU. This is to
176 * ensure quick enough wakeup from idle, when transfer
177 * completes.
178 * Only omap3 has support for constraints
179 */
180 if (cpu_is_omap34xx())
181 pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
182 pdev = omap_device_build(name, bus_id, oh, pdata,
183 sizeof(struct omap_i2c_bus_platform_data),
184 NULL, 0, 0);
185 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
186
187 return PTR_RET(pdev);
188}
189#else
190static inline int omap2_i2c_add_bus(int bus_id)
191{
192 return 0;
193}
194#endif
195
196static int __init omap_i2c_add_bus(int bus_id)
197{
198 if (cpu_class_is_omap1())
199 return omap1_i2c_add_bus(bus_id);
200 else
201 return omap2_i2c_add_bus(bus_id);
202}
203
204/** 41/**
205 * omap_i2c_bus_setup - Process command line options for the I2C bus speed 42 * omap_i2c_bus_setup - Process command line options for the I2C bus speed
206 * @str: String of options 43 * @str: String of options
@@ -214,12 +51,11 @@ static int __init omap_i2c_add_bus(int bus_id)
214 */ 51 */
215static int __init omap_i2c_bus_setup(char *str) 52static int __init omap_i2c_bus_setup(char *str)
216{ 53{
217 int ports;
218 int ints[3]; 54 int ints[3];
219 55
220 ports = omap_i2c_nr_ports();
221 get_options(str, 3, ints); 56 get_options(str, 3, ints);
222 if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports) 57 if (ints[0] < 2 || ints[1] < 1 ||
58 ints[1] > OMAP_I2C_MAX_CONTROLLERS)
223 return 0; 59 return 0;
224 i2c_pdata[ints[1] - 1].clkrate = ints[2]; 60 i2c_pdata[ints[1] - 1].clkrate = ints[2];
225 i2c_pdata[ints[1] - 1].clkrate |= OMAP_I2C_CMDLINE_SETUP; 61 i2c_pdata[ints[1] - 1].clkrate |= OMAP_I2C_CMDLINE_SETUP;
@@ -239,7 +75,7 @@ static int __init omap_register_i2c_bus_cmdline(void)
239 for (i = 0; i < ARRAY_SIZE(i2c_pdata); i++) 75 for (i = 0; i < ARRAY_SIZE(i2c_pdata); i++)
240 if (i2c_pdata[i].clkrate & OMAP_I2C_CMDLINE_SETUP) { 76 if (i2c_pdata[i].clkrate & OMAP_I2C_CMDLINE_SETUP) {
241 i2c_pdata[i].clkrate &= ~OMAP_I2C_CMDLINE_SETUP; 77 i2c_pdata[i].clkrate &= ~OMAP_I2C_CMDLINE_SETUP;
242 err = omap_i2c_add_bus(i + 1); 78 err = omap_i2c_add_bus(&i2c_pdata[i], i + 1);
243 if (err) 79 if (err)
244 goto out; 80 goto out;
245 } 81 }
@@ -264,7 +100,7 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
264{ 100{
265 int err; 101 int err;
266 102
267 BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports()); 103 BUG_ON(bus_id < 1 || bus_id > OMAP_I2C_MAX_CONTROLLERS);
268 104
269 if (info) { 105 if (info) {
270 err = i2c_register_board_info(bus_id, info, len); 106 err = i2c_register_board_info(bus_id, info, len);
@@ -277,5 +113,5 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
277 113
278 i2c_pdata[bus_id - 1].clkrate &= ~OMAP_I2C_CMDLINE_SETUP; 114 i2c_pdata[bus_id - 1].clkrate &= ~OMAP_I2C_CMDLINE_SETUP;
279 115
280 return omap_i2c_add_bus(bus_id); 116 return omap_i2c_add_bus(&i2c_pdata[bus_id - 1], bus_id);
281} 117}
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h
deleted file mode 100644
index 025d85a3ee8..00000000000
--- a/arch/arm/plat-omap/include/plat/clkdev_omap.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * clkdev <-> OMAP integration
3 *
4 * Russell King <linux@arm.linux.org.uk>
5 *
6 */
7
8#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
9#define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
10
11#include <linux/clkdev.h>
12
13struct omap_clk {
14 u16 cpu;
15 struct clk_lookup lk;
16};
17
18#define CLK(dev, con, ck, cp) \
19 { \
20 .cpu = cp, \
21 .lk = { \
22 .dev_id = dev, \
23 .con_id = con, \
24 .clk = ck, \
25 }, \
26 }
27
28/* Platform flags for the clkdev-OMAP integration code */
29#define CK_310 (1 << 0)
30#define CK_7XX (1 << 1) /* 7xx, 850 */
31#define CK_1510 (1 << 2)
32#define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */
33#define CK_242X (1 << 4)
34#define CK_243X (1 << 5) /* 243x, 253x */
35#define CK_3430ES1 (1 << 6) /* 34xxES1 only */
36#define CK_3430ES2PLUS (1 << 7) /* 34xxES2, ES3, non-Sitara 35xx only */
37#define CK_AM35XX (1 << 9) /* Sitara AM35xx */
38#define CK_36XX (1 << 10) /* 36xx/37xx-specific clocks */
39#define CK_443X (1 << 11)
40#define CK_TI816X (1 << 12)
41#define CK_446X (1 << 13)
42#define CK_AM33XX (1 << 14) /* AM33xx specific clocks */
43#define CK_1710 (1 << 15) /* 1710 extra for rate selection */
44
45
46#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
47#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
48
49
50#endif
51
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
deleted file mode 100644
index e2e2d045e42..00000000000
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ /dev/null
@@ -1,309 +0,0 @@
1/*
2 * OMAP clock: data structure definitions, function prototypes, shared macros
3 *
4 * Copyright (C) 2004-2005, 2008-2010 Nokia Corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ARCH_ARM_OMAP_CLOCK_H
14#define __ARCH_ARM_OMAP_CLOCK_H
15
16#include <linux/list.h>
17
18struct module;
19struct clk;
20struct clockdomain;
21
22/* Temporary, needed during the common clock framework conversion */
23#define __clk_get_name(clk) (clk->name)
24#define __clk_get_parent(clk) (clk->parent)
25#define __clk_get_rate(clk) (clk->rate)
26
27/**
28 * struct clkops - some clock function pointers
29 * @enable: fn ptr that enables the current clock in hardware
30 * @disable: fn ptr that enables the current clock in hardware
31 * @find_idlest: function returning the IDLEST register for the clock's IP blk
32 * @find_companion: function returning the "companion" clk reg for the clock
33 * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
34 * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
35 *
36 * A "companion" clk is an accompanying clock to the one being queried
37 * that must be enabled for the IP module connected to the clock to
38 * become accessible by the hardware. Neither @find_idlest nor
39 * @find_companion should be needed; that information is IP
40 * block-specific; the hwmod code has been created to handle this, but
41 * until hwmod data is ready and drivers have been converted to use PM
42 * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
43 * @find_companion must, unfortunately, remain.
44 */
45struct clkops {
46 int (*enable)(struct clk *);
47 void (*disable)(struct clk *);
48 void (*find_idlest)(struct clk *, void __iomem **,
49 u8 *, u8 *);
50 void (*find_companion)(struct clk *, void __iomem **,
51 u8 *);
52 void (*allow_idle)(struct clk *);
53 void (*deny_idle)(struct clk *);
54};
55
56#ifdef CONFIG_ARCH_OMAP2PLUS
57
58/* struct clksel_rate.flags possibilities */
59#define RATE_IN_242X (1 << 0)
60#define RATE_IN_243X (1 << 1)
61#define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */
62#define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */
63#define RATE_IN_36XX (1 << 4)
64#define RATE_IN_4430 (1 << 5)
65#define RATE_IN_TI816X (1 << 6)
66#define RATE_IN_4460 (1 << 7)
67#define RATE_IN_AM33XX (1 << 8)
68#define RATE_IN_TI814X (1 << 9)
69
70#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
71#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
72#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
73#define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
74
75/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
76#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
77
78
79/**
80 * struct clksel_rate - register bitfield values corresponding to clk divisors
81 * @val: register bitfield value (shifted to bit 0)
82 * @div: clock divisor corresponding to @val
83 * @flags: (see "struct clksel_rate.flags possibilities" above)
84 *
85 * @val should match the value of a read from struct clk.clksel_reg
86 * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
87 *
88 * @div is the divisor that should be applied to the parent clock's rate
89 * to produce the current clock's rate.
90 */
91struct clksel_rate {
92 u32 val;
93 u8 div;
94 u16 flags;
95};
96
97/**
98 * struct clksel - available parent clocks, and a pointer to their divisors
99 * @parent: struct clk * to a possible parent clock
100 * @rates: available divisors for this parent clock
101 *
102 * A struct clksel is always associated with one or more struct clks
103 * and one or more struct clksel_rates.
104 */
105struct clksel {
106 struct clk *parent;
107 const struct clksel_rate *rates;
108};
109
110/**
111 * struct dpll_data - DPLL registers and integration data
112 * @mult_div1_reg: register containing the DPLL M and N bitfields
113 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
114 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
115 * @clk_bypass: struct clk pointer to the clock's bypass clock input
116 * @clk_ref: struct clk pointer to the clock's reference clock input
117 * @control_reg: register containing the DPLL mode bitfield
118 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
119 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
120 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
121 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
122 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
123 * @min_divider: minimum valid non-bypass divider value (actual)
124 * @max_divider: maximum valid non-bypass divider value (actual)
125 * @modes: possible values of @enable_mask
126 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
127 * @idlest_reg: register containing the DPLL idle status bitfield
128 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
129 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
130 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
131 * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
132 * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
133 * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
134 * @flags: DPLL type/features (see below)
135 *
136 * Possible values for @flags:
137 * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
138 *
139 * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
140 *
141 * XXX Some DPLLs have multiple bypass inputs, so it's not technically
142 * correct to only have one @clk_bypass pointer.
143 *
144 * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
145 * @last_rounded_n) should be separated from the runtime-fixed fields
146 * and placed into a different structure, so that the runtime-fixed data
147 * can be placed into read-only space.
148 */
149struct dpll_data {
150 void __iomem *mult_div1_reg;
151 u32 mult_mask;
152 u32 div1_mask;
153 struct clk *clk_bypass;
154 struct clk *clk_ref;
155 void __iomem *control_reg;
156 u32 enable_mask;
157 unsigned long last_rounded_rate;
158 u16 last_rounded_m;
159 u16 max_multiplier;
160 u8 last_rounded_n;
161 u8 min_divider;
162 u16 max_divider;
163 u8 modes;
164 void __iomem *autoidle_reg;
165 void __iomem *idlest_reg;
166 u32 autoidle_mask;
167 u32 freqsel_mask;
168 u32 idlest_mask;
169 u32 dco_mask;
170 u32 sddiv_mask;
171 u8 auto_recal_bit;
172 u8 recal_en_bit;
173 u8 recal_st_bit;
174 u8 flags;
175};
176
177#endif
178
179/*
180 * struct clk.flags possibilities
181 *
182 * XXX document the rest of the clock flags here
183 *
184 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
185 * bits share the same register. This flag allows the
186 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
187 * should be used. This is a temporary solution - a better approach
188 * would be to associate clock type-specific data with the clock,
189 * similar to the struct dpll_data approach.
190 */
191#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
192#define CLOCK_IDLE_CONTROL (1 << 1)
193#define CLOCK_NO_IDLE_PARENT (1 << 2)
194#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
195#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
196#define CLOCK_CLKOUTX2 (1 << 5)
197
198/**
199 * struct clk - OMAP struct clk
200 * @node: list_head connecting this clock into the full clock list
201 * @ops: struct clkops * for this clock
202 * @name: the name of the clock in the hardware (used in hwmod data and debug)
203 * @parent: pointer to this clock's parent struct clk
204 * @children: list_head connecting to the child clks' @sibling list_heads
205 * @sibling: list_head connecting this clk to its parent clk's @children
206 * @rate: current clock rate
207 * @enable_reg: register to write to enable the clock (see @enable_bit)
208 * @recalc: fn ptr that returns the clock's current rate
209 * @set_rate: fn ptr that can change the clock's current rate
210 * @round_rate: fn ptr that can round the clock's current rate
211 * @init: fn ptr to do clock-specific initialization
212 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
213 * @usecount: number of users that have requested this clock to be enabled
214 * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
215 * @flags: see "struct clk.flags possibilities" above
216 * @clksel_reg: for clksel clks, register va containing src/divisor select
217 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
218 * @clksel: for clksel clks, pointer to struct clksel for this clock
219 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
220 * @clkdm_name: clockdomain name that this clock is contained in
221 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
222 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
223 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
224 *
225 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
226 * clock code converted to use clksel.
227 *
228 * XXX @usecount is poorly named. It should be "enable_count" or
229 * something similar. "users" in the description refers to kernel
230 * code (core code or drivers) that have called clk_enable() and not
231 * yet called clk_disable(); the usecount of parent clocks is also
232 * incremented by the clock code when clk_enable() is called on child
233 * clocks and decremented by the clock code when clk_disable() is
234 * called on child clocks.
235 *
236 * XXX @clkdm, @usecount, @children, @sibling should be marked for
237 * internal use only.
238 *
239 * @children and @sibling are used to optimize parent-to-child clock
240 * tree traversals. (child-to-parent traversals use @parent.)
241 *
242 * XXX The notion of the clock's current rate probably needs to be
243 * separated from the clock's target rate.
244 */
245struct clk {
246 struct list_head node;
247 const struct clkops *ops;
248 const char *name;
249 struct clk *parent;
250 struct list_head children;
251 struct list_head sibling; /* node for children */
252 unsigned long rate;
253 void __iomem *enable_reg;
254 unsigned long (*recalc)(struct clk *);
255 int (*set_rate)(struct clk *, unsigned long);
256 long (*round_rate)(struct clk *, unsigned long);
257 void (*init)(struct clk *);
258 u8 enable_bit;
259 s8 usecount;
260 u8 fixed_div;
261 u8 flags;
262#ifdef CONFIG_ARCH_OMAP2PLUS
263 void __iomem *clksel_reg;
264 u32 clksel_mask;
265 const struct clksel *clksel;
266 struct dpll_data *dpll_data;
267 const char *clkdm_name;
268 struct clockdomain *clkdm;
269#else
270 u8 rate_offset;
271 u8 src_offset;
272#endif
273#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
274 struct dentry *dent; /* For visible tree hierarchy */
275#endif
276};
277
278struct clk_functions {
279 int (*clk_enable)(struct clk *clk);
280 void (*clk_disable)(struct clk *clk);
281 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
282 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
283 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
284 void (*clk_allow_idle)(struct clk *clk);
285 void (*clk_deny_idle)(struct clk *clk);
286 void (*clk_disable_unused)(struct clk *clk);
287};
288
289extern int mpurate;
290
291extern int clk_init(struct clk_functions *custom_clocks);
292extern void clk_preinit(struct clk *clk);
293extern int clk_register(struct clk *clk);
294extern void clk_reparent(struct clk *child, struct clk *parent);
295extern void clk_unregister(struct clk *clk);
296extern void propagate_rate(struct clk *clk);
297extern void recalculate_root_clocks(void);
298extern unsigned long followparent_recalc(struct clk *clk);
299extern void clk_enable_init_clocks(void);
300unsigned long omap_fixed_divisor_recalc(struct clk *clk);
301extern struct clk *omap_clk_get_by_name(const char *name);
302extern int omap_clk_enable_autoidle_all(void);
303extern int omap_clk_disable_autoidle_all(void);
304
305extern const struct clkops clkops_null;
306
307extern struct clk dummy_ck;
308
309#endif
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
deleted file mode 100644
index d1cb6f527b7..00000000000
--- a/arch/arm/plat-omap/include/plat/common.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/common.h
3 *
4 * Header for code common to all OMAP machines.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
28#define __ARCH_ARM_MACH_OMAP_COMMON_H
29
30#include <plat/i2c.h>
31#include <plat/omap_hwmod.h>
32
33extern int __init omap_init_clocksource_32k(void __iomem *vbase);
34
35extern void __init omap_check_revision(void);
36
37extern void omap_reserve(void);
38extern int omap_dss_reset(struct omap_hwmod *);
39
40void omap_sram_init(void);
41
42#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/arch/arm/plat-omap/include/plat/counter-32k.h b/arch/arm/plat-omap/include/plat/counter-32k.h
new file mode 100644
index 00000000000..da000d482ff
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/counter-32k.h
@@ -0,0 +1 @@
int omap_init_clocksource_32k(void __iomem *vbase);
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 67da857783c..b4516aba67e 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/cpu.h
3 *
4 * OMAP cpu type detection 2 * OMAP cpu type detection
5 * 3 *
6 * Copyright (C) 2004, 2008 Nokia Corporation 4 * Copyright (C) 2004, 2008 Nokia Corporation
@@ -30,470 +28,12 @@
30#ifndef __ASM_ARCH_OMAP_CPU_H 28#ifndef __ASM_ARCH_OMAP_CPU_H
31#define __ASM_ARCH_OMAP_CPU_H 29#define __ASM_ARCH_OMAP_CPU_H
32 30
33#ifndef __ASSEMBLY__ 31#ifdef CONFIG_ARCH_OMAP1
34 32#include <mach/soc.h>
35#include <linux/bitops.h>
36#include <plat/multi.h>
37
38/*
39 * Omap device type i.e. EMU/HS/TST/GP/BAD
40 */
41#define OMAP2_DEVICE_TYPE_TEST 0
42#define OMAP2_DEVICE_TYPE_EMU 1
43#define OMAP2_DEVICE_TYPE_SEC 2
44#define OMAP2_DEVICE_TYPE_GP 3
45#define OMAP2_DEVICE_TYPE_BAD 4
46
47int omap_type(void);
48
49/*
50 * omap_rev bits:
51 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
52 * CPU revision (See _REV_ defined in cpu.h) [15:08]
53 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
54 */
55unsigned int omap_rev(void);
56
57/*
58 * Get the CPU revision for OMAP devices
59 */
60#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
61
62/*
63 * Macros to group OMAP into cpu classes.
64 * These can be used in most places.
65 * cpu_is_omap7xx(): True for OMAP730, OMAP850
66 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
67 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
68 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
69 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
70 * cpu_is_omap243x(): True for OMAP2430
71 * cpu_is_omap343x(): True for OMAP3430
72 * cpu_is_omap443x(): True for OMAP4430
73 * cpu_is_omap446x(): True for OMAP4460
74 * cpu_is_omap447x(): True for OMAP4470
75 * soc_is_omap543x(): True for OMAP5430, OMAP5432
76 */
77#define GET_OMAP_CLASS (omap_rev() & 0xff)
78
79#define IS_OMAP_CLASS(class, id) \
80static inline int is_omap ##class (void) \
81{ \
82 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
83}
84
85#define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
86
87#define IS_AM_CLASS(class, id) \
88static inline int is_am ##class (void) \
89{ \
90 return (GET_AM_CLASS == (id)) ? 1 : 0; \
91}
92
93#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
94
95#define IS_TI_CLASS(class, id) \
96static inline int is_ti ##class (void) \
97{ \
98 return (GET_TI_CLASS == (id)) ? 1 : 0; \
99}
100
101#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
102
103#define IS_OMAP_SUBCLASS(subclass, id) \
104static inline int is_omap ##subclass (void) \
105{ \
106 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
107}
108
109#define IS_TI_SUBCLASS(subclass, id) \
110static inline int is_ti ##subclass (void) \
111{ \
112 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
113}
114
115#define IS_AM_SUBCLASS(subclass, id) \
116static inline int is_am ##subclass (void) \
117{ \
118 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
119}
120
121IS_OMAP_CLASS(7xx, 0x07)
122IS_OMAP_CLASS(15xx, 0x15)
123IS_OMAP_CLASS(16xx, 0x16)
124IS_OMAP_CLASS(24xx, 0x24)
125IS_OMAP_CLASS(34xx, 0x34)
126IS_OMAP_CLASS(44xx, 0x44)
127IS_AM_CLASS(35xx, 0x35)
128IS_OMAP_CLASS(54xx, 0x54)
129IS_AM_CLASS(33xx, 0x33)
130
131IS_TI_CLASS(81xx, 0x81)
132
133IS_OMAP_SUBCLASS(242x, 0x242)
134IS_OMAP_SUBCLASS(243x, 0x243)
135IS_OMAP_SUBCLASS(343x, 0x343)
136IS_OMAP_SUBCLASS(363x, 0x363)
137IS_OMAP_SUBCLASS(443x, 0x443)
138IS_OMAP_SUBCLASS(446x, 0x446)
139IS_OMAP_SUBCLASS(447x, 0x447)
140IS_OMAP_SUBCLASS(543x, 0x543)
141
142IS_TI_SUBCLASS(816x, 0x816)
143IS_TI_SUBCLASS(814x, 0x814)
144IS_AM_SUBCLASS(335x, 0x335)
145
146#define cpu_is_omap7xx() 0
147#define cpu_is_omap15xx() 0
148#define cpu_is_omap16xx() 0
149#define cpu_is_omap24xx() 0
150#define cpu_is_omap242x() 0
151#define cpu_is_omap243x() 0
152#define cpu_is_omap34xx() 0
153#define cpu_is_omap343x() 0
154#define cpu_is_ti81xx() 0
155#define cpu_is_ti816x() 0
156#define cpu_is_ti814x() 0
157#define soc_is_am35xx() 0
158#define soc_is_am33xx() 0
159#define soc_is_am335x() 0
160#define cpu_is_omap44xx() 0
161#define cpu_is_omap443x() 0
162#define cpu_is_omap446x() 0
163#define cpu_is_omap447x() 0
164#define soc_is_omap54xx() 0
165#define soc_is_omap543x() 0
166
167#if defined(MULTI_OMAP1)
168# if defined(CONFIG_ARCH_OMAP730)
169# undef cpu_is_omap7xx
170# define cpu_is_omap7xx() is_omap7xx()
171# endif
172# if defined(CONFIG_ARCH_OMAP850)
173# undef cpu_is_omap7xx
174# define cpu_is_omap7xx() is_omap7xx()
175# endif
176# if defined(CONFIG_ARCH_OMAP15XX)
177# undef cpu_is_omap15xx
178# define cpu_is_omap15xx() is_omap15xx()
179# endif
180# if defined(CONFIG_ARCH_OMAP16XX)
181# undef cpu_is_omap16xx
182# define cpu_is_omap16xx() is_omap16xx()
183# endif
184#else
185# if defined(CONFIG_ARCH_OMAP730)
186# undef cpu_is_omap7xx
187# define cpu_is_omap7xx() 1
188# endif
189# if defined(CONFIG_ARCH_OMAP850)
190# undef cpu_is_omap7xx
191# define cpu_is_omap7xx() 1
192# endif
193# if defined(CONFIG_ARCH_OMAP15XX)
194# undef cpu_is_omap15xx
195# define cpu_is_omap15xx() 1
196# endif
197# if defined(CONFIG_ARCH_OMAP16XX)
198# undef cpu_is_omap16xx
199# define cpu_is_omap16xx() 1
200# endif
201#endif
202
203#if defined(MULTI_OMAP2)
204# if defined(CONFIG_ARCH_OMAP2)
205# undef cpu_is_omap24xx
206# define cpu_is_omap24xx() is_omap24xx()
207# endif
208# if defined (CONFIG_SOC_OMAP2420)
209# undef cpu_is_omap242x
210# define cpu_is_omap242x() is_omap242x()
211# endif
212# if defined (CONFIG_SOC_OMAP2430)
213# undef cpu_is_omap243x
214# define cpu_is_omap243x() is_omap243x()
215# endif
216# if defined(CONFIG_ARCH_OMAP3)
217# undef cpu_is_omap34xx
218# undef cpu_is_omap343x
219# define cpu_is_omap34xx() is_omap34xx()
220# define cpu_is_omap343x() is_omap343x()
221# endif
222#else
223# if defined(CONFIG_ARCH_OMAP2)
224# undef cpu_is_omap24xx
225# define cpu_is_omap24xx() 1
226# endif
227# if defined(CONFIG_SOC_OMAP2420)
228# undef cpu_is_omap242x
229# define cpu_is_omap242x() 1
230# endif
231# if defined(CONFIG_SOC_OMAP2430)
232# undef cpu_is_omap243x
233# define cpu_is_omap243x() 1
234# endif
235# if defined(CONFIG_ARCH_OMAP3)
236# undef cpu_is_omap34xx
237# define cpu_is_omap34xx() 1
238# endif
239# if defined(CONFIG_SOC_OMAP3430)
240# undef cpu_is_omap343x
241# define cpu_is_omap343x() 1
242# endif
243#endif
244
245/*
246 * Macros to detect individual cpu types.
247 * These are only rarely needed.
248 * cpu_is_omap310(): True for OMAP310
249 * cpu_is_omap1510(): True for OMAP1510
250 * cpu_is_omap1610(): True for OMAP1610
251 * cpu_is_omap1611(): True for OMAP1611
252 * cpu_is_omap5912(): True for OMAP5912
253 * cpu_is_omap1621(): True for OMAP1621
254 * cpu_is_omap1710(): True for OMAP1710
255 * cpu_is_omap2420(): True for OMAP2420
256 * cpu_is_omap2422(): True for OMAP2422
257 * cpu_is_omap2423(): True for OMAP2423
258 * cpu_is_omap2430(): True for OMAP2430
259 * cpu_is_omap3430(): True for OMAP3430
260 */
261#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
262
263#define IS_OMAP_TYPE(type, id) \
264static inline int is_omap ##type (void) \
265{ \
266 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
267}
268
269IS_OMAP_TYPE(310, 0x0310)
270IS_OMAP_TYPE(1510, 0x1510)
271IS_OMAP_TYPE(1610, 0x1610)
272IS_OMAP_TYPE(1611, 0x1611)
273IS_OMAP_TYPE(5912, 0x1611)
274IS_OMAP_TYPE(1621, 0x1621)
275IS_OMAP_TYPE(1710, 0x1710)
276IS_OMAP_TYPE(2420, 0x2420)
277IS_OMAP_TYPE(2422, 0x2422)
278IS_OMAP_TYPE(2423, 0x2423)
279IS_OMAP_TYPE(2430, 0x2430)
280IS_OMAP_TYPE(3430, 0x3430)
281
282#define cpu_is_omap310() 0
283#define cpu_is_omap1510() 0
284#define cpu_is_omap1610() 0
285#define cpu_is_omap5912() 0
286#define cpu_is_omap1611() 0
287#define cpu_is_omap1621() 0
288#define cpu_is_omap1710() 0
289#define cpu_is_omap2420() 0
290#define cpu_is_omap2422() 0
291#define cpu_is_omap2423() 0
292#define cpu_is_omap2430() 0
293#define cpu_is_omap3430() 0
294#define cpu_is_omap3630() 0
295#define soc_is_omap5430() 0
296
297/*
298 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
299 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
300 */
301
302#if defined(CONFIG_ARCH_OMAP15XX)
303# undef cpu_is_omap310
304# undef cpu_is_omap1510
305# define cpu_is_omap310() is_omap310()
306# define cpu_is_omap1510() is_omap1510()
307#endif
308
309#if defined(CONFIG_ARCH_OMAP16XX)
310# undef cpu_is_omap1610
311# undef cpu_is_omap1611
312# undef cpu_is_omap5912
313# undef cpu_is_omap1621
314# undef cpu_is_omap1710
315# define cpu_is_omap1610() is_omap1610()
316# define cpu_is_omap1611() is_omap1611()
317# define cpu_is_omap5912() is_omap5912()
318# define cpu_is_omap1621() is_omap1621()
319# define cpu_is_omap1710() is_omap1710()
320#endif
321
322#if defined(CONFIG_ARCH_OMAP2)
323# undef cpu_is_omap2420
324# undef cpu_is_omap2422
325# undef cpu_is_omap2423
326# undef cpu_is_omap2430
327# define cpu_is_omap2420() is_omap2420()
328# define cpu_is_omap2422() is_omap2422()
329# define cpu_is_omap2423() is_omap2423()
330# define cpu_is_omap2430() is_omap2430()
331#endif
332
333#if defined(CONFIG_ARCH_OMAP3)
334# undef cpu_is_omap3430
335# undef cpu_is_ti81xx
336# undef cpu_is_ti816x
337# undef cpu_is_ti814x
338# undef soc_is_am35xx
339# define cpu_is_omap3430() is_omap3430()
340# undef cpu_is_omap3630
341# define cpu_is_omap3630() is_omap363x()
342# define cpu_is_ti81xx() is_ti81xx()
343# define cpu_is_ti816x() is_ti816x()
344# define cpu_is_ti814x() is_ti814x()
345# define soc_is_am35xx() is_am35xx()
346#endif 33#endif
347 34
348# if defined(CONFIG_SOC_AM33XX) 35#ifdef CONFIG_ARCH_OMAP2PLUS
349# undef soc_is_am33xx 36#include "../../mach-omap2/soc.h"
350# undef soc_is_am335x
351# define soc_is_am33xx() is_am33xx()
352# define soc_is_am335x() is_am335x()
353#endif 37#endif
354 38
355# if defined(CONFIG_ARCH_OMAP4)
356# undef cpu_is_omap44xx
357# undef cpu_is_omap443x
358# undef cpu_is_omap446x
359# undef cpu_is_omap447x
360# define cpu_is_omap44xx() is_omap44xx()
361# define cpu_is_omap443x() is_omap443x()
362# define cpu_is_omap446x() is_omap446x()
363# define cpu_is_omap447x() is_omap447x()
364# endif
365
366# if defined(CONFIG_SOC_OMAP5)
367# undef soc_is_omap54xx
368# undef soc_is_omap543x
369# define soc_is_omap54xx() is_omap54xx()
370# define soc_is_omap543x() is_omap543x()
371#endif
372
373/* Macros to detect if we have OMAP1 or OMAP2 */
374#define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
375 cpu_is_omap16xx())
376#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
377 cpu_is_omap44xx() || soc_is_omap54xx() || \
378 soc_is_am33xx())
379
380/* Various silicon revisions for omap2 */
381#define OMAP242X_CLASS 0x24200024
382#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
383#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
384
385#define OMAP243X_CLASS 0x24300024
386#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
387
388#define OMAP343X_CLASS 0x34300034
389#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
390#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
391#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
392#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
393#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
394#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
395
396#define OMAP363X_CLASS 0x36300034
397#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
398#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
399#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
400
401#define TI816X_CLASS 0x81600034
402#define TI8168_REV_ES1_0 TI816X_CLASS
403#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
404
405#define TI814X_CLASS 0x81400034
406#define TI8148_REV_ES1_0 TI814X_CLASS
407#define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
408#define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
409
410#define AM35XX_CLASS 0x35170034
411#define AM35XX_REV_ES1_0 AM35XX_CLASS
412#define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
413
414#define AM335X_CLASS 0x33500033
415#define AM335X_REV_ES1_0 AM335X_CLASS
416
417#define OMAP443X_CLASS 0x44300044
418#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
419#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
420#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
421#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
422#define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
423
424#define OMAP446X_CLASS 0x44600044
425#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
426#define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
427
428#define OMAP447X_CLASS 0x44700044
429#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
430
431#define OMAP54XX_CLASS 0x54000054
432#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
433#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
434
435void omap2xxx_check_revision(void);
436void omap3xxx_check_revision(void);
437void omap4xxx_check_revision(void);
438void omap5xxx_check_revision(void);
439void omap3xxx_check_features(void);
440void ti81xx_check_features(void);
441void omap4xxx_check_features(void);
442
443/*
444 * Runtime detection of OMAP3 features
445 *
446 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
447 * family have OS-level control over the I/O chain clock. This is
448 * to avoid a window during which wakeups could potentially be lost
449 * during powerdomain transitions. If this bit is set, it
450 * indicates that the chip does support OS-level control of this
451 * feature.
452 */
453extern u32 omap_features;
454
455#define OMAP3_HAS_L2CACHE BIT(0)
456#define OMAP3_HAS_IVA BIT(1)
457#define OMAP3_HAS_SGX BIT(2)
458#define OMAP3_HAS_NEON BIT(3)
459#define OMAP3_HAS_ISP BIT(4)
460#define OMAP3_HAS_192MHZ_CLK BIT(5)
461#define OMAP3_HAS_IO_WAKEUP BIT(6)
462#define OMAP3_HAS_SDRC BIT(7)
463#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
464#define OMAP4_HAS_MPU_1GHZ BIT(9)
465#define OMAP4_HAS_MPU_1_2GHZ BIT(10)
466#define OMAP4_HAS_MPU_1_5GHZ BIT(11)
467
468
469#define OMAP3_HAS_FEATURE(feat,flag) \
470static inline unsigned int omap3_has_ ##feat(void) \
471{ \
472 return omap_features & OMAP3_HAS_ ##flag; \
473} \
474
475OMAP3_HAS_FEATURE(l2cache, L2CACHE)
476OMAP3_HAS_FEATURE(sgx, SGX)
477OMAP3_HAS_FEATURE(iva, IVA)
478OMAP3_HAS_FEATURE(neon, NEON)
479OMAP3_HAS_FEATURE(isp, ISP)
480OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
481OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
482OMAP3_HAS_FEATURE(sdrc, SDRC)
483OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
484
485/*
486 * Runtime detection of OMAP4 features
487 */
488#define OMAP4_HAS_FEATURE(feat, flag) \
489static inline unsigned int omap4_has_ ##feat(void) \
490{ \
491 return omap_features & OMAP4_HAS_ ##flag; \
492} \
493
494OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
495OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
496OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
497
498#endif /* __ASSEMBLY__ */
499#endif 39#endif
diff --git a/arch/arm/mach-omap2/debug-devices.h b/arch/arm/plat-omap/include/plat/debug-devices.h
index a4edbd2f748..8fc4287222d 100644
--- a/arch/arm/mach-omap2/debug-devices.h
+++ b/arch/arm/plat-omap/include/plat/debug-devices.h
@@ -1,9 +1,2 @@
1#ifndef _OMAP_DEBUG_DEVICES_H
2#define _OMAP_DEBUG_DEVICES_H
3
4#include <linux/types.h>
5
6/* for TI reference platforms sharing the same debug card */ 1/* for TI reference platforms sharing the same debug card */
7extern int debug_card_init(u32 addr, unsigned gpio); 2extern int debug_card_init(u32 addr, unsigned gpio);
8
9#endif
diff --git a/arch/arm/plat-omap/include/plat/dma-44xx.h b/arch/arm/plat-omap/include/plat/dma-44xx.h
deleted file mode 100644
index 1f767cb2f38..00000000000
--- a/arch/arm/plat-omap/include/plat/dma-44xx.h
+++ /dev/null
@@ -1,147 +0,0 @@
1/*
2 * OMAP4 SDMA channel definitions
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Santosh Shilimkar (santosh.shilimkar@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 * Paul Walmsley (paul@pwsan.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
23#define __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
24
25#define OMAP44XX_DMA_SYS_REQ0 2
26#define OMAP44XX_DMA_SYS_REQ1 3
27#define OMAP44XX_DMA_GPMC 4
28#define OMAP44XX_DMA_DSS_DISPC_REQ 6
29#define OMAP44XX_DMA_SYS_REQ2 7
30#define OMAP44XX_DMA_MCASP1_AXEVT 8
31#define OMAP44XX_DMA_ISS_REQ1 9
32#define OMAP44XX_DMA_ISS_REQ2 10
33#define OMAP44XX_DMA_MCASP1_AREVT 11
34#define OMAP44XX_DMA_ISS_REQ3 12
35#define OMAP44XX_DMA_ISS_REQ4 13
36#define OMAP44XX_DMA_DSS_RFBI_REQ 14
37#define OMAP44XX_DMA_SPI3_TX0 15
38#define OMAP44XX_DMA_SPI3_RX0 16
39#define OMAP44XX_DMA_MCBSP2_TX 17
40#define OMAP44XX_DMA_MCBSP2_RX 18
41#define OMAP44XX_DMA_MCBSP3_TX 19
42#define OMAP44XX_DMA_MCBSP3_RX 20
43#define OMAP44XX_DMA_C2C_SSCM_GPO0 21
44#define OMAP44XX_DMA_C2C_SSCM_GPO1 22
45#define OMAP44XX_DMA_SPI3_TX1 23
46#define OMAP44XX_DMA_SPI3_RX1 24
47#define OMAP44XX_DMA_I2C3_TX 25
48#define OMAP44XX_DMA_I2C3_RX 26
49#define OMAP44XX_DMA_I2C1_TX 27
50#define OMAP44XX_DMA_I2C1_RX 28
51#define OMAP44XX_DMA_I2C2_TX 29
52#define OMAP44XX_DMA_I2C2_RX 30
53#define OMAP44XX_DMA_MCBSP4_TX 31
54#define OMAP44XX_DMA_MCBSP4_RX 32
55#define OMAP44XX_DMA_MCBSP1_TX 33
56#define OMAP44XX_DMA_MCBSP1_RX 34
57#define OMAP44XX_DMA_SPI1_TX0 35
58#define OMAP44XX_DMA_SPI1_RX0 36
59#define OMAP44XX_DMA_SPI1_TX1 37
60#define OMAP44XX_DMA_SPI1_RX1 38
61#define OMAP44XX_DMA_SPI1_TX2 39
62#define OMAP44XX_DMA_SPI1_RX2 40
63#define OMAP44XX_DMA_SPI1_TX3 41
64#define OMAP44XX_DMA_SPI1_RX3 42
65#define OMAP44XX_DMA_SPI2_TX0 43
66#define OMAP44XX_DMA_SPI2_RX0 44
67#define OMAP44XX_DMA_SPI2_TX1 45
68#define OMAP44XX_DMA_SPI2_RX1 46
69#define OMAP44XX_DMA_MMC2_TX 47
70#define OMAP44XX_DMA_MMC2_RX 48
71#define OMAP44XX_DMA_UART1_TX 49
72#define OMAP44XX_DMA_UART1_RX 50
73#define OMAP44XX_DMA_UART2_TX 51
74#define OMAP44XX_DMA_UART2_RX 52
75#define OMAP44XX_DMA_UART3_TX 53
76#define OMAP44XX_DMA_UART3_RX 54
77#define OMAP44XX_DMA_UART4_TX 55
78#define OMAP44XX_DMA_UART4_RX 56
79#define OMAP44XX_DMA_MMC4_TX 57
80#define OMAP44XX_DMA_MMC4_RX 58
81#define OMAP44XX_DMA_MMC5_TX 59
82#define OMAP44XX_DMA_MMC5_RX 60
83#define OMAP44XX_DMA_MMC1_TX 61
84#define OMAP44XX_DMA_MMC1_RX 62
85#define OMAP44XX_DMA_SYS_REQ3 64
86#define OMAP44XX_DMA_MCPDM_UP 65
87#define OMAP44XX_DMA_MCPDM_DL 66
88#define OMAP44XX_DMA_DMIC_REQ 67
89#define OMAP44XX_DMA_C2C_SSCM_GPO2 68
90#define OMAP44XX_DMA_C2C_SSCM_GPO3 69
91#define OMAP44XX_DMA_SPI4_TX0 70
92#define OMAP44XX_DMA_SPI4_RX0 71
93#define OMAP44XX_DMA_DSS_DSI1_REQ0 72
94#define OMAP44XX_DMA_DSS_DSI1_REQ1 73
95#define OMAP44XX_DMA_DSS_DSI1_REQ2 74
96#define OMAP44XX_DMA_DSS_DSI1_REQ3 75
97#define OMAP44XX_DMA_DSS_HDMI_REQ 76
98#define OMAP44XX_DMA_MMC3_TX 77
99#define OMAP44XX_DMA_MMC3_RX 78
100#define OMAP44XX_DMA_USIM_TX 79
101#define OMAP44XX_DMA_USIM_RX 80
102#define OMAP44XX_DMA_DSS_DSI2_REQ0 81
103#define OMAP44XX_DMA_DSS_DSI2_REQ1 82
104#define OMAP44XX_DMA_DSS_DSI2_REQ2 83
105#define OMAP44XX_DMA_DSS_DSI2_REQ3 84
106#define OMAP44XX_DMA_SLIMBUS1_TX0 85
107#define OMAP44XX_DMA_SLIMBUS1_TX1 86
108#define OMAP44XX_DMA_SLIMBUS1_TX2 87
109#define OMAP44XX_DMA_SLIMBUS1_TX3 88
110#define OMAP44XX_DMA_SLIMBUS1_RX0 89
111#define OMAP44XX_DMA_SLIMBUS1_RX1 90
112#define OMAP44XX_DMA_SLIMBUS1_RX2 91
113#define OMAP44XX_DMA_SLIMBUS1_RX3 92
114#define OMAP44XX_DMA_SLIMBUS2_TX0 93
115#define OMAP44XX_DMA_SLIMBUS2_TX1 94
116#define OMAP44XX_DMA_SLIMBUS2_TX2 95
117#define OMAP44XX_DMA_SLIMBUS2_TX3 96
118#define OMAP44XX_DMA_SLIMBUS2_RX0 97
119#define OMAP44XX_DMA_SLIMBUS2_RX1 98
120#define OMAP44XX_DMA_SLIMBUS2_RX2 99
121#define OMAP44XX_DMA_SLIMBUS2_RX3 100
122#define OMAP44XX_DMA_ABE_REQ_0 101
123#define OMAP44XX_DMA_ABE_REQ_1 102
124#define OMAP44XX_DMA_ABE_REQ_2 103
125#define OMAP44XX_DMA_ABE_REQ_3 104
126#define OMAP44XX_DMA_ABE_REQ_4 105
127#define OMAP44XX_DMA_ABE_REQ_5 106
128#define OMAP44XX_DMA_ABE_REQ_6 107
129#define OMAP44XX_DMA_ABE_REQ_7 108
130#define OMAP44XX_DMA_AES1_P_CTX_IN_REQ 109
131#define OMAP44XX_DMA_AES1_P_DATA_IN_REQ 110
132#define OMAP44XX_DMA_AES1_P_DATA_OUT_REQ 111
133#define OMAP44XX_DMA_AES2_P_CTX_IN_REQ 112
134#define OMAP44XX_DMA_AES2_P_DATA_IN_REQ 113
135#define OMAP44XX_DMA_AES2_P_DATA_OUT_REQ 114
136#define OMAP44XX_DMA_DES_P_CTX_IN_REQ 115
137#define OMAP44XX_DMA_DES_P_DATA_IN_REQ 116
138#define OMAP44XX_DMA_DES_P_DATA_OUT_REQ 117
139#define OMAP44XX_DMA_SHA2_CTXIN_P 118
140#define OMAP44XX_DMA_SHA2_DIN_P 119
141#define OMAP44XX_DMA_SHA2_CTXOUT_P 120
142#define OMAP44XX_DMA_AES1_P_CONTEXT_OUT_REQ 121
143#define OMAP44XX_DMA_AES2_P_CONTEXT_OUT_REQ 122
144#define OMAP44XX_DMA_I2C4_TX 124
145#define OMAP44XX_DMA_I2C4_RX 125
146
147#endif
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h
deleted file mode 100644
index 0a87b052f8f..00000000000
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ /dev/null
@@ -1,546 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/dma.h
3 *
4 * Copyright (C) 2003 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H
23
24#include <linux/platform_device.h>
25
26/*
27 * TODO: These dma channel defines should go away once all
28 * the omap drivers hwmod adapted.
29 */
30
31/* Move omap4 specific defines to dma-44xx.h */
32#include "dma-44xx.h"
33
34#define INT_DMA_LCD 25
35
36/* DMA channels for omap1 */
37#define OMAP_DMA_NO_DEVICE 0
38#define OMAP_DMA_MCSI1_TX 1
39#define OMAP_DMA_MCSI1_RX 2
40#define OMAP_DMA_I2C_RX 3
41#define OMAP_DMA_I2C_TX 4
42#define OMAP_DMA_EXT_NDMA_REQ 5
43#define OMAP_DMA_EXT_NDMA_REQ2 6
44#define OMAP_DMA_UWIRE_TX 7
45#define OMAP_DMA_MCBSP1_TX 8
46#define OMAP_DMA_MCBSP1_RX 9
47#define OMAP_DMA_MCBSP3_TX 10
48#define OMAP_DMA_MCBSP3_RX 11
49#define OMAP_DMA_UART1_TX 12
50#define OMAP_DMA_UART1_RX 13
51#define OMAP_DMA_UART2_TX 14
52#define OMAP_DMA_UART2_RX 15
53#define OMAP_DMA_MCBSP2_TX 16
54#define OMAP_DMA_MCBSP2_RX 17
55#define OMAP_DMA_UART3_TX 18
56#define OMAP_DMA_UART3_RX 19
57#define OMAP_DMA_CAMERA_IF_RX 20
58#define OMAP_DMA_MMC_TX 21
59#define OMAP_DMA_MMC_RX 22
60#define OMAP_DMA_NAND 23
61#define OMAP_DMA_IRQ_LCD_LINE 24
62#define OMAP_DMA_MEMORY_STICK 25
63#define OMAP_DMA_USB_W2FC_RX0 26
64#define OMAP_DMA_USB_W2FC_RX1 27
65#define OMAP_DMA_USB_W2FC_RX2 28
66#define OMAP_DMA_USB_W2FC_TX0 29
67#define OMAP_DMA_USB_W2FC_TX1 30
68#define OMAP_DMA_USB_W2FC_TX2 31
69
70/* These are only for 1610 */
71#define OMAP_DMA_CRYPTO_DES_IN 32
72#define OMAP_DMA_SPI_TX 33
73#define OMAP_DMA_SPI_RX 34
74#define OMAP_DMA_CRYPTO_HASH 35
75#define OMAP_DMA_CCP_ATTN 36
76#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
77#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
78#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
79#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
80#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
81#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
82#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
83#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
84#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
85#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
86#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
87#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
88#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
89#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
90#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
91#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
92#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
93#define OMAP_DMA_MMC2_TX 54
94#define OMAP_DMA_MMC2_RX 55
95#define OMAP_DMA_CRYPTO_DES_OUT 56
96
97/* DMA channels for 24xx */
98#define OMAP24XX_DMA_NO_DEVICE 0
99#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
100#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
101#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
102#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
103#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
104#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
105#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
106#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
107#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
108#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
109#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
110#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
111#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
112#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
113#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
114#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
115#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
116#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
117#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
118#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
119#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
120#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
121#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
122#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
123#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
124#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
125#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
126#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
127#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
128#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
129#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
130#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
131#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
132#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
133#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
134#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
135#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
136#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
137#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
138#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
139#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
140#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
141#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
142#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
143#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
144#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
145#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
146#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
147#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
148#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
149#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
150#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
151#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
152#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
153#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
154#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
155#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
156#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
157#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
158#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
159#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
160#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
161#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
162#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
163#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
164#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
165#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
166#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
167#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
168#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
169#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
170#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
171#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
172#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
173#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
174#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
175#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
176#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
177#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
178#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
179#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
180#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
181#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
182#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
183#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
184#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
185#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
186#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
187#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
188#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
189#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
190#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
191#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
192#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
193#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
194#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
195#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
196#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
197
198#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
199#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
200
201/* Only for AM35xx */
202#define AM35XX_DMA_UART4_TX 54
203#define AM35XX_DMA_UART4_RX 55
204
205/*----------------------------------------------------------------------------*/
206
207#define OMAP1_DMA_TOUT_IRQ (1 << 0)
208#define OMAP_DMA_DROP_IRQ (1 << 1)
209#define OMAP_DMA_HALF_IRQ (1 << 2)
210#define OMAP_DMA_FRAME_IRQ (1 << 3)
211#define OMAP_DMA_LAST_IRQ (1 << 4)
212#define OMAP_DMA_BLOCK_IRQ (1 << 5)
213#define OMAP1_DMA_SYNC_IRQ (1 << 6)
214#define OMAP2_DMA_PKT_IRQ (1 << 7)
215#define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8)
216#define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9)
217#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10)
218#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)
219
220#define OMAP_DMA_CCR_EN (1 << 7)
221#define OMAP_DMA_CCR_RD_ACTIVE (1 << 9)
222#define OMAP_DMA_CCR_WR_ACTIVE (1 << 10)
223#define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24)
224#define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25)
225
226#define OMAP_DMA_DATA_TYPE_S8 0x00
227#define OMAP_DMA_DATA_TYPE_S16 0x01
228#define OMAP_DMA_DATA_TYPE_S32 0x02
229
230#define OMAP_DMA_SYNC_ELEMENT 0x00
231#define OMAP_DMA_SYNC_FRAME 0x01
232#define OMAP_DMA_SYNC_BLOCK 0x02
233#define OMAP_DMA_SYNC_PACKET 0x03
234
235#define OMAP_DMA_DST_SYNC_PREFETCH 0x02
236#define OMAP_DMA_SRC_SYNC 0x01
237#define OMAP_DMA_DST_SYNC 0x00
238
239#define OMAP_DMA_PORT_EMIFF 0x00
240#define OMAP_DMA_PORT_EMIFS 0x01
241#define OMAP_DMA_PORT_OCP_T1 0x02
242#define OMAP_DMA_PORT_TIPB 0x03
243#define OMAP_DMA_PORT_OCP_T2 0x04
244#define OMAP_DMA_PORT_MPUI 0x05
245
246#define OMAP_DMA_AMODE_CONSTANT 0x00
247#define OMAP_DMA_AMODE_POST_INC 0x01
248#define OMAP_DMA_AMODE_SINGLE_IDX 0x02
249#define OMAP_DMA_AMODE_DOUBLE_IDX 0x03
250
251#define DMA_DEFAULT_FIFO_DEPTH 0x10
252#define DMA_DEFAULT_ARB_RATE 0x01
253/* Pass THREAD_RESERVE ORed with THREAD_FIFO for tparams */
254#define DMA_THREAD_RESERVE_NORM (0x00 << 12) /* Def */
255#define DMA_THREAD_RESERVE_ONET (0x01 << 12)
256#define DMA_THREAD_RESERVE_TWOT (0x02 << 12)
257#define DMA_THREAD_RESERVE_THREET (0x03 << 12)
258#define DMA_THREAD_FIFO_NONE (0x00 << 14) /* Def */
259#define DMA_THREAD_FIFO_75 (0x01 << 14)
260#define DMA_THREAD_FIFO_25 (0x02 << 14)
261#define DMA_THREAD_FIFO_50 (0x03 << 14)
262
263/* DMA4_OCP_SYSCONFIG bits */
264#define DMA_SYSCONFIG_MIDLEMODE_MASK (3 << 12)
265#define DMA_SYSCONFIG_CLOCKACTIVITY_MASK (3 << 8)
266#define DMA_SYSCONFIG_EMUFREE (1 << 5)
267#define DMA_SYSCONFIG_SIDLEMODE_MASK (3 << 3)
268#define DMA_SYSCONFIG_SOFTRESET (1 << 2)
269#define DMA_SYSCONFIG_AUTOIDLE (1 << 0)
270
271#define DMA_SYSCONFIG_MIDLEMODE(n) ((n) << 12)
272#define DMA_SYSCONFIG_SIDLEMODE(n) ((n) << 3)
273
274#define DMA_IDLEMODE_SMARTIDLE 0x2
275#define DMA_IDLEMODE_NO_IDLE 0x1
276#define DMA_IDLEMODE_FORCE_IDLE 0x0
277
278/* Chaining modes*/
279#ifndef CONFIG_ARCH_OMAP1
280#define OMAP_DMA_STATIC_CHAIN 0x1
281#define OMAP_DMA_DYNAMIC_CHAIN 0x2
282#define OMAP_DMA_CHAIN_ACTIVE 0x1
283#define OMAP_DMA_CHAIN_INACTIVE 0x0
284#endif
285
286#define DMA_CH_PRIO_HIGH 0x1
287#define DMA_CH_PRIO_LOW 0x0 /* Def */
288
289/* Errata handling */
290#define IS_DMA_ERRATA(id) (errata & (id))
291#define SET_DMA_ERRATA(id) (errata |= (id))
292
293#define DMA_ERRATA_IFRAME_BUFFERING BIT(0x0)
294#define DMA_ERRATA_PARALLEL_CHANNELS BIT(0x1)
295#define DMA_ERRATA_i378 BIT(0x2)
296#define DMA_ERRATA_i541 BIT(0x3)
297#define DMA_ERRATA_i88 BIT(0x4)
298#define DMA_ERRATA_3_3 BIT(0x5)
299#define DMA_ROMCODE_BUG BIT(0x6)
300
301/* Attributes for OMAP DMA Contrller */
302#define DMA_LINKED_LCH BIT(0x0)
303#define GLOBAL_PRIORITY BIT(0x1)
304#define RESERVE_CHANNEL BIT(0x2)
305#define IS_CSSA_32 BIT(0x3)
306#define IS_CDSA_32 BIT(0x4)
307#define IS_RW_PRIORITY BIT(0x5)
308#define ENABLE_1510_MODE BIT(0x6)
309#define SRC_PORT BIT(0x7)
310#define DST_PORT BIT(0x8)
311#define SRC_INDEX BIT(0x9)
312#define DST_INDEX BIT(0xA)
313#define IS_BURST_ONLY4 BIT(0xB)
314#define CLEAR_CSR_ON_READ BIT(0xC)
315#define IS_WORD_16 BIT(0xD)
316
317/* Defines for DMA Capabilities */
318#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)
319#define DMA_HAS_CONSTANT_FILL_CAPS (0x1 << 19)
320#define DMA_HAS_DESCRIPTOR_CAPS (0x3 << 20)
321
322enum omap_reg_offsets {
323
324GCR, GSCR, GRST1, HW_ID,
325PCH2_ID, PCH0_ID, PCH1_ID, PCHG_ID,
326PCHD_ID, CAPS_0, CAPS_1, CAPS_2,
327CAPS_3, CAPS_4, PCH2_SR, PCH0_SR,
328PCH1_SR, PCHD_SR, REVISION, IRQSTATUS_L0,
329IRQSTATUS_L1, IRQSTATUS_L2, IRQSTATUS_L3, IRQENABLE_L0,
330IRQENABLE_L1, IRQENABLE_L2, IRQENABLE_L3, SYSSTATUS,
331OCP_SYSCONFIG,
332
333/* omap1+ specific */
334CPC, CCR2, LCH_CTRL,
335
336/* Common registers for all omap's */
337CSDP, CCR, CICR, CSR,
338CEN, CFN, CSFI, CSEI,
339CSAC, CDAC, CDEI,
340CDFI, CLNK_CTRL,
341
342/* Channel specific registers */
343CSSA, CDSA, COLOR,
344CCEN, CCFN,
345
346/* omap3630 and omap4 specific */
347CDP, CNDP, CCDN,
348
349};
350
351enum omap_dma_burst_mode {
352 OMAP_DMA_DATA_BURST_DIS = 0,
353 OMAP_DMA_DATA_BURST_4,
354 OMAP_DMA_DATA_BURST_8,
355 OMAP_DMA_DATA_BURST_16,
356};
357
358enum end_type {
359 OMAP_DMA_LITTLE_ENDIAN = 0,
360 OMAP_DMA_BIG_ENDIAN
361};
362
363enum omap_dma_color_mode {
364 OMAP_DMA_COLOR_DIS = 0,
365 OMAP_DMA_CONSTANT_FILL,
366 OMAP_DMA_TRANSPARENT_COPY
367};
368
369enum omap_dma_write_mode {
370 OMAP_DMA_WRITE_NON_POSTED = 0,
371 OMAP_DMA_WRITE_POSTED,
372 OMAP_DMA_WRITE_LAST_NON_POSTED
373};
374
375enum omap_dma_channel_mode {
376 OMAP_DMA_LCH_2D = 0,
377 OMAP_DMA_LCH_G,
378 OMAP_DMA_LCH_P,
379 OMAP_DMA_LCH_PD
380};
381
382struct omap_dma_channel_params {
383 int data_type; /* data type 8,16,32 */
384 int elem_count; /* number of elements in a frame */
385 int frame_count; /* number of frames in a element */
386
387 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */
388 int src_amode; /* constant, post increment, indexed,
389 double indexed */
390 unsigned long src_start; /* source address : physical */
391 int src_ei; /* source element index */
392 int src_fi; /* source frame index */
393
394 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */
395 int dst_amode; /* constant, post increment, indexed,
396 double indexed */
397 unsigned long dst_start; /* source address : physical */
398 int dst_ei; /* source element index */
399 int dst_fi; /* source frame index */
400
401 int trigger; /* trigger attached if the channel is
402 synchronized */
403 int sync_mode; /* sycn on element, frame , block or packet */
404 int src_or_dst_synch; /* source synch(1) or destination synch(0) */
405
406 int ie; /* interrupt enabled */
407
408 unsigned char read_prio;/* read priority */
409 unsigned char write_prio;/* write priority */
410
411#ifndef CONFIG_ARCH_OMAP1
412 enum omap_dma_burst_mode burst_mode; /* Burst mode 4/8/16 words */
413#endif
414};
415
416struct omap_dma_lch {
417 int next_lch;
418 int dev_id;
419 u16 saved_csr;
420 u16 enabled_irqs;
421 const char *dev_name;
422 void (*callback)(int lch, u16 ch_status, void *data);
423 void *data;
424 long flags;
425 /* required for Dynamic chaining */
426 int prev_linked_ch;
427 int next_linked_ch;
428 int state;
429 int chain_id;
430 int status;
431};
432
433struct omap_dma_dev_attr {
434 u32 dev_caps;
435 u16 lch_count;
436 u16 chan_count;
437 struct omap_dma_lch *chan;
438};
439
440/* System DMA platform data structure */
441struct omap_system_dma_plat_info {
442 struct omap_dma_dev_attr *dma_attr;
443 u32 errata;
444 void (*disable_irq_lch)(int lch);
445 void (*show_dma_caps)(void);
446 void (*clear_lch_regs)(int lch);
447 void (*clear_dma)(int lch);
448 void (*dma_write)(u32 val, int reg, int lch);
449 u32 (*dma_read)(int reg, int lch);
450};
451
452extern void __init omap_init_consistent_dma_size(void);
453extern void omap_set_dma_priority(int lch, int dst_port, int priority);
454extern int omap_request_dma(int dev_id, const char *dev_name,
455 void (*callback)(int lch, u16 ch_status, void *data),
456 void *data, int *dma_ch);
457extern void omap_enable_dma_irq(int ch, u16 irq_bits);
458extern void omap_disable_dma_irq(int ch, u16 irq_bits);
459extern void omap_free_dma(int ch);
460extern void omap_start_dma(int lch);
461extern void omap_stop_dma(int lch);
462extern void omap_set_dma_transfer_params(int lch, int data_type,
463 int elem_count, int frame_count,
464 int sync_mode,
465 int dma_trigger, int src_or_dst_synch);
466extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
467 u32 color);
468extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
469extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
470
471extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
472 unsigned long src_start,
473 int src_ei, int src_fi);
474extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
475extern void omap_set_dma_src_data_pack(int lch, int enable);
476extern void omap_set_dma_src_burst_mode(int lch,
477 enum omap_dma_burst_mode burst_mode);
478
479extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
480 unsigned long dest_start,
481 int dst_ei, int dst_fi);
482extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
483extern void omap_set_dma_dest_data_pack(int lch, int enable);
484extern void omap_set_dma_dest_burst_mode(int lch,
485 enum omap_dma_burst_mode burst_mode);
486
487extern void omap_set_dma_params(int lch,
488 struct omap_dma_channel_params *params);
489
490extern void omap_dma_link_lch(int lch_head, int lch_queue);
491extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
492
493extern int omap_set_dma_callback(int lch,
494 void (*callback)(int lch, u16 ch_status, void *data),
495 void *data);
496extern dma_addr_t omap_get_dma_src_pos(int lch);
497extern dma_addr_t omap_get_dma_dst_pos(int lch);
498extern void omap_clear_dma(int lch);
499extern int omap_get_dma_active_status(int lch);
500extern int omap_dma_running(void);
501extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
502 int tparams);
503extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
504 unsigned char write_prio);
505extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
506extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
507extern int omap_get_dma_index(int lch, int *ei, int *fi);
508
509void omap_dma_global_context_save(void);
510void omap_dma_global_context_restore(void);
511
512extern void omap_dma_disable_irq(int lch);
513
514/* Chaining APIs */
515#ifndef CONFIG_ARCH_OMAP1
516extern int omap_request_dma_chain(int dev_id, const char *dev_name,
517 void (*callback) (int lch, u16 ch_status,
518 void *data),
519 int *chain_id, int no_of_chans,
520 int chain_mode,
521 struct omap_dma_channel_params params);
522extern int omap_free_dma_chain(int chain_id);
523extern int omap_dma_chain_a_transfer(int chain_id, int src_start,
524 int dest_start, int elem_count,
525 int frame_count, void *callbk_data);
526extern int omap_start_dma_chain_transfers(int chain_id);
527extern int omap_stop_dma_chain_transfers(int chain_id);
528extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi);
529extern int omap_get_dma_chain_dst_pos(int chain_id);
530extern int omap_get_dma_chain_src_pos(int chain_id);
531
532extern int omap_modify_dma_chain_params(int chain_id,
533 struct omap_dma_channel_params params);
534extern int omap_dma_chain_status(int chain_id);
535#endif
536
537#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP)
538#include <mach/lcd_dma.h>
539#else
540static inline int omap_lcd_dma_running(void)
541{
542 return 0;
543}
544#endif
545
546#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 85868e98c11..a3fbc48c332 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -32,7 +32,6 @@
32 * 675 Mass Ave, Cambridge, MA 02139, USA. 32 * 675 Mass Ave, Cambridge, MA 02139, USA.
33 */ 33 */
34 34
35#include <linux/clk.h>
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <linux/io.h> 36#include <linux/io.h>
38#include <linux/platform_device.h> 37#include <linux/platform_device.h>
@@ -55,6 +54,10 @@
55#define OMAP_TIMER_TRIGGER_OVERFLOW 0x01 54#define OMAP_TIMER_TRIGGER_OVERFLOW 0x01
56#define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 55#define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02
57 56
57/* posted mode types */
58#define OMAP_TIMER_NONPOSTED 0x00
59#define OMAP_TIMER_POSTED 0x01
60
58/* timer capabilities used in hwmod database */ 61/* timer capabilities used in hwmod database */
59#define OMAP_TIMER_SECURE 0x80000000 62#define OMAP_TIMER_SECURE 0x80000000
60#define OMAP_TIMER_ALWON 0x40000000 63#define OMAP_TIMER_ALWON 0x40000000
@@ -62,16 +65,22 @@
62#define OMAP_TIMER_NEEDS_RESET 0x10000000 65#define OMAP_TIMER_NEEDS_RESET 0x10000000
63#define OMAP_TIMER_HAS_DSP_IRQ 0x08000000 66#define OMAP_TIMER_HAS_DSP_IRQ 0x08000000
64 67
68/*
69 * timer errata flags
70 *
71 * Errata i103/i767 impacts all OMAP3/4/5 devices including AM33xx. This
72 * errata prevents us from using posted mode on these devices, unless the
73 * timer counter register is never read. For more details please refer to
74 * the OMAP3/4/5 errata documents.
75 */
76#define OMAP_TIMER_ERRATA_I103_I767 0x80000000
77
65struct omap_timer_capability_dev_attr { 78struct omap_timer_capability_dev_attr {
66 u32 timer_capability; 79 u32 timer_capability;
67}; 80};
68 81
69struct omap_dm_timer;
70
71struct timer_regs { 82struct timer_regs {
72 u32 tidr; 83 u32 tidr;
73 u32 tistat;
74 u32 tisr;
75 u32 tier; 84 u32 tier;
76 u32 twer; 85 u32 twer;
77 u32 tclr; 86 u32 tclr;
@@ -90,15 +99,35 @@ struct timer_regs {
90 u32 towr; 99 u32 towr;
91}; 100};
92 101
93struct dmtimer_platform_data { 102struct omap_dm_timer {
94 /* set_timer_src - Only used for OMAP1 devices */ 103 int id;
95 int (*set_timer_src)(struct platform_device *pdev, int source); 104 int irq;
96 u32 timer_capability; 105 struct clk *fclk;
106
107 void __iomem *io_base;
108 void __iomem *irq_stat; /* TISR/IRQSTATUS interrupt status */
109 void __iomem *irq_ena; /* irq enable */
110 void __iomem *irq_dis; /* irq disable, only on v2 ip */
111 void __iomem *pend; /* write pending */
112 void __iomem *func_base; /* function register base */
113
114 unsigned long rate;
115 unsigned reserved:1;
116 unsigned posted:1;
117 struct timer_regs context;
118 int (*get_context_loss_count)(struct device *);
119 int ctx_loss_count;
120 int revision;
121 u32 capability;
122 u32 errata;
123 struct platform_device *pdev;
124 struct list_head node;
97}; 125};
98 126
99int omap_dm_timer_reserve_systimer(int id); 127int omap_dm_timer_reserve_systimer(int id);
100struct omap_dm_timer *omap_dm_timer_request(void); 128struct omap_dm_timer *omap_dm_timer_request(void);
101struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); 129struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
130struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap);
102int omap_dm_timer_free(struct omap_dm_timer *timer); 131int omap_dm_timer_free(struct omap_dm_timer *timer);
103void omap_dm_timer_enable(struct omap_dm_timer *timer); 132void omap_dm_timer_enable(struct omap_dm_timer *timer);
104void omap_dm_timer_disable(struct omap_dm_timer *timer); 133void omap_dm_timer_disable(struct omap_dm_timer *timer);
@@ -120,6 +149,7 @@ int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, i
120int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); 149int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
121 150
122int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); 151int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
152int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask);
123 153
124unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); 154unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer);
125int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); 155int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
@@ -245,33 +275,6 @@ int omap_dm_timers_active(void);
245#define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \ 275#define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \
246 (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT)) 276 (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT))
247 277
248struct omap_dm_timer {
249 unsigned long phys_base;
250 int id;
251 int irq;
252 struct clk *fclk;
253
254 void __iomem *io_base;
255 void __iomem *sys_stat; /* TISTAT timer status */
256 void __iomem *irq_stat; /* TISR/IRQSTATUS interrupt status */
257 void __iomem *irq_ena; /* irq enable */
258 void __iomem *irq_dis; /* irq disable, only on v2 ip */
259 void __iomem *pend; /* write pending */
260 void __iomem *func_base; /* function register base */
261
262 unsigned long rate;
263 unsigned reserved:1;
264 unsigned posted:1;
265 struct timer_regs context;
266 int ctx_loss_count;
267 int revision;
268 u32 capability;
269 struct platform_device *pdev;
270 struct list_head node;
271};
272
273int omap_dm_timer_prepare(struct omap_dm_timer *timer);
274
275static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg, 278static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
276 int posted) 279 int posted)
277{ 280{
@@ -300,16 +303,13 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
300 tidr = __raw_readl(timer->io_base); 303 tidr = __raw_readl(timer->io_base);
301 if (!(tidr >> 16)) { 304 if (!(tidr >> 16)) {
302 timer->revision = 1; 305 timer->revision = 1;
303 timer->sys_stat = timer->io_base +
304 OMAP_TIMER_V1_SYS_STAT_OFFSET;
305 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET; 306 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET;
306 timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET; 307 timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET;
307 timer->irq_dis = NULL; 308 timer->irq_dis = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET;
308 timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET; 309 timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET;
309 timer->func_base = timer->io_base; 310 timer->func_base = timer->io_base;
310 } else { 311 } else {
311 timer->revision = 2; 312 timer->revision = 2;
312 timer->sys_stat = NULL;
313 timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS; 313 timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS;
314 timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET; 314 timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET;
315 timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR; 315 timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR;
@@ -320,45 +320,44 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
320 } 320 }
321} 321}
322 322
323/* Assumes the source clock has been set by caller */ 323/*
324static inline void __omap_dm_timer_reset(struct omap_dm_timer *timer, 324 * __omap_dm_timer_enable_posted - enables write posted mode
325 int autoidle, int wakeup) 325 * @timer: pointer to timer instance handle
326 *
327 * Enables the write posted mode for the timer. When posted mode is enabled
328 * writes to certain timer registers are immediately acknowledged by the
329 * internal bus and hence prevents stalling the CPU waiting for the write to
330 * complete. Enabling this feature can improve performance for writing to the
331 * timer registers.
332 */
333static inline void __omap_dm_timer_enable_posted(struct omap_dm_timer *timer)
326{ 334{
327 u32 l; 335 if (timer->posted)
336 return;
328 337
329 l = __raw_readl(timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET); 338 if (timer->errata & OMAP_TIMER_ERRATA_I103_I767)
330 l |= 0x02 << 3; /* Set to smart-idle mode */ 339 return;
331 l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */
332 340
333 if (autoidle)
334 l |= 0x1 << 0;
335
336 if (wakeup)
337 l |= 1 << 2;
338
339 __raw_writel(l, timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET);
340
341 /* Match hardware reset default of posted mode */
342 __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, 341 __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG,
343 OMAP_TIMER_CTRL_POSTED, 0); 342 OMAP_TIMER_CTRL_POSTED, 0);
343 timer->context.tsicr = OMAP_TIMER_CTRL_POSTED;
344 timer->posted = OMAP_TIMER_POSTED;
344} 345}
345 346
346static inline int __omap_dm_timer_set_source(struct clk *timer_fck, 347/**
347 struct clk *parent) 348 * __omap_dm_timer_override_errata - override errata flags for a timer
349 * @timer: pointer to timer handle
350 * @errata: errata flags to be ignored
351 *
352 * For a given timer, override a timer errata by clearing the flags
353 * specified by the errata argument. A specific erratum should only be
354 * overridden for a timer if the timer is used in such a way the erratum
355 * has no impact.
356 */
357static inline void __omap_dm_timer_override_errata(struct omap_dm_timer *timer,
358 u32 errata)
348{ 359{
349 int ret; 360 timer->errata &= ~errata;
350
351 clk_disable(timer_fck);
352 ret = clk_set_parent(timer_fck, parent);
353 clk_enable(timer_fck);
354
355 /*
356 * When the functional clock disappears, too quick writes seem
357 * to cause an abort. XXX Is this still necessary?
358 */
359 __delay(300000);
360
361 return ret;
362} 361}
363 362
364static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer, 363static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer,
diff --git a/arch/arm/plat-omap/include/plat/fpga.h b/arch/arm/plat-omap/include/plat/fpga.h
deleted file mode 100644
index bd3c6324ae1..00000000000
--- a/arch/arm/plat-omap/include/plat/fpga.h
+++ /dev/null
@@ -1,193 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/fpga.h
3 *
4 * Interrupt handler for OMAP-1510 FPGA
5 *
6 * Copyright (C) 2001 RidgeRun, Inc.
7 * Author: Greg Lonnon <glonnon@ridgerun.com>
8 *
9 * Copyright (C) 2002 MontaVista Software, Inc.
10 *
11 * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
12 * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#ifndef __ASM_ARCH_OMAP_FPGA_H
20#define __ASM_ARCH_OMAP_FPGA_H
21
22extern void omap1510_fpga_init_irq(void);
23
24#define fpga_read(reg) __raw_readb(reg)
25#define fpga_write(val, reg) __raw_writeb(val, reg)
26
27/*
28 * ---------------------------------------------------------------------------
29 * H2/P2 Debug board FPGA
30 * ---------------------------------------------------------------------------
31 */
32/* maps in the FPGA registers and the ETHR registers */
33#define H2P2_DBG_FPGA_BASE 0xE8000000 /* VA */
34#define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */
35#define H2P2_DBG_FPGA_START 0x04000000 /* PA */
36
37#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
38#define H2P2_DBG_FPGA_FPGA_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */
39#define H2P2_DBG_FPGA_BOARD_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x12) /* Board Revision */
40#define H2P2_DBG_FPGA_GPIO IOMEM(H2P2_DBG_FPGA_BASE + 0x14) /* GPIO outputs */
41#define H2P2_DBG_FPGA_LEDS IOMEM(H2P2_DBG_FPGA_BASE + 0x16) /* LEDs outputs */
42#define H2P2_DBG_FPGA_MISC_INPUTS IOMEM(H2P2_DBG_FPGA_BASE + 0x18) /* Misc inputs */
43#define H2P2_DBG_FPGA_LAN_STATUS IOMEM(H2P2_DBG_FPGA_BASE + 0x1A) /* LAN Status line */
44#define H2P2_DBG_FPGA_LAN_RESET IOMEM(H2P2_DBG_FPGA_BASE + 0x1C) /* LAN Reset line */
45
46/* NOTE: most boards don't have a static mapping for the FPGA ... */
47struct h2p2_dbg_fpga {
48 /* offset 0x00 */
49 u16 smc91x[8];
50 /* offset 0x10 */
51 u16 fpga_rev;
52 u16 board_rev;
53 u16 gpio_outputs;
54 u16 leds;
55 /* offset 0x18 */
56 u16 misc_inputs;
57 u16 lan_status;
58 u16 lan_reset;
59 u16 reserved0;
60 /* offset 0x20 */
61 u16 ps2_data;
62 u16 ps2_ctrl;
63 /* plus also 4 rs232 ports ... */
64};
65
66/* LEDs definition on debug board (16 LEDs, all physically green) */
67#define H2P2_DBG_FPGA_LED_GREEN (1 << 15)
68#define H2P2_DBG_FPGA_LED_AMBER (1 << 14)
69#define H2P2_DBG_FPGA_LED_RED (1 << 13)
70#define H2P2_DBG_FPGA_LED_BLUE (1 << 12)
71/* cpu0 load-meter LEDs */
72#define H2P2_DBG_FPGA_LOAD_METER (1 << 0) // A bit of fun on our board ...
73#define H2P2_DBG_FPGA_LOAD_METER_SIZE 11
74#define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
75
76#define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0)
77#define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1)
78
79/*
80 * ---------------------------------------------------------------------------
81 * OMAP-1510 FPGA
82 * ---------------------------------------------------------------------------
83 */
84#define OMAP1510_FPGA_BASE 0xE8000000 /* VA */
85#define OMAP1510_FPGA_SIZE SZ_4K
86#define OMAP1510_FPGA_START 0x08000000 /* PA */
87
88/* Revision */
89#define OMAP1510_FPGA_REV_LOW IOMEM(OMAP1510_FPGA_BASE + 0x0)
90#define OMAP1510_FPGA_REV_HIGH IOMEM(OMAP1510_FPGA_BASE + 0x1)
91
92#define OMAP1510_FPGA_LCD_PANEL_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x2)
93#define OMAP1510_FPGA_LED_DIGIT IOMEM(OMAP1510_FPGA_BASE + 0x3)
94#define INNOVATOR_FPGA_HID_SPI IOMEM(OMAP1510_FPGA_BASE + 0x4)
95#define OMAP1510_FPGA_POWER IOMEM(OMAP1510_FPGA_BASE + 0x5)
96
97/* Interrupt status */
98#define OMAP1510_FPGA_ISR_LO IOMEM(OMAP1510_FPGA_BASE + 0x6)
99#define OMAP1510_FPGA_ISR_HI IOMEM(OMAP1510_FPGA_BASE + 0x7)
100
101/* Interrupt mask */
102#define OMAP1510_FPGA_IMR_LO IOMEM(OMAP1510_FPGA_BASE + 0x8)
103#define OMAP1510_FPGA_IMR_HI IOMEM(OMAP1510_FPGA_BASE + 0x9)
104
105/* Reset registers */
106#define OMAP1510_FPGA_HOST_RESET IOMEM(OMAP1510_FPGA_BASE + 0xa)
107#define OMAP1510_FPGA_RST IOMEM(OMAP1510_FPGA_BASE + 0xb)
108
109#define OMAP1510_FPGA_AUDIO IOMEM(OMAP1510_FPGA_BASE + 0xc)
110#define OMAP1510_FPGA_DIP IOMEM(OMAP1510_FPGA_BASE + 0xe)
111#define OMAP1510_FPGA_FPGA_IO IOMEM(OMAP1510_FPGA_BASE + 0xf)
112#define OMAP1510_FPGA_UART1 IOMEM(OMAP1510_FPGA_BASE + 0x14)
113#define OMAP1510_FPGA_UART2 IOMEM(OMAP1510_FPGA_BASE + 0x15)
114#define OMAP1510_FPGA_OMAP1510_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x16)
115#define OMAP1510_FPGA_BOARD_REV IOMEM(OMAP1510_FPGA_BASE + 0x18)
116#define OMAP1510P1_PPT_DATA IOMEM(OMAP1510_FPGA_BASE + 0x100)
117#define OMAP1510P1_PPT_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x101)
118#define OMAP1510P1_PPT_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x102)
119
120#define OMAP1510_FPGA_TOUCHSCREEN IOMEM(OMAP1510_FPGA_BASE + 0x204)
121
122#define INNOVATOR_FPGA_INFO IOMEM(OMAP1510_FPGA_BASE + 0x205)
123#define INNOVATOR_FPGA_LCD_BRIGHT_LO IOMEM(OMAP1510_FPGA_BASE + 0x206)
124#define INNOVATOR_FPGA_LCD_BRIGHT_HI IOMEM(OMAP1510_FPGA_BASE + 0x207)
125#define INNOVATOR_FPGA_LED_GRN_LO IOMEM(OMAP1510_FPGA_BASE + 0x208)
126#define INNOVATOR_FPGA_LED_GRN_HI IOMEM(OMAP1510_FPGA_BASE + 0x209)
127#define INNOVATOR_FPGA_LED_RED_LO IOMEM(OMAP1510_FPGA_BASE + 0x20a)
128#define INNOVATOR_FPGA_LED_RED_HI IOMEM(OMAP1510_FPGA_BASE + 0x20b)
129#define INNOVATOR_FPGA_CAM_USB_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20c)
130#define INNOVATOR_FPGA_EXP_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20d)
131#define INNOVATOR_FPGA_ISR2 IOMEM(OMAP1510_FPGA_BASE + 0x20e)
132#define INNOVATOR_FPGA_IMR2 IOMEM(OMAP1510_FPGA_BASE + 0x210)
133
134#define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300)
135
136/*
137 * Power up Giga UART driver, turn on HID clock.
138 * Turn off BT power, since we're not using it and it
139 * draws power.
140 */
141#define OMAP1510_FPGA_RESET_VALUE 0x42
142
143#define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7)
144#define OMAP1510_FPGA_PCR_COM2_EN (1 << 6)
145#define OMAP1510_FPGA_PCR_COM1_EN (1 << 5)
146#define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4)
147#define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3)
148#define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2)
149#define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1)
150#define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0)
151
152/*
153 * Innovator/OMAP1510 FPGA HID register bit definitions
154 */
155#define OMAP1510_FPGA_HID_SCLK (1<<0) /* output */
156#define OMAP1510_FPGA_HID_MOSI (1<<1) /* output */
157#define OMAP1510_FPGA_HID_nSS (1<<2) /* output 0/1 chip idle/select */
158#define OMAP1510_FPGA_HID_nHSUS (1<<3) /* output 0/1 host active/suspended */
159#define OMAP1510_FPGA_HID_MISO (1<<4) /* input */
160#define OMAP1510_FPGA_HID_ATN (1<<5) /* input 0/1 chip idle/ATN */
161#define OMAP1510_FPGA_HID_rsrvd (1<<6)
162#define OMAP1510_FPGA_HID_RESETn (1<<7) /* output - 0/1 USAR reset/run */
163
164/* The FPGA IRQ is cascaded through GPIO_13 */
165#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
166
167/* IRQ Numbers for interrupts muxed through the FPGA */
168#define OMAP1510_INT_FPGA_ATN (OMAP_FPGA_IRQ_BASE + 0)
169#define OMAP1510_INT_FPGA_ACK (OMAP_FPGA_IRQ_BASE + 1)
170#define OMAP1510_INT_FPGA2 (OMAP_FPGA_IRQ_BASE + 2)
171#define OMAP1510_INT_FPGA3 (OMAP_FPGA_IRQ_BASE + 3)
172#define OMAP1510_INT_FPGA4 (OMAP_FPGA_IRQ_BASE + 4)
173#define OMAP1510_INT_FPGA5 (OMAP_FPGA_IRQ_BASE + 5)
174#define OMAP1510_INT_FPGA6 (OMAP_FPGA_IRQ_BASE + 6)
175#define OMAP1510_INT_FPGA7 (OMAP_FPGA_IRQ_BASE + 7)
176#define OMAP1510_INT_FPGA8 (OMAP_FPGA_IRQ_BASE + 8)
177#define OMAP1510_INT_FPGA9 (OMAP_FPGA_IRQ_BASE + 9)
178#define OMAP1510_INT_FPGA10 (OMAP_FPGA_IRQ_BASE + 10)
179#define OMAP1510_INT_FPGA11 (OMAP_FPGA_IRQ_BASE + 11)
180#define OMAP1510_INT_FPGA12 (OMAP_FPGA_IRQ_BASE + 12)
181#define OMAP1510_INT_ETHER (OMAP_FPGA_IRQ_BASE + 13)
182#define OMAP1510_INT_FPGAUART1 (OMAP_FPGA_IRQ_BASE + 14)
183#define OMAP1510_INT_FPGAUART2 (OMAP_FPGA_IRQ_BASE + 15)
184#define OMAP1510_INT_FPGA_TS (OMAP_FPGA_IRQ_BASE + 16)
185#define OMAP1510_INT_FPGA17 (OMAP_FPGA_IRQ_BASE + 17)
186#define OMAP1510_INT_FPGA_CAM (OMAP_FPGA_IRQ_BASE + 18)
187#define OMAP1510_INT_FPGA_RTC_A (OMAP_FPGA_IRQ_BASE + 19)
188#define OMAP1510_INT_FPGA_RTC_B (OMAP_FPGA_IRQ_BASE + 20)
189#define OMAP1510_INT_FPGA_CD (OMAP_FPGA_IRQ_BASE + 21)
190#define OMAP1510_INT_FPGA22 (OMAP_FPGA_IRQ_BASE + 22)
191#define OMAP1510_INT_FPGA23 (OMAP_FPGA_IRQ_BASE + 23)
192
193#endif
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h
index 7c22b9e10dc..7a9028cb5a7 100644
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -18,11 +18,15 @@
18 * 02110-1301 USA 18 * 02110-1301 USA
19 * 19 *
20 */ 20 */
21#ifndef __ASM__ARCH_OMAP_I2C_H
22#define __ASM__ARCH_OMAP_I2C_H
23 21
24#include <linux/i2c.h> 22#ifndef __PLAT_OMAP_I2C_H
25#include <linux/i2c-omap.h> 23#define __PLAT_OMAP_I2C_H
24
25struct i2c_board_info;
26struct omap_i2c_bus_platform_data;
27
28int omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
29 int bus_id);
26 30
27#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) 31#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
28extern int omap_register_i2c_bus(int bus_id, u32 clkrate, 32extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
@@ -37,23 +41,7 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
37} 41}
38#endif 42#endif
39 43
40/**
41 * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
42 * @fifo_depth: total controller FIFO size (in bytes)
43 * @flags: differences in hardware support capability
44 *
45 * @fifo_depth represents what exists on the hardware, not what is
46 * actually configured at runtime by the device driver.
47 */
48struct omap_i2c_dev_attr {
49 u8 fifo_depth;
50 u32 flags;
51};
52
53void __init omap1_i2c_mux_pins(int bus_id);
54void __init omap2_i2c_mux_pins(int bus_id);
55
56struct omap_hwmod; 44struct omap_hwmod;
57int omap_i2c_reset(struct omap_hwmod *oh); 45int omap_i2c_reset(struct omap_hwmod *oh);
58 46
59#endif /* __ASM__ARCH_OMAP_I2C_H */ 47#endif /* __PLAT_OMAP_I2C_H */
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
deleted file mode 100644
index 68b5f0362f3..00000000000
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ /dev/null
@@ -1,221 +0,0 @@
1/*
2 * omap iommu: main structures
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __MACH_IOMMU_H
14#define __MACH_IOMMU_H
15
16struct iotlb_entry {
17 u32 da;
18 u32 pa;
19 u32 pgsz, prsvd, valid;
20 union {
21 u16 ap;
22 struct {
23 u32 endian, elsz, mixed;
24 };
25 };
26};
27
28struct omap_iommu {
29 const char *name;
30 struct module *owner;
31 struct clk *clk;
32 void __iomem *regbase;
33 struct device *dev;
34 void *isr_priv;
35 struct iommu_domain *domain;
36
37 unsigned int refcount;
38 spinlock_t iommu_lock; /* global for this whole object */
39
40 /*
41 * We don't change iopgd for a situation like pgd for a task,
42 * but share it globally for each iommu.
43 */
44 u32 *iopgd;
45 spinlock_t page_table_lock; /* protect iopgd */
46
47 int nr_tlb_entries;
48
49 struct list_head mmap;
50 struct mutex mmap_lock; /* protect mmap */
51
52 void *ctx; /* iommu context: registres saved area */
53 u32 da_start;
54 u32 da_end;
55};
56
57struct cr_regs {
58 union {
59 struct {
60 u16 cam_l;
61 u16 cam_h;
62 };
63 u32 cam;
64 };
65 union {
66 struct {
67 u16 ram_l;
68 u16 ram_h;
69 };
70 u32 ram;
71 };
72};
73
74struct iotlb_lock {
75 short base;
76 short vict;
77};
78
79/* architecture specific functions */
80struct iommu_functions {
81 unsigned long version;
82
83 int (*enable)(struct omap_iommu *obj);
84 void (*disable)(struct omap_iommu *obj);
85 void (*set_twl)(struct omap_iommu *obj, bool on);
86 u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra);
87
88 void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr);
89 void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr);
90
91 struct cr_regs *(*alloc_cr)(struct omap_iommu *obj,
92 struct iotlb_entry *e);
93 int (*cr_valid)(struct cr_regs *cr);
94 u32 (*cr_to_virt)(struct cr_regs *cr);
95 void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e);
96 ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr,
97 char *buf);
98
99 u32 (*get_pte_attr)(struct iotlb_entry *e);
100
101 void (*save_ctx)(struct omap_iommu *obj);
102 void (*restore_ctx)(struct omap_iommu *obj);
103 ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
104};
105
106/**
107 * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod
108 * @da_start: device address where the va space starts.
109 * @da_end: device address where the va space ends.
110 * @nr_tlb_entries: number of entries supported by the translation
111 * look-aside buffer (TLB).
112 */
113struct omap_mmu_dev_attr {
114 u32 da_start;
115 u32 da_end;
116 int nr_tlb_entries;
117};
118
119struct iommu_platform_data {
120 const char *name;
121 const char *clk_name;
122 const int nr_tlb_entries;
123 u32 da_start;
124 u32 da_end;
125};
126
127/**
128 * struct iommu_arch_data - omap iommu private data
129 * @name: name of the iommu device
130 * @iommu_dev: handle of the iommu device
131 *
132 * This is an omap iommu private data object, which binds an iommu user
133 * to its iommu device. This object should be placed at the iommu user's
134 * dev_archdata so generic IOMMU API can be used without having to
135 * utilize omap-specific plumbing anymore.
136 */
137struct omap_iommu_arch_data {
138 const char *name;
139 struct omap_iommu *iommu_dev;
140};
141
142#ifdef CONFIG_IOMMU_API
143/**
144 * dev_to_omap_iommu() - retrieves an omap iommu object from a user device
145 * @dev: iommu client device
146 */
147static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
148{
149 struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
150
151 return arch_data->iommu_dev;
152}
153#endif
154
155/* IOMMU errors */
156#define OMAP_IOMMU_ERR_TLB_MISS (1 << 0)
157#define OMAP_IOMMU_ERR_TRANS_FAULT (1 << 1)
158#define OMAP_IOMMU_ERR_EMU_MISS (1 << 2)
159#define OMAP_IOMMU_ERR_TBLWALK_FAULT (1 << 3)
160#define OMAP_IOMMU_ERR_MULTIHIT_FAULT (1 << 4)
161
162#if defined(CONFIG_ARCH_OMAP1)
163#error "iommu for this processor not implemented yet"
164#else
165#include <plat/iommu2.h>
166#endif
167
168/*
169 * utilities for super page(16MB, 1MB, 64KB and 4KB)
170 */
171
172#define iopgsz_max(bytes) \
173 (((bytes) >= SZ_16M) ? SZ_16M : \
174 ((bytes) >= SZ_1M) ? SZ_1M : \
175 ((bytes) >= SZ_64K) ? SZ_64K : \
176 ((bytes) >= SZ_4K) ? SZ_4K : 0)
177
178#define bytes_to_iopgsz(bytes) \
179 (((bytes) == SZ_16M) ? MMU_CAM_PGSZ_16M : \
180 ((bytes) == SZ_1M) ? MMU_CAM_PGSZ_1M : \
181 ((bytes) == SZ_64K) ? MMU_CAM_PGSZ_64K : \
182 ((bytes) == SZ_4K) ? MMU_CAM_PGSZ_4K : -1)
183
184#define iopgsz_to_bytes(iopgsz) \
185 (((iopgsz) == MMU_CAM_PGSZ_16M) ? SZ_16M : \
186 ((iopgsz) == MMU_CAM_PGSZ_1M) ? SZ_1M : \
187 ((iopgsz) == MMU_CAM_PGSZ_64K) ? SZ_64K : \
188 ((iopgsz) == MMU_CAM_PGSZ_4K) ? SZ_4K : 0)
189
190#define iopgsz_ok(bytes) (bytes_to_iopgsz(bytes) >= 0)
191
192/*
193 * global functions
194 */
195extern u32 omap_iommu_arch_version(void);
196
197extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e);
198
199extern int
200omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e);
201
202extern int omap_iommu_set_isr(const char *name,
203 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
204 void *priv),
205 void *isr_priv);
206
207extern void omap_iommu_save_ctx(struct device *dev);
208extern void omap_iommu_restore_ctx(struct device *dev);
209
210extern int omap_install_iommu_arch(const struct iommu_functions *ops);
211extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
212
213extern int omap_foreach_iommu_device(void *data,
214 int (*fn)(struct device *, void *));
215
216extern ssize_t
217omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
218extern size_t
219omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len);
220
221#endif /* __MACH_IOMMU_H */
diff --git a/arch/arm/plat-omap/include/plat/iommu2.h b/arch/arm/plat-omap/include/plat/iommu2.h
deleted file mode 100644
index d4116b595e4..00000000000
--- a/arch/arm/plat-omap/include/plat/iommu2.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * omap iommu: omap2 architecture specific definitions
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __MACH_IOMMU2_H
14#define __MACH_IOMMU2_H
15
16#include <linux/io.h>
17
18/*
19 * MMU Register offsets
20 */
21#define MMU_REVISION 0x00
22#define MMU_SYSCONFIG 0x10
23#define MMU_SYSSTATUS 0x14
24#define MMU_IRQSTATUS 0x18
25#define MMU_IRQENABLE 0x1c
26#define MMU_WALKING_ST 0x40
27#define MMU_CNTL 0x44
28#define MMU_FAULT_AD 0x48
29#define MMU_TTB 0x4c
30#define MMU_LOCK 0x50
31#define MMU_LD_TLB 0x54
32#define MMU_CAM 0x58
33#define MMU_RAM 0x5c
34#define MMU_GFLUSH 0x60
35#define MMU_FLUSH_ENTRY 0x64
36#define MMU_READ_CAM 0x68
37#define MMU_READ_RAM 0x6c
38#define MMU_EMU_FAULT_AD 0x70
39
40#define MMU_REG_SIZE 256
41
42/*
43 * MMU Register bit definitions
44 */
45#define MMU_LOCK_BASE_SHIFT 10
46#define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT)
47#define MMU_LOCK_BASE(x) \
48 ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
49
50#define MMU_LOCK_VICT_SHIFT 4
51#define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT)
52#define MMU_LOCK_VICT(x) \
53 ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
54
55#define MMU_CAM_VATAG_SHIFT 12
56#define MMU_CAM_VATAG_MASK \
57 ((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
58#define MMU_CAM_P (1 << 3)
59#define MMU_CAM_V (1 << 2)
60#define MMU_CAM_PGSZ_MASK 3
61#define MMU_CAM_PGSZ_1M (0 << 0)
62#define MMU_CAM_PGSZ_64K (1 << 0)
63#define MMU_CAM_PGSZ_4K (2 << 0)
64#define MMU_CAM_PGSZ_16M (3 << 0)
65
66#define MMU_RAM_PADDR_SHIFT 12
67#define MMU_RAM_PADDR_MASK \
68 ((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
69#define MMU_RAM_ENDIAN_SHIFT 9
70#define MMU_RAM_ENDIAN_MASK (1 << MMU_RAM_ENDIAN_SHIFT)
71#define MMU_RAM_ENDIAN_BIG (1 << MMU_RAM_ENDIAN_SHIFT)
72#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT)
73#define MMU_RAM_ELSZ_SHIFT 7
74#define MMU_RAM_ELSZ_MASK (3 << MMU_RAM_ELSZ_SHIFT)
75#define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT)
76#define MMU_RAM_ELSZ_16 (1 << MMU_RAM_ELSZ_SHIFT)
77#define MMU_RAM_ELSZ_32 (2 << MMU_RAM_ELSZ_SHIFT)
78#define MMU_RAM_ELSZ_NONE (3 << MMU_RAM_ELSZ_SHIFT)
79#define MMU_RAM_MIXED_SHIFT 6
80#define MMU_RAM_MIXED_MASK (1 << MMU_RAM_MIXED_SHIFT)
81#define MMU_RAM_MIXED MMU_RAM_MIXED_MASK
82
83/*
84 * register accessors
85 */
86static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs)
87{
88 return __raw_readl(obj->regbase + offs);
89}
90
91static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
92{
93 __raw_writel(val, obj->regbase + offs);
94}
95
96#endif /* __MACH_IOMMU2_H */
diff --git a/arch/arm/plat-omap/include/plat/iopgtable.h b/arch/arm/plat-omap/include/plat/iopgtable.h
deleted file mode 100644
index 66a813977d5..00000000000
--- a/arch/arm/plat-omap/include/plat/iopgtable.h
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * omap iommu: pagetable definitions
3 *
4 * Copyright (C) 2008-2010 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __PLAT_OMAP_IOMMU_H
14#define __PLAT_OMAP_IOMMU_H
15
16/*
17 * "L2 table" address mask and size definitions.
18 */
19#define IOPGD_SHIFT 20
20#define IOPGD_SIZE (1UL << IOPGD_SHIFT)
21#define IOPGD_MASK (~(IOPGD_SIZE - 1))
22
23/*
24 * "section" address mask and size definitions.
25 */
26#define IOSECTION_SHIFT 20
27#define IOSECTION_SIZE (1UL << IOSECTION_SHIFT)
28#define IOSECTION_MASK (~(IOSECTION_SIZE - 1))
29
30/*
31 * "supersection" address mask and size definitions.
32 */
33#define IOSUPER_SHIFT 24
34#define IOSUPER_SIZE (1UL << IOSUPER_SHIFT)
35#define IOSUPER_MASK (~(IOSUPER_SIZE - 1))
36
37#define PTRS_PER_IOPGD (1UL << (32 - IOPGD_SHIFT))
38#define IOPGD_TABLE_SIZE (PTRS_PER_IOPGD * sizeof(u32))
39
40/*
41 * "small page" address mask and size definitions.
42 */
43#define IOPTE_SHIFT 12
44#define IOPTE_SIZE (1UL << IOPTE_SHIFT)
45#define IOPTE_MASK (~(IOPTE_SIZE - 1))
46
47/*
48 * "large page" address mask and size definitions.
49 */
50#define IOLARGE_SHIFT 16
51#define IOLARGE_SIZE (1UL << IOLARGE_SHIFT)
52#define IOLARGE_MASK (~(IOLARGE_SIZE - 1))
53
54#define PTRS_PER_IOPTE (1UL << (IOPGD_SHIFT - IOPTE_SHIFT))
55#define IOPTE_TABLE_SIZE (PTRS_PER_IOPTE * sizeof(u32))
56
57#define IOPAGE_MASK IOPTE_MASK
58
59/**
60 * omap_iommu_translate() - va to pa translation
61 * @d: omap iommu descriptor
62 * @va: virtual address
63 * @mask: omap iommu descriptor mask
64 *
65 * va to pa translation
66 */
67static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
68{
69 return (d & mask) | (va & (~mask));
70}
71
72/*
73 * some descriptor attributes.
74 */
75#define IOPGD_TABLE (1 << 0)
76#define IOPGD_SECTION (2 << 0)
77#define IOPGD_SUPER (1 << 18 | 2 << 0)
78
79#define iopgd_is_table(x) (((x) & 3) == IOPGD_TABLE)
80#define iopgd_is_section(x) (((x) & (1 << 18 | 3)) == IOPGD_SECTION)
81#define iopgd_is_super(x) (((x) & (1 << 18 | 3)) == IOPGD_SUPER)
82
83#define IOPTE_SMALL (2 << 0)
84#define IOPTE_LARGE (1 << 0)
85
86#define iopte_is_small(x) (((x) & 2) == IOPTE_SMALL)
87#define iopte_is_large(x) (((x) & 3) == IOPTE_LARGE)
88
89/* to find an entry in a page-table-directory */
90#define iopgd_index(da) (((da) >> IOPGD_SHIFT) & (PTRS_PER_IOPGD - 1))
91#define iopgd_offset(obj, da) ((obj)->iopgd + iopgd_index(da))
92
93#define iopgd_page_paddr(iopgd) (*iopgd & ~((1 << 10) - 1))
94#define iopgd_page_vaddr(iopgd) ((u32 *)phys_to_virt(iopgd_page_paddr(iopgd)))
95
96/* to find an entry in the second-level page table. */
97#define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1))
98#define iopte_offset(iopgd, da) (iopgd_page_vaddr(iopgd) + iopte_index(da))
99
100static inline u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa,
101 u32 flags)
102{
103 memset(e, 0, sizeof(*e));
104
105 e->da = da;
106 e->pa = pa;
107 e->valid = 1;
108 /* FIXME: add OMAP1 support */
109 e->pgsz = flags & MMU_CAM_PGSZ_MASK;
110 e->endian = flags & MMU_RAM_ENDIAN_MASK;
111 e->elsz = flags & MMU_RAM_ELSZ_MASK;
112 e->mixed = flags & MMU_RAM_MIXED_MASK;
113
114 return iopgsz_to_bytes(e->pgsz);
115}
116
117#define to_iommu(dev) \
118 (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev))
119
120#endif /* __PLAT_OMAP_IOMMU_H */
diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h
deleted file mode 100644
index 498e57cda6c..00000000000
--- a/arch/arm/plat-omap/include/plat/iovmm.h
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * omap iommu: simple virtual address space management
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __IOMMU_MMAP_H
14#define __IOMMU_MMAP_H
15
16#include <linux/iommu.h>
17
18struct iovm_struct {
19 struct omap_iommu *iommu; /* iommu object which this belongs to */
20 u32 da_start; /* area definition */
21 u32 da_end;
22 u32 flags; /* IOVMF_: see below */
23 struct list_head list; /* linked in ascending order */
24 const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */
25 void *va; /* mpu side mapped address */
26};
27
28/*
29 * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma)
30 *
31 * lower 16 bit is used for h/w and upper 16 bit is for s/w.
32 */
33#define IOVMF_SW_SHIFT 16
34
35/*
36 * iovma: h/w flags derived from cam and ram attribute
37 */
38#define IOVMF_CAM_MASK (~((1 << 10) - 1))
39#define IOVMF_RAM_MASK (~IOVMF_CAM_MASK)
40
41#define IOVMF_PGSZ_MASK (3 << 0)
42#define IOVMF_PGSZ_1M MMU_CAM_PGSZ_1M
43#define IOVMF_PGSZ_64K MMU_CAM_PGSZ_64K
44#define IOVMF_PGSZ_4K MMU_CAM_PGSZ_4K
45#define IOVMF_PGSZ_16M MMU_CAM_PGSZ_16M
46
47#define IOVMF_ENDIAN_MASK (1 << 9)
48#define IOVMF_ENDIAN_BIG MMU_RAM_ENDIAN_BIG
49#define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE
50
51#define IOVMF_ELSZ_MASK (3 << 7)
52#define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8
53#define IOVMF_ELSZ_16 MMU_RAM_ELSZ_16
54#define IOVMF_ELSZ_32 MMU_RAM_ELSZ_32
55#define IOVMF_ELSZ_NONE MMU_RAM_ELSZ_NONE
56
57#define IOVMF_MIXED_MASK (1 << 6)
58#define IOVMF_MIXED MMU_RAM_MIXED
59
60/*
61 * iovma: s/w flags, used for mapping and umapping internally.
62 */
63#define IOVMF_MMIO (1 << IOVMF_SW_SHIFT)
64#define IOVMF_ALLOC (2 << IOVMF_SW_SHIFT)
65#define IOVMF_ALLOC_MASK (3 << IOVMF_SW_SHIFT)
66
67/* "superpages" is supported just with physically linear pages */
68#define IOVMF_DISCONT (1 << (2 + IOVMF_SW_SHIFT))
69#define IOVMF_LINEAR (2 << (2 + IOVMF_SW_SHIFT))
70#define IOVMF_LINEAR_MASK (3 << (2 + IOVMF_SW_SHIFT))
71
72#define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT))
73
74
75extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
76extern u32
77omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
78 const struct sg_table *sgt, u32 flags);
79extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
80 struct device *dev, u32 da);
81extern u32
82omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
83 u32 da, size_t bytes, u32 flags);
84extern void
85omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
86 const u32 da);
87extern void *omap_da_to_va(struct device *dev, u32 da);
88
89#endif /* __IOMMU_MMAP_H */
diff --git a/arch/arm/plat-omap/include/plat/led.h b/arch/arm/plat-omap/include/plat/led.h
deleted file mode 100644
index 25e451e7e2f..00000000000
--- a/arch/arm/plat-omap/include/plat/led.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/led.h
3 *
4 * Copyright (C) 2006 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@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#ifndef ASMARM_ARCH_LED_H
12#define ASMARM_ARCH_LED_H
13
14struct omap_led_config {
15 struct led_classdev cdev;
16 s16 gpio;
17};
18
19struct omap_led_platform_data {
20 s16 nr_leds;
21 struct omap_led_config *leds;
22};
23
24#endif
diff --git a/arch/arm/plat-omap/include/plat/menelaus.h b/arch/arm/plat-omap/include/plat/menelaus.h
deleted file mode 100644
index 4a970ec62dd..00000000000
--- a/arch/arm/plat-omap/include/plat/menelaus.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/menelaus.h
3 *
4 * Functions to access Menelaus power management chip
5 */
6
7#ifndef __ASM_ARCH_MENELAUS_H
8#define __ASM_ARCH_MENELAUS_H
9
10struct device;
11
12struct menelaus_platform_data {
13 int (* late_init)(struct device *dev);
14};
15
16extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask),
17 void *data);
18extern void menelaus_unregister_mmc_callback(void);
19extern int menelaus_set_mmc_opendrain(int slot, int enable);
20extern int menelaus_set_mmc_slot(int slot, int enable, int power, int cd_on);
21
22extern int menelaus_set_vmem(unsigned int mV);
23extern int menelaus_set_vio(unsigned int mV);
24extern int menelaus_set_vmmc(unsigned int mV);
25extern int menelaus_set_vaux(unsigned int mV);
26extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
27extern int menelaus_set_slot_sel(int enable);
28extern int menelaus_get_slot_pin_states(void);
29extern int menelaus_set_vcore_sw(unsigned int mV);
30extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
31
32#define EN_VPLL_SLEEP (1 << 7)
33#define EN_VMMC_SLEEP (1 << 6)
34#define EN_VAUX_SLEEP (1 << 5)
35#define EN_VIO_SLEEP (1 << 4)
36#define EN_VMEM_SLEEP (1 << 3)
37#define EN_DC3_SLEEP (1 << 2)
38#define EN_DC2_SLEEP (1 << 1)
39#define EN_VC_SLEEP (1 << 0)
40
41extern int menelaus_set_regulator_sleep(int enable, u32 val);
42
43#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
44#define omap_has_menelaus() 1
45#else
46#define omap_has_menelaus() 0
47#endif
48
49#endif
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
deleted file mode 100644
index 8b4e4f2da2f..00000000000
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ /dev/null
@@ -1,188 +0,0 @@
1/*
2 * MMC definitions for OMAP2
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __OMAP2_MMC_H
12#define __OMAP2_MMC_H
13
14#include <linux/types.h>
15#include <linux/device.h>
16#include <linux/mmc/host.h>
17
18#include <plat/omap_hwmod.h>
19
20#define OMAP15XX_NR_MMC 1
21#define OMAP16XX_NR_MMC 2
22#define OMAP1_MMC_SIZE 0x080
23#define OMAP1_MMC1_BASE 0xfffb7800
24#define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
25
26#define OMAP24XX_NR_MMC 2
27#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
28#define OMAP2_MMC1_BASE 0x4809c000
29
30#define OMAP4_MMC_REG_OFFSET 0x100
31
32#define OMAP_MMC_MAX_SLOTS 2
33
34/*
35 * struct omap_mmc_dev_attr.flags possibilities
36 *
37 * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
38 * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
39 * should be set if this is the case. See for example Section 22.5.3
40 * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
41 * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
42 *
43 * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
44 * don't work correctly on some MMC controller instances on some
45 * OMAP3 SoCs; this flag should be set if this is the case. See
46 * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
47 * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
48 * Revision F (October 2010) (SPRZ278F).
49 */
50#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
51#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
52
53struct omap_mmc_dev_attr {
54 u8 flags;
55};
56
57struct omap_mmc_platform_data {
58 /* back-link to device */
59 struct device *dev;
60
61 /* number of slots per controller */
62 unsigned nr_slots:2;
63
64 /* set if your board has components or wiring that limits the
65 * maximum frequency on the MMC bus */
66 unsigned int max_freq;
67
68 /* switch the bus to a new slot */
69 int (*switch_slot)(struct device *dev, int slot);
70 /* initialize board-specific MMC functionality, can be NULL if
71 * not supported */
72 int (*init)(struct device *dev);
73 void (*cleanup)(struct device *dev);
74 void (*shutdown)(struct device *dev);
75
76 /* To handle board related suspend/resume functionality for MMC */
77 int (*suspend)(struct device *dev, int slot);
78 int (*resume)(struct device *dev, int slot);
79
80 /* Return context loss count due to PM states changing */
81 int (*get_context_loss_count)(struct device *dev);
82
83 /* Integrating attributes from the omap_hwmod layer */
84 u8 controller_flags;
85
86 /* Register offset deviation */
87 u16 reg_offset;
88
89 struct omap_mmc_slot_data {
90
91 /*
92 * 4/8 wires and any additional host capabilities
93 * need to OR'd all capabilities (ref. linux/mmc/host.h)
94 */
95 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
96 u32 caps; /* Used for the MMC driver on 2430 and later */
97 u32 pm_caps; /* PM capabilities of the mmc */
98
99 /*
100 * nomux means "standard" muxing is wrong on this board, and
101 * that board-specific code handled it before common init logic.
102 */
103 unsigned nomux:1;
104
105 /* switch pin can be for card detect (default) or card cover */
106 unsigned cover:1;
107
108 /* use the internal clock */
109 unsigned internal_clock:1;
110
111 /* nonremovable e.g. eMMC */
112 unsigned nonremovable:1;
113
114 /* Try to sleep or power off when possible */
115 unsigned power_saving:1;
116
117 /* If using power_saving and the MMC power is not to go off */
118 unsigned no_off:1;
119
120 /* eMMC does not handle power off when not in sleep state */
121 unsigned no_regulator_off_init:1;
122
123 /* Regulator off remapped to sleep */
124 unsigned vcc_aux_disable_is_sleep:1;
125
126 /* we can put the features above into this variable */
127#define HSMMC_HAS_PBIAS (1 << 0)
128#define HSMMC_HAS_UPDATED_RESET (1 << 1)
129 unsigned features;
130
131 int switch_pin; /* gpio (card detect) */
132 int gpio_wp; /* gpio (write protect) */
133
134 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
135 int (*set_power)(struct device *dev, int slot,
136 int power_on, int vdd);
137 int (*get_ro)(struct device *dev, int slot);
138 void (*remux)(struct device *dev, int slot, int power_on);
139 /* Call back before enabling / disabling regulators */
140 void (*before_set_reg)(struct device *dev, int slot,
141 int power_on, int vdd);
142 /* Call back after enabling / disabling regulators */
143 void (*after_set_reg)(struct device *dev, int slot,
144 int power_on, int vdd);
145 /* if we have special card, init it using this callback */
146 void (*init_card)(struct mmc_card *card);
147
148 /* return MMC cover switch state, can be NULL if not supported.
149 *
150 * possible return values:
151 * 0 - closed
152 * 1 - open
153 */
154 int (*get_cover_state)(struct device *dev, int slot);
155
156 const char *name;
157 u32 ocr_mask;
158
159 /* Card detection IRQs */
160 int card_detect_irq;
161 int (*card_detect)(struct device *dev, int slot);
162
163 unsigned int ban_openended:1;
164
165 } slots[OMAP_MMC_MAX_SLOTS];
166};
167
168/* called from board-specific card detection service routine */
169extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
170 int is_closed);
171
172#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
173void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
174 int nr_controllers);
175void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
176#else
177static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
178 int nr_controllers)
179{
180}
181static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
182{
183}
184#endif
185
186extern int omap_msdi_reset(struct omap_hwmod *oh);
187
188#endif
diff --git a/arch/arm/plat-omap/include/plat/multi.h b/arch/arm/plat-omap/include/plat/multi.h
deleted file mode 100644
index 324d31b1485..00000000000
--- a/arch/arm/plat-omap/include/plat/multi.h
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * Support for compiling in multiple OMAP processors
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef __PLAT_OMAP_MULTI_H
23#define __PLAT_OMAP_MULTI_H
24
25/*
26 * Test if multicore OMAP support is needed
27 */
28#undef MULTI_OMAP1
29#undef MULTI_OMAP2
30#undef OMAP_NAME
31
32#ifdef CONFIG_ARCH_OMAP730
33# ifdef OMAP_NAME
34# undef MULTI_OMAP1
35# define MULTI_OMAP1
36# else
37# define OMAP_NAME omap730
38# endif
39#endif
40#ifdef CONFIG_ARCH_OMAP850
41# ifdef OMAP_NAME
42# undef MULTI_OMAP1
43# define MULTI_OMAP1
44# else
45# define OMAP_NAME omap850
46# endif
47#endif
48#ifdef CONFIG_ARCH_OMAP15XX
49# ifdef OMAP_NAME
50# undef MULTI_OMAP1
51# define MULTI_OMAP1
52# else
53# define OMAP_NAME omap1510
54# endif
55#endif
56#ifdef CONFIG_ARCH_OMAP16XX
57# ifdef OMAP_NAME
58# undef MULTI_OMAP1
59# define MULTI_OMAP1
60# else
61# define OMAP_NAME omap16xx
62# endif
63#endif
64#ifdef CONFIG_ARCH_OMAP2PLUS
65# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
66# error "OMAP1 and OMAP2PLUS can't be selected at the same time"
67# endif
68#endif
69#ifdef CONFIG_SOC_OMAP2420
70# ifdef OMAP_NAME
71# undef MULTI_OMAP2
72# define MULTI_OMAP2
73# else
74# define OMAP_NAME omap2420
75# endif
76#endif
77#ifdef CONFIG_SOC_OMAP2430
78# ifdef OMAP_NAME
79# undef MULTI_OMAP2
80# define MULTI_OMAP2
81# else
82# define OMAP_NAME omap2430
83# endif
84#endif
85#ifdef CONFIG_ARCH_OMAP3
86# ifdef OMAP_NAME
87# undef MULTI_OMAP2
88# define MULTI_OMAP2
89# else
90# define OMAP_NAME omap3
91# endif
92#endif
93#ifdef CONFIG_ARCH_OMAP4
94# ifdef OMAP_NAME
95# undef MULTI_OMAP2
96# define MULTI_OMAP2
97# else
98# define OMAP_NAME omap4
99# endif
100#endif
101
102#ifdef CONFIG_SOC_OMAP5
103# ifdef OMAP_NAME
104# undef MULTI_OMAP2
105# define MULTI_OMAP2
106# else
107# define OMAP_NAME omap5
108# endif
109#endif
110
111#ifdef CONFIG_SOC_AM33XX
112# ifdef OMAP_NAME
113# undef MULTI_OMAP2
114# define MULTI_OMAP2
115# else
116# define OMAP_NAME am33xx
117# endif
118#endif
119
120#endif /* __PLAT_OMAP_MULTI_H */
diff --git a/arch/arm/plat-omap/include/plat/omap-secure.h b/arch/arm/plat-omap/include/plat/omap-secure.h
deleted file mode 100644
index 0e4acd2d2de..00000000000
--- a/arch/arm/plat-omap/include/plat/omap-secure.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __OMAP_SECURE_H__
2#define __OMAP_SECURE_H__
3
4#include <linux/types.h>
5
6extern int omap_secure_ram_reserve_memblock(void);
7
8#ifdef CONFIG_OMAP4_ERRATA_I688
9extern int omap_barrier_reserve_memblock(void);
10#else
11static inline void omap_barrier_reserve_memblock(void)
12{ }
13#endif
14#endif /* __OMAP_SECURE_H__ */
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 1957a8516e9..ff9b0aab528 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -30,35 +30,6 @@
30 */ 30 */
31#define OMAP_SERIAL_NAME "ttyO" 31#define OMAP_SERIAL_NAME "ttyO"
32 32
33#define OMAP_MODE13X_SPEED 230400
34
35#define OMAP_UART_SCR_TX_EMPTY 0x08
36
37/* WER = 0x7F
38 * Enable module level wakeup in WER reg
39 */
40#define OMAP_UART_WER_MOD_WKUP 0X7F
41
42/* Enable XON/XOFF flow control on output */
43#define OMAP_UART_SW_TX 0x04
44
45/* Enable XON/XOFF flow control on input */
46#define OMAP_UART_SW_RX 0x04
47
48#define OMAP_UART_SYSC_RESET 0X07
49#define OMAP_UART_TCR_TRIG 0X0F
50#define OMAP_UART_SW_CLR 0XF0
51#define OMAP_UART_FIFO_CLR 0X06
52
53#define OMAP_UART_DMA_CH_FREE -1
54
55#define OMAP_MAX_HSUART_PORTS 6
56
57#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
58
59#define UART_ERRATA_i202_MDR1_ACCESS BIT(0)
60#define UART_ERRATA_i291_DMA_FORCEIDLE BIT(1)
61
62struct omap_uart_port_info { 33struct omap_uart_port_info {
63 bool dma_enabled; /* To specify DMA Mode */ 34 bool dma_enabled; /* To specify DMA Mode */
64 unsigned int uartclk; /* UART clock rate */ 35 unsigned int uartclk; /* UART clock rate */
@@ -77,30 +48,4 @@ struct omap_uart_port_info {
77 void (*enable_wakeup)(struct device *, bool); 48 void (*enable_wakeup)(struct device *, bool);
78}; 49};
79 50
80struct uart_omap_dma {
81 u8 uart_dma_tx;
82 u8 uart_dma_rx;
83 int rx_dma_channel;
84 int tx_dma_channel;
85 dma_addr_t rx_buf_dma_phys;
86 dma_addr_t tx_buf_dma_phys;
87 unsigned int uart_base;
88 /*
89 * Buffer for rx dma.It is not required for tx because the buffer
90 * comes from port structure.
91 */
92 unsigned char *rx_buf;
93 unsigned int prev_rx_dma_pos;
94 int tx_buf_size;
95 int tx_dma_used;
96 int rx_dma_used;
97 spinlock_t tx_lock;
98 spinlock_t rx_lock;
99 /* timer to poll activity on rx dma */
100 struct timer_list rx_timer;
101 unsigned int rx_buf_size;
102 unsigned int rx_poll_rate;
103 unsigned int rx_timeout;
104};
105
106#endif /* __OMAP_SERIAL_H__ */ 51#endif /* __OMAP_SERIAL_H__ */
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h
deleted file mode 100644
index 267f43bb2a4..00000000000
--- a/arch/arm/plat-omap/include/plat/prcm.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/prcm.h
3 *
4 * Access definations for use in OMAP24XX clock and power management
5 *
6 * Copyright (C) 2005 Texas Instruments, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * XXX This file is deprecated. The PRCM is an OMAP2+-only subsystem,
23 * so this file doesn't belong in plat-omap/include/plat. Please
24 * do not add anything new to this file.
25 */
26
27#ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
28#define __ASM_ARM_ARCH_OMAP_PRCM_H
29
30u32 omap_prcm_get_reset_sources(void);
31int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
32 const char *name);
33
34#endif
35
36
37
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h
deleted file mode 100644
index 36d6a766621..00000000000
--- a/arch/arm/plat-omap/include/plat/sdrc.h
+++ /dev/null
@@ -1,164 +0,0 @@
1#ifndef ____ASM_ARCH_SDRC_H
2#define ____ASM_ARCH_SDRC_H
3
4/*
5 * OMAP2/3 SDRC/SMS register definitions
6 *
7 * Copyright (C) 2007-2008 Texas Instruments, Inc.
8 * Copyright (C) 2007-2008 Nokia Corporation
9 *
10 * Tony Lindgren
11 * Paul Walmsley
12 * Richard Woodruff
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19
20/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
21
22#define SDRC_SYSCONFIG 0x010
23#define SDRC_CS_CFG 0x040
24#define SDRC_SHARING 0x044
25#define SDRC_ERR_TYPE 0x04C
26#define SDRC_DLLA_CTRL 0x060
27#define SDRC_DLLA_STATUS 0x064
28#define SDRC_DLLB_CTRL 0x068
29#define SDRC_DLLB_STATUS 0x06C
30#define SDRC_POWER 0x070
31#define SDRC_MCFG_0 0x080
32#define SDRC_MR_0 0x084
33#define SDRC_EMR2_0 0x08c
34#define SDRC_ACTIM_CTRL_A_0 0x09c
35#define SDRC_ACTIM_CTRL_B_0 0x0a0
36#define SDRC_RFR_CTRL_0 0x0a4
37#define SDRC_MANUAL_0 0x0a8
38#define SDRC_MCFG_1 0x0B0
39#define SDRC_MR_1 0x0B4
40#define SDRC_EMR2_1 0x0BC
41#define SDRC_ACTIM_CTRL_A_1 0x0C4
42#define SDRC_ACTIM_CTRL_B_1 0x0C8
43#define SDRC_RFR_CTRL_1 0x0D4
44#define SDRC_MANUAL_1 0x0D8
45
46#define SDRC_POWER_AUTOCOUNT_SHIFT 8
47#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
48#define SDRC_POWER_CLKCTRL_SHIFT 4
49#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
50#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
51
52/*
53 * These values represent the number of memory clock cycles between
54 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
55 * rows per device, and include a subtraction of a 50 cycle window in the
56 * event that the autorefresh command is delayed due to other SDRC activity.
57 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
58 * counter reaches 0.
59 *
60 * These represent optimal values for common parts, it won't work for all.
61 * As long as you scale down, most parameters are still work, they just
62 * become sub-optimal. The RFR value goes in the opposite direction. If you
63 * don't adjust it down as your clock period increases the refresh interval
64 * will not be met. Setting all parameters for complete worst case may work,
65 * but may cut memory performance by 2x. Due to errata the DLLs need to be
66 * unlocked and their value needs run time calibration. A dynamic call is
67 * need for that as no single right value exists acorss production samples.
68 *
69 * Only the FULL speed values are given. Current code is such that rate
70 * changes must be made at DPLLoutx2. The actual value adjustment for low
71 * frequency operation will be handled by omap_set_performance()
72 *
73 * By having the boot loader boot up in the fastest L4 speed available likely
74 * will result in something which you can switch between.
75 */
76#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
77#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
78#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
79#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
80#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
81
82
83/*
84 * SMS register access
85 */
86
87#define OMAP242X_SMS_REGADDR(reg) \
88 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
89#define OMAP243X_SMS_REGADDR(reg) \
90 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
91#define OMAP343X_SMS_REGADDR(reg) \
92 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
93
94/* SMS register offsets - read/write with sms_{read,write}_reg() */
95
96#define SMS_SYSCONFIG 0x010
97#define SMS_ROT_CONTROL(context) (0x180 + 0x10 * context)
98#define SMS_ROT_SIZE(context) (0x184 + 0x10 * context)
99#define SMS_ROT_PHYSICAL_BA(context) (0x188 + 0x10 * context)
100/* REVISIT: fill in other SMS registers here */
101
102
103#ifndef __ASSEMBLER__
104
105/**
106 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
107 * @rate: SDRC clock rate (in Hz)
108 * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
109 * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
110 * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
111 * @mr: Value to program to SDRC_MR for this rate
112 *
113 * This structure holds a pre-computed set of register values for the
114 * SDRC for a given SDRC clock rate and SDRAM chip. These are
115 * intended to be pre-computed and specified in an array in the board-*.c
116 * files. The structure is keyed off the 'rate' field.
117 */
118struct omap_sdrc_params {
119 unsigned long rate;
120 u32 actim_ctrla;
121 u32 actim_ctrlb;
122 u32 rfr_ctrl;
123 u32 mr;
124};
125
126#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
127void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
128 struct omap_sdrc_params *sdrc_cs1);
129#else
130static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
131 struct omap_sdrc_params *sdrc_cs1) {};
132#endif
133
134int omap2_sdrc_get_params(unsigned long r,
135 struct omap_sdrc_params **sdrc_cs0,
136 struct omap_sdrc_params **sdrc_cs1);
137void omap2_sms_save_context(void);
138void omap2_sms_restore_context(void);
139
140void omap2_sms_write_rot_control(u32 val, unsigned ctx);
141void omap2_sms_write_rot_size(u32 val, unsigned ctx);
142void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx);
143
144#ifdef CONFIG_ARCH_OMAP2
145
146struct memory_timings {
147 u32 m_type; /* ddr = 1, sdr = 0 */
148 u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
149 u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
150 u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
151 u32 base_cs; /* base chip select to use for calculations */
152};
153
154extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
155struct omap_sdrc_params *rx51_get_sdram_timings(void);
156
157u32 omap2xxx_sdrc_dll_is_unlocked(void);
158u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
159
160#endif /* CONFIG_ARCH_OMAP2 */
161
162#endif /* __ASSEMBLER__ */
163
164#endif
diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h
index 227ae265755..ba4525059a9 100644
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ b/arch/arm/plat-omap/include/plat/sram.h
@@ -1,18 +1,8 @@
1/* 1int omap_sram_init(void);
2 * arch/arm/plat-omap/include/mach/sram.h
3 *
4 * Interface for functions that need to be run in internal SRAM
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 2
11#ifndef __ARCH_ARM_OMAP_SRAM_H 3void omap_map_sram(unsigned long start, unsigned long size,
12#define __ARCH_ARM_OMAP_SRAM_H 4 unsigned long skip, int cached);
13 5void omap_sram_reset(void);
14#ifndef __ASSEMBLY__
15#include <asm/fncpy.h>
16 6
17extern void *omap_sram_push_address(unsigned long size); 7extern void *omap_sram_push_address(unsigned long size);
18 8
@@ -24,82 +14,3 @@ extern void *omap_sram_push_address(unsigned long size);
24 _res = fncpy(_sram_address, &(funcp), size); \ 14 _res = fncpy(_sram_address, &(funcp), size); \
25 _res; \ 15 _res; \
26}) 16})
27
28extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
29
30extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
31 u32 base_cs, u32 force_unlock);
32extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
33 u32 mem_type);
34extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
35
36extern u32 omap3_configure_core_dpll(
37 u32 m2, u32 unlock_dll, u32 f, u32 inc,
38 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
39 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
40 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
41 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
42extern void omap3_sram_restore_context(void);
43
44/* Do not use these */
45extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
46extern unsigned long omap1_sram_reprogram_clock_sz;
47
48extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
49extern unsigned long omap24xx_sram_reprogram_clock_sz;
50
51extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
52 u32 base_cs, u32 force_unlock);
53extern unsigned long omap242x_sram_ddr_init_sz;
54
55extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
56 int bypass);
57extern unsigned long omap242x_sram_set_prcm_sz;
58
59extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
60 u32 mem_type);
61extern unsigned long omap242x_sram_reprogram_sdrc_sz;
62
63
64extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
65 u32 base_cs, u32 force_unlock);
66extern unsigned long omap243x_sram_ddr_init_sz;
67
68extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
69 int bypass);
70extern unsigned long omap243x_sram_set_prcm_sz;
71
72extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
73 u32 mem_type);
74extern unsigned long omap243x_sram_reprogram_sdrc_sz;
75
76extern u32 omap3_sram_configure_core_dpll(
77 u32 m2, u32 unlock_dll, u32 f, u32 inc,
78 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
79 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
80 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
81 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
82extern unsigned long omap3_sram_configure_core_dpll_sz;
83
84#ifdef CONFIG_PM
85extern void omap_push_sram_idle(void);
86#else
87static inline void omap_push_sram_idle(void) {}
88#endif /* CONFIG_PM */
89
90#endif /* __ASSEMBLY__ */
91
92/*
93 * OMAP2+: define the SRAM PA addresses.
94 * Used by the SRAM management code and the idle sleep code.
95 */
96#define OMAP2_SRAM_PA 0x40200000
97#define OMAP3_SRAM_PA 0x40200000
98#ifdef CONFIG_OMAP4_ERRATA_I688
99#define OMAP4_SRAM_PA 0x40304000
100#define OMAP4_SRAM_VA 0xfe404000
101#else
102#define OMAP4_SRAM_PA 0x40300000
103#endif
104#define AM33XX_SRAM_PA 0x40300000
105#endif
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
deleted file mode 100644
index 7f7b112accc..00000000000
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ /dev/null
@@ -1,204 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Initially based on:
7 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Author: Greg Lonnon <glonnon@ridgerun.com>
10 *
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#include <linux/types.h>
21#include <linux/serial_reg.h>
22
23#include <asm/memory.h>
24#include <asm/mach-types.h>
25
26#include <plat/serial.h>
27
28#define MDR1_MODE_MASK 0x07
29
30volatile u8 *uart_base;
31int uart_shift;
32
33/*
34 * Store the DEBUG_LL uart number into memory.
35 * See also debug-macro.S, and serial.c for related code.
36 */
37static void set_omap_uart_info(unsigned char port)
38{
39 /*
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
42 */
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
46}
47
48static void putc(int c)
49{
50 if (!uart_base)
51 return;
52
53 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
56
57 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
58 barrier();
59 uart_base[UART_TX << uart_shift] = c;
60}
61
62static inline void flush(void)
63{
64}
65
66/*
67 * Macros to configure UART1 and debug UART
68 */
69#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
70 if (machine_is_##mach()) { \
71 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
74 set_omap_uart_info(port); \
75 break; \
76 }
77
78#define DEBUG_LL_OMAP7XX(p, mach) \
79 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
80 OMAP1UART##p)
81
82#define DEBUG_LL_OMAP1(p, mach) \
83 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP1UART##p)
85
86#define DEBUG_LL_OMAP2(p, mach) \
87 _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
88 OMAP2UART##p)
89
90#define DEBUG_LL_OMAP3(p, mach) \
91 _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
92 OMAP3UART##p)
93
94#define DEBUG_LL_OMAP4(p, mach) \
95 _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
96 OMAP4UART##p)
97
98#define DEBUG_LL_OMAP5(p, mach) \
99 _DEBUG_LL_ENTRY(mach, OMAP5_UART##p##_BASE, OMAP_PORT_SHIFT, \
100 OMAP5UART##p)
101/* Zoom2/3 shift is different for UART1 and external port */
102#define DEBUG_LL_ZOOM(mach) \
103 _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
104
105#define DEBUG_LL_TI81XX(p, mach) \
106 _DEBUG_LL_ENTRY(mach, TI81XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
107 TI81XXUART##p)
108
109#define DEBUG_LL_AM33XX(p, mach) \
110 _DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
111 AM33XXUART##p)
112
113static inline void arch_decomp_setup(void)
114{
115 int port = 0;
116
117 /*
118 * Initialize the port based on the machine ID from the bootloader.
119 * Note that we're using macros here instead of switch statement
120 * as machine_is functions are optimized out for the boards that
121 * are not selected.
122 */
123 do {
124 /* omap7xx/8xx based boards using UART1 with shift 0 */
125 DEBUG_LL_OMAP7XX(1, herald);
126 DEBUG_LL_OMAP7XX(1, omap_perseus2);
127
128 /* omap15xx/16xx based boards using UART1 */
129 DEBUG_LL_OMAP1(1, ams_delta);
130 DEBUG_LL_OMAP1(1, nokia770);
131 DEBUG_LL_OMAP1(1, omap_h2);
132 DEBUG_LL_OMAP1(1, omap_h3);
133 DEBUG_LL_OMAP1(1, omap_innovator);
134 DEBUG_LL_OMAP1(1, omap_osk);
135 DEBUG_LL_OMAP1(1, omap_palmte);
136 DEBUG_LL_OMAP1(1, omap_palmz71);
137
138 /* omap15xx/16xx based boards using UART2 */
139 DEBUG_LL_OMAP1(2, omap_palmtt);
140
141 /* omap15xx/16xx based boards using UART3 */
142 DEBUG_LL_OMAP1(3, sx1);
143
144 /* omap2 based boards using UART1 */
145 DEBUG_LL_OMAP2(1, omap_2430sdp);
146 DEBUG_LL_OMAP2(1, omap_apollon);
147 DEBUG_LL_OMAP2(1, omap_h4);
148
149 /* omap2 based boards using UART3 */
150 DEBUG_LL_OMAP2(3, nokia_n800);
151 DEBUG_LL_OMAP2(3, nokia_n810);
152 DEBUG_LL_OMAP2(3, nokia_n810_wimax);
153
154 /* omap3 based boards using UART1 */
155 DEBUG_LL_OMAP2(1, omap3evm);
156 DEBUG_LL_OMAP3(1, omap_3430sdp);
157 DEBUG_LL_OMAP3(1, omap_3630sdp);
158 DEBUG_LL_OMAP3(1, omap3530_lv_som);
159 DEBUG_LL_OMAP3(1, omap3_torpedo);
160
161 /* omap3 based boards using UART3 */
162 DEBUG_LL_OMAP3(3, cm_t35);
163 DEBUG_LL_OMAP3(3, cm_t3517);
164 DEBUG_LL_OMAP3(3, cm_t3730);
165 DEBUG_LL_OMAP3(3, craneboard);
166 DEBUG_LL_OMAP3(3, devkit8000);
167 DEBUG_LL_OMAP3(3, igep0020);
168 DEBUG_LL_OMAP3(3, igep0030);
169 DEBUG_LL_OMAP3(3, nokia_rm680);
170 DEBUG_LL_OMAP3(3, nokia_rm696);
171 DEBUG_LL_OMAP3(3, nokia_rx51);
172 DEBUG_LL_OMAP3(3, omap3517evm);
173 DEBUG_LL_OMAP3(3, omap3_beagle);
174 DEBUG_LL_OMAP3(3, omap3_pandora);
175 DEBUG_LL_OMAP3(3, omap_ldp);
176 DEBUG_LL_OMAP3(3, overo);
177 DEBUG_LL_OMAP3(3, touchbook);
178
179 /* omap4 based boards using UART3 */
180 DEBUG_LL_OMAP4(3, omap_4430sdp);
181 DEBUG_LL_OMAP4(3, omap4_panda);
182
183 /* omap5 based boards using UART3 */
184 DEBUG_LL_OMAP5(3, omap5_sevm);
185
186 /* zoom2/3 external uart */
187 DEBUG_LL_ZOOM(omap_zoom2);
188 DEBUG_LL_ZOOM(omap_zoom3);
189
190 /* TI8168 base boards using UART3 */
191 DEBUG_LL_TI81XX(3, ti8168evm);
192
193 /* TI8148 base boards using UART1 */
194 DEBUG_LL_TI81XX(1, ti8148evm);
195
196 /* AM33XX base boards using UART1 */
197 DEBUG_LL_AM33XX(1, am335xevm);
198 } while (0);
199}
200
201/*
202 * nothing to do
203 */
204#define arch_decomp_wdog()
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
deleted file mode 100644
index 87ee140fefa..00000000000
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ /dev/null
@@ -1,179 +0,0 @@
1// include/asm-arm/mach-omap/usb.h
2
3#ifndef __ASM_ARCH_OMAP_USB_H
4#define __ASM_ARCH_OMAP_USB_H
5
6#include <linux/io.h>
7#include <linux/platform_device.h>
8#include <linux/usb/musb.h>
9
10#define OMAP3_HS_USB_PORTS 3
11
12enum usbhs_omap_port_mode {
13 OMAP_USBHS_PORT_MODE_UNUSED,
14 OMAP_EHCI_PORT_MODE_PHY,
15 OMAP_EHCI_PORT_MODE_TLL,
16 OMAP_EHCI_PORT_MODE_HSIC,
17 OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
18 OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
19 OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
20 OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
21 OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
22 OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
23 OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
24 OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
25 OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
26 OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM
27};
28
29struct usbhs_omap_board_data {
30 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
31
32 /* have to be valid if phy_reset is true and portx is in phy mode */
33 int reset_gpio_port[OMAP3_HS_USB_PORTS];
34
35 /* Set this to true for ES2.x silicon */
36 unsigned es2_compatibility:1;
37
38 unsigned phy_reset:1;
39
40 /*
41 * Regulators for USB PHYs.
42 * Each PHY can have a separate regulator.
43 */
44 struct regulator *regulator[OMAP3_HS_USB_PORTS];
45};
46
47#ifdef CONFIG_ARCH_OMAP2PLUS
48
49struct ehci_hcd_omap_platform_data {
50 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
51 int reset_gpio_port[OMAP3_HS_USB_PORTS];
52 struct regulator *regulator[OMAP3_HS_USB_PORTS];
53 unsigned phy_reset:1;
54};
55
56struct ohci_hcd_omap_platform_data {
57 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
58 unsigned es2_compatibility:1;
59};
60
61struct usbhs_omap_platform_data {
62 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
63
64 struct ehci_hcd_omap_platform_data *ehci_data;
65 struct ohci_hcd_omap_platform_data *ohci_data;
66};
67
68struct usbtll_omap_platform_data {
69 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
70};
71/*-------------------------------------------------------------------------*/
72
73struct omap_musb_board_data {
74 u8 interface_type;
75 u8 mode;
76 u16 power;
77 unsigned extvbus:1;
78 void (*set_phy_power)(u8 on);
79 void (*clear_irq)(void);
80 void (*set_mode)(u8 mode);
81 void (*reset)(void);
82};
83
84enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
85
86extern void usb_musb_init(struct omap_musb_board_data *board_data);
87
88extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
89extern int omap_tll_enable(void);
90extern int omap_tll_disable(void);
91
92extern int omap4430_phy_power(struct device *dev, int ID, int on);
93extern int omap4430_phy_set_clk(struct device *dev, int on);
94extern int omap4430_phy_init(struct device *dev);
95extern int omap4430_phy_exit(struct device *dev);
96extern int omap4430_phy_suspend(struct device *dev, int suspend);
97
98#endif
99
100extern void am35x_musb_reset(void);
101extern void am35x_musb_phy_power(u8 on);
102extern void am35x_musb_clear_irq(void);
103extern void am35x_set_mode(u8 musb_mode);
104extern void ti81xx_musb_phy_power(u8 on);
105
106/* AM35x */
107/* USB 2.0 PHY Control */
108#define CONF2_PHY_GPIOMODE (1 << 23)
109#define CONF2_OTGMODE (3 << 14)
110#define CONF2_NO_OVERRIDE (0 << 14)
111#define CONF2_FORCE_HOST (1 << 14)
112#define CONF2_FORCE_DEVICE (2 << 14)
113#define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
114#define CONF2_SESENDEN (1 << 13)
115#define CONF2_VBDTCTEN (1 << 12)
116#define CONF2_REFFREQ_24MHZ (2 << 8)
117#define CONF2_REFFREQ_26MHZ (7 << 8)
118#define CONF2_REFFREQ_13MHZ (6 << 8)
119#define CONF2_REFFREQ (0xf << 8)
120#define CONF2_PHYCLKGD (1 << 7)
121#define CONF2_VBUSSENSE (1 << 6)
122#define CONF2_PHY_PLLON (1 << 5)
123#define CONF2_RESET (1 << 4)
124#define CONF2_PHYPWRDN (1 << 3)
125#define CONF2_OTGPWRDN (1 << 2)
126#define CONF2_DATPOL (1 << 1)
127
128/* TI81XX specific definitions */
129#define USBCTRL0 0x620
130#define USBSTAT0 0x624
131
132/* TI816X PHY controls bits */
133#define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
134#define TI816X_USBPHY_REFCLK_OSC (1 << 8)
135
136/* TI814X PHY controls bits */
137#define USBPHY_CM_PWRDN (1 << 0)
138#define USBPHY_OTG_PWRDN (1 << 1)
139#define USBPHY_CHGDET_DIS (1 << 2)
140#define USBPHY_CHGDET_RSTRT (1 << 3)
141#define USBPHY_SRCONDM (1 << 4)
142#define USBPHY_SINKONDP (1 << 5)
143#define USBPHY_CHGISINK_EN (1 << 6)
144#define USBPHY_CHGVSRC_EN (1 << 7)
145#define USBPHY_DMPULLUP (1 << 8)
146#define USBPHY_DPPULLUP (1 << 9)
147#define USBPHY_CDET_EXTCTL (1 << 10)
148#define USBPHY_GPIO_MODE (1 << 12)
149#define USBPHY_DPOPBUFCTL (1 << 13)
150#define USBPHY_DMOPBUFCTL (1 << 14)
151#define USBPHY_DPINPUT (1 << 15)
152#define USBPHY_DMINPUT (1 << 16)
153#define USBPHY_DPGPIO_PD (1 << 17)
154#define USBPHY_DMGPIO_PD (1 << 18)
155#define USBPHY_OTGVDET_EN (1 << 19)
156#define USBPHY_OTGSESSEND_EN (1 << 20)
157#define USBPHY_DATA_POLARITY (1 << 23)
158
159#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB)
160u32 omap1_usb0_init(unsigned nwires, unsigned is_device);
161u32 omap1_usb1_init(unsigned nwires);
162u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup);
163#else
164static inline u32 omap1_usb0_init(unsigned nwires, unsigned is_device)
165{
166 return 0;
167}
168static inline u32 omap1_usb1_init(unsigned nwires)
169{
170 return 0;
171
172}
173static inline u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
174{
175 return 0;
176}
177#endif
178
179#endif /* __ASM_ARCH_OMAP_USB_H */
diff --git a/arch/arm/plat-omap/include/plat/vrfb.h b/arch/arm/plat-omap/include/plat/vrfb.h
deleted file mode 100644
index 3792bdea2f6..00000000000
--- a/arch/arm/plat-omap/include/plat/vrfb.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * VRFB Rotation Engine
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __OMAP_VRFB_H__
22#define __OMAP_VRFB_H__
23
24#define OMAP_VRFB_LINE_LEN 2048
25
26struct vrfb {
27 u8 context;
28 void __iomem *vaddr[4];
29 unsigned long paddr[4];
30 u16 xres;
31 u16 yres;
32 u16 xoffset;
33 u16 yoffset;
34 u8 bytespp;
35 bool yuv_mode;
36};
37
38#ifdef CONFIG_OMAP2_VRFB
39extern int omap_vrfb_request_ctx(struct vrfb *vrfb);
40extern void omap_vrfb_release_ctx(struct vrfb *vrfb);
41extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
42 u8 bytespp);
43extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp);
44extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp);
45extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
46 u16 width, u16 height,
47 unsigned bytespp, bool yuv_mode);
48extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
49extern void omap_vrfb_restore_context(void);
50
51#else
52static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; }
53static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {}
54static inline void omap_vrfb_adjust_size(u16 *width, u16 *height,
55 u8 bytespp) {}
56static inline u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp)
57 { return 0; }
58static inline u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp)
59 { return 0; }
60static inline void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
61 u16 width, u16 height, unsigned bytespp, bool yuv_mode) {}
62static inline int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot)
63 { return 0; }
64static inline void omap_vrfb_restore_context(void) {}
65#endif
66#endif /* __VRFB_H */
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 28acb383e7d..743fc2836f7 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -20,198 +20,20 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <asm/fncpy.h>
23#include <asm/tlb.h> 24#include <asm/tlb.h>
24#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
25 26
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
27 28
28#include <plat/sram.h>
29#include <plat/cpu.h>
30
31#include "sram.h"
32
33/* XXX These "sideways" includes will disappear when sram.c becomes a driver */
34#include "../mach-omap2/iomap.h"
35#include "../mach-omap2/prm2xxx_3xxx.h"
36#include "../mach-omap2/sdrc.h"
37
38#define OMAP1_SRAM_PA 0x20000000
39#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800)
40#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000)
41#ifdef CONFIG_OMAP4_ERRATA_I688
42#define OMAP4_SRAM_PUB_PA OMAP4_SRAM_PA
43#else
44#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000)
45#endif
46#define OMAP5_SRAM_PA 0x40300000
47
48#if defined(CONFIG_ARCH_OMAP2PLUS)
49#define SRAM_BOOTLOADER_SZ 0x00
50#else
51#define SRAM_BOOTLOADER_SZ 0x80
52#endif
53
54#define OMAP24XX_VA_REQINFOPERM0 OMAP2_L3_IO_ADDRESS(0x68005048)
55#define OMAP24XX_VA_READPERM0 OMAP2_L3_IO_ADDRESS(0x68005050)
56#define OMAP24XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68005058)
57
58#define OMAP34XX_VA_REQINFOPERM0 OMAP2_L3_IO_ADDRESS(0x68012848)
59#define OMAP34XX_VA_READPERM0 OMAP2_L3_IO_ADDRESS(0x68012850)
60#define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
61#define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880)
62#define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048)
63
64#define GP_DEVICE 0x300
65
66#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 29#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
67 30
68static unsigned long omap_sram_start;
69static void __iomem *omap_sram_base; 31static void __iomem *omap_sram_base;
70static unsigned long omap_sram_skip; 32static unsigned long omap_sram_skip;
71static unsigned long omap_sram_size; 33static unsigned long omap_sram_size;
72static void __iomem *omap_sram_ceil; 34static void __iomem *omap_sram_ceil;
73 35
74/* 36/*
75 * Depending on the target RAMFS firewall setup, the public usable amount of
76 * SRAM varies. The default accessible size for all device types is 2k. A GP
77 * device allows ARM11 but not other initiators for full size. This
78 * functionality seems ok until some nice security API happens.
79 */
80static int is_sram_locked(void)
81{
82 if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
83 /* RAMFW: R/W access to all initiators for all qualifier sets */
84 if (cpu_is_omap242x()) {
85 __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
86 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */
87 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
88 }
89 if (cpu_is_omap34xx()) {
90 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
91 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */
92 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
93 __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2);
94 __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
95 }
96 return 0;
97 } else
98 return 1; /* assume locked with no PPA or security driver */
99}
100
101/*
102 * The amount of SRAM depends on the core type.
103 * Note that we cannot try to test for SRAM here because writes
104 * to secure SRAM will hang the system. Also the SRAM is not
105 * yet mapped at this point.
106 */
107static void __init omap_detect_sram(void)
108{
109 omap_sram_skip = SRAM_BOOTLOADER_SZ;
110 if (cpu_class_is_omap2()) {
111 if (is_sram_locked()) {
112 if (cpu_is_omap34xx()) {
113 omap_sram_start = OMAP3_SRAM_PUB_PA;
114 if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
115 (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
116 omap_sram_size = 0x7000; /* 28K */
117 omap_sram_skip += SZ_16K;
118 } else {
119 omap_sram_size = 0x8000; /* 32K */
120 }
121 } else if (cpu_is_omap44xx()) {
122 omap_sram_start = OMAP4_SRAM_PUB_PA;
123 omap_sram_size = 0xa000; /* 40K */
124 } else if (soc_is_omap54xx()) {
125 omap_sram_start = OMAP5_SRAM_PA;
126 omap_sram_size = SZ_128K; /* 128KB */
127 } else {
128 omap_sram_start = OMAP2_SRAM_PUB_PA;
129 omap_sram_size = 0x800; /* 2K */
130 }
131 } else {
132 if (soc_is_am33xx()) {
133 omap_sram_start = AM33XX_SRAM_PA;
134 omap_sram_size = 0x10000; /* 64K */
135 } else if (cpu_is_omap34xx()) {
136 omap_sram_start = OMAP3_SRAM_PA;
137 omap_sram_size = 0x10000; /* 64K */
138 } else if (cpu_is_omap44xx()) {
139 omap_sram_start = OMAP4_SRAM_PA;
140 omap_sram_size = 0xe000; /* 56K */
141 } else if (soc_is_omap54xx()) {
142 omap_sram_start = OMAP5_SRAM_PA;
143 omap_sram_size = SZ_128K; /* 128KB */
144 } else {
145 omap_sram_start = OMAP2_SRAM_PA;
146 if (cpu_is_omap242x())
147 omap_sram_size = 0xa0000; /* 640K */
148 else if (cpu_is_omap243x())
149 omap_sram_size = 0x10000; /* 64K */
150 }
151 }
152 } else {
153 omap_sram_start = OMAP1_SRAM_PA;
154
155 if (cpu_is_omap7xx())
156 omap_sram_size = 0x32000; /* 200K */
157 else if (cpu_is_omap15xx())
158 omap_sram_size = 0x30000; /* 192K */
159 else if (cpu_is_omap1610() || cpu_is_omap1611() ||
160 cpu_is_omap1621() || cpu_is_omap1710())
161 omap_sram_size = 0x4000; /* 16K */
162 else {
163 pr_err("Could not detect SRAM size\n");
164 omap_sram_size = 0x4000;
165 }
166 }
167}
168
169/*
170 * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
171 */
172static void __init omap_map_sram(void)
173{
174 int cached = 1;
175
176 if (omap_sram_size == 0)
177 return;
178
179#ifdef CONFIG_OMAP4_ERRATA_I688
180 if (cpu_is_omap44xx()) {
181 omap_sram_start += PAGE_SIZE;
182 omap_sram_size -= SZ_16K;
183 }
184#endif
185 if (cpu_is_omap34xx()) {
186 /*
187 * SRAM must be marked as non-cached on OMAP3 since the
188 * CORE DPLL M2 divider change code (in SRAM) runs with the
189 * SDRAM controller disabled, and if it is marked cached,
190 * the ARM may attempt to write cache lines back to SDRAM
191 * which will cause the system to hang.
192 */
193 cached = 0;
194 }
195
196 omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
197 omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
198 cached);
199 if (!omap_sram_base) {
200 pr_err("SRAM: Could not map\n");
201 return;
202 }
203
204 omap_sram_ceil = omap_sram_base + omap_sram_size;
205
206 /*
207 * Looks like we need to preserve some bootloader code at the
208 * beginning of SRAM for jumping to flash for reboot to work...
209 */
210 memset_io(omap_sram_base + omap_sram_skip, 0,
211 omap_sram_size - omap_sram_skip);
212}
213
214/*
215 * Memory allocator for SRAM: calculates the new ceiling address 37 * Memory allocator for SRAM: calculates the new ceiling address
216 * for pushing a function using the fncpy API. 38 * for pushing a function using the fncpy API.
217 * 39 *
@@ -236,171 +58,39 @@ void *omap_sram_push_address(unsigned long size)
236 return (void *)omap_sram_ceil; 58 return (void *)omap_sram_ceil;
237} 59}
238 60
239#ifdef CONFIG_ARCH_OMAP1 61/*
240 62 * The SRAM context is lost during off-idle and stack
241static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl); 63 * needs to be reset.
242 64 */
243void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl) 65void omap_sram_reset(void)
244{
245 BUG_ON(!_omap_sram_reprogram_clock);
246 /* On 730, bit 13 must always be 1 */
247 if (cpu_is_omap7xx())
248 ckctl |= 0x2000;
249 _omap_sram_reprogram_clock(dpllctl, ckctl);
250}
251
252static int __init omap1_sram_init(void)
253{
254 _omap_sram_reprogram_clock =
255 omap_sram_push(omap1_sram_reprogram_clock,
256 omap1_sram_reprogram_clock_sz);
257
258 return 0;
259}
260
261#else
262#define omap1_sram_init() do {} while (0)
263#endif
264
265#if defined(CONFIG_ARCH_OMAP2)
266
267static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
268 u32 base_cs, u32 force_unlock);
269
270void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
271 u32 base_cs, u32 force_unlock)
272{
273 BUG_ON(!_omap2_sram_ddr_init);
274 _omap2_sram_ddr_init(slow_dll_ctrl, fast_dll_ctrl,
275 base_cs, force_unlock);
276}
277
278static void (*_omap2_sram_reprogram_sdrc)(u32 perf_level, u32 dll_val,
279 u32 mem_type);
280
281void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, u32 mem_type)
282{
283 BUG_ON(!_omap2_sram_reprogram_sdrc);
284 _omap2_sram_reprogram_sdrc(perf_level, dll_val, mem_type);
285}
286
287static u32 (*_omap2_set_prcm)(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
288
289u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass)
290{
291 BUG_ON(!_omap2_set_prcm);
292 return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass);
293}
294#endif
295
296#ifdef CONFIG_SOC_OMAP2420
297static int __init omap242x_sram_init(void)
298{
299 _omap2_sram_ddr_init = omap_sram_push(omap242x_sram_ddr_init,
300 omap242x_sram_ddr_init_sz);
301
302 _omap2_sram_reprogram_sdrc = omap_sram_push(omap242x_sram_reprogram_sdrc,
303 omap242x_sram_reprogram_sdrc_sz);
304
305 _omap2_set_prcm = omap_sram_push(omap242x_sram_set_prcm,
306 omap242x_sram_set_prcm_sz);
307
308 return 0;
309}
310#else
311static inline int omap242x_sram_init(void)
312{
313 return 0;
314}
315#endif
316
317#ifdef CONFIG_SOC_OMAP2430
318static int __init omap243x_sram_init(void)
319{
320 _omap2_sram_ddr_init = omap_sram_push(omap243x_sram_ddr_init,
321 omap243x_sram_ddr_init_sz);
322
323 _omap2_sram_reprogram_sdrc = omap_sram_push(omap243x_sram_reprogram_sdrc,
324 omap243x_sram_reprogram_sdrc_sz);
325
326 _omap2_set_prcm = omap_sram_push(omap243x_sram_set_prcm,
327 omap243x_sram_set_prcm_sz);
328
329 return 0;
330}
331#else
332static inline int omap243x_sram_init(void)
333{
334 return 0;
335}
336#endif
337
338#ifdef CONFIG_ARCH_OMAP3
339
340static u32 (*_omap3_sram_configure_core_dpll)(
341 u32 m2, u32 unlock_dll, u32 f, u32 inc,
342 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
343 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
344 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
345 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
346
347u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
348 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
349 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
350 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
351 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
352{
353 BUG_ON(!_omap3_sram_configure_core_dpll);
354 return _omap3_sram_configure_core_dpll(
355 m2, unlock_dll, f, inc,
356 sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
357 sdrc_actim_ctrl_b_0, sdrc_mr_0,
358 sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
359 sdrc_actim_ctrl_b_1, sdrc_mr_1);
360}
361
362void omap3_sram_restore_context(void)
363{ 66{
364 omap_sram_ceil = omap_sram_base + omap_sram_size; 67 omap_sram_ceil = omap_sram_base + omap_sram_size;
365
366 _omap3_sram_configure_core_dpll =
367 omap_sram_push(omap3_sram_configure_core_dpll,
368 omap3_sram_configure_core_dpll_sz);
369 omap_push_sram_idle();
370} 68}
371 69
372static inline int omap34xx_sram_init(void) 70/*
373{ 71 * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
374 omap3_sram_restore_context(); 72 */
375 return 0; 73void __init omap_map_sram(unsigned long start, unsigned long size,
376} 74 unsigned long skip, int cached)
377#else
378static inline int omap34xx_sram_init(void)
379{
380 return 0;
381}
382#endif /* CONFIG_ARCH_OMAP3 */
383
384static inline int am33xx_sram_init(void)
385{ 75{
386 return 0; 76 if (size == 0)
387} 77 return;
388 78
389int __init omap_sram_init(void) 79 start = ROUND_DOWN(start, PAGE_SIZE);
390{ 80 omap_sram_size = size;
391 omap_detect_sram(); 81 omap_sram_skip = skip;
392 omap_map_sram(); 82 omap_sram_base = __arm_ioremap_exec(start, size, cached);
83 if (!omap_sram_base) {
84 pr_err("SRAM: Could not map\n");
85 return;
86 }
393 87
394 if (!(cpu_class_is_omap2())) 88 omap_sram_reset();
395 omap1_sram_init();
396 else if (cpu_is_omap242x())
397 omap242x_sram_init();
398 else if (cpu_is_omap2430())
399 omap243x_sram_init();
400 else if (soc_is_am33xx())
401 am33xx_sram_init();
402 else if (cpu_is_omap34xx())
403 omap34xx_sram_init();
404 89
405 return 0; 90 /*
91 * Looks like we need to preserve some bootloader code at the
92 * beginning of SRAM for jumping to flash for reboot to work...
93 */
94 memset_io(omap_sram_base + omap_sram_skip, 0,
95 omap_sram_size - omap_sram_skip);
406} 96}
diff --git a/arch/arm/plat-omap/sram.h b/arch/arm/plat-omap/sram.h
deleted file mode 100644
index 29b43ef97f2..00000000000
--- a/arch/arm/plat-omap/sram.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PLAT_OMAP_SRAM_H__
2#define __PLAT_OMAP_SRAM_H__
3
4extern int __init omap_sram_init(void);
5
6#endif /* __PLAT_OMAP_SRAM_H__ */
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index 1867944415c..8db0b981ca6 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -41,7 +41,7 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
41static int __init orion_add_irq_domain(struct device_node *np, 41static int __init orion_add_irq_domain(struct device_node *np,
42 struct device_node *interrupt_parent) 42 struct device_node *interrupt_parent)
43{ 43{
44 int i = 0, irq_gpio; 44 int i = 0;
45 void __iomem *base; 45 void __iomem *base;
46 46
47 do { 47 do {
@@ -54,10 +54,6 @@ static int __init orion_add_irq_domain(struct device_node *np,
54 54
55 irq_domain_add_legacy(np, i * 32, 0, 0, 55 irq_domain_add_legacy(np, i * 32, 0, 0,
56 &irq_domain_simple_ops, NULL); 56 &irq_domain_simple_ops, NULL);
57
58 irq_gpio = i * 32;
59 orion_gpio_of_init(irq_gpio);
60
61 return 0; 57 return 0;
62} 58}
63 59
diff --git a/arch/arm/plat-pxa/Makefile b/arch/arm/plat-pxa/Makefile
index af8e484001e..1fc94194491 100644
--- a/arch/arm/plat-pxa/Makefile
+++ b/arch/arm/plat-pxa/Makefile
@@ -5,7 +5,6 @@
5obj-y := dma.o 5obj-y := dma.o
6 6
7obj-$(CONFIG_PXA3xx) += mfp.o 7obj-$(CONFIG_PXA3xx) += mfp.o
8obj-$(CONFIG_PXA95x) += mfp.o
9obj-$(CONFIG_ARCH_MMP) += mfp.o 8obj-$(CONFIG_ARCH_MMP) += mfp.o
10 9
11obj-$(CONFIG_PXA_SSP) += ssp.o 10obj-$(CONFIG_PXA_SSP) += ssp.o
diff --git a/arch/arm/plat-pxa/include/plat/mfp.h b/arch/arm/plat-pxa/include/plat/mfp.h
index 5c79c29f283..10bc4f3757d 100644
--- a/arch/arm/plat-pxa/include/plat/mfp.h
+++ b/arch/arm/plat-pxa/include/plat/mfp.h
@@ -423,7 +423,7 @@ typedef unsigned long mfp_cfg_t;
423 ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_DS_MASK | MFP_LPM_STATE_MASK)) |\ 423 ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_DS_MASK | MFP_LPM_STATE_MASK)) |\
424 (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_##drv | MFP_LPM_##lpm)) 424 (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_##drv | MFP_LPM_##lpm))
425 425
426#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x) || defined(CONFIG_ARCH_MMP) 426#if defined(CONFIG_PXA3xx) || defined(CONFIG_ARCH_MMP)
427/* 427/*
428 * each MFP pin will have a MFPR register, since the offset of the 428 * each MFP pin will have a MFPR register, since the offset of the
429 * register varies between processors, the processor specific code 429 * register varies between processors, the processor specific code
@@ -470,6 +470,6 @@ void mfp_write(int mfp, unsigned long mfpr_val);
470void mfp_config(unsigned long *mfp_cfgs, int num); 470void mfp_config(unsigned long *mfp_cfgs, int num);
471void mfp_config_run(void); 471void mfp_config_run(void);
472void mfp_config_lpm(void); 472void mfp_config_lpm(void);
473#endif /* CONFIG_PXA3xx || CONFIG_PXA95x || CONFIG_ARCH_MMP */ 473#endif /* CONFIG_PXA3xx || CONFIG_ARCH_MMP */
474 474
475#endif /* __ASM_PLAT_MFP_H */ 475#endif /* __ASM_PLAT_MFP_H */
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index db98e7021f0..ba3e76c9550 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -325,7 +325,7 @@ static int s3c2410_dma_start(struct s3c2410_dma_chan *chan)
325 325
326 chan->state = S3C2410_DMA_RUNNING; 326 chan->state = S3C2410_DMA_RUNNING;
327 327
328 /* check wether there is anything to load, and if not, see 328 /* check whether there is anything to load, and if not, see
329 * if we can find anything to load 329 * if we can find anything to load
330 */ 330 */
331 331
@@ -473,12 +473,13 @@ int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
473 pr_debug("dma%d: %s: buffer %p queued onto non-empty channel\n", 473 pr_debug("dma%d: %s: buffer %p queued onto non-empty channel\n",
474 chan->number, __func__, buf); 474 chan->number, __func__, buf);
475 475
476 if (chan->end == NULL) 476 if (chan->end == NULL) {
477 pr_debug("dma%d: %s: %p not empty, and chan->end==NULL?\n", 477 pr_debug("dma%d: %s: %p not empty, and chan->end==NULL?\n",
478 chan->number, __func__, chan); 478 chan->number, __func__, chan);
479 479 } else {
480 chan->end->next = buf; 480 chan->end->next = buf;
481 chan->end = buf; 481 chan->end = buf;
482 }
482 } 483 }
483 484
484 /* if necessary, update the next buffer field */ 485 /* if necessary, update the next buffer field */
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 59401e1cc53..a9d52167e16 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -414,6 +414,11 @@ config S5P_SETUP_MIPIPHY
414 help 414 help
415 Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices 415 Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices
416 416
417config S3C_SETUP_CAMIF
418 bool
419 help
420 Compile in common setup code for S3C CAMIF devices
421
417# DMA 422# DMA
418 423
419config S3C_DMA 424config S3C_DMA
@@ -502,5 +507,6 @@ config DEBUG_S3C_UART
502 default "0" if DEBUG_S3C_UART0 507 default "0" if DEBUG_S3C_UART0
503 default "1" if DEBUG_S3C_UART1 508 default "1" if DEBUG_S3C_UART1
504 default "2" if DEBUG_S3C_UART2 509 default "2" if DEBUG_S3C_UART2
510 default "3" if DEBUG_S3C_UART3
505 511
506endif 512endif
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 9e40e8d0074..3a7c64d1814 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o
41 41
42obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o 42obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o
43 43
44obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o
44obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o 45obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o
45 46
46# DMA support 47# DMA support
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index b1e05ccff3a..37542c2689a 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -344,7 +344,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
344 int ret; 344 int ret;
345 unsigned tmp; 345 unsigned tmp;
346 346
347 adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL); 347 adc = devm_kzalloc(dev, sizeof(struct adc_device), GFP_KERNEL);
348 if (adc == NULL) { 348 if (adc == NULL) {
349 dev_err(dev, "failed to allocate adc_device\n"); 349 dev_err(dev, "failed to allocate adc_device\n");
350 return -ENOMEM; 350 return -ENOMEM;
@@ -355,50 +355,46 @@ static int s3c_adc_probe(struct platform_device *pdev)
355 adc->pdev = pdev; 355 adc->pdev = pdev;
356 adc->prescale = S3C2410_ADCCON_PRSCVL(49); 356 adc->prescale = S3C2410_ADCCON_PRSCVL(49);
357 357
358 adc->vdd = regulator_get(dev, "vdd"); 358 adc->vdd = devm_regulator_get(dev, "vdd");
359 if (IS_ERR(adc->vdd)) { 359 if (IS_ERR(adc->vdd)) {
360 dev_err(dev, "operating without regulator \"vdd\" .\n"); 360 dev_err(dev, "operating without regulator \"vdd\" .\n");
361 ret = PTR_ERR(adc->vdd); 361 return PTR_ERR(adc->vdd);
362 goto err_alloc;
363 } 362 }
364 363
365 adc->irq = platform_get_irq(pdev, 1); 364 adc->irq = platform_get_irq(pdev, 1);
366 if (adc->irq <= 0) { 365 if (adc->irq <= 0) {
367 dev_err(dev, "failed to get adc irq\n"); 366 dev_err(dev, "failed to get adc irq\n");
368 ret = -ENOENT; 367 return -ENOENT;
369 goto err_reg;
370 } 368 }
371 369
372 ret = request_irq(adc->irq, s3c_adc_irq, 0, dev_name(dev), adc); 370 ret = devm_request_irq(dev, adc->irq, s3c_adc_irq, 0, dev_name(dev),
371 adc);
373 if (ret < 0) { 372 if (ret < 0) {
374 dev_err(dev, "failed to attach adc irq\n"); 373 dev_err(dev, "failed to attach adc irq\n");
375 goto err_reg; 374 return ret;
376 } 375 }
377 376
378 adc->clk = clk_get(dev, "adc"); 377 adc->clk = devm_clk_get(dev, "adc");
379 if (IS_ERR(adc->clk)) { 378 if (IS_ERR(adc->clk)) {
380 dev_err(dev, "failed to get adc clock\n"); 379 dev_err(dev, "failed to get adc clock\n");
381 ret = PTR_ERR(adc->clk); 380 return PTR_ERR(adc->clk);
382 goto err_irq;
383 } 381 }
384 382
385 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 383 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
386 if (!regs) { 384 if (!regs) {
387 dev_err(dev, "failed to find registers\n"); 385 dev_err(dev, "failed to find registers\n");
388 ret = -ENXIO; 386 return -ENXIO;
389 goto err_clk;
390 } 387 }
391 388
392 adc->regs = ioremap(regs->start, resource_size(regs)); 389 adc->regs = devm_request_and_ioremap(dev, regs);
393 if (!adc->regs) { 390 if (!adc->regs) {
394 dev_err(dev, "failed to map registers\n"); 391 dev_err(dev, "failed to map registers\n");
395 ret = -ENXIO; 392 return -ENXIO;
396 goto err_clk;
397 } 393 }
398 394
399 ret = regulator_enable(adc->vdd); 395 ret = regulator_enable(adc->vdd);
400 if (ret) 396 if (ret)
401 goto err_ioremap; 397 return ret;
402 398
403 clk_enable(adc->clk); 399 clk_enable(adc->clk);
404 400
@@ -418,32 +414,14 @@ static int s3c_adc_probe(struct platform_device *pdev)
418 adc_dev = adc; 414 adc_dev = adc;
419 415
420 return 0; 416 return 0;
421
422 err_ioremap:
423 iounmap(adc->regs);
424 err_clk:
425 clk_put(adc->clk);
426
427 err_irq:
428 free_irq(adc->irq, adc);
429 err_reg:
430 regulator_put(adc->vdd);
431 err_alloc:
432 kfree(adc);
433 return ret;
434} 417}
435 418
436static int __devexit s3c_adc_remove(struct platform_device *pdev) 419static int __devexit s3c_adc_remove(struct platform_device *pdev)
437{ 420{
438 struct adc_device *adc = platform_get_drvdata(pdev); 421 struct adc_device *adc = platform_get_drvdata(pdev);
439 422
440 iounmap(adc->regs);
441 free_irq(adc->irq, adc);
442 clk_disable(adc->clk); 423 clk_disable(adc->clk);
443 regulator_disable(adc->vdd); 424 regulator_disable(adc->vdd);
444 regulator_put(adc->vdd);
445 clk_put(adc->clk);
446 kfree(adc);
447 425
448 return 0; 426 return 0;
449} 427}
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 03f654d55ef..51afedda9ab 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -146,15 +146,6 @@ struct platform_device s3c_device_camif = {
146 146
147/* ASOC DMA */ 147/* ASOC DMA */
148 148
149struct platform_device samsung_asoc_dma = {
150 .name = "samsung-audio",
151 .id = -1,
152 .dev = {
153 .dma_mask = &samsung_device_dma_mask,
154 .coherent_dma_mask = DMA_BIT_MASK(32),
155 }
156};
157
158struct platform_device samsung_asoc_idma = { 149struct platform_device samsung_asoc_idma = {
159 .name = "samsung-idma", 150 .name = "samsung-idma",
160 .id = -1, 151 .id = -1,
@@ -486,11 +477,7 @@ static struct resource s3c_i2c0_resource[] = {
486 477
487struct platform_device s3c_device_i2c0 = { 478struct platform_device s3c_device_i2c0 = {
488 .name = "s3c2410-i2c", 479 .name = "s3c2410-i2c",
489#ifdef CONFIG_S3C_DEV_I2C1
490 .id = 0, 480 .id = 0,
491#else
492 .id = -1,
493#endif
494 .num_resources = ARRAY_SIZE(s3c_i2c0_resource), 481 .num_resources = ARRAY_SIZE(s3c_i2c0_resource),
495 .resource = s3c_i2c0_resource, 482 .resource = s3c_i2c0_resource,
496}; 483};
@@ -933,6 +920,7 @@ struct platform_device s5p_device_mfc_r = {
933 .coherent_dma_mask = DMA_BIT_MASK(32), 920 .coherent_dma_mask = DMA_BIT_MASK(32),
934 }, 921 },
935}; 922};
923
936#endif /* CONFIG_S5P_DEV_MFC */ 924#endif /* CONFIG_S5P_DEV_MFC */
937 925
938/* MIPI CSIS */ 926/* MIPI CSIS */
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index ace4451b765..e0072ce8d6e 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -43,6 +43,7 @@ extern unsigned long samsung_cpu_id;
43#define EXYNOS4_CPU_MASK 0xFFFE0000 43#define EXYNOS4_CPU_MASK 0xFFFE0000
44 44
45#define EXYNOS5250_SOC_ID 0x43520000 45#define EXYNOS5250_SOC_ID 0x43520000
46#define EXYNOS5440_SOC_ID 0x54400000
46#define EXYNOS5_SOC_MASK 0xFFFFF000 47#define EXYNOS5_SOC_MASK 0xFFFFF000
47 48
48#define IS_SAMSUNG_CPU(name, id, mask) \ 49#define IS_SAMSUNG_CPU(name, id, mask) \
@@ -62,6 +63,7 @@ IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
62IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) 63IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
63IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) 64IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
64IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) 65IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
66IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
65 67
66#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 68#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
67 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ 69 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
@@ -130,6 +132,12 @@ IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
130# define soc_is_exynos5250() 0 132# define soc_is_exynos5250() 0
131#endif 133#endif
132 134
135#if defined(CONFIG_SOC_EXYNOS5440)
136# define soc_is_exynos5440() is_samsung_exynos5440()
137#else
138# define soc_is_exynos5440() 0
139#endif
140
133#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 141#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
134 142
135#ifndef KHZ 143#ifndef KHZ
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 5da4b4f38f4..87d501ff332 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -123,7 +123,6 @@ extern struct platform_device s5pv210_device_spdif;
123 123
124extern struct platform_device exynos4_device_ac97; 124extern struct platform_device exynos4_device_ac97;
125extern struct platform_device exynos4_device_ahci; 125extern struct platform_device exynos4_device_ahci;
126extern struct platform_device exynos4_device_dwmci;
127extern struct platform_device exynos4_device_i2s0; 126extern struct platform_device exynos4_device_i2s0;
128extern struct platform_device exynos4_device_i2s1; 127extern struct platform_device exynos4_device_i2s1;
129extern struct platform_device exynos4_device_i2s2; 128extern struct platform_device exynos4_device_i2s2;
@@ -133,9 +132,6 @@ extern struct platform_device exynos4_device_pcm1;
133extern struct platform_device exynos4_device_pcm2; 132extern struct platform_device exynos4_device_pcm2;
134extern struct platform_device exynos4_device_spdif; 133extern struct platform_device exynos4_device_spdif;
135 134
136extern struct platform_device exynos_device_drm;
137
138extern struct platform_device samsung_asoc_dma;
139extern struct platform_device samsung_asoc_idma; 135extern struct platform_device samsung_asoc_idma;
140extern struct platform_device samsung_device_keypad; 136extern struct platform_device samsung_device_keypad;
141 137
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index 1fe6917f6a2..dfd8b7af8c7 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -48,6 +48,7 @@ struct samsung_gpio_cfg;
48 * @config: special function and pull-resistor control information. 48 * @config: special function and pull-resistor control information.
49 * @lock: Lock for exclusive access to this gpio bank. 49 * @lock: Lock for exclusive access to this gpio bank.
50 * @pm_save: Save information for suspend/resume support. 50 * @pm_save: Save information for suspend/resume support.
51 * @bitmap_gpio_int: Bitmap for representing GPIO interrupt or not.
51 * 52 *
52 * This wrapper provides the necessary information for the Samsung 53 * This wrapper provides the necessary information for the Samsung
53 * specific gpios being registered with gpiolib. 54 * specific gpios being registered with gpiolib.
@@ -71,6 +72,7 @@ struct samsung_gpio_chip {
71#ifdef CONFIG_PM 72#ifdef CONFIG_PM
72 u32 pm_save[4]; 73 u32 pm_save[4];
73#endif 74#endif
75 u32 bitmap_gpio_int;
74}; 76};
75 77
76static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc) 78static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc)
diff --git a/arch/arm/plat-samsung/include/plat/mfc.h b/arch/arm/plat-samsung/include/plat/mfc.h
index ac13227272f..e6d7c42d68b 100644
--- a/arch/arm/plat-samsung/include/plat/mfc.h
+++ b/arch/arm/plat-samsung/include/plat/mfc.h
@@ -10,6 +10,14 @@
10#ifndef __PLAT_SAMSUNG_MFC_H 10#ifndef __PLAT_SAMSUNG_MFC_H
11#define __PLAT_SAMSUNG_MFC_H __FILE__ 11#define __PLAT_SAMSUNG_MFC_H __FILE__
12 12
13struct s5p_mfc_dt_meminfo {
14 unsigned long loff;
15 unsigned long lsize;
16 unsigned long roff;
17 unsigned long rsize;
18 char *compatible;
19};
20
13/** 21/**
14 * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver 22 * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver
15 * @rbase: base address for MFC 'right' memory interface 23 * @rbase: base address for MFC 'right' memory interface
@@ -24,4 +32,7 @@
24void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, 32void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
25 phys_addr_t lbase, unsigned int lsize); 33 phys_addr_t lbase, unsigned int lsize);
26 34
35int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
36 int depth, void *data);
37
27#endif /* __PLAT_SAMSUNG_MFC_H */ 38#endif /* __PLAT_SAMSUNG_MFC_H */
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index 61fc53740fb..887a0c95437 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -107,10 +107,12 @@ extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
107extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); 107extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
108 108
109#ifdef CONFIG_PM 109#ifdef CONFIG_PM
110extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
110extern int s3c_irqext_wake(struct irq_data *data, unsigned int state); 111extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
111extern int s3c24xx_irq_suspend(void); 112extern int s3c24xx_irq_suspend(void);
112extern void s3c24xx_irq_resume(void); 113extern void s3c24xx_irq_resume(void);
113#else 114#else
115#define s3c_irq_wake NULL
114#define s3c_irqext_wake NULL 116#define s3c_irqext_wake NULL
115#define s3c24xx_irq_suspend NULL 117#define s3c24xx_irq_suspend NULL
116#define s3c24xx_irq_resume NULL 118#define s3c24xx_irq_resume NULL
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c
index ad6089465e2..5ec104b5408 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/plat-samsung/s5p-dev-mfc.c
@@ -14,6 +14,8 @@
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/memblock.h> 15#include <linux/memblock.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/of_fdt.h>
18#include <linux/of.h>
17 19
18#include <mach/map.h> 20#include <mach/map.h>
19#include <plat/devs.h> 21#include <plat/devs.h>
@@ -69,3 +71,35 @@ static int __init s5p_mfc_memory_init(void)
69 return 0; 71 return 0;
70} 72}
71device_initcall(s5p_mfc_memory_init); 73device_initcall(s5p_mfc_memory_init);
74
75#ifdef CONFIG_OF
76int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
77 int depth, void *data)
78{
79 __be32 *prop;
80 unsigned long len;
81 struct s5p_mfc_dt_meminfo *mfc_mem = data;
82
83 if (!data)
84 return 0;
85
86 if (!of_flat_dt_is_compatible(node, mfc_mem->compatible))
87 return 0;
88
89 prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
90 if (!prop || (len != 2 * sizeof(unsigned long)))
91 return 0;
92
93 mfc_mem->loff = be32_to_cpu(prop[0]);
94 mfc_mem->lsize = be32_to_cpu(prop[1]);
95
96 prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len);
97 if (!prop || (len != 2 * sizeof(unsigned long)))
98 return 0;
99
100 mfc_mem->roff = be32_to_cpu(prop[0]);
101 mfc_mem->rsize = be32_to_cpu(prop[1]);
102
103 return 1;
104}
105#endif
diff --git a/arch/arm/plat-samsung/s5p-irq-gpioint.c b/arch/arm/plat-samsung/s5p-irq-gpioint.c
index 23557d30e44..bae56131a50 100644
--- a/arch/arm/plat-samsung/s5p-irq-gpioint.c
+++ b/arch/arm/plat-samsung/s5p-irq-gpioint.c
@@ -185,7 +185,7 @@ int __init s5p_register_gpio_interrupt(int pin)
185 185
186 /* check if the group has been already registered */ 186 /* check if the group has been already registered */
187 if (my_chip->irq_base) 187 if (my_chip->irq_base)
188 return my_chip->irq_base + offset; 188 goto success;
189 189
190 /* register gpio group */ 190 /* register gpio group */
191 ret = s5p_gpioint_add(my_chip); 191 ret = s5p_gpioint_add(my_chip);
@@ -193,9 +193,13 @@ int __init s5p_register_gpio_interrupt(int pin)
193 my_chip->chip.to_irq = samsung_gpiolib_to_irq; 193 my_chip->chip.to_irq = samsung_gpiolib_to_irq;
194 printk(KERN_INFO "Registered interrupt support for gpio group %d.\n", 194 printk(KERN_INFO "Registered interrupt support for gpio group %d.\n",
195 group); 195 group);
196 return my_chip->irq_base + offset; 196 goto success;
197 } 197 }
198 return ret; 198 return ret;
199success:
200 my_chip->bitmap_gpio_int |= BIT(offset);
201
202 return my_chip->irq_base + offset;
199} 203}
200 204
201int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups) 205int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups)
diff --git a/arch/arm/plat-samsung/setup-camif.c b/arch/arm/plat-samsung/setup-camif.c
new file mode 100644
index 00000000000..e01bf760af2
--- /dev/null
+++ b/arch/arm/plat-samsung/setup-camif.c
@@ -0,0 +1,70 @@
1/*
2 * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
3 *
4 * Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h>
13
14/* Number of camera port pins, without FIELD */
15#define S3C_CAMIF_NUM_GPIOS 13
16
17/* Default camera port configuration helpers. */
18
19static void camif_get_gpios(int *gpio_start, int *gpio_reset)
20{
21#ifdef CONFIG_ARCH_S3C24XX
22 *gpio_start = S3C2410_GPJ(0);
23 *gpio_reset = S3C2410_GPJ(12);
24#else
25 /* s3c64xx */
26 *gpio_start = S3C64XX_GPF(0);
27 *gpio_reset = S3C64XX_GPF(3);
28#endif
29}
30
31int s3c_camif_gpio_get(void)
32{
33 int gpio_start, gpio_reset;
34 int ret, i;
35
36 camif_get_gpios(&gpio_start, &gpio_reset);
37
38 for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
39 int gpio = gpio_start + i;
40
41 if (gpio == gpio_reset)
42 continue;
43
44 ret = gpio_request(gpio, "camif");
45 if (!ret)
46 ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
47 if (ret) {
48 pr_err("failed to configure GPIO %d\n", gpio);
49 for (--i; i >= 0; i--)
50 gpio_free(gpio--);
51 return ret;
52 }
53 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
54 }
55
56 return 0;
57}
58
59void s3c_camif_gpio_put(void)
60{
61 int i, gpio_start, gpio_reset;
62
63 camif_get_gpios(&gpio_start, &gpio_reset);
64
65 for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
66 int gpio = gpio_start + i;
67 if (gpio != gpio_reset)
68 gpio_free(gpio);
69 }
70}
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig
index f8db7b2deb3..87dbd81bdf5 100644
--- a/arch/arm/plat-spear/Kconfig
+++ b/arch/arm/plat-spear/Kconfig
@@ -12,6 +12,7 @@ config ARCH_SPEAR13XX
12 bool "ST SPEAr13xx with Device Tree" 12 bool "ST SPEAr13xx with Device Tree"
13 select ARM_GIC 13 select ARM_GIC
14 select CPU_V7 14 select CPU_V7
15 select GPIO_SPEAR_SPICS
15 select HAVE_SMP 16 select HAVE_SMP
16 select MIGHT_HAVE_CACHE_L2X0 17 select MIGHT_HAVE_CACHE_L2X0
17 select PINCTRL 18 select PINCTRL
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 2a4ae8a6a08..2c4332b9f94 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -6,20 +6,11 @@ config PLAT_VERSATILE_CLOCK
6config PLAT_VERSATILE_CLCD 6config PLAT_VERSATILE_CLCD
7 bool 7 bool
8 8
9config PLAT_VERSATILE_FPGA_IRQ
10 bool
11 select IRQ_DOMAIN
12
13config PLAT_VERSATILE_FPGA_IRQ_NR
14 int
15 default 4
16 depends on PLAT_VERSATILE_FPGA_IRQ
17
18config PLAT_VERSATILE_LEDS 9config PLAT_VERSATILE_LEDS
19 def_bool y if NEW_LEDS 10 def_bool y if NEW_LEDS
20 depends on ARCH_REALVIEW || ARCH_VERSATILE 11 depends on ARCH_REALVIEW || ARCH_VERSATILE
21 select LEDS_CLASS 12 select LEDS_CLASS
22 select LEDS_TRIGGER 13 select LEDS_TRIGGERS
23 14
24config PLAT_VERSATILE_SCHED_CLOCK 15config PLAT_VERSATILE_SCHED_CLOCK
25 def_bool y 16 def_bool y
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index 74cfd94cbf8..f88d448b629 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -2,7 +2,6 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
2 2
3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o 3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o
4obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o 4obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
5obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o
6obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o 5obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o
7obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o 6obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o
8obj-$(CONFIG_SMP) += headsmp.o platsmp.o 7obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/plat-versatile/fpga-irq.c b/arch/arm/plat-versatile/fpga-irq.c
deleted file mode 100644
index 091ae103004..00000000000
--- a/arch/arm/plat-versatile/fpga-irq.c
+++ /dev/null
@@ -1,210 +0,0 @@
1/*
2 * Support for Versatile FPGA-based IRQ controllers
3 */
4#include <linux/irq.h>
5#include <linux/io.h>
6#include <linux/irqdomain.h>
7#include <linux/module.h>
8#include <linux/of.h>
9#include <linux/of_address.h>
10
11#include <asm/exception.h>
12#include <asm/mach/irq.h>
13#include <plat/fpga-irq.h>
14
15#define IRQ_STATUS 0x00
16#define IRQ_RAW_STATUS 0x04
17#define IRQ_ENABLE_SET 0x08
18#define IRQ_ENABLE_CLEAR 0x0c
19#define INT_SOFT_SET 0x10
20#define INT_SOFT_CLEAR 0x14
21#define FIQ_STATUS 0x20
22#define FIQ_RAW_STATUS 0x24
23#define FIQ_ENABLE 0x28
24#define FIQ_ENABLE_SET 0x28
25#define FIQ_ENABLE_CLEAR 0x2C
26
27/**
28 * struct fpga_irq_data - irq data container for the FPGA IRQ controller
29 * @base: memory offset in virtual memory
30 * @chip: chip container for this instance
31 * @domain: IRQ domain for this instance
32 * @valid: mask for valid IRQs on this controller
33 * @used_irqs: number of active IRQs on this controller
34 */
35struct fpga_irq_data {
36 void __iomem *base;
37 struct irq_chip chip;
38 u32 valid;
39 struct irq_domain *domain;
40 u8 used_irqs;
41};
42
43/* we cannot allocate memory when the controllers are initially registered */
44static struct fpga_irq_data fpga_irq_devices[CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR];
45static int fpga_irq_id;
46
47static void fpga_irq_mask(struct irq_data *d)
48{
49 struct fpga_irq_data *f = irq_data_get_irq_chip_data(d);
50 u32 mask = 1 << d->hwirq;
51
52 writel(mask, f->base + IRQ_ENABLE_CLEAR);
53}
54
55static void fpga_irq_unmask(struct irq_data *d)
56{
57 struct fpga_irq_data *f = irq_data_get_irq_chip_data(d);
58 u32 mask = 1 << d->hwirq;
59
60 writel(mask, f->base + IRQ_ENABLE_SET);
61}
62
63static void fpga_irq_handle(unsigned int irq, struct irq_desc *desc)
64{
65 struct fpga_irq_data *f = irq_desc_get_handler_data(desc);
66 u32 status = readl(f->base + IRQ_STATUS);
67
68 if (status == 0) {
69 do_bad_IRQ(irq, desc);
70 return;
71 }
72
73 do {
74 irq = ffs(status) - 1;
75 status &= ~(1 << irq);
76 generic_handle_irq(irq_find_mapping(f->domain, irq));
77 } while (status);
78}
79
80/*
81 * Handle each interrupt in a single FPGA IRQ controller. Returns non-zero
82 * if we've handled at least one interrupt. This does a single read of the
83 * status register and handles all interrupts in order from LSB first.
84 */
85static int handle_one_fpga(struct fpga_irq_data *f, struct pt_regs *regs)
86{
87 int handled = 0;
88 int irq;
89 u32 status;
90
91 while ((status = readl(f->base + IRQ_STATUS))) {
92 irq = ffs(status) - 1;
93 handle_IRQ(irq_find_mapping(f->domain, irq), regs);
94 handled = 1;
95 }
96
97 return handled;
98}
99
100/*
101 * Keep iterating over all registered FPGA IRQ controllers until there are
102 * no pending interrupts.
103 */
104asmlinkage void __exception_irq_entry fpga_handle_irq(struct pt_regs *regs)
105{
106 int i, handled;
107
108 do {
109 for (i = 0, handled = 0; i < fpga_irq_id; ++i)
110 handled |= handle_one_fpga(&fpga_irq_devices[i], regs);
111 } while (handled);
112}
113
114static int fpga_irqdomain_map(struct irq_domain *d, unsigned int irq,
115 irq_hw_number_t hwirq)
116{
117 struct fpga_irq_data *f = d->host_data;
118
119 /* Skip invalid IRQs, only register handlers for the real ones */
120 if (!(f->valid & (1 << hwirq)))
121 return -ENOTSUPP;
122 irq_set_chip_data(irq, f);
123 irq_set_chip_and_handler(irq, &f->chip,
124 handle_level_irq);
125 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
126 f->used_irqs++;
127 return 0;
128}
129
130static struct irq_domain_ops fpga_irqdomain_ops = {
131 .map = fpga_irqdomain_map,
132 .xlate = irq_domain_xlate_onetwocell,
133};
134
135static __init struct fpga_irq_data *
136fpga_irq_prep_struct(void __iomem *base, const char *name, u32 valid) {
137 struct fpga_irq_data *f;
138
139 if (fpga_irq_id >= ARRAY_SIZE(fpga_irq_devices)) {
140 printk(KERN_ERR "%s: too few FPGA IRQ controllers, increase CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR\n", __func__);
141 return NULL;
142 }
143 f = &fpga_irq_devices[fpga_irq_id];
144 f->base = base;
145 f->chip.name = name;
146 f->chip.irq_ack = fpga_irq_mask;
147 f->chip.irq_mask = fpga_irq_mask;
148 f->chip.irq_unmask = fpga_irq_unmask;
149 f->valid = valid;
150 fpga_irq_id++;
151
152 return f;
153}
154
155void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
156 int parent_irq, u32 valid, struct device_node *node)
157{
158 struct fpga_irq_data *f;
159
160 f = fpga_irq_prep_struct(base, name, valid);
161 if (!f)
162 return;
163
164 if (parent_irq != -1) {
165 irq_set_handler_data(parent_irq, f);
166 irq_set_chained_handler(parent_irq, fpga_irq_handle);
167 }
168
169 f->domain = irq_domain_add_legacy(node, fls(valid), irq_start, 0,
170 &fpga_irqdomain_ops, f);
171 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
172 fpga_irq_id, name, base, f->used_irqs);
173}
174
175#ifdef CONFIG_OF
176int __init fpga_irq_of_init(struct device_node *node,
177 struct device_node *parent)
178{
179 struct fpga_irq_data *f;
180 void __iomem *base;
181 u32 clear_mask;
182 u32 valid_mask;
183
184 if (WARN_ON(!node))
185 return -ENODEV;
186
187 base = of_iomap(node, 0);
188 WARN(!base, "unable to map fpga irq registers\n");
189
190 if (of_property_read_u32(node, "clear-mask", &clear_mask))
191 clear_mask = 0;
192
193 if (of_property_read_u32(node, "valid-mask", &valid_mask))
194 valid_mask = 0;
195
196 f = fpga_irq_prep_struct(base, node->name, valid_mask);
197 if (!f)
198 return -ENOMEM;
199
200 writel(clear_mask, base + IRQ_ENABLE_CLEAR);
201 writel(clear_mask, base + FIQ_ENABLE_CLEAR);
202
203 f->domain = irq_domain_add_linear(node, fls(valid_mask), &fpga_irqdomain_ops, f);
204 f->used_irqs = hweight32(valid_mask);
205
206 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
207 fpga_irq_id, node->name, base, f->used_irqs);
208 return 0;
209}
210#endif
diff --git a/arch/arm/plat-versatile/include/plat/fpga-irq.h b/arch/arm/plat-versatile/include/plat/fpga-irq.h
deleted file mode 100644
index 1fac9651d3c..00000000000
--- a/arch/arm/plat-versatile/include/plat/fpga-irq.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef PLAT_FPGA_IRQ_H
2#define PLAT_FPGA_IRQ_H
3
4struct device_node;
5struct pt_regs;
6
7void fpga_handle_irq(struct pt_regs *regs);
8void fpga_irq_init(void __iomem *, const char *, int, int, u32,
9 struct device_node *node);
10int fpga_irq_of_init(struct device_node *node,
11 struct device_node *parent);
12
13#endif
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index f5760927544..7a32976fa2a 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -8,6 +8,8 @@
8#include <xen/features.h> 8#include <xen/features.h>
9#include <xen/platform_pci.h> 9#include <xen/platform_pci.h>
10#include <xen/xenbus.h> 10#include <xen/xenbus.h>
11#include <xen/page.h>
12#include <xen/xen-ops.h>
11#include <asm/xen/hypervisor.h> 13#include <asm/xen/hypervisor.h>
12#include <asm/xen/hypercall.h> 14#include <asm/xen/hypercall.h>
13#include <linux/interrupt.h> 15#include <linux/interrupt.h>
@@ -17,6 +19,8 @@
17#include <linux/of_irq.h> 19#include <linux/of_irq.h>
18#include <linux/of_address.h> 20#include <linux/of_address.h>
19 21
22#include <linux/mm.h>
23
20struct start_info _xen_start_info; 24struct start_info _xen_start_info;
21struct start_info *xen_start_info = &_xen_start_info; 25struct start_info *xen_start_info = &_xen_start_info;
22EXPORT_SYMBOL_GPL(xen_start_info); 26EXPORT_SYMBOL_GPL(xen_start_info);
@@ -29,6 +33,10 @@ struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info;
29 33
30DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); 34DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
31 35
36/* These are unused until we support booting "pre-ballooned" */
37unsigned long xen_released_pages;
38struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
39
32/* TODO: to be removed */ 40/* TODO: to be removed */
33__read_mostly int xen_have_vector_callback; 41__read_mostly int xen_have_vector_callback;
34EXPORT_SYMBOL_GPL(xen_have_vector_callback); 42EXPORT_SYMBOL_GPL(xen_have_vector_callback);
@@ -38,15 +46,106 @@ EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
38 46
39static __read_mostly int xen_events_irq = -1; 47static __read_mostly int xen_events_irq = -1;
40 48
49/* map fgmfn of domid to lpfn in the current domain */
50static int map_foreign_page(unsigned long lpfn, unsigned long fgmfn,
51 unsigned int domid)
52{
53 int rc;
54 struct xen_add_to_physmap_range xatp = {
55 .domid = DOMID_SELF,
56 .foreign_domid = domid,
57 .size = 1,
58 .space = XENMAPSPACE_gmfn_foreign,
59 };
60 xen_ulong_t idx = fgmfn;
61 xen_pfn_t gpfn = lpfn;
62
63 set_xen_guest_handle(xatp.idxs, &idx);
64 set_xen_guest_handle(xatp.gpfns, &gpfn);
65
66 rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &xatp);
67 if (rc) {
68 pr_warn("Failed to map pfn to mfn rc:%d pfn:%lx mfn:%lx\n",
69 rc, lpfn, fgmfn);
70 return 1;
71 }
72 return 0;
73}
74
75struct remap_data {
76 xen_pfn_t fgmfn; /* foreign domain's gmfn */
77 pgprot_t prot;
78 domid_t domid;
79 struct vm_area_struct *vma;
80 int index;
81 struct page **pages;
82 struct xen_remap_mfn_info *info;
83};
84
85static int remap_pte_fn(pte_t *ptep, pgtable_t token, unsigned long addr,
86 void *data)
87{
88 struct remap_data *info = data;
89 struct page *page = info->pages[info->index++];
90 unsigned long pfn = page_to_pfn(page);
91 pte_t pte = pfn_pte(pfn, info->prot);
92
93 if (map_foreign_page(pfn, info->fgmfn, info->domid))
94 return -EFAULT;
95 set_pte_at(info->vma->vm_mm, addr, ptep, pte);
96
97 return 0;
98}
99
41int xen_remap_domain_mfn_range(struct vm_area_struct *vma, 100int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
42 unsigned long addr, 101 unsigned long addr,
43 unsigned long mfn, int nr, 102 xen_pfn_t mfn, int nr,
44 pgprot_t prot, unsigned domid) 103 pgprot_t prot, unsigned domid,
104 struct page **pages)
45{ 105{
46 return -ENOSYS; 106 int err;
107 struct remap_data data;
108
109 /* TBD: Batching, current sole caller only does page at a time */
110 if (nr > 1)
111 return -EINVAL;
112
113 data.fgmfn = mfn;
114 data.prot = prot;
115 data.domid = domid;
116 data.vma = vma;
117 data.index = 0;
118 data.pages = pages;
119 err = apply_to_page_range(vma->vm_mm, addr, nr << PAGE_SHIFT,
120 remap_pte_fn, &data);
121 return err;
47} 122}
48EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); 123EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
49 124
125int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
126 int nr, struct page **pages)
127{
128 int i;
129
130 for (i = 0; i < nr; i++) {
131 struct xen_remove_from_physmap xrp;
132 unsigned long rc, pfn;
133
134 pfn = page_to_pfn(pages[i]);
135
136 xrp.domid = DOMID_SELF;
137 xrp.gpfn = pfn;
138 rc = HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrp);
139 if (rc) {
140 pr_warn("Failed to unmap pfn:%lx rc:%ld\n",
141 pfn, rc);
142 return rc;
143 }
144 }
145 return 0;
146}
147EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
148
50/* 149/*
51 * see Documentation/devicetree/bindings/arm/xen.txt for the 150 * see Documentation/devicetree/bindings/arm/xen.txt for the
52 * documentation of the Xen Device Tree format. 151 * documentation of the Xen Device Tree format.
@@ -149,24 +248,6 @@ static int __init xen_init_events(void)
149} 248}
150postcore_initcall(xen_init_events); 249postcore_initcall(xen_init_events);
151 250
152/* XXX: only until balloon is properly working */
153int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem)
154{
155 *pages = alloc_pages(highmem ? GFP_HIGHUSER : GFP_KERNEL,
156 get_order(nr_pages));
157 if (*pages == NULL)
158 return -ENOMEM;
159 return 0;
160}
161EXPORT_SYMBOL_GPL(alloc_xenballooned_pages);
162
163void free_xenballooned_pages(int nr_pages, struct page **pages)
164{
165 kfree(*pages);
166 *pages = NULL;
167}
168EXPORT_SYMBOL_GPL(free_xenballooned_pages);
169
170/* In the hypervisor.S file. */ 251/* In the hypervisor.S file. */
171EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op); 252EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);
172EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op); 253EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 15ac18a56c9..f9ccff91591 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -2,11 +2,14 @@ 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_WANT_COMPAT_IPC_PARSE_VERSION 4 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
5 select COMMON_CLK
5 select GENERIC_CLOCKEVENTS 6 select GENERIC_CLOCKEVENTS
6 select GENERIC_HARDIRQS_NO_DEPRECATED 7 select GENERIC_HARDIRQS_NO_DEPRECATED
7 select GENERIC_IOMAP 8 select GENERIC_IOMAP
8 select GENERIC_IRQ_PROBE 9 select GENERIC_IRQ_PROBE
9 select GENERIC_IRQ_SHOW 10 select GENERIC_IRQ_SHOW
11 select GENERIC_KERNEL_EXECVE
12 select GENERIC_KERNEL_THREAD
10 select GENERIC_SMP_IDLE_THREAD 13 select GENERIC_SMP_IDLE_THREAD
11 select GENERIC_TIME_VSYSCALL 14 select GENERIC_TIME_VSYSCALL
12 select HARDIRQS_SW_RESEND 15 select HARDIRQS_SW_RESEND
@@ -21,7 +24,6 @@ config ARM64
21 select HAVE_IRQ_WORK 24 select HAVE_IRQ_WORK
22 select HAVE_MEMBLOCK 25 select HAVE_MEMBLOCK
23 select HAVE_PERF_EVENTS 26 select HAVE_PERF_EVENTS
24 select HAVE_SPARSE_IRQ
25 select IRQ_DOMAIN 27 select IRQ_DOMAIN
26 select MODULES_USE_ELF_RELA 28 select MODULES_USE_ELF_RELA
27 select NO_BOOTMEM 29 select NO_BOOTMEM
@@ -31,6 +33,7 @@ config ARM64
31 select RTC_LIB 33 select RTC_LIB
32 select SPARSE_IRQ 34 select SPARSE_IRQ
33 select SYSCTL_EXCEPTION_TRACE 35 select SYSCTL_EXCEPTION_TRACE
36 select CLONE_BACKWARDS
34 help 37 help
35 ARM 64-bit (AArch64) Linux support. 38 ARM 64-bit (AArch64) Linux support.
36 39
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 364191f3be4..c95c5cb212f 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -41,20 +41,24 @@ libs-y := arch/arm64/lib/ $(libs-y)
41libs-y += $(LIBGCC) 41libs-y += $(LIBGCC)
42 42
43# Default target when executing plain make 43# Default target when executing plain make
44KBUILD_IMAGE := Image.gz 44KBUILD_IMAGE := Image.gz
45KBUILD_DTBS := dtbs
45 46
46all: $(KBUILD_IMAGE) 47all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
47 48
48boot := arch/arm64/boot 49boot := arch/arm64/boot
49 50
50Image Image.gz: vmlinux 51Image Image.gz: vmlinux
51 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 52 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
52 53
53zinstall install: vmlinux 54zinstall install: vmlinux
54 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 55 $(Q)$(MAKE) $(build)=$(boot) $@
55 56
56%.dtb: 57%.dtb: scripts
57 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 58 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
59
60dtbs: scripts
61 $(Q)$(MAKE) $(build)=$(boot)/dts dtbs
58 62
59# We use MRPROPER_FILES and CLEAN_FILES now 63# We use MRPROPER_FILES and CLEAN_FILES now
60archclean: 64archclean:
@@ -63,6 +67,7 @@ archclean:
63define archhelp 67define archhelp
64 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' 68 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
65 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' 69 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
70 echo '* dtbs - Build device tree blobs for enabled boards'
66 echo ' install - Install uncompressed kernel' 71 echo ' install - Install uncompressed kernel'
67 echo ' zinstall - Install compressed kernel' 72 echo ' zinstall - Install compressed kernel'
68 echo ' Install using (your) ~/bin/installkernel or' 73 echo ' Install using (your) ~/bin/installkernel or'
diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
index eca209b2b0b..5a0e3ab854a 100644
--- a/arch/arm64/boot/Makefile
+++ b/arch/arm64/boot/Makefile
@@ -22,9 +22,6 @@ $(obj)/Image: vmlinux FORCE
22$(obj)/Image.gz: $(obj)/Image FORCE 22$(obj)/Image.gz: $(obj)/Image FORCE
23 $(call if_changed,gzip) 23 $(call if_changed,gzip)
24 24
25$(obj)/%.dtb: $(src)/dts/%.dts
26 $(call cmd,dtc)
27
28install: $(obj)/Image 25install: $(obj)/Image
29 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 26 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
30 $(obj)/Image System.map "$(INSTALL_PATH)" 27 $(obj)/Image System.map "$(INSTALL_PATH)"
@@ -32,5 +29,3 @@ install: $(obj)/Image
32zinstall: $(obj)/Image.gz 29zinstall: $(obj)/Image.gz
33 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 30 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
34 $(obj)/Image.gz System.map "$(INSTALL_PATH)" 31 $(obj)/Image.gz System.map "$(INSTALL_PATH)"
35
36clean-files += *.dtb
diff --git a/arch/arm64/boot/dts/.gitignore b/arch/arm64/boot/dts/.gitignore
new file mode 100644
index 00000000000..b60ed208c77
--- /dev/null
+++ b/arch/arm64/boot/dts/.gitignore
@@ -0,0 +1 @@
*.dtb
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
new file mode 100644
index 00000000000..801e2d7fcbc
--- /dev/null
+++ b/arch/arm64/boot/dts/Makefile
@@ -0,0 +1,5 @@
1targets += dtbs
2
3dtbs: $(addprefix $(obj)/, $(dtb-y))
4
5clean-files := *.dtb
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index a581a220593..14a9d5a2b85 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -3,6 +3,7 @@
3generic-y += bug.h 3generic-y += bug.h
4generic-y += bugs.h 4generic-y += bugs.h
5generic-y += checksum.h 5generic-y += checksum.h
6generic-y += clkdev.h
6generic-y += cputime.h 7generic-y += cputime.h
7generic-y += current.h 8generic-y += current.h
8generic-y += delay.h 9generic-y += delay.h
@@ -43,6 +44,7 @@ generic-y += swab.h
43generic-y += termbits.h 44generic-y += termbits.h
44generic-y += termios.h 45generic-y += termios.h
45generic-y += topology.h 46generic-y += topology.h
47generic-y += trace_clock.h
46generic-y += types.h 48generic-y += types.h
47generic-y += unaligned.h 49generic-y += unaligned.h
48generic-y += user.h 50generic-y += user.h
diff --git a/arch/arm64/include/asm/arm_generic.h b/arch/arm64/include/asm/arm_generic.h
index e4cec9d30f2..df2aeb82f74 100644
--- a/arch/arm64/include/asm/arm_generic.h
+++ b/arch/arm64/include/asm/arm_generic.h
@@ -70,12 +70,12 @@ static inline void __cpuinit arch_counter_enable_user_access(void)
70{ 70{
71 u32 cntkctl; 71 u32 cntkctl;
72 72
73 /* Disable user access to the timers and the virtual counter. */ 73 /* Disable user access to the timers and the physical counter. */
74 asm volatile("mrs %0, cntkctl_el1" : "=r" (cntkctl)); 74 asm volatile("mrs %0, cntkctl_el1" : "=r" (cntkctl));
75 cntkctl &= ~((3 << 8) | (1 << 1)); 75 cntkctl &= ~((3 << 8) | (1 << 0));
76 76
77 /* Enable user access to the physical counter and frequency. */ 77 /* Enable user access to the virtual counter and frequency. */
78 cntkctl |= 1; 78 cntkctl |= (1 << 1);
79 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); 79 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
80} 80}
81 81
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index da2a13e8f1e..c8eedc60498 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -107,3 +107,11 @@
107 * Register aliases. 107 * Register aliases.
108 */ 108 */
109lr .req x30 // link register 109lr .req x30 // link register
110
111/*
112 * Vector entry
113 */
114 .macro ventry label
115 .align 7
116 b \label
117 .endm
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
index aa3132ab7f2..3300cbd18a8 100644
--- a/arch/arm64/include/asm/cacheflush.h
+++ b/arch/arm64/include/asm/cacheflush.h
@@ -70,13 +70,20 @@
70 * - size - region size 70 * - size - region size
71 */ 71 */
72extern void flush_cache_all(void); 72extern void flush_cache_all(void);
73extern void flush_cache_mm(struct mm_struct *mm);
74extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); 73extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
75extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn);
76extern void flush_icache_range(unsigned long start, unsigned long end); 74extern void flush_icache_range(unsigned long start, unsigned long end);
77extern void __flush_dcache_area(void *addr, size_t len); 75extern void __flush_dcache_area(void *addr, size_t len);
78extern void __flush_cache_user_range(unsigned long start, unsigned long end); 76extern void __flush_cache_user_range(unsigned long start, unsigned long end);
79 77
78static inline void flush_cache_mm(struct mm_struct *mm)
79{
80}
81
82static inline void flush_cache_page(struct vm_area_struct *vma,
83 unsigned long user_addr, unsigned long pfn)
84{
85}
86
80/* 87/*
81 * Copy user data from/to a page which is mapped into a different 88 * Copy user data from/to a page which is mapped into a different
82 * processes address space. Really, we want to allow our "user 89 * processes address space. Really, we want to allow our "user
diff --git a/arch/arm64/include/asm/fpsimdmacros.h b/arch/arm64/include/asm/fpsimdmacros.h
new file mode 100644
index 00000000000..bbec599c96b
--- /dev/null
+++ b/arch/arm64/include/asm/fpsimdmacros.h
@@ -0,0 +1,64 @@
1/*
2 * FP/SIMD state saving and restoring macros
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Author: Catalin Marinas <catalin.marinas@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20.macro fpsimd_save state, tmpnr
21 stp q0, q1, [\state, #16 * 0]
22 stp q2, q3, [\state, #16 * 2]
23 stp q4, q5, [\state, #16 * 4]
24 stp q6, q7, [\state, #16 * 6]
25 stp q8, q9, [\state, #16 * 8]
26 stp q10, q11, [\state, #16 * 10]
27 stp q12, q13, [\state, #16 * 12]
28 stp q14, q15, [\state, #16 * 14]
29 stp q16, q17, [\state, #16 * 16]
30 stp q18, q19, [\state, #16 * 18]
31 stp q20, q21, [\state, #16 * 20]
32 stp q22, q23, [\state, #16 * 22]
33 stp q24, q25, [\state, #16 * 24]
34 stp q26, q27, [\state, #16 * 26]
35 stp q28, q29, [\state, #16 * 28]
36 stp q30, q31, [\state, #16 * 30]!
37 mrs x\tmpnr, fpsr
38 str w\tmpnr, [\state, #16 * 2]
39 mrs x\tmpnr, fpcr
40 str w\tmpnr, [\state, #16 * 2 + 4]
41.endm
42
43.macro fpsimd_restore state, tmpnr
44 ldp q0, q1, [\state, #16 * 0]
45 ldp q2, q3, [\state, #16 * 2]
46 ldp q4, q5, [\state, #16 * 4]
47 ldp q6, q7, [\state, #16 * 6]
48 ldp q8, q9, [\state, #16 * 8]
49 ldp q10, q11, [\state, #16 * 10]
50 ldp q12, q13, [\state, #16 * 12]
51 ldp q14, q15, [\state, #16 * 14]
52 ldp q16, q17, [\state, #16 * 16]
53 ldp q18, q19, [\state, #16 * 18]
54 ldp q20, q21, [\state, #16 * 20]
55 ldp q22, q23, [\state, #16 * 22]
56 ldp q24, q25, [\state, #16 * 24]
57 ldp q26, q27, [\state, #16 * 26]
58 ldp q28, q29, [\state, #16 * 28]
59 ldp q30, q31, [\state, #16 * 30]!
60 ldr w\tmpnr, [\state, #16 * 2]
61 msr fpsr, x\tmpnr
62 ldr w\tmpnr, [\state, #16 * 2 + 4]
63 msr fpcr, x\tmpnr
64.endm
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 14aba2db677..64b13394950 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -159,6 +159,8 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
159{ 159{
160 if (pte_present_exec_user(pte)) 160 if (pte_present_exec_user(pte))
161 __sync_icache_dcache(pte, addr); 161 __sync_icache_dcache(pte, addr);
162 if (!pte_dirty(pte))
163 pte = pte_wrprotect(pte);
162 set_pte(ptep, pte); 164 set_pte(ptep, pte);
163} 165}
164 166
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 77f696c1433..ab239b2c456 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -128,11 +128,6 @@ unsigned long get_wchan(struct task_struct *p);
128extern struct task_struct *cpu_switch_to(struct task_struct *prev, 128extern struct task_struct *cpu_switch_to(struct task_struct *prev,
129 struct task_struct *next); 129 struct task_struct *next);
130 130
131/*
132 * Create a new kernel thread
133 */
134extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
135
136#define task_pt_regs(p) \ 131#define task_pt_regs(p) \
137 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) 132 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
138 133
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index b04d3404f0d..4ce845f8ee1 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -30,7 +30,17 @@
30#define COMPAT_PTRACE_SETVFPREGS 28 30#define COMPAT_PTRACE_SETVFPREGS 28
31#define COMPAT_PTRACE_GETHBPREGS 29 31#define COMPAT_PTRACE_GETHBPREGS 29
32#define COMPAT_PTRACE_SETHBPREGS 30 32#define COMPAT_PTRACE_SETHBPREGS 30
33
34/* AArch32 CPSR bits */
35#define COMPAT_PSR_MODE_MASK 0x0000001f
33#define COMPAT_PSR_MODE_USR 0x00000010 36#define COMPAT_PSR_MODE_USR 0x00000010
37#define COMPAT_PSR_MODE_FIQ 0x00000011
38#define COMPAT_PSR_MODE_IRQ 0x00000012
39#define COMPAT_PSR_MODE_SVC 0x00000013
40#define COMPAT_PSR_MODE_ABT 0x00000017
41#define COMPAT_PSR_MODE_HYP 0x0000001a
42#define COMPAT_PSR_MODE_UND 0x0000001b
43#define COMPAT_PSR_MODE_SYS 0x0000001f
34#define COMPAT_PSR_T_BIT 0x00000020 44#define COMPAT_PSR_T_BIT 0x00000020
35#define COMPAT_PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */ 45#define COMPAT_PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */
36/* 46/*
@@ -44,10 +54,27 @@
44 54
45/* sizeof(struct user) for AArch32 */ 55/* sizeof(struct user) for AArch32 */
46#define COMPAT_USER_SZ 296 56#define COMPAT_USER_SZ 296
47/* AArch32 uses x13 as the stack pointer... */ 57
58/* Architecturally defined mapping between AArch32 and AArch64 registers */
59#define compat_usr(x) regs[(x)]
48#define compat_sp regs[13] 60#define compat_sp regs[13]
49/* ... and x14 as the link register. */
50#define compat_lr regs[14] 61#define compat_lr regs[14]
62#define compat_sp_hyp regs[15]
63#define compat_sp_irq regs[16]
64#define compat_lr_irq regs[17]
65#define compat_sp_svc regs[18]
66#define compat_lr_svc regs[19]
67#define compat_sp_abt regs[20]
68#define compat_lr_abt regs[21]
69#define compat_sp_und regs[22]
70#define compat_lr_und regs[23]
71#define compat_r8_fiq regs[24]
72#define compat_r9_fiq regs[25]
73#define compat_r10_fiq regs[26]
74#define compat_r11_fiq regs[27]
75#define compat_r12_fiq regs[28]
76#define compat_sp_fiq regs[29]
77#define compat_lr_fiq regs[30]
51 78
52/* 79/*
53 * This struct defines the way the registers are stored on the stack during an 80 * This struct defines the way the registers are stored on the stack during an
diff --git a/arch/arm64/include/asm/syscalls.h b/arch/arm64/include/asm/syscalls.h
index 09ff33572aa..20d63b29066 100644
--- a/arch/arm64/include/asm/syscalls.h
+++ b/arch/arm64/include/asm/syscalls.h
@@ -23,14 +23,6 @@
23/* 23/*
24 * System call wrappers implemented in kernel/entry.S. 24 * System call wrappers implemented in kernel/entry.S.
25 */ 25 */
26asmlinkage long sys_execve_wrapper(const char __user *filename,
27 const char __user *const __user *argv,
28 const char __user *const __user *envp);
29asmlinkage long sys_clone_wrapper(unsigned long clone_flags,
30 unsigned long newsp,
31 void __user *parent_tid,
32 unsigned long tls_val,
33 void __user *child_tid);
34asmlinkage long sys_rt_sigreturn_wrapper(void); 26asmlinkage long sys_rt_sigreturn_wrapper(void);
35asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss, 27asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss,
36 stack_t __user *uoss); 28 stack_t __user *uoss);
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 68aff2816e8..d69aeea6da1 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -24,5 +24,9 @@
24#define __ARCH_WANT_SYS_SIGPROCMASK 24#define __ARCH_WANT_SYS_SIGPROCMASK
25#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 25#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
26#define __ARCH_WANT_COMPAT_SYS_SENDFILE 26#define __ARCH_WANT_COMPAT_SYS_SENDFILE
27#define __ARCH_WANT_SYS_FORK
28#define __ARCH_WANT_SYS_VFORK
27#endif 29#endif
30#define __ARCH_WANT_SYS_EXECVE
31#define __ARCH_WANT_SYS_CLONE
28#include <uapi/asm/unistd.h> 32#include <uapi/asm/unistd.h>
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 6d909faebf2..58432625fdb 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -23,7 +23,7 @@
23 23
24__SYSCALL(0, sys_restart_syscall) 24__SYSCALL(0, sys_restart_syscall)
25__SYSCALL(1, sys_exit) 25__SYSCALL(1, sys_exit)
26__SYSCALL(2, compat_sys_fork_wrapper) 26__SYSCALL(2, sys_fork)
27__SYSCALL(3, sys_read) 27__SYSCALL(3, sys_read)
28__SYSCALL(4, sys_write) 28__SYSCALL(4, sys_write)
29__SYSCALL(5, compat_sys_open) 29__SYSCALL(5, compat_sys_open)
@@ -32,7 +32,7 @@ __SYSCALL(7, sys_ni_syscall) /* 7 was sys_waitpid */
32__SYSCALL(8, sys_creat) 32__SYSCALL(8, sys_creat)
33__SYSCALL(9, sys_link) 33__SYSCALL(9, sys_link)
34__SYSCALL(10, sys_unlink) 34__SYSCALL(10, sys_unlink)
35__SYSCALL(11, compat_sys_execve_wrapper) 35__SYSCALL(11, compat_sys_execve)
36__SYSCALL(12, sys_chdir) 36__SYSCALL(12, sys_chdir)
37__SYSCALL(13, sys_ni_syscall) /* 13 was sys_time */ 37__SYSCALL(13, sys_ni_syscall) /* 13 was sys_time */
38__SYSCALL(14, sys_mknod) 38__SYSCALL(14, sys_mknod)
@@ -141,7 +141,7 @@ __SYSCALL(116, compat_sys_sysinfo)
141__SYSCALL(117, sys_ni_syscall) /* 117 was sys_ipc */ 141__SYSCALL(117, sys_ni_syscall) /* 117 was sys_ipc */
142__SYSCALL(118, sys_fsync) 142__SYSCALL(118, sys_fsync)
143__SYSCALL(119, compat_sys_sigreturn_wrapper) 143__SYSCALL(119, compat_sys_sigreturn_wrapper)
144__SYSCALL(120, compat_sys_clone_wrapper) 144__SYSCALL(120, sys_clone)
145__SYSCALL(121, sys_setdomainname) 145__SYSCALL(121, sys_setdomainname)
146__SYSCALL(122, sys_newuname) 146__SYSCALL(122, sys_newuname)
147__SYSCALL(123, sys_ni_syscall) /* 123 was sys_modify_ldt */ 147__SYSCALL(123, sys_ni_syscall) /* 123 was sys_modify_ldt */
@@ -211,7 +211,7 @@ __SYSCALL(186, compat_sys_sigaltstack_wrapper)
211__SYSCALL(187, compat_sys_sendfile) 211__SYSCALL(187, compat_sys_sendfile)
212__SYSCALL(188, sys_ni_syscall) /* 188 reserved */ 212__SYSCALL(188, sys_ni_syscall) /* 188 reserved */
213__SYSCALL(189, sys_ni_syscall) /* 189 reserved */ 213__SYSCALL(189, sys_ni_syscall) /* 189 reserved */
214__SYSCALL(190, compat_sys_vfork_wrapper) 214__SYSCALL(190, sys_vfork)
215__SYSCALL(191, compat_sys_getrlimit) /* SuS compliant getrlimit */ 215__SYSCALL(191, compat_sys_getrlimit) /* SuS compliant getrlimit */
216__SYSCALL(192, sys_mmap_pgoff) 216__SYSCALL(192, sys_mmap_pgoff)
217__SYSCALL(193, compat_sys_truncate64_wrapper) 217__SYSCALL(193, compat_sys_truncate64_wrapper)
@@ -392,8 +392,8 @@ __SYSCALL(367, sys_fanotify_init)
392__SYSCALL(368, compat_sys_fanotify_mark_wrapper) 392__SYSCALL(368, compat_sys_fanotify_mark_wrapper)
393__SYSCALL(369, sys_prlimit64) 393__SYSCALL(369, sys_prlimit64)
394__SYSCALL(370, sys_name_to_handle_at) 394__SYSCALL(370, sys_name_to_handle_at)
395__SYSCALL(371, sys_open_by_handle_at) 395__SYSCALL(371, compat_sys_open_by_handle_at)
396__SYSCALL(372, sys_clock_adjtime) 396__SYSCALL(372, compat_sys_clock_adjtime)
397__SYSCALL(373, sys_syncfs) 397__SYSCALL(373, sys_syncfs)
398 398
399#define __NR_compat_syscalls 374 399#define __NR_compat_syscalls 374
diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h
new file mode 100644
index 00000000000..439827271e3
--- /dev/null
+++ b/arch/arm64/include/asm/virt.h
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __ASM__VIRT_H
19#define __ASM__VIRT_H
20
21#define BOOT_CPU_MODE_EL2 (0x0e12b007)
22
23#ifndef __ASSEMBLY__
24
25/*
26 * __boot_cpu_mode records what mode CPUs were booted in.
27 * A correctly-implemented bootloader must start all CPUs in the same mode:
28 * In this case, both 32bit halves of __boot_cpu_mode will contain the
29 * same value (either 0 if booted in EL1, BOOT_CPU_MODE_EL2 if booted in EL2).
30 *
31 * Should the bootloader fail to do this, the two values will be different.
32 * This allows the kernel to flag an error when the secondaries have come up.
33 */
34extern u32 __boot_cpu_mode[2];
35
36void __hyp_set_vectors(phys_addr_t phys_vector_base);
37phys_addr_t __hyp_get_vectors(void);
38
39/* Reports the availability of HYP mode */
40static inline bool is_hyp_mode_available(void)
41{
42 return (__boot_cpu_mode[0] == BOOT_CPU_MODE_EL2 &&
43 __boot_cpu_mode[1] == BOOT_CPU_MODE_EL2);
44}
45
46/* Check if the bootloader has booted CPUs in different modes */
47static inline bool is_hyp_mode_mismatched(void)
48{
49 return __boot_cpu_mode[0] != __boot_cpu_mode[1];
50}
51
52#endif /* __ASSEMBLY__ */
53
54#endif /* ! __ASM__VIRT_H */
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index e2caff1b812..74239c31e25 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -8,7 +8,8 @@ AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
8# Object file lists. 8# Object file lists.
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
12 13
13arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ 14arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \
14 sys_compat.o 15 sys_compat.o
diff --git a/arch/arm64/kernel/entry-fpsimd.S b/arch/arm64/kernel/entry-fpsimd.S
index 17988a6e7ea..6a27cd6dbfa 100644
--- a/arch/arm64/kernel/entry-fpsimd.S
+++ b/arch/arm64/kernel/entry-fpsimd.S
@@ -20,6 +20,7 @@
20#include <linux/linkage.h> 20#include <linux/linkage.h>
21 21
22#include <asm/assembler.h> 22#include <asm/assembler.h>
23#include <asm/fpsimdmacros.h>
23 24
24/* 25/*
25 * Save the FP registers. 26 * Save the FP registers.
@@ -27,26 +28,7 @@
27 * x0 - pointer to struct fpsimd_state 28 * x0 - pointer to struct fpsimd_state
28 */ 29 */
29ENTRY(fpsimd_save_state) 30ENTRY(fpsimd_save_state)
30 stp q0, q1, [x0, #16 * 0] 31 fpsimd_save x0, 8
31 stp q2, q3, [x0, #16 * 2]
32 stp q4, q5, [x0, #16 * 4]
33 stp q6, q7, [x0, #16 * 6]
34 stp q8, q9, [x0, #16 * 8]
35 stp q10, q11, [x0, #16 * 10]
36 stp q12, q13, [x0, #16 * 12]
37 stp q14, q15, [x0, #16 * 14]
38 stp q16, q17, [x0, #16 * 16]
39 stp q18, q19, [x0, #16 * 18]
40 stp q20, q21, [x0, #16 * 20]
41 stp q22, q23, [x0, #16 * 22]
42 stp q24, q25, [x0, #16 * 24]
43 stp q26, q27, [x0, #16 * 26]
44 stp q28, q29, [x0, #16 * 28]
45 stp q30, q31, [x0, #16 * 30]!
46 mrs x8, fpsr
47 str w8, [x0, #16 * 2]
48 mrs x8, fpcr
49 str w8, [x0, #16 * 2 + 4]
50 ret 32 ret
51ENDPROC(fpsimd_save_state) 33ENDPROC(fpsimd_save_state)
52 34
@@ -56,25 +38,6 @@ ENDPROC(fpsimd_save_state)
56 * x0 - pointer to struct fpsimd_state 38 * x0 - pointer to struct fpsimd_state
57 */ 39 */
58ENTRY(fpsimd_load_state) 40ENTRY(fpsimd_load_state)
59 ldp q0, q1, [x0, #16 * 0] 41 fpsimd_restore x0, 8
60 ldp q2, q3, [x0, #16 * 2]
61 ldp q4, q5, [x0, #16 * 4]
62 ldp q6, q7, [x0, #16 * 6]
63 ldp q8, q9, [x0, #16 * 8]
64 ldp q10, q11, [x0, #16 * 10]
65 ldp q12, q13, [x0, #16 * 12]
66 ldp q14, q15, [x0, #16 * 14]
67 ldp q16, q17, [x0, #16 * 16]
68 ldp q18, q19, [x0, #16 * 18]
69 ldp q20, q21, [x0, #16 * 20]
70 ldp q22, q23, [x0, #16 * 22]
71 ldp q24, q25, [x0, #16 * 24]
72 ldp q26, q27, [x0, #16 * 26]
73 ldp q28, q29, [x0, #16 * 28]
74 ldp q30, q31, [x0, #16 * 30]!
75 ldr w8, [x0, #16 * 2]
76 ldr w9, [x0, #16 * 2 + 4]
77 msr fpsr, x8
78 msr fpcr, x9
79 ret 42 ret
80ENDPROC(fpsimd_load_state) 43ENDPROC(fpsimd_load_state)
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index a6f3f7da688..9c94f404ded 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -148,10 +148,6 @@ tsk .req x28 // current thread_info
148/* 148/*
149 * Exception vectors. 149 * Exception vectors.
150 */ 150 */
151 .macro ventry label
152 .align 7
153 b \label
154 .endm
155 151
156 .align 11 152 .align 11
157ENTRY(vectors) 153ENTRY(vectors)
@@ -594,7 +590,7 @@ work_resched:
594/* 590/*
595 * "slow" syscall return path. 591 * "slow" syscall return path.
596 */ 592 */
597ENTRY(ret_to_user) 593ret_to_user:
598 disable_irq // disable interrupts 594 disable_irq // disable interrupts
599 ldr x1, [tsk, #TI_FLAGS] 595 ldr x1, [tsk, #TI_FLAGS]
600 and x2, x1, #_TIF_WORK_MASK 596 and x2, x1, #_TIF_WORK_MASK
@@ -611,7 +607,10 @@ ENDPROC(ret_to_user)
611 */ 607 */
612ENTRY(ret_from_fork) 608ENTRY(ret_from_fork)
613 bl schedule_tail 609 bl schedule_tail
614 get_thread_info tsk 610 cbz x19, 1f // not a kernel thread
611 mov x0, x20
612 blr x19
6131: get_thread_info tsk
615 b ret_to_user 614 b ret_to_user
616ENDPROC(ret_from_fork) 615ENDPROC(ret_from_fork)
617 616
@@ -673,16 +672,6 @@ __sys_trace_return:
673/* 672/*
674 * Special system call wrappers. 673 * Special system call wrappers.
675 */ 674 */
676ENTRY(sys_execve_wrapper)
677 mov x3, sp
678 b sys_execve
679ENDPROC(sys_execve_wrapper)
680
681ENTRY(sys_clone_wrapper)
682 mov x5, sp
683 b sys_clone
684ENDPROC(sys_clone_wrapper)
685
686ENTRY(sys_rt_sigreturn_wrapper) 675ENTRY(sys_rt_sigreturn_wrapper)
687 mov x0, sp 676 mov x0, sp
688 b sys_rt_sigreturn 677 b sys_rt_sigreturn
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index a2f02b63eae..368ad1f7c36 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -31,6 +31,7 @@
31#include <asm/pgtable-hwdef.h> 31#include <asm/pgtable-hwdef.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/virt.h>
34 35
35/* 36/*
36 * swapper_pg_dir is the virtual address of the initial page table. We place 37 * swapper_pg_dir is the virtual address of the initial page table. We place
@@ -115,13 +116,13 @@
115 116
116ENTRY(stext) 117ENTRY(stext)
117 mov x21, x0 // x21=FDT 118 mov x21, x0 // x21=FDT
119 bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
118 bl el2_setup // Drop to EL1 120 bl el2_setup // Drop to EL1
119 mrs x22, midr_el1 // x22=cpuid 121 mrs x22, midr_el1 // x22=cpuid
120 mov x0, x22 122 mov x0, x22
121 bl lookup_processor_type 123 bl lookup_processor_type
122 mov x23, x0 // x23=current cpu_table 124 mov x23, x0 // x23=current cpu_table
123 cbz x23, __error_p // invalid processor (x23=0)? 125 cbz x23, __error_p // invalid processor (x23=0)?
124 bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
125 bl __vet_fdt 126 bl __vet_fdt
126 bl __create_page_tables // x25=TTBR0, x26=TTBR1 127 bl __create_page_tables // x25=TTBR0, x26=TTBR1
127 /* 128 /*
@@ -147,17 +148,23 @@ ENTRY(el2_setup)
147 mrs x0, CurrentEL 148 mrs x0, CurrentEL
148 cmp x0, #PSR_MODE_EL2t 149 cmp x0, #PSR_MODE_EL2t
149 ccmp x0, #PSR_MODE_EL2h, #0x4, ne 150 ccmp x0, #PSR_MODE_EL2h, #0x4, ne
151 ldr x0, =__boot_cpu_mode // Compute __boot_cpu_mode
152 add x0, x0, x28
150 b.eq 1f 153 b.eq 1f
154 str wzr, [x0] // Remember we don't have EL2...
151 ret 155 ret
152 156
153 /* Hyp configuration. */ 157 /* Hyp configuration. */
1541: mov x0, #(1 << 31) // 64-bit EL1 1581: ldr w1, =BOOT_CPU_MODE_EL2
159 str w1, [x0, #4] // This CPU has EL2
160 mov x0, #(1 << 31) // 64-bit EL1
155 msr hcr_el2, x0 161 msr hcr_el2, x0
156 162
157 /* Generic timers. */ 163 /* Generic timers. */
158 mrs x0, cnthctl_el2 164 mrs x0, cnthctl_el2
159 orr x0, x0, #3 // Enable EL1 physical timers 165 orr x0, x0, #3 // Enable EL1 physical timers
160 msr cnthctl_el2, x0 166 msr cnthctl_el2, x0
167 msr cntvoff_el2, xzr // Clear virtual offset
161 168
162 /* Populate ID registers. */ 169 /* Populate ID registers. */
163 mrs x0, midr_el1 170 mrs x0, midr_el1
@@ -178,6 +185,13 @@ ENTRY(el2_setup)
178 msr hstr_el2, xzr // Disable CP15 traps to EL2 185 msr hstr_el2, xzr // Disable CP15 traps to EL2
179#endif 186#endif
180 187
188 /* Stage-2 translation */
189 msr vttbr_el2, xzr
190
191 /* Hypervisor stub */
192 adr x0, __hyp_stub_vectors
193 msr vbar_el2, x0
194
181 /* spsr */ 195 /* spsr */
182 mov x0, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\ 196 mov x0, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\
183 PSR_MODE_EL1h) 197 PSR_MODE_EL1h)
@@ -186,6 +200,19 @@ ENTRY(el2_setup)
186 eret 200 eret
187ENDPROC(el2_setup) 201ENDPROC(el2_setup)
188 202
203/*
204 * We need to find out the CPU boot mode long after boot, so we need to
205 * store it in a writable variable.
206 *
207 * This is not in .bss, because we set it sufficiently early that the boot-time
208 * zeroing of .bss would clobber it.
209 */
210 .pushsection .data
211ENTRY(__boot_cpu_mode)
212 .long BOOT_CPU_MODE_EL2
213 .long 0
214 .popsection
215
189 .align 3 216 .align 3
1902: .quad . 2172: .quad .
191 .quad PAGE_OFFSET 218 .quad PAGE_OFFSET
@@ -201,6 +228,7 @@ ENDPROC(el2_setup)
201 * cores are held until we're ready for them to initialise. 228 * cores are held until we're ready for them to initialise.
202 */ 229 */
203ENTRY(secondary_holding_pen) 230ENTRY(secondary_holding_pen)
231 bl __calc_phys_offset // x24=phys offset
204 bl el2_setup // Drop to EL1 232 bl el2_setup // Drop to EL1
205 mrs x0, mpidr_el1 233 mrs x0, mpidr_el1
206 and x0, x0, #15 // CPU number 234 and x0, x0, #15 // CPU number
@@ -226,7 +254,6 @@ ENTRY(secondary_startup)
226 mov x23, x0 // x23=current cpu_table 254 mov x23, x0 // x23=current cpu_table
227 cbz x23, __error_p // invalid processor (x23=0)? 255 cbz x23, __error_p // invalid processor (x23=0)?
228 256
229 bl __calc_phys_offset // x24=phys offset
230 pgtbl x25, x26, x24 // x25=TTBR0, x26=TTBR1 257 pgtbl x25, x26, x24 // x25=TTBR0, x26=TTBR1
231 ldr x12, [x23, #CPU_INFO_SETUP] 258 ldr x12, [x23, #CPU_INFO_SETUP]
232 add x12, x12, x28 // __virt_to_phys 259 add x12, x12, x28 // __virt_to_phys
diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S
new file mode 100644
index 00000000000..0959611d9ff
--- /dev/null
+++ b/arch/arm64/kernel/hyp-stub.S
@@ -0,0 +1,109 @@
1/*
2 * Hypervisor stub
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Author: Marc Zyngier <marc.zyngier@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/init.h>
21#include <linux/linkage.h>
22
23#include <asm/assembler.h>
24#include <asm/ptrace.h>
25#include <asm/virt.h>
26
27 .text
28 .align 11
29
30ENTRY(__hyp_stub_vectors)
31 ventry el2_sync_invalid // Synchronous EL2t
32 ventry el2_irq_invalid // IRQ EL2t
33 ventry el2_fiq_invalid // FIQ EL2t
34 ventry el2_error_invalid // Error EL2t
35
36 ventry el2_sync_invalid // Synchronous EL2h
37 ventry el2_irq_invalid // IRQ EL2h
38 ventry el2_fiq_invalid // FIQ EL2h
39 ventry el2_error_invalid // Error EL2h
40
41 ventry el1_sync // Synchronous 64-bit EL1
42 ventry el1_irq_invalid // IRQ 64-bit EL1
43 ventry el1_fiq_invalid // FIQ 64-bit EL1
44 ventry el1_error_invalid // Error 64-bit EL1
45
46 ventry el1_sync_invalid // Synchronous 32-bit EL1
47 ventry el1_irq_invalid // IRQ 32-bit EL1
48 ventry el1_fiq_invalid // FIQ 32-bit EL1
49 ventry el1_error_invalid // Error 32-bit EL1
50ENDPROC(__hyp_stub_vectors)
51
52 .align 11
53
54el1_sync:
55 mrs x1, esr_el2
56 lsr x1, x1, #26
57 cmp x1, #0x16
58 b.ne 2f // Not an HVC trap
59 cbz x0, 1f
60 msr vbar_el2, x0 // Set vbar_el2
61 b 2f
621: mrs x0, vbar_el2 // Return vbar_el2
632: eret
64ENDPROC(el1_sync)
65
66.macro invalid_vector label
67\label:
68 b \label
69ENDPROC(\label)
70.endm
71
72 invalid_vector el2_sync_invalid
73 invalid_vector el2_irq_invalid
74 invalid_vector el2_fiq_invalid
75 invalid_vector el2_error_invalid
76 invalid_vector el1_sync_invalid
77 invalid_vector el1_irq_invalid
78 invalid_vector el1_fiq_invalid
79 invalid_vector el1_error_invalid
80
81/*
82 * __hyp_set_vectors: Call this after boot to set the initial hypervisor
83 * vectors as part of hypervisor installation. On an SMP system, this should
84 * be called on each CPU.
85 *
86 * x0 must be the physical address of the new vector table, and must be
87 * 2KB aligned.
88 *
89 * Before calling this, you must check that the stub hypervisor is installed
90 * everywhere, by waiting for any secondary CPUs to be brought up and then
91 * checking that is_hyp_mode_available() is true.
92 *
93 * If not, there is a pre-existing hypervisor, some CPUs failed to boot, or
94 * something else went wrong... in such cases, trying to install a new
95 * hypervisor is unlikely to work as desired.
96 *
97 * When you call into your shiny new hypervisor, sp_el2 will contain junk,
98 * so you will need to set that to something sensible at the new hypervisor's
99 * initialisation entry point.
100 */
101
102ENTRY(__hyp_get_vectors)
103 mov x0, xzr
104 // fall through
105ENTRY(__hyp_set_vectors)
106 hvc #0
107 ret
108ENDPROC(__hyp_get_vectors)
109ENDPROC(__hyp_set_vectors)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index e04cebdbb47..cb0956bc96e 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -234,33 +234,46 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
234asmlinkage void ret_from_fork(void) asm("ret_from_fork"); 234asmlinkage void ret_from_fork(void) asm("ret_from_fork");
235 235
236int copy_thread(unsigned long clone_flags, unsigned long stack_start, 236int copy_thread(unsigned long clone_flags, unsigned long stack_start,
237 unsigned long stk_sz, struct task_struct *p, 237 unsigned long stk_sz, struct task_struct *p)
238 struct pt_regs *regs)
239{ 238{
240 struct pt_regs *childregs = task_pt_regs(p); 239 struct pt_regs *childregs = task_pt_regs(p);
241 unsigned long tls = p->thread.tp_value; 240 unsigned long tls = p->thread.tp_value;
242 241
243 *childregs = *regs; 242 memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context));
244 childregs->regs[0] = 0;
245 243
246 if (is_compat_thread(task_thread_info(p))) 244 if (likely(!(p->flags & PF_KTHREAD))) {
247 childregs->compat_sp = stack_start; 245 *childregs = *current_pt_regs();
248 else { 246 childregs->regs[0] = 0;
247 if (is_compat_thread(task_thread_info(p))) {
248 if (stack_start)
249 childregs->compat_sp = stack_start;
250 } else {
251 /*
252 * Read the current TLS pointer from tpidr_el0 as it may be
253 * out-of-sync with the saved value.
254 */
255 asm("mrs %0, tpidr_el0" : "=r" (tls));
256 if (stack_start) {
257 /* 16-byte aligned stack mandatory on AArch64 */
258 if (stack_start & 15)
259 return -EINVAL;
260 childregs->sp = stack_start;
261 }
262 }
249 /* 263 /*
250 * Read the current TLS pointer from tpidr_el0 as it may be 264 * If a TLS pointer was passed to clone (4th argument), use it
251 * out-of-sync with the saved value. 265 * for the new thread.
252 */ 266 */
253 asm("mrs %0, tpidr_el0" : "=r" (tls)); 267 if (clone_flags & CLONE_SETTLS)
254 childregs->sp = stack_start; 268 tls = childregs->regs[3];
269 } else {
270 memset(childregs, 0, sizeof(struct pt_regs));
271 childregs->pstate = PSR_MODE_EL1h;
272 p->thread.cpu_context.x19 = stack_start;
273 p->thread.cpu_context.x20 = stk_sz;
255 } 274 }
256
257 memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context));
258 p->thread.cpu_context.sp = (unsigned long)childregs;
259 p->thread.cpu_context.pc = (unsigned long)ret_from_fork; 275 p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
260 276 p->thread.cpu_context.sp = (unsigned long)childregs;
261 /* If a TLS pointer was passed to clone, use that for the new thread. */
262 if (clone_flags & CLONE_SETTLS)
263 tls = regs->regs[3];
264 p->thread.tp_value = tls; 277 p->thread.tp_value = tls;
265 278
266 ptrace_hw_copy_thread(p); 279 ptrace_hw_copy_thread(p);
@@ -309,43 +322,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
309 return last; 322 return last;
310} 323}
311 324
312/*
313 * Shuffle the argument into the correct register before calling the
314 * thread function. x1 is the thread argument, x2 is the pointer to
315 * the thread function, and x3 points to the exit function.
316 */
317extern void kernel_thread_helper(void);
318asm( ".section .text\n"
319" .align\n"
320" .type kernel_thread_helper, #function\n"
321"kernel_thread_helper:\n"
322" mov x0, x1\n"
323" mov x30, x3\n"
324" br x2\n"
325" .size kernel_thread_helper, . - kernel_thread_helper\n"
326" .previous");
327
328#define kernel_thread_exit do_exit
329
330/*
331 * Create a kernel thread.
332 */
333pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
334{
335 struct pt_regs regs;
336
337 memset(&regs, 0, sizeof(regs));
338
339 regs.regs[1] = (unsigned long)arg;
340 regs.regs[2] = (unsigned long)fn;
341 regs.regs[3] = (unsigned long)kernel_thread_exit;
342 regs.pc = (unsigned long)kernel_thread_helper;
343 regs.pstate = PSR_MODE_EL1h;
344
345 return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
346}
347EXPORT_SYMBOL(kernel_thread);
348
349unsigned long get_wchan(struct task_struct *p) 325unsigned long get_wchan(struct task_struct *p)
350{ 326{
351 struct stackframe frame; 327 struct stackframe frame;
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 8807ba2cf26..abd756315cb 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -41,6 +41,8 @@
41struct rt_sigframe { 41struct rt_sigframe {
42 struct siginfo info; 42 struct siginfo info;
43 struct ucontext uc; 43 struct ucontext uc;
44 u64 fp;
45 u64 lr;
44}; 46};
45 47
46static int preserve_fpsimd_context(struct fpsimd_context __user *ctx) 48static int preserve_fpsimd_context(struct fpsimd_context __user *ctx)
@@ -175,6 +177,10 @@ static int setup_sigframe(struct rt_sigframe __user *sf,
175 struct aux_context __user *aux = 177 struct aux_context __user *aux =
176 (struct aux_context __user *)sf->uc.uc_mcontext.__reserved; 178 (struct aux_context __user *)sf->uc.uc_mcontext.__reserved;
177 179
180 /* set up the stack frame for unwinding */
181 __put_user_error(regs->regs[29], &sf->fp, err);
182 __put_user_error(regs->regs[30], &sf->lr, err);
183
178 for (i = 0; i < 31; i++) 184 for (i = 0; i < 31; i++)
179 __put_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i], 185 __put_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i],
180 err); 186 err);
@@ -196,11 +202,11 @@ static int setup_sigframe(struct rt_sigframe __user *sf,
196 return err; 202 return err;
197} 203}
198 204
199static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 205static struct rt_sigframe __user *get_sigframe(struct k_sigaction *ka,
200 int framesize) 206 struct pt_regs *regs)
201{ 207{
202 unsigned long sp, sp_top; 208 unsigned long sp, sp_top;
203 void __user *frame; 209 struct rt_sigframe __user *frame;
204 210
205 sp = sp_top = regs->sp; 211 sp = sp_top = regs->sp;
206 212
@@ -210,11 +216,8 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
210 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp)) 216 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
211 sp = sp_top = current->sas_ss_sp + current->sas_ss_size; 217 sp = sp_top = current->sas_ss_sp + current->sas_ss_size;
212 218
213 /* room for stack frame (FP, LR) */ 219 sp = (sp - sizeof(struct rt_sigframe)) & ~15;
214 sp -= 16; 220 frame = (struct rt_sigframe __user *)sp;
215
216 sp = (sp - framesize) & ~15;
217 frame = (void __user *)sp;
218 221
219 /* 222 /*
220 * Check that we can actually write to the signal frame. 223 * Check that we can actually write to the signal frame.
@@ -225,20 +228,14 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
225 return frame; 228 return frame;
226} 229}
227 230
228static int setup_return(struct pt_regs *regs, struct k_sigaction *ka, 231static void setup_return(struct pt_regs *regs, struct k_sigaction *ka,
229 void __user *frame, int usig) 232 void __user *frame, int usig)
230{ 233{
231 int err = 0;
232 __sigrestore_t sigtramp; 234 __sigrestore_t sigtramp;
233 unsigned long __user *sp = (unsigned long __user *)regs->sp;
234
235 /* set up the stack frame */
236 __put_user_error(regs->regs[29], sp - 2, err);
237 __put_user_error(regs->regs[30], sp - 1, err);
238 235
239 regs->regs[0] = usig; 236 regs->regs[0] = usig;
240 regs->regs[29] = regs->sp - 16;
241 regs->sp = (unsigned long)frame; 237 regs->sp = (unsigned long)frame;
238 regs->regs[29] = regs->sp + offsetof(struct rt_sigframe, fp);
242 regs->pc = (unsigned long)ka->sa.sa_handler; 239 regs->pc = (unsigned long)ka->sa.sa_handler;
243 240
244 if (ka->sa.sa_flags & SA_RESTORER) 241 if (ka->sa.sa_flags & SA_RESTORER)
@@ -247,8 +244,6 @@ static int setup_return(struct pt_regs *regs, struct k_sigaction *ka,
247 sigtramp = VDSO_SYMBOL(current->mm->context.vdso, sigtramp); 244 sigtramp = VDSO_SYMBOL(current->mm->context.vdso, sigtramp);
248 245
249 regs->regs[30] = (unsigned long)sigtramp; 246 regs->regs[30] = (unsigned long)sigtramp;
250
251 return err;
252} 247}
253 248
254static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 249static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
@@ -258,7 +253,7 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
258 stack_t stack; 253 stack_t stack;
259 int err = 0; 254 int err = 0;
260 255
261 frame = get_sigframe(ka, regs, sizeof(*frame)); 256 frame = get_sigframe(ka, regs);
262 if (!frame) 257 if (!frame)
263 return 1; 258 return 1;
264 259
@@ -272,13 +267,13 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
272 err |= __copy_to_user(&frame->uc.uc_stack, &stack, sizeof(stack)); 267 err |= __copy_to_user(&frame->uc.uc_stack, &stack, sizeof(stack));
273 268
274 err |= setup_sigframe(frame, regs, set); 269 err |= setup_sigframe(frame, regs, set);
275 if (err == 0) 270 if (err == 0) {
276 err = setup_return(regs, ka, frame, usig); 271 setup_return(regs, ka, frame, usig);
277 272 if (ka->sa.sa_flags & SA_SIGINFO) {
278 if (err == 0 && ka->sa.sa_flags & SA_SIGINFO) { 273 err |= copy_siginfo_to_user(&frame->info, info);
279 err |= copy_siginfo_to_user(&frame->info, info); 274 regs->regs[1] = (unsigned long)&frame->info;
280 regs->regs[1] = (unsigned long)&frame->info; 275 regs->regs[2] = (unsigned long)&frame->uc;
281 regs->regs[2] = (unsigned long)&frame->uc; 276 }
282 } 277 }
283 278
284 return err; 279 return err;
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index 4654824747a..a4db3d22aac 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -578,9 +578,9 @@ badframe:
578 return 0; 578 return 0;
579} 579}
580 580
581static inline void __user *compat_get_sigframe(struct k_sigaction *ka, 581static void __user *compat_get_sigframe(struct k_sigaction *ka,
582 struct pt_regs *regs, 582 struct pt_regs *regs,
583 int framesize) 583 int framesize)
584{ 584{
585 compat_ulong_t sp = regs->compat_sp; 585 compat_ulong_t sp = regs->compat_sp;
586 void __user *frame; 586 void __user *frame;
@@ -605,9 +605,9 @@ static inline void __user *compat_get_sigframe(struct k_sigaction *ka,
605 return frame; 605 return frame;
606} 606}
607 607
608static int compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka, 608static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
609 compat_ulong_t __user *rc, void __user *frame, 609 compat_ulong_t __user *rc, void __user *frame,
610 int usig) 610 int usig)
611{ 611{
612 compat_ulong_t handler = ptr_to_compat(ka->sa.sa_handler); 612 compat_ulong_t handler = ptr_to_compat(ka->sa.sa_handler);
613 compat_ulong_t retcode; 613 compat_ulong_t retcode;
@@ -643,8 +643,6 @@ static int compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
643 regs->compat_lr = retcode; 643 regs->compat_lr = retcode;
644 regs->pc = handler; 644 regs->pc = handler;
645 regs->pstate = spsr; 645 regs->pstate = spsr;
646
647 return 0;
648} 646}
649 647
650static int compat_setup_sigframe(struct compat_sigframe __user *sf, 648static int compat_setup_sigframe(struct compat_sigframe __user *sf,
@@ -714,11 +712,9 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
714 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack)); 712 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack));
715 713
716 err |= compat_setup_sigframe(&frame->sig, regs, set); 714 err |= compat_setup_sigframe(&frame->sig, regs, set);
717 if (err == 0)
718 err = compat_setup_return(regs, ka, frame->sig.retcode, frame,
719 usig);
720 715
721 if (err == 0) { 716 if (err == 0) {
717 compat_setup_return(regs, ka, frame->sig.retcode, frame, usig);
722 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info; 718 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info;
723 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc; 719 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc;
724 } 720 }
@@ -741,7 +737,7 @@ int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set,
741 737
742 err |= compat_setup_sigframe(frame, regs, set); 738 err |= compat_setup_sigframe(frame, regs, set);
743 if (err == 0) 739 if (err == 0)
744 err = compat_setup_return(regs, ka, frame->retcode, frame, usig); 740 compat_setup_return(regs, ka, frame->retcode, frame, usig);
745 741
746 return err; 742 return err;
747} 743}
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index b120df37de3..8292a9b090f 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -26,85 +26,6 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/syscalls.h> 27#include <linux/syscalls.h>
28 28
29/*
30 * Clone a task - this clones the calling program thread.
31 */
32asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
33 int __user *parent_tidptr, unsigned long tls_val,
34 int __user *child_tidptr, struct pt_regs *regs)
35{
36 if (!newsp)
37 newsp = regs->sp;
38 /* 16-byte aligned stack mandatory on AArch64 */
39 if (newsp & 15)
40 return -EINVAL;
41 return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr);
42}
43
44/*
45 * sys_execve() executes a new program.
46 */
47asmlinkage long sys_execve(const char __user *filenamei,
48 const char __user *const __user *argv,
49 const char __user *const __user *envp,
50 struct pt_regs *regs)
51{
52 long error;
53 struct filename *filename;
54
55 filename = getname(filenamei);
56 error = PTR_ERR(filename);
57 if (IS_ERR(filename))
58 goto out;
59 error = do_execve(filename->name, argv, envp, regs);
60 putname(filename);
61out:
62 return error;
63}
64
65int kernel_execve(const char *filename,
66 const char *const argv[],
67 const char *const envp[])
68{
69 struct pt_regs regs;
70 int ret;
71
72 memset(&regs, 0, sizeof(struct pt_regs));
73 ret = do_execve(filename,
74 (const char __user *const __user *)argv,
75 (const char __user *const __user *)envp, &regs);
76 if (ret < 0)
77 goto out;
78
79 /*
80 * Save argc to the register structure for userspace.
81 */
82 regs.regs[0] = ret;
83
84 /*
85 * We were successful. We won't be returning to our caller, but
86 * instead to user space by manipulating the kernel stack.
87 */
88 asm( "add x0, %0, %1\n\t"
89 "mov x1, %2\n\t"
90 "mov x2, %3\n\t"
91 "bl memmove\n\t" /* copy regs to top of stack */
92 "mov x27, #0\n\t" /* not a syscall */
93 "mov x28, %0\n\t" /* thread structure */
94 "mov sp, x0\n\t" /* reposition stack pointer */
95 "b ret_to_user"
96 :
97 : "r" (current_thread_info()),
98 "Ir" (THREAD_START_SP - sizeof(regs)),
99 "r" (&regs),
100 "Ir" (sizeof(regs))
101 : "x0", "x1", "x2", "x27", "x28", "x30", "memory");
102
103 out:
104 return ret;
105}
106EXPORT_SYMBOL(kernel_execve);
107
108asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 29asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
109 unsigned long prot, unsigned long flags, 30 unsigned long prot, unsigned long flags,
110 unsigned long fd, off_t off) 31 unsigned long fd, off_t off)
@@ -118,8 +39,6 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
118/* 39/*
119 * Wrappers to pass the pt_regs argument. 40 * Wrappers to pass the pt_regs argument.
120 */ 41 */
121#define sys_execve sys_execve_wrapper
122#define sys_clone sys_clone_wrapper
123#define sys_rt_sigreturn sys_rt_sigreturn_wrapper 42#define sys_rt_sigreturn sys_rt_sigreturn_wrapper
124#define sys_sigaltstack sys_sigaltstack_wrapper 43#define sys_sigaltstack sys_sigaltstack_wrapper
125 44
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S
index 54c4aec47a0..7ef59e9245e 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/sys32.S
@@ -26,25 +26,6 @@
26/* 26/*
27 * System call wrappers for the AArch32 compatibility layer. 27 * System call wrappers for the AArch32 compatibility layer.
28 */ 28 */
29compat_sys_fork_wrapper:
30 mov x0, sp
31 b compat_sys_fork
32ENDPROC(compat_sys_fork_wrapper)
33
34compat_sys_vfork_wrapper:
35 mov x0, sp
36 b compat_sys_vfork
37ENDPROC(compat_sys_vfork_wrapper)
38
39compat_sys_execve_wrapper:
40 mov x3, sp
41 b compat_sys_execve
42ENDPROC(compat_sys_execve_wrapper)
43
44compat_sys_clone_wrapper:
45 mov x5, sp
46 b compat_sys_clone
47ENDPROC(compat_sys_clone_wrapper)
48 29
49compat_sys_sigreturn_wrapper: 30compat_sys_sigreturn_wrapper:
50 mov x0, sp 31 mov x0, sp
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c
index 906e3bd270b..f7b05edf8ce 100644
--- a/arch/arm64/kernel/sys_compat.c
+++ b/arch/arm64/kernel/sys_compat.c
@@ -28,45 +28,6 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/unistd32.h> 29#include <asm/unistd32.h>
30 30
31asmlinkage int compat_sys_fork(struct pt_regs *regs)
32{
33 return do_fork(SIGCHLD, regs->compat_sp, regs, 0, NULL, NULL);
34}
35
36asmlinkage int compat_sys_clone(unsigned long clone_flags, unsigned long newsp,
37 int __user *parent_tidptr, int tls_val,
38 int __user *child_tidptr, struct pt_regs *regs)
39{
40 if (!newsp)
41 newsp = regs->compat_sp;
42
43 return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr);
44}
45
46asmlinkage int compat_sys_vfork(struct pt_regs *regs)
47{
48 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->compat_sp,
49 regs, 0, NULL, NULL);
50}
51
52asmlinkage int compat_sys_execve(const char __user *filenamei,
53 compat_uptr_t argv, compat_uptr_t envp,
54 struct pt_regs *regs)
55{
56 int error;
57 struct filename *filename;
58
59 filename = getname(filenamei);
60 error = PTR_ERR(filename);
61 if (IS_ERR(filename))
62 goto out;
63 error = compat_do_execve(filename->name, compat_ptr(argv),
64 compat_ptr(envp), regs);
65 putname(filename);
66out:
67 return error;
68}
69
70asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid, 31asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid,
71 struct compat_timespec __user *interval) 32 struct compat_timespec __user *interval)
72{ 33{
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index ba457943a16..c958cb84d75 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -239,7 +239,7 @@ void update_vsyscall(struct timekeeper *tk)
239 if (!use_syscall) { 239 if (!use_syscall) {
240 vdso_data->cs_cycle_last = tk->clock->cycle_last; 240 vdso_data->cs_cycle_last = tk->clock->cycle_last;
241 vdso_data->xtime_clock_sec = tk->xtime_sec; 241 vdso_data->xtime_clock_sec = tk->xtime_sec;
242 vdso_data->xtime_clock_nsec = tk->xtime_nsec >> tk->shift; 242 vdso_data->xtime_clock_nsec = tk->xtime_nsec;
243 vdso_data->cs_mult = tk->mult; 243 vdso_data->cs_mult = tk->mult;
244 vdso_data->cs_shift = tk->shift; 244 vdso_data->cs_shift = tk->shift;
245 vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; 245 vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;
diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S
index dcb8c203a3b..8bf658d974f 100644
--- a/arch/arm64/kernel/vdso/gettimeofday.S
+++ b/arch/arm64/kernel/vdso/gettimeofday.S
@@ -62,18 +62,19 @@ ENTRY(__kernel_gettimeofday)
62 /* If tv is NULL, skip to the timezone code. */ 62 /* If tv is NULL, skip to the timezone code. */
63 cbz x0, 2f 63 cbz x0, 2f
64 bl __do_get_tspec 64 bl __do_get_tspec
65 seqcnt_check w13, 1b 65 seqcnt_check w9, 1b
66 66
67 /* Convert ns to us. */ 67 /* Convert ns to us. */
68 mov x11, #1000 68 mov x13, #1000
69 udiv x10, x10, x11 69 lsl x13, x13, x12
70 stp x9, x10, [x0, #TVAL_TV_SEC] 70 udiv x11, x11, x13
71 stp x10, x11, [x0, #TVAL_TV_SEC]
712: 722:
72 /* If tz is NULL, return 0. */ 73 /* If tz is NULL, return 0. */
73 cbz x1, 3f 74 cbz x1, 3f
74 ldp w4, w5, [vdso_data, #VDSO_TZ_MINWEST] 75 ldp w4, w5, [vdso_data, #VDSO_TZ_MINWEST]
75 seqcnt_read w13 76 seqcnt_read w9
76 seqcnt_check w13, 1b 77 seqcnt_check w9, 1b
77 stp w4, w5, [x1, #TZ_MINWEST] 78 stp w4, w5, [x1, #TZ_MINWEST]
783: 793:
79 mov x0, xzr 80 mov x0, xzr
@@ -102,17 +103,17 @@ ENTRY(__kernel_clock_gettime)
102 cbnz use_syscall, 7f 103 cbnz use_syscall, 7f
103 104
104 bl __do_get_tspec 105 bl __do_get_tspec
105 seqcnt_check w13, 1b 106 seqcnt_check w9, 1b
106 107
107 cmp w0, #CLOCK_MONOTONIC 108 cmp w0, #CLOCK_MONOTONIC
108 b.ne 6f 109 b.ne 6f
109 110
110 /* Get wtm timespec. */ 111 /* Get wtm timespec. */
111 ldp x14, x15, [vdso_data, #VDSO_WTM_CLK_SEC] 112 ldp x13, x14, [vdso_data, #VDSO_WTM_CLK_SEC]
112 113
113 /* Check the sequence counter. */ 114 /* Check the sequence counter. */
114 seqcnt_read w13 115 seqcnt_read w9
115 seqcnt_check w13, 1b 116 seqcnt_check w9, 1b
116 b 4f 117 b 4f
1172: 1182:
118 cmp w0, #CLOCK_REALTIME_COARSE 119 cmp w0, #CLOCK_REALTIME_COARSE
@@ -122,37 +123,40 @@ ENTRY(__kernel_clock_gettime)
122 /* Get coarse timespec. */ 123 /* Get coarse timespec. */
123 adr vdso_data, _vdso_data 124 adr vdso_data, _vdso_data
1243: seqcnt_acquire 1253: seqcnt_acquire
125 ldp x9, x10, [vdso_data, #VDSO_XTIME_CRS_SEC] 126 ldp x10, x11, [vdso_data, #VDSO_XTIME_CRS_SEC]
126
127 cmp w0, #CLOCK_MONOTONIC_COARSE
128 b.ne 6f
129 127
130 /* Get wtm timespec. */ 128 /* Get wtm timespec. */
131 ldp x14, x15, [vdso_data, #VDSO_WTM_CLK_SEC] 129 ldp x13, x14, [vdso_data, #VDSO_WTM_CLK_SEC]
132 130
133 /* Check the sequence counter. */ 131 /* Check the sequence counter. */
134 seqcnt_read w13 132 seqcnt_read w9
135 seqcnt_check w13, 3b 133 seqcnt_check w9, 3b
134
135 cmp w0, #CLOCK_MONOTONIC_COARSE
136 b.ne 6f
1364: 1374:
137 /* Add on wtm timespec. */ 138 /* Add on wtm timespec. */
138 add x9, x9, x14 139 add x10, x10, x13
139 add x10, x10, x15 140 lsl x14, x14, x12
141 add x11, x11, x14
140 142
141 /* Normalise the new timespec. */ 143 /* Normalise the new timespec. */
142 mov x14, #NSEC_PER_SEC_LO16 144 mov x15, #NSEC_PER_SEC_LO16
143 movk x14, #NSEC_PER_SEC_HI16, lsl #16 145 movk x15, #NSEC_PER_SEC_HI16, lsl #16
144 cmp x10, x14 146 lsl x15, x15, x12
147 cmp x11, x15
145 b.lt 5f 148 b.lt 5f
146 sub x10, x10, x14 149 sub x11, x11, x15
147 add x9, x9, #1 150 add x10, x10, #1
1485: 1515:
149 cmp x10, #0 152 cmp x11, #0
150 b.ge 6f 153 b.ge 6f
151 add x10, x10, x14 154 add x11, x11, x15
152 sub x9, x9, #1 155 sub x10, x10, #1
153 156
1546: /* Store to the user timespec. */ 1576: /* Store to the user timespec. */
155 stp x9, x10, [x1, #TSPEC_TV_SEC] 158 lsr x11, x11, x12
159 stp x10, x11, [x1, #TSPEC_TV_SEC]
156 mov x0, xzr 160 mov x0, xzr
157 ret x2 161 ret x2
1587: 1627:
@@ -203,39 +207,39 @@ ENDPROC(__kernel_clock_getres)
203 * Expects vdso_data to be initialised. 207 * Expects vdso_data to be initialised.
204 * Clobbers the temporary registers (x9 - x15). 208 * Clobbers the temporary registers (x9 - x15).
205 * Returns: 209 * Returns:
206 * - (x9, x10) = (ts->tv_sec, ts->tv_nsec) 210 * - w9 = vDSO sequence counter
207 * - (x11, x12) = (xtime->tv_sec, xtime->tv_nsec) 211 * - (x10, x11) = (ts->tv_sec, shifted ts->tv_nsec)
208 * - w13 = vDSO sequence counter 212 * - w12 = cs_shift
209 */ 213 */
210ENTRY(__do_get_tspec) 214ENTRY(__do_get_tspec)
211 .cfi_startproc 215 .cfi_startproc
212 216
213 /* Read from the vDSO data page. */ 217 /* Read from the vDSO data page. */
214 ldr x10, [vdso_data, #VDSO_CS_CYCLE_LAST] 218 ldr x10, [vdso_data, #VDSO_CS_CYCLE_LAST]
215 ldp x11, x12, [vdso_data, #VDSO_XTIME_CLK_SEC] 219 ldp x13, x14, [vdso_data, #VDSO_XTIME_CLK_SEC]
216 ldp w14, w15, [vdso_data, #VDSO_CS_MULT] 220 ldp w11, w12, [vdso_data, #VDSO_CS_MULT]
217 seqcnt_read w13 221 seqcnt_read w9
218 222
219 /* Read the physical counter. */ 223 /* Read the virtual counter. */
220 isb 224 isb
221 mrs x9, cntpct_el0 225 mrs x15, cntvct_el0
222 226
223 /* Calculate cycle delta and convert to ns. */ 227 /* Calculate cycle delta and convert to ns. */
224 sub x10, x9, x10 228 sub x10, x15, x10
225 /* We can only guarantee 56 bits of precision. */ 229 /* We can only guarantee 56 bits of precision. */
226 movn x9, #0xff0, lsl #48 230 movn x15, #0xff00, lsl #48
227 and x10, x9, x10 231 and x10, x15, x10
228 mul x10, x10, x14 232 mul x10, x10, x11
229 lsr x10, x10, x15
230 233
231 /* Use the kernel time to calculate the new timespec. */ 234 /* Use the kernel time to calculate the new timespec. */
232 add x10, x12, x10 235 mov x11, #NSEC_PER_SEC_LO16
233 mov x14, #NSEC_PER_SEC_LO16 236 movk x11, #NSEC_PER_SEC_HI16, lsl #16
234 movk x14, #NSEC_PER_SEC_HI16, lsl #16 237 lsl x11, x11, x12
235 udiv x15, x10, x14 238 add x15, x10, x14
236 add x9, x15, x11 239 udiv x14, x15, x11
237 mul x14, x14, x15 240 add x10, x13, x14
238 sub x10, x10, x14 241 mul x13, x14, x11
242 sub x11, x15, x13
239 243
240 ret 244 ret
241 .cfi_endproc 245 .cfi_endproc
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 1909a69983c..afadae6682e 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -36,6 +36,8 @@
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/tlbflush.h> 37#include <asm/tlbflush.h>
38 38
39static const char *fault_name(unsigned int esr);
40
39/* 41/*
40 * Dump out the page tables associated with 'addr' in mm 'mm'. 42 * Dump out the page tables associated with 'addr' in mm 'mm'.
41 */ 43 */
@@ -112,8 +114,9 @@ static void __do_user_fault(struct task_struct *tsk, unsigned long addr,
112 struct siginfo si; 114 struct siginfo si;
113 115
114 if (show_unhandled_signals) { 116 if (show_unhandled_signals) {
115 pr_info("%s[%d]: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n", 117 pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n",
116 tsk->comm, task_pid_nr(tsk), sig, addr, esr); 118 tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
119 addr, esr);
117 show_pte(tsk->mm, addr); 120 show_pte(tsk->mm, addr);
118 show_regs(regs); 121 show_regs(regs);
119 } 122 }
@@ -450,6 +453,12 @@ static struct fault_info {
450 { do_bad, SIGBUS, 0, "unknown 63" }, 453 { do_bad, SIGBUS, 0, "unknown 63" },
451}; 454};
452 455
456static const char *fault_name(unsigned int esr)
457{
458 const struct fault_info *inf = fault_info + (esr & 63);
459 return inf->name;
460}
461
453/* 462/*
454 * Dispatch a data abort to the relevant handler. 463 * Dispatch a data abort to the relevant handler.
455 */ 464 */
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index c144adb1682..88611c3a421 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -27,10 +27,6 @@
27 27
28#include "mm.h" 28#include "mm.h"
29 29
30void flush_cache_mm(struct mm_struct *mm)
31{
32}
33
34void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 30void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
35 unsigned long end) 31 unsigned long end)
36{ 32{
@@ -38,11 +34,6 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
38 __flush_icache_all(); 34 __flush_icache_all();
39} 35}
40 36
41void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr,
42 unsigned long pfn)
43{
44}
45
46static void flush_ptrace_access(struct vm_area_struct *vma, struct page *page, 37static void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
47 unsigned long uaddr, void *kaddr, 38 unsigned long uaddr, void *kaddr,
48 unsigned long len) 39 unsigned long len)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 4cd28931dba..800aac306a0 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -79,8 +79,8 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
79 79
80#ifdef CONFIG_ZONE_DMA32 80#ifdef CONFIG_ZONE_DMA32
81 /* 4GB maximum for 32-bit only capable devices */ 81 /* 4GB maximum for 32-bit only capable devices */
82 max_dma32 = min(max, MAX_DMA32_PFN); 82 max_dma32 = max(min, min(max, MAX_DMA32_PFN));
83 zone_size[ZONE_DMA32] = max(min, max_dma32) - min; 83 zone_size[ZONE_DMA32] = max_dma32 - min;
84#endif 84#endif
85 zone_size[ZONE_NORMAL] = max - max_dma32; 85 zone_size[ZONE_NORMAL] = max - max_dma32;
86 86
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 06e73bf665e..e40c9bd7914 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -17,6 +17,8 @@ config AVR32
17 select GENERIC_CLOCKEVENTS 17 select GENERIC_CLOCKEVENTS
18 select HAVE_MOD_ARCH_SPECIFIC 18 select HAVE_MOD_ARCH_SPECIFIC
19 select MODULES_USE_ELF_RELA 19 select MODULES_USE_ELF_RELA
20 select GENERIC_KERNEL_THREAD
21 select GENERIC_KERNEL_EXECVE
20 help 22 help
21 AVR32 is a high-performance 32-bit RISC microprocessor core, 23 AVR32 is a high-performance 32-bit RISC microprocessor core,
22 designed for cost-sensitive embedded applications, with particular 24 designed for cost-sensitive embedded applications, with particular
@@ -80,7 +82,6 @@ config PLATFORM_AT32AP
80 select ARCH_REQUIRE_GPIOLIB 82 select ARCH_REQUIRE_GPIOLIB
81 select GENERIC_ALLOCATOR 83 select GENERIC_ALLOCATOR
82 select HAVE_FB_ATMEL 84 select HAVE_FB_ATMEL
83 select HAVE_NET_MACB
84 85
85# 86#
86# CPU types 87# CPU types
@@ -193,9 +194,6 @@ source "kernel/Kconfig.preempt"
193config QUICKLIST 194config QUICKLIST
194 def_bool y 195 def_bool y
195 196
196config HAVE_ARCH_BOOTMEM
197 def_bool n
198
199config ARCH_HAVE_MEMORY_PRESENT 197config ARCH_HAVE_MEMORY_PRESENT
200 def_bool n 198 def_bool n
201 199
diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig
index a06bfccc284..f4025db184f 100644
--- a/arch/avr32/configs/atngw100_defconfig
+++ b/arch/avr32/configs/atngw100_defconfig
@@ -109,7 +109,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=350
109CONFIG_USB_ZERO=m 109CONFIG_USB_ZERO=m
110CONFIG_USB_ETH=m 110CONFIG_USB_ETH=m
111CONFIG_USB_GADGETFS=m 111CONFIG_USB_GADGETFS=m
112CONFIG_USB_FILE_STORAGE=m 112CONFIG_USB_MASS_STORAGE=m
113CONFIG_USB_G_SERIAL=m 113CONFIG_USB_G_SERIAL=m
114CONFIG_USB_CDC_COMPOSITE=m 114CONFIG_USB_CDC_COMPOSITE=m
115CONFIG_MMC=y 115CONFIG_MMC=y
diff --git a/arch/avr32/configs/atngw100_evklcd100_defconfig b/arch/avr32/configs/atngw100_evklcd100_defconfig
index d8f1fe80d21..c76a49b9e9d 100644
--- a/arch/avr32/configs/atngw100_evklcd100_defconfig
+++ b/arch/avr32/configs/atngw100_evklcd100_defconfig
@@ -125,7 +125,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=350
125CONFIG_USB_ZERO=m 125CONFIG_USB_ZERO=m
126CONFIG_USB_ETH=m 126CONFIG_USB_ETH=m
127CONFIG_USB_GADGETFS=m 127CONFIG_USB_GADGETFS=m
128CONFIG_USB_FILE_STORAGE=m 128CONFIG_USB_MASS_STORAGE=m
129CONFIG_USB_G_SERIAL=m 129CONFIG_USB_G_SERIAL=m
130CONFIG_USB_CDC_COMPOSITE=m 130CONFIG_USB_CDC_COMPOSITE=m
131CONFIG_MMC=y 131CONFIG_MMC=y
diff --git a/arch/avr32/configs/atngw100_evklcd101_defconfig b/arch/avr32/configs/atngw100_evklcd101_defconfig
index d4c5b19ec95..2d8ab089a64 100644
--- a/arch/avr32/configs/atngw100_evklcd101_defconfig
+++ b/arch/avr32/configs/atngw100_evklcd101_defconfig
@@ -124,7 +124,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=350
124CONFIG_USB_ZERO=m 124CONFIG_USB_ZERO=m
125CONFIG_USB_ETH=m 125CONFIG_USB_ETH=m
126CONFIG_USB_GADGETFS=m 126CONFIG_USB_GADGETFS=m
127CONFIG_USB_FILE_STORAGE=m 127CONFIG_USB_MASS_STORAGE=m
128CONFIG_USB_G_SERIAL=m 128CONFIG_USB_G_SERIAL=m
129CONFIG_USB_CDC_COMPOSITE=m 129CONFIG_USB_CDC_COMPOSITE=m
130CONFIG_MMC=y 130CONFIG_MMC=y
diff --git a/arch/avr32/configs/atngw100_mrmt_defconfig b/arch/avr32/configs/atngw100_mrmt_defconfig
index 77ca4f905d2..b189e0cab04 100644
--- a/arch/avr32/configs/atngw100_mrmt_defconfig
+++ b/arch/avr32/configs/atngw100_mrmt_defconfig
@@ -99,7 +99,7 @@ CONFIG_SND_ATMEL_AC97C=m
99# CONFIG_SND_SPI is not set 99# CONFIG_SND_SPI is not set
100CONFIG_USB_GADGET=m 100CONFIG_USB_GADGET=m
101CONFIG_USB_GADGET_DEBUG_FILES=y 101CONFIG_USB_GADGET_DEBUG_FILES=y
102CONFIG_USB_FILE_STORAGE=m 102CONFIG_USB_MASS_STORAGE=m
103CONFIG_USB_G_SERIAL=m 103CONFIG_USB_G_SERIAL=m
104CONFIG_MMC=y 104CONFIG_MMC=y
105CONFIG_MMC_ATMELMCI=y 105CONFIG_MMC_ATMELMCI=y
diff --git a/arch/avr32/configs/atngw100mkii_defconfig b/arch/avr32/configs/atngw100mkii_defconfig
index 6e0dca4d313..2e4de42a53c 100644
--- a/arch/avr32/configs/atngw100mkii_defconfig
+++ b/arch/avr32/configs/atngw100mkii_defconfig
@@ -111,7 +111,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=350
111CONFIG_USB_ZERO=m 111CONFIG_USB_ZERO=m
112CONFIG_USB_ETH=m 112CONFIG_USB_ETH=m
113CONFIG_USB_GADGETFS=m 113CONFIG_USB_GADGETFS=m
114CONFIG_USB_FILE_STORAGE=m 114CONFIG_USB_MASS_STORAGE=m
115CONFIG_USB_G_SERIAL=m 115CONFIG_USB_G_SERIAL=m
116CONFIG_USB_CDC_COMPOSITE=m 116CONFIG_USB_CDC_COMPOSITE=m
117CONFIG_MMC=y 117CONFIG_MMC=y
diff --git a/arch/avr32/configs/atngw100mkii_evklcd100_defconfig b/arch/avr32/configs/atngw100mkii_evklcd100_defconfig
index 7f2a344a5fa..fad3cd22dfd 100644
--- a/arch/avr32/configs/atngw100mkii_evklcd100_defconfig
+++ b/arch/avr32/configs/atngw100mkii_evklcd100_defconfig
@@ -128,7 +128,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=350
128CONFIG_USB_ZERO=m 128CONFIG_USB_ZERO=m
129CONFIG_USB_ETH=m 129CONFIG_USB_ETH=m
130CONFIG_USB_GADGETFS=m 130CONFIG_USB_GADGETFS=m
131CONFIG_USB_FILE_STORAGE=m 131CONFIG_USB_MASS_STORAGE=m
132CONFIG_USB_G_SERIAL=m 132CONFIG_USB_G_SERIAL=m
133CONFIG_USB_CDC_COMPOSITE=m 133CONFIG_USB_CDC_COMPOSITE=m
134CONFIG_MMC=y 134CONFIG_MMC=y
diff --git a/arch/avr32/configs/atngw100mkii_evklcd101_defconfig b/arch/avr32/configs/atngw100mkii_evklcd101_defconfig
index 085eeba88f6..29986230aaa 100644
--- a/arch/avr32/configs/atngw100mkii_evklcd101_defconfig
+++ b/arch/avr32/configs/atngw100mkii_evklcd101_defconfig
@@ -127,7 +127,7 @@ CONFIG_USB_GADGET_VBUS_DRAW=350
127CONFIG_USB_ZERO=m 127CONFIG_USB_ZERO=m
128CONFIG_USB_ETH=m 128CONFIG_USB_ETH=m
129CONFIG_USB_GADGETFS=m 129CONFIG_USB_GADGETFS=m
130CONFIG_USB_FILE_STORAGE=m 130CONFIG_USB_MASS_STORAGE=m
131CONFIG_USB_G_SERIAL=m 131CONFIG_USB_G_SERIAL=m
132CONFIG_USB_CDC_COMPOSITE=m 132CONFIG_USB_CDC_COMPOSITE=m
133CONFIG_MMC=y 133CONFIG_MMC=y
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index d1a887e6405..a582465e1ce 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_defconfig
@@ -126,7 +126,7 @@ CONFIG_USB_GADGET=y
126CONFIG_USB_ZERO=m 126CONFIG_USB_ZERO=m
127CONFIG_USB_ETH=m 127CONFIG_USB_ETH=m
128CONFIG_USB_GADGETFS=m 128CONFIG_USB_GADGETFS=m
129CONFIG_USB_FILE_STORAGE=m 129CONFIG_USB_MASS_STORAGE=m
130CONFIG_USB_G_SERIAL=m 130CONFIG_USB_G_SERIAL=m
131CONFIG_USB_CDC_COMPOSITE=m 131CONFIG_USB_CDC_COMPOSITE=m
132CONFIG_MMC=y 132CONFIG_MMC=y
diff --git a/arch/avr32/configs/atstk1003_defconfig b/arch/avr32/configs/atstk1003_defconfig
index 956f2819ad4..57a79df2ce5 100644
--- a/arch/avr32/configs/atstk1003_defconfig
+++ b/arch/avr32/configs/atstk1003_defconfig
@@ -105,7 +105,7 @@ CONFIG_USB_GADGET=y
105CONFIG_USB_ZERO=m 105CONFIG_USB_ZERO=m
106CONFIG_USB_ETH=m 106CONFIG_USB_ETH=m
107CONFIG_USB_GADGETFS=m 107CONFIG_USB_GADGETFS=m
108CONFIG_USB_FILE_STORAGE=m 108CONFIG_USB_MASS_STORAGE=m
109CONFIG_USB_G_SERIAL=m 109CONFIG_USB_G_SERIAL=m
110CONFIG_USB_CDC_COMPOSITE=m 110CONFIG_USB_CDC_COMPOSITE=m
111CONFIG_MMC=y 111CONFIG_MMC=y
diff --git a/arch/avr32/configs/atstk1004_defconfig b/arch/avr32/configs/atstk1004_defconfig
index 40c69f38c61..1a49bd8c634 100644
--- a/arch/avr32/configs/atstk1004_defconfig
+++ b/arch/avr32/configs/atstk1004_defconfig
@@ -104,7 +104,7 @@ CONFIG_USB_GADGET=y
104CONFIG_USB_ZERO=m 104CONFIG_USB_ZERO=m
105CONFIG_USB_ETH=m 105CONFIG_USB_ETH=m
106CONFIG_USB_GADGETFS=m 106CONFIG_USB_GADGETFS=m
107CONFIG_USB_FILE_STORAGE=m 107CONFIG_USB_MASS_STORAGE=m
108CONFIG_USB_G_SERIAL=m 108CONFIG_USB_G_SERIAL=m
109CONFIG_USB_CDC_COMPOSITE=m 109CONFIG_USB_CDC_COMPOSITE=m
110CONFIG_MMC=y 110CONFIG_MMC=y
diff --git a/arch/avr32/configs/atstk1006_defconfig b/arch/avr32/configs/atstk1006_defconfig
index 511eb8af356..206a1b67f76 100644
--- a/arch/avr32/configs/atstk1006_defconfig
+++ b/arch/avr32/configs/atstk1006_defconfig
@@ -129,7 +129,7 @@ CONFIG_USB_GADGET=y
129CONFIG_USB_ZERO=m 129CONFIG_USB_ZERO=m
130CONFIG_USB_ETH=m 130CONFIG_USB_ETH=m
131CONFIG_USB_GADGETFS=m 131CONFIG_USB_GADGETFS=m
132CONFIG_USB_FILE_STORAGE=m 132CONFIG_USB_MASS_STORAGE=m
133CONFIG_USB_G_SERIAL=m 133CONFIG_USB_G_SERIAL=m
134CONFIG_USB_CDC_COMPOSITE=m 134CONFIG_USB_CDC_COMPOSITE=m
135CONFIG_MMC=y 135CONFIG_MMC=y
diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig
index 19973b06170..0421498d666 100644
--- a/arch/avr32/configs/favr-32_defconfig
+++ b/arch/avr32/configs/favr-32_defconfig
@@ -117,7 +117,7 @@ CONFIG_USB_GADGET=y
117CONFIG_USB_ZERO=m 117CONFIG_USB_ZERO=m
118CONFIG_USB_ETH=m 118CONFIG_USB_ETH=m
119CONFIG_USB_GADGETFS=m 119CONFIG_USB_GADGETFS=m
120CONFIG_USB_FILE_STORAGE=m 120CONFIG_USB_MASS_STORAGE=m
121CONFIG_USB_G_SERIAL=m 121CONFIG_USB_G_SERIAL=m
122CONFIG_USB_CDC_COMPOSITE=m 122CONFIG_USB_CDC_COMPOSITE=m
123CONFIG_MMC=y 123CONFIG_MMC=y
diff --git a/arch/avr32/configs/hammerhead_defconfig b/arch/avr32/configs/hammerhead_defconfig
index 6f45681196d..82f24eb251b 100644
--- a/arch/avr32/configs/hammerhead_defconfig
+++ b/arch/avr32/configs/hammerhead_defconfig
@@ -127,7 +127,7 @@ CONFIG_USB_GADGET=y
127CONFIG_USB_ZERO=m 127CONFIG_USB_ZERO=m
128CONFIG_USB_ETH=m 128CONFIG_USB_ETH=m
129CONFIG_USB_GADGETFS=m 129CONFIG_USB_GADGETFS=m
130CONFIG_USB_FILE_STORAGE=m 130CONFIG_USB_MASS_STORAGE=m
131CONFIG_USB_G_SERIAL=m 131CONFIG_USB_G_SERIAL=m
132CONFIG_MMC=m 132CONFIG_MMC=m
133CONFIG_MMC_ATMELMCI=m 133CONFIG_MMC_ATMELMCI=m
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 4807ded352c..4dd4f78d3dc 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,3 +1,4 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += trace_clock.h
diff --git a/arch/avr32/include/asm/mach/serial_at91.h b/arch/avr32/include/asm/mach/serial_at91.h
deleted file mode 100644
index 55b317a8906..00000000000
--- a/arch/avr32/include/asm/mach/serial_at91.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * linux/include/asm-arm/mach/serial_at91.h
3 *
4 * Based on serial_sa1100.h by Nicolas Pitre
5 *
6 * Copyright (C) 2002 ATMEL Rousset
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12
13/*
14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot.
16 */
17struct atmel_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23 int (*open)(struct uart_port *);
24 void (*close)(struct uart_port *);
25};
26
27#if defined(CONFIG_SERIAL_ATMEL)
28void atmel_register_uart_fns(struct atmel_port_fns *fns);
29#else
30#define atmel_register_uart_fns(fns) do { } while (0)
31#endif
32
33
diff --git a/arch/avr32/include/asm/processor.h b/arch/avr32/include/asm/processor.h
index 87d8baccc60..48d71c5c898 100644
--- a/arch/avr32/include/asm/processor.h
+++ b/arch/avr32/include/asm/processor.h
@@ -142,9 +142,6 @@ struct task_struct;
142/* Free all resources held by a thread */ 142/* Free all resources held by a thread */
143extern void release_thread(struct task_struct *); 143extern void release_thread(struct task_struct *);
144 144
145/* Create a kernel thread without removing it from tasklists */
146extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
147
148/* Return saved PC of a blocked thread */ 145/* Return saved PC of a blocked thread */
149#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) 146#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc)
150 147
diff --git a/arch/avr32/include/asm/signal.h b/arch/avr32/include/asm/signal.h
index 4d502fd6bad..9326d182e9e 100644
--- a/arch/avr32/include/asm/signal.h
+++ b/arch/avr32/include/asm/signal.h
@@ -37,6 +37,4 @@ struct k_sigaction {
37#include <asm/sigcontext.h> 37#include <asm/sigcontext.h>
38#undef __HAVE_ARCH_SIG_BITOPS 38#undef __HAVE_ARCH_SIG_BITOPS
39 39
40#define ptrace_signal_deliver(regs, cookie) do { } while (0)
41
42#endif 40#endif
diff --git a/arch/avr32/include/asm/unistd.h b/arch/avr32/include/asm/unistd.h
index 157b4bd3d5e..f05a9804e8e 100644
--- a/arch/avr32/include/asm/unistd.h
+++ b/arch/avr32/include/asm/unistd.h
@@ -39,6 +39,10 @@
39#define __ARCH_WANT_SYS_GETPGRP 39#define __ARCH_WANT_SYS_GETPGRP
40#define __ARCH_WANT_SYS_RT_SIGACTION 40#define __ARCH_WANT_SYS_RT_SIGACTION
41#define __ARCH_WANT_SYS_RT_SIGSUSPEND 41#define __ARCH_WANT_SYS_RT_SIGSUSPEND
42#define __ARCH_WANT_SYS_EXECVE
43#define __ARCH_WANT_SYS_FORK
44#define __ARCH_WANT_SYS_VFORK
45#define __ARCH_WANT_SYS_CLONE
42 46
43/* 47/*
44 * "Conditional" syscalls 48 * "Conditional" syscalls
diff --git a/arch/avr32/include/uapi/asm/socket.h b/arch/avr32/include/uapi/asm/socket.h
index a473f8c6a9a..486df68abee 100644
--- a/arch/avr32/include/uapi/asm/socket.h
+++ b/arch/avr32/include/uapi/asm/socket.h
@@ -40,6 +40,7 @@
40/* Socket filtering */ 40/* Socket filtering */
41#define SO_ATTACH_FILTER 26 41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27 42#define SO_DETACH_FILTER 27
43#define SO_GET_FILTER SO_ATTACH_FILTER
43 44
44#define SO_PEERNAME 28 45#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29 46#define SO_TIMESTAMP 29
diff --git a/arch/avr32/kernel/Makefile b/arch/avr32/kernel/Makefile
index 9e2c465ef3a..119a2e41def 100644
--- a/arch/avr32/kernel/Makefile
+++ b/arch/avr32/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := head.o vmlinux.lds
7obj-$(CONFIG_SUBARCH_AVR32B) += entry-avr32b.o 7obj-$(CONFIG_SUBARCH_AVR32B) += entry-avr32b.o
8obj-y += syscall_table.o syscall-stubs.o irq.o 8obj-y += syscall_table.o syscall-stubs.o irq.o
9obj-y += setup.o traps.o ocd.o ptrace.o 9obj-y += setup.o traps.o ocd.o ptrace.o
10obj-y += signal.o sys_avr32.o process.o time.o 10obj-y += signal.o process.o time.o
11obj-y += switch_to.o cpu.o 11obj-y += switch_to.o cpu.o
12obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o 12obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o
13obj-$(CONFIG_KPROBES) += kprobes.o 13obj-$(CONFIG_KPROBES) += kprobes.o
diff --git a/arch/avr32/kernel/entry-avr32b.S b/arch/avr32/kernel/entry-avr32b.S
index df288418131..9899d3cc6f0 100644
--- a/arch/avr32/kernel/entry-avr32b.S
+++ b/arch/avr32/kernel/entry-avr32b.S
@@ -251,13 +251,15 @@ syscall_badsys:
251 .global ret_from_fork 251 .global ret_from_fork
252ret_from_fork: 252ret_from_fork:
253 call schedule_tail 253 call schedule_tail
254 mov r12, 0
255 rjmp syscall_return
254 256
255 /* check for syscall tracing */ 257 .global ret_from_kernel_thread
256 get_thread_info r0 258ret_from_kernel_thread:
257 ld.w r1, r0[TI_flags] 259 call schedule_tail
258 andl r1, _TIF_ALLWORK_MASK, COH 260 mov r12, r0
259 brne syscall_exit_work 261 mov lr, r2 /* syscall_return */
260 rjmp syscall_exit_cont 262 mov pc, r1
261 263
262syscall_trace_enter: 264syscall_trace_enter:
263 pushm r8-r12 265 pushm r8-r12
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 1bb0a8abd79..fd78f58ea79 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -69,44 +69,6 @@ void machine_restart(char *cmd)
69} 69}
70 70
71/* 71/*
72 * PC is actually discarded when returning from a system call -- the
73 * return address must be stored in LR. This function will make sure
74 * LR points to do_exit before starting the thread.
75 *
76 * Also, when returning from fork(), r12 is 0, so we must copy the
77 * argument as well.
78 *
79 * r0 : The argument to the main thread function
80 * r1 : The address of do_exit
81 * r2 : The address of the main thread function
82 */
83asmlinkage extern void kernel_thread_helper(void);
84__asm__(" .type kernel_thread_helper, @function\n"
85 "kernel_thread_helper:\n"
86 " mov r12, r0\n"
87 " mov lr, r2\n"
88 " mov pc, r1\n"
89 " .size kernel_thread_helper, . - kernel_thread_helper");
90
91int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
92{
93 struct pt_regs regs;
94
95 memset(&regs, 0, sizeof(regs));
96
97 regs.r0 = (unsigned long)arg;
98 regs.r1 = (unsigned long)fn;
99 regs.r2 = (unsigned long)do_exit;
100 regs.lr = (unsigned long)kernel_thread_helper;
101 regs.pc = (unsigned long)kernel_thread_helper;
102 regs.sr = MODE_SUPERVISOR;
103
104 return do_fork(flags | CLONE_VM | CLONE_UNTRACED,
105 0, &regs, 0, NULL, NULL);
106}
107EXPORT_SYMBOL(kernel_thread);
108
109/*
110 * Free current thread data structures etc 72 * Free current thread data structures etc
111 */ 73 */
112void exit_thread(void) 74void exit_thread(void)
@@ -332,26 +294,32 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
332} 294}
333 295
334asmlinkage void ret_from_fork(void); 296asmlinkage void ret_from_fork(void);
297asmlinkage void ret_from_kernel_thread(void);
298asmlinkage void syscall_return(void);
335 299
336int copy_thread(unsigned long clone_flags, unsigned long usp, 300int copy_thread(unsigned long clone_flags, unsigned long usp,
337 unsigned long unused, 301 unsigned long arg,
338 struct task_struct *p, struct pt_regs *regs) 302 struct task_struct *p)
339{ 303{
340 struct pt_regs *childregs; 304 struct pt_regs *childregs = task_pt_regs(p);
341 305
342 childregs = ((struct pt_regs *)(THREAD_SIZE + (unsigned long)task_stack_page(p))) - 1; 306 if (unlikely(p->flags & PF_KTHREAD)) {
343 *childregs = *regs; 307 memset(childregs, 0, sizeof(struct pt_regs));
344 308 p->thread.cpu_context.r0 = arg;
345 if (user_mode(regs)) 309 p->thread.cpu_context.r1 = usp; /* fn */
346 childregs->sp = usp; 310 p->thread.cpu_context.r2 = syscall_return;
347 else 311 p->thread.cpu_context.pc = (unsigned long)ret_from_kernel_thread;
348 childregs->sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; 312 childregs->sr = MODE_SUPERVISOR;
349 313 } else {
350 childregs->r12 = 0; /* Set return value for child */ 314 *childregs = *current_pt_regs();
315 if (usp)
316 childregs->sp = usp;
317 childregs->r12 = 0; /* Set return value for child */
318 p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
319 }
351 320
352 p->thread.cpu_context.sr = MODE_SUPERVISOR | SR_GM; 321 p->thread.cpu_context.sr = MODE_SUPERVISOR | SR_GM;
353 p->thread.cpu_context.ksp = (unsigned long)childregs; 322 p->thread.cpu_context.ksp = (unsigned long)childregs;
354 p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
355 323
356 clear_tsk_thread_flag(p, TIF_DEBUG); 324 clear_tsk_thread_flag(p, TIF_DEBUG);
357 if ((clone_flags & CLONE_PTRACE) && test_thread_flag(TIF_DEBUG)) 325 if ((clone_flags & CLONE_PTRACE) && test_thread_flag(TIF_DEBUG))
@@ -360,49 +328,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
360 return 0; 328 return 0;
361} 329}
362 330
363/* r12-r8 are dummy parameters to force the compiler to use the stack */
364asmlinkage int sys_fork(struct pt_regs *regs)
365{
366 return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
367}
368
369asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
370 void __user *parent_tidptr, void __user *child_tidptr,
371 struct pt_regs *regs)
372{
373 if (!newsp)
374 newsp = regs->sp;
375 return do_fork(clone_flags, newsp, regs, 0, parent_tidptr,
376 child_tidptr);
377}
378
379asmlinkage int sys_vfork(struct pt_regs *regs)
380{
381 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->sp, regs,
382 0, NULL, NULL);
383}
384
385asmlinkage int sys_execve(const char __user *ufilename,
386 const char __user *const __user *uargv,
387 const char __user *const __user *uenvp,
388 struct pt_regs *regs)
389{
390 int error;
391 struct filename *filename;
392
393 filename = getname(ufilename);
394 error = PTR_ERR(filename);
395 if (IS_ERR(filename))
396 goto out;
397
398 error = do_execve(filename->name, uargv, uenvp, regs);
399 putname(filename);
400
401out:
402 return error;
403}
404
405
406/* 331/*
407 * This function is supposed to answer the question "who called 332 * This function is supposed to answer the question "who called
408 * schedule()?" 333 * schedule()?"
diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c
deleted file mode 100644
index 62635a09ae3..00000000000
--- a/arch/avr32/kernel/sys_avr32.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#include <linux/unistd.h>
9
10int kernel_execve(const char *file,
11 const char *const *argv,
12 const char *const *envp)
13{
14 register long scno asm("r8") = __NR_execve;
15 register long sc1 asm("r12") = (long)file;
16 register long sc2 asm("r11") = (long)argv;
17 register long sc3 asm("r10") = (long)envp;
18
19 asm volatile("scall"
20 : "=r"(sc1)
21 : "r"(scno), "0"(sc1), "r"(sc2), "r"(sc3)
22 : "cc", "memory");
23 return sc1;
24}
diff --git a/arch/avr32/kernel/syscall-stubs.S b/arch/avr32/kernel/syscall-stubs.S
index 0447a3e2ba6..275aab9731f 100644
--- a/arch/avr32/kernel/syscall-stubs.S
+++ b/arch/avr32/kernel/syscall-stubs.S
@@ -32,30 +32,6 @@ __sys_rt_sigreturn:
32 mov r12, sp 32 mov r12, sp
33 rjmp sys_rt_sigreturn 33 rjmp sys_rt_sigreturn
34 34
35 .global __sys_fork
36 .type __sys_fork,@function
37__sys_fork:
38 mov r12, sp
39 rjmp sys_fork
40
41 .global __sys_clone
42 .type __sys_clone,@function
43__sys_clone:
44 mov r8, sp
45 rjmp sys_clone
46
47 .global __sys_vfork
48 .type __sys_vfork,@function
49__sys_vfork:
50 mov r12, sp
51 rjmp sys_vfork
52
53 .global __sys_execve
54 .type __sys_execve,@function
55__sys_execve:
56 mov r9, sp
57 rjmp sys_execve
58
59 .global __sys_mmap2 35 .global __sys_mmap2
60 .type __sys_mmap2,@function 36 .type __sys_mmap2,@function
61__sys_mmap2: 37__sys_mmap2:
diff --git a/arch/avr32/kernel/syscall_table.S b/arch/avr32/kernel/syscall_table.S
index 6eba53530d1..f27bb878da6 100644
--- a/arch/avr32/kernel/syscall_table.S
+++ b/arch/avr32/kernel/syscall_table.S
@@ -15,7 +15,7 @@
15sys_call_table: 15sys_call_table:
16 .long sys_restart_syscall 16 .long sys_restart_syscall
17 .long sys_exit 17 .long sys_exit
18 .long __sys_fork 18 .long sys_fork
19 .long sys_read 19 .long sys_read
20 .long sys_write 20 .long sys_write
21 .long sys_open /* 5 */ 21 .long sys_open /* 5 */
@@ -24,7 +24,7 @@ sys_call_table:
24 .long sys_creat 24 .long sys_creat
25 .long sys_link 25 .long sys_link
26 .long sys_unlink /* 10 */ 26 .long sys_unlink /* 10 */
27 .long __sys_execve 27 .long sys_execve
28 .long sys_chdir 28 .long sys_chdir
29 .long sys_time 29 .long sys_time
30 .long sys_mknod 30 .long sys_mknod
@@ -57,7 +57,7 @@ sys_call_table:
57 .long sys_dup 57 .long sys_dup
58 .long sys_pipe 58 .long sys_pipe
59 .long sys_times 59 .long sys_times
60 .long __sys_clone 60 .long sys_clone
61 .long sys_brk /* 45 */ 61 .long sys_brk /* 45 */
62 .long sys_setgid 62 .long sys_setgid
63 .long sys_getgid 63 .long sys_getgid
@@ -127,7 +127,7 @@ sys_call_table:
127 .long sys_newuname 127 .long sys_newuname
128 .long sys_adjtimex 128 .long sys_adjtimex
129 .long sys_mprotect 129 .long sys_mprotect
130 .long __sys_vfork 130 .long sys_vfork
131 .long sys_init_module /* 115 */ 131 .long sys_init_module /* 115 */
132 .long sys_delete_module 132 .long sys_delete_module
133 .long sys_quotactl 133 .long sys_quotactl
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index 70742ec997f..d485b039135 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -26,7 +26,6 @@ static inline void __deprecated at32_add_system_devices(void)
26 26
27} 27}
28 28
29#define ATMEL_MAX_UART 4
30extern struct platform_device *atmel_default_console_device; 29extern struct platform_device *atmel_default_console_device;
31 30
32/* Flags for selecting USART extra pins */ 31/* Flags for selecting USART extra pins */
@@ -34,13 +33,6 @@ extern struct platform_device *atmel_default_console_device;
34#define ATMEL_USART_CTS 0x02 33#define ATMEL_USART_CTS 0x02
35#define ATMEL_USART_CLK 0x04 34#define ATMEL_USART_CLK 0x04
36 35
37struct atmel_uart_data {
38 int num; /* port num */
39 short use_dma_tx; /* use transmit DMA? */
40 short use_dma_rx; /* use receive DMA? */
41 void __iomem *regs; /* virtual base address, if any */
42 struct serial_rs485 rs485; /* rs485 settings */
43};
44void at32_map_usart(unsigned int hw_id, unsigned int line, int flags); 36void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
45struct platform_device *at32_add_device_usart(unsigned int id); 37struct platform_device *at32_add_device_usart(unsigned int id);
46 38
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index b6f3ad5441c..ab9ff4075f4 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -45,6 +45,8 @@ config BLACKFIN
45 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS 45 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
46 select HAVE_MOD_ARCH_SPECIFIC 46 select HAVE_MOD_ARCH_SPECIFIC
47 select MODULES_USE_ELF_RELA 47 select MODULES_USE_ELF_RELA
48 select GENERIC_KERNEL_THREAD
49 select GENERIC_KERNEL_EXECVE
48 50
49config GENERIC_CSUM 51config GENERIC_CSUM
50 def_bool y 52 def_bool y
diff --git a/arch/blackfin/configs/CM-BF527_defconfig b/arch/blackfin/configs/CM-BF527_defconfig
index c280a50e794..f59c80ee78e 100644
--- a/arch/blackfin/configs/CM-BF527_defconfig
+++ b/arch/blackfin/configs/CM-BF527_defconfig
@@ -106,7 +106,7 @@ CONFIG_MUSB_PIO_ONLY=y
106CONFIG_USB_STORAGE=m 106CONFIG_USB_STORAGE=m
107CONFIG_USB_GADGET=m 107CONFIG_USB_GADGET=m
108CONFIG_USB_ETH=m 108CONFIG_USB_ETH=m
109CONFIG_USB_FILE_STORAGE=m 109CONFIG_USB_MASS_STORAGE=m
110CONFIG_USB_G_SERIAL=m 110CONFIG_USB_G_SERIAL=m
111CONFIG_USB_G_PRINTER=m 111CONFIG_USB_G_PRINTER=m
112CONFIG_RTC_CLASS=y 112CONFIG_RTC_CLASS=y
diff --git a/arch/blackfin/configs/CM-BF548_defconfig b/arch/blackfin/configs/CM-BF548_defconfig
index 349922be01f..e961483f187 100644
--- a/arch/blackfin/configs/CM-BF548_defconfig
+++ b/arch/blackfin/configs/CM-BF548_defconfig
@@ -107,7 +107,7 @@ CONFIG_USB_ZERO=m
107CONFIG_USB_ETH=m 107CONFIG_USB_ETH=m
108# CONFIG_USB_ETH_RNDIS is not set 108# CONFIG_USB_ETH_RNDIS is not set
109CONFIG_USB_GADGETFS=m 109CONFIG_USB_GADGETFS=m
110CONFIG_USB_FILE_STORAGE=m 110CONFIG_USB_MASS_STORAGE=m
111CONFIG_USB_G_SERIAL=m 111CONFIG_USB_G_SERIAL=m
112CONFIG_USB_G_PRINTER=m 112CONFIG_USB_G_PRINTER=m
113CONFIG_MMC=m 113CONFIG_MMC=m
diff --git a/arch/blackfin/configs/CM-BF561_defconfig b/arch/blackfin/configs/CM-BF561_defconfig
index 0456deaa2d6..24936b91a6e 100644
--- a/arch/blackfin/configs/CM-BF561_defconfig
+++ b/arch/blackfin/configs/CM-BF561_defconfig
@@ -83,7 +83,7 @@ CONFIG_GPIOLIB=y
83CONFIG_GPIO_SYSFS=y 83CONFIG_GPIO_SYSFS=y
84CONFIG_USB_GADGET=m 84CONFIG_USB_GADGET=m
85CONFIG_USB_ETH=m 85CONFIG_USB_ETH=m
86CONFIG_USB_FILE_STORAGE=m 86CONFIG_USB_MASS_STORAGE=m
87CONFIG_USB_G_SERIAL=m 87CONFIG_USB_G_SERIAL=m
88CONFIG_USB_G_PRINTER=m 88CONFIG_USB_G_PRINTER=m
89CONFIG_MMC=y 89CONFIG_MMC=y
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index 5a0625aad6a..27d70759474 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -38,6 +38,7 @@ generic-y += statfs.h
38generic-y += termbits.h 38generic-y += termbits.h
39generic-y += termios.h 39generic-y += termios.h
40generic-y += topology.h 40generic-y += topology.h
41generic-y += trace_clock.h
41generic-y += types.h 42generic-y += types.h
42generic-y += ucontext.h 43generic-y += ucontext.h
43generic-y += unaligned.h 44generic-y += unaligned.h
diff --git a/arch/blackfin/include/asm/processor.h b/arch/blackfin/include/asm/processor.h
index 4ef7cfe43ce..d0e72e9475a 100644
--- a/arch/blackfin/include/asm/processor.h
+++ b/arch/blackfin/include/asm/processor.h
@@ -75,8 +75,6 @@ static inline void release_thread(struct task_struct *dead_task)
75{ 75{
76} 76}
77 77
78extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
79
80/* 78/*
81 * Free current thread data structures etc.. 79 * Free current thread data structures etc..
82 */ 80 */
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index 5b2a0748d7d..460514a1a4e 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -446,6 +446,8 @@
446#define __ARCH_WANT_SYS_NICE 446#define __ARCH_WANT_SYS_NICE
447#define __ARCH_WANT_SYS_RT_SIGACTION 447#define __ARCH_WANT_SYS_RT_SIGACTION
448#define __ARCH_WANT_SYS_RT_SIGSUSPEND 448#define __ARCH_WANT_SYS_RT_SIGSUSPEND
449#define __ARCH_WANT_SYS_EXECVE
450#define __ARCH_WANT_SYS_VFORK
449 451
450/* 452/*
451 * "Conditional" syscalls 453 * "Conditional" syscalls
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S
index f33792cc1a0..4071265fc4f 100644
--- a/arch/blackfin/kernel/entry.S
+++ b/arch/blackfin/kernel/entry.S
@@ -46,53 +46,14 @@ ENTRY(_ret_from_fork)
46 SP += -12; 46 SP += -12;
47 pseudo_long_call _schedule_tail, p5; 47 pseudo_long_call _schedule_tail, p5;
48 SP += 12; 48 SP += 12;
49 r0 = [sp + PT_IPEND]; 49 p1 = [sp++];
50 cc = bittst(r0,1); 50 r0 = [sp++];
51 if cc jump .Lin_kernel; 51 cc = p1 == 0;
52 if cc jump .Lfork;
53 sp += -12;
54 call (p1);
55 sp += 12;
56.Lfork:
52 RESTORE_CONTEXT 57 RESTORE_CONTEXT
53 rti; 58 rti;
54.Lin_kernel:
55 bitclr(r0,1);
56 [sp + PT_IPEND] = r0;
57 /* do a 'fake' RTI by jumping to [RETI]
58 * to avoid clearing supervisor mode in child
59 */
60 r0 = [sp + PT_PC];
61 [sp + PT_P0] = r0;
62
63 RESTORE_ALL_SYS
64 jump (p0);
65ENDPROC(_ret_from_fork) 59ENDPROC(_ret_from_fork)
66
67ENTRY(_sys_vfork)
68 r0 = sp;
69 r0 += 24;
70 [--sp] = rets;
71 SP += -12;
72 pseudo_long_call _bfin_vfork, p2;
73 SP += 12;
74 rets = [sp++];
75 rts;
76ENDPROC(_sys_vfork)
77
78ENTRY(_sys_clone)
79 r0 = sp;
80 r0 += 24;
81 [--sp] = rets;
82 SP += -12;
83 pseudo_long_call _bfin_clone, p2;
84 SP += 12;
85 rets = [sp++];
86 rts;
87ENDPROC(_sys_clone)
88
89ENTRY(_sys_rt_sigreturn)
90 r0 = sp;
91 r0 += 24;
92 [--sp] = rets;
93 SP += -12;
94 pseudo_long_call _do_rt_sigreturn, p2;
95 SP += 12;
96 rets = [sp++];
97 rts;
98ENDPROC(_sys_rt_sigreturn)
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index bb1cc721fcf..3e16ad9b0a9 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -102,40 +102,6 @@ void cpu_idle(void)
102} 102}
103 103
104/* 104/*
105 * This gets run with P1 containing the
106 * function to call, and R1 containing
107 * the "args". Note P0 is clobbered on the way here.
108 */
109void kernel_thread_helper(void);
110__asm__(".section .text\n"
111 ".align 4\n"
112 "_kernel_thread_helper:\n\t"
113 "\tsp += -12;\n\t"
114 "\tr0 = r1;\n\t" "\tcall (p1);\n\t" "\tcall _do_exit;\n" ".previous");
115
116/*
117 * Create a kernel thread.
118 */
119pid_t kernel_thread(int (*fn) (void *), void *arg, unsigned long flags)
120{
121 struct pt_regs regs;
122
123 memset(&regs, 0, sizeof(regs));
124
125 regs.r1 = (unsigned long)arg;
126 regs.p1 = (unsigned long)fn;
127 regs.pc = (unsigned long)kernel_thread_helper;
128 regs.orig_p0 = -1;
129 /* Set bit 2 to tell ret_from_fork we should be returning to kernel
130 mode. */
131 regs.ipend = 0x8002;
132 __asm__ __volatile__("%0 = syscfg;":"=da"(regs.syscfg):);
133 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL,
134 NULL);
135}
136EXPORT_SYMBOL(kernel_thread);
137
138/*
139 * Do necessary setup to start up a newly executed thread. 105 * Do necessary setup to start up a newly executed thread.
140 * 106 *
141 * pass the data segment into user programs if it exists, 107 * pass the data segment into user programs if it exists,
@@ -161,70 +127,48 @@ void flush_thread(void)
161{ 127{
162} 128}
163 129
164asmlinkage int bfin_vfork(struct pt_regs *regs) 130asmlinkage int bfin_clone(unsigned long clone_flags, unsigned long newsp)
165{
166 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL,
167 NULL);
168}
169
170asmlinkage int bfin_clone(struct pt_regs *regs)
171{ 131{
172 unsigned long clone_flags;
173 unsigned long newsp;
174
175#ifdef __ARCH_SYNC_CORE_DCACHE 132#ifdef __ARCH_SYNC_CORE_DCACHE
176 if (current->nr_cpus_allowed == num_possible_cpus()) 133 if (current->nr_cpus_allowed == num_possible_cpus())
177 set_cpus_allowed_ptr(current, cpumask_of(smp_processor_id())); 134 set_cpus_allowed_ptr(current, cpumask_of(smp_processor_id()));
178#endif 135#endif
179 136 if (newsp)
180 /* syscall2 puts clone_flags in r0 and usp in r1 */
181 clone_flags = regs->r0;
182 newsp = regs->r1;
183 if (!newsp)
184 newsp = rdusp();
185 else
186 newsp -= 12; 137 newsp -= 12;
187 return do_fork(clone_flags, newsp, regs, 0, NULL, NULL); 138 return do_fork(clone_flags, newsp, 0, NULL, NULL);
188} 139}
189 140
190int 141int
191copy_thread(unsigned long clone_flags, 142copy_thread(unsigned long clone_flags,
192 unsigned long usp, unsigned long topstk, 143 unsigned long usp, unsigned long topstk,
193 struct task_struct *p, struct pt_regs *regs) 144 struct task_struct *p)
194{ 145{
195 struct pt_regs *childregs; 146 struct pt_regs *childregs;
147 unsigned long *v;
196 148
197 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; 149 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
198 *childregs = *regs; 150 v = ((unsigned long *)childregs) - 2;
199 childregs->r0 = 0; 151 if (unlikely(p->flags & PF_KTHREAD)) {
152 memset(childregs, 0, sizeof(struct pt_regs));
153 v[0] = usp;
154 v[1] = topstk;
155 childregs->orig_p0 = -1;
156 childregs->ipend = 0x8000;
157 __asm__ __volatile__("%0 = syscfg;":"=da"(childregs->syscfg):);
158 p->thread.usp = 0;
159 } else {
160 *childregs = *current_pt_regs();
161 childregs->r0 = 0;
162 p->thread.usp = usp ? : rdusp();
163 v[0] = v[1] = 0;
164 }
200 165
201 p->thread.usp = usp; 166 p->thread.ksp = (unsigned long)v;
202 p->thread.ksp = (unsigned long)childregs;
203 p->thread.pc = (unsigned long)ret_from_fork; 167 p->thread.pc = (unsigned long)ret_from_fork;
204 168
205 return 0; 169 return 0;
206} 170}
207 171
208/*
209 * sys_execve() executes a new program.
210 */
211asmlinkage int sys_execve(const char __user *name,
212 const char __user *const __user *argv,
213 const char __user *const __user *envp)
214{
215 int error;
216 struct filename *filename;
217 struct pt_regs *regs = (struct pt_regs *)((&name) + 6);
218
219 filename = getname(name);
220 error = PTR_ERR(filename);
221 if (IS_ERR(filename))
222 return error;
223 error = do_execve(filename->name, argv, envp, regs);
224 putname(filename);
225 return error;
226}
227
228unsigned long get_wchan(struct task_struct *p) 172unsigned long get_wchan(struct task_struct *p)
229{ 173{
230 unsigned long fp, pc; 174 unsigned long fp, pc;
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index 6ed20a1a4af..84b4be05840 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -82,9 +82,9 @@ rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *p
82 return err; 82 return err;
83} 83}
84 84
85asmlinkage int do_rt_sigreturn(unsigned long __unused) 85asmlinkage int sys_rt_sigreturn(void)
86{ 86{
87 struct pt_regs *regs = (struct pt_regs *)__unused; 87 struct pt_regs *regs = current_pt_regs();
88 unsigned long usp = rdusp(); 88 unsigned long usp = rdusp();
89 struct rt_sigframe *frame = (struct rt_sigframe *)(usp); 89 struct rt_sigframe *frame = (struct rt_sigframe *)(usp);
90 sigset_t set; 90 sigset_t set;
diff --git a/arch/blackfin/mach-bf609/Kconfig b/arch/blackfin/mach-bf609/Kconfig
index 101b33ee9bb..95a4f1b676c 100644
--- a/arch/blackfin/mach-bf609/Kconfig
+++ b/arch/blackfin/mach-bf609/Kconfig
@@ -56,7 +56,7 @@ config SEC_IRQ_PRIORITY_LEVELS
56 default 7 56 default 7
57 range 0 7 57 range 0 7
58 help 58 help
59 Devide the total number of interrupt priority levels into sub-levels. 59 Divide the total number of interrupt priority levels into sub-levels.
60 There is 2 ^ (SEC_IRQ_PRIORITY_LEVELS + 1) different levels. 60 There is 2 ^ (SEC_IRQ_PRIORITY_LEVELS + 1) different levels.
61 61
62endmenu 62endmenu
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 1c3d2c5bb0b..86b5a095c5a 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -530,61 +530,6 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
530 jump .Lsyscall_really_exit; 530 jump .Lsyscall_really_exit;
531ENDPROC(_trap) 531ENDPROC(_trap)
532 532
533ENTRY(_kernel_execve)
534 link SIZEOF_PTREGS;
535 p0 = sp;
536 r3 = SIZEOF_PTREGS / 4;
537 r4 = 0(x);
538.Lclear_regs:
539 [p0++] = r4;
540 r3 += -1;
541 cc = r3 == 0;
542 if !cc jump .Lclear_regs (bp);
543
544 p0 = sp;
545 sp += -16;
546 [sp + 12] = p0;
547 pseudo_long_call _do_execve, p5;
548 SP += 16;
549 cc = r0 == 0;
550 if ! cc jump .Lexecve_failed;
551 /* Success. Copy our temporary pt_regs to the top of the kernel
552 * stack and do a normal exception return.
553 */
554 r1 = sp;
555 r0 = (-KERNEL_STACK_SIZE) (x);
556 r1 = r1 & r0;
557 p2 = r1;
558 p3 = [p2];
559 r0 = KERNEL_STACK_SIZE - 4 (z);
560 p1 = r0;
561 p1 = p1 + p2;
562
563 p0 = fp;
564 r4 = [p0--];
565 r3 = SIZEOF_PTREGS / 4;
566.Lcopy_regs:
567 r4 = [p0--];
568 [p1--] = r4;
569 r3 += -1;
570 cc = r3 == 0;
571 if ! cc jump .Lcopy_regs (bp);
572
573 r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
574 p1 = r0;
575 p1 = p1 + p2;
576 sp = p1;
577 r0 = syscfg;
578 [SP + PT_SYSCFG] = r0;
579 [p3 + (TASK_THREAD + THREAD_KSP)] = sp;
580
581 RESTORE_CONTEXT;
582 rti;
583.Lexecve_failed:
584 unlink;
585 rts;
586ENDPROC(_kernel_execve)
587
588ENTRY(_system_call) 533ENTRY(_system_call)
589 /* Store IPEND */ 534 /* Store IPEND */
590 p2.l = lo(IPEND); 535 p2.l = lo(IPEND);
@@ -1486,7 +1431,7 @@ ENTRY(_sys_call_table)
1486 .long _sys_ni_syscall /* old sys_ipc */ 1431 .long _sys_ni_syscall /* old sys_ipc */
1487 .long _sys_fsync 1432 .long _sys_fsync
1488 .long _sys_ni_syscall /* old sys_sigreturn */ 1433 .long _sys_ni_syscall /* old sys_sigreturn */
1489 .long _sys_clone /* 120 */ 1434 .long _bfin_clone /* 120 */
1490 .long _sys_setdomainname 1435 .long _sys_setdomainname
1491 .long _sys_newuname 1436 .long _sys_newuname
1492 .long _sys_ni_syscall /* old sys_modify_ldt */ 1437 .long _sys_ni_syscall /* old sys_modify_ldt */
diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c
index 342e378da1e..1f3b3ef3e10 100644
--- a/arch/blackfin/mm/sram-alloc.c
+++ b/arch/blackfin/mm/sram-alloc.c
@@ -191,7 +191,7 @@ static irqreturn_t l2_ecc_err(int irq, void *dev_id)
191{ 191{
192 int status; 192 int status;
193 193
194 printk(KERN_ERR "L2 ecc error happend\n"); 194 printk(KERN_ERR "L2 ecc error happened\n");
195 status = bfin_read32(L2CTL0_STAT); 195 status = bfin_read32(L2CTL0_STAT);
196 if (status & 0x1) 196 if (status & 0x1)
197 printk(KERN_ERR "Core channel error type:0x%x, addr:0x%x\n", 197 printk(KERN_ERR "Core channel error type:0x%x, addr:0x%x\n",
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index aee1b569ee6..66eab3703c7 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -18,6 +18,7 @@ config C6X
18 select OF_EARLY_FLATTREE 18 select OF_EARLY_FLATTREE
19 select GENERIC_CLOCKEVENTS 19 select GENERIC_CLOCKEVENTS
20 select GENERIC_KERNEL_THREAD 20 select GENERIC_KERNEL_THREAD
21 select GENERIC_KERNEL_EXECVE
21 select MODULES_USE_ELF_RELA 22 select MODULES_USE_ELF_RELA
22 23
23config MMU 24config MMU
diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index a9eb9597e03..e72eb341723 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -41,7 +41,7 @@ DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS)))
41export DTB 41export DTB
42 42
43ifneq ($(DTB),) 43ifneq ($(DTB),)
44core-y += $(boot)/ 44core-y += $(boot)/dts/
45endif 45endif
46 46
47# With make 3.82 we cannot mix normal and wildcard targets 47# With make 3.82 we cannot mix normal and wildcard targets
diff --git a/arch/c6x/boot/Makefile b/arch/c6x/boot/Makefile
index 6891257d514..8734abee548 100644
--- a/arch/c6x/boot/Makefile
+++ b/arch/c6x/boot/Makefile
@@ -6,25 +6,5 @@ OBJCOPYFLAGS_vmlinux.bin := -O binary
6$(obj)/vmlinux.bin: vmlinux FORCE 6$(obj)/vmlinux.bin: vmlinux FORCE
7 $(call if_changed,objcopy) 7 $(call if_changed,objcopy)
8 8
9DTC_FLAGS ?= -p 1024
10
11ifneq ($(DTB),)
12obj-y += linked_dtb.o
13endif
14
15$(obj)/%.dtb: $(src)/dts/%.dts FORCE
16 $(call if_changed_dep,dtc)
17
18quiet_cmd_cp = CP $< $@$2
19 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
20
21# Generate builtin.dtb from $(DTB).dtb
22$(obj)/builtin.dtb: $(obj)/$(DTB).dtb
23 $(call if_changed,cp)
24
25$(obj)/linked_dtb.o: $(obj)/builtin.dtb
26
27$(obj)/dtbImage.%: vmlinux 9$(obj)/dtbImage.%: vmlinux
28 $(call if_changed,objcopy) 10 $(call if_changed,objcopy)
29
30clean-files := $(obj)/*.dtb
diff --git a/arch/c6x/boot/dts/Makefile b/arch/c6x/boot/dts/Makefile
new file mode 100644
index 00000000000..c7528b02d06
--- /dev/null
+++ b/arch/c6x/boot/dts/Makefile
@@ -0,0 +1,20 @@
1#
2# Makefile for device trees
3#
4
5DTC_FLAGS ?= -p 1024
6
7ifneq ($(DTB),)
8obj-y += linked_dtb.o
9endif
10
11quiet_cmd_cp = CP $< $@$2
12 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
13
14# Generate builtin.dtb from $(DTB).dtb
15$(obj)/builtin.dtb: $(obj)/$(DTB).dtb
16 $(call if_changed,cp)
17
18$(obj)/linked_dtb.o: $(obj)/builtin.dtb
19
20clean-files := *.dtb
diff --git a/arch/c6x/boot/dts/linked_dtb.S b/arch/c6x/boot/dts/linked_dtb.S
new file mode 100644
index 00000000000..cf347f1d16c
--- /dev/null
+++ b/arch/c6x/boot/dts/linked_dtb.S
@@ -0,0 +1,2 @@
1.section __fdt_blob,"a"
2.incbin "arch/c6x/boot/dts/builtin.dtb"
diff --git a/arch/c6x/boot/linked_dtb.S b/arch/c6x/boot/linked_dtb.S
deleted file mode 100644
index 57a4454eaec..00000000000
--- a/arch/c6x/boot/linked_dtb.S
+++ /dev/null
@@ -1,2 +0,0 @@
1.section __fdt_blob,"a"
2.incbin "arch/c6x/boot/builtin.dtb"
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index 112a496d835..eae7b5963e8 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -49,6 +49,7 @@ generic-y += termbits.h
49generic-y += termios.h 49generic-y += termios.h
50generic-y += tlbflush.h 50generic-y += tlbflush.h
51generic-y += topology.h 51generic-y += topology.h
52generic-y += trace_clock.h
52generic-y += types.h 53generic-y += types.h
53generic-y += ucontext.h 54generic-y += ucontext.h
54generic-y += user.h 55generic-y += user.h
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
new file mode 100644
index 00000000000..ecead15872a
--- /dev/null
+++ b/arch/c6x/include/asm/setup.h
@@ -0,0 +1,33 @@
1/*
2 * Port on Texas Instruments TMS320C6x architecture
3 *
4 * Copyright (C) 2004, 2009, 2010 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.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#ifndef _ASM_C6X_SETUP_H
12#define _ASM_C6X_SETUP_H
13
14#include <uapi/asm/setup.h>
15
16#ifndef __ASSEMBLY__
17extern char c6x_command_line[COMMAND_LINE_SIZE];
18
19extern int c6x_add_memory(phys_addr_t start, unsigned long size);
20
21extern unsigned long ram_start;
22extern unsigned long ram_end;
23
24extern int c6x_num_cores;
25extern unsigned int c6x_silicon_rev;
26extern unsigned int c6x_devstat;
27extern unsigned char c6x_fuse_mac[6];
28
29extern void machine_init(unsigned long dt_ptr);
30extern void time_init(void);
31
32#endif /* !__ASSEMBLY__ */
33#endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/include/asm/syscalls.h b/arch/c6x/include/asm/syscalls.h
index e7b8991dc07..df3d05feb15 100644
--- a/arch/c6x/include/asm/syscalls.h
+++ b/arch/c6x/include/asm/syscalls.h
@@ -41,10 +41,6 @@ extern long sys_fallocate_c6x(int fd, int mode,
41 u32 len_lo, u32 len_hi); 41 u32 len_lo, u32 len_hi);
42extern int sys_cache_sync(unsigned long s, unsigned long e); 42extern int sys_cache_sync(unsigned long s, unsigned long e);
43 43
44struct pt_regs;
45
46extern asmlinkage long sys_c6x_clone(struct pt_regs *regs);
47
48#include <asm-generic/syscalls.h> 44#include <asm-generic/syscalls.h>
49 45
50#endif /* __ASM_C6X_SYSCALLS_H */ 46#endif /* __ASM_C6X_SYSCALLS_H */
diff --git a/arch/c6x/include/uapi/asm/Kbuild b/arch/c6x/include/uapi/asm/Kbuild
index c312b424c43..e9bc2b2b814 100644
--- a/arch/c6x/include/uapi/asm/Kbuild
+++ b/arch/c6x/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 += kvm_para.h
5
4header-y += byteorder.h 6header-y += byteorder.h
5header-y += kvm_para.h 7header-y += kvm_para.h
6header-y += ptrace.h 8header-y += ptrace.h
diff --git a/arch/c6x/include/uapi/asm/kvm_para.h b/arch/c6x/include/uapi/asm/kvm_para.h
deleted file mode 100644
index 14fab8f0b95..00000000000
--- a/arch/c6x/include/uapi/asm/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kvm_para.h>
diff --git a/arch/c6x/include/uapi/asm/setup.h b/arch/c6x/include/uapi/asm/setup.h
index a01e31896fa..ad9ac97a8da 100644
--- a/arch/c6x/include/uapi/asm/setup.h
+++ b/arch/c6x/include/uapi/asm/setup.h
@@ -1,33 +1,6 @@
1/* 1#ifndef _UAPI_ASM_C6X_SETUP_H
2 * Port on Texas Instruments TMS320C6x architecture 2#define _UAPI_ASM_C6X_SETUP_H
3 *
4 * Copyright (C) 2004, 2009, 2010 2011 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.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#ifndef _ASM_C6X_SETUP_H
12#define _ASM_C6X_SETUP_H
13 3
14#define COMMAND_LINE_SIZE 1024 4#define COMMAND_LINE_SIZE 1024
15 5
16#ifndef __ASSEMBLY__ 6#endif /* _UAPI_ASM_C6X_SETUP_H */
17extern char c6x_command_line[COMMAND_LINE_SIZE];
18
19extern int c6x_add_memory(phys_addr_t start, unsigned long size);
20
21extern unsigned long ram_start;
22extern unsigned long ram_end;
23
24extern int c6x_num_cores;
25extern unsigned int c6x_silicon_rev;
26extern unsigned int c6x_devstat;
27extern unsigned char c6x_fuse_mac[6];
28
29extern void machine_init(unsigned long dt_ptr);
30extern void time_init(void);
31
32#endif /* !__ASSEMBLY__ */
33#endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
index 4ff747d12da..f3987a8703d 100644
--- a/arch/c6x/include/uapi/asm/unistd.h
+++ b/arch/c6x/include/uapi/asm/unistd.h
@@ -14,8 +14,8 @@
14 * more details. 14 * more details.
15 */ 15 */
16 16
17#define __ARCH_WANT_KERNEL_EXECVE
18#define __ARCH_WANT_SYS_EXECVE 17#define __ARCH_WANT_SYS_EXECVE
18#define __ARCH_WANT_SYS_CLONE
19 19
20/* Use the standard ABI for syscalls. */ 20/* Use the standard ABI for syscalls. */
21#include <asm-generic/unistd.h> 21#include <asm-generic/unistd.h>
diff --git a/arch/c6x/kernel/entry.S b/arch/c6x/kernel/entry.S
index 5449c36018f..5239057de4c 100644
--- a/arch/c6x/kernel/entry.S
+++ b/arch/c6x/kernel/entry.S
@@ -277,6 +277,8 @@ work_rescheduled:
277 [A1] BNOP .S1 work_resched,5 277 [A1] BNOP .S1 work_resched,5
278 278
279work_notifysig: 279work_notifysig:
280 ;; enable interrupts for do_notify_resume()
281 UNMASK_INT B2
280 B .S2 do_notify_resume 282 B .S2 do_notify_resume
281 LDW .D2T1 *+SP(REGS__END+8),A6 ; syscall flag 283 LDW .D2T1 *+SP(REGS__END+8),A6 ; syscall flag
282 ADDKPC .S2 resume_userspace,B3,1 284 ADDKPC .S2 resume_userspace,B3,1
@@ -413,22 +415,11 @@ ENTRY(ret_from_kernel_thread)
4130: 4150:
414 B .S2 B10 /* call fn */ 416 B .S2 B10 /* call fn */
415 LDW .D2T1 *+SP(REGS_A1+8),A4 /* get arg */ 417 LDW .D2T1 *+SP(REGS_A1+8),A4 /* get arg */
416 MVKL .S2 sys_exit,B11 418 ADDKPC .S2 ret_from_fork_2,B3,3
417 MVKH .S2 sys_exit,B11
418 ADDKPC .S2 0f,B3,1
4190:
420 BNOP .S2 B11,5 /* jump to sys_exit */
421ENDPROC(ret_from_kernel_thread) 419ENDPROC(ret_from_kernel_thread)
422 420
423ENTRY(ret_from_kernel_execve)
424 GET_THREAD_INFO A12
425 BNOP .S2 syscall_exit,4
426 ADD .D2X A4,-8,SP
427ENDPROC(ret_from_kernel_execve)
428
429 ;; 421 ;;
430 ;; These are the interrupt handlers, responsible for calling __do_IRQ() 422 ;; These are the interrupt handlers, responsible for calling c6x_do_IRQ()
431 ;; int6 is used for syscalls (see _system_call entry)
432 ;; 423 ;;
433 .macro SAVE_ALL_INT 424 .macro SAVE_ALL_INT
434 SAVE_ALL IRP,ITSR 425 SAVE_ALL IRP,ITSR
@@ -623,18 +614,6 @@ ENDPROC(sys_sigaltstack)
623 ;; Special system calls 614 ;; Special system calls
624 ;; return address is in B3 615 ;; return address is in B3
625 ;; 616 ;;
626ENTRY(sys_clone)
627 ADD .D1X SP,8,A4
628#ifdef CONFIG_C6X_BIG_KERNEL
629 || MVKL .S1 sys_c6x_clone,A0
630 MVKH .S1 sys_c6x_clone,A0
631 BNOP .S2X A0,5
632#else
633 || B .S2 sys_c6x_clone
634 NOP 5
635#endif
636ENDPROC(sys_clone)
637
638ENTRY(sys_rt_sigreturn) 617ENTRY(sys_rt_sigreturn)
639 ADD .D1X SP,8,A4 618 ADD .D1X SP,8,A4
640#ifdef CONFIG_C6X_BIG_KERNEL 619#ifdef CONFIG_C6X_BIG_KERNEL
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 2770d9a9a84..6434df476f7 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -112,22 +112,6 @@ void exit_thread(void)
112{ 112{
113} 113}
114 114
115SYSCALL_DEFINE1(c6x_clone, struct pt_regs *, regs)
116{
117 unsigned long clone_flags;
118 unsigned long newsp;
119
120 /* syscall puts clone_flags in A4 and usp in B4 */
121 clone_flags = regs->orig_a4;
122 if (regs->b4)
123 newsp = regs->b4;
124 else
125 newsp = regs->sp;
126
127 return do_fork(clone_flags, newsp, regs, 0, (int __user *)regs->a6,
128 (int __user *)regs->b6);
129}
130
131/* 115/*
132 * Do necessary setup to start up a newly executed thread. 116 * Do necessary setup to start up a newly executed thread.
133 */ 117 */
@@ -155,13 +139,13 @@ void start_thread(struct pt_regs *regs, unsigned int pc, unsigned long usp)
155 */ 139 */
156int copy_thread(unsigned long clone_flags, unsigned long usp, 140int copy_thread(unsigned long clone_flags, unsigned long usp,
157 unsigned long ustk_size, 141 unsigned long ustk_size,
158 struct task_struct *p, struct pt_regs *regs) 142 struct task_struct *p)
159{ 143{
160 struct pt_regs *childregs; 144 struct pt_regs *childregs;
161 145
162 childregs = task_pt_regs(p); 146 childregs = task_pt_regs(p);
163 147
164 if (!regs) { 148 if (unlikely(p->flags & PF_KTHREAD)) {
165 /* case of __kernel_thread: we return to supervisor space */ 149 /* case of __kernel_thread: we return to supervisor space */
166 memset(childregs, 0, sizeof(struct pt_regs)); 150 memset(childregs, 0, sizeof(struct pt_regs));
167 childregs->sp = (unsigned long)(childregs + 1); 151 childregs->sp = (unsigned long)(childregs + 1);
@@ -170,8 +154,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
170 childregs->a1 = ustk_size; /* argument */ 154 childregs->a1 = ustk_size; /* argument */
171 } else { 155 } else {
172 /* Otherwise use the given stack */ 156 /* Otherwise use the given stack */
173 *childregs = *regs; 157 *childregs = *current_pt_regs();
174 childregs->sp = usp; 158 if (usp)
159 childregs->sp = usp;
175 p->thread.pc = (unsigned long) ret_from_fork; 160 p->thread.pc = (unsigned long) ret_from_fork;
176 } 161 }
177 162
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index a67244473a3..0cac6a49f23 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -49,6 +49,9 @@ config CRIS
49 select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32 49 select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32
50 select GENERIC_CMOS_UPDATE 50 select GENERIC_CMOS_UPDATE
51 select MODULES_USE_ELF_RELA 51 select MODULES_USE_ELF_RELA
52 select GENERIC_KERNEL_THREAD
53 select GENERIC_KERNEL_EXECVE
54 select CLONE_BACKWARDS2
52 55
53config HZ 56config HZ
54 int 57 int
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 592fbe9dfb6..897bba67bf7 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -35,6 +35,7 @@
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
38 .globl ret_from_kernel_thread
38 .globl resume 39 .globl resume
39 .globl multiple_interrupt 40 .globl multiple_interrupt
40 .globl hwbreakpoint 41 .globl hwbreakpoint
@@ -81,7 +82,14 @@ ret_from_fork:
81 jsr schedule_tail 82 jsr schedule_tail
82 ba ret_from_sys_call 83 ba ret_from_sys_call
83 nop 84 nop
84 85
86ret_from_kernel_thread:
87 jsr schedule_tail
88 move.d $r2, $r10 ; argument is here
89 jsr $r1 ; call the payload
90 moveq 0, $r9 ; no syscall restarts, TYVM...
91 ba ret_from_sys_call
92
85ret_from_intr: 93ret_from_intr:
86 ;; 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
87 ;; this test matches the user_regs(regs) macro 95 ;; this test matches the user_regs(regs) macro
@@ -586,13 +594,6 @@ _ugdb_handle_breakpoint:
586 ba do_sigtrap ; SIGTRAP the offending process. 594 ba do_sigtrap ; SIGTRAP the offending process.
587 pop $dccr ; Restore dccr in delay slot. 595 pop $dccr ; Restore dccr in delay slot.
588 596
589 .global kernel_execve
590kernel_execve:
591 move.d __NR_execve, $r9
592 break 13
593 ret
594 nop
595
596 .data 597 .data
597 598
598hw_bp_trigs: 599hw_bp_trigs:
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index 15ac7150371..b1018750cff 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -17,6 +17,7 @@
17#include <arch/svinto.h> 17#include <arch/svinto.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <arch/system.h> 19#include <arch/system.h>
20#include <linux/ptrace.h>
20 21
21#ifdef CONFIG_ETRAX_GPIO 22#ifdef CONFIG_ETRAX_GPIO
22void etrax_gpio_wake_up_check(void); /* drivers/gpio.c */ 23void etrax_gpio_wake_up_check(void); /* drivers/gpio.c */
@@ -81,31 +82,6 @@ unsigned long thread_saved_pc(struct task_struct *t)
81 return task_pt_regs(t)->irp; 82 return task_pt_regs(t)->irp;
82} 83}
83 84
84static void kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg)
85{
86 fn(arg);
87 do_exit(-1); /* Should never be called, return bad exit value */
88}
89
90/*
91 * Create a kernel thread
92 */
93int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
94{
95 struct pt_regs regs;
96
97 memset(&regs, 0, sizeof(regs));
98
99 /* Don't use r10 since that is set to 0 in copy_thread */
100 regs.r11 = (unsigned long)fn;
101 regs.r12 = (unsigned long)arg;
102 regs.irp = (unsigned long)kernel_thread_helper;
103 regs.dccr = 1 << I_DCCR_BITNR;
104
105 /* Ok, create the new process.. */
106 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
107}
108
109/* setup the child's kernel stack with a pt_regs and switch_stack on it. 85/* setup the child's kernel stack with a pt_regs and switch_stack on it.
110 * it will be un-nested during _resume and _ret_from_sys_call when the 86 * it will be un-nested during _resume and _ret_from_sys_call when the
111 * new thread is scheduled. 87 * new thread is scheduled.
@@ -115,29 +91,34 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
115 * 91 *
116 */ 92 */
117asmlinkage void ret_from_fork(void); 93asmlinkage void ret_from_fork(void);
94asmlinkage void ret_from_kernel_thread(void);
118 95
119int copy_thread(unsigned long clone_flags, unsigned long usp, 96int copy_thread(unsigned long clone_flags, unsigned long usp,
120 unsigned long unused, 97 unsigned long arg, struct task_struct *p)
121 struct task_struct *p, struct pt_regs *regs)
122{ 98{
123 struct pt_regs * childregs; 99 struct pt_regs *childregs = task_pt_regs(p);
124 struct switch_stack *swstack; 100 struct switch_stack *swstack = ((struct switch_stack *)childregs) - 1;
125 101
126 /* put the pt_regs structure at the end of the new kernel stack page and fix it up 102 /* put the pt_regs structure at the end of the new kernel stack page and fix it up
127 * remember that the task_struct doubles as the kernel stack for the task 103 * remember that the task_struct doubles as the kernel stack for the task
128 */ 104 */
129 105
130 childregs = task_pt_regs(p); 106 if (unlikely(p->flags & PF_KTHREAD)) {
131 107 memset(swstack, 0,
132 *childregs = *regs; /* struct copy of pt_regs */ 108 sizeof(struct switch_stack) + sizeof(struct pt_regs));
133 109 swstack->r1 = usp;
134 p->set_child_tid = p->clear_child_tid = NULL; 110 swstack->r2 = arg;
111 childregs->dccr = 1 << I_DCCR_BITNR;
112 swstack->return_ip = (unsigned long) ret_from_kernel_thread;
113 p->thread.ksp = (unsigned long) swstack;
114 p->thread.usp = 0;
115 return 0;
116 }
117 *childregs = *current_pt_regs(); /* struct copy of pt_regs */
135 118
136 childregs->r10 = 0; /* child returns 0 after a fork/clone */ 119 childregs->r10 = 0; /* child returns 0 after a fork/clone */
137
138 /* put the switch stack right below the pt_regs */
139 120
140 swstack = ((struct switch_stack *)childregs) - 1; 121 /* put the switch stack right below the pt_regs */
141 122
142 swstack->r9 = 0; /* parameter to ret_from_sys_call, 0 == dont restart the syscall */ 123 swstack->r9 = 0; /* parameter to ret_from_sys_call, 0 == dont restart the syscall */
143 124
@@ -147,7 +128,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
147 128
148 /* fix the user-mode stackpointer */ 129 /* fix the user-mode stackpointer */
149 130
150 p->thread.usp = usp; 131 p->thread.usp = usp ?: rdusp();
151 132
152 /* and the kernel-mode one */ 133 /* and the kernel-mode one */
153 134
@@ -161,70 +142,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
161 return 0; 142 return 0;
162} 143}
163 144
164/*
165 * Be aware of the "magic" 7th argument in the four system-calls below.
166 * They need the latest stackframe, which is put as the 7th argument by
167 * entry.S. The previous arguments are dummies or actually used, but need
168 * to be defined to reach the 7th argument.
169 *
170 * N.B.: Another method to get the stackframe is to use current_regs(). But
171 * it returns the latest stack-frame stacked when going from _user mode_ and
172 * some of these (at least sys_clone) are called from kernel-mode sometimes
173 * (for example during kernel_thread, above) and thus cannot use it. Thus,
174 * to be sure not to get any surprises, we use the method for the other calls
175 * as well.
176 */
177
178asmlinkage int sys_fork(long r10, long r11, long r12, long r13, long mof, long srp,
179 struct pt_regs *regs)
180{
181 return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
182}
183
184/* if newusp is 0, we just grab the old usp */
185/* FIXME: Is parent_tid/child_tid really third/fourth argument? Update lib? */
186asmlinkage int sys_clone(unsigned long newusp, unsigned long flags,
187 int* parent_tid, int* child_tid, long mof, long srp,
188 struct pt_regs *regs)
189{
190 if (!newusp)
191 newusp = rdusp();
192 return do_fork(flags, newusp, regs, 0, parent_tid, child_tid);
193}
194
195/* vfork is a system call in i386 because of register-pressure - maybe
196 * we can remove it and handle it in libc but we put it here until then.
197 */
198
199asmlinkage int sys_vfork(long r10, long r11, long r12, long r13, long mof, long srp,
200 struct pt_regs *regs)
201{
202 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL);
203}
204
205/*
206 * sys_execve() executes a new program.
207 */
208asmlinkage int sys_execve(const char *fname,
209 const char *const *argv,
210 const char *const *envp,
211 long r13, long mof, long srp,
212 struct pt_regs *regs)
213{
214 int error;
215 struct filename *filename;
216
217 filename = getname(fname);
218 error = PTR_ERR(filename);
219
220 if (IS_ERR(filename))
221 goto out;
222 error = do_execve(filename->name, argv, envp, regs);
223 putname(filename);
224 out:
225 return error;
226}
227
228unsigned long get_wchan(struct task_struct *p) 145unsigned long get_wchan(struct task_struct *p)
229{ 146{
230#if 0 147#if 0
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index c3ea4694fba..faa644111fe 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -31,6 +31,7 @@
31 .globl system_call 31 .globl system_call
32 .globl ret_from_intr 32 .globl ret_from_intr
33 .globl ret_from_fork 33 .globl ret_from_fork
34 .globl ret_from_kernel_thread
34 .globl resume 35 .globl resume
35 .globl multiple_interrupt 36 .globl multiple_interrupt
36 .globl nmi_interrupt 37 .globl nmi_interrupt
@@ -84,6 +85,18 @@ ret_from_fork:
84 nop 85 nop
85 .size ret_from_fork, . - ret_from_fork 86 .size ret_from_fork, . - ret_from_fork
86 87
88 .type ret_from_kernel_thread,@function
89ret_from_kernel_thread:
90 jsr schedule_tail
91 nop
92 move.d $r2, $r10
93 jsr $r1
94 nop
95 moveq 0, $r9 ; no syscall restarts, TYVM...
96 ba ret_from_sys_call
97 nop
98 .size ret_from_kernel_thread, . - ret_from_kernel_thread
99
87 .type ret_from_intr,@function 100 .type ret_from_intr,@function
88ret_from_intr: 101ret_from_intr:
89 ;; Check for resched if preemptive kernel, or if we're going back to 102 ;; Check for resched if preemptive kernel, or if we're going back to
@@ -531,15 +544,6 @@ _ugdb_handle_exception:
531 ba do_sigtrap ; SIGTRAP the offending process. 544 ba do_sigtrap ; SIGTRAP the offending process.
532 move.d [$sp+], $r0 ; Restore R0 in delay slot. 545 move.d [$sp+], $r0 ; Restore R0 in delay slot.
533 546
534 .global kernel_execve
535 .type kernel_execve,@function
536kernel_execve:
537 move.d __NR_execve, $r9
538 break 13
539 ret
540 nop
541 .size kernel_execve, . - kernel_execve
542
543 .data 547 .data
544 548
545 .section .rodata,"a" 549 .section .rodata,"a"
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
index 4e999224635..2b23ef0e445 100644
--- a/arch/cris/arch-v32/kernel/process.c
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -16,6 +16,7 @@
16#include <hwregs/reg_map.h> 16#include <hwregs/reg_map.h>
17#include <hwregs/timer_defs.h> 17#include <hwregs/timer_defs.h>
18#include <hwregs/intr_vect_defs.h> 18#include <hwregs/intr_vect_defs.h>
19#include <linux/ptrace.h>
19 20
20extern void stop_watchdog(void); 21extern void stop_watchdog(void);
21 22
@@ -94,31 +95,6 @@ unsigned long thread_saved_pc(struct task_struct *t)
94 return task_pt_regs(t)->erp; 95 return task_pt_regs(t)->erp;
95} 96}
96 97
97static void
98kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg)
99{
100 fn(arg);
101 do_exit(-1); /* Should never be called, return bad exit value. */
102}
103
104/* Create a kernel thread. */
105int
106kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
107{
108 struct pt_regs regs;
109
110 memset(&regs, 0, sizeof(regs));
111
112 /* Don't use r10 since that is set to 0 in copy_thread. */
113 regs.r11 = (unsigned long) fn;
114 regs.r12 = (unsigned long) arg;
115 regs.erp = (unsigned long) kernel_thread_helper;
116 regs.ccs = 1 << (I_CCS_BITNR + CCS_SHIFT);
117
118 /* Create the new process. */
119 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
120}
121
122/* 98/*
123 * Setup the child's kernel stack with a pt_regs and call switch_stack() on it. 99 * Setup the child's kernel stack with a pt_regs and call switch_stack() on it.
124 * It will be unnested during _resume and _ret_from_sys_call when the new thread 100 * It will be unnested during _resume and _ret_from_sys_call when the new thread
@@ -129,34 +105,42 @@ kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
129 */ 105 */
130 106
131extern asmlinkage void ret_from_fork(void); 107extern asmlinkage void ret_from_fork(void);
108extern asmlinkage void ret_from_kernel_thread(void);
132 109
133int 110int
134copy_thread(unsigned long clone_flags, unsigned long usp, 111copy_thread(unsigned long clone_flags, unsigned long usp,
135 unsigned long unused, 112 unsigned long arg, struct task_struct *p)
136 struct task_struct *p, struct pt_regs *regs)
137{ 113{
138 struct pt_regs *childregs; 114 struct pt_regs *childregs = task_pt_regs(p);
139 struct switch_stack *swstack; 115 struct switch_stack *swstack = ((struct switch_stack *) childregs) - 1;
140 116
141 /* 117 /*
142 * Put the pt_regs structure at the end of the new kernel stack page and 118 * Put the pt_regs structure at the end of the new kernel stack page and
143 * fix it up. Note: the task_struct doubles as the kernel stack for the 119 * fix it up. Note: the task_struct doubles as the kernel stack for the
144 * task. 120 * task.
145 */ 121 */
146 childregs = task_pt_regs(p); 122 if (unlikely(p->flags & PF_KTHREAD)) {
147 *childregs = *regs; /* Struct copy of pt_regs. */ 123 memset(swstack, 0,
148 p->set_child_tid = p->clear_child_tid = NULL; 124 sizeof(struct switch_stack) + sizeof(struct pt_regs));
125 swstack->r1 = usp;
126 swstack->r2 = arg;
127 childregs->ccs = 1 << (I_CCS_BITNR + CCS_SHIFT);
128 swstack->return_ip = (unsigned long) ret_from_kernel_thread;
129 p->thread.ksp = (unsigned long) swstack;
130 p->thread.usp = 0;
131 return 0;
132 }
133 *childregs = *current_pt_regs(); /* Struct copy of pt_regs. */
149 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */ 134 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */
150 135
151 /* Set a new TLS ? 136 /* Set a new TLS ?
152 * The TLS is in $mof because it is the 5th argument to sys_clone. 137 * The TLS is in $mof because it is the 5th argument to sys_clone.
153 */ 138 */
154 if (p->mm && (clone_flags & CLONE_SETTLS)) { 139 if (p->mm && (clone_flags & CLONE_SETTLS)) {
155 task_thread_info(p)->tls = regs->mof; 140 task_thread_info(p)->tls = childregs->mof;
156 } 141 }
157 142
158 /* Put the switch stack right below the pt_regs. */ 143 /* Put the switch stack right below the pt_regs. */
159 swstack = ((struct switch_stack *) childregs) - 1;
160 144
161 /* Parameter to ret_from_sys_call. 0 is don't restart the syscall. */ 145 /* Parameter to ret_from_sys_call. 0 is don't restart the syscall. */
162 swstack->r9 = 0; 146 swstack->r9 = 0;
@@ -168,76 +152,12 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
168 swstack->return_ip = (unsigned long) ret_from_fork; 152 swstack->return_ip = (unsigned long) ret_from_fork;
169 153
170 /* Fix the user-mode and kernel-mode stackpointer. */ 154 /* Fix the user-mode and kernel-mode stackpointer. */
171 p->thread.usp = usp; 155 p->thread.usp = usp ?: rdusp();
172 p->thread.ksp = (unsigned long) swstack; 156 p->thread.ksp = (unsigned long) swstack;
173 157
174 return 0; 158 return 0;
175} 159}
176 160
177/*
178 * Be aware of the "magic" 7th argument in the four system-calls below.
179 * They need the latest stackframe, which is put as the 7th argument by
180 * entry.S. The previous arguments are dummies or actually used, but need
181 * to be defined to reach the 7th argument.
182 *
183 * N.B.: Another method to get the stackframe is to use current_regs(). But
184 * it returns the latest stack-frame stacked when going from _user mode_ and
185 * some of these (at least sys_clone) are called from kernel-mode sometimes
186 * (for example during kernel_thread, above) and thus cannot use it. Thus,
187 * to be sure not to get any surprises, we use the method for the other calls
188 * as well.
189 */
190asmlinkage int
191sys_fork(long r10, long r11, long r12, long r13, long mof, long srp,
192 struct pt_regs *regs)
193{
194 return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
195}
196
197/* FIXME: Is parent_tid/child_tid really third/fourth argument? Update lib? */
198asmlinkage int
199sys_clone(unsigned long newusp, unsigned long flags, int *parent_tid, int *child_tid,
200 unsigned long tls, long srp, struct pt_regs *regs)
201{
202 if (!newusp)
203 newusp = rdusp();
204
205 return do_fork(flags, newusp, regs, 0, parent_tid, child_tid);
206}
207
208/*
209 * vfork is a system call in i386 because of register-pressure - maybe
210 * we can remove it and handle it in libc but we put it here until then.
211 */
212asmlinkage int
213sys_vfork(long r10, long r11, long r12, long r13, long mof, long srp,
214 struct pt_regs *regs)
215{
216 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL);
217}
218
219/* sys_execve() executes a new program. */
220asmlinkage int
221sys_execve(const char *fname,
222 const char *const *argv,
223 const char *const *envp, long r13, long mof, long srp,
224 struct pt_regs *regs)
225{
226 int error;
227 struct filename *filename;
228
229 filename = getname(fname);
230 error = PTR_ERR(filename);
231
232 if (IS_ERR(filename))
233 goto out;
234
235 error = do_execve(filename->name, argv, envp, regs);
236 putname(filename);
237 out:
238 return error;
239}
240
241unsigned long 161unsigned long
242get_wchan(struct task_struct *p) 162get_wchan(struct task_struct *p)
243{ 163{
diff --git a/arch/cris/include/arch-v10/arch/irq.h b/arch/cris/include/arch-v10/arch/irq.h
index 7d345947b3e..ca2675ae08e 100644
--- a/arch/cris/include/arch-v10/arch/irq.h
+++ b/arch/cris/include/arch-v10/arch/irq.h
@@ -142,7 +142,7 @@ __asm__ ( \
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 is
145 * registred as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not 145 * registered as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not
146 * be an sti() before the timer irq handler is run to acknowledge the interrupt. 146 * be an sti() before the timer irq handler is run to acknowledge the interrupt.
147 */ 147 */
148 148
diff --git a/arch/cris/include/arch-v32/arch/irq.h b/arch/cris/include/arch-v32/arch/irq.h
index b31e9984f84..fe3cdd22bed 100644
--- a/arch/cris/include/arch-v32/arch/irq.h
+++ b/arch/cris/include/arch-v32/arch/irq.h
@@ -103,7 +103,7 @@ __asm__ ( \
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 is
106 * registred as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not 106 * registered as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not
107 * be an sti() before the timer irq handler is run to acknowledge the interrupt. 107 * be an sti() before the 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) \
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 6d43a951b5e..15a122c3767 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -11,3 +11,4 @@ header-y += sync_serial.h
11generic-y += clkdev.h 11generic-y += clkdev.h
12generic-y += exec.h 12generic-y += exec.h
13generic-y += module.h 13generic-y += module.h
14generic-y += trace_clock.h
diff --git a/arch/cris/include/asm/processor.h b/arch/cris/include/asm/processor.h
index ef4e1bc3efc..675823f70c0 100644
--- a/arch/cris/include/asm/processor.h
+++ b/arch/cris/include/asm/processor.h
@@ -49,8 +49,6 @@ struct task_struct;
49#define task_pt_regs(task) user_regs(task_thread_info(task)) 49#define task_pt_regs(task) user_regs(task_thread_info(task))
50#define current_regs() task_pt_regs(current) 50#define current_regs() task_pt_regs(current)
51 51
52extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
53
54unsigned long get_wchan(struct task_struct *p); 52unsigned long get_wchan(struct task_struct *p);
55 53
56#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) 54#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
diff --git a/arch/cris/include/asm/signal.h b/arch/cris/include/asm/signal.h
index ea6af9aad76..72dbbf59dfa 100644
--- a/arch/cris/include/asm/signal.h
+++ b/arch/cris/include/asm/signal.h
@@ -152,12 +152,6 @@ typedef struct sigaltstack {
152 152
153#ifdef __KERNEL__ 153#ifdef __KERNEL__
154#include <asm/sigcontext.h> 154#include <asm/sigcontext.h>
155
156/* here we could define asm-optimized sigaddset, sigdelset etc. operations.
157 * if we don't, generic ones are used from linux/signal.h
158 */
159#define ptrace_signal_deliver(regs, cookie) do { } while (0)
160
161#endif /* __KERNEL__ */ 155#endif /* __KERNEL__ */
162 156
163#endif 157#endif
diff --git a/arch/cris/include/asm/socket.h b/arch/cris/include/asm/socket.h
index ae52825021a..b681b043f6c 100644
--- a/arch/cris/include/asm/socket.h
+++ b/arch/cris/include/asm/socket.h
@@ -42,6 +42,7 @@
42/* Socket filtering */ 42/* Socket filtering */
43#define SO_ATTACH_FILTER 26 43#define SO_ATTACH_FILTER 26
44#define SO_DETACH_FILTER 27 44#define SO_DETACH_FILTER 27
45#define SO_GET_FILTER SO_ATTACH_FILTER
45 46
46#define SO_PEERNAME 28 47#define SO_PEERNAME 28
47#define SO_TIMESTAMP 29 48#define SO_TIMESTAMP 29
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index 51873a446f8..f27b542e0eb 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -371,6 +371,10 @@
371#define __ARCH_WANT_SYS_SIGPROCMASK 371#define __ARCH_WANT_SYS_SIGPROCMASK
372#define __ARCH_WANT_SYS_RT_SIGACTION 372#define __ARCH_WANT_SYS_RT_SIGACTION
373#define __ARCH_WANT_SYS_RT_SIGSUSPEND 373#define __ARCH_WANT_SYS_RT_SIGSUSPEND
374#define __ARCH_WANT_SYS_EXECVE
375#define __ARCH_WANT_SYS_FORK
376#define __ARCH_WANT_SYS_VFORK
377#define __ARCH_WANT_SYS_CLONE
374 378
375/* 379/*
376 * "Conditional" syscalls 380 * "Conditional" syscalls
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 7ac000f6a88..5868cee20eb 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -30,7 +30,6 @@ extern void __negdi2(void);
30extern void iounmap(volatile void * __iomem); 30extern void iounmap(volatile void * __iomem);
31 31
32/* Platform dependent support */ 32/* Platform dependent support */
33EXPORT_SYMBOL(kernel_thread);
34EXPORT_SYMBOL(get_cmos_time); 33EXPORT_SYMBOL(get_cmos_time);
35EXPORT_SYMBOL(loops_per_usec); 34EXPORT_SYMBOL(loops_per_usec);
36 35
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild
index 4a159da2363..c5d76702830 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@ -1,3 +1,4 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += trace_clock.h
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index 2358634cacc..1807d8ea8cb 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -30,6 +30,9 @@
30#define __ARCH_WANT_SYS_RT_SIGACTION 30#define __ARCH_WANT_SYS_RT_SIGACTION
31#define __ARCH_WANT_SYS_RT_SIGSUSPEND 31#define __ARCH_WANT_SYS_RT_SIGSUSPEND
32#define __ARCH_WANT_SYS_EXECVE 32#define __ARCH_WANT_SYS_EXECVE
33#define __ARCH_WANT_SYS_FORK
34#define __ARCH_WANT_SYS_VFORK
35#define __ARCH_WANT_SYS_CLONE
33 36
34/* 37/*
35 * "Conditional" syscalls 38 * "Conditional" syscalls
diff --git a/arch/frv/include/uapi/asm/socket.h b/arch/frv/include/uapi/asm/socket.h
index a5b1d7dbb20..871f89b7fbd 100644
--- a/arch/frv/include/uapi/asm/socket.h
+++ b/arch/frv/include/uapi/asm/socket.h
@@ -40,6 +40,7 @@
40/* Socket filtering */ 40/* Socket filtering */
41#define SO_ATTACH_FILTER 26 41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27 42#define SO_DETACH_FILTER 27
43#define SO_GET_FILTER SO_ATTACH_FILTER
43 44
44#define SO_PEERNAME 28 45#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29 46#define SO_TIMESTAMP 29
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 7e33215f1d8..23916b2a12a 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -139,42 +139,12 @@ inline unsigned long user_stack(const struct pt_regs *regs)
139 return user_mode(regs) ? regs->sp : 0; 139 return user_mode(regs) ? regs->sp : 0;
140} 140}
141 141
142asmlinkage int sys_fork(void)
143{
144#ifndef CONFIG_MMU
145 /* fork almost works, enough to trick you into looking elsewhere:-( */
146 return -EINVAL;
147#else
148 return do_fork(SIGCHLD, user_stack(__frame), __frame, 0, NULL, NULL);
149#endif
150}
151
152asmlinkage int sys_vfork(void)
153{
154 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, user_stack(__frame), __frame, 0,
155 NULL, NULL);
156}
157
158/*****************************************************************************/
159/*
160 * clone a process
161 * - tlsptr is retrieved by copy_thread()
162 */
163asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
164 int __user *parent_tidptr, int __user *child_tidptr,
165 int __user *tlsptr)
166{
167 if (!newsp)
168 newsp = user_stack(__frame);
169 return do_fork(clone_flags, newsp, __frame, 0, parent_tidptr, child_tidptr);
170} /* end sys_clone() */
171
172/* 142/*
173 * set up the kernel stack and exception frames for a new process 143 * set up the kernel stack and exception frames for a new process
174 */ 144 */
175int copy_thread(unsigned long clone_flags, 145int copy_thread(unsigned long clone_flags,
176 unsigned long usp, unsigned long arg, 146 unsigned long usp, unsigned long arg,
177 struct task_struct *p, struct pt_regs *regs) 147 struct task_struct *p)
178{ 148{
179 struct pt_regs *childregs; 149 struct pt_regs *childregs;
180 150
@@ -182,9 +152,7 @@ int copy_thread(unsigned long clone_flags,
182 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); 152 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
183 153
184 /* set up the userspace frame (the only place that the USP is stored) */ 154 /* set up the userspace frame (the only place that the USP is stored) */
185 *childregs = *__kernel_frame0_ptr; 155 *childregs = *current_pt_regs();
186
187 p->set_child_tid = p->clear_child_tid = NULL;
188 156
189 p->thread.frame = childregs; 157 p->thread.frame = childregs;
190 p->thread.curr = p; 158 p->thread.curr = p;
@@ -193,18 +161,15 @@ int copy_thread(unsigned long clone_flags,
193 p->thread.lr = 0; 161 p->thread.lr = 0;
194 p->thread.frame0 = childregs; 162 p->thread.frame0 = childregs;
195 163
196 if (unlikely(!regs)) { 164 if (unlikely(p->flags & PF_KTHREAD)) {
197 childregs->gr9 = usp; /* function */ 165 childregs->gr9 = usp; /* function */
198 childregs->gr8 = arg; 166 childregs->gr8 = arg;
199 p->thread.pc = (unsigned long) ret_from_kernel_thread; 167 p->thread.pc = (unsigned long) ret_from_kernel_thread;
200 save_user_regs(p->thread.user); 168 save_user_regs(p->thread.user);
201 return 0; 169 return 0;
202 } 170 }
203 171 if (usp)
204 /* set up the userspace frame (the only place that the USP is stored) */ 172 childregs->sp = usp;
205 *childregs = *regs;
206
207 childregs->sp = usp;
208 childregs->next_frame = NULL; 173 childregs->next_frame = NULL;
209 174
210 p->thread.pc = (unsigned long) ret_from_fork; 175 p->thread.pc = (unsigned long) ret_from_fork;
diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c
index 4fb63a36bd5..f6084bc524e 100644
--- a/arch/frv/mm/pgalloc.c
+++ b/arch/frv/mm/pgalloc.c
@@ -77,7 +77,7 @@ void __set_pmd(pmd_t *pmdptr, unsigned long pmd)
77 * checks at dup_mmap(), exec(), and other mmlist addition points 77 * checks at dup_mmap(), exec(), and other mmlist addition points
78 * could be used. The locking scheme was chosen on the basis of 78 * could be used. The locking scheme was chosen on the basis of
79 * manfred's recommendations and having no core impact whatsoever. 79 * manfred's recommendations and having no core impact whatsoever.
80 * -- wli 80 * -- nyc
81 */ 81 */
82DEFINE_SPINLOCK(pgd_lock); 82DEFINE_SPINLOCK(pgd_lock);
83struct page *pgd_list; 83struct page *pgd_list;
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 98fabd10e95..04bef4d25b4 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -8,6 +8,8 @@ config H8300
8 select GENERIC_IRQ_SHOW 8 select GENERIC_IRQ_SHOW
9 select GENERIC_CPU_DEVICES 9 select GENERIC_CPU_DEVICES
10 select MODULES_USE_ELF_RELA 10 select MODULES_USE_ELF_RELA
11 select GENERIC_KERNEL_THREAD
12 select GENERIC_KERNEL_EXECVE
11 13
12config SYMBOL_PREFIX 14config SYMBOL_PREFIX
13 string 15 string
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 50bbf387b2f..4bc8ae73e08 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -3,3 +3,4 @@ include include/asm-generic/Kbuild.asm
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += module.h 5generic-y += module.h
6generic-y += trace_clock.h
diff --git a/arch/h8300/include/asm/processor.h b/arch/h8300/include/asm/processor.h
index 4c9f6f87b61..4b0ca49bb46 100644
--- a/arch/h8300/include/asm/processor.h
+++ b/arch/h8300/include/asm/processor.h
@@ -107,8 +107,6 @@ static inline void release_thread(struct task_struct *dead_task)
107{ 107{
108} 108}
109 109
110extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
111
112/* 110/*
113 * Free current thread data structures etc.. 111 * Free current thread data structures etc..
114 */ 112 */
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h
index d09c440bdba..7468589a128 100644
--- a/arch/h8300/include/asm/ptrace.h
+++ b/arch/h8300/include/asm/ptrace.h
@@ -60,6 +60,9 @@ struct pt_regs {
60#define user_mode(regs) (!((regs)->ccr & PS_S)) 60#define user_mode(regs) (!((regs)->ccr & PS_S))
61#define instruction_pointer(regs) ((regs)->pc) 61#define instruction_pointer(regs) ((regs)->pc)
62#define profile_pc(regs) instruction_pointer(regs) 62#define profile_pc(regs) instruction_pointer(regs)
63#define current_pt_regs() ((struct pt_regs *) \
64 (THREAD_SIZE + (unsigned long)current_thread_info()) - 1)
65#define signal_pt_regs() ((struct pt_regs *)current->thread.esp0)
63#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
64#endif /* __ASSEMBLY__ */ 67#endif /* __ASSEMBLY__ */
65#endif /* _H8300_PTRACE_H */ 68#endif /* _H8300_PTRACE_H */
diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h
index fd8b66e40dc..c43c0a7d2c2 100644
--- a/arch/h8300/include/asm/signal.h
+++ b/arch/h8300/include/asm/signal.h
@@ -154,8 +154,6 @@ typedef struct sigaltstack {
154#include <asm/sigcontext.h> 154#include <asm/sigcontext.h>
155#undef __HAVE_ARCH_SIG_BITOPS 155#undef __HAVE_ARCH_SIG_BITOPS
156 156
157#define ptrace_signal_deliver(regs, cookie) do { } while (0)
158
159#endif /* __KERNEL__ */ 157#endif /* __KERNEL__ */
160 158
161#endif /* _H8300_SIGNAL_H */ 159#endif /* _H8300_SIGNAL_H */
diff --git a/arch/h8300/include/asm/socket.h b/arch/h8300/include/asm/socket.h
index ec4554e7b04..90a2e573c7e 100644
--- a/arch/h8300/include/asm/socket.h
+++ b/arch/h8300/include/asm/socket.h
@@ -40,6 +40,7 @@
40/* Socket filtering */ 40/* Socket filtering */
41#define SO_ATTACH_FILTER 26 41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27 42#define SO_DETACH_FILTER 27
43#define SO_GET_FILTER SO_ATTACH_FILTER
43 44
44#define SO_PEERNAME 28 45#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29 46#define SO_TIMESTAMP 29
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
index 5cd882801d7..c2c2f5c7d6b 100644
--- a/arch/h8300/include/asm/unistd.h
+++ b/arch/h8300/include/asm/unistd.h
@@ -356,6 +356,10 @@
356#define __ARCH_WANT_SYS_SIGPROCMASK 356#define __ARCH_WANT_SYS_SIGPROCMASK
357#define __ARCH_WANT_SYS_RT_SIGACTION 357#define __ARCH_WANT_SYS_RT_SIGACTION
358#define __ARCH_WANT_SYS_RT_SIGSUSPEND 358#define __ARCH_WANT_SYS_RT_SIGSUSPEND
359#define __ARCH_WANT_SYS_EXECVE
360#define __ARCH_WANT_SYS_FORK
361#define __ARCH_WANT_SYS_VFORK
362#define __ARCH_WANT_SYS_CLONE
359 363
360/* 364/*
361 * "Conditional" syscalls 365 * "Conditional" syscalls
diff --git a/arch/h8300/kernel/entry.S b/arch/h8300/kernel/entry.S
index ca743169030..617a6878787 100644
--- a/arch/h8300/kernel/entry.S
+++ b/arch/h8300/kernel/entry.S
@@ -158,6 +158,7 @@ INTERRUPTS = 128
158.globl SYMBOL_NAME(system_call) 158.globl SYMBOL_NAME(system_call)
159.globl SYMBOL_NAME(ret_from_exception) 159.globl SYMBOL_NAME(ret_from_exception)
160.globl SYMBOL_NAME(ret_from_fork) 160.globl SYMBOL_NAME(ret_from_fork)
161.globl SYMBOL_NAME(ret_from_kernel_thread)
161.globl SYMBOL_NAME(ret_from_interrupt) 162.globl SYMBOL_NAME(ret_from_interrupt)
162.globl SYMBOL_NAME(interrupt_redirect_table) 163.globl SYMBOL_NAME(interrupt_redirect_table)
163.globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp) 164.globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp)
@@ -330,6 +331,14 @@ SYMBOL_NAME_LABEL(ret_from_fork)
330 jsr @SYMBOL_NAME(schedule_tail) 331 jsr @SYMBOL_NAME(schedule_tail)
331 jmp @SYMBOL_NAME(ret_from_exception) 332 jmp @SYMBOL_NAME(ret_from_exception)
332 333
334SYMBOL_NAME_LABEL(ret_from_kernel_thread)
335 mov.l er2,er0
336 jsr @SYMBOL_NAME(schedule_tail)
337 mov.l @(LER4:16,sp),er0
338 mov.l @(LER5:16,sp),er1
339 jsr @er1
340 jmp @SYMBOL_NAME(ret_from_exception)
341
333SYMBOL_NAME_LABEL(resume) 342SYMBOL_NAME_LABEL(resume)
334 /* 343 /*
335 * Beware - when entering resume, offset of tss is in d1, 344 * Beware - when entering resume, offset of tss is in d1,
diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c
index 6866bd9c7fb..53d7c0e4bd8 100644
--- a/arch/h8300/kernel/h8300_ksyms.c
+++ b/arch/h8300/kernel/h8300_ksyms.c
@@ -33,7 +33,6 @@ EXPORT_SYMBOL(strncmp);
33 33
34EXPORT_SYMBOL(ip_fast_csum); 34EXPORT_SYMBOL(ip_fast_csum);
35 35
36EXPORT_SYMBOL(kernel_thread);
37EXPORT_SYMBOL(enable_irq); 36EXPORT_SYMBOL(enable_irq);
38EXPORT_SYMBOL(disable_irq); 37EXPORT_SYMBOL(disable_irq);
39 38
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index e8dc1393a13..b609f63f159 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -47,6 +47,7 @@ void (*pm_power_off)(void) = NULL;
47EXPORT_SYMBOL(pm_power_off); 47EXPORT_SYMBOL(pm_power_off);
48 48
49asmlinkage void ret_from_fork(void); 49asmlinkage void ret_from_fork(void);
50asmlinkage void ret_from_kernel_thread(void);
50 51
51/* 52/*
52 * The idle loop on an H8/300.. 53 * The idle loop on an H8/300..
@@ -122,113 +123,34 @@ void show_regs(struct pt_regs * regs)
122 printk("\n"); 123 printk("\n");
123} 124}
124 125
125/*
126 * Create a kernel thread
127 */
128int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
129{
130 long retval;
131 long clone_arg;
132 mm_segment_t fs;
133
134 fs = get_fs();
135 set_fs (KERNEL_DS);
136 clone_arg = flags | CLONE_VM;
137 __asm__("mov.l sp,er3\n\t"
138 "sub.l er2,er2\n\t"
139 "mov.l %2,er1\n\t"
140 "mov.l %1,er0\n\t"
141 "trapa #0\n\t"
142 "cmp.l sp,er3\n\t"
143 "beq 1f\n\t"
144 "mov.l %4,er0\n\t"
145 "mov.l %3,er1\n\t"
146 "jsr @er1\n\t"
147 "mov.l %5,er0\n\t"
148 "trapa #0\n"
149 "1:\n\t"
150 "mov.l er0,%0"
151 :"=r"(retval)
152 :"i"(__NR_clone),"g"(clone_arg),"g"(fn),"g"(arg),"i"(__NR_exit)
153 :"er0","er1","er2","er3");
154 set_fs (fs);
155 return retval;
156}
157
158void flush_thread(void) 126void flush_thread(void)
159{ 127{
160} 128}
161 129
162/*
163 * "h8300_fork()".. By the time we get here, the
164 * non-volatile registers have also been saved on the
165 * stack. We do some ugly pointer stuff here.. (see
166 * also copy_thread)
167 */
168
169asmlinkage int h8300_fork(struct pt_regs *regs)
170{
171 return -EINVAL;
172}
173
174asmlinkage int h8300_vfork(struct pt_regs *regs)
175{
176 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL);
177}
178
179asmlinkage int h8300_clone(struct pt_regs *regs)
180{
181 unsigned long clone_flags;
182 unsigned long newsp;
183
184 /* syscall2 puts clone_flags in er1 and usp in er2 */
185 clone_flags = regs->er1;
186 newsp = regs->er2;
187 if (!newsp)
188 newsp = rdusp();
189 return do_fork(clone_flags, newsp, regs, 0, NULL, NULL);
190
191}
192
193int copy_thread(unsigned long clone_flags, 130int copy_thread(unsigned long clone_flags,
194 unsigned long usp, unsigned long topstk, 131 unsigned long usp, unsigned long topstk,
195 struct task_struct * p, struct pt_regs * regs) 132 struct task_struct * p)
196{ 133{
197 struct pt_regs * childregs; 134 struct pt_regs * childregs;
198 135
199 childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1; 136 childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
200 137
201 *childregs = *regs; 138 if (unlikely(p->flags & PF_KTHREAD)) {
139 memset(childregs, 0, sizeof(struct pt_regs));
140 childregs->retpc = (unsigned long) ret_from_kernel_thread;
141 childregs->er4 = topstk; /* arg */
142 childregs->er5 = usp; /* fn */
143 p->thread.ksp = (unsigned long)childregs;
144 }
145 *childregs = *current_pt_regs();
202 childregs->retpc = (unsigned long) ret_from_fork; 146 childregs->retpc = (unsigned long) ret_from_fork;
203 childregs->er0 = 0; 147 childregs->er0 = 0;
204 148 p->thread.usp = usp ?: rdusp();
205 p->thread.usp = usp;
206 p->thread.ksp = (unsigned long)childregs; 149 p->thread.ksp = (unsigned long)childregs;
207 150
208 return 0; 151 return 0;
209} 152}
210 153
211/*
212 * sys_execve() executes a new program.
213 */
214asmlinkage int sys_execve(const char *name,
215 const char *const *argv,
216 const char *const *envp,
217 int dummy, ...)
218{
219 int error;
220 struct filename *filename;
221 struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy-4);
222
223 filename = getname(name);
224 error = PTR_ERR(filename);
225 if (IS_ERR(filename))
226 return error;
227 error = do_execve(filename->name, argv, envp, regs);
228 putname(filename);
229 return error;
230}
231
232unsigned long thread_saved_pc(struct task_struct *tsk) 154unsigned long thread_saved_pc(struct task_struct *tsk)
233{ 155{
234 return ((struct pt_regs *)tsk->thread.esp0)->pc; 156 return ((struct pt_regs *)tsk->thread.esp0)->pc;
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 4bdc7311784..bf350cb7f59 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -46,29 +46,3 @@ asmlinkage void syscall_print(void *dummy,...)
46 ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0); 46 ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0);
47} 47}
48#endif 48#endif
49
50/*
51 * Do a system call from kernel instead of calling sys_execve so we
52 * end up with proper pt_regs.
53 */
54asmlinkage
55int kernel_execve(const char *filename,
56 const char *const argv[],
57 const char *const envp[])
58{
59 register long res __asm__("er0");
60 register const char *const *_c __asm__("er3") = envp;
61 register const char *const *_b __asm__("er2") = argv;
62 register const char * _a __asm__("er1") = filename;
63 __asm__ __volatile__ ("mov.l %1,er0\n\t"
64 "trapa #0\n\t"
65 : "=r" (res)
66 : "g" (__NR_execve),
67 "g" (_a),
68 "g" (_b),
69 "g" (_c)
70 : "cc", "memory");
71 return res;
72}
73
74
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index 9d77e715a2e..b74dd0ade58 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -340,21 +340,12 @@ SYMBOL_NAME_LABEL(sys_call_table)
340 bra SYMBOL_NAME(syscall_trampoline):8 340 bra SYMBOL_NAME(syscall_trampoline):8
341 .endm 341 .endm
342 342
343SYMBOL_NAME_LABEL(sys_clone)
344 call_sp h8300_clone
345
346SYMBOL_NAME_LABEL(sys_sigreturn) 343SYMBOL_NAME_LABEL(sys_sigreturn)
347 call_sp do_sigreturn 344 call_sp do_sigreturn
348 345
349SYMBOL_NAME_LABEL(sys_rt_sigreturn) 346SYMBOL_NAME_LABEL(sys_rt_sigreturn)
350 call_sp do_rt_sigreturn 347 call_sp do_rt_sigreturn
351 348
352SYMBOL_NAME_LABEL(sys_fork)
353 call_sp h8300_fork
354
355SYMBOL_NAME_LABEL(sys_vfork)
356 call_sp h8300_vfork
357
358SYMBOL_NAME_LABEL(syscall_trampoline) 349SYMBOL_NAME_LABEL(syscall_trampoline)
359 mov.l sp,er0 350 mov.l sp,er0
360 jmp @er6 351 jmp @er6
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 0744f7d7b1f..e418803b6c8 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -31,6 +31,8 @@ config HEXAGON
31 select GENERIC_CLOCKEVENTS 31 select GENERIC_CLOCKEVENTS
32 select GENERIC_CLOCKEVENTS_BROADCAST 32 select GENERIC_CLOCKEVENTS_BROADCAST
33 select MODULES_USE_ELF_RELA 33 select MODULES_USE_ELF_RELA
34 select GENERIC_KERNEL_THREAD
35 select GENERIC_KERNEL_EXECVE
34 ---help--- 36 ---help---
35 Qualcomm Hexagon is a processor architecture designed for high 37 Qualcomm Hexagon is a processor architecture designed for high
36 performance and low power across a wide variety of applications. 38 performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index 3bfa9b30f44..bdb54ceb53b 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -48,6 +48,7 @@ generic-y += stat.h
48generic-y += termbits.h 48generic-y += termbits.h
49generic-y += termios.h 49generic-y += termios.h
50generic-y += topology.h 50generic-y += topology.h
51generic-y += trace_clock.h
51generic-y += types.h 52generic-y += types.h
52generic-y += ucontext.h 53generic-y += ucontext.h
53generic-y += unaligned.h 54generic-y += unaligned.h
diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h
index a03323ab9d4..6dd5d370686 100644
--- a/arch/hexagon/include/asm/processor.h
+++ b/arch/hexagon/include/asm/processor.h
@@ -34,7 +34,6 @@
34struct task_struct; 34struct task_struct;
35 35
36/* this is defined in arch/process.c */ 36/* this is defined in arch/process.c */
37extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
38extern unsigned long thread_saved_pc(struct task_struct *tsk); 37extern unsigned long thread_saved_pc(struct task_struct *tsk);
39 38
40extern void start_thread(struct pt_regs *, unsigned long, unsigned long); 39extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
index fb0e9d48faa..4af9c7b6f13 100644
--- a/arch/hexagon/include/asm/syscall.h
+++ b/arch/hexagon/include/asm/syscall.h
@@ -25,14 +25,6 @@ typedef long (*syscall_fn)(unsigned long, unsigned long,
25 unsigned long, unsigned long, 25 unsigned long, unsigned long,
26 unsigned long, unsigned long); 26 unsigned long, unsigned long);
27 27
28asmlinkage int sys_execve(char __user *ufilename, char __user * __user *argv,
29 char __user * __user *envp);
30asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
31 unsigned long parent_tidp, unsigned long child_tidp);
32
33#define sys_execve sys_execve
34#define sys_clone sys_clone
35
36#include <asm-generic/syscalls.h> 28#include <asm-generic/syscalls.h>
37 29
38extern void *sys_call_table[]; 30extern void *sys_call_table[];
diff --git a/arch/hexagon/include/uapi/asm/ptrace.h b/arch/hexagon/include/uapi/asm/ptrace.h
index 8ef784047a7..1ffce0c6ee0 100644
--- a/arch/hexagon/include/uapi/asm/ptrace.h
+++ b/arch/hexagon/include/uapi/asm/ptrace.h
@@ -32,4 +32,8 @@
32extern int regs_query_register_offset(const char *name); 32extern int regs_query_register_offset(const char *name);
33extern const char *regs_query_register_name(unsigned int offset); 33extern const char *regs_query_register_name(unsigned int offset);
34 34
35#define current_pt_regs() \
36 ((struct pt_regs *) \
37 ((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
38
35#endif 39#endif
diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
index 81312d6a52e..2af81533bd0 100644
--- a/arch/hexagon/include/uapi/asm/unistd.h
+++ b/arch/hexagon/include/uapi/asm/unistd.h
@@ -27,5 +27,7 @@
27 */ 27 */
28 28
29#define sys_mmap2 sys_mmap_pgoff 29#define sys_mmap2 sys_mmap_pgoff
30#define __ARCH_WANT_SYS_EXECVE
31#define __ARCH_WANT_SYS_CLONE
30 32
31#include <asm-generic/unistd.h> 33#include <asm-generic/unistd.h>
diff --git a/arch/hexagon/kernel/Makefile b/arch/hexagon/kernel/Makefile
index 536aec093e6..6c19501b487 100644
--- a/arch/hexagon/kernel/Makefile
+++ b/arch/hexagon/kernel/Makefile
@@ -3,8 +3,7 @@ extra-y := head.o vmlinux.lds
3obj-$(CONFIG_SMP) += smp.o topology.o 3obj-$(CONFIG_SMP) += smp.o topology.o
4 4
5obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o 5obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o
6obj-y += process.o syscall.o trampoline.o reset.o ptrace.o 6obj-y += process.o trampoline.o reset.o ptrace.o vdso.o
7obj-y += vdso.o
8 7
9obj-$(CONFIG_KGDB) += kgdb.o 8obj-$(CONFIG_KGDB) += kgdb.o
10obj-$(CONFIG_MODULES) += module.o hexagon_ksyms.o 9obj-$(CONFIG_MODULES) += module.o hexagon_ksyms.o
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
index 9f6d7411b57..06ae9ffcabd 100644
--- a/arch/hexagon/kernel/process.c
+++ b/arch/hexagon/kernel/process.c
@@ -26,33 +26,6 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27 27
28/* 28/*
29 * Kernel thread creation. The desired kernel function is "wrapped"
30 * in the kernel_thread_helper function, which does cleanup
31 * afterwards.
32 */
33static void __noreturn kernel_thread_helper(void *arg, int (*fn)(void *))
34{
35 do_exit(fn(arg));
36}
37
38int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
39{
40 struct pt_regs regs;
41
42 memset(&regs, 0, sizeof(regs));
43 /*
44 * Yes, we're exploting illicit knowledge of the ABI here.
45 */
46 regs.r00 = (unsigned long) arg;
47 regs.r01 = (unsigned long) fn;
48 pt_set_elr(&regs, (unsigned long)kernel_thread_helper);
49 pt_set_kmode(&regs);
50
51 return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
52}
53EXPORT_SYMBOL(kernel_thread);
54
55/*
56 * Program thread launch. Often defined as a macro in processor.h, 29 * Program thread launch. Often defined as a macro in processor.h,
57 * but we're shooting for a small footprint and it's not an inner-loop 30 * but we're shooting for a small footprint and it's not an inner-loop
58 * performance-critical operation. 31 * performance-critical operation.
@@ -114,8 +87,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
114 * Copy architecture-specific thread state 87 * Copy architecture-specific thread state
115 */ 88 */
116int copy_thread(unsigned long clone_flags, unsigned long usp, 89int copy_thread(unsigned long clone_flags, unsigned long usp,
117 unsigned long unused, struct task_struct *p, 90 unsigned long arg, struct task_struct *p)
118 struct pt_regs *regs)
119{ 91{
120 struct thread_info *ti = task_thread_info(p); 92 struct thread_info *ti = task_thread_info(p);
121 struct hexagon_switch_stack *ss; 93 struct hexagon_switch_stack *ss;
@@ -125,61 +97,51 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
125 childregs = (struct pt_regs *) (((unsigned long) ti + THREAD_SIZE) - 97 childregs = (struct pt_regs *) (((unsigned long) ti + THREAD_SIZE) -
126 sizeof(*childregs)); 98 sizeof(*childregs));
127 99
128 memcpy(childregs, regs, sizeof(*childregs));
129 ti->regs = childregs; 100 ti->regs = childregs;
130 101
131 /* 102 /*
132 * Establish kernel stack pointer and initial PC for new thread 103 * Establish kernel stack pointer and initial PC for new thread
104 * Note that unlike the usual situation, we do not copy the
105 * parent's callee-saved here; those are in pt_regs and whatever
106 * we leave here will be overridden on return to userland.
133 */ 107 */
134 ss = (struct hexagon_switch_stack *) ((unsigned long) childregs - 108 ss = (struct hexagon_switch_stack *) ((unsigned long) childregs -
135 sizeof(*ss)); 109 sizeof(*ss));
136 ss->lr = (unsigned long)ret_from_fork; 110 ss->lr = (unsigned long)ret_from_fork;
137 p->thread.switch_sp = ss; 111 p->thread.switch_sp = ss;
112 if (unlikely(p->flags & PF_KTHREAD)) {
113 memset(childregs, 0, sizeof(struct pt_regs));
114 /* r24 <- fn, r25 <- arg */
115 ss->r2524 = usp | ((u64)arg << 32);
116 pt_set_kmode(childregs);
117 return 0;
118 }
119 memcpy(childregs, current_pt_regs(), sizeof(*childregs));
120 ss->r2524 = 0;
138 121
139 /* If User mode thread, set pt_reg stack pointer as per parameter */ 122 if (usp)
140 if (user_mode(childregs)) {
141 pt_set_rte_sp(childregs, usp); 123 pt_set_rte_sp(childregs, usp);
142 124
143 /* Child sees zero return value */ 125 /* Child sees zero return value */
144 childregs->r00 = 0; 126 childregs->r00 = 0;
145 127
146 /* 128 /*
147 * The clone syscall has the C signature: 129 * The clone syscall has the C signature:
148 * int [r0] clone(int flags [r0], 130 * int [r0] clone(int flags [r0],
149 * void *child_frame [r1], 131 * void *child_frame [r1],
150 * void *parent_tid [r2], 132 * void *parent_tid [r2],
151 * void *child_tid [r3], 133 * void *child_tid [r3],
152 * void *thread_control_block [r4]); 134 * void *thread_control_block [r4]);
153 * ugp is used to provide TLS support. 135 * ugp is used to provide TLS support.
154 */ 136 */
155 if (clone_flags & CLONE_SETTLS) 137 if (clone_flags & CLONE_SETTLS)
156 childregs->ugp = childregs->r04; 138 childregs->ugp = childregs->r04;
157
158 /*
159 * Parent sees new pid -- not necessary, not even possible at
160 * this point in the fork process
161 * Might also want to set things like ti->addr_limit
162 */
163 } else {
164 /*
165 * If kernel thread, resume stack is kernel stack base.
166 * Note that this is pointer arithmetic on pt_regs *
167 */
168 pt_set_rte_sp(childregs, (unsigned long)(childregs + 1));
169 /*
170 * We need the current thread_info fast path pointer
171 * set up in pt_regs. The register to be used is
172 * parametric for assembler code, but the mechanism
173 * doesn't drop neatly into C. Needs to be fixed.
174 */
175 childregs->THREADINFO_REG = (unsigned long) ti;
176 }
177 139
178 /* 140 /*
179 * thread_info pointer is pulled out of task_struct "stack" 141 * Parent sees new pid -- not necessary, not even possible at
180 * field on switch_to. 142 * this point in the fork process
143 * Might also want to set things like ti->addr_limit
181 */ 144 */
182 p->stack = (void *)ti;
183 145
184 return 0; 146 return 0;
185} 147}
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index 5047b8b879c..fe0d1373165 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -249,14 +249,14 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
249 */ 249 */
250asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) 250asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
251{ 251{
252 struct pt_regs *regs = current_thread_info()->regs; 252 struct pt_regs *regs = current_pt_regs();
253 253
254 return do_sigaltstack(uss, uoss, regs->r29); 254 return do_sigaltstack(uss, uoss, regs->r29);
255} 255}
256 256
257asmlinkage int sys_rt_sigreturn(void) 257asmlinkage int sys_rt_sigreturn(void)
258{ 258{
259 struct pt_regs *regs = current_thread_info()->regs; 259 struct pt_regs *regs = current_pt_regs();
260 struct rt_sigframe __user *frame; 260 struct rt_sigframe __user *frame;
261 sigset_t blocked; 261 sigset_t blocked;
262 262
diff --git a/arch/hexagon/kernel/syscall.c b/arch/hexagon/kernel/syscall.c
deleted file mode 100644
index 319fa6494f5..00000000000
--- a/arch/hexagon/kernel/syscall.c
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * Hexagon system calls
3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#include <linux/file.h>
22#include <linux/fs.h>
23#include <linux/linkage.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/sched.h>
27#include <linux/slab.h>
28#include <linux/syscalls.h>
29#include <linux/unistd.h>
30#include <asm/mman.h>
31#include <asm/registers.h>
32
33/*
34 * System calls with architecture-specific wrappers.
35 * See signal.c for signal-related system call wrappers.
36 */
37
38asmlinkage int sys_execve(char __user *ufilename,
39 const char __user *const __user *argv,
40 const char __user *const __user *envp)
41{
42 struct pt_regs *pregs = current_thread_info()->regs;
43 struct filename *filename;
44 int retval;
45
46 filename = getname(ufilename);
47 retval = PTR_ERR(filename);
48 if (IS_ERR(filename))
49 return retval;
50
51 retval = do_execve(filename->name, argv, envp, pregs);
52 putname(filename);
53
54 return retval;
55}
56
57asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
58 unsigned long parent_tidp, unsigned long child_tidp)
59{
60 struct pt_regs *pregs = current_thread_info()->regs;
61
62 if (!newsp)
63 newsp = pregs->SP;
64 return do_fork(clone_flags, newsp, pregs, 0, (int __user *)parent_tidp,
65 (int __user *)child_tidp);
66}
67
68/*
69 * Do a system call from the kernel, so as to have a proper pt_regs
70 * and recycle the sys_execvpe infrustructure.
71 */
72int kernel_execve(const char *filename,
73 const char *const argv[], const char *const envp[])
74{
75 register unsigned long __a0 asm("r0") = (unsigned long) filename;
76 register unsigned long __a1 asm("r1") = (unsigned long) argv;
77 register unsigned long __a2 asm("r2") = (unsigned long) envp;
78 int retval;
79
80 __asm__ volatile(
81 " R6 = #%4;\n"
82 " trap0(#1);\n"
83 " %0 = R0;\n"
84 : "=r" (retval)
85 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve)
86 );
87
88 return retval;
89}
diff --git a/arch/hexagon/kernel/vm_entry.S b/arch/hexagon/kernel/vm_entry.S
index cd71673ac25..425e50c694f 100644
--- a/arch/hexagon/kernel/vm_entry.S
+++ b/arch/hexagon/kernel/vm_entry.S
@@ -266,4 +266,8 @@ _K_enter_machcheck:
266 .globl ret_from_fork 266 .globl ret_from_fork
267ret_from_fork: 267ret_from_fork:
268 call schedule_tail 268 call schedule_tail
269 P0 = cmp.eq(R24, #0);
270 if P0 jump return_from_syscall
271 R0 = R25;
272 callr R24
269 jump return_from_syscall 273 jump return_from_syscall
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3279646120e..67060046812 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -42,6 +42,8 @@ config IA64
42 select GENERIC_TIME_VSYSCALL_OLD 42 select GENERIC_TIME_VSYSCALL_OLD
43 select HAVE_MOD_ARCH_SPECIFIC 43 select HAVE_MOD_ARCH_SPECIFIC
44 select MODULES_USE_ELF_RELA 44 select MODULES_USE_ELF_RELA
45 select GENERIC_KERNEL_THREAD
46 select GENERIC_KERNEL_EXECVE
45 default y 47 default y
46 help 48 help
47 The Itanium Processor Family is Intel's 64-bit successor to 49 The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index ec536e4e36c..fc3924d18c1 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -555,6 +555,7 @@ static int __init simrs_init(void)
555 return 0; 555 return 0;
556err_free_tty: 556err_free_tty:
557 put_tty_driver(hp_simserial_driver); 557 put_tty_driver(hp_simserial_driver);
558 tty_port_destroy(&state->port);
558 return retval; 559 return retval;
559} 560}
560 561
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index dd02f09b6ed..05b03ecd793 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -2,3 +2,4 @@
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += kvm_para.h 4generic-y += kvm_para.h
5generic-y += trace_clock.h
diff --git a/arch/ia64/include/asm/cputime.h b/arch/ia64/include/asm/cputime.h
index 3deac956d32..7fcf7f08ab0 100644
--- a/arch/ia64/include/asm/cputime.h
+++ b/arch/ia64/include/asm/cputime.h
@@ -103,5 +103,7 @@ static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
103#define cputime64_to_clock_t(__ct) \ 103#define cputime64_to_clock_t(__ct) \
104 cputime_to_clock_t((__force cputime_t)__ct) 104 cputime_to_clock_t((__force cputime_t)__ct)
105 105
106extern void arch_vtime_task_switch(struct task_struct *tsk);
107
106#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 108#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
107#endif /* __IA64_CPUTIME_H */ 109#endif /* __IA64_CPUTIME_H */
diff --git a/arch/ia64/include/asm/device.h b/arch/ia64/include/asm/device.h
index d05e78f6db9..f69c32ffbe6 100644
--- a/arch/ia64/include/asm/device.h
+++ b/arch/ia64/include/asm/device.h
@@ -7,9 +7,6 @@
7#define _ASM_IA64_DEVICE_H 7#define _ASM_IA64_DEVICE_H
8 8
9struct dev_archdata { 9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
13#ifdef CONFIG_INTEL_IOMMU 10#ifdef CONFIG_INTEL_IOMMU
14 void *iommu; /* hook for IOMMU specific extension */ 11 void *iommu; /* hook for IOMMU specific extension */
15#endif 12#endif
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 2c26321c28c..74a7cc3293b 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -90,7 +90,7 @@ phys_to_virt (unsigned long address)
90 90
91#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 91#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
92extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size); 92extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
93extern int valid_phys_addr_range (unsigned long addr, size_t count); /* efi.c */ 93extern int valid_phys_addr_range (phys_addr_t addr, size_t count); /* efi.c */
94extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count); 94extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
95 95
96/* 96/*
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index 944152a5091..e0a899a1a8a 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -340,22 +340,6 @@ struct task_struct;
340 */ 340 */
341#define release_thread(dead_task) 341#define release_thread(dead_task)
342 342
343/*
344 * This is the mechanism for creating a new kernel thread.
345 *
346 * NOTE 1: Only a kernel-only process (ie the swapper or direct
347 * descendants who haven't done an "execve()") should use this: it
348 * will work within a system call from a "real" process, but the
349 * process memory space will not be free'd until both the parent and
350 * the child have exited.
351 *
352 * NOTE 2: This MUST NOT be an inlined function. Otherwise, we get
353 * into trouble in init/main.c when the child thread returns to
354 * do_basic_setup() and the timing is such that free_initmem() has
355 * been called already.
356 */
357extern pid_t kernel_thread (int (*fn)(void *), void *arg, unsigned long flags);
358
359/* Get wait channel for task P. */ 343/* Get wait channel for task P. */
360extern unsigned long get_wchan (struct task_struct *p); 344extern unsigned long get_wchan (struct task_struct *p);
361 345
diff --git a/arch/ia64/include/asm/signal.h b/arch/ia64/include/asm/signal.h
index aecda5b9eb4..3a1b20e74c5 100644
--- a/arch/ia64/include/asm/signal.h
+++ b/arch/ia64/include/asm/signal.h
@@ -38,7 +38,5 @@ struct k_sigaction {
38 38
39# include <asm/sigcontext.h> 39# include <asm/sigcontext.h>
40 40
41#define ptrace_signal_deliver(regs, cookie) do { } while (0)
42
43# endif /* !__ASSEMBLY__ */ 41# endif /* !__ASSEMBLY__ */
44#endif /* _ASM_IA64_SIGNAL_H */ 42#endif /* _ASM_IA64_SIGNAL_H */
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 8b3ff2f5b86..1574bca8613 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -29,6 +29,7 @@
29 29
30#define __ARCH_WANT_SYS_RT_SIGACTION 30#define __ARCH_WANT_SYS_RT_SIGACTION
31#define __ARCH_WANT_SYS_RT_SIGSUSPEND 31#define __ARCH_WANT_SYS_RT_SIGSUSPEND
32#define __ARCH_WANT_SYS_EXECVE
32 33
33#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) 34#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
34 35
diff --git a/arch/ia64/include/uapi/asm/socket.h b/arch/ia64/include/uapi/asm/socket.h
index 41fc28a4a18..23d6759bb57 100644
--- a/arch/ia64/include/uapi/asm/socket.h
+++ b/arch/ia64/include/uapi/asm/socket.h
@@ -49,6 +49,7 @@
49/* Socket filtering */ 49/* Socket filtering */
50#define SO_ATTACH_FILTER 26 50#define SO_ATTACH_FILTER 26
51#define SO_DETACH_FILTER 27 51#define SO_DETACH_FILTER 27
52#define SO_GET_FILTER SO_ATTACH_FILTER
52 53
53#define SO_PEERNAME 28 54#define SO_PEERNAME 28
54#define SO_TIMESTAMP 29 55#define SO_TIMESTAMP 29
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 440578850ae..e9682f5be34 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -633,6 +633,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
633 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : 633 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
634 IOSAPIC_LEVEL); 634 IOSAPIC_LEVEL);
635} 635}
636EXPORT_SYMBOL_GPL(acpi_register_gsi);
636 637
637void acpi_unregister_gsi(u32 gsi) 638void acpi_unregister_gsi(u32 gsi)
638{ 639{
@@ -644,6 +645,7 @@ void acpi_unregister_gsi(u32 gsi)
644 645
645 iosapic_unregister_intr(gsi); 646 iosapic_unregister_intr(gsi);
646} 647}
648EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
647 649
648static int __init acpi_parse_fadt(struct acpi_table_header *table) 650static int __init acpi_parse_fadt(struct acpi_table_header *table)
649{ 651{
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index d37bbd48637..f034563aeae 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -870,7 +870,7 @@ kern_mem_attribute (unsigned long phys_addr, unsigned long size)
870EXPORT_SYMBOL(kern_mem_attribute); 870EXPORT_SYMBOL(kern_mem_attribute);
871 871
872int 872int
873valid_phys_addr_range (unsigned long phys_addr, unsigned long size) 873valid_phys_addr_range (phys_addr_t phys_addr, unsigned long size)
874{ 874{
875 u64 attr; 875 u64 attr;
876 876
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 1ccbe12a4d8..e25b784a2b7 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -61,14 +61,13 @@ ENTRY(ia64_execve)
61 * Allocate 8 input registers since ptrace() may clobber them 61 * Allocate 8 input registers since ptrace() may clobber them
62 */ 62 */
63 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8) 63 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
64 alloc loc1=ar.pfs,8,2,4,0 64 alloc loc1=ar.pfs,8,2,3,0
65 mov loc0=rp 65 mov loc0=rp
66 .body 66 .body
67 mov out0=in0 // filename 67 mov out0=in0 // filename
68 ;; // stop bit between alloc and call 68 ;; // stop bit between alloc and call
69 mov out1=in1 // argv 69 mov out1=in1 // argv
70 mov out2=in2 // envp 70 mov out2=in2 // envp
71 add out3=16,sp // regs
72 br.call.sptk.many rp=sys_execve 71 br.call.sptk.many rp=sys_execve
73.ret0: 72.ret0:
74 cmp4.ge p6,p7=r8,r0 73 cmp4.ge p6,p7=r8,r0
@@ -76,7 +75,6 @@ ENTRY(ia64_execve)
76 sxt4 r8=r8 // return 64-bit result 75 sxt4 r8=r8 // return 64-bit result
77 ;; 76 ;;
78 stf.spill [sp]=f0 77 stf.spill [sp]=f0
79(p6) cmp.ne pKStk,pUStk=r0,r0 // a successful execve() lands us in user-mode...
80 mov rp=loc0 78 mov rp=loc0
81(p6) mov ar.pfs=r0 // clear ar.pfs on success 79(p6) mov ar.pfs=r0 // clear ar.pfs on success
82(p7) br.ret.sptk.many rp 80(p7) br.ret.sptk.many rp
@@ -118,13 +116,12 @@ GLOBAL_ENTRY(sys_clone2)
118 mov loc1=r16 // save ar.pfs across do_fork 116 mov loc1=r16 // save ar.pfs across do_fork
119 .body 117 .body
120 mov out1=in1 118 mov out1=in1
121 mov out3=in2 119 mov out2=in2
122 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT 120 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
123 mov out4=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID 121 mov out3=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
124 ;; 122 ;;
125(p6) st8 [r2]=in5 // store TLS in r16 for copy_thread() 123(p6) st8 [r2]=in5 // store TLS in r16 for copy_thread()
126 mov out5=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID 124 mov out4=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
127 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = &regs
128 mov out0=in0 // out0 = clone_flags 125 mov out0=in0 // out0 = clone_flags
129 br.call.sptk.many rp=do_fork 126 br.call.sptk.many rp=do_fork
130.ret1: .restore sp 127.ret1: .restore sp
@@ -150,13 +147,12 @@ GLOBAL_ENTRY(sys_clone)
150 mov loc1=r16 // save ar.pfs across do_fork 147 mov loc1=r16 // save ar.pfs across do_fork
151 .body 148 .body
152 mov out1=in1 149 mov out1=in1
153 mov out3=16 // stacksize (compensates for 16-byte scratch area) 150 mov out2=16 // stacksize (compensates for 16-byte scratch area)
154 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT 151 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
155 mov out4=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID 152 mov out3=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
156 ;; 153 ;;
157(p6) st8 [r2]=in4 // store TLS in r13 (tp) 154(p6) st8 [r2]=in4 // store TLS in r13 (tp)
158 mov out5=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID 155 mov out4=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
159 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = &regs
160 mov out0=in0 // out0 = clone_flags 156 mov out0=in0 // out0 = clone_flags
161 br.call.sptk.many rp=do_fork 157 br.call.sptk.many rp=do_fork
162.ret2: .restore sp 158.ret2: .restore sp
@@ -484,19 +480,6 @@ GLOBAL_ENTRY(prefetch_stack)
484 br.ret.sptk.many rp 480 br.ret.sptk.many rp
485END(prefetch_stack) 481END(prefetch_stack)
486 482
487GLOBAL_ENTRY(kernel_execve)
488 rum psr.ac
489 mov r15=__NR_execve // put syscall number in place
490 break __BREAK_SYSCALL
491 br.ret.sptk.many rp
492END(kernel_execve)
493
494GLOBAL_ENTRY(clone)
495 mov r15=__NR_clone // put syscall number in place
496 break __BREAK_SYSCALL
497 br.ret.sptk.many rp
498END(clone)
499
500 /* 483 /*
501 * Invoke a system call, but do some tracing before and after the call. 484 * Invoke a system call, but do some tracing before and after the call.
502 * We MUST preserve the current register frame throughout this routine 485 * We MUST preserve the current register frame throughout this routine
@@ -600,6 +583,27 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel)
600.ret4: br.cond.sptk ia64_leave_kernel 583.ret4: br.cond.sptk ia64_leave_kernel
601END(ia64_strace_leave_kernel) 584END(ia64_strace_leave_kernel)
602 585
586ENTRY(call_payload)
587 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(0)
588 /* call the kernel_thread payload; fn is in r4, arg - in r5 */
589 alloc loc1=ar.pfs,0,3,1,0
590 mov loc0=rp
591 mov loc2=gp
592 mov out0=r5 // arg
593 ld8 r14 = [r4], 8 // fn.address
594 ;;
595 mov b6 = r14
596 ld8 gp = [r4] // fn.gp
597 ;;
598 br.call.sptk.many rp=b6 // fn(arg)
599.ret12: mov gp=loc2
600 mov rp=loc0
601 mov ar.pfs=loc1
602 /* ... and if it has returned, we are going to userland */
603 cmp.ne pKStk,pUStk=r0,r0
604 br.ret.sptk.many rp
605END(call_payload)
606
603GLOBAL_ENTRY(ia64_ret_from_clone) 607GLOBAL_ENTRY(ia64_ret_from_clone)
604 PT_REGS_UNWIND_INFO(0) 608 PT_REGS_UNWIND_INFO(0)
605{ /* 609{ /*
@@ -616,6 +620,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
616 br.call.sptk.many rp=ia64_invoke_schedule_tail 620 br.call.sptk.many rp=ia64_invoke_schedule_tail
617} 621}
618.ret8: 622.ret8:
623(pKStk) br.call.sptk.many rp=call_payload
619 adds r2=TI_FLAGS+IA64_TASK_SIZE,r13 624 adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
620 ;; 625 ;;
621 ld4 r2=[r2] 626 ld4 r2=[r2]
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 629a250f7c1..4738ff7bd66 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1093,19 +1093,6 @@ GLOBAL_ENTRY(cycle_to_cputime)
1093END(cycle_to_cputime) 1093END(cycle_to_cputime)
1094#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 1094#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
1095 1095
1096GLOBAL_ENTRY(start_kernel_thread)
1097 .prologue
1098 .save rp, r0 // this is the end of the call-chain
1099 .body
1100 alloc r2 = ar.pfs, 0, 0, 2, 0
1101 mov out0 = r9
1102 mov out1 = r11;;
1103 br.call.sptk.many rp = kernel_thread_helper;;
1104 mov out0 = r8
1105 br.call.sptk.many rp = sys_exit;;
11061: br.sptk.few 1b // not reached
1107END(start_kernel_thread)
1108
1109#ifdef CONFIG_IA64_BRL_EMU 1096#ifdef CONFIG_IA64_BRL_EMU
1110 1097
1111/* 1098/*
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 35e106f2ed1..31360cbbd5f 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -393,72 +393,24 @@ ia64_load_extra (struct task_struct *task)
393int 393int
394copy_thread(unsigned long clone_flags, 394copy_thread(unsigned long clone_flags,
395 unsigned long user_stack_base, unsigned long user_stack_size, 395 unsigned long user_stack_base, unsigned long user_stack_size,
396 struct task_struct *p, struct pt_regs *regs) 396 struct task_struct *p)
397{ 397{
398 extern char ia64_ret_from_clone; 398 extern char ia64_ret_from_clone;
399 struct switch_stack *child_stack, *stack; 399 struct switch_stack *child_stack, *stack;
400 unsigned long rbs, child_rbs, rbs_size; 400 unsigned long rbs, child_rbs, rbs_size;
401 struct pt_regs *child_ptregs; 401 struct pt_regs *child_ptregs;
402 struct pt_regs *regs = current_pt_regs();
402 int retval = 0; 403 int retval = 0;
403 404
404#ifdef CONFIG_SMP
405 /*
406 * For SMP idle threads, fork_by_hand() calls do_fork with
407 * NULL regs.
408 */
409 if (!regs)
410 return 0;
411#endif
412
413 stack = ((struct switch_stack *) regs) - 1;
414
415 child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1; 405 child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1;
416 child_stack = (struct switch_stack *) child_ptregs - 1; 406 child_stack = (struct switch_stack *) child_ptregs - 1;
417 407
418 /* copy parent's switch_stack & pt_regs to child: */
419 memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack));
420
421 rbs = (unsigned long) current + IA64_RBS_OFFSET; 408 rbs = (unsigned long) current + IA64_RBS_OFFSET;
422 child_rbs = (unsigned long) p + IA64_RBS_OFFSET; 409 child_rbs = (unsigned long) p + IA64_RBS_OFFSET;
423 rbs_size = stack->ar_bspstore - rbs;
424
425 /* copy the parent's register backing store to the child: */
426 memcpy((void *) child_rbs, (void *) rbs, rbs_size);
427
428 if (likely(user_mode(child_ptregs))) {
429 if (clone_flags & CLONE_SETTLS)
430 child_ptregs->r13 = regs->r16; /* see sys_clone2() in entry.S */
431 if (user_stack_base) {
432 child_ptregs->r12 = user_stack_base + user_stack_size - 16;
433 child_ptregs->ar_bspstore = user_stack_base;
434 child_ptregs->ar_rnat = 0;
435 child_ptregs->loadrs = 0;
436 }
437 } else {
438 /*
439 * Note: we simply preserve the relative position of
440 * the stack pointer here. There is no need to
441 * allocate a scratch area here, since that will have
442 * been taken care of by the caller of sys_clone()
443 * already.
444 */
445 child_ptregs->r12 = (unsigned long) child_ptregs - 16; /* kernel sp */
446 child_ptregs->r13 = (unsigned long) p; /* set `current' pointer */
447 }
448 child_stack->ar_bspstore = child_rbs + rbs_size;
449 child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
450 410
451 /* copy parts of thread_struct: */ 411 /* copy parts of thread_struct: */
452 p->thread.ksp = (unsigned long) child_stack - 16; 412 p->thread.ksp = (unsigned long) child_stack - 16;
453 413
454 /* stop some PSR bits from being inherited.
455 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve()
456 * therefore we must specify them explicitly here and not include them in
457 * IA64_PSR_BITS_TO_CLEAR.
458 */
459 child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET)
460 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP));
461
462 /* 414 /*
463 * NOTE: The calling convention considers all floating point 415 * NOTE: The calling convention considers all floating point
464 * registers in the high partition (fph) to be scratch. Since 416 * registers in the high partition (fph) to be scratch. Since
@@ -480,8 +432,66 @@ copy_thread(unsigned long clone_flags,
480# define THREAD_FLAGS_TO_SET 0 432# define THREAD_FLAGS_TO_SET 0
481 p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR) 433 p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR)
482 | THREAD_FLAGS_TO_SET); 434 | THREAD_FLAGS_TO_SET);
435
483 ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */ 436 ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */
484 437
438 if (unlikely(p->flags & PF_KTHREAD)) {
439 if (unlikely(!user_stack_base)) {
440 /* fork_idle() called us */
441 return 0;
442 }
443 memset(child_stack, 0, sizeof(*child_ptregs) + sizeof(*child_stack));
444 child_stack->r4 = user_stack_base; /* payload */
445 child_stack->r5 = user_stack_size; /* argument */
446 /*
447 * Preserve PSR bits, except for bits 32-34 and 37-45,
448 * which we can't read.
449 */
450 child_ptregs->cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN;
451 /* mark as valid, empty frame */
452 child_ptregs->cr_ifs = 1UL << 63;
453 child_stack->ar_fpsr = child_ptregs->ar_fpsr
454 = ia64_getreg(_IA64_REG_AR_FPSR);
455 child_stack->pr = (1 << PRED_KERNEL_STACK);
456 child_stack->ar_bspstore = child_rbs;
457 child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
458
459 /* stop some PSR bits from being inherited.
460 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve()
461 * therefore we must specify them explicitly here and not include them in
462 * IA64_PSR_BITS_TO_CLEAR.
463 */
464 child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET)
465 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP));
466
467 return 0;
468 }
469 stack = ((struct switch_stack *) regs) - 1;
470 /* copy parent's switch_stack & pt_regs to child: */
471 memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack));
472
473 /* copy the parent's register backing store to the child: */
474 rbs_size = stack->ar_bspstore - rbs;
475 memcpy((void *) child_rbs, (void *) rbs, rbs_size);
476 if (clone_flags & CLONE_SETTLS)
477 child_ptregs->r13 = regs->r16; /* see sys_clone2() in entry.S */
478 if (user_stack_base) {
479 child_ptregs->r12 = user_stack_base + user_stack_size - 16;
480 child_ptregs->ar_bspstore = user_stack_base;
481 child_ptregs->ar_rnat = 0;
482 child_ptregs->loadrs = 0;
483 }
484 child_stack->ar_bspstore = child_rbs + rbs_size;
485 child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
486
487 /* stop some PSR bits from being inherited.
488 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve()
489 * therefore we must specify them explicitly here and not include them in
490 * IA64_PSR_BITS_TO_CLEAR.
491 */
492 child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET)
493 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP));
494
485#ifdef CONFIG_PERFMON 495#ifdef CONFIG_PERFMON
486 if (current->thread.pfm_context) 496 if (current->thread.pfm_context)
487 pfm_inherit(p, child_ptregs); 497 pfm_inherit(p, child_ptregs);
@@ -608,57 +618,6 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)
608 return 1; /* f0-f31 are always valid so we always return 1 */ 618 return 1; /* f0-f31 are always valid so we always return 1 */
609} 619}
610 620
611long
612sys_execve (const char __user *filename,
613 const char __user *const __user *argv,
614 const char __user *const __user *envp,
615 struct pt_regs *regs)
616{
617 struct filename *fname;
618 int error;
619
620 fname = getname(filename);
621 error = PTR_ERR(fname);
622 if (IS_ERR(fname))
623 goto out;
624 error = do_execve(fname->name, argv, envp, regs);
625 putname(fname);
626out:
627 return error;
628}
629
630pid_t
631kernel_thread (int (*fn)(void *), void *arg, unsigned long flags)
632{
633 extern void start_kernel_thread (void);
634 unsigned long *helper_fptr = (unsigned long *) &start_kernel_thread;
635 struct {
636 struct switch_stack sw;
637 struct pt_regs pt;
638 } regs;
639
640 memset(&regs, 0, sizeof(regs));
641 regs.pt.cr_iip = helper_fptr[0]; /* set entry point (IP) */
642 regs.pt.r1 = helper_fptr[1]; /* set GP */
643 regs.pt.r9 = (unsigned long) fn; /* 1st argument */
644 regs.pt.r11 = (unsigned long) arg; /* 2nd argument */
645 /* Preserve PSR bits, except for bits 32-34 and 37-45, which we can't read. */
646 regs.pt.cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN;
647 regs.pt.cr_ifs = 1UL << 63; /* mark as valid, empty frame */
648 regs.sw.ar_fpsr = regs.pt.ar_fpsr = ia64_getreg(_IA64_REG_AR_FPSR);
649 regs.sw.ar_bspstore = (unsigned long) current + IA64_RBS_OFFSET;
650 regs.sw.pr = (1 << PRED_KERNEL_STACK);
651 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs.pt, 0, NULL, NULL);
652}
653EXPORT_SYMBOL(kernel_thread);
654
655/* This gets called from kernel_thread() via ia64_invoke_thread_helper(). */
656int
657kernel_thread_helper (int (*fn)(void *), void *arg)
658{
659 return (*fn)(arg);
660}
661
662/* 621/*
663 * Flush thread state. This is called when a thread does an execve(). 622 * Flush thread state. This is called when a thread does an execve().
664 */ 623 */
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 963d2db53bf..6a368cb2043 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -460,11 +460,6 @@ start_secondary (void *unused)
460 return 0; 460 return 0;
461} 461}
462 462
463struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
464{
465 return NULL;
466}
467
468static int __cpuinit 463static int __cpuinit
469do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) 464do_boot_cpu (int sapicid, int cpu, struct task_struct *idle)
470{ 465{
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index f6388216080..b1995efbfd2 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -83,7 +83,7 @@ static struct clocksource *itc_clocksource;
83 83
84extern cputime_t cycle_to_cputime(u64 cyc); 84extern cputime_t cycle_to_cputime(u64 cyc);
85 85
86static void vtime_account_user(struct task_struct *tsk) 86void vtime_account_user(struct task_struct *tsk)
87{ 87{
88 cputime_t delta_utime; 88 cputime_t delta_utime;
89 struct thread_info *ti = task_thread_info(tsk); 89 struct thread_info *ti = task_thread_info(tsk);
@@ -100,18 +100,11 @@ static void vtime_account_user(struct task_struct *tsk)
100 * accumulated times to the current process, and to prepare accounting on 100 * accumulated times to the current process, and to prepare accounting on
101 * the next process. 101 * the next process.
102 */ 102 */
103void vtime_task_switch(struct task_struct *prev) 103void arch_vtime_task_switch(struct task_struct *prev)
104{ 104{
105 struct thread_info *pi = task_thread_info(prev); 105 struct thread_info *pi = task_thread_info(prev);
106 struct thread_info *ni = task_thread_info(current); 106 struct thread_info *ni = task_thread_info(current);
107 107
108 if (idle_task(smp_processor_id()) != prev)
109 vtime_account_system(prev);
110 else
111 vtime_account_idle(prev);
112
113 vtime_account_user(prev);
114
115 pi->ac_stamp = ni->ac_stamp; 108 pi->ac_stamp = ni->ac_stamp;
116 ni->ac_stime = ni->ac_utime = 0; 109 ni->ac_stime = ni->ac_utime = 0;
117} 110}
@@ -126,6 +119,8 @@ static cputime_t vtime_delta(struct task_struct *tsk)
126 cputime_t delta_stime; 119 cputime_t delta_stime;
127 __u64 now; 120 __u64 now;
128 121
122 WARN_ON_ONCE(!irqs_disabled());
123
129 now = ia64_get_itc(); 124 now = ia64_get_itc();
130 125
131 delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); 126 delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp));
@@ -147,15 +142,6 @@ void vtime_account_idle(struct task_struct *tsk)
147 account_idle_time(vtime_delta(tsk)); 142 account_idle_time(vtime_delta(tsk));
148} 143}
149 144
150/*
151 * Called from the timer interrupt handler to charge accumulated user time
152 * to the current process. Must be called with interrupts disabled.
153 */
154void account_process_tick(struct task_struct *p, int user_tick)
155{
156 vtime_account_user(p);
157}
158
159#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 145#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
160 146
161static irqreturn_t 147static irqreturn_t
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index c64460b9c70..dc00b2c1b42 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -275,7 +275,7 @@ static struct attribute * cache_default_attrs[] = {
275#define to_object(k) container_of(k, struct cache_info, kobj) 275#define to_object(k) container_of(k, struct cache_info, kobj)
276#define to_attr(a) container_of(a, struct cache_attr, attr) 276#define to_attr(a) container_of(a, struct cache_attr, attr)
277 277
278static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char * buf) 278static ssize_t ia64_cache_show(struct kobject * kobj, struct attribute * attr, char * buf)
279{ 279{
280 struct cache_attr *fattr = to_attr(attr); 280 struct cache_attr *fattr = to_attr(attr);
281 struct cache_info *this_leaf = to_object(kobj); 281 struct cache_info *this_leaf = to_object(kobj);
@@ -286,7 +286,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char *
286} 286}
287 287
288static const struct sysfs_ops cache_sysfs_ops = { 288static const struct sysfs_ops cache_sysfs_ops = {
289 .show = cache_show 289 .show = ia64_cache_show
290}; 290};
291 291
292static struct kobj_type cache_ktype = { 292static struct kobj_type cache_ktype = {
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 8b3a9c0e771..bd1c5155503 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * kvm_ia64.c: Basic KVM suppport On Itanium series processors 2 * kvm_ia64.c: Basic KVM support On Itanium series processors
3 * 3 *
4 * 4 *
5 * Copyright (C) 2007, Intel Corporation. 5 * Copyright (C) 2007, Intel Corporation.
@@ -1330,6 +1330,11 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
1330 return 0; 1330 return 0;
1331} 1331}
1332 1332
1333int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
1334{
1335 return 0;
1336}
1337
1333int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 1338int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
1334{ 1339{
1335 return -EINVAL; 1340 return -EINVAL;
@@ -1362,11 +1367,9 @@ static void kvm_release_vm_pages(struct kvm *kvm)
1362 struct kvm_memslots *slots; 1367 struct kvm_memslots *slots;
1363 struct kvm_memory_slot *memslot; 1368 struct kvm_memory_slot *memslot;
1364 int j; 1369 int j;
1365 unsigned long base_gfn;
1366 1370
1367 slots = kvm_memslots(kvm); 1371 slots = kvm_memslots(kvm);
1368 kvm_for_each_memslot(memslot, slots) { 1372 kvm_for_each_memslot(memslot, slots) {
1369 base_gfn = memslot->base_gfn;
1370 for (j = 0; j < memslot->npages; j++) { 1373 for (j = 0; j < memslot->npages; j++) {
1371 if (memslot->rmap[j]) 1374 if (memslot->rmap[j])
1372 put_page((struct page *)memslot->rmap[j]); 1375 put_page((struct page *)memslot->rmap[j]);
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index f807721e19a..5183f43a2cf 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -15,6 +15,8 @@ config M32R
15 select GENERIC_ATOMIC64 15 select GENERIC_ATOMIC64
16 select ARCH_USES_GETTIMEOFFSET 16 select ARCH_USES_GETTIMEOFFSET
17 select MODULES_USE_ELF_RELA 17 select MODULES_USE_ELF_RELA
18 select GENERIC_KERNEL_THREAD
19 select GENERIC_KERNEL_EXECVE
18 20
19config SBUS 21config SBUS
20 bool 22 bool
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index 50bbf387b2f..4bc8ae73e08 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -3,3 +3,4 @@ include include/asm-generic/Kbuild.asm
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += module.h 5generic-y += module.h
6generic-y += trace_clock.h
diff --git a/arch/m32r/include/asm/processor.h b/arch/m32r/include/asm/processor.h
index da17253b573..5767367550c 100644
--- a/arch/m32r/include/asm/processor.h
+++ b/arch/m32r/include/asm/processor.h
@@ -118,11 +118,6 @@ struct mm_struct;
118/* Free all resources held by a thread. */ 118/* Free all resources held by a thread. */
119extern void release_thread(struct task_struct *); 119extern void release_thread(struct task_struct *);
120 120
121/*
122 * create a kernel thread without removing it from tasklists
123 */
124extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
125
126/* Copy and release all segment info associated with a VM */ 121/* Copy and release all segment info associated with a VM */
127extern void copy_segments(struct task_struct *p, struct mm_struct * mm); 122extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
128extern void release_segments(struct mm_struct * mm); 123extern void release_segments(struct mm_struct * mm);
diff --git a/arch/m32r/include/asm/ptrace.h b/arch/m32r/include/asm/ptrace.h
index 4313aa62b51..c4432f1fb2c 100644
--- a/arch/m32r/include/asm/ptrace.h
+++ b/arch/m32r/include/asm/ptrace.h
@@ -139,6 +139,8 @@ extern void withdraw_debug_trap(struct pt_regs *regs);
139 139
140#define task_pt_regs(task) \ 140#define task_pt_regs(task) \
141 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) 141 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
142#define current_pt_regs() ((struct pt_regs *) \
143 ((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
142 144
143#endif /* __KERNEL */ 145#endif /* __KERNEL */
144 146
diff --git a/arch/m32r/include/asm/signal.h b/arch/m32r/include/asm/signal.h
index ea5f95e4079..e4d2e2ad5f1 100644
--- a/arch/m32r/include/asm/signal.h
+++ b/arch/m32r/include/asm/signal.h
@@ -149,10 +149,6 @@ typedef struct sigaltstack {
149 149
150#undef __HAVE_ARCH_SIG_BITOPS 150#undef __HAVE_ARCH_SIG_BITOPS
151 151
152struct pt_regs;
153
154#define ptrace_signal_deliver(regs, cookie) do { } while (0)
155
156#endif /* __KERNEL__ */ 152#endif /* __KERNEL__ */
157 153
158#endif /* _ASM_M32R_SIGNAL_H */ 154#endif /* _ASM_M32R_SIGNAL_H */
diff --git a/arch/m32r/include/asm/socket.h b/arch/m32r/include/asm/socket.h
index a15f40b5278..5e7088a2672 100644
--- a/arch/m32r/include/asm/socket.h
+++ b/arch/m32r/include/asm/socket.h
@@ -40,6 +40,7 @@
40/* Socket filtering */ 40/* Socket filtering */
41#define SO_ATTACH_FILTER 26 41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27 42#define SO_DETACH_FILTER 27
43#define SO_GET_FILTER SO_ATTACH_FILTER
43 44
44#define SO_PEERNAME 28 45#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29 46#define SO_TIMESTAMP 29
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h
index d5e66a48078..d9e7351af2a 100644
--- a/arch/m32r/include/asm/unistd.h
+++ b/arch/m32r/include/asm/unistd.h
@@ -352,6 +352,10 @@
352#define __ARCH_WANT_SYS_OLDUMOUNT 352#define __ARCH_WANT_SYS_OLDUMOUNT
353#define __ARCH_WANT_SYS_RT_SIGACTION 353#define __ARCH_WANT_SYS_RT_SIGACTION
354#define __ARCH_WANT_SYS_RT_SIGSUSPEND 354#define __ARCH_WANT_SYS_RT_SIGSUSPEND
355#define __ARCH_WANT_SYS_EXECVE
356#define __ARCH_WANT_SYS_CLONE
357#define __ARCH_WANT_SYS_FORK
358#define __ARCH_WANT_SYS_VFORK
355 359
356#define __IGNORE_lchown 360#define __IGNORE_lchown
357#define __IGNORE_setuid 361#define __IGNORE_setuid
diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S
index 225412bc227..0c01543f10c 100644
--- a/arch/m32r/kernel/entry.S
+++ b/arch/m32r/kernel/entry.S
@@ -125,6 +125,15 @@
125 and \reg, sp 125 and \reg, sp
126 .endm 126 .endm
127 127
128ENTRY(ret_from_kernel_thread)
129 pop r0
130 bl schedule_tail
131 GET_THREAD_INFO(r8)
132 ld r0, R0(r8)
133 ld r1, R1(r8)
134 jl r1
135 bra syscall_exit
136
128ENTRY(ret_from_fork) 137ENTRY(ret_from_fork)
129 pop r0 138 pop r0
130 bl schedule_tail 139 bl schedule_tail
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index 700570747a9..b727e693c80 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -21,7 +21,6 @@ EXPORT_SYMBOL(boot_cpu_data);
21EXPORT_SYMBOL(dump_fpu); 21EXPORT_SYMBOL(dump_fpu);
22EXPORT_SYMBOL(__ioremap); 22EXPORT_SYMBOL(__ioremap);
23EXPORT_SYMBOL(iounmap); 23EXPORT_SYMBOL(iounmap);
24EXPORT_SYMBOL(kernel_thread);
25 24
26EXPORT_SYMBOL(strncpy_from_user); 25EXPORT_SYMBOL(strncpy_from_user);
27EXPORT_SYMBOL(__strncpy_from_user); 26EXPORT_SYMBOL(__strncpy_from_user);
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index e7366276ef3..765d0f57c78 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -165,41 +165,6 @@ void show_regs(struct pt_regs * regs)
165} 165}
166 166
167/* 167/*
168 * Create a kernel thread
169 */
170
171/*
172 * This is the mechanism for creating a new kernel thread.
173 *
174 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
175 * who haven't done an "execve()") should use this: it will work within
176 * a system call from a "real" process, but the process memory space will
177 * not be free'd until both the parent and the child have exited.
178 */
179static void kernel_thread_helper(void *nouse, int (*fn)(void *), void *arg)
180{
181 fn(arg);
182 do_exit(-1);
183}
184
185int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
186{
187 struct pt_regs regs;
188
189 memset(&regs, 0, sizeof (regs));
190 regs.r1 = (unsigned long)fn;
191 regs.r2 = (unsigned long)arg;
192
193 regs.bpc = (unsigned long)kernel_thread_helper;
194
195 regs.psw = M32R_PSW_BIE;
196
197 /* Ok, create the new process. */
198 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL,
199 NULL);
200}
201
202/*
203 * Free current thread data structures etc.. 168 * Free current thread data structures etc..
204 */ 169 */
205void exit_thread(void) 170void exit_thread(void)
@@ -227,88 +192,31 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
227} 192}
228 193
229int copy_thread(unsigned long clone_flags, unsigned long spu, 194int copy_thread(unsigned long clone_flags, unsigned long spu,
230 unsigned long unused, struct task_struct *tsk, struct pt_regs *regs) 195 unsigned long arg, struct task_struct *tsk)
231{ 196{
232 struct pt_regs *childregs = task_pt_regs(tsk); 197 struct pt_regs *childregs = task_pt_regs(tsk);
233 extern void ret_from_fork(void); 198 extern void ret_from_fork(void);
234 199 extern void ret_from_kernel_thread(void);
235 /* Copy registers */ 200
236 *childregs = *regs; 201 if (unlikely(tsk->flags & PF_KTHREAD)) {
237 202 memset(childregs, 0, sizeof(struct pt_regs));
238 childregs->spu = spu; 203 childregs->psw = M32R_PSW_BIE;
239 childregs->r0 = 0; /* Child gets zero as return value */ 204 childregs->r1 = spu; /* fn */
240 regs->r0 = tsk->pid; 205 childregs->r0 = arg;
206 tsk->thread.lr = (unsigned long)ret_from_kernel_thread;
207 } else {
208 /* Copy registers */
209 *childregs = *current_pt_regs();
210 if (spu)
211 childregs->spu = spu;
212 childregs->r0 = 0; /* Child gets zero as return value */
213 tsk->thread.lr = (unsigned long)ret_from_fork;
214 }
241 tsk->thread.sp = (unsigned long)childregs; 215 tsk->thread.sp = (unsigned long)childregs;
242 tsk->thread.lr = (unsigned long)ret_from_fork;
243 216
244 return 0; 217 return 0;
245} 218}
246 219
247asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2,
248 unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6,
249 struct pt_regs regs)
250{
251#ifdef CONFIG_MMU
252 return do_fork(SIGCHLD, regs.spu, &regs, 0, NULL, NULL);
253#else
254 return -EINVAL;
255#endif /* CONFIG_MMU */
256}
257
258asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
259 unsigned long parent_tidptr,
260 unsigned long child_tidptr,
261 unsigned long r4, unsigned long r5, unsigned long r6,
262 struct pt_regs regs)
263{
264 if (!newsp)
265 newsp = regs.spu;
266
267 return do_fork(clone_flags, newsp, &regs, 0,
268 (int __user *)parent_tidptr, (int __user *)child_tidptr);
269}
270
271/*
272 * This is trivial, and on the face of it looks like it
273 * could equally well be done in user mode.
274 *
275 * Not so, for quite unobvious reasons - register pressure.
276 * In user mode vfork() cannot have a stack frame, and if
277 * done by calling the "clone()" system call directly, you
278 * do not have enough call-clobbered registers to hold all
279 * the information you need.
280 */
281asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2,
282 unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6,
283 struct pt_regs regs)
284{
285 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.spu, &regs, 0,
286 NULL, NULL);
287}
288
289/*
290 * sys_execve() executes a new program.
291 */
292asmlinkage int sys_execve(const char __user *ufilename,
293 const char __user *const __user *uargv,
294 const char __user *const __user *uenvp,
295 unsigned long r3, unsigned long r4, unsigned long r5,
296 unsigned long r6, struct pt_regs regs)
297{
298 int error;
299 struct filename *filename;
300
301 filename = getname(ufilename);
302 error = PTR_ERR(filename);
303 if (IS_ERR(filename))
304 goto out;
305
306 error = do_execve(filename->name, uargv, uenvp, &regs);
307 putname(filename);
308out:
309 return error;
310}
311
312/* 220/*
313 * These bracket the sleeping functions.. 221 * These bracket the sleeping functions..
314 */ 222 */
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index d841fb6cc70..c3fdd632fba 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -88,24 +88,3 @@ asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
88 /* Not implemented yet. */ 88 /* Not implemented yet. */
89 return -ENOSYS; 89 return -ENOSYS;
90} 90}
91
92/*
93 * Do a system call from kernel instead of calling sys_execve so we
94 * end up with proper pt_regs.
95 */
96int kernel_execve(const char *filename,
97 const char *const argv[],
98 const char *const envp[])
99{
100 register long __scno __asm__ ("r7") = __NR_execve;
101 register long __arg3 __asm__ ("r2") = (long)(envp);
102 register long __arg2 __asm__ ("r1") = (long)(argv);
103 register long __res __asm__ ("r0") = (long)(filename);
104 __asm__ __volatile__ (
105 "trap #" SYSCALL_VECTOR "|| nop"
106 : "=r" (__res)
107 : "r" (__scno), "0" (__res), "r" (__arg2),
108 "r" (__arg3)
109 : "memory");
110 return __res;
111}
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index e7c161433ea..953a7ba5d05 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -16,6 +16,7 @@ config M68K
16 select ARCH_WANT_IPC_PARSE_VERSION 16 select ARCH_WANT_IPC_PARSE_VERSION
17 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE 17 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
18 select GENERIC_KERNEL_THREAD 18 select GENERIC_KERNEL_THREAD
19 select GENERIC_KERNEL_EXECVE
19 select HAVE_MOD_ARCH_SPECIFIC 20 select HAVE_MOD_ARCH_SPECIFIC
20 select MODULES_USE_ELF_REL 21 select MODULES_USE_ELF_REL
21 select MODULES_USE_ELF_RELA 22 select MODULES_USE_ELF_RELA
diff --git a/arch/m68k/Kconfig.bus b/arch/m68k/Kconfig.bus
index ffc0601a2a1..93ef0346b20 100644
--- a/arch/m68k/Kconfig.bus
+++ b/arch/m68k/Kconfig.bus
@@ -28,8 +28,8 @@ config ZORRO
28 Linux use these. 28 Linux use these.
29 29
30config AMIGA_PCMCIA 30config AMIGA_PCMCIA
31 bool "Amiga 1200/600 PCMCIA support (EXPERIMENTAL)" 31 bool "Amiga 1200/600 PCMCIA support"
32 depends on AMIGA && EXPERIMENTAL 32 depends on AMIGA
33 help 33 help
34 Include support in the kernel for pcmcia on Amiga 1200 and Amiga 34 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
35 600. If you intend to use pcmcia cards say Y; otherwise say N. 35 600. If you intend to use pcmcia cards say Y; otherwise say N.
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index c4eb79edece..2f2d87b4034 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -274,9 +274,8 @@ endif # COLDFIRE
274comment "Processor Specific Options" 274comment "Processor Specific Options"
275 275
276config M68KFPU_EMU 276config M68KFPU_EMU
277 bool "Math emulation support (EXPERIMENTAL)" 277 bool "Math emulation support"
278 depends on MMU 278 depends on MMU
279 depends on EXPERIMENTAL
280 help 279 help
281 At some point in the future, this will cause floating-point math 280 At some point in the future, this will cause floating-point math
282 instructions to be emulated by the kernel on machines that lack a 281 instructions to be emulated by the kernel on machines that lack a
diff --git a/arch/m68k/Kconfig.debug b/arch/m68k/Kconfig.debug
index 87233acef18..fa12283d58f 100644
--- a/arch/m68k/Kconfig.debug
+++ b/arch/m68k/Kconfig.debug
@@ -41,7 +41,7 @@ config NO_KERNEL_MSG
41 41
42config BDM_DISABLE 42config BDM_DISABLE
43 bool "Disable BDM signals" 43 bool "Disable BDM signals"
44 depends on (EXPERIMENTAL && COLDFIRE) 44 depends on COLDFIRE
45 help 45 help
46 Disable the ColdFire CPU's BDM signals. 46 Disable the ColdFire CPU's BDM signals.
47 47
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
index 04a3d9be90e..c4cdfe444c6 100644
--- a/arch/m68k/Kconfig.devices
+++ b/arch/m68k/Kconfig.devices
@@ -60,8 +60,8 @@ endmenu
60menu "Character devices" 60menu "Character devices"
61 61
62config ATARI_DSP56K 62config ATARI_DSP56K
63 tristate "Atari DSP56k support (EXPERIMENTAL)" 63 tristate "Atari DSP56k support"
64 depends on ATARI && EXPERIMENTAL 64 depends on ATARI
65 help 65 help
66 If you want to be able to use the DSP56001 in Falcons, say Y. This 66 If you want to be able to use the DSP56001 in Falcons, say Y. This
67 driver is still experimental, and if you don't know what it is, or 67 driver is still experimental, and if you don't know what it is, or
@@ -87,7 +87,7 @@ config HPDCA
87 87
88config HPAPCI 88config HPAPCI
89 tristate "HP APCI serial support" 89 tristate "HP APCI serial support"
90 depends on HP300 && SERIAL_8250 && EXPERIMENTAL 90 depends on HP300 && SERIAL_8250
91 help 91 help
92 If you want to use the internal "APCI" serial ports on an HP400 92 If you want to use the internal "APCI" serial ports on an HP400
93 machine, say Y here. 93 machine, say Y here.
diff --git a/arch/m68k/emu/nfcon.c b/arch/m68k/emu/nfcon.c
index 16d170f53bf..6685bf45c2c 100644
--- a/arch/m68k/emu/nfcon.c
+++ b/arch/m68k/emu/nfcon.c
@@ -120,8 +120,6 @@ static int __init nfcon_init(void)
120{ 120{
121 int res; 121 int res;
122 122
123 tty_port_init(&nfcon_tty_port);
124
125 stderr_id = nf_get_id("NF_STDERR"); 123 stderr_id = nf_get_id("NF_STDERR");
126 if (!stderr_id) 124 if (!stderr_id)
127 return -ENODEV; 125 return -ENODEV;
@@ -130,6 +128,8 @@ static int __init nfcon_init(void)
130 if (!nfcon_tty_driver) 128 if (!nfcon_tty_driver)
131 return -ENOMEM; 129 return -ENOMEM;
132 130
131 tty_port_init(&nfcon_tty_port);
132
133 nfcon_tty_driver->driver_name = "nfcon"; 133 nfcon_tty_driver->driver_name = "nfcon";
134 nfcon_tty_driver->name = "nfcon"; 134 nfcon_tty_driver->name = "nfcon";
135 nfcon_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM; 135 nfcon_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;
@@ -143,6 +143,7 @@ static int __init nfcon_init(void)
143 if (res) { 143 if (res) {
144 pr_err("failed to register nfcon tty driver\n"); 144 pr_err("failed to register nfcon tty driver\n");
145 put_tty_driver(nfcon_tty_driver); 145 put_tty_driver(nfcon_tty_driver);
146 tty_port_destroy(&nfcon_tty_port);
146 return res; 147 return res;
147 } 148 }
148 149
@@ -157,6 +158,7 @@ static void __exit nfcon_exit(void)
157 unregister_console(&nf_console); 158 unregister_console(&nf_console);
158 tty_unregister_driver(nfcon_tty_driver); 159 tty_unregister_driver(nfcon_tty_driver);
159 put_tty_driver(nfcon_tty_driver); 160 put_tty_driver(nfcon_tty_driver);
161 tty_port_destroy(&nfcon_tty_port);
160} 162}
161 163
162module_init(nfcon_init); 164module_init(nfcon_init);
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 88fa3ac86fa..c7933e41f10 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -7,6 +7,7 @@ generic-y += emergency-restart.h
7generic-y += errno.h 7generic-y += errno.h
8generic-y += exec.h 8generic-y += exec.h
9generic-y += futex.h 9generic-y += futex.h
10generic-y += hw_irq.h
10generic-y += ioctl.h 11generic-y += ioctl.h
11generic-y += ipcbuf.h 12generic-y += ipcbuf.h
12generic-y += irq_regs.h 13generic-y += irq_regs.h
@@ -21,9 +22,13 @@ generic-y += percpu.h
21generic-y += resource.h 22generic-y += resource.h
22generic-y += scatterlist.h 23generic-y += scatterlist.h
23generic-y += sections.h 24generic-y += sections.h
25generic-y += shmparam.h
24generic-y += siginfo.h 26generic-y += siginfo.h
27generic-y += spinlock.h
25generic-y += statfs.h 28generic-y += statfs.h
29generic-y += termios.h
26generic-y += topology.h 30generic-y += topology.h
31generic-y += trace_clock.h
27generic-y += types.h 32generic-y += types.h
28generic-y += word-at-a-time.h 33generic-y += word-at-a-time.h
29generic-y += xor.h 34generic-y += xor.h
diff --git a/arch/m68k/include/asm/hw_irq.h b/arch/m68k/include/asm/hw_irq.h
deleted file mode 100644
index eacef0951fb..00000000000
--- a/arch/m68k/include/asm/hw_irq.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_M68K_HW_IRQ_H
2#define __ASM_M68K_HW_IRQ_H
3
4/* Dummy include. */
5
6#endif
diff --git a/arch/m68k/include/asm/shmparam.h b/arch/m68k/include/asm/shmparam.h
deleted file mode 100644
index 558892a2efb..00000000000
--- a/arch/m68k/include/asm/shmparam.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68K_SHMPARAM_H
2#define _M68K_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _M68K_SHMPARAM_H */
diff --git a/arch/m68k/include/asm/signal.h b/arch/m68k/include/asm/signal.h
index 2df26b57c26..9c8c46b06b0 100644
--- a/arch/m68k/include/asm/signal.h
+++ b/arch/m68k/include/asm/signal.h
@@ -86,11 +86,9 @@ static inline int sigfindinword(unsigned long word)
86 86
87#endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */ 87#endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */
88 88
89#ifdef __uClinux__ 89#ifndef __uClinux__
90#define ptrace_signal_deliver(regs, cookie) do { } while (0) 90extern void ptrace_signal_deliver(void);
91#else 91#define ptrace_signal_deliver ptrace_signal_deliver
92struct pt_regs;
93extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
94#endif /* __uClinux__ */ 92#endif /* __uClinux__ */
95 93
96#endif /* _M68K_SIGNAL_H */ 94#endif /* _M68K_SIGNAL_H */
diff --git a/arch/m68k/include/asm/spinlock.h b/arch/m68k/include/asm/spinlock.h
deleted file mode 100644
index 20f46e27b53..00000000000
--- a/arch/m68k/include/asm/spinlock.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __M68K_SPINLOCK_H
2#define __M68K_SPINLOCK_H
3
4#error "m68k doesn't do SMP yet"
5
6#endif
diff --git a/arch/m68k/include/asm/termios.h b/arch/m68k/include/asm/termios.h
deleted file mode 100644
index ad8efb09866..00000000000
--- a/arch/m68k/include/asm/termios.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef _M68K_TERMIOS_H
2#define _M68K_TERMIOS_H
3
4#include <uapi/asm/termios.h>
5
6/* intr=^C quit=^| erase=del kill=^U
7 eof=^D vtime=\0 vmin=\1 sxtc=\0
8 start=^Q stop=^S susp=^Z eol=\0
9 reprint=^R discard=^U werase=^W lnext=^V
10 eol2=\0
11*/
12#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
13
14/*
15 * Translate a "termio" structure into a "termios". Ugh.
16 */
17#define user_termio_to_kernel_termios(termios, termio) \
18({ \
19 unsigned short tmp; \
20 get_user(tmp, &(termio)->c_iflag); \
21 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
22 get_user(tmp, &(termio)->c_oflag); \
23 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
24 get_user(tmp, &(termio)->c_cflag); \
25 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
26 get_user(tmp, &(termio)->c_lflag); \
27 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
28 get_user((termios)->c_line, &(termio)->c_line); \
29 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
30})
31
32/*
33 * Translate a "termios" structure into a "termio". Ugh.
34 */
35#define kernel_termios_to_user_termio(termio, termios) \
36({ \
37 put_user((termios)->c_iflag, &(termio)->c_iflag); \
38 put_user((termios)->c_oflag, &(termio)->c_oflag); \
39 put_user((termios)->c_cflag, &(termio)->c_cflag); \
40 put_user((termios)->c_lflag, &(termio)->c_lflag); \
41 put_user((termios)->c_line, &(termio)->c_line); \
42 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
43})
44
45#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
46#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
47#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
48#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
49
50#endif /* _M68K_TERMIOS_H */
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 5fc7f7bec1c..a021d67cdd7 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -32,7 +32,8 @@
32#define __ARCH_WANT_SYS_RT_SIGACTION 32#define __ARCH_WANT_SYS_RT_SIGACTION
33#define __ARCH_WANT_SYS_RT_SIGSUSPEND 33#define __ARCH_WANT_SYS_RT_SIGSUSPEND
34#define __ARCH_WANT_SYS_EXECVE 34#define __ARCH_WANT_SYS_EXECVE
35#define __ARCH_WANT_KERNEL_EXECVE 35#define __ARCH_WANT_SYS_FORK
36#define __ARCH_WANT_SYS_VFORK
36 37
37/* 38/*
38 * "Conditional" syscalls 39 * "Conditional" syscalls
diff --git a/arch/m68k/include/uapi/asm/Kbuild b/arch/m68k/include/uapi/asm/Kbuild
index 972bce120e1..1fef45ada09 100644
--- a/arch/m68k/include/uapi/asm/Kbuild
+++ b/arch/m68k/include/uapi/asm/Kbuild
@@ -1,26 +1,27 @@
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 += auxvec.h
5generic-y += msgbuf.h
6generic-y += sembuf.h
7generic-y += shmbuf.h
8generic-y += socket.h
9generic-y += sockios.h
10generic-y += termbits.h
11generic-y += termios.h
12
4header-y += a.out.h 13header-y += a.out.h
5header-y += auxvec.h
6header-y += byteorder.h 14header-y += byteorder.h
7header-y += cachectl.h 15header-y += cachectl.h
8header-y += fcntl.h 16header-y += fcntl.h
9header-y += ioctls.h 17header-y += ioctls.h
10header-y += msgbuf.h
11header-y += param.h 18header-y += param.h
12header-y += poll.h 19header-y += poll.h
13header-y += posix_types.h 20header-y += posix_types.h
14header-y += ptrace.h 21header-y += ptrace.h
15header-y += sembuf.h
16header-y += setup.h 22header-y += setup.h
17header-y += shmbuf.h
18header-y += sigcontext.h 23header-y += sigcontext.h
19header-y += signal.h 24header-y += signal.h
20header-y += socket.h
21header-y += sockios.h
22header-y += stat.h 25header-y += stat.h
23header-y += swab.h 26header-y += swab.h
24header-y += termbits.h
25header-y += termios.h
26header-y += unistd.h 27header-y += unistd.h
diff --git a/arch/m68k/include/uapi/asm/auxvec.h b/arch/m68k/include/uapi/asm/auxvec.h
deleted file mode 100644
index 844d6d52204..00000000000
--- a/arch/m68k/include/uapi/asm/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASMm68k_AUXVEC_H
2#define __ASMm68k_AUXVEC_H
3
4#endif
diff --git a/arch/m68k/include/uapi/asm/msgbuf.h b/arch/m68k/include/uapi/asm/msgbuf.h
deleted file mode 100644
index 243cb798de8..00000000000
--- a/arch/m68k/include/uapi/asm/msgbuf.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _M68K_MSGBUF_H
2#define _M68K_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _M68K_MSGBUF_H */
diff --git a/arch/m68k/include/uapi/asm/sembuf.h b/arch/m68k/include/uapi/asm/sembuf.h
deleted file mode 100644
index 2308052a8c2..00000000000
--- a/arch/m68k/include/uapi/asm/sembuf.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _M68K_SEMBUF_H
2#define _M68K_SEMBUF_H
3
4/*
5 * The semid64_ds structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _M68K_SEMBUF_H */
diff --git a/arch/m68k/include/uapi/asm/shmbuf.h b/arch/m68k/include/uapi/asm/shmbuf.h
deleted file mode 100644
index f8928d62f1b..00000000000
--- a/arch/m68k/include/uapi/asm/shmbuf.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _M68K_SHMBUF_H
2#define _M68K_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _M68K_SHMBUF_H */
diff --git a/arch/m68k/include/uapi/asm/socket.h b/arch/m68k/include/uapi/asm/socket.h
deleted file mode 100644
index d1be684edf9..00000000000
--- a/arch/m68k/include/uapi/asm/socket.h
+++ /dev/null
@@ -1,72 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
60#define SO_PROTOCOL 38
61#define SO_DOMAIN 39
62
63#define SO_RXQ_OVFL 40
64
65#define SO_WIFI_STATUS 41
66#define SCM_WIFI_STATUS SO_WIFI_STATUS
67#define SO_PEEK_OFF 42
68
69/* Instruct lower device to use last 4-bytes of skb data as FCS */
70#define SO_NOFCS 43
71
72#endif /* _ASM_SOCKET_H */
diff --git a/arch/m68k/include/uapi/asm/sockios.h b/arch/m68k/include/uapi/asm/sockios.h
deleted file mode 100644
index c04a23943cb..00000000000
--- a/arch/m68k/include/uapi/asm/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ARCH_M68K_SOCKIOS__
2#define __ARCH_M68K_SOCKIOS__
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* __ARCH_M68K_SOCKIOS__ */
diff --git a/arch/m68k/include/uapi/asm/termbits.h b/arch/m68k/include/uapi/asm/termbits.h
deleted file mode 100644
index aea1e37b765..00000000000
--- a/arch/m68k/include/uapi/asm/termbits.h
+++ /dev/null
@@ -1,201 +0,0 @@
1#ifndef __ARCH_M68K_TERMBITS_H__
2#define __ARCH_M68K_TERMBITS_H__
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61
62/* c_iflag bits */
63#define IGNBRK 0000001
64#define BRKINT 0000002
65#define IGNPAR 0000004
66#define PARMRK 0000010
67#define INPCK 0000020
68#define ISTRIP 0000040
69#define INLCR 0000100
70#define IGNCR 0000200
71#define ICRNL 0000400
72#define IUCLC 0001000
73#define IXON 0002000
74#define IXANY 0004000
75#define IXOFF 0010000
76#define IMAXBEL 0020000
77#define IUTF8 0040000
78
79/* c_oflag bits */
80#define OPOST 0000001
81#define OLCUC 0000002
82#define ONLCR 0000004
83#define OCRNL 0000010
84#define ONOCR 0000020
85#define ONLRET 0000040
86#define OFILL 0000100
87#define OFDEL 0000200
88#define NLDLY 0000400
89#define NL0 0000000
90#define NL1 0000400
91#define CRDLY 0003000
92#define CR0 0000000
93#define CR1 0001000
94#define CR2 0002000
95#define CR3 0003000
96#define TABDLY 0014000
97#define TAB0 0000000
98#define TAB1 0004000
99#define TAB2 0010000
100#define TAB3 0014000
101#define XTABS 0014000
102#define BSDLY 0020000
103#define BS0 0000000
104#define BS1 0020000
105#define VTDLY 0040000
106#define VT0 0000000
107#define VT1 0040000
108#define FFDLY 0100000
109#define FF0 0000000
110#define FF1 0100000
111
112/* c_cflag bit meaning */
113#define CBAUD 0010017
114#define B0 0000000 /* hang up */
115#define B50 0000001
116#define B75 0000002
117#define B110 0000003
118#define B134 0000004
119#define B150 0000005
120#define B200 0000006
121#define B300 0000007
122#define B600 0000010
123#define B1200 0000011
124#define B1800 0000012
125#define B2400 0000013
126#define B4800 0000014
127#define B9600 0000015
128#define B19200 0000016
129#define B38400 0000017
130#define EXTA B19200
131#define EXTB B38400
132#define CSIZE 0000060
133#define CS5 0000000
134#define CS6 0000020
135#define CS7 0000040
136#define CS8 0000060
137#define CSTOPB 0000100
138#define CREAD 0000200
139#define PARENB 0000400
140#define PARODD 0001000
141#define HUPCL 0002000
142#define CLOCAL 0004000
143#define CBAUDEX 0010000
144#define BOTHER 0010000
145#define B57600 0010001
146#define B115200 0010002
147#define B230400 0010003
148#define B460800 0010004
149#define B500000 0010005
150#define B576000 0010006
151#define B921600 0010007
152#define B1000000 0010010
153#define B1152000 0010011
154#define B1500000 0010012
155#define B2000000 0010013
156#define B2500000 0010014
157#define B3000000 0010015
158#define B3500000 0010016
159#define B4000000 0010017
160#define CIBAUD 002003600000 /* input baud rate */
161#define CMSPAR 010000000000 /* mark or space (stick) parity */
162#define CRTSCTS 020000000000 /* flow control */
163
164#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
165
166/* c_lflag bits */
167#define ISIG 0000001
168#define ICANON 0000002
169#define XCASE 0000004
170#define ECHO 0000010
171#define ECHOE 0000020
172#define ECHOK 0000040
173#define ECHONL 0000100
174#define NOFLSH 0000200
175#define TOSTOP 0000400
176#define ECHOCTL 0001000
177#define ECHOPRT 0002000
178#define ECHOKE 0004000
179#define FLUSHO 0010000
180#define PENDIN 0040000
181#define IEXTEN 0100000
182#define EXTPROC 0200000
183
184
185/* tcflow() and TCXONC use these */
186#define TCOOFF 0
187#define TCOON 1
188#define TCIOFF 2
189#define TCION 3
190
191/* tcflush() and TCFLSH use these */
192#define TCIFLUSH 0
193#define TCOFLUSH 1
194#define TCIOFLUSH 2
195
196/* tcsetattr uses these */
197#define TCSANOW 0
198#define TCSADRAIN 1
199#define TCSAFLUSH 2
200
201#endif /* __ARCH_M68K_TERMBITS_H__ */
diff --git a/arch/m68k/include/uapi/asm/termios.h b/arch/m68k/include/uapi/asm/termios.h
deleted file mode 100644
index ce2142c9ac1..00000000000
--- a/arch/m68k/include/uapi/asm/termios.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _UAPI_M68K_TERMIOS_H
2#define _UAPI_M68K_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24
25/* modem lines */
26#define TIOCM_LE 0x001
27#define TIOCM_DTR 0x002
28#define TIOCM_RTS 0x004
29#define TIOCM_ST 0x008
30#define TIOCM_SR 0x010
31#define TIOCM_CTS 0x020
32#define TIOCM_CAR 0x040
33#define TIOCM_RNG 0x080
34#define TIOCM_DSR 0x100
35#define TIOCM_CD TIOCM_CAR
36#define TIOCM_RI TIOCM_RNG
37#define TIOCM_OUT1 0x2000
38#define TIOCM_OUT2 0x4000
39#define TIOCM_LOOP 0x8000
40
41/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
42
43
44#endif /* _UAPI_M68K_TERMIOS_H */
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 946cb018775..a78f5649e8d 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -44,34 +44,29 @@
44 44
45.globl system_call, buserr, trap, resume 45.globl system_call, buserr, trap, resume
46.globl sys_call_table 46.globl sys_call_table
47.globl sys_fork, sys_clone, sys_vfork 47.globl __sys_fork, __sys_clone, __sys_vfork
48.globl ret_from_interrupt, bad_interrupt 48.globl ret_from_interrupt, bad_interrupt
49.globl auto_irqhandler_fixup 49.globl auto_irqhandler_fixup
50.globl user_irqvec_fixup 50.globl user_irqvec_fixup
51 51
52.text 52.text
53ENTRY(sys_fork) 53ENTRY(__sys_fork)
54 SAVE_SWITCH_STACK 54 SAVE_SWITCH_STACK
55 pea %sp@(SWITCH_STACK_SIZE) 55 jbsr sys_fork
56 jbsr m68k_fork 56 lea %sp@(24),%sp
57 addql #4,%sp
58 RESTORE_SWITCH_STACK
59 rts 57 rts
60 58
61ENTRY(sys_clone) 59ENTRY(__sys_clone)
62 SAVE_SWITCH_STACK 60 SAVE_SWITCH_STACK
63 pea %sp@(SWITCH_STACK_SIZE) 61 pea %sp@(SWITCH_STACK_SIZE)
64 jbsr m68k_clone 62 jbsr m68k_clone
65 addql #4,%sp 63 lea %sp@(28),%sp
66 RESTORE_SWITCH_STACK
67 rts 64 rts
68 65
69ENTRY(sys_vfork) 66ENTRY(__sys_vfork)
70 SAVE_SWITCH_STACK 67 SAVE_SWITCH_STACK
71 pea %sp@(SWITCH_STACK_SIZE) 68 jbsr sys_vfork
72 jbsr m68k_vfork 69 lea %sp@(24),%sp
73 addql #4,%sp
74 RESTORE_SWITCH_STACK
75 rts 70 rts
76 71
77ENTRY(sys_sigreturn) 72ENTRY(sys_sigreturn)
@@ -115,16 +110,9 @@ ENTRY(ret_from_kernel_thread)
115 | a3 contains the kernel thread payload, d7 - its argument 110 | a3 contains the kernel thread payload, d7 - its argument
116 movel %d1,%sp@- 111 movel %d1,%sp@-
117 jsr schedule_tail 112 jsr schedule_tail
118 GET_CURRENT(%d0)
119 movel %d7,(%sp) 113 movel %d7,(%sp)
120 jsr %a3@ 114 jsr %a3@
121 addql #4,%sp 115 addql #4,%sp
122 movel %d0,(%sp)
123 jra sys_exit
124
125ENTRY(ret_from_kernel_execve)
126 movel 4(%sp), %sp
127 GET_CURRENT(%d0)
128 jra ret_from_exception 116 jra ret_from_exception
129 117
130#if defined(CONFIG_COLDFIRE) || !defined(CONFIG_MMU) 118#if defined(CONFIG_COLDFIRE) || !defined(CONFIG_MMU)
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index c51bb172e14..d538694ad20 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -136,57 +136,35 @@ void flush_thread(void)
136} 136}
137 137
138/* 138/*
139 * "m68k_fork()".. By the time we get here, the 139 * Why not generic sys_clone, you ask? m68k passes all arguments on stack.
140 * non-volatile registers have also been saved on the 140 * And we need all registers saved, which means a bunch of stuff pushed
141 * stack. We do some ugly pointer stuff here.. (see 141 * on top of pt_regs, which means that sys_clone() arguments would be
142 * also copy_thread) 142 * buried. We could, of course, copy them, but it's too costly for no
143 * good reason - generic clone() would have to copy them *again* for
144 * do_fork() anyway. So in this case it's actually better to pass pt_regs *
145 * and extract arguments for do_fork() from there. Eventually we might
146 * go for calling do_fork() directly from the wrapper, but only after we
147 * are finished with do_fork() prototype conversion.
143 */ 148 */
144
145asmlinkage int m68k_fork(struct pt_regs *regs)
146{
147#ifdef CONFIG_MMU
148 return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
149#else
150 return -EINVAL;
151#endif
152}
153
154asmlinkage int m68k_vfork(struct pt_regs *regs)
155{
156 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0,
157 NULL, NULL);
158}
159
160asmlinkage int m68k_clone(struct pt_regs *regs) 149asmlinkage int m68k_clone(struct pt_regs *regs)
161{ 150{
162 unsigned long clone_flags; 151 /* regs will be equal to current_pt_regs() */
163 unsigned long newsp; 152 return do_fork(regs->d1, regs->d2, 0,
164 int __user *parent_tidptr, *child_tidptr; 153 (int __user *)regs->d3, (int __user *)regs->d4);
165
166 /* syscall2 puts clone_flags in d1 and usp in d2 */
167 clone_flags = regs->d1;
168 newsp = regs->d2;
169 parent_tidptr = (int __user *)regs->d3;
170 child_tidptr = (int __user *)regs->d4;
171 if (!newsp)
172 newsp = rdusp();
173 return do_fork(clone_flags, newsp, regs, 0,
174 parent_tidptr, child_tidptr);
175} 154}
176 155
177int copy_thread(unsigned long clone_flags, unsigned long usp, 156int copy_thread(unsigned long clone_flags, unsigned long usp,
178 unsigned long arg, 157 unsigned long arg, struct task_struct *p)
179 struct task_struct * p, struct pt_regs * regs)
180{ 158{
181 struct pt_regs * childregs; 159 struct fork_frame {
182 struct switch_stack *childstack; 160 struct switch_stack sw;
161 struct pt_regs regs;
162 } *frame;
183 163
184 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; 164 frame = (struct fork_frame *) (task_stack_page(p) + THREAD_SIZE) - 1;
185 childstack = ((struct switch_stack *) childregs) - 1;
186 165
187 p->thread.usp = usp; 166 p->thread.ksp = (unsigned long)frame;
188 p->thread.ksp = (unsigned long)childstack; 167 p->thread.esp0 = (unsigned long)&frame->regs;
189 p->thread.esp0 = (unsigned long)childregs;
190 168
191 /* 169 /*
192 * Must save the current SFC/DFC value, NOT the value when 170 * Must save the current SFC/DFC value, NOT the value when
@@ -194,25 +172,24 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
194 */ 172 */
195 p->thread.fs = get_fs().seg; 173 p->thread.fs = get_fs().seg;
196 174
197 if (unlikely(!regs)) { 175 if (unlikely(p->flags & PF_KTHREAD)) {
198 /* kernel thread */ 176 /* kernel thread */
199 memset(childstack, 0, 177 memset(frame, 0, sizeof(struct fork_frame));
200 sizeof(struct switch_stack) + sizeof(struct pt_regs)); 178 frame->regs.sr = PS_S;
201 childregs->sr = PS_S; 179 frame->sw.a3 = usp; /* function */
202 childstack->a3 = usp; /* function */ 180 frame->sw.d7 = arg;
203 childstack->d7 = arg; 181 frame->sw.retpc = (unsigned long)ret_from_kernel_thread;
204 childstack->retpc = (unsigned long)ret_from_kernel_thread;
205 p->thread.usp = 0; 182 p->thread.usp = 0;
206 return 0; 183 return 0;
207 } 184 }
208 *childregs = *regs; 185 memcpy(frame, container_of(current_pt_regs(), struct fork_frame, regs),
209 childregs->d0 = 0; 186 sizeof(struct fork_frame));
210 187 frame->regs.d0 = 0;
211 *childstack = ((struct switch_stack *) regs)[-1]; 188 frame->sw.retpc = (unsigned long)ret_from_fork;
212 childstack->retpc = (unsigned long)ret_from_fork; 189 p->thread.usp = usp ?: rdusp();
213 190
214 if (clone_flags & CLONE_SETTLS) 191 if (clone_flags & CLONE_SETTLS)
215 task_thread_info(p)->tp_value = regs->d5; 192 task_thread_info(p)->tp_value = frame->regs.d5;
216 193
217#ifdef CONFIG_FPU 194#ifdef CONFIG_FPU
218 if (!FPU_IS_EMU) { 195 if (!FPU_IS_EMU) {
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 710a528b928..9a396cda314 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -108,8 +108,9 @@ int handle_kernel_fault(struct pt_regs *regs)
108 return 1; 108 return 1;
109} 109}
110 110
111void ptrace_signal_deliver(struct pt_regs *regs, void *cookie) 111void ptrace_signal_deliver(void)
112{ 112{
113 struct pt_regs *regs = signal_pt_regs();
113 if (regs->orig_d0 < 0) 114 if (regs->orig_d0 < 0)
114 return; 115 return;
115 switch (regs->d0) { 116 switch (regs->d0) {
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
index 4fc2e29b771..c30da5b3f2d 100644
--- a/arch/m68k/kernel/syscalltable.S
+++ b/arch/m68k/kernel/syscalltable.S
@@ -22,7 +22,7 @@ ALIGN
22ENTRY(sys_call_table) 22ENTRY(sys_call_table)
23 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ 23 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
24 .long sys_exit 24 .long sys_exit
25 .long sys_fork 25 .long __sys_fork
26 .long sys_read 26 .long sys_read
27 .long sys_write 27 .long sys_write
28 .long sys_open /* 5 */ 28 .long sys_open /* 5 */
@@ -140,7 +140,7 @@ ENTRY(sys_call_table)
140 .long sys_ipc 140 .long sys_ipc
141 .long sys_fsync 141 .long sys_fsync
142 .long sys_sigreturn 142 .long sys_sigreturn
143 .long sys_clone /* 120 */ 143 .long __sys_clone /* 120 */
144 .long sys_setdomainname 144 .long sys_setdomainname
145 .long sys_newuname 145 .long sys_newuname
146 .long sys_cacheflush /* modify_ldt for i386 */ 146 .long sys_cacheflush /* modify_ldt for i386 */
@@ -210,7 +210,7 @@ ENTRY(sys_call_table)
210 .long sys_sendfile 210 .long sys_sendfile
211 .long sys_ni_syscall /* streams1 */ 211 .long sys_ni_syscall /* streams1 */
212 .long sys_ni_syscall /* streams2 */ 212 .long sys_ni_syscall /* streams2 */
213 .long sys_vfork /* 190 */ 213 .long __sys_vfork /* 190 */
214 .long sys_getrlimit 214 .long sys_getrlimit
215 .long sys_mmap2 215 .long sys_mmap2
216 .long sys_truncate64 216 .long sys_truncate64
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 388e5cc8959..cbc624af449 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -506,7 +506,7 @@ static inline void bus_error030 (struct frame *fp)
506 addr -= 2; 506 addr -= 2;
507 507
508 if (buserr_type & SUN3_BUSERR_INVALID) { 508 if (buserr_type & SUN3_BUSERR_INVALID) {
509 if (!mmu_emu_handle_fault (fp->un.fmtb.daddr, 1, 0)) 509 if (!mmu_emu_handle_fault(addr, 1, 0))
510 do_page_fault (&fp->ptregs, addr, 0); 510 do_page_fault (&fp->ptregs, addr, 0);
511 } else { 511 } else {
512#ifdef DEBUG 512#ifdef DEBUG
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index 3384a5244fb..0663067870f 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -50,7 +50,7 @@ fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
50 * sqrt(m*2^e) = 50 * sqrt(m*2^e) =
51 * sqrt(2*m) * 2^(p) , if e = 2*p + 1 51 * sqrt(2*m) * 2^(p) , if e = 2*p + 1
52 * 52 *
53 * So we use the last bit of the exponent to decide wether to 53 * So we use the last bit of the exponent to decide whether to
54 * use the m or 2*m. 54 * use the m or 2*m.
55 * 55 *
56 * Since only the fractional part of the mantissa is stored and 56 * Since only the fractional part of the mantissa is stored and
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 27b5ce089a3..f0e05bce92f 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -1,5 +1,225 @@
1/*
2 * linux/arch/m68k/mm/init.c
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 *
6 * Contains common initialization routines, specific init code moved
7 * to motorola.c and sun3mmu.c
8 */
9
10#include <linux/module.h>
11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/mm.h>
14#include <linux/swap.h>
15#include <linux/kernel.h>
16#include <linux/string.h>
17#include <linux/types.h>
18#include <linux/init.h>
19#include <linux/bootmem.h>
20#include <linux/gfp.h>
21
22#include <asm/setup.h>
23#include <asm/uaccess.h>
24#include <asm/page.h>
25#include <asm/pgalloc.h>
26#include <asm/traps.h>
27#include <asm/machdep.h>
28#include <asm/io.h>
29#ifdef CONFIG_ATARI
30#include <asm/atari_stram.h>
31#endif
32#include <asm/sections.h>
33#include <asm/tlb.h>
34
35/*
36 * ZERO_PAGE is a special page that is used for zero-initialized
37 * data and COW.
38 */
39void *empty_zero_page;
40EXPORT_SYMBOL(empty_zero_page);
41
1#ifdef CONFIG_MMU 42#ifdef CONFIG_MMU
2#include "init_mm.c" 43
44pg_data_t pg_data_map[MAX_NUMNODES];
45EXPORT_SYMBOL(pg_data_map);
46
47int m68k_virt_to_node_shift;
48
49#ifndef CONFIG_SINGLE_MEMORY_CHUNK
50pg_data_t *pg_data_table[65];
51EXPORT_SYMBOL(pg_data_table);
52#endif
53
54void __init m68k_setup_node(int node)
55{
56#ifndef CONFIG_SINGLE_MEMORY_CHUNK
57 struct mem_info *info = m68k_memory + node;
58 int i, end;
59
60 i = (unsigned long)phys_to_virt(info->addr) >> __virt_to_node_shift();
61 end = (unsigned long)phys_to_virt(info->addr + info->size - 1) >> __virt_to_node_shift();
62 for (; i <= end; i++) {
63 if (pg_data_table[i])
64 printk("overlap at %u for chunk %u\n", i, node);
65 pg_data_table[i] = pg_data_map + node;
66 }
67#endif
68 pg_data_map[node].bdata = bootmem_node_data + node;
69 node_set_online(node);
70}
71
72extern void init_pointer_table(unsigned long ptable);
73extern pmd_t *zero_pgtable;
74
75#else /* CONFIG_MMU */
76
77/*
78 * paging_init() continues the virtual memory environment setup which
79 * was begun by the code in arch/head.S.
80 * The parameters are pointers to where to stick the starting and ending
81 * addresses of available kernel virtual memory.
82 */
83void __init paging_init(void)
84{
85 /*
86 * Make sure start_mem is page aligned, otherwise bootmem and
87 * page_alloc get different views of the world.
88 */
89 unsigned long end_mem = memory_end & PAGE_MASK;
90 unsigned long zones_size[MAX_NR_ZONES] = { 0, };
91
92 high_memory = (void *) end_mem;
93
94 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
95 memset(empty_zero_page, 0, PAGE_SIZE);
96
97 /*
98 * Set up SFC/DFC registers (user data space).
99 */
100 set_fs (USER_DS);
101
102 zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
103 free_area_init(zones_size);
104}
105
106#endif /* CONFIG_MMU */
107
108void free_initmem(void)
109{
110#ifndef CONFIG_MMU_SUN3
111 unsigned long addr;
112
113 addr = (unsigned long) __init_begin;
114 for (; addr < ((unsigned long) __init_end); addr += PAGE_SIZE) {
115 ClearPageReserved(virt_to_page(addr));
116 init_page_count(virt_to_page(addr));
117 free_page(addr);
118 totalram_pages++;
119 }
120 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n",
121 (addr - (unsigned long) __init_begin) >> 10,
122 (unsigned int) __init_begin, (unsigned int) __init_end);
123#endif /* CONFIG_MMU_SUN3 */
124}
125
126#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
127#define VECTORS &vectors[0]
3#else 128#else
4#include "init_no.c" 129#define VECTORS _ramvec
130#endif
131
132void __init print_memmap(void)
133{
134#define UL(x) ((unsigned long) (x))
135#define MLK(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 10
136#define MLM(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 20
137#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), 1024)
138
139 pr_notice("Virtual kernel memory layout:\n"
140 " vector : 0x%08lx - 0x%08lx (%4ld KiB)\n"
141 " kmap : 0x%08lx - 0x%08lx (%4ld MiB)\n"
142 " vmalloc : 0x%08lx - 0x%08lx (%4ld MiB)\n"
143 " lowmem : 0x%08lx - 0x%08lx (%4ld MiB)\n"
144 " .init : 0x%p" " - 0x%p" " (%4d KiB)\n"
145 " .text : 0x%p" " - 0x%p" " (%4d KiB)\n"
146 " .data : 0x%p" " - 0x%p" " (%4d KiB)\n"
147 " .bss : 0x%p" " - 0x%p" " (%4d KiB)\n",
148 MLK(VECTORS, VECTORS + 256),
149 MLM(KMAP_START, KMAP_END),
150 MLM(VMALLOC_START, VMALLOC_END),
151 MLM(PAGE_OFFSET, (unsigned long)high_memory),
152 MLK_ROUNDUP(__init_begin, __init_end),
153 MLK_ROUNDUP(_stext, _etext),
154 MLK_ROUNDUP(_sdata, _edata),
155 MLK_ROUNDUP(__bss_start, __bss_stop));
156}
157
158void __init mem_init(void)
159{
160 pg_data_t *pgdat;
161 int codepages = 0;
162 int datapages = 0;
163 int initpages = 0;
164 int i;
165
166 /* this will put all memory onto the freelists */
167 totalram_pages = num_physpages = 0;
168 for_each_online_pgdat(pgdat) {
169 num_physpages += pgdat->node_present_pages;
170
171 totalram_pages += free_all_bootmem_node(pgdat);
172 for (i = 0; i < pgdat->node_spanned_pages; i++) {
173 struct page *page = pgdat->node_mem_map + i;
174 char *addr = page_to_virt(page);
175
176 if (!PageReserved(page))
177 continue;
178 if (addr >= _text &&
179 addr < _etext)
180 codepages++;
181 else if (addr >= __init_begin &&
182 addr < __init_end)
183 initpages++;
184 else
185 datapages++;
186 }
187 }
188
189#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
190 /* insert pointer tables allocated so far into the tablelist */
191 init_pointer_table((unsigned long)kernel_pg_dir);
192 for (i = 0; i < PTRS_PER_PGD; i++) {
193 if (pgd_present(kernel_pg_dir[i]))
194 init_pointer_table(__pgd_page(kernel_pg_dir[i]));
195 }
196
197 /* insert also pointer table that we used to unmap the zero page */
198 if (zero_pgtable)
199 init_pointer_table((unsigned long)zero_pgtable);
200#endif
201
202 pr_info("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
203 nr_free_pages() << (PAGE_SHIFT-10),
204 totalram_pages << (PAGE_SHIFT-10),
205 codepages << (PAGE_SHIFT-10),
206 datapages << (PAGE_SHIFT-10),
207 initpages << (PAGE_SHIFT-10));
208 print_memmap();
209}
210
211#ifdef CONFIG_BLK_DEV_INITRD
212void free_initrd_mem(unsigned long start, unsigned long end)
213{
214 int pages = 0;
215 for (; start < end; start += PAGE_SIZE) {
216 ClearPageReserved(virt_to_page(start));
217 init_page_count(virt_to_page(start));
218 free_page(start);
219 totalram_pages++;
220 pages++;
221 }
222 pr_notice("Freeing initrd memory: %dk freed\n",
223 pages << (PAGE_SHIFT - 10));
224}
5#endif 225#endif
diff --git a/arch/m68k/mm/init_mm.c b/arch/m68k/mm/init_mm.c
deleted file mode 100644
index 282f9de6896..00000000000
--- a/arch/m68k/mm/init_mm.c
+++ /dev/null
@@ -1,176 +0,0 @@
1/*
2 * linux/arch/m68k/mm/init.c
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 *
6 * Contains common initialization routines, specific init code moved
7 * to motorola.c and sun3mmu.c
8 */
9
10#include <linux/module.h>
11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/mm.h>
14#include <linux/swap.h>
15#include <linux/kernel.h>
16#include <linux/string.h>
17#include <linux/types.h>
18#include <linux/init.h>
19#include <linux/bootmem.h>
20#include <linux/gfp.h>
21
22#include <asm/setup.h>
23#include <asm/uaccess.h>
24#include <asm/page.h>
25#include <asm/pgalloc.h>
26#include <asm/traps.h>
27#include <asm/machdep.h>
28#include <asm/io.h>
29#ifdef CONFIG_ATARI
30#include <asm/atari_stram.h>
31#endif
32#include <asm/sections.h>
33#include <asm/tlb.h>
34
35pg_data_t pg_data_map[MAX_NUMNODES];
36EXPORT_SYMBOL(pg_data_map);
37
38int m68k_virt_to_node_shift;
39
40#ifndef CONFIG_SINGLE_MEMORY_CHUNK
41pg_data_t *pg_data_table[65];
42EXPORT_SYMBOL(pg_data_table);
43#endif
44
45void __init m68k_setup_node(int node)
46{
47#ifndef CONFIG_SINGLE_MEMORY_CHUNK
48 struct mem_info *info = m68k_memory + node;
49 int i, end;
50
51 i = (unsigned long)phys_to_virt(info->addr) >> __virt_to_node_shift();
52 end = (unsigned long)phys_to_virt(info->addr + info->size - 1) >> __virt_to_node_shift();
53 for (; i <= end; i++) {
54 if (pg_data_table[i])
55 printk("overlap at %u for chunk %u\n", i, node);
56 pg_data_table[i] = pg_data_map + node;
57 }
58#endif
59 pg_data_map[node].bdata = bootmem_node_data + node;
60 node_set_online(node);
61}
62
63
64/*
65 * ZERO_PAGE is a special page that is used for zero-initialized
66 * data and COW.
67 */
68
69void *empty_zero_page;
70EXPORT_SYMBOL(empty_zero_page);
71
72extern void init_pointer_table(unsigned long ptable);
73
74/* References to section boundaries */
75
76extern pmd_t *zero_pgtable;
77
78#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
79#define VECTORS &vectors[0]
80#else
81#define VECTORS _ramvec
82#endif
83
84void __init print_memmap(void)
85{
86#define UL(x) ((unsigned long) (x))
87#define MLK(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 10
88#define MLM(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 20
89#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), 1024)
90
91 pr_notice("Virtual kernel memory layout:\n"
92 " vector : 0x%08lx - 0x%08lx (%4ld KiB)\n"
93 " kmap : 0x%08lx - 0x%08lx (%4ld MiB)\n"
94 " vmalloc : 0x%08lx - 0x%08lx (%4ld MiB)\n"
95 " lowmem : 0x%08lx - 0x%08lx (%4ld MiB)\n"
96 " .init : 0x%p" " - 0x%p" " (%4d KiB)\n"
97 " .text : 0x%p" " - 0x%p" " (%4d KiB)\n"
98 " .data : 0x%p" " - 0x%p" " (%4d KiB)\n"
99 " .bss : 0x%p" " - 0x%p" " (%4d KiB)\n",
100 MLK(VECTORS, VECTORS + 256),
101 MLM(KMAP_START, KMAP_END),
102 MLM(VMALLOC_START, VMALLOC_END),
103 MLM(PAGE_OFFSET, (unsigned long)high_memory),
104 MLK_ROUNDUP(__init_begin, __init_end),
105 MLK_ROUNDUP(_stext, _etext),
106 MLK_ROUNDUP(_sdata, _edata),
107 MLK_ROUNDUP(__bss_start, __bss_stop));
108}
109
110void __init mem_init(void)
111{
112 pg_data_t *pgdat;
113 int codepages = 0;
114 int datapages = 0;
115 int initpages = 0;
116 int i;
117
118 /* this will put all memory onto the freelists */
119 totalram_pages = num_physpages = 0;
120 for_each_online_pgdat(pgdat) {
121 num_physpages += pgdat->node_present_pages;
122
123 totalram_pages += free_all_bootmem_node(pgdat);
124 for (i = 0; i < pgdat->node_spanned_pages; i++) {
125 struct page *page = pgdat->node_mem_map + i;
126 char *addr = page_to_virt(page);
127
128 if (!PageReserved(page))
129 continue;
130 if (addr >= _text &&
131 addr < _etext)
132 codepages++;
133 else if (addr >= __init_begin &&
134 addr < __init_end)
135 initpages++;
136 else
137 datapages++;
138 }
139 }
140
141#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
142 /* insert pointer tables allocated so far into the tablelist */
143 init_pointer_table((unsigned long)kernel_pg_dir);
144 for (i = 0; i < PTRS_PER_PGD; i++) {
145 if (pgd_present(kernel_pg_dir[i]))
146 init_pointer_table(__pgd_page(kernel_pg_dir[i]));
147 }
148
149 /* insert also pointer table that we used to unmap the zero page */
150 if (zero_pgtable)
151 init_pointer_table((unsigned long)zero_pgtable);
152#endif
153
154 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
155 nr_free_pages() << (PAGE_SHIFT-10),
156 totalram_pages << (PAGE_SHIFT-10),
157 codepages << (PAGE_SHIFT-10),
158 datapages << (PAGE_SHIFT-10),
159 initpages << (PAGE_SHIFT-10));
160 print_memmap();
161}
162
163#ifdef CONFIG_BLK_DEV_INITRD
164void free_initrd_mem(unsigned long start, unsigned long end)
165{
166 int pages = 0;
167 for (; start < end; start += PAGE_SIZE) {
168 ClearPageReserved(virt_to_page(start));
169 init_page_count(virt_to_page(start));
170 free_page(start);
171 totalram_pages++;
172 pages++;
173 }
174 printk ("Freeing initrd memory: %dk freed\n", pages);
175}
176#endif
diff --git a/arch/m68k/mm/init_no.c b/arch/m68k/mm/init_no.c
deleted file mode 100644
index 688e3664aea..00000000000
--- a/arch/m68k/mm/init_no.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 * linux/arch/m68knommu/mm/init.c
3 *
4 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
5 * Kenneth Albanowski <kjahds@kjahds.com>,
6 * Copyright (C) 2000 Lineo, Inc. (www.lineo.com)
7 *
8 * Based on:
9 *
10 * linux/arch/m68k/mm/init.c
11 *
12 * Copyright (C) 1995 Hamish Macdonald
13 *
14 * JAN/1999 -- hacked to support ColdFire (gerg@snapgear.com)
15 * DEC/2000 -- linux 2.4 support <davidm@snapgear.com>
16 */
17
18#include <linux/signal.h>
19#include <linux/sched.h>
20#include <linux/kernel.h>
21#include <linux/errno.h>
22#include <linux/string.h>
23#include <linux/types.h>
24#include <linux/ptrace.h>
25#include <linux/mman.h>
26#include <linux/mm.h>
27#include <linux/swap.h>
28#include <linux/init.h>
29#include <linux/highmem.h>
30#include <linux/pagemap.h>
31#include <linux/bootmem.h>
32#include <linux/gfp.h>
33
34#include <asm/setup.h>
35#include <asm/sections.h>
36#include <asm/segment.h>
37#include <asm/page.h>
38#include <asm/pgtable.h>
39#include <asm/machdep.h>
40
41/*
42 * ZERO_PAGE is a special page that is used for zero-initialized
43 * data and COW.
44 */
45void *empty_zero_page;
46
47/*
48 * paging_init() continues the virtual memory environment setup which
49 * was begun by the code in arch/head.S.
50 * The parameters are pointers to where to stick the starting and ending
51 * addresses of available kernel virtual memory.
52 */
53void __init paging_init(void)
54{
55 /*
56 * Make sure start_mem is page aligned, otherwise bootmem and
57 * page_alloc get different views of the world.
58 */
59 unsigned long end_mem = memory_end & PAGE_MASK;
60 unsigned long zones_size[MAX_NR_ZONES] = {0, };
61
62 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
63 memset(empty_zero_page, 0, PAGE_SIZE);
64
65 /*
66 * Set up SFC/DFC registers (user data space).
67 */
68 set_fs (USER_DS);
69
70 zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
71 free_area_init(zones_size);
72}
73
74void __init mem_init(void)
75{
76 int codek = 0, datak = 0, initk = 0;
77 unsigned long tmp;
78 unsigned long len = _ramend - _rambase;
79 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */
80 unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */
81
82 pr_debug("Mem_init: start=%lx, end=%lx\n", start_mem, end_mem);
83
84 end_mem &= PAGE_MASK;
85 high_memory = (void *) end_mem;
86
87 start_mem = PAGE_ALIGN(start_mem);
88 max_mapnr = num_physpages = (((unsigned long) high_memory) - PAGE_OFFSET) >> PAGE_SHIFT;
89
90 /* this will put all memory onto the freelists */
91 totalram_pages = free_all_bootmem();
92
93 codek = (_etext - _stext) >> 10;
94 datak = (__bss_stop - _sdata) >> 10;
95 initk = (__init_begin - __init_end) >> 10;
96
97 tmp = nr_free_pages() << PAGE_SHIFT;
98 printk(KERN_INFO "Memory available: %luk/%luk RAM, (%dk kernel code, %dk data)\n",
99 tmp >> 10,
100 len >> 10,
101 codek,
102 datak
103 );
104}
105
106
107#ifdef CONFIG_BLK_DEV_INITRD
108void free_initrd_mem(unsigned long start, unsigned long end)
109{
110 int pages = 0;
111 for (; start < end; start += PAGE_SIZE) {
112 ClearPageReserved(virt_to_page(start));
113 init_page_count(virt_to_page(start));
114 free_page(start);
115 totalram_pages++;
116 pages++;
117 }
118 pr_notice("Freeing initrd memory: %luk freed\n",
119 pages * (PAGE_SIZE / 1024));
120}
121#endif
122
123void free_initmem(void)
124{
125#ifdef CONFIG_RAMKERNEL
126 unsigned long addr;
127 /*
128 * The following code should be cool even if these sections
129 * are not page aligned.
130 */
131 addr = PAGE_ALIGN((unsigned long) __init_begin);
132 /* next to check that the page we free is not a partial page */
133 for (; addr + PAGE_SIZE < ((unsigned long) __init_end); addr += PAGE_SIZE) {
134 ClearPageReserved(virt_to_page(addr));
135 init_page_count(virt_to_page(addr));
136 free_page(addr);
137 totalram_pages++;
138 }
139 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n",
140 (addr - PAGE_ALIGN((unsigned long) __init_begin)) >> 10,
141 (int)(PAGE_ALIGN((unsigned long) __init_begin)),
142 (int)(addr - PAGE_SIZE));
143#endif
144}
145
diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
index 875b800ef0d..f58fafe7e4c 100644
--- a/arch/m68k/mm/mcfmmu.c
+++ b/arch/m68k/mm/mcfmmu.c
@@ -29,10 +29,6 @@ atomic_t nr_free_contexts;
29struct mm_struct *context_mm[LAST_CONTEXT+1]; 29struct mm_struct *context_mm[LAST_CONTEXT+1];
30extern unsigned long num_pages; 30extern unsigned long num_pages;
31 31
32void free_initmem(void)
33{
34}
35
36/* 32/*
37 * ColdFire paging_init derived from sun3. 33 * ColdFire paging_init derived from sun3.
38 */ 34 */
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 0dafa693515..251c5437787 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -304,17 +304,3 @@ void __init paging_init(void)
304 } 304 }
305} 305}
306 306
307void free_initmem(void)
308{
309 unsigned long addr;
310
311 addr = (unsigned long)__init_begin;
312 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) {
313 virt_to_page(addr)->flags &= ~(1 << PG_reserved);
314 init_page_count(virt_to_page(addr));
315 free_page(addr);
316 totalram_pages++;
317 }
318}
319
320
diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
index e0804060501..269f81158a3 100644
--- a/arch/m68k/mm/sun3mmu.c
+++ b/arch/m68k/mm/sun3mmu.c
@@ -30,10 +30,6 @@ const char bad_pmd_string[] = "Bad pmd in pte_alloc: %08lx\n";
30 30
31extern unsigned long num_pages; 31extern unsigned long num_pages;
32 32
33void free_initmem(void)
34{
35}
36
37/* For the sun3 we try to follow the i386 paging_init() more closely */ 33/* For the sun3 we try to follow the i386 paging_init() more closely */
38/* start_mem and end_mem have PAGE_OFFSET added already */ 34/* start_mem and end_mem have PAGE_OFFSET added already */
39/* now sets up tables using sun3 PTEs rather than i386 as before. --m */ 35/* now sets up tables using sun3 PTEs rather than i386 as before. --m */
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index 78b60f53e90..6bbca30c918 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -66,6 +66,8 @@ static irqreturn_t sun3_int5(int irq, void *dev_id)
66#ifdef CONFIG_SUN3 66#ifdef CONFIG_SUN3
67 intersil_clear(); 67 intersil_clear();
68#endif 68#endif
69 sun3_disable_irq(5);
70 sun3_enable_irq(5);
69#ifdef CONFIG_SUN3 71#ifdef CONFIG_SUN3
70 intersil_clear(); 72 intersil_clear();
71#endif 73#endif
@@ -79,41 +81,18 @@ static irqreturn_t sun3_int5(int irq, void *dev_id)
79 81
80static irqreturn_t sun3_vec255(int irq, void *dev_id) 82static irqreturn_t sun3_vec255(int irq, void *dev_id)
81{ 83{
82// intersil_clear();
83 return IRQ_HANDLED; 84 return IRQ_HANDLED;
84} 85}
85 86
86static void sun3_irq_enable(struct irq_data *data)
87{
88 sun3_enable_irq(data->irq);
89};
90
91static void sun3_irq_disable(struct irq_data *data)
92{
93 sun3_disable_irq(data->irq);
94};
95
96static struct irq_chip sun3_irq_chip = {
97 .name = "sun3",
98 .irq_startup = m68k_irq_startup,
99 .irq_shutdown = m68k_irq_shutdown,
100 .irq_enable = sun3_irq_enable,
101 .irq_disable = sun3_irq_disable,
102 .irq_mask = sun3_irq_disable,
103 .irq_unmask = sun3_irq_enable,
104};
105
106void __init sun3_init_IRQ(void) 87void __init sun3_init_IRQ(void)
107{ 88{
108 *sun3_intreg = 1; 89 *sun3_intreg = 1;
109 90
110 m68k_setup_irq_controller(&sun3_irq_chip, handle_level_irq, IRQ_AUTO_1,
111 7);
112 m68k_setup_user_interrupt(VEC_USER, 128); 91 m68k_setup_user_interrupt(VEC_USER, 128);
113 92
114 if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL)) 93 if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "clock", NULL))
115 pr_err("Couldn't register %s interrupt\n", "int5"); 94 pr_err("Couldn't register %s interrupt\n", "int5");
116 if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL)) 95 if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "nmi", NULL))
117 pr_err("Couldn't register %s interrupt\n", "int7"); 96 pr_err("Couldn't register %s interrupt\n", "int7");
118 if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL)) 97 if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL))
119 pr_err("Couldn't register %s interrupt\n", "vec255"); 98 pr_err("Couldn't register %s interrupt\n", "vec255");
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 4cba7439f9d..4bcf89148f3 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -26,6 +26,9 @@ config MICROBLAZE
26 select GENERIC_ATOMIC64 26 select GENERIC_ATOMIC64
27 select GENERIC_CLOCKEVENTS 27 select GENERIC_CLOCKEVENTS
28 select MODULES_USE_ELF_RELA 28 select MODULES_USE_ELF_RELA
29 select GENERIC_KERNEL_THREAD
30 select GENERIC_KERNEL_EXECVE
31 select CLONE_BACKWARDS
29 32
30config SWAP 33config SWAP
31 def_bool n 34 def_bool n
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index b23c40eb7a5..d26fb905ee0 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -57,7 +57,7 @@ boot := arch/microblaze/boot
57DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS))) 57DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
58 58
59ifneq ($(DTB),) 59ifneq ($(DTB),)
60 core-y += $(boot)/ 60 core-y += $(boot)/dts/
61endif 61endif
62 62
63# defines filename extension depending memory management type 63# defines filename extension depending memory management type
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
index fa83ea497db..80fe54fb7ca 100644
--- a/arch/microblaze/boot/Makefile
+++ b/arch/microblaze/boot/Makefile
@@ -2,21 +2,10 @@
2# arch/microblaze/boot/Makefile 2# arch/microblaze/boot/Makefile
3# 3#
4 4
5obj-y += linked_dtb.o
6
7targets := linux.bin linux.bin.gz simpleImage.% 5targets := linux.bin linux.bin.gz simpleImage.%
8 6
9OBJCOPYFLAGS := -R .note -R .comment -R .note.gnu.build-id -O binary 7OBJCOPYFLAGS := -R .note -R .comment -R .note.gnu.build-id -O binary
10 8
11# Ensure system.dtb exists
12$(obj)/linked_dtb.o: $(obj)/system.dtb
13
14# Generate system.dtb from $(DTB).dtb
15ifneq ($(DTB),system)
16$(obj)/system.dtb: $(obj)/$(DTB).dtb
17 $(call if_changed,cp)
18endif
19
20$(obj)/linux.bin: vmlinux FORCE 9$(obj)/linux.bin: vmlinux FORCE
21 $(call if_changed,objcopy) 10 $(call if_changed,objcopy)
22 $(call if_changed,uimage) 11 $(call if_changed,uimage)
@@ -45,10 +34,4 @@ $(obj)/simpleImage.%: vmlinux FORCE
45 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 34 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
46 35
47 36
48# Rule to build device tree blobs 37clean-files += simpleImage.*.unstrip linux.bin.ub
49DTC_FLAGS := -p 1024
50
51$(obj)/%.dtb: $(src)/dts/%.dts FORCE
52 $(call if_changed_dep,dtc)
53
54clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub
diff --git a/arch/microblaze/boot/dts/Makefile b/arch/microblaze/boot/dts/Makefile
new file mode 100644
index 00000000000..c3b3a5d67b8
--- /dev/null
+++ b/arch/microblaze/boot/dts/Makefile
@@ -0,0 +1,22 @@
1#
2# arch/microblaze/boot/Makefile
3#
4
5obj-y += linked_dtb.o
6
7# Ensure system.dtb exists
8$(obj)/linked_dtb.o: $(obj)/system.dtb
9
10# Generate system.dtb from $(DTB).dtb
11ifneq ($(DTB),system)
12$(obj)/system.dtb: $(obj)/$(DTB).dtb
13 $(call if_changed,cp)
14endif
15
16quiet_cmd_cp = CP $< $@$2
17 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
18
19# Rule to build device tree blobs
20DTC_FLAGS := -p 1024
21
22clean-files += *.dtb
diff --git a/arch/microblaze/boot/dts/linked_dtb.S b/arch/microblaze/boot/dts/linked_dtb.S
new file mode 100644
index 00000000000..23345af3721
--- /dev/null
+++ b/arch/microblaze/boot/dts/linked_dtb.S
@@ -0,0 +1,2 @@
1.section __fdt_blob,"a"
2.incbin "arch/microblaze/boot/dts/system.dtb"
diff --git a/arch/microblaze/boot/linked_dtb.S b/arch/microblaze/boot/linked_dtb.S
deleted file mode 100644
index cb2b537aebe..00000000000
--- a/arch/microblaze/boot/linked_dtb.S
+++ /dev/null
@@ -1,3 +0,0 @@
1.section __fdt_blob,"a"
2.incbin "arch/microblaze/boot/system.dtb"
3
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 8653072d7e9..eb3a46c096f 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -3,3 +3,5 @@ include include/asm-generic/Kbuild.asm
3header-y += elf.h 3header-y += elf.h
4generic-y += clkdev.h 4generic-y += clkdev.h
5generic-y += exec.h 5generic-y += exec.h
6generic-y += trace_clock.h
7generic-y += syscalls.h
diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h
index af2bb965239..0759153e811 100644
--- a/arch/microblaze/include/asm/processor.h
+++ b/arch/microblaze/include/asm/processor.h
@@ -31,6 +31,7 @@ extern const struct seq_operations cpuinfo_op;
31void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp); 31void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp);
32 32
33extern void ret_from_fork(void); 33extern void ret_from_fork(void);
34extern void ret_from_kernel_thread(void);
34 35
35# endif /* __ASSEMBLY__ */ 36# endif /* __ASSEMBLY__ */
36 37
@@ -78,11 +79,6 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
78 79
79extern unsigned long get_wchan(struct task_struct *p); 80extern unsigned long get_wchan(struct task_struct *p);
80 81
81/*
82 * create a kernel thread without removing it from tasklists
83 */
84extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
85
86# define KSTK_EIP(tsk) (0) 82# define KSTK_EIP(tsk) (0)
87# define KSTK_ESP(tsk) (0) 83# define KSTK_ESP(tsk) (0)
88 84
@@ -131,8 +127,6 @@ extern inline void release_thread(struct task_struct *dead_task)
131{ 127{
132} 128}
133 129
134extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
135
136/* Free current thread data structures etc. */ 130/* Free current thread data structures etc. */
137static inline void exit_thread(void) 131static inline void exit_thread(void)
138{ 132{
diff --git a/arch/microblaze/include/asm/syscalls.h b/arch/microblaze/include/asm/syscalls.h
deleted file mode 100644
index 27f2f4c0f39..00000000000
--- a/arch/microblaze/include/asm/syscalls.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_MICROBLAZE_SYSCALLS_H
2
3asmlinkage long microblaze_vfork(struct pt_regs *regs);
4asmlinkage long microblaze_clone(int flags, unsigned long stack,
5 struct pt_regs *regs);
6asmlinkage long microblaze_execve(const char __user *filenamei,
7 const char __user *const __user *argv,
8 const char __user *const __user *envp,
9 struct pt_regs *regs);
10
11asmlinkage long sys_clone(int flags, unsigned long stack, struct pt_regs *regs);
12#define sys_clone sys_clone
13
14#include <asm-generic/syscalls.h>
15
16#endif /* __ASM_MICROBLAZE_SYSCALLS_H */
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index 6985e6e9d82..94d978986b7 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -422,6 +422,12 @@
422#define __ARCH_WANT_SYS_SIGPROCMASK 422#define __ARCH_WANT_SYS_SIGPROCMASK
423#define __ARCH_WANT_SYS_RT_SIGACTION 423#define __ARCH_WANT_SYS_RT_SIGACTION
424#define __ARCH_WANT_SYS_RT_SIGSUSPEND 424#define __ARCH_WANT_SYS_RT_SIGSUSPEND
425#define __ARCH_WANT_SYS_EXECVE
426#define __ARCH_WANT_SYS_CLONE
427#define __ARCH_WANT_SYS_VFORK
428#ifdef CONFIG_MMU
429#define __ARCH_WANT_SYS_FORK
430#endif
425 431
426/* 432/*
427 * "Conditional" syscalls 433 * "Conditional" syscalls
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S
index 75c3ea1f48a..cb0327f204a 100644
--- a/arch/microblaze/kernel/entry-nommu.S
+++ b/arch/microblaze/kernel/entry-nommu.S
@@ -474,6 +474,14 @@ ENTRY(ret_from_fork)
474 brid ret_to_user 474 brid ret_to_user
475 nop 475 nop
476 476
477ENTRY(ret_from_kernel_thread)
478 brlid r15, schedule_tail
479 addk r5, r0, r3
480 brald r15, r20
481 addk r5, r0, r19
482 brid ret_to_user
483 addk r3, r0, r0
484
477work_pending: 485work_pending:
478 enable_irq 486 enable_irq
479 487
@@ -551,18 +559,6 @@ no_work_pending:
551 rtid r14, 0 559 rtid r14, 0
552 nop 560 nop
553 561
554sys_vfork:
555 brid microblaze_vfork
556 addk r5, r1, r0
557
558sys_clone:
559 brid microblaze_clone
560 addk r7, r1, r0
561
562sys_execve:
563 brid microblaze_execve
564 addk r8, r1, r0
565
566sys_rt_sigreturn_wrapper: 562sys_rt_sigreturn_wrapper:
567 brid sys_rt_sigreturn 563 brid sys_rt_sigreturn
568 addk r5, r1, r0 564 addk r5, r1, r0
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index 03f7b8ce6b6..c217367dfc7 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -293,24 +293,6 @@ C_ENTRY(_user_exception):
293 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ 293 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
294 addi r14, r14, 4 /* return address is 4 byte after call */ 294 addi r14, r14, 4 /* return address is 4 byte after call */
295 295
296 mfs r1, rmsr
297 nop
298 andi r1, r1, MSR_UMS
299 bnei r1, 1f
300
301/* Kernel-mode state save - kernel execve */
302 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
303 tophys(r1,r1);
304
305 addik r1, r1, -PT_SIZE; /* Make room on the stack. */
306 SAVE_REGS
307
308 swi r1, r1, PT_MODE; /* pt_regs -> kernel mode */
309 brid 2f;
310 nop; /* Fill delay slot */
311
312/* User-mode state save. */
3131:
314 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ 296 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
315 tophys(r1,r1); 297 tophys(r1,r1);
316 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ 298 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */
@@ -460,18 +442,6 @@ TRAP_return: /* Make global symbol for debugging */
460 nop; 442 nop;
461 443
462 444
463/* These syscalls need access to the struct pt_regs on the stack, so we
464 implement them in assembly (they're basically all wrappers anyway). */
465
466C_ENTRY(sys_fork_wrapper):
467 addi r5, r0, SIGCHLD /* Arg 0: flags */
468 lwi r6, r1, PT_R1 /* Arg 1: child SP (use parent's) */
469 addik r7, r1, 0 /* Arg 2: parent context */
470 add r8, r0, r0 /* Arg 3: (unused) */
471 add r9, r0, r0; /* Arg 4: (unused) */
472 brid do_fork /* Do real work (tail-call) */
473 add r10, r0, r0; /* Arg 5: (unused) */
474
475/* This the initial entry point for a new child thread, with an appropriate 445/* This the initial entry point for a new child thread, with an appropriate
476 stack in place that makes it look the the child is in the middle of an 446 stack in place that makes it look the the child is in the middle of an
477 syscall. This function is actually `returned to' from switch_thread 447 syscall. This function is actually `returned to' from switch_thread
@@ -479,28 +449,19 @@ C_ENTRY(sys_fork_wrapper):
479 saved context). */ 449 saved context). */
480C_ENTRY(ret_from_fork): 450C_ENTRY(ret_from_fork):
481 bralid r15, schedule_tail; /* ...which is schedule_tail's arg */ 451 bralid r15, schedule_tail; /* ...which is schedule_tail's arg */
482 add r3, r5, r0; /* switch_thread returns the prev task */ 452 add r5, r3, r0; /* switch_thread returns the prev task */
483 /* ( in the delay slot ) */ 453 /* ( in the delay slot ) */
484 brid ret_from_trap; /* Do normal trap return */ 454 brid ret_from_trap; /* Do normal trap return */
485 add r3, r0, r0; /* Child's fork call should return 0. */ 455 add r3, r0, r0; /* Child's fork call should return 0. */
486 456
487C_ENTRY(sys_vfork): 457C_ENTRY(ret_from_kernel_thread):
488 brid microblaze_vfork /* Do real work (tail-call) */ 458 bralid r15, schedule_tail; /* ...which is schedule_tail's arg */
489 addik r5, r1, 0 459 add r5, r3, r0; /* switch_thread returns the prev task */
490 460 /* ( in the delay slot ) */
491C_ENTRY(sys_clone): 461 brald r15, r20 /* fn was left in r20 */
492 bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ 462 addk r5, r0, r19 /* ... and argument - in r19 */
493 lwi r6, r1, PT_R1; /* If so, use paret's stack ptr */ 463 brid ret_from_trap
4941: addik r7, r1, 0; /* Arg 2: parent context */ 464 add r3, r0, r0
495 lwi r9, r1, PT_R8; /* parent tid. */
496 lwi r10, r1, PT_R9; /* child tid. */
497 /* do_fork will pick up TLS from regs->r10. */
498 brid do_fork /* Do real work (tail-call) */
499 add r8, r0, r0; /* Arg 3: (unused) */
500
501C_ENTRY(sys_execve):
502 brid microblaze_execve; /* Do real work (tail-call).*/
503 addik r8, r1, 0; /* add user context as 4th arg */
504 465
505C_ENTRY(sys_rt_sigreturn_wrapper): 466C_ENTRY(sys_rt_sigreturn_wrapper):
506 brid sys_rt_sigreturn /* Do real work */ 467 brid sys_rt_sigreturn /* Do real work */
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 1944e00f07e..40823fd1db0 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -13,6 +13,7 @@
13#include <linux/pm.h> 13#include <linux/pm.h>
14#include <linux/tick.h> 14#include <linux/tick.h>
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/ptrace.h>
16#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
17#include <asm/uaccess.h> /* for USER_DS macros */ 18#include <asm/uaccess.h> /* for USER_DS macros */
18#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
@@ -119,46 +120,38 @@ void flush_thread(void)
119} 120}
120 121
121int copy_thread(unsigned long clone_flags, unsigned long usp, 122int copy_thread(unsigned long clone_flags, unsigned long usp,
122 unsigned long unused, 123 unsigned long arg, struct task_struct *p)
123 struct task_struct *p, struct pt_regs *regs)
124{ 124{
125 struct pt_regs *childregs = task_pt_regs(p); 125 struct pt_regs *childregs = task_pt_regs(p);
126 struct thread_info *ti = task_thread_info(p); 126 struct thread_info *ti = task_thread_info(p);
127 127
128 *childregs = *regs; 128 if (unlikely(p->flags & PF_KTHREAD)) {
129 if (user_mode(regs)) 129 /* if we're creating a new kernel thread then just zeroing all
130 * the registers. That's OK for a brand new thread.*/
131 memset(childregs, 0, sizeof(struct pt_regs));
132 memset(&ti->cpu_context, 0, sizeof(struct cpu_context));
133 ti->cpu_context.r1 = (unsigned long)childregs;
134 ti->cpu_context.r20 = (unsigned long)usp; /* fn */
135 ti->cpu_context.r19 = (unsigned long)arg;
136 childregs->pt_mode = 1;
137 local_save_flags(childregs->msr);
138#ifdef CONFIG_MMU
139 ti->cpu_context.msr = childregs->msr & ~MSR_IE;
140#endif
141 ti->cpu_context.r15 = (unsigned long)ret_from_kernel_thread - 8;
142 return 0;
143 }
144 *childregs = *current_pt_regs();
145 if (usp)
130 childregs->r1 = usp; 146 childregs->r1 = usp;
131 else
132 childregs->r1 = ((unsigned long) ti) + THREAD_SIZE;
133 147
134#ifndef CONFIG_MMU
135 memset(&ti->cpu_context, 0, sizeof(struct cpu_context)); 148 memset(&ti->cpu_context, 0, sizeof(struct cpu_context));
136 ti->cpu_context.r1 = (unsigned long)childregs; 149 ti->cpu_context.r1 = (unsigned long)childregs;
150#ifndef CONFIG_MMU
137 ti->cpu_context.msr = (unsigned long)childregs->msr; 151 ti->cpu_context.msr = (unsigned long)childregs->msr;
138#else 152#else
153 childregs->msr |= MSR_UMS;
139 154
140 /* if creating a kernel thread then update the current reg (we don't
141 * want to use the parent's value when restoring by POP_STATE) */
142 if (kernel_mode(regs))
143 /* save new current on stack to use POP_STATE */
144 childregs->CURRENT_TASK = (unsigned long)p;
145 /* if returning to user then use the parent's value of this register */
146
147 /* if we're creating a new kernel thread then just zeroing all
148 * the registers. That's OK for a brand new thread.*/
149 /* Pls. note that some of them will be restored in POP_STATE */
150 if (kernel_mode(regs))
151 memset(&ti->cpu_context, 0, sizeof(struct cpu_context));
152 /* if this thread is created for fork/vfork/clone, then we want to
153 * restore all the parent's context */
154 /* in addition to the registers which will be restored by POP_STATE */
155 else {
156 ti->cpu_context = *(struct cpu_context *)regs;
157 childregs->msr |= MSR_UMS;
158 }
159
160 /* FIXME STATE_SAVE_PT_OFFSET; */
161 ti->cpu_context.r1 = (unsigned long)childregs;
162 /* we should consider the fact that childregs is a copy of the parent 155 /* we should consider the fact that childregs is a copy of the parent
163 * regs which were saved immediately after entering the kernel state 156 * regs which were saved immediately after entering the kernel state
164 * before enabling VM. This MSR will be restored in switch_to and 157 * before enabling VM. This MSR will be restored in switch_to and
@@ -209,29 +202,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
209} 202}
210#endif 203#endif
211 204
212static void kernel_thread_helper(int (*fn)(void *), void *arg)
213{
214 fn(arg);
215 do_exit(-1);
216}
217
218int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
219{
220 struct pt_regs regs;
221
222 memset(&regs, 0, sizeof(regs));
223 /* store them in non-volatile registers */
224 regs.r5 = (unsigned long)fn;
225 regs.r6 = (unsigned long)arg;
226 local_save_flags(regs.msr);
227 regs.pc = (unsigned long)kernel_thread_helper;
228 regs.pt_mode = 1;
229
230 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
231 &regs, 0, NULL, NULL);
232}
233EXPORT_SYMBOL_GPL(kernel_thread);
234
235unsigned long get_wchan(struct task_struct *p) 205unsigned long get_wchan(struct task_struct *p)
236{ 206{
237/* TBD (used by procfs) */ 207/* TBD (used by procfs) */
@@ -246,6 +216,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp)
246 regs->pt_mode = 0; 216 regs->pt_mode = 0;
247#ifdef CONFIG_MMU 217#ifdef CONFIG_MMU
248 regs->msr |= MSR_UMS; 218 regs->msr |= MSR_UMS;
219 regs->msr &= ~MSR_VM;
249#endif 220#endif
250} 221}
251 222
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index 3847e5b9c60..3903e3d11f5 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -111,7 +111,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
111 111
112 /* It is more difficult to avoid calling this function than to 112 /* It is more difficult to avoid calling this function than to
113 call it and ignore errors. */ 113 call it and ignore errors. */
114 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->r1)) 114 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->r1) == -EFAULT)
115 goto badframe; 115 goto badframe;
116 116
117 return rval; 117 return rval;
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index 404c0f24bd4..63647c586b4 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -34,38 +34,6 @@
34 34
35#include <asm/syscalls.h> 35#include <asm/syscalls.h>
36 36
37asmlinkage long microblaze_vfork(struct pt_regs *regs)
38{
39 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
40 regs, 0, NULL, NULL);
41}
42
43asmlinkage long microblaze_clone(int flags, unsigned long stack,
44 struct pt_regs *regs)
45{
46 if (!stack)
47 stack = regs->r1;
48 return do_fork(flags, stack, regs, 0, NULL, NULL);
49}
50
51asmlinkage long microblaze_execve(const char __user *filenamei,
52 const char __user *const __user *argv,
53 const char __user *const __user *envp,
54 struct pt_regs *regs)
55{
56 int error;
57 struct filename *filename;
58
59 filename = getname(filenamei);
60 error = PTR_ERR(filename);
61 if (IS_ERR(filename))
62 goto out;
63 error = do_execve(filename->name, argv, envp, regs);
64 putname(filename);
65out:
66 return error;
67}
68
69asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 37asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
70 unsigned long prot, unsigned long flags, 38 unsigned long prot, unsigned long flags,
71 unsigned long fd, off_t pgoff) 39 unsigned long fd, off_t pgoff)
@@ -75,24 +43,3 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
75 43
76 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 44 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
77} 45}
78
79/*
80 * Do a system call from kernel instead of calling sys_execve so we
81 * end up with proper pt_regs.
82 */
83int kernel_execve(const char *filename,
84 const char *const argv[],
85 const char *const envp[])
86{
87 register const char *__a __asm__("r5") = filename;
88 register const void *__b __asm__("r6") = argv;
89 register const void *__c __asm__("r7") = envp;
90 register unsigned long __syscall __asm__("r12") = __NR_execve;
91 register unsigned long __ret __asm__("r3");
92 __asm__ __volatile__ ("brki r14, 0x8"
93 : "=r" (__ret), "=r" (__syscall)
94 : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
95 : "r4", "r8", "r9",
96 "r10", "r11", "r14", "cc", "memory");
97 return __ret;
98}
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 6a2b294ef6d..ff6431e5468 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -2,11 +2,7 @@ ENTRY(sys_call_table)
2 .long sys_restart_syscall /* 0 - old "setup()" system call, 2 .long sys_restart_syscall /* 0 - old "setup()" system call,
3 * used for restarting */ 3 * used for restarting */
4 .long sys_exit 4 .long sys_exit
5#ifdef CONFIG_MMU 5 .long sys_fork
6 .long sys_fork_wrapper
7#else
8 .long sys_ni_syscall
9#endif
10 .long sys_read 6 .long sys_read
11 .long sys_write 7 .long sys_write
12 .long sys_open /* 5 */ 8 .long sys_open /* 5 */
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 4dbb5055d04..a1c5b996d66 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1346,8 +1346,6 @@ void __init pcibios_resource_survey(void)
1346 pci_assign_unassigned_resources(); 1346 pci_assign_unassigned_resources();
1347} 1347}
1348 1348
1349#ifdef CONFIG_HOTPLUG
1350
1351/* This is used by the PCI hotplug driver to allocate resource 1349/* This is used by the PCI hotplug driver to allocate resource
1352 * of newly plugged busses. We can try to consolidate with the 1350 * of newly plugged busses. We can try to consolidate with the
1353 * rest of the code later, for now, keep it as-is as our main 1351 * rest of the code later, for now, keep it as-is as our main
@@ -1407,8 +1405,6 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1407} 1405}
1408EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); 1406EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1409 1407
1410#endif /* CONFIG_HOTPLUG */
1411
1412int pcibios_enable_device(struct pci_dev *dev, int mask) 1408int pcibios_enable_device(struct pci_dev *dev, int mask)
1413{ 1409{
1414 return pci_enable_resources(dev, mask); 1410 return pci_enable_resources(dev, mask);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b7dc39c6c84..d971d1586f1 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -41,6 +41,8 @@ config MIPS
41 select HAVE_MOD_ARCH_SPECIFIC 41 select HAVE_MOD_ARCH_SPECIFIC
42 select MODULES_USE_ELF_REL 42 select MODULES_USE_ELF_REL
43 select MODULES_USE_ELF_RELA if 64BIT 43 select MODULES_USE_ELF_RELA if 64BIT
44 select GENERIC_KERNEL_THREAD
45 select GENERIC_KERNEL_EXECVE
44 46
45menu "Machine selection" 47menu "Machine selection"
46 48
diff --git a/arch/mips/alchemy/common/Makefile b/arch/mips/alchemy/common/Makefile
index 407ebc00e66..cb83d8d21ae 100644
--- a/arch/mips/alchemy/common/Makefile
+++ b/arch/mips/alchemy/common/Makefile
@@ -6,7 +6,7 @@
6# 6#
7 7
8obj-y += prom.o time.o clocks.o platform.o power.o setup.o \ 8obj-y += prom.o time.o clocks.o platform.o power.o setup.o \
9 sleeper.o dma.o dbdma.o vss.o irq.o 9 sleeper.o dma.o dbdma.o vss.o irq.o usb.o
10 10
11# optional gpiolib support 11# optional gpiolib support
12ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),) 12ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),)
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index c0f3ce6dcb5..7af941d8e71 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -17,6 +17,8 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/serial_8250.h> 18#include <linux/serial_8250.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/usb/ehci_pdriver.h>
21#include <linux/usb/ohci_pdriver.h>
20 22
21#include <asm/mach-au1x00/au1000.h> 23#include <asm/mach-au1x00/au1000.h>
22#include <asm/mach-au1x00/au1xxx_dbdma.h> 24#include <asm/mach-au1x00/au1xxx_dbdma.h>
@@ -122,6 +124,53 @@ static void __init alchemy_setup_uarts(int ctype)
122static u64 alchemy_ohci_dmamask = DMA_BIT_MASK(32); 124static u64 alchemy_ohci_dmamask = DMA_BIT_MASK(32);
123static u64 __maybe_unused alchemy_ehci_dmamask = DMA_BIT_MASK(32); 125static u64 __maybe_unused alchemy_ehci_dmamask = DMA_BIT_MASK(32);
124 126
127/* Power on callback for the ehci platform driver */
128static int alchemy_ehci_power_on(struct platform_device *pdev)
129{
130 return alchemy_usb_control(ALCHEMY_USB_EHCI0, 1);
131}
132
133/* Power off/suspend callback for the ehci platform driver */
134static void alchemy_ehci_power_off(struct platform_device *pdev)
135{
136 alchemy_usb_control(ALCHEMY_USB_EHCI0, 0);
137}
138
139static struct usb_ehci_pdata alchemy_ehci_pdata = {
140 .no_io_watchdog = 1,
141 .power_on = alchemy_ehci_power_on,
142 .power_off = alchemy_ehci_power_off,
143 .power_suspend = alchemy_ehci_power_off,
144};
145
146/* Power on callback for the ohci platform driver */
147static int alchemy_ohci_power_on(struct platform_device *pdev)
148{
149 int unit;
150
151 unit = (pdev->id == 1) ?
152 ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0;
153
154 return alchemy_usb_control(unit, 1);
155}
156
157/* Power off/suspend callback for the ohci platform driver */
158static void alchemy_ohci_power_off(struct platform_device *pdev)
159{
160 int unit;
161
162 unit = (pdev->id == 1) ?
163 ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0;
164
165 alchemy_usb_control(unit, 0);
166}
167
168static struct usb_ohci_pdata alchemy_ohci_pdata = {
169 .power_on = alchemy_ohci_power_on,
170 .power_off = alchemy_ohci_power_off,
171 .power_suspend = alchemy_ohci_power_off,
172};
173
125static unsigned long alchemy_ohci_data[][2] __initdata = { 174static unsigned long alchemy_ohci_data[][2] __initdata = {
126 [ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT }, 175 [ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT },
127 [ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT }, 176 [ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT },
@@ -169,9 +218,10 @@ static void __init alchemy_setup_usb(int ctype)
169 res[1].start = alchemy_ohci_data[ctype][1]; 218 res[1].start = alchemy_ohci_data[ctype][1];
170 res[1].end = res[1].start; 219 res[1].end = res[1].start;
171 res[1].flags = IORESOURCE_IRQ; 220 res[1].flags = IORESOURCE_IRQ;
172 pdev->name = "au1xxx-ohci"; 221 pdev->name = "ohci-platform";
173 pdev->id = 0; 222 pdev->id = 0;
174 pdev->dev.dma_mask = &alchemy_ohci_dmamask; 223 pdev->dev.dma_mask = &alchemy_ohci_dmamask;
224 pdev->dev.platform_data = &alchemy_ohci_pdata;
175 225
176 if (platform_device_register(pdev)) 226 if (platform_device_register(pdev))
177 printk(KERN_INFO "Alchemy USB: cannot add OHCI0\n"); 227 printk(KERN_INFO "Alchemy USB: cannot add OHCI0\n");
@@ -188,9 +238,10 @@ static void __init alchemy_setup_usb(int ctype)
188 res[1].start = alchemy_ehci_data[ctype][1]; 238 res[1].start = alchemy_ehci_data[ctype][1];
189 res[1].end = res[1].start; 239 res[1].end = res[1].start;
190 res[1].flags = IORESOURCE_IRQ; 240 res[1].flags = IORESOURCE_IRQ;
191 pdev->name = "au1xxx-ehci"; 241 pdev->name = "ehci-platform";
192 pdev->id = 0; 242 pdev->id = 0;
193 pdev->dev.dma_mask = &alchemy_ehci_dmamask; 243 pdev->dev.dma_mask = &alchemy_ehci_dmamask;
244 pdev->dev.platform_data = &alchemy_ehci_pdata;
194 245
195 if (platform_device_register(pdev)) 246 if (platform_device_register(pdev))
196 printk(KERN_INFO "Alchemy USB: cannot add EHCI0\n"); 247 printk(KERN_INFO "Alchemy USB: cannot add EHCI0\n");
@@ -207,9 +258,10 @@ static void __init alchemy_setup_usb(int ctype)
207 res[1].start = AU1300_USB_INT; 258 res[1].start = AU1300_USB_INT;
208 res[1].end = res[1].start; 259 res[1].end = res[1].start;
209 res[1].flags = IORESOURCE_IRQ; 260 res[1].flags = IORESOURCE_IRQ;
210 pdev->name = "au1xxx-ohci"; 261 pdev->name = "ohci-platform";
211 pdev->id = 1; 262 pdev->id = 1;
212 pdev->dev.dma_mask = &alchemy_ohci_dmamask; 263 pdev->dev.dma_mask = &alchemy_ohci_dmamask;
264 pdev->dev.platform_data = &alchemy_ohci_pdata;
213 265
214 if (platform_device_register(pdev)) 266 if (platform_device_register(pdev))
215 printk(KERN_INFO "Alchemy USB: cannot add OHCI1\n"); 267 printk(KERN_INFO "Alchemy USB: cannot add OHCI1\n");
diff --git a/arch/mips/alchemy/common/usb.c b/arch/mips/alchemy/common/usb.c
new file mode 100644
index 00000000000..936af8359fb
--- /dev/null
+++ b/arch/mips/alchemy/common/usb.c
@@ -0,0 +1,614 @@
1/*
2 * USB block power/access management abstraction.
3 *
4 * Au1000+: The OHCI block control register is at the far end of the OHCI memory
5 * area. Au1550 has OHCI on different base address. No need to handle
6 * UDC here.
7 * Au1200: one register to control access and clocks to O/EHCI, UDC and OTG
8 * as well as the PHY for EHCI and UDC.
9 *
10 */
11
12#include <linux/init.h>
13#include <linux/io.h>
14#include <linux/module.h>
15#include <linux/spinlock.h>
16#include <linux/syscore_ops.h>
17#include <asm/mach-au1x00/au1000.h>
18
19/* control register offsets */
20#define AU1000_OHCICFG 0x7fffc
21#define AU1550_OHCICFG 0x07ffc
22#define AU1200_USBCFG 0x04
23
24/* Au1000 USB block config bits */
25#define USBHEN_RD (1 << 4) /* OHCI reset-done indicator */
26#define USBHEN_CE (1 << 3) /* OHCI block clock enable */
27#define USBHEN_E (1 << 2) /* OHCI block enable */
28#define USBHEN_C (1 << 1) /* OHCI block coherency bit */
29#define USBHEN_BE (1 << 0) /* OHCI Big-Endian */
30
31/* Au1200 USB config bits */
32#define USBCFG_PFEN (1 << 31) /* prefetch enable (undoc) */
33#define USBCFG_RDCOMB (1 << 30) /* read combining (undoc) */
34#define USBCFG_UNKNOWN (5 << 20) /* unknown, leave this way */
35#define USBCFG_SSD (1 << 23) /* serial short detect en */
36#define USBCFG_PPE (1 << 19) /* HS PHY PLL */
37#define USBCFG_UCE (1 << 18) /* UDC clock enable */
38#define USBCFG_ECE (1 << 17) /* EHCI clock enable */
39#define USBCFG_OCE (1 << 16) /* OHCI clock enable */
40#define USBCFG_FLA(x) (((x) & 0x3f) << 8)
41#define USBCFG_UCAM (1 << 7) /* coherent access (undoc) */
42#define USBCFG_GME (1 << 6) /* OTG mem access */
43#define USBCFG_DBE (1 << 5) /* UDC busmaster enable */
44#define USBCFG_DME (1 << 4) /* UDC mem enable */
45#define USBCFG_EBE (1 << 3) /* EHCI busmaster enable */
46#define USBCFG_EME (1 << 2) /* EHCI mem enable */
47#define USBCFG_OBE (1 << 1) /* OHCI busmaster enable */
48#define USBCFG_OME (1 << 0) /* OHCI mem enable */
49#define USBCFG_INIT_AU1200 (USBCFG_PFEN | USBCFG_RDCOMB | USBCFG_UNKNOWN |\
50 USBCFG_SSD | USBCFG_FLA(0x20) | USBCFG_UCAM | \
51 USBCFG_GME | USBCFG_DBE | USBCFG_DME | \
52 USBCFG_EBE | USBCFG_EME | USBCFG_OBE | \
53 USBCFG_OME)
54
55/* Au1300 USB config registers */
56#define USB_DWC_CTRL1 0x00
57#define USB_DWC_CTRL2 0x04
58#define USB_VBUS_TIMER 0x10
59#define USB_SBUS_CTRL 0x14
60#define USB_MSR_ERR 0x18
61#define USB_DWC_CTRL3 0x1C
62#define USB_DWC_CTRL4 0x20
63#define USB_OTG_STATUS 0x28
64#define USB_DWC_CTRL5 0x2C
65#define USB_DWC_CTRL6 0x30
66#define USB_DWC_CTRL7 0x34
67#define USB_PHY_STATUS 0xC0
68#define USB_INT_STATUS 0xC4
69#define USB_INT_ENABLE 0xC8
70
71#define USB_DWC_CTRL1_OTGD 0x04 /* set to DISable OTG */
72#define USB_DWC_CTRL1_HSTRS 0x02 /* set to ENable EHCI */
73#define USB_DWC_CTRL1_DCRS 0x01 /* set to ENable UDC */
74
75#define USB_DWC_CTRL2_PHY1RS 0x04 /* set to enable PHY1 */
76#define USB_DWC_CTRL2_PHY0RS 0x02 /* set to enable PHY0 */
77#define USB_DWC_CTRL2_PHYRS 0x01 /* set to enable PHY */
78
79#define USB_DWC_CTRL3_OHCI1_CKEN (1 << 19)
80#define USB_DWC_CTRL3_OHCI0_CKEN (1 << 18)
81#define USB_DWC_CTRL3_EHCI0_CKEN (1 << 17)
82#define USB_DWC_CTRL3_OTG0_CKEN (1 << 16)
83
84#define USB_SBUS_CTRL_SBCA 0x04 /* coherent access */
85
86#define USB_INTEN_FORCE 0x20
87#define USB_INTEN_PHY 0x10
88#define USB_INTEN_UDC 0x08
89#define USB_INTEN_EHCI 0x04
90#define USB_INTEN_OHCI1 0x02
91#define USB_INTEN_OHCI0 0x01
92
93static DEFINE_SPINLOCK(alchemy_usb_lock);
94
95static inline void __au1300_usb_phyctl(void __iomem *base, int enable)
96{
97 unsigned long r, s;
98
99 r = __raw_readl(base + USB_DWC_CTRL2);
100 s = __raw_readl(base + USB_DWC_CTRL3);
101
102 s &= USB_DWC_CTRL3_OHCI1_CKEN | USB_DWC_CTRL3_OHCI0_CKEN |
103 USB_DWC_CTRL3_EHCI0_CKEN | USB_DWC_CTRL3_OTG0_CKEN;
104
105 if (enable) {
106 /* simply enable all PHYs */
107 r |= USB_DWC_CTRL2_PHY1RS | USB_DWC_CTRL2_PHY0RS |
108 USB_DWC_CTRL2_PHYRS;
109 __raw_writel(r, base + USB_DWC_CTRL2);
110 wmb();
111 } else if (!s) {
112 /* no USB block active, do disable all PHYs */
113 r &= ~(USB_DWC_CTRL2_PHY1RS | USB_DWC_CTRL2_PHY0RS |
114 USB_DWC_CTRL2_PHYRS);
115 __raw_writel(r, base + USB_DWC_CTRL2);
116 wmb();
117 }
118}
119
120static inline void __au1300_ohci_control(void __iomem *base, int enable, int id)
121{
122 unsigned long r;
123
124 if (enable) {
125 __raw_writel(1, base + USB_DWC_CTRL7); /* start OHCI clock */
126 wmb();
127
128 r = __raw_readl(base + USB_DWC_CTRL3); /* enable OHCI block */
129 r |= (id == 0) ? USB_DWC_CTRL3_OHCI0_CKEN
130 : USB_DWC_CTRL3_OHCI1_CKEN;
131 __raw_writel(r, base + USB_DWC_CTRL3);
132 wmb();
133
134 __au1300_usb_phyctl(base, enable); /* power up the PHYs */
135
136 r = __raw_readl(base + USB_INT_ENABLE);
137 r |= (id == 0) ? USB_INTEN_OHCI0 : USB_INTEN_OHCI1;
138 __raw_writel(r, base + USB_INT_ENABLE);
139 wmb();
140
141 /* reset the OHCI start clock bit */
142 __raw_writel(0, base + USB_DWC_CTRL7);
143 wmb();
144 } else {
145 r = __raw_readl(base + USB_INT_ENABLE);
146 r &= ~((id == 0) ? USB_INTEN_OHCI0 : USB_INTEN_OHCI1);
147 __raw_writel(r, base + USB_INT_ENABLE);
148 wmb();
149
150 r = __raw_readl(base + USB_DWC_CTRL3);
151 r &= ~((id == 0) ? USB_DWC_CTRL3_OHCI0_CKEN
152 : USB_DWC_CTRL3_OHCI1_CKEN);
153 __raw_writel(r, base + USB_DWC_CTRL3);
154 wmb();
155
156 __au1300_usb_phyctl(base, enable);
157 }
158}
159
160static inline void __au1300_ehci_control(void __iomem *base, int enable)
161{
162 unsigned long r;
163
164 if (enable) {
165 r = __raw_readl(base + USB_DWC_CTRL3);
166 r |= USB_DWC_CTRL3_EHCI0_CKEN;
167 __raw_writel(r, base + USB_DWC_CTRL3);
168 wmb();
169
170 r = __raw_readl(base + USB_DWC_CTRL1);
171 r |= USB_DWC_CTRL1_HSTRS;
172 __raw_writel(r, base + USB_DWC_CTRL1);
173 wmb();
174
175 __au1300_usb_phyctl(base, enable);
176
177 r = __raw_readl(base + USB_INT_ENABLE);
178 r |= USB_INTEN_EHCI;
179 __raw_writel(r, base + USB_INT_ENABLE);
180 wmb();
181 } else {
182 r = __raw_readl(base + USB_INT_ENABLE);
183 r &= ~USB_INTEN_EHCI;
184 __raw_writel(r, base + USB_INT_ENABLE);
185 wmb();
186
187 r = __raw_readl(base + USB_DWC_CTRL1);
188 r &= ~USB_DWC_CTRL1_HSTRS;
189 __raw_writel(r, base + USB_DWC_CTRL1);
190 wmb();
191
192 r = __raw_readl(base + USB_DWC_CTRL3);
193 r &= ~USB_DWC_CTRL3_EHCI0_CKEN;
194 __raw_writel(r, base + USB_DWC_CTRL3);
195 wmb();
196
197 __au1300_usb_phyctl(base, enable);
198 }
199}
200
201static inline void __au1300_udc_control(void __iomem *base, int enable)
202{
203 unsigned long r;
204
205 if (enable) {
206 r = __raw_readl(base + USB_DWC_CTRL1);
207 r |= USB_DWC_CTRL1_DCRS;
208 __raw_writel(r, base + USB_DWC_CTRL1);
209 wmb();
210
211 __au1300_usb_phyctl(base, enable);
212
213 r = __raw_readl(base + USB_INT_ENABLE);
214 r |= USB_INTEN_UDC;
215 __raw_writel(r, base + USB_INT_ENABLE);
216 wmb();
217 } else {
218 r = __raw_readl(base + USB_INT_ENABLE);
219 r &= ~USB_INTEN_UDC;
220 __raw_writel(r, base + USB_INT_ENABLE);
221 wmb();
222
223 r = __raw_readl(base + USB_DWC_CTRL1);
224 r &= ~USB_DWC_CTRL1_DCRS;
225 __raw_writel(r, base + USB_DWC_CTRL1);
226 wmb();
227
228 __au1300_usb_phyctl(base, enable);
229 }
230}
231
232static inline void __au1300_otg_control(void __iomem *base, int enable)
233{
234 unsigned long r;
235 if (enable) {
236 r = __raw_readl(base + USB_DWC_CTRL3);
237 r |= USB_DWC_CTRL3_OTG0_CKEN;
238 __raw_writel(r, base + USB_DWC_CTRL3);
239 wmb();
240
241 r = __raw_readl(base + USB_DWC_CTRL1);
242 r &= ~USB_DWC_CTRL1_OTGD;
243 __raw_writel(r, base + USB_DWC_CTRL1);
244 wmb();
245
246 __au1300_usb_phyctl(base, enable);
247 } else {
248 r = __raw_readl(base + USB_DWC_CTRL1);
249 r |= USB_DWC_CTRL1_OTGD;
250 __raw_writel(r, base + USB_DWC_CTRL1);
251 wmb();
252
253 r = __raw_readl(base + USB_DWC_CTRL3);
254 r &= ~USB_DWC_CTRL3_OTG0_CKEN;
255 __raw_writel(r, base + USB_DWC_CTRL3);
256 wmb();
257
258 __au1300_usb_phyctl(base, enable);
259 }
260}
261
262static inline int au1300_usb_control(int block, int enable)
263{
264 void __iomem *base =
265 (void __iomem *)KSEG1ADDR(AU1300_USB_CTL_PHYS_ADDR);
266 int ret = 0;
267
268 switch (block) {
269 case ALCHEMY_USB_OHCI0:
270 __au1300_ohci_control(base, enable, 0);
271 break;
272 case ALCHEMY_USB_OHCI1:
273 __au1300_ohci_control(base, enable, 1);
274 break;
275 case ALCHEMY_USB_EHCI0:
276 __au1300_ehci_control(base, enable);
277 break;
278 case ALCHEMY_USB_UDC0:
279 __au1300_udc_control(base, enable);
280 break;
281 case ALCHEMY_USB_OTG0:
282 __au1300_otg_control(base, enable);
283 break;
284 default:
285 ret = -ENODEV;
286 }
287 return ret;
288}
289
290static inline void au1300_usb_init(void)
291{
292 void __iomem *base =
293 (void __iomem *)KSEG1ADDR(AU1300_USB_CTL_PHYS_ADDR);
294
295 /* set some sane defaults. Note: we don't fiddle with DWC_CTRL4
296 * here at all: Port 2 routing (EHCI or UDC) must be set either
297 * by boot firmware or platform init code; I can't autodetect
298 * a sane setting.
299 */
300 __raw_writel(0, base + USB_INT_ENABLE); /* disable all USB irqs */
301 wmb();
302 __raw_writel(0, base + USB_DWC_CTRL3); /* disable all clocks */
303 wmb();
304 __raw_writel(~0, base + USB_MSR_ERR); /* clear all errors */
305 wmb();
306 __raw_writel(~0, base + USB_INT_STATUS); /* clear int status */
307 wmb();
308 /* set coherent access bit */
309 __raw_writel(USB_SBUS_CTRL_SBCA, base + USB_SBUS_CTRL);
310 wmb();
311}
312
313static inline void __au1200_ohci_control(void __iomem *base, int enable)
314{
315 unsigned long r = __raw_readl(base + AU1200_USBCFG);
316 if (enable) {
317 __raw_writel(r | USBCFG_OCE, base + AU1200_USBCFG);
318 wmb();
319 udelay(2000);
320 } else {
321 __raw_writel(r & ~USBCFG_OCE, base + AU1200_USBCFG);
322 wmb();
323 udelay(1000);
324 }
325}
326
327static inline void __au1200_ehci_control(void __iomem *base, int enable)
328{
329 unsigned long r = __raw_readl(base + AU1200_USBCFG);
330 if (enable) {
331 __raw_writel(r | USBCFG_ECE | USBCFG_PPE, base + AU1200_USBCFG);
332 wmb();
333 udelay(1000);
334 } else {
335 if (!(r & USBCFG_UCE)) /* UDC also off? */
336 r &= ~USBCFG_PPE; /* yes: disable HS PHY PLL */
337 __raw_writel(r & ~USBCFG_ECE, base + AU1200_USBCFG);
338 wmb();
339 udelay(1000);
340 }
341}
342
343static inline void __au1200_udc_control(void __iomem *base, int enable)
344{
345 unsigned long r = __raw_readl(base + AU1200_USBCFG);
346 if (enable) {
347 __raw_writel(r | USBCFG_UCE | USBCFG_PPE, base + AU1200_USBCFG);
348 wmb();
349 } else {
350 if (!(r & USBCFG_ECE)) /* EHCI also off? */
351 r &= ~USBCFG_PPE; /* yes: disable HS PHY PLL */
352 __raw_writel(r & ~USBCFG_UCE, base + AU1200_USBCFG);
353 wmb();
354 }
355}
356
357static inline int au1200_coherency_bug(void)
358{
359#if defined(CONFIG_DMA_COHERENT)
360 /* Au1200 AB USB does not support coherent memory */
361 if (!(read_c0_prid() & 0xff)) {
362 printk(KERN_INFO "Au1200 USB: this is chip revision AB !!\n");
363 printk(KERN_INFO "Au1200 USB: update your board or re-configure"
364 " the kernel\n");
365 return -ENODEV;
366 }
367#endif
368 return 0;
369}
370
371static inline int au1200_usb_control(int block, int enable)
372{
373 void __iomem *base =
374 (void __iomem *)KSEG1ADDR(AU1200_USB_CTL_PHYS_ADDR);
375 int ret = 0;
376
377 switch (block) {
378 case ALCHEMY_USB_OHCI0:
379 ret = au1200_coherency_bug();
380 if (ret && enable)
381 goto out;
382 __au1200_ohci_control(base, enable);
383 break;
384 case ALCHEMY_USB_UDC0:
385 __au1200_udc_control(base, enable);
386 break;
387 case ALCHEMY_USB_EHCI0:
388 ret = au1200_coherency_bug();
389 if (ret && enable)
390 goto out;
391 __au1200_ehci_control(base, enable);
392 break;
393 default:
394 ret = -ENODEV;
395 }
396out:
397 return ret;
398}
399
400
401/* initialize USB block(s) to a known working state */
402static inline void au1200_usb_init(void)
403{
404 void __iomem *base =
405 (void __iomem *)KSEG1ADDR(AU1200_USB_CTL_PHYS_ADDR);
406 __raw_writel(USBCFG_INIT_AU1200, base + AU1200_USBCFG);
407 wmb();
408 udelay(1000);
409}
410
411static inline void au1000_usb_init(unsigned long rb, int reg)
412{
413 void __iomem *base = (void __iomem *)KSEG1ADDR(rb + reg);
414 unsigned long r = __raw_readl(base);
415
416#if defined(__BIG_ENDIAN)
417 r |= USBHEN_BE;
418#endif
419 r |= USBHEN_C;
420
421 __raw_writel(r, base);
422 wmb();
423 udelay(1000);
424}
425
426
427static inline void __au1xx0_ohci_control(int enable, unsigned long rb, int creg)
428{
429 void __iomem *base = (void __iomem *)KSEG1ADDR(rb);
430 unsigned long r = __raw_readl(base + creg);
431
432 if (enable) {
433 __raw_writel(r | USBHEN_CE, base + creg);
434 wmb();
435 udelay(1000);
436 __raw_writel(r | USBHEN_CE | USBHEN_E, base + creg);
437 wmb();
438 udelay(1000);
439
440 /* wait for reset complete (read reg twice: au1500 erratum) */
441 while (__raw_readl(base + creg),
442 !(__raw_readl(base + creg) & USBHEN_RD))
443 udelay(1000);
444 } else {
445 __raw_writel(r & ~(USBHEN_CE | USBHEN_E), base + creg);
446 wmb();
447 }
448}
449
450static inline int au1000_usb_control(int block, int enable, unsigned long rb,
451 int creg)
452{
453 int ret = 0;
454
455 switch (block) {
456 case ALCHEMY_USB_OHCI0:
457 __au1xx0_ohci_control(enable, rb, creg);
458 break;
459 default:
460 ret = -ENODEV;
461 }
462 return ret;
463}
464
465/*
466 * alchemy_usb_control - control Alchemy on-chip USB blocks
467 * @block: USB block to target
468 * @enable: set 1 to enable a block, 0 to disable
469 */
470int alchemy_usb_control(int block, int enable)
471{
472 unsigned long flags;
473 int ret;
474
475 spin_lock_irqsave(&alchemy_usb_lock, flags);
476 switch (alchemy_get_cputype()) {
477 case ALCHEMY_CPU_AU1000:
478 case ALCHEMY_CPU_AU1500:
479 case ALCHEMY_CPU_AU1100:
480 ret = au1000_usb_control(block, enable,
481 AU1000_USB_OHCI_PHYS_ADDR, AU1000_OHCICFG);
482 break;
483 case ALCHEMY_CPU_AU1550:
484 ret = au1000_usb_control(block, enable,
485 AU1550_USB_OHCI_PHYS_ADDR, AU1550_OHCICFG);
486 break;
487 case ALCHEMY_CPU_AU1200:
488 ret = au1200_usb_control(block, enable);
489 break;
490 case ALCHEMY_CPU_AU1300:
491 ret = au1300_usb_control(block, enable);
492 break;
493 default:
494 ret = -ENODEV;
495 }
496 spin_unlock_irqrestore(&alchemy_usb_lock, flags);
497 return ret;
498}
499EXPORT_SYMBOL_GPL(alchemy_usb_control);
500
501
502static unsigned long alchemy_usb_pmdata[2];
503
504static void au1000_usb_pm(unsigned long br, int creg, int susp)
505{
506 void __iomem *base = (void __iomem *)KSEG1ADDR(br);
507
508 if (susp) {
509 alchemy_usb_pmdata[0] = __raw_readl(base + creg);
510 /* There appears to be some undocumented reset register.... */
511 __raw_writel(0, base + 0x04);
512 wmb();
513 __raw_writel(0, base + creg);
514 wmb();
515 } else {
516 __raw_writel(alchemy_usb_pmdata[0], base + creg);
517 wmb();
518 }
519}
520
521static void au1200_usb_pm(int susp)
522{
523 void __iomem *base =
524 (void __iomem *)KSEG1ADDR(AU1200_USB_OTG_PHYS_ADDR);
525 if (susp) {
526 /* save OTG_CAP/MUX registers which indicate port routing */
527 /* FIXME: write an OTG driver to do that */
528 alchemy_usb_pmdata[0] = __raw_readl(base + 0x00);
529 alchemy_usb_pmdata[1] = __raw_readl(base + 0x04);
530 } else {
531 /* restore access to all MMIO areas */
532 au1200_usb_init();
533
534 /* restore OTG_CAP/MUX registers */
535 __raw_writel(alchemy_usb_pmdata[0], base + 0x00);
536 __raw_writel(alchemy_usb_pmdata[1], base + 0x04);
537 wmb();
538 }
539}
540
541static void au1300_usb_pm(int susp)
542{
543 void __iomem *base =
544 (void __iomem *)KSEG1ADDR(AU1300_USB_CTL_PHYS_ADDR);
545 /* remember Port2 routing */
546 if (susp) {
547 alchemy_usb_pmdata[0] = __raw_readl(base + USB_DWC_CTRL4);
548 } else {
549 au1300_usb_init();
550 __raw_writel(alchemy_usb_pmdata[0], base + USB_DWC_CTRL4);
551 wmb();
552 }
553}
554
555static void alchemy_usb_pm(int susp)
556{
557 switch (alchemy_get_cputype()) {
558 case ALCHEMY_CPU_AU1000:
559 case ALCHEMY_CPU_AU1500:
560 case ALCHEMY_CPU_AU1100:
561 au1000_usb_pm(AU1000_USB_OHCI_PHYS_ADDR, AU1000_OHCICFG, susp);
562 break;
563 case ALCHEMY_CPU_AU1550:
564 au1000_usb_pm(AU1550_USB_OHCI_PHYS_ADDR, AU1550_OHCICFG, susp);
565 break;
566 case ALCHEMY_CPU_AU1200:
567 au1200_usb_pm(susp);
568 break;
569 case ALCHEMY_CPU_AU1300:
570 au1300_usb_pm(susp);
571 break;
572 }
573}
574
575static int alchemy_usb_suspend(void)
576{
577 alchemy_usb_pm(1);
578 return 0;
579}
580
581static void alchemy_usb_resume(void)
582{
583 alchemy_usb_pm(0);
584}
585
586static struct syscore_ops alchemy_usb_pm_ops = {
587 .suspend = alchemy_usb_suspend,
588 .resume = alchemy_usb_resume,
589};
590
591static int __init alchemy_usb_init(void)
592{
593 switch (alchemy_get_cputype()) {
594 case ALCHEMY_CPU_AU1000:
595 case ALCHEMY_CPU_AU1500:
596 case ALCHEMY_CPU_AU1100:
597 au1000_usb_init(AU1000_USB_OHCI_PHYS_ADDR, AU1000_OHCICFG);
598 break;
599 case ALCHEMY_CPU_AU1550:
600 au1000_usb_init(AU1550_USB_OHCI_PHYS_ADDR, AU1550_OHCICFG);
601 break;
602 case ALCHEMY_CPU_AU1200:
603 au1200_usb_init();
604 break;
605 case ALCHEMY_CPU_AU1300:
606 au1300_usb_init();
607 break;
608 }
609
610 register_syscore_ops(&alchemy_usb_pm_ops);
611
612 return 0;
613}
614arch_initcall(alchemy_usb_init);
diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c
index 072bb9be230..bd2bc108e1b 100644
--- a/arch/mips/ath79/dev-usb.c
+++ b/arch/mips/ath79/dev-usb.c
@@ -50,13 +50,11 @@ static u64 ath79_ehci_dmamask = DMA_BIT_MASK(32);
50 50
51static struct usb_ehci_pdata ath79_ehci_pdata_v1 = { 51static struct usb_ehci_pdata ath79_ehci_pdata_v1 = {
52 .has_synopsys_hc_bug = 1, 52 .has_synopsys_hc_bug = 1,
53 .port_power_off = 1,
54}; 53};
55 54
56static struct usb_ehci_pdata ath79_ehci_pdata_v2 = { 55static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
57 .caps_offset = 0x100, 56 .caps_offset = 0x100,
58 .has_tt = 1, 57 .has_tt = 1,
59 .port_power_off = 1,
60}; 58};
61 59
62static struct platform_device ath79_ehci_device = { 60static struct platform_device ath79_ehci_device = {
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index d43ceff5be4..48a4c70b384 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -43,8 +43,8 @@ static void early_nvram_init(void)
43#ifdef CONFIG_BCM47XX_SSB 43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB: 44 case BCM47XX_BUS_TYPE_SSB:
45 mcore_ssb = &bcm47xx_bus.ssb.mipscore; 45 mcore_ssb = &bcm47xx_bus.ssb.mipscore;
46 base = mcore_ssb->flash_window; 46 base = mcore_ssb->pflash.window;
47 lim = mcore_ssb->flash_window_size; 47 lim = mcore_ssb->pflash.window_size;
48 break; 48 break;
49#endif 49#endif
50#ifdef CONFIG_BCM47XX_BCMA 50#ifdef CONFIG_BCM47XX_BCMA
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index 6c28f6d891d..9d111e8087e 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -160,10 +160,10 @@ static int __init wgt634u_init(void)
160 SSB_CHIPCO_IRQ_GPIO); 160 SSB_CHIPCO_IRQ_GPIO);
161 } 161 }
162 162
163 wgt634u_flash_data.width = mcore->flash_buswidth; 163 wgt634u_flash_data.width = mcore->pflash.buswidth;
164 wgt634u_flash_resource.start = mcore->flash_window; 164 wgt634u_flash_resource.start = mcore->pflash.window;
165 wgt634u_flash_resource.end = mcore->flash_window 165 wgt634u_flash_resource.end = mcore->pflash.window
166 + mcore->flash_window_size 166 + mcore->pflash.window_size
167 - 1; 167 - 1;
168 return platform_add_devices(wgt634u_devices, 168 return platform_add_devices(wgt634u_devices,
169 ARRAY_SIZE(wgt634u_devices)); 169 ARRAY_SIZE(wgt634u_devices));
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index bc96e2908f1..6e927cf20df 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -24,9 +24,6 @@ DTB_FILES = $(patsubst %.dts, %.dtb, $(DTS_FILES))
24 24
25obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES)) 25obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES))
26 26
27$(obj)/%.dtb: $(src)/%.dts FORCE
28 $(call if_changed_dep,dtc)
29
30# Let's keep the .dtb files around in case we want to look at them. 27# Let's keep the .dtb files around in case we want to look at them.
31.SECONDARY: $(addprefix $(obj)/, $(DTB_FILES)) 28.SECONDARY: $(addprefix $(obj)/, $(DTB_FILES))
32 29
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index b6fde2bb51b..4ca8e5c9922 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -473,7 +473,7 @@ CONFIG_USB_GADGET_NET2280=y
473CONFIG_USB_ZERO=m 473CONFIG_USB_ZERO=m
474CONFIG_USB_ETH=m 474CONFIG_USB_ETH=m
475CONFIG_USB_GADGETFS=m 475CONFIG_USB_GADGETFS=m
476CONFIG_USB_FILE_STORAGE=m 476CONFIG_USB_MASS_STORAGE=m
477CONFIG_USB_G_SERIAL=m 477CONFIG_USB_G_SERIAL=m
478CONFIG_USB_MIDI_GADGET=m 478CONFIG_USB_MIDI_GADGET=m
479CONFIG_LEDS_CLASS=y 479CONFIG_LEDS_CLASS=y
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index 17a36c12517..face9d26e6d 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -233,6 +233,7 @@ CONFIG_USB_EHCI_HCD=y
233CONFIG_USB_EHCI_ROOT_HUB_TT=y 233CONFIG_USB_EHCI_ROOT_HUB_TT=y
234CONFIG_USB_EHCI_TT_NEWSCHED=y 234CONFIG_USB_EHCI_TT_NEWSCHED=y
235CONFIG_USB_OHCI_HCD=y 235CONFIG_USB_OHCI_HCD=y
236CONFIG_USB_OHCI_HCD_PLATFORM=y
236CONFIG_USB_UHCI_HCD=y 237CONFIG_USB_UHCI_HCD=y
237CONFIG_USB_STORAGE=y 238CONFIG_USB_STORAGE=y
238CONFIG_NEW_LEDS=y 239CONFIG_NEW_LEDS=y
diff --git a/arch/mips/configs/db1235_defconfig b/arch/mips/configs/db1235_defconfig
index c48998ffd19..14752dde754 100644
--- a/arch/mips/configs/db1235_defconfig
+++ b/arch/mips/configs/db1235_defconfig
@@ -346,8 +346,10 @@ CONFIG_USB=y
346CONFIG_USB_DYNAMIC_MINORS=y 346CONFIG_USB_DYNAMIC_MINORS=y
347CONFIG_USB_SUSPEND=y 347CONFIG_USB_SUSPEND=y
348CONFIG_USB_EHCI_HCD=y 348CONFIG_USB_EHCI_HCD=y
349CONFIG_USB_EHCI_HCD_PLATFORM=y
349CONFIG_USB_EHCI_ROOT_HUB_TT=y 350CONFIG_USB_EHCI_ROOT_HUB_TT=y
350CONFIG_USB_OHCI_HCD=y 351CONFIG_USB_OHCI_HCD=y
352CONFIG_USB_OHCI_HCD_PLATFORM=y
351CONFIG_USB_STORAGE=y 353CONFIG_USB_STORAGE=y
352CONFIG_MMC=y 354CONFIG_MMC=y
353CONFIG_MMC_CLKGATE=y 355CONFIG_MMC_CLKGATE=y
diff --git a/arch/mips/configs/gpr_defconfig b/arch/mips/configs/gpr_defconfig
index 48a40aefaf5..fb64589015f 100644
--- a/arch/mips/configs/gpr_defconfig
+++ b/arch/mips/configs/gpr_defconfig
@@ -291,6 +291,7 @@ CONFIG_USB_MON=y
291CONFIG_USB_EHCI_HCD=y 291CONFIG_USB_EHCI_HCD=y
292CONFIG_USB_EHCI_ROOT_HUB_TT=y 292CONFIG_USB_EHCI_ROOT_HUB_TT=y
293CONFIG_USB_OHCI_HCD=y 293CONFIG_USB_OHCI_HCD=y
294CONFIG_USB_OHCI_HCD_PLATFORM=y
294CONFIG_USB_STORAGE=m 295CONFIG_USB_STORAGE=m
295CONFIG_USB_LIBUSUAL=y 296CONFIG_USB_LIBUSUAL=y
296CONFIG_USB_SERIAL=y 297CONFIG_USB_SERIAL=y
diff --git a/arch/mips/configs/ls1b_defconfig b/arch/mips/configs/ls1b_defconfig
index 80cff8bea8e..7eb75543ca1 100644
--- a/arch/mips/configs/ls1b_defconfig
+++ b/arch/mips/configs/ls1b_defconfig
@@ -76,6 +76,7 @@ CONFIG_HID_GENERIC=m
76CONFIG_USB=y 76CONFIG_USB=y
77CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 77CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
78CONFIG_USB_EHCI_HCD=y 78CONFIG_USB_EHCI_HCD=y
79CONFIG_USB_EHCI_HCD_PLATFORM=y
79# CONFIG_USB_EHCI_TT_NEWSCHED is not set 80# CONFIG_USB_EHCI_TT_NEWSCHED is not set
80CONFIG_USB_STORAGE=m 81CONFIG_USB_STORAGE=m
81CONFIG_USB_SERIAL=m 82CONFIG_USB_SERIAL=m
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index 46c61edcdf7..9fa8f16068d 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -581,6 +581,7 @@ CONFIG_USB_MON=m
581CONFIG_USB_EHCI_HCD=m 581CONFIG_USB_EHCI_HCD=m
582CONFIG_USB_EHCI_ROOT_HUB_TT=y 582CONFIG_USB_EHCI_ROOT_HUB_TT=y
583CONFIG_USB_OHCI_HCD=m 583CONFIG_USB_OHCI_HCD=m
584CONFIG_USB_OHCI_HCD_PLATFORM=y
584CONFIG_USB_UHCI_HCD=m 585CONFIG_USB_UHCI_HCD=m
585CONFIG_USB_U132_HCD=m 586CONFIG_USB_U132_HCD=m
586CONFIG_USB_SL811_HCD=m 587CONFIG_USB_SL811_HCD=m
@@ -661,7 +662,7 @@ CONFIG_USB_GADGET_NET2280=y
661CONFIG_USB_ZERO=m 662CONFIG_USB_ZERO=m
662CONFIG_USB_ETH=m 663CONFIG_USB_ETH=m
663CONFIG_USB_GADGETFS=m 664CONFIG_USB_GADGETFS=m
664CONFIG_USB_FILE_STORAGE=m 665CONFIG_USB_MASS_STORAGE=m
665CONFIG_USB_G_SERIAL=m 666CONFIG_USB_G_SERIAL=m
666CONFIG_USB_MIDI_GADGET=m 667CONFIG_USB_MIDI_GADGET=m
667CONFIG_MMC=m 668CONFIG_MMC=m
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 533053d12ce..9b54b7a403d 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -1 +1,2 @@
1# MIPS headers 1# MIPS headers
2generic-y += trace_clock.h
diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h
index bd94946a18f..ef99db994c2 100644
--- a/arch/mips/include/asm/hugetlb.h
+++ b/arch/mips/include/asm/hugetlb.h
@@ -95,7 +95,17 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
95 pte_t *ptep, pte_t pte, 95 pte_t *ptep, pte_t pte,
96 int dirty) 96 int dirty)
97{ 97{
98 return ptep_set_access_flags(vma, addr, ptep, pte, dirty); 98 int changed = !pte_same(*ptep, pte);
99
100 if (changed) {
101 set_pte_at(vma->vm_mm, addr, ptep, pte);
102 /*
103 * There could be some standard sized pages in there,
104 * get them all.
105 */
106 flush_tlb_range(vma, addr, addr + HPAGE_SIZE);
107 }
108 return changed;
99} 109}
100 110
101static inline pte_t huge_ptep_get(pte_t *ptep) 111static inline pte_t huge_ptep_get(pte_t *ptep)
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 252202d24a8..ec50d52cfb7 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -77,16 +77,7 @@ extern unsigned long zero_page_mask;
77 77
78#define ZERO_PAGE(vaddr) \ 78#define ZERO_PAGE(vaddr) \
79 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))) 79 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
80 80#define __HAVE_COLOR_ZERO_PAGE
81#define is_zero_pfn is_zero_pfn
82static inline int is_zero_pfn(unsigned long pfn)
83{
84 extern unsigned long zero_pfn;
85 unsigned long offset_from_zero_pfn = pfn - zero_pfn;
86 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
87}
88
89#define my_zero_pfn(addr) page_to_pfn(ZERO_PAGE(addr))
90 81
91extern void paging_init(void); 82extern void paging_init(void);
92 83
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index 8481c1a5219..bd98b503f04 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -306,8 +306,6 @@ struct task_struct;
306/* Free all resources held by a thread. */ 306/* Free all resources held by a thread. */
307#define release_thread(thread) do { } while(0) 307#define release_thread(thread) do { } while(0)
308 308
309extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
310
311extern unsigned long thread_saved_pc(struct task_struct *tsk); 309extern unsigned long thread_saved_pc(struct task_struct *tsk);
312 310
313/* 311/*
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index 4f5da948a77..cec5e125f7e 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -61,4 +61,10 @@ static inline void die_if_kernel(const char *str, struct pt_regs *regs)
61 die(str, regs); 61 die(str, regs);
62} 62}
63 63
64#define current_pt_regs() \
65({ \
66 unsigned long sp = (unsigned long)__builtin_frame_address(0); \
67 (struct pt_regs *)((sp | (THREAD_SIZE - 1)) + 1 - 32) - 1; \
68})
69
64#endif /* _ASM_PTRACE_H */ 70#endif /* _ASM_PTRACE_H */
diff --git a/arch/mips/include/asm/signal.h b/arch/mips/include/asm/signal.h
index 880240dff8b..cf4a08062d1 100644
--- a/arch/mips/include/asm/signal.h
+++ b/arch/mips/include/asm/signal.h
@@ -21,6 +21,4 @@
21#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
22#include <asm/siginfo.h> 22#include <asm/siginfo.h>
23 23
24#define ptrace_signal_deliver(regs, cookie) do { } while (0)
25
26#endif /* _ASM_SIGNAL_H */ 24#endif /* _ASM_SIGNAL_H */
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 9e47cc11aa2..b306e2081ca 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -20,6 +20,7 @@
20#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64 20#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64
21#define __ARCH_WANT_OLD_READDIR 21#define __ARCH_WANT_OLD_READDIR
22#define __ARCH_WANT_SYS_ALARM 22#define __ARCH_WANT_SYS_ALARM
23#define __ARCH_WANT_SYS_EXECVE
23#define __ARCH_WANT_SYS_GETHOSTNAME 24#define __ARCH_WANT_SYS_GETHOSTNAME
24#define __ARCH_WANT_SYS_IPC 25#define __ARCH_WANT_SYS_IPC
25#define __ARCH_WANT_SYS_PAUSE 26#define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/mips/include/uapi/asm/ioctls.h b/arch/mips/include/uapi/asm/ioctls.h
index 92403c3d600..addd56b6069 100644
--- a/arch/mips/include/uapi/asm/ioctls.h
+++ b/arch/mips/include/uapi/asm/ioctls.h
@@ -86,6 +86,9 @@
86#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ 86#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
87#define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */ 87#define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */
88#define TIOCVHANGUP 0x5437 88#define TIOCVHANGUP 0x5437
89#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
90#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
91#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
89 92
90/* I hope the range from 0x5480 on is free ... */ 93/* I hope the range from 0x5480 on is free ... */
91#define TIOCSCTTY 0x5480 /* become controlling tty */ 94#define TIOCSCTTY 0x5480 /* become controlling tty */
diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h
index 46d3da0d4b9..9a936ac9a94 100644
--- a/arch/mips/include/uapi/asm/mman.h
+++ b/arch/mips/include/uapi/asm/mman.h
@@ -87,4 +87,15 @@
87/* compatibility flags */ 87/* compatibility flags */
88#define MAP_FILE 0 88#define MAP_FILE 0
89 89
90/*
91 * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
92 * This gives us 6 bits, which is enough until someone invents 128 bit address
93 * spaces.
94 *
95 * Assume these are all power of twos.
96 * When 0 use the default page size.
97 */
98#define MAP_HUGE_SHIFT 26
99#define MAP_HUGE_MASK 0x3f
100
90#endif /* _ASM_MMAN_H */ 101#endif /* _ASM_MMAN_H */
diff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h
index c5ed59549cb..17307ab9047 100644
--- a/arch/mips/include/uapi/asm/socket.h
+++ b/arch/mips/include/uapi/asm/socket.h
@@ -63,6 +63,7 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
63/* Socket filtering */ 63/* Socket filtering */
64#define SO_ATTACH_FILTER 26 64#define SO_ATTACH_FILTER 26
65#define SO_DETACH_FILTER 27 65#define SO_DETACH_FILTER 27
66#define SO_GET_FILTER SO_ATTACH_FILTER
66 67
67#define SO_PEERNAME 28 68#define SO_PEERNAME 28
68#define SO_TIMESTAMP 29 69#define SO_TIMESTAMP 29
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index b1fb7af3c35..cce3782c96c 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -510,7 +510,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
510 c->cputype = CPU_R3000A; 510 c->cputype = CPU_R3000A;
511 __cpu_name[cpu] = "R3000A"; 511 __cpu_name[cpu] = "R3000A";
512 } 512 }
513 break;
514 } else { 513 } else {
515 c->cputype = CPU_R3000; 514 c->cputype = CPU_R3000;
516 __cpu_name[cpu] = "R3000"; 515 __cpu_name[cpu] = "R3000";
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
index a6c13321200..e5786858cdb 100644
--- a/arch/mips/kernel/entry.S
+++ b/arch/mips/kernel/entry.S
@@ -36,6 +36,11 @@ FEXPORT(ret_from_exception)
36FEXPORT(ret_from_irq) 36FEXPORT(ret_from_irq)
37 LONG_S s0, TI_REGS($28) 37 LONG_S s0, TI_REGS($28)
38FEXPORT(__ret_from_irq) 38FEXPORT(__ret_from_irq)
39/*
40 * We can be coming here from a syscall done in the kernel space,
41 * e.g. a failed kernel_execve().
42 */
43resume_userspace_check:
39 LONG_L t0, PT_STATUS(sp) # returning to kernel mode? 44 LONG_L t0, PT_STATUS(sp) # returning to kernel mode?
40 andi t0, t0, KU_USER 45 andi t0, t0, KU_USER
41 beqz t0, resume_kernel 46 beqz t0, resume_kernel
@@ -65,6 +70,12 @@ need_resched:
65 b need_resched 70 b need_resched
66#endif 71#endif
67 72
73FEXPORT(ret_from_kernel_thread)
74 jal schedule_tail # a0 = struct task_struct *prev
75 move a0, s1
76 jal s0
77 j syscall_exit
78
68FEXPORT(ret_from_fork) 79FEXPORT(ret_from_fork)
69 jal schedule_tail # a0 = struct task_struct *prev 80 jal schedule_tail # a0 = struct task_struct *prev
70 81
@@ -162,7 +173,7 @@ work_notifysig: # deal with pending signals and
162 move a0, sp 173 move a0, sp
163 li a1, 0 174 li a1, 0
164 jal do_notify_resume # a2 already loaded 175 jal do_notify_resume # a2 already loaded
165 j resume_userspace 176 j resume_userspace_check
166 177
167FEXPORT(syscall_exit_partial) 178FEXPORT(syscall_exit_partial)
168 local_irq_disable # make sure need_resched doesn't 179 local_irq_disable # make sure need_resched doesn't
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 3a21acedf88..7adab86c632 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * Copyright (C) 2000 Silicon Graphics, Inc. 4 * Copyright (C) 2000 Silicon Graphics, Inc.
5 * Written by Ulf Carlsson (ulfc@engr.sgi.com) 5 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
6 * sys32_execve from ia64/ia32 code, Feb 2000, Kanoj Sarcar (kanoj@sgi.com)
7 */ 6 */
8#include <linux/compiler.h> 7#include <linux/compiler.h>
9#include <linux/mm.h> 8#include <linux/mm.h>
@@ -77,26 +76,6 @@ out:
77 return error; 76 return error;
78} 77}
79 78
80/*
81 * sys_execve() executes a new program.
82 */
83asmlinkage int sys32_execve(nabi_no_regargs struct pt_regs regs)
84{
85 int error;
86 struct filename *filename;
87
88 filename = getname(compat_ptr(regs.regs[4]));
89 error = PTR_ERR(filename);
90 if (IS_ERR(filename))
91 goto out;
92 error = compat_do_execve(filename->name, compat_ptr(regs.regs[5]),
93 compat_ptr(regs.regs[6]), &regs);
94 putname(filename);
95
96out:
97 return error;
98}
99
100#define RLIM_INFINITY32 0x7fffffff 79#define RLIM_INFINITY32 0x7fffffff
101#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x) 80#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
102 81
@@ -333,7 +312,7 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
333 /* Use __dummy4 instead of getting it off the stack, so that 312 /* Use __dummy4 instead of getting it off the stack, so that
334 syscall() works. */ 313 syscall() works. */
335 child_tidptr = (int __user *) __dummy4; 314 child_tidptr = (int __user *) __dummy4;
336 return do_fork(clone_flags, newsp, &regs, 0, 315 return do_fork(clone_flags, newsp, 0,
337 parent_tidptr, child_tidptr); 316 parent_tidptr, child_tidptr);
338} 317}
339 318
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 1ba8933683a..df1e3e455f9 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -32,8 +32,6 @@ EXPORT_SYMBOL(memset);
32EXPORT_SYMBOL(memcpy); 32EXPORT_SYMBOL(memcpy);
33EXPORT_SYMBOL(memmove); 33EXPORT_SYMBOL(memmove);
34 34
35EXPORT_SYMBOL(kernel_thread);
36
37/* 35/*
38 * Functions that operate on entire pages. Mostly used by memory management. 36 * Functions that operate on entire pages. Mostly used by memory management.
39 */ 37 */
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 69b17a92004..a11c6f9fdd5 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -82,6 +82,7 @@ void __noreturn cpu_idle(void)
82} 82}
83 83
84asmlinkage void ret_from_fork(void); 84asmlinkage void ret_from_fork(void);
85asmlinkage void ret_from_kernel_thread(void);
85 86
86void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp) 87void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
87{ 88{
@@ -111,10 +112,10 @@ void flush_thread(void)
111} 112}
112 113
113int copy_thread(unsigned long clone_flags, unsigned long usp, 114int copy_thread(unsigned long clone_flags, unsigned long usp,
114 unsigned long unused, struct task_struct *p, struct pt_regs *regs) 115 unsigned long arg, struct task_struct *p)
115{ 116{
116 struct thread_info *ti = task_thread_info(p); 117 struct thread_info *ti = task_thread_info(p);
117 struct pt_regs *childregs; 118 struct pt_regs *childregs, *regs = current_pt_regs();
118 unsigned long childksp; 119 unsigned long childksp;
119 p->set_child_tid = p->clear_child_tid = NULL; 120 p->set_child_tid = p->clear_child_tid = NULL;
120 121
@@ -134,19 +135,30 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
134 childregs = (struct pt_regs *) childksp - 1; 135 childregs = (struct pt_regs *) childksp - 1;
135 /* Put the stack after the struct pt_regs. */ 136 /* Put the stack after the struct pt_regs. */
136 childksp = (unsigned long) childregs; 137 childksp = (unsigned long) childregs;
138 p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
139 if (unlikely(p->flags & PF_KTHREAD)) {
140 unsigned long status = p->thread.cp0_status;
141 memset(childregs, 0, sizeof(struct pt_regs));
142 ti->addr_limit = KERNEL_DS;
143 p->thread.reg16 = usp; /* fn */
144 p->thread.reg17 = arg;
145 p->thread.reg29 = childksp;
146 p->thread.reg31 = (unsigned long) ret_from_kernel_thread;
147#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
148 status = (status & ~(ST0_KUP | ST0_IEP | ST0_IEC)) |
149 ((status & (ST0_KUC | ST0_IEC)) << 2);
150#else
151 status |= ST0_EXL;
152#endif
153 childregs->cp0_status = status;
154 return 0;
155 }
137 *childregs = *regs; 156 *childregs = *regs;
138 childregs->regs[7] = 0; /* Clear error flag */ 157 childregs->regs[7] = 0; /* Clear error flag */
139
140 childregs->regs[2] = 0; /* Child gets zero as return value */ 158 childregs->regs[2] = 0; /* Child gets zero as return value */
159 childregs->regs[29] = usp;
160 ti->addr_limit = USER_DS;
141 161
142 if (childregs->cp0_status & ST0_CU0) {
143 childregs->regs[28] = (unsigned long) ti;
144 childregs->regs[29] = childksp;
145 ti->addr_limit = KERNEL_DS;
146 } else {
147 childregs->regs[29] = usp;
148 ti->addr_limit = USER_DS;
149 }
150 p->thread.reg29 = (unsigned long) childregs; 162 p->thread.reg29 = (unsigned long) childregs;
151 p->thread.reg31 = (unsigned long) ret_from_fork; 163 p->thread.reg31 = (unsigned long) ret_from_fork;
152 164
@@ -154,7 +166,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
154 * New tasks lose permission to use the fpu. This accelerates context 166 * New tasks lose permission to use the fpu. This accelerates context
155 * switching for most programs since they don't use the fpu. 167 * switching for most programs since they don't use the fpu.
156 */ 168 */
157 p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
158 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1); 169 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
159 170
160#ifdef CONFIG_MIPS_MT_SMTC 171#ifdef CONFIG_MIPS_MT_SMTC
@@ -220,35 +231,6 @@ int dump_task_fpu(struct task_struct *t, elf_fpregset_t *fpr)
220} 231}
221 232
222/* 233/*
223 * Create a kernel thread
224 */
225static void __noreturn kernel_thread_helper(void *arg, int (*fn)(void *))
226{
227 do_exit(fn(arg));
228}
229
230long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
231{
232 struct pt_regs regs;
233
234 memset(&regs, 0, sizeof(regs));
235
236 regs.regs[4] = (unsigned long) arg;
237 regs.regs[5] = (unsigned long) fn;
238 regs.cp0_epc = (unsigned long) kernel_thread_helper;
239 regs.cp0_status = read_c0_status();
240#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
241 regs.cp0_status = (regs.cp0_status & ~(ST0_KUP | ST0_IEP | ST0_IEC)) |
242 ((regs.cp0_status & (ST0_KUC | ST0_IEC)) << 2);
243#else
244 regs.cp0_status |= ST0_EXL;
245#endif
246
247 /* Ok, create the new process.. */
248 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
249}
250
251/*
252 * 234 *
253 */ 235 */
254struct mips_frame_info { 236struct mips_frame_info {
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 9c721dd84ba..ad3de9668da 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -161,7 +161,7 @@ EXPORT(sysn32_call_table)
161 PTR sys_getsockopt 161 PTR sys_getsockopt
162 PTR sys_clone /* 6055 */ 162 PTR sys_clone /* 6055 */
163 PTR sys_fork 163 PTR sys_fork
164 PTR sys32_execve 164 PTR compat_sys_execve
165 PTR sys_exit 165 PTR sys_exit
166 PTR compat_sys_wait4 166 PTR compat_sys_wait4
167 PTR sys_kill /* 6060 */ 167 PTR sys_kill /* 6060 */
@@ -391,14 +391,14 @@ EXPORT(sysn32_call_table)
391 PTR sys_timerfd_create 391 PTR sys_timerfd_create
392 PTR compat_sys_timerfd_gettime /* 6285 */ 392 PTR compat_sys_timerfd_gettime /* 6285 */
393 PTR compat_sys_timerfd_settime 393 PTR compat_sys_timerfd_settime
394 PTR sys_signalfd4 394 PTR compat_sys_signalfd4
395 PTR sys_eventfd2 395 PTR sys_eventfd2
396 PTR sys_epoll_create1 396 PTR sys_epoll_create1
397 PTR sys_dup3 /* 6290 */ 397 PTR sys_dup3 /* 6290 */
398 PTR sys_pipe2 398 PTR sys_pipe2
399 PTR sys_inotify_init1 399 PTR sys_inotify_init1
400 PTR sys_preadv 400 PTR compat_sys_preadv
401 PTR sys_pwritev 401 PTR compat_sys_pwritev
402 PTR compat_sys_rt_tgsigqueueinfo /* 6295 */ 402 PTR compat_sys_rt_tgsigqueueinfo /* 6295 */
403 PTR sys_perf_event_open 403 PTR sys_perf_event_open
404 PTR sys_accept4 404 PTR sys_accept4
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 53c2d724576..9601be6afa3 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -203,7 +203,7 @@ sys_call_table:
203 PTR sys_creat 203 PTR sys_creat
204 PTR sys_link 204 PTR sys_link
205 PTR sys_unlink /* 4010 */ 205 PTR sys_unlink /* 4010 */
206 PTR sys32_execve 206 PTR compat_sys_execve
207 PTR sys_chdir 207 PTR sys_chdir
208 PTR compat_sys_time 208 PTR compat_sys_time
209 PTR sys_mknod 209 PTR sys_mknod
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 2bd561bc05a..201cb76b4df 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -92,7 +92,7 @@ save_static_function(sys_fork);
92static int __used noinline 92static int __used noinline
93_sys_fork(nabi_no_regargs struct pt_regs regs) 93_sys_fork(nabi_no_regargs struct pt_regs regs)
94{ 94{
95 return do_fork(SIGCHLD, regs.regs[29], &regs, 0, NULL, NULL); 95 return do_fork(SIGCHLD, regs.regs[29], 0, NULL, NULL);
96} 96}
97 97
98save_static_function(sys_clone); 98save_static_function(sys_clone);
@@ -123,32 +123,10 @@ _sys_clone(nabi_no_regargs struct pt_regs regs)
123#else 123#else
124 child_tidptr = (int __user *) regs.regs[8]; 124 child_tidptr = (int __user *) regs.regs[8];
125#endif 125#endif
126 return do_fork(clone_flags, newsp, &regs, 0, 126 return do_fork(clone_flags, newsp, 0,
127 parent_tidptr, child_tidptr); 127 parent_tidptr, child_tidptr);
128} 128}
129 129
130/*
131 * sys_execve() executes a new program.
132 */
133asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
134{
135 int error;
136 struct filename *filename;
137
138 filename = getname((const char __user *) (long)regs.regs[4]);
139 error = PTR_ERR(filename);
140 if (IS_ERR(filename))
141 goto out;
142 error = do_execve(filename->name,
143 (const char __user *const __user *) (long)regs.regs[5],
144 (const char __user *const __user *) (long)regs.regs[6],
145 &regs);
146 putname(filename);
147
148out:
149 return error;
150}
151
152SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) 130SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
153{ 131{
154 struct thread_info *ti = task_thread_info(current); 132 struct thread_info *ti = task_thread_info(current);
@@ -313,34 +291,3 @@ asmlinkage void bad_stack(void)
313{ 291{
314 do_exit(SIGSEGV); 292 do_exit(SIGSEGV);
315} 293}
316
317/*
318 * Do a system call from kernel instead of calling sys_execve so we
319 * end up with proper pt_regs.
320 */
321int kernel_execve(const char *filename,
322 const char *const argv[],
323 const char *const envp[])
324{
325 register unsigned long __a0 asm("$4") = (unsigned long) filename;
326 register unsigned long __a1 asm("$5") = (unsigned long) argv;
327 register unsigned long __a2 asm("$6") = (unsigned long) envp;
328 register unsigned long __a3 asm("$7");
329 unsigned long __v0;
330
331 __asm__ volatile (" \n"
332 " .set noreorder \n"
333 " li $2, %5 # __NR_execve \n"
334 " syscall \n"
335 " move %0, $2 \n"
336 " .set reorder \n"
337 : "=&r" (__v0), "=r" (__a3)
338 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve)
339 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24",
340 "memory");
341
342 if (__a3 == 0)
343 return __v0;
344
345 return -__v0;
346}
diff --git a/arch/mips/lantiq/dts/Makefile b/arch/mips/lantiq/dts/Makefile
index 674fca45f72..6fa72dd641b 100644
--- a/arch/mips/lantiq/dts/Makefile
+++ b/arch/mips/lantiq/dts/Makefile
@@ -1,4 +1 @@
1obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o
2
3$(obj)/%.dtb: $(obj)/%.dts
4 $(call if_changed,dtc)
diff --git a/arch/mips/loongson1/common/platform.c b/arch/mips/loongson1/common/platform.c
index 3a42276b8ea..69dad4cfaaf 100644
--- a/arch/mips/loongson1/common/platform.c
+++ b/arch/mips/loongson1/common/platform.c
@@ -13,6 +13,7 @@
13#include <linux/phy.h> 13#include <linux/phy.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/stmmac.h> 15#include <linux/stmmac.h>
16#include <linux/usb/ehci_pdriver.h>
16#include <asm-generic/sizes.h> 17#include <asm-generic/sizes.h>
17 18
18#include <loongson1.h> 19#include <loongson1.h>
@@ -107,13 +108,17 @@ static struct resource ls1x_ehci_resources[] = {
107 }, 108 },
108}; 109};
109 110
111static struct usb_ehci_pdata ls1x_ehci_pdata = {
112};
113
110struct platform_device ls1x_ehci_device = { 114struct platform_device ls1x_ehci_device = {
111 .name = "ls1x-ehci", 115 .name = "ehci-platform",
112 .id = -1, 116 .id = -1,
113 .num_resources = ARRAY_SIZE(ls1x_ehci_resources), 117 .num_resources = ARRAY_SIZE(ls1x_ehci_resources),
114 .resource = ls1x_ehci_resources, 118 .resource = ls1x_ehci_resources,
115 .dev = { 119 .dev = {
116 .dma_mask = &ls1x_ehci_dmamask, 120 .dma_mask = &ls1x_ehci_dmamask,
121 .platform_data = &ls1x_ehci_pdata,
117 }, 122 },
118}; 123};
119 124
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 302d779d5b0..d9be7540a6b 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -45,18 +45,6 @@ static unsigned long mmap_base(unsigned long rnd)
45 return PAGE_ALIGN(TASK_SIZE - gap - rnd); 45 return PAGE_ALIGN(TASK_SIZE - gap - rnd);
46} 46}
47 47
48static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
49 unsigned long pgoff)
50{
51 unsigned long base = addr & ~shm_align_mask;
52 unsigned long off = (pgoff << PAGE_SHIFT) & shm_align_mask;
53
54 if (base + off <= addr)
55 return base + off;
56
57 return base - off;
58}
59
60#define COLOUR_ALIGN(addr, pgoff) \ 48#define COLOUR_ALIGN(addr, pgoff) \
61 ((((addr) + shm_align_mask) & ~shm_align_mask) + \ 49 ((((addr) + shm_align_mask) & ~shm_align_mask) + \
62 (((pgoff) << PAGE_SHIFT) & shm_align_mask)) 50 (((pgoff) << PAGE_SHIFT) & shm_align_mask))
@@ -71,6 +59,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
71 struct vm_area_struct *vma; 59 struct vm_area_struct *vma;
72 unsigned long addr = addr0; 60 unsigned long addr = addr0;
73 int do_color_align; 61 int do_color_align;
62 struct vm_unmapped_area_info info;
74 63
75 if (unlikely(len > TASK_SIZE)) 64 if (unlikely(len > TASK_SIZE))
76 return -ENOMEM; 65 return -ENOMEM;
@@ -107,97 +96,31 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
107 return addr; 96 return addr;
108 } 97 }
109 98
110 if (dir == UP) { 99 info.length = len;
111 addr = mm->mmap_base; 100 info.align_mask = do_color_align ? (PAGE_MASK & shm_align_mask) : 0;
112 if (do_color_align) 101 info.align_offset = pgoff << PAGE_SHIFT;
113 addr = COLOUR_ALIGN(addr, pgoff);
114 else
115 addr = PAGE_ALIGN(addr);
116 102
117 for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { 103 if (dir == DOWN) {
118 /* At this point: (!vma || addr < vma->vm_end). */ 104 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
119 if (TASK_SIZE - len < addr) 105 info.low_limit = PAGE_SIZE;
120 return -ENOMEM; 106 info.high_limit = mm->mmap_base;
121 if (!vma || addr + len <= vma->vm_start) 107 addr = vm_unmapped_area(&info);
122 return addr; 108
123 addr = vma->vm_end; 109 if (!(addr & ~PAGE_MASK))
124 if (do_color_align) 110 return addr;
125 addr = COLOUR_ALIGN(addr, pgoff);
126 }
127 } else {
128 /* check if free_area_cache is useful for us */
129 if (len <= mm->cached_hole_size) {
130 mm->cached_hole_size = 0;
131 mm->free_area_cache = mm->mmap_base;
132 }
133 111
134 /*
135 * either no address requested, or the mapping can't fit into
136 * the requested address hole
137 */
138 addr = mm->free_area_cache;
139 if (do_color_align) {
140 unsigned long base =
141 COLOUR_ALIGN_DOWN(addr - len, pgoff);
142 addr = base + len;
143 }
144
145 /* make sure it can fit in the remaining address space */
146 if (likely(addr > len)) {
147 vma = find_vma(mm, addr - len);
148 if (!vma || addr <= vma->vm_start) {
149 /* cache the address as a hint for next time */
150 return mm->free_area_cache = addr - len;
151 }
152 }
153
154 if (unlikely(mm->mmap_base < len))
155 goto bottomup;
156
157 addr = mm->mmap_base - len;
158 if (do_color_align)
159 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
160
161 do {
162 /*
163 * Lookup failure means no vma is above this address,
164 * else if new region fits below vma->vm_start,
165 * return with success:
166 */
167 vma = find_vma(mm, addr);
168 if (likely(!vma || addr + len <= vma->vm_start)) {
169 /* cache the address as a hint for next time */
170 return mm->free_area_cache = addr;
171 }
172
173 /* remember the largest hole we saw so far */
174 if (addr + mm->cached_hole_size < vma->vm_start)
175 mm->cached_hole_size = vma->vm_start - addr;
176
177 /* try just below the current vma->vm_start */
178 addr = vma->vm_start - len;
179 if (do_color_align)
180 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
181 } while (likely(len < vma->vm_start));
182
183bottomup:
184 /* 112 /*
185 * A failed mmap() very likely causes application failure, 113 * A failed mmap() very likely causes application failure,
186 * so fall back to the bottom-up function here. This scenario 114 * so fall back to the bottom-up function here. This scenario
187 * can happen with large stack limits and large mmap() 115 * can happen with large stack limits and large mmap()
188 * allocations. 116 * allocations.
189 */ 117 */
190 mm->cached_hole_size = ~0UL;
191 mm->free_area_cache = TASK_UNMAPPED_BASE;
192 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
193 /*
194 * Restore the topdown base:
195 */
196 mm->free_area_cache = mm->mmap_base;
197 mm->cached_hole_size = ~0UL;
198
199 return addr;
200 } 118 }
119
120 info.flags = 0;
121 info.low_limit = mm->mmap_base;
122 info.high_limit = TASK_SIZE;
123 return vm_unmapped_area(&info);
201} 124}
202 125
203unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr0, 126unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr0,
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 94ad86d055c..2a7c9725b2a 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -120,18 +120,11 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
120 120
121 if (cpu_context(cpu, mm) != 0) { 121 if (cpu_context(cpu, mm) != 0) {
122 unsigned long size, flags; 122 unsigned long size, flags;
123 int huge = is_vm_hugetlb_page(vma);
124 123
125 ENTER_CRITICAL(flags); 124 ENTER_CRITICAL(flags);
126 if (huge) { 125 start = round_down(start, PAGE_SIZE << 1);
127 start = round_down(start, HPAGE_SIZE); 126 end = round_up(end, PAGE_SIZE << 1);
128 end = round_up(end, HPAGE_SIZE); 127 size = (end - start) >> (PAGE_SHIFT + 1);
129 size = (end - start) >> HPAGE_SHIFT;
130 } else {
131 start = round_down(start, PAGE_SIZE << 1);
132 end = round_up(end, PAGE_SIZE << 1);
133 size = (end - start) >> (PAGE_SHIFT + 1);
134 }
135 if (size <= current_cpu_data.tlbsize/2) { 128 if (size <= current_cpu_data.tlbsize/2) {
136 int oldpid = read_c0_entryhi(); 129 int oldpid = read_c0_entryhi();
137 int newpid = cpu_asid(cpu, mm); 130 int newpid = cpu_asid(cpu, mm);
@@ -140,10 +133,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
140 int idx; 133 int idx;
141 134
142 write_c0_entryhi(start | newpid); 135 write_c0_entryhi(start | newpid);
143 if (huge) 136 start += (PAGE_SIZE << 1);
144 start += HPAGE_SIZE;
145 else
146 start += (PAGE_SIZE << 1);
147 mtc0_tlbw_hazard(); 137 mtc0_tlbw_hazard();
148 tlb_probe(); 138 tlb_probe();
149 tlb_probe_hazard(); 139 tlb_probe_hazard();
diff --git a/arch/mips/netlogic/dts/Makefile b/arch/mips/netlogic/dts/Makefile
index 67ae3fe296f..d117d46413a 100644
--- a/arch/mips/netlogic/dts/Makefile
+++ b/arch/mips/netlogic/dts/Makefile
@@ -1,4 +1 @@
1obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o
2
3$(obj)/%.dtb: $(obj)/%.dts
4 $(call if_changed,dtc)
diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c
index 71b44d82621..507230eeb76 100644
--- a/arch/mips/netlogic/xlr/platform.c
+++ b/arch/mips/netlogic/xlr/platform.c
@@ -15,6 +15,8 @@
15#include <linux/serial_8250.h> 15#include <linux/serial_8250.h>
16#include <linux/serial_reg.h> 16#include <linux/serial_reg.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/usb/ehci_pdriver.h>
19#include <linux/usb/ohci_pdriver.h>
18 20
19#include <asm/netlogic/haldefs.h> 21#include <asm/netlogic/haldefs.h>
20#include <asm/netlogic/xlr/iomap.h> 22#include <asm/netlogic/xlr/iomap.h>
@@ -123,12 +125,18 @@ static u64 xls_usb_dmamask = ~(u32)0;
123 }, \ 125 }, \
124 } 126 }
125 127
128static struct usb_ehci_pdata xls_usb_ehci_pdata = {
129 .caps_offset = 0,
130};
131
132static struct usb_ohci_pdata xls_usb_ohci_pdata;
133
126static struct platform_device xls_usb_ehci_device = 134static struct platform_device xls_usb_ehci_device =
127 USB_PLATFORM_DEV("ehci-xls", 0, PIC_USB_IRQ); 135 USB_PLATFORM_DEV("ehci-platform", 0, PIC_USB_IRQ);
128static struct platform_device xls_usb_ohci_device_0 = 136static struct platform_device xls_usb_ohci_device_0 =
129 USB_PLATFORM_DEV("ohci-xls-0", 1, PIC_USB_IRQ); 137 USB_PLATFORM_DEV("ohci-platform", 1, PIC_USB_IRQ);
130static struct platform_device xls_usb_ohci_device_1 = 138static struct platform_device xls_usb_ohci_device_1 =
131 USB_PLATFORM_DEV("ohci-xls-1", 2, PIC_USB_IRQ); 139 USB_PLATFORM_DEV("ohci-platform", 2, PIC_USB_IRQ);
132 140
133static struct platform_device *xls_platform_devices[] = { 141static struct platform_device *xls_platform_devices[] = {
134 &xls_usb_ehci_device, 142 &xls_usb_ehci_device,
@@ -172,14 +180,17 @@ int xls_platform_usb_init(void)
172 memres = CPHYSADDR((unsigned long)usb_mmio); 180 memres = CPHYSADDR((unsigned long)usb_mmio);
173 xls_usb_ehci_device.resource[0].start = memres; 181 xls_usb_ehci_device.resource[0].start = memres;
174 xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1; 182 xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1;
183 xls_usb_ehci_device.dev.platform_data = &xls_usb_ehci_pdata;
175 184
176 memres += 0x400; 185 memres += 0x400;
177 xls_usb_ohci_device_0.resource[0].start = memres; 186 xls_usb_ohci_device_0.resource[0].start = memres;
178 xls_usb_ohci_device_0.resource[0].end = memres + 0x400 - 1; 187 xls_usb_ohci_device_0.resource[0].end = memres + 0x400 - 1;
188 xls_usb_ohci_device_0.dev.platform_data = &xls_usb_ohci_pdata;
179 189
180 memres += 0x400; 190 memres += 0x400;
181 xls_usb_ohci_device_1.resource[0].start = memres; 191 xls_usb_ohci_device_1.resource[0].start = memres;
182 xls_usb_ohci_device_1.resource[0].end = memres + 0x400 - 1; 192 xls_usb_ohci_device_1.resource[0].end = memres + 0x400 - 1;
193 xls_usb_ohci_device_1.dev.platform_data = &xls_usb_ohci_pdata;
183 194
184 return platform_add_devices(xls_platform_devices, 195 return platform_add_devices(xls_platform_devices,
185 ARRAY_SIZE(xls_platform_devices)); 196 ARRAY_SIZE(xls_platform_devices));
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 04e35bcde07..4040416e060 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -313,10 +313,8 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
313 } 313 }
314} 314}
315 315
316#ifdef CONFIG_HOTPLUG
317EXPORT_SYMBOL(PCIBIOS_MIN_IO); 316EXPORT_SYMBOL(PCIBIOS_MIN_IO);
318EXPORT_SYMBOL(PCIBIOS_MIN_MEM); 317EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
319#endif
320 318
321int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 319int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
322 enum pci_mmap_state mmap_state, int write_combine) 320 enum pci_mmap_state mmap_state, int write_combine)
diff --git a/arch/mips/pnx8550/common/platform.c b/arch/mips/pnx8550/common/platform.c
index 5264cc09a27..0a8faeaa7b7 100644
--- a/arch/mips/pnx8550/common/platform.c
+++ b/arch/mips/pnx8550/common/platform.c
@@ -20,6 +20,7 @@
20#include <linux/serial.h> 20#include <linux/serial.h>
21#include <linux/serial_pnx8xxx.h> 21#include <linux/serial_pnx8xxx.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/usb/ohci_pdriver.h>
23 24
24#include <int.h> 25#include <int.h>
25#include <usb.h> 26#include <usb.h>
@@ -96,12 +97,40 @@ static u64 ohci_dmamask = DMA_BIT_MASK(32);
96 97
97static u64 uart_dmamask = DMA_BIT_MASK(32); 98static u64 uart_dmamask = DMA_BIT_MASK(32);
98 99
100static int pnx8550_usb_ohci_power_on(struct platform_device *pdev)
101{
102 /*
103 * Set register CLK48CTL to enable and 48MHz
104 */
105 outl(0x00000003, PCI_BASE | 0x0004770c);
106
107 /*
108 * Set register CLK12CTL to enable and 48MHz
109 */
110 outl(0x00000003, PCI_BASE | 0x00047710);
111
112 udelay(100);
113
114 return 0;
115}
116
117static void pnx8550_usb_ohci_power_off(struct platform_device *pdev)
118{
119 udelay(10);
120}
121
122static struct usb_ohci_pdata pnx8550_usb_ohci_pdata = {
123 .power_on = pnx8550_usb_ohci_power_on,
124 .power_off = pnx8550_usb_ohci_power_off,
125};
126
99static struct platform_device pnx8550_usb_ohci_device = { 127static struct platform_device pnx8550_usb_ohci_device = {
100 .name = "pnx8550-ohci", 128 .name = "ohci-platform",
101 .id = -1, 129 .id = -1,
102 .dev = { 130 .dev = {
103 .dma_mask = &ohci_dmamask, 131 .dma_mask = &ohci_dmamask,
104 .coherent_dma_mask = DMA_BIT_MASK(32), 132 .coherent_dma_mask = DMA_BIT_MASK(32),
133 .platform_data = &pnx8550_usb_ohci_pdata,
105 }, 134 },
106 .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources), 135 .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources),
107 .resource = pnx8550_usb_ohci_resources, 136 .resource = pnx8550_usb_ohci_resources,
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 4efd9185f29..b14ee53581a 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -341,7 +341,7 @@ static void __devinit quirk_slc90e66_ide(struct pci_dev *dev)
341 341
342static void __devinit tc35815_fixup(struct pci_dev *dev) 342static void __devinit tc35815_fixup(struct pci_dev *dev)
343{ 343{
344 /* This device may have PM registers but not they are not suported. */ 344 /* This device may have PM registers but not they are not supported. */
345 if (dev->pm_cap) { 345 if (dev->pm_cap) {
346 dev_info(&dev->dev, "PM disabled\n"); 346 dev_info(&dev->dev, "PM disabled\n");
347 dev->pm_cap = 0; 347 dev->pm_cap = 0;
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 04669fac117..72471744a91 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -9,6 +9,7 @@ config MN10300
9 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER 9 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
10 select GENERIC_CLOCKEVENTS 10 select GENERIC_CLOCKEVENTS
11 select GENERIC_KERNEL_THREAD 11 select GENERIC_KERNEL_THREAD
12 select GENERIC_KERNEL_EXECVE
12 select MODULES_USE_ELF_RELA 13 select MODULES_USE_ELF_RELA
13 14
14config AM33_2 15config AM33_2
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index 4a159da2363..c5d76702830 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -1,3 +1,4 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += trace_clock.h
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index 139df8c53de..e6ed0d897cc 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -14,6 +14,7 @@
14#include <asm/page.h> /* I/O is all done through memory accesses */ 14#include <asm/page.h> /* I/O is all done through memory accesses */
15#include <asm/cpu-regs.h> 15#include <asm/cpu-regs.h>
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm-generic/pci_iomap.h>
17 18
18#define mmiowb() do {} while (0) 19#define mmiowb() do {} while (0)
19 20
@@ -258,7 +259,7 @@ static inline void __iomem *__ioremap(unsigned long offset, unsigned long size,
258 259
259static inline void __iomem *ioremap(unsigned long offset, unsigned long size) 260static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
260{ 261{
261 return (void __iomem *) offset; 262 return (void __iomem *)(offset & ~0x20000000);
262} 263}
263 264
264/* 265/*
diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h
index f9668ec3040..d280e978079 100644
--- a/arch/mn10300/include/asm/signal.h
+++ b/arch/mn10300/include/asm/signal.h
@@ -45,8 +45,4 @@ struct k_sigaction {
45}; 45};
46#include <asm/sigcontext.h> 46#include <asm/sigcontext.h>
47 47
48
49struct pt_regs;
50#define ptrace_signal_deliver(regs, cookie) do { } while (0)
51
52#endif /* _ASM_SIGNAL_H */ 48#endif /* _ASM_SIGNAL_H */
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index 55bbec1887e..cabf8ba73b2 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -44,7 +44,9 @@
44#define __ARCH_WANT_SYS_RT_SIGACTION 44#define __ARCH_WANT_SYS_RT_SIGACTION
45#define __ARCH_WANT_SYS_RT_SIGSUSPEND 45#define __ARCH_WANT_SYS_RT_SIGSUSPEND
46#define __ARCH_WANT_SYS_EXECVE 46#define __ARCH_WANT_SYS_EXECVE
47#define __ARCH_WANT_KERNEL_EXECVE 47#define __ARCH_WANT_SYS_FORK
48#define __ARCH_WANT_SYS_VFORK
49#define __ARCH_WANT_SYS_CLONE
48 50
49/* 51/*
50 * "Conditional" syscalls 52 * "Conditional" syscalls
diff --git a/arch/mn10300/include/uapi/asm/socket.h b/arch/mn10300/include/uapi/asm/socket.h
index 820463a484b..af5366bbfe6 100644
--- a/arch/mn10300/include/uapi/asm/socket.h
+++ b/arch/mn10300/include/uapi/asm/socket.h
@@ -40,6 +40,7 @@
40/* Socket filtering */ 40/* Socket filtering */
41#define SO_ATTACH_FILTER 26 41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27 42#define SO_DETACH_FILTER 27
43#define SO_GET_FILTER SO_ATTACH_FILTER
43 44
44#define SO_PEERNAME 28 45#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29 46#define SO_TIMESTAMP 29
diff --git a/arch/mn10300/kernel/asm-offsets.c b/arch/mn10300/kernel/asm-offsets.c
index 96f24fab7de..47b3bb0c04f 100644
--- a/arch/mn10300/kernel/asm-offsets.c
+++ b/arch/mn10300/kernel/asm-offsets.c
@@ -96,7 +96,7 @@ void foo(void)
96 OFFSET(__rx_outp, mn10300_serial_port, rx_outp); 96 OFFSET(__rx_outp, mn10300_serial_port, rx_outp);
97 OFFSET(__uart_state, mn10300_serial_port, uart.state); 97 OFFSET(__uart_state, mn10300_serial_port, uart.state);
98 OFFSET(__tx_xchar, mn10300_serial_port, tx_xchar); 98 OFFSET(__tx_xchar, mn10300_serial_port, tx_xchar);
99 OFFSET(__tx_break, mn10300_serial_port, tx_break); 99 OFFSET(__tx_flags, mn10300_serial_port, tx_flags);
100 OFFSET(__intr_flags, mn10300_serial_port, intr_flags); 100 OFFSET(__intr_flags, mn10300_serial_port, intr_flags);
101 OFFSET(__rx_icr, mn10300_serial_port, rx_icr); 101 OFFSET(__rx_icr, mn10300_serial_port, rx_icr);
102 OFFSET(__tx_icr, mn10300_serial_port, tx_icr); 102 OFFSET(__tx_icr, mn10300_serial_port, tx_icr);
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index 0c631d34c8d..68fcab8f8f6 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -60,13 +60,8 @@ ENTRY(ret_from_kernel_thread)
60 mov (REG_D0,fp),d0 60 mov (REG_D0,fp),d0
61 mov (REG_A0,fp),a0 61 mov (REG_A0,fp),a0
62 calls (a0) 62 calls (a0)
63 jmp sys_exit
64
65ENTRY(ret_from_kernel_execve)
66 add -12,d0 /* pt_regs -> frame */
67 mov d0,sp
68 GET_THREAD_INFO a2
69 clr d0 63 clr d0
64 mov d0,(REG_D0,fp)
70 jmp syscall_exit 65 jmp syscall_exit
71 66
72############################################################################### 67###############################################################################
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index 35932a8de8b..6ab3b73efcf 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -142,57 +142,11 @@ mn10300_cpupic_setaffinity(struct irq_data *d, const struct cpumask *mask,
142 bool force) 142 bool force)
143{ 143{
144 unsigned long flags; 144 unsigned long flags;
145 int err;
146 145
147 flags = arch_local_cli_save(); 146 flags = arch_local_cli_save();
148 147 set_bit(d->irq, irq_affinity_request);
149 /* check irq no */
150 switch (d->irq) {
151 case TMJCIRQ:
152 case RESCHEDULE_IPI:
153 case CALL_FUNC_SINGLE_IPI:
154 case LOCAL_TIMER_IPI:
155 case FLUSH_CACHE_IPI:
156 case CALL_FUNCTION_NMI_IPI:
157 case DEBUGGER_NMI_IPI:
158#ifdef CONFIG_MN10300_TTYSM0
159 case SC0RXIRQ:
160 case SC0TXIRQ:
161#ifdef CONFIG_MN10300_TTYSM0_TIMER8
162 case TM8IRQ:
163#elif CONFIG_MN10300_TTYSM0_TIMER2
164 case TM2IRQ:
165#endif /* CONFIG_MN10300_TTYSM0_TIMER8 */
166#endif /* CONFIG_MN10300_TTYSM0 */
167
168#ifdef CONFIG_MN10300_TTYSM1
169 case SC1RXIRQ:
170 case SC1TXIRQ:
171#ifdef CONFIG_MN10300_TTYSM1_TIMER12
172 case TM12IRQ:
173#elif defined(CONFIG_MN10300_TTYSM1_TIMER9)
174 case TM9IRQ:
175#elif defined(CONFIG_MN10300_TTYSM1_TIMER3)
176 case TM3IRQ:
177#endif /* CONFIG_MN10300_TTYSM1_TIMER12 */
178#endif /* CONFIG_MN10300_TTYSM1 */
179
180#ifdef CONFIG_MN10300_TTYSM2
181 case SC2RXIRQ:
182 case SC2TXIRQ:
183 case TM10IRQ:
184#endif /* CONFIG_MN10300_TTYSM2 */
185 err = -1;
186 break;
187
188 default:
189 set_bit(d->irq, irq_affinity_request);
190 err = 0;
191 break;
192 }
193
194 arch_local_irq_restore(flags); 148 arch_local_irq_restore(flags);
195 return err; 149 return 0;
196} 150}
197#endif /* CONFIG_SMP */ 151#endif /* CONFIG_SMP */
198 152
diff --git a/arch/mn10300/kernel/mn10300-serial-low.S b/arch/mn10300/kernel/mn10300-serial-low.S
index dfc1b6f2fa9..b95e76caf4f 100644
--- a/arch/mn10300/kernel/mn10300-serial-low.S
+++ b/arch/mn10300/kernel/mn10300-serial-low.S
@@ -118,8 +118,8 @@ ENTRY(mn10300_serial_vdma_tx_handler)
118 movbu d2,(e3) # ACK the interrupt 118 movbu d2,(e3) # ACK the interrupt
119 movhu (e3),d2 # flush 119 movhu (e3),d2 # flush
120 120
121 btst 0x01,(__tx_break,a3) # handle transmit break request 121 btst 0xFF,(__tx_flags,a3) # handle transmit flags
122 bne mnsc_vdma_tx_break 122 bne mnsc_vdma_tx_flags
123 123
124 movbu (SCxSTR,e2),d2 # don't try and transmit a char if the 124 movbu (SCxSTR,e2),d2 # don't try and transmit a char if the
125 # buffer is not empty 125 # buffer is not empty
@@ -171,10 +171,13 @@ mnsc_vdma_tx_empty:
171 bset MNSCx_TX_EMPTY,(__intr_flags,a3) 171 bset MNSCx_TX_EMPTY,(__intr_flags,a3)
172 bra mnsc_vdma_tx_done 172 bra mnsc_vdma_tx_done
173 173
174mnsc_vdma_tx_break: 174mnsc_vdma_tx_flags:
175 btst MNSCx_TX_STOP,(__tx_flags,a3)
176 bne mnsc_vdma_tx_stop
175 movhu (SCxCTR,e2),d2 # turn on break mode 177 movhu (SCxCTR,e2),d2 # turn on break mode
176 or SC01CTR_BKE,d2 178 or SC01CTR_BKE,d2
177 movhu d2,(SCxCTR,e2) 179 movhu d2,(SCxCTR,e2)
180mnsc_vdma_tx_stop:
178 mov +(NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL)|GxICR_DETECT),d2 181 mov +(NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL)|GxICR_DETECT),d2
179 movhu d2,(e3) # disable transmit interrupts on this 182 movhu d2,(e3) # disable transmit interrupts on this
180 # channel 183 # channel
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index 339cef4c825..81d5cb9b656 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -408,6 +408,34 @@ static struct irq_chip mn10300_serial_pic = {
408 .irq_unmask = mn10300_serial_nop, 408 .irq_unmask = mn10300_serial_nop,
409}; 409};
410 410
411static void mn10300_serial_low_mask(struct irq_data *d)
412{
413 unsigned long flags;
414 u16 tmp;
415
416 flags = arch_local_cli_save();
417 GxICR(d->irq) = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL);
418 tmp = GxICR(d->irq); /* flush write buffer */
419 arch_local_irq_restore(flags);
420}
421
422static void mn10300_serial_low_unmask(struct irq_data *d)
423{
424 unsigned long flags;
425 u16 tmp;
426
427 flags = arch_local_cli_save();
428 GxICR(d->irq) =
429 NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL) | GxICR_ENABLE;
430 tmp = GxICR(d->irq); /* flush write buffer */
431 arch_local_irq_restore(flags);
432}
433
434static struct irq_chip mn10300_serial_low_pic = {
435 .name = "mnserial-low",
436 .irq_mask = mn10300_serial_low_mask,
437 .irq_unmask = mn10300_serial_low_unmask,
438};
411 439
412/* 440/*
413 * serial virtual DMA interrupt jump table 441 * serial virtual DMA interrupt jump table
@@ -416,25 +444,53 @@ struct mn10300_serial_int mn10300_serial_int_tbl[NR_IRQS];
416 444
417static void mn10300_serial_dis_tx_intr(struct mn10300_serial_port *port) 445static void mn10300_serial_dis_tx_intr(struct mn10300_serial_port *port)
418{ 446{
419 unsigned long flags; 447 int retries = 100;
420 u16 x; 448 u16 x;
421 449
422 flags = arch_local_cli_save(); 450 /* nothing to do if irq isn't set up */
423 *port->tx_icr = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL); 451 if (!mn10300_serial_int_tbl[port->tx_irq].port)
424 x = *port->tx_icr; 452 return;
425 arch_local_irq_restore(flags); 453
454 port->tx_flags |= MNSCx_TX_STOP;
455 mb();
456
457 /*
458 * Here we wait for the irq to be disabled. Either it already is
459 * disabled or we wait some number of retries for the VDMA handler
460 * to disable it. The retries give the VDMA handler enough time to
461 * run to completion if it was already in progress. If the VDMA IRQ
462 * is enabled but the handler is not yet running when arrive here,
463 * the STOP flag will prevent the handler from conflicting with the
464 * driver code following this loop.
465 */
466 while ((*port->tx_icr & GxICR_ENABLE) && retries-- > 0)
467 ;
468 if (retries <= 0) {
469 *port->tx_icr =
470 NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL);
471 x = *port->tx_icr;
472 }
426} 473}
427 474
428static void mn10300_serial_en_tx_intr(struct mn10300_serial_port *port) 475static void mn10300_serial_en_tx_intr(struct mn10300_serial_port *port)
429{ 476{
430 unsigned long flags;
431 u16 x; 477 u16 x;
432 478
433 flags = arch_local_cli_save(); 479 /* nothing to do if irq isn't set up */
480 if (!mn10300_serial_int_tbl[port->tx_irq].port)
481 return;
482
483 /* stop vdma irq if not already stopped */
484 if (!(port->tx_flags & MNSCx_TX_STOP))
485 mn10300_serial_dis_tx_intr(port);
486
487 port->tx_flags &= ~MNSCx_TX_STOP;
488 mb();
489
434 *port->tx_icr = 490 *port->tx_icr =
435 NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL) | GxICR_ENABLE; 491 NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL) |
492 GxICR_ENABLE | GxICR_REQUEST | GxICR_DETECT;
436 x = *port->tx_icr; 493 x = *port->tx_icr;
437 arch_local_irq_restore(flags);
438} 494}
439 495
440static void mn10300_serial_dis_rx_intr(struct mn10300_serial_port *port) 496static void mn10300_serial_dis_rx_intr(struct mn10300_serial_port *port)
@@ -487,16 +543,17 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
487 543
488try_again: 544try_again:
489 /* pull chars out of the hat */ 545 /* pull chars out of the hat */
490 ix = port->rx_outp; 546 ix = ACCESS_ONCE(port->rx_outp);
491 if (ix == port->rx_inp) { 547 if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) {
492 if (push && !tty->low_latency) 548 if (push && !tty->low_latency)
493 tty_flip_buffer_push(tty); 549 tty_flip_buffer_push(tty);
494 return; 550 return;
495 } 551 }
496 552
553 smp_read_barrier_depends();
497 ch = port->rx_buffer[ix++]; 554 ch = port->rx_buffer[ix++];
498 st = port->rx_buffer[ix++]; 555 st = port->rx_buffer[ix++];
499 smp_rmb(); 556 smp_mb();
500 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1); 557 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1);
501 port->uart.icount.rx++; 558 port->uart.icount.rx++;
502 559
@@ -778,8 +835,6 @@ static void mn10300_serial_start_tx(struct uart_port *_port)
778 struct mn10300_serial_port *port = 835 struct mn10300_serial_port *port =
779 container_of(_port, struct mn10300_serial_port, uart); 836 container_of(_port, struct mn10300_serial_port, uart);
780 837
781 u16 x;
782
783 _enter("%s{%lu}", 838 _enter("%s{%lu}",
784 port->name, 839 port->name,
785 CIRC_CNT(&port->uart.state->xmit.head, 840 CIRC_CNT(&port->uart.state->xmit.head,
@@ -787,14 +842,7 @@ static void mn10300_serial_start_tx(struct uart_port *_port)
787 UART_XMIT_SIZE)); 842 UART_XMIT_SIZE));
788 843
789 /* kick the virtual DMA controller */ 844 /* kick the virtual DMA controller */
790 arch_local_cli(); 845 mn10300_serial_en_tx_intr(port);
791 x = *port->tx_icr;
792 x |= GxICR_ENABLE;
793
794 if (*port->_status & SC01STR_TBF)
795 x &= ~(GxICR_REQUEST | GxICR_DETECT);
796 else
797 x |= GxICR_REQUEST | GxICR_DETECT;
798 846
799 _debug("CTR=%04hx ICR=%02hx STR=%04x TMD=%02hx TBR=%04hx ICR=%04hx", 847 _debug("CTR=%04hx ICR=%02hx STR=%04x TMD=%02hx TBR=%04hx ICR=%04hx",
800 *port->_control, *port->_intr, *port->_status, 848 *port->_control, *port->_intr, *port->_status,
@@ -802,10 +850,6 @@ static void mn10300_serial_start_tx(struct uart_port *_port)
802 (port->div_timer == MNSCx_DIV_TIMER_8BIT) ? 850 (port->div_timer == MNSCx_DIV_TIMER_8BIT) ?
803 *(volatile u8 *)port->_tmxbr : *port->_tmxbr, 851 *(volatile u8 *)port->_tmxbr : *port->_tmxbr,
804 *port->tx_icr); 852 *port->tx_icr);
805
806 *port->tx_icr = x;
807 x = *port->tx_icr;
808 arch_local_sti();
809} 853}
810 854
811/* 855/*
@@ -815,13 +859,17 @@ static void mn10300_serial_send_xchar(struct uart_port *_port, char ch)
815{ 859{
816 struct mn10300_serial_port *port = 860 struct mn10300_serial_port *port =
817 container_of(_port, struct mn10300_serial_port, uart); 861 container_of(_port, struct mn10300_serial_port, uart);
862 unsigned long flags;
818 863
819 _enter("%s,%02x", port->name, ch); 864 _enter("%s,%02x", port->name, ch);
820 865
821 if (likely(port->gdbstub)) { 866 if (likely(port->gdbstub)) {
822 port->tx_xchar = ch; 867 port->tx_xchar = ch;
823 if (ch) 868 if (ch) {
869 spin_lock_irqsave(&port->uart.lock, flags);
824 mn10300_serial_en_tx_intr(port); 870 mn10300_serial_en_tx_intr(port);
871 spin_unlock_irqrestore(&port->uart.lock, flags);
872 }
825 } 873 }
826} 874}
827 875
@@ -882,18 +930,21 @@ static void mn10300_serial_break_ctl(struct uart_port *_port, int ctl)
882{ 930{
883 struct mn10300_serial_port *port = 931 struct mn10300_serial_port *port =
884 container_of(_port, struct mn10300_serial_port, uart); 932 container_of(_port, struct mn10300_serial_port, uart);
933 unsigned long flags;
885 934
886 _enter("%s,%d", port->name, ctl); 935 _enter("%s,%d", port->name, ctl);
887 936
937 spin_lock_irqsave(&port->uart.lock, flags);
888 if (ctl) { 938 if (ctl) {
889 /* tell the virtual DMA handler to assert BREAK */ 939 /* tell the virtual DMA handler to assert BREAK */
890 port->tx_break = 1; 940 port->tx_flags |= MNSCx_TX_BREAK;
891 mn10300_serial_en_tx_intr(port); 941 mn10300_serial_en_tx_intr(port);
892 } else { 942 } else {
893 port->tx_break = 0; 943 port->tx_flags &= ~MNSCx_TX_BREAK;
894 *port->_control &= ~SC01CTR_BKE; 944 *port->_control &= ~SC01CTR_BKE;
895 mn10300_serial_en_tx_intr(port); 945 mn10300_serial_en_tx_intr(port);
896 } 946 }
947 spin_unlock_irqrestore(&port->uart.lock, flags);
897} 948}
898 949
899/* 950/*
@@ -916,6 +967,7 @@ static int mn10300_serial_startup(struct uart_port *_port)
916 return -ENOMEM; 967 return -ENOMEM;
917 968
918 port->rx_inp = port->rx_outp = 0; 969 port->rx_inp = port->rx_outp = 0;
970 port->tx_flags = 0;
919 971
920 /* finally, enable the device */ 972 /* finally, enable the device */
921 *port->_intr = SC01ICR_TI; 973 *port->_intr = SC01ICR_TI;
@@ -928,22 +980,23 @@ static int mn10300_serial_startup(struct uart_port *_port)
928 pint->port = port; 980 pint->port = port;
929 pint->vdma = mn10300_serial_vdma_tx_handler; 981 pint->vdma = mn10300_serial_vdma_tx_handler;
930 982
931 set_intr_level(port->rx_irq, 983 irq_set_chip(port->rx_irq, &mn10300_serial_low_pic);
932 NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL)); 984 irq_set_chip(port->tx_irq, &mn10300_serial_low_pic);
933 set_intr_level(port->tx_irq,
934 NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL));
935 irq_set_chip(port->tm_irq, &mn10300_serial_pic); 985 irq_set_chip(port->tm_irq, &mn10300_serial_pic);
936 986
937 if (request_irq(port->rx_irq, mn10300_serial_interrupt, 987 if (request_irq(port->rx_irq, mn10300_serial_interrupt,
938 IRQF_DISABLED, port->rx_name, port) < 0) 988 IRQF_DISABLED | IRQF_NOBALANCING,
989 port->rx_name, port) < 0)
939 goto error; 990 goto error;
940 991
941 if (request_irq(port->tx_irq, mn10300_serial_interrupt, 992 if (request_irq(port->tx_irq, mn10300_serial_interrupt,
942 IRQF_DISABLED, port->tx_name, port) < 0) 993 IRQF_DISABLED | IRQF_NOBALANCING,
994 port->tx_name, port) < 0)
943 goto error2; 995 goto error2;
944 996
945 if (request_irq(port->tm_irq, mn10300_serial_interrupt, 997 if (request_irq(port->tm_irq, mn10300_serial_interrupt,
946 IRQF_DISABLED, port->tm_name, port) < 0) 998 IRQF_DISABLED | IRQF_NOBALANCING,
999 port->tm_name, port) < 0)
947 goto error3; 1000 goto error3;
948 mn10300_serial_mask_ack(port->tm_irq); 1001 mn10300_serial_mask_ack(port->tm_irq);
949 1002
@@ -964,14 +1017,22 @@ error:
964 */ 1017 */
965static void mn10300_serial_shutdown(struct uart_port *_port) 1018static void mn10300_serial_shutdown(struct uart_port *_port)
966{ 1019{
1020 unsigned long flags;
967 u16 x; 1021 u16 x;
968 struct mn10300_serial_port *port = 1022 struct mn10300_serial_port *port =
969 container_of(_port, struct mn10300_serial_port, uart); 1023 container_of(_port, struct mn10300_serial_port, uart);
970 1024
971 _enter("%s", port->name); 1025 _enter("%s", port->name);
972 1026
1027 spin_lock_irqsave(&_port->lock, flags);
1028 mn10300_serial_dis_tx_intr(port);
1029
1030 *port->rx_icr = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL);
1031 x = *port->rx_icr;
1032 port->tx_flags = 0;
1033 spin_unlock_irqrestore(&_port->lock, flags);
1034
973 /* disable the serial port and its baud rate timer */ 1035 /* disable the serial port and its baud rate timer */
974 port->tx_break = 0;
975 *port->_control &= ~(SC01CTR_TXE | SC01CTR_RXE | SC01CTR_BKE); 1036 *port->_control &= ~(SC01CTR_TXE | SC01CTR_RXE | SC01CTR_BKE);
976 *port->_tmxmd = 0; 1037 *port->_tmxmd = 0;
977 1038
@@ -986,12 +1047,8 @@ static void mn10300_serial_shutdown(struct uart_port *_port)
986 free_irq(port->rx_irq, port); 1047 free_irq(port->rx_irq, port);
987 free_irq(port->tx_irq, port); 1048 free_irq(port->tx_irq, port);
988 1049
989 arch_local_cli(); 1050 mn10300_serial_int_tbl[port->tx_irq].port = NULL;
990 *port->rx_icr = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL); 1051 mn10300_serial_int_tbl[port->rx_irq].port = NULL;
991 x = *port->rx_icr;
992 *port->tx_icr = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL);
993 x = *port->tx_icr;
994 arch_local_sti();
995} 1052}
996 1053
997/* 1054/*
@@ -1317,7 +1374,8 @@ timer_okay:
1317 if ((new->c_cflag & CREAD) == 0) 1374 if ((new->c_cflag & CREAD) == 0)
1318 port->uart.ignore_status_mask |= (1 << TTY_NORMAL); 1375 port->uart.ignore_status_mask |= (1 << TTY_NORMAL);
1319 1376
1320 scxctr |= *port->_control & (SC01CTR_TXE | SC01CTR_RXE | SC01CTR_BKE); 1377 scxctr |= SC01CTR_TXE | SC01CTR_RXE;
1378 scxctr |= *port->_control & SC01CTR_BKE;
1321 *port->_control = scxctr; 1379 *port->_control = scxctr;
1322 1380
1323 spin_unlock_irqrestore(&port->uart.lock, flags); 1381 spin_unlock_irqrestore(&port->uart.lock, flags);
@@ -1519,17 +1577,24 @@ static void mn10300_serial_console_write(struct console *co,
1519{ 1577{
1520 struct mn10300_serial_port *port; 1578 struct mn10300_serial_port *port;
1521 unsigned i; 1579 unsigned i;
1522 u16 scxctr, txicr, tmp; 1580 u16 scxctr;
1523 u8 tmxmd; 1581 u8 tmxmd;
1582 unsigned long flags;
1583 int locked = 1;
1524 1584
1525 port = mn10300_serial_ports[co->index]; 1585 port = mn10300_serial_ports[co->index];
1526 1586
1587 local_irq_save(flags);
1588 if (port->uart.sysrq) {
1589 /* mn10300_serial_interrupt() already took the lock */
1590 locked = 0;
1591 } else if (oops_in_progress) {
1592 locked = spin_trylock(&port->uart.lock);
1593 } else
1594 spin_lock(&port->uart.lock);
1595
1527 /* firstly hijack the serial port from the "virtual DMA" controller */ 1596 /* firstly hijack the serial port from the "virtual DMA" controller */
1528 arch_local_cli(); 1597 mn10300_serial_dis_tx_intr(port);
1529 txicr = *port->tx_icr;
1530 *port->tx_icr = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL);
1531 tmp = *port->tx_icr;
1532 arch_local_sti();
1533 1598
1534 /* the transmitter may be disabled */ 1599 /* the transmitter may be disabled */
1535 scxctr = *port->_control; 1600 scxctr = *port->_control;
@@ -1565,12 +1630,12 @@ static void mn10300_serial_console_write(struct console *co,
1565 1630
1566 while (*port->_status & SC01STR_TBF) 1631 while (*port->_status & SC01STR_TBF)
1567 continue; 1632 continue;
1568 *(u8 *) port->_txb = ch; 1633 *port->_txb = ch;
1569 1634
1570 if (ch == 0x0a) { 1635 if (ch == 0x0a) {
1571 while (*port->_status & SC01STR_TBF) 1636 while (*port->_status & SC01STR_TBF)
1572 continue; 1637 continue;
1573 *(u8 *) port->_txb = 0xd; 1638 *port->_txb = 0xd;
1574 } 1639 }
1575 } 1640 }
1576 1641
@@ -1583,10 +1648,11 @@ static void mn10300_serial_console_write(struct console *co,
1583 if (!(scxctr & SC01CTR_TXE)) 1648 if (!(scxctr & SC01CTR_TXE))
1584 *port->_control = scxctr; 1649 *port->_control = scxctr;
1585 1650
1586 arch_local_cli(); 1651 mn10300_serial_en_tx_intr(port);
1587 *port->tx_icr = txicr; 1652
1588 tmp = *port->tx_icr; 1653 if (locked)
1589 arch_local_sti(); 1654 spin_unlock(&port->uart.lock);
1655 local_irq_restore(flags);
1590} 1656}
1591 1657
1592/* 1658/*
@@ -1655,18 +1721,29 @@ static int mn10300_serial_poll_get_char(struct uart_port *_port)
1655 1721
1656 _enter("%s", port->name); 1722 _enter("%s", port->name);
1657 1723
1658 do { 1724 if (mn10300_serial_int_tbl[port->rx_irq].port != NULL) {
1659 /* pull chars out of the hat */ 1725 do {
1660 ix = port->rx_outp; 1726 /* pull chars out of the hat */
1661 if (ix == port->rx_inp) 1727 ix = ACCESS_ONCE(port->rx_outp);
1662 return NO_POLL_CHAR; 1728 if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0)
1729 return NO_POLL_CHAR;
1663 1730
1664 ch = port->rx_buffer[ix++]; 1731 smp_read_barrier_depends();
1665 st = port->rx_buffer[ix++]; 1732 ch = port->rx_buffer[ix++];
1666 smp_rmb(); 1733 st = port->rx_buffer[ix++];
1667 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1); 1734 smp_mb();
1735 port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1);
1668 1736
1669 } while (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF)); 1737 } while (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF));
1738 } else {
1739 do {
1740 st = *port->_status;
1741 if (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF))
1742 continue;
1743 } while (!(st & SC01STR_RBF));
1744
1745 ch = *port->_rxb;
1746 }
1670 1747
1671 return ch; 1748 return ch;
1672} 1749}
@@ -1693,12 +1770,12 @@ static void mn10300_serial_poll_put_char(struct uart_port *_port,
1693 tmp = *port->_intr; 1770 tmp = *port->_intr;
1694 1771
1695 if (ch == 0x0a) { 1772 if (ch == 0x0a) {
1696 *(u8 *) port->_txb = 0x0d; 1773 *port->_txb = 0x0d;
1697 while (*port->_status & SC01STR_TBF) 1774 while (*port->_status & SC01STR_TBF)
1698 continue; 1775 continue;
1699 } 1776 }
1700 1777
1701 *(u8 *) port->_txb = ch; 1778 *port->_txb = ch;
1702 while (*port->_status & SC01STR_TBF) 1779 while (*port->_status & SC01STR_TBF)
1703 continue; 1780 continue;
1704 1781
diff --git a/arch/mn10300/kernel/mn10300-serial.h b/arch/mn10300/kernel/mn10300-serial.h
index 6796499bf78..01791c68ea1 100644
--- a/arch/mn10300/kernel/mn10300-serial.h
+++ b/arch/mn10300/kernel/mn10300-serial.h
@@ -29,6 +29,10 @@
29#define MNSCx_TX_SPACE 0x04 29#define MNSCx_TX_SPACE 0x04
30#define MNSCx_TX_EMPTY 0x08 30#define MNSCx_TX_EMPTY 0x08
31 31
32/* tx_flags bits */
33#define MNSCx_TX_BREAK 0x01
34#define MNSCx_TX_STOP 0x02
35
32#ifndef __ASSEMBLY__ 36#ifndef __ASSEMBLY__
33 37
34struct mn10300_serial_port { 38struct mn10300_serial_port {
@@ -36,7 +40,7 @@ struct mn10300_serial_port {
36 unsigned rx_inp; /* pointer to rx input offset */ 40 unsigned rx_inp; /* pointer to rx input offset */
37 unsigned rx_outp; /* pointer to rx output offset */ 41 unsigned rx_outp; /* pointer to rx output offset */
38 u8 tx_xchar; /* high-priority XON/XOFF buffer */ 42 u8 tx_xchar; /* high-priority XON/XOFF buffer */
39 u8 tx_break; /* transmit break request */ 43 u8 tx_flags; /* transmit break/stop request */
40 u8 intr_flags; /* interrupt flags */ 44 u8 intr_flags; /* interrupt flags */
41 volatile u16 *rx_icr; /* Rx interrupt control register */ 45 volatile u16 *rx_icr; /* Rx interrupt control register */
42 volatile u16 *tx_icr; /* Tx interrupt control register */ 46 volatile u16 *tx_icr; /* Tx interrupt control register */
@@ -54,8 +58,8 @@ struct mn10300_serial_port {
54 volatile u16 *_control; /* control register pointer */ 58 volatile u16 *_control; /* control register pointer */
55 volatile u8 *_status; /* status register pointer */ 59 volatile u8 *_status; /* status register pointer */
56 volatile u8 *_intr; /* interrupt register pointer */ 60 volatile u8 *_intr; /* interrupt register pointer */
57 volatile void *_rxb; /* receive buffer register pointer */ 61 volatile u8 *_rxb; /* receive buffer register pointer */
58 volatile void *_txb; /* transmit buffer register pointer */ 62 volatile u8 *_txb; /* transmit buffer register pointer */
59 volatile u16 *_tmicr; /* timer interrupt control register */ 63 volatile u16 *_tmicr; /* timer interrupt control register */
60 volatile u8 *_tmxmd; /* baud rate timer mode register */ 64 volatile u8 *_tmxmd; /* baud rate timer mode register */
61 volatile u16 *_tmxbr; /* baud rate timer base register */ 65 volatile u16 *_tmxbr; /* baud rate timer base register */
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index d0c671b6d9f..eb09f5a552f 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -206,7 +206,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
206 */ 206 */
207int copy_thread(unsigned long clone_flags, 207int copy_thread(unsigned long clone_flags,
208 unsigned long c_usp, unsigned long ustk_size, 208 unsigned long c_usp, unsigned long ustk_size,
209 struct task_struct *p, struct pt_regs *kregs) 209 struct task_struct *p)
210{ 210{
211 struct thread_info *ti = task_thread_info(p); 211 struct thread_info *ti = task_thread_info(p);
212 struct pt_regs *c_regs; 212 struct pt_regs *c_regs;
@@ -227,7 +227,7 @@ int copy_thread(unsigned long clone_flags,
227 p->thread.wchan = p->thread.pc; 227 p->thread.wchan = p->thread.pc;
228 p->thread.usp = c_usp; 228 p->thread.usp = c_usp;
229 229
230 if (unlikely(!kregs)) { 230 if (unlikely(p->flags & PF_KTHREAD)) {
231 memset(c_regs, 0, sizeof(struct pt_regs)); 231 memset(c_regs, 0, sizeof(struct pt_regs));
232 c_regs->a0 = c_usp; /* function */ 232 c_regs->a0 = c_usp; /* function */
233 c_regs->d0 = ustk_size; /* argument */ 233 c_regs->d0 = ustk_size; /* argument */
@@ -236,8 +236,9 @@ int copy_thread(unsigned long clone_flags,
236 p->thread.pc = (unsigned long) ret_from_kernel_thread; 236 p->thread.pc = (unsigned long) ret_from_kernel_thread;
237 return 0; 237 return 0;
238 } 238 }
239 *c_regs = *kregs; 239 *c_regs = *current_pt_regs();
240 c_regs->sp = c_usp; 240 if (c_usp)
241 c_regs->sp = c_usp;
241 c_regs->epsw &= ~EPSW_FE; /* my FPU */ 242 c_regs->epsw &= ~EPSW_FE; /* my FPU */
242 243
243 /* the new TLS pointer is passed in as arg #5 to sys_clone() */ 244 /* the new TLS pointer is passed in as arg #5 to sys_clone() */
@@ -249,30 +250,6 @@ int copy_thread(unsigned long clone_flags,
249 return 0; 250 return 0;
250} 251}
251 252
252/*
253 * clone a process
254 * - tlsptr is retrieved by copy_thread() from current_frame()->d3
255 */
256asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
257 int __user *parent_tidptr, int __user *child_tidptr,
258 int __user *tlsptr)
259{
260 return do_fork(clone_flags, newsp ?: current_frame()->sp,
261 current_frame(), 0, parent_tidptr, child_tidptr);
262}
263
264asmlinkage long sys_fork(void)
265{
266 return do_fork(SIGCHLD, current_frame()->sp,
267 current_frame(), 0, NULL, NULL);
268}
269
270asmlinkage long sys_vfork(void)
271{
272 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, current_frame()->sp,
273 current_frame(), 0, NULL, NULL);
274}
275
276unsigned long get_wchan(struct task_struct *p) 253unsigned long get_wchan(struct task_struct *p)
277{ 254{
278 return p->thread.wchan; 255 return p->thread.wchan;
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index e62c223e4c4..95983cd21e7 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c
@@ -130,10 +130,12 @@ static irqreturn_t smp_call_function_interrupt(int irq, void *dev_id);
130 130
131static struct irqaction reschedule_ipi = { 131static struct irqaction reschedule_ipi = {
132 .handler = smp_reschedule_interrupt, 132 .handler = smp_reschedule_interrupt,
133 .flags = IRQF_NOBALANCING,
133 .name = "smp reschedule IPI" 134 .name = "smp reschedule IPI"
134}; 135};
135static struct irqaction call_function_ipi = { 136static struct irqaction call_function_ipi = {
136 .handler = smp_call_function_interrupt, 137 .handler = smp_call_function_interrupt,
138 .flags = IRQF_NOBALANCING,
137 .name = "smp call function IPI" 139 .name = "smp call function IPI"
138}; 140};
139 141
@@ -141,7 +143,7 @@ static struct irqaction call_function_ipi = {
141static irqreturn_t smp_ipi_timer_interrupt(int irq, void *dev_id); 143static irqreturn_t smp_ipi_timer_interrupt(int irq, void *dev_id);
142static struct irqaction local_timer_ipi = { 144static struct irqaction local_timer_ipi = {
143 .handler = smp_ipi_timer_interrupt, 145 .handler = smp_ipi_timer_interrupt,
144 .flags = IRQF_DISABLED, 146 .flags = IRQF_DISABLED | IRQF_NOBALANCING,
145 .name = "smp local timer IPI" 147 .name = "smp local timer IPI"
146}; 148};
147#endif 149#endif
@@ -180,6 +182,7 @@ static void init_ipi(void)
180 182
181#ifdef CONFIG_MN10300_CACHE_ENABLED 183#ifdef CONFIG_MN10300_CACHE_ENABLED
182 /* set up the cache flush IPI */ 184 /* set up the cache flush IPI */
185 irq_set_chip(FLUSH_CACHE_IPI, &mn10300_ipi_type);
183 flags = arch_local_cli_save(); 186 flags = arch_local_cli_save();
184 __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(FLUSH_CACHE_GxICR_LV), 187 __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(FLUSH_CACHE_GxICR_LV),
185 mn10300_low_ipi_handler); 188 mn10300_low_ipi_handler);
@@ -189,6 +192,7 @@ static void init_ipi(void)
189#endif 192#endif
190 193
191 /* set up the NMI call function IPI */ 194 /* set up the NMI call function IPI */
195 irq_set_chip(CALL_FUNCTION_NMI_IPI, &mn10300_ipi_type);
192 flags = arch_local_cli_save(); 196 flags = arch_local_cli_save();
193 GxICR(CALL_FUNCTION_NMI_IPI) = GxICR_NMI | GxICR_ENABLE | GxICR_DETECT; 197 GxICR(CALL_FUNCTION_NMI_IPI) = GxICR_NMI | GxICR_ENABLE | GxICR_DETECT;
194 tmp16 = GxICR(CALL_FUNCTION_NMI_IPI); 198 tmp16 = GxICR(CALL_FUNCTION_NMI_IPI);
@@ -199,6 +203,10 @@ static void init_ipi(void)
199 __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(SMP_BOOT_GxICR_LV), 203 __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(SMP_BOOT_GxICR_LV),
200 mn10300_low_ipi_handler); 204 mn10300_low_ipi_handler);
201 arch_local_irq_restore(flags); 205 arch_local_irq_restore(flags);
206
207#ifdef CONFIG_KERNEL_DEBUGGER
208 irq_set_chip(DEBUGGER_NMI_IPI, &mn10300_ipi_type);
209#endif
202} 210}
203 211
204/** 212/**
diff --git a/arch/mn10300/mm/fault.c b/arch/mn10300/mm/fault.c
index 90f346f7392..d48a84fd7fa 100644
--- a/arch/mn10300/mm/fault.c
+++ b/arch/mn10300/mm/fault.c
@@ -123,7 +123,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long fault_code,
123 struct mm_struct *mm; 123 struct mm_struct *mm;
124 unsigned long page; 124 unsigned long page;
125 siginfo_t info; 125 siginfo_t info;
126 int write, fault; 126 int fault;
127 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
127 128
128#ifdef CONFIG_GDBSTUB 129#ifdef CONFIG_GDBSTUB
129 /* handle GDB stub causing a fault */ 130 /* handle GDB stub causing a fault */
@@ -170,6 +171,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long fault_code,
170 if (in_atomic() || !mm) 171 if (in_atomic() || !mm)
171 goto no_context; 172 goto no_context;
172 173
174retry:
173 down_read(&mm->mmap_sem); 175 down_read(&mm->mmap_sem);
174 176
175 vma = find_vma(mm, address); 177 vma = find_vma(mm, address);
@@ -220,7 +222,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long fault_code,
220 */ 222 */
221good_area: 223good_area:
222 info.si_code = SEGV_ACCERR; 224 info.si_code = SEGV_ACCERR;
223 write = 0;
224 switch (fault_code & (MMUFCR_xFC_PGINVAL|MMUFCR_xFC_TYPE)) { 225 switch (fault_code & (MMUFCR_xFC_PGINVAL|MMUFCR_xFC_TYPE)) {
225 default: /* 3: write, present */ 226 default: /* 3: write, present */
226 case MMUFCR_xFC_TYPE_WRITE: 227 case MMUFCR_xFC_TYPE_WRITE:
@@ -232,7 +233,7 @@ good_area:
232 case MMUFCR_xFC_PGINVAL | MMUFCR_xFC_TYPE_WRITE: 233 case MMUFCR_xFC_PGINVAL | MMUFCR_xFC_TYPE_WRITE:
233 if (!(vma->vm_flags & VM_WRITE)) 234 if (!(vma->vm_flags & VM_WRITE))
234 goto bad_area; 235 goto bad_area;
235 write++; 236 flags |= FAULT_FLAG_WRITE;
236 break; 237 break;
237 238
238 /* read from protected page */ 239 /* read from protected page */
@@ -251,7 +252,11 @@ good_area:
251 * make sure we exit gracefully rather than endlessly redo 252 * make sure we exit gracefully rather than endlessly redo
252 * the fault. 253 * the fault.
253 */ 254 */
254 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 255 fault = handle_mm_fault(mm, vma, address, flags);
256
257 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
258 return;
259
255 if (unlikely(fault & VM_FAULT_ERROR)) { 260 if (unlikely(fault & VM_FAULT_ERROR)) {
256 if (fault & VM_FAULT_OOM) 261 if (fault & VM_FAULT_OOM)
257 goto out_of_memory; 262 goto out_of_memory;
@@ -259,10 +264,22 @@ good_area:
259 goto do_sigbus; 264 goto do_sigbus;
260 BUG(); 265 BUG();
261 } 266 }
262 if (fault & VM_FAULT_MAJOR) 267 if (flags & FAULT_FLAG_ALLOW_RETRY) {
263 current->maj_flt++; 268 if (fault & VM_FAULT_MAJOR)
264 else 269 current->maj_flt++;
265 current->min_flt++; 270 else
271 current->min_flt++;
272 if (fault & VM_FAULT_RETRY) {
273 flags &= ~FAULT_FLAG_ALLOW_RETRY;
274
275 /* No need to up_read(&mm->mmap_sem) as we would
276 * have already released it in __lock_page_or_retry
277 * in mm/filemap.c.
278 */
279
280 goto retry;
281 }
282 }
266 283
267 up_read(&mm->mmap_sem); 284 up_read(&mm->mmap_sem);
268 return; 285 return;
diff --git a/arch/mn10300/mm/pgtable.c b/arch/mn10300/mm/pgtable.c
index 4ebf117c328..bd9ada693f9 100644
--- a/arch/mn10300/mm/pgtable.c
+++ b/arch/mn10300/mm/pgtable.c
@@ -95,7 +95,7 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
95 * checks at dup_mmap(), exec(), and other mmlist addition points 95 * checks at dup_mmap(), exec(), and other mmlist addition points
96 * could be used. The locking scheme was chosen on the basis of 96 * could be used. The locking scheme was chosen on the basis of
97 * manfred's recommendations and having no core impact whatsoever. 97 * manfred's recommendations and having no core impact whatsoever.
98 * -- wli 98 * -- nyc
99 */ 99 */
100DEFINE_SPINLOCK(pgd_lock); 100DEFINE_SPINLOCK(pgd_lock);
101struct page *pgd_list; 101struct page *pgd_list;
diff --git a/arch/mn10300/unit-asb2305/pci-iomap.c b/arch/mn10300/unit-asb2305/pci-iomap.c
new file mode 100644
index 00000000000..bd65dae17f3
--- /dev/null
+++ b/arch/mn10300/unit-asb2305/pci-iomap.c
@@ -0,0 +1,35 @@
1/* ASB2305 PCI I/O mapping handler
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#include <linux/pci.h>
12#include <linux/module.h>
13
14/*
15 * Create a virtual mapping cookie for a PCI BAR (memory or IO)
16 */
17void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
18{
19 resource_size_t start = pci_resource_start(dev, bar);
20 resource_size_t len = pci_resource_len(dev, bar);
21 unsigned long flags = pci_resource_flags(dev, bar);
22
23 if (!len || !start)
24 return NULL;
25
26 if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM)) {
27 if (flags & IORESOURCE_CACHEABLE && !(flags & IORESOURCE_IO))
28 return ioremap(start, len);
29 else
30 return ioremap_nocache(start, len);
31 }
32
33 return NULL;
34}
35EXPORT_SYMBOL(pci_iomap);
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6dce9fc2cf3..e2059486d3f 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/irq.h>
20#include <asm/io.h> 21#include <asm/io.h>
21#include "pci-asb2305.h" 22#include "pci-asb2305.h"
22 23
@@ -303,9 +304,7 @@ static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
303 304
304static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 305static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
305{ 306{
306 struct pci_bus_region region; 307 int limit, i;
307 int i;
308 int limit;
309 308
310 if (dev->bus->number != 0) 309 if (dev->bus->number != 0)
311 return; 310 return;
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 05f2ba41ff1..ec37e185d20 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -22,6 +22,8 @@ config OPENRISC
22 select GENERIC_STRNCPY_FROM_USER 22 select GENERIC_STRNCPY_FROM_USER
23 select GENERIC_STRNLEN_USER 23 select GENERIC_STRNLEN_USER
24 select MODULES_USE_ELF_RELA 24 select MODULES_USE_ELF_RELA
25 select GENERIC_KERNEL_THREAD
26 select GENERIC_KERNEL_EXECVE
25 27
26config MMU 28config MMU
27 def_bool y 29 def_bool y
@@ -144,7 +146,7 @@ config DEBUG_STACKOVERFLOW
144 help 146 help
145 Make extra checks for space available on stack in some 147 Make extra checks for space available on stack in some
146 critical functions. This will cause kernel to run a bit slower, 148 critical functions. This will cause kernel to run a bit slower,
147 but will catch most of kernel stack overruns and exit gracefuly. 149 but will catch most of kernel stack overruns and exit gracefully.
148 150
149 Say Y if you are unsure. 151 Say Y if you are unsure.
150 152
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
index 966886c8daf..4739b8302a5 100644
--- a/arch/openrisc/Makefile
+++ b/arch/openrisc/Makefile
@@ -50,6 +50,6 @@ BUILTIN_DTB := y
50else 50else
51BUILTIN_DTB := n 51BUILTIN_DTB := n
52endif 52endif
53core-$(BUILTIN_DTB) += arch/openrisc/boot/ 53core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/
54 54
55all: vmlinux 55all: vmlinux
diff --git a/arch/openrisc/boot/Makefile b/arch/openrisc/boot/dts/Makefile
index 09958358601..b092d30d6c2 100644
--- a/arch/openrisc/boot/Makefile
+++ b/arch/openrisc/boot/dts/Makefile
@@ -1,5 +1,3 @@
1
2
3ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""' 1ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""'
4BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o 2BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o
5else 3else
@@ -10,6 +8,3 @@ obj-y += $(BUILTIN_DTB)
10clean-files := *.dtb.S 8clean-files := *.dtb.S
11 9
12#DTC_FLAGS ?= -p 1024 10#DTC_FLAGS ?= -p 1024
13
14$(obj)/%.dtb: $(src)/dts/%.dts FORCE
15 $(call if_changed_dep,dtc)
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 78de6805268..8971026e1c6 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -60,6 +60,7 @@ generic-y += swab.h
60generic-y += termbits.h 60generic-y += termbits.h
61generic-y += termios.h 61generic-y += termios.h
62generic-y += topology.h 62generic-y += topology.h
63generic-y += trace_clock.h
63generic-y += types.h 64generic-y += types.h
64generic-y += ucontext.h 65generic-y += ucontext.h
65generic-y += user.h 66generic-y += user.h
diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h
index 43decdbdb2e..33691380608 100644
--- a/arch/openrisc/include/asm/processor.h
+++ b/arch/openrisc/include/asm/processor.h
@@ -81,8 +81,6 @@ struct thread_struct {
81#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp) 81#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp)
82 82
83 83
84extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
85
86void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp); 84void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
87void release_thread(struct task_struct *); 85void release_thread(struct task_struct *);
88unsigned long get_wchan(struct task_struct *p); 86unsigned long get_wchan(struct task_struct *p);
diff --git a/arch/openrisc/include/asm/syscalls.h b/arch/openrisc/include/asm/syscalls.h
index 84a978af44d..8ee816812a9 100644
--- a/arch/openrisc/include/asm/syscalls.h
+++ b/arch/openrisc/include/asm/syscalls.h
@@ -24,4 +24,11 @@ asmlinkage long sys_or1k_atomic(unsigned long type, unsigned long *v1,
24 24
25#include <asm-generic/syscalls.h> 25#include <asm-generic/syscalls.h>
26 26
27asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
28 void __user *parent_tid, void __user *child_tid, int tls);
29asmlinkage long __sys_fork(void);
30
31#define sys_clone __sys_clone
32#define sys_fork __sys_fork
33
27#endif /* __ASM_OPENRISC_SYSCALLS_H */ 34#endif /* __ASM_OPENRISC_SYSCALLS_H */
diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
index 437bdbb61b1..5082b806632 100644
--- a/arch/openrisc/include/uapi/asm/unistd.h
+++ b/arch/openrisc/include/uapi/asm/unistd.h
@@ -20,6 +20,10 @@
20 20
21#define sys_mmap2 sys_mmap_pgoff 21#define sys_mmap2 sys_mmap_pgoff
22 22
23#define __ARCH_WANT_SYS_EXECVE
24#define __ARCH_WANT_SYS_FORK
25#define __ARCH_WANT_SYS_CLONE
26
23#include <asm-generic/unistd.h> 27#include <asm-generic/unistd.h>
24 28
25#define __NR_or1k_atomic __NR_arch_specific_syscall 29#define __NR_or1k_atomic __NR_arch_specific_syscall
diff --git a/arch/openrisc/kernel/Makefile b/arch/openrisc/kernel/Makefile
index e1ee0fa2bbd..35f92ce51c2 100644
--- a/arch/openrisc/kernel/Makefile
+++ b/arch/openrisc/kernel/Makefile
@@ -5,7 +5,7 @@
5extra-y := head.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \ 7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \
8 traps.o time.o irq.o entry.o ptrace.o signal.o sys_or32.o \ 8 traps.o time.o irq.o entry.o ptrace.o signal.o \
9 sys_call_table.o 9 sys_call_table.o
10 10
11obj-$(CONFIG_MODULES) += module.o 11obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index ddfcaa828b0..5e5b30601bb 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -894,6 +894,16 @@ ENTRY(ret_from_fork)
894 l.jal schedule_tail 894 l.jal schedule_tail
895 l.nop 895 l.nop
896 896
897 /* Check if we are a kernel thread */
898 l.sfeqi r20,0
899 l.bf 1f
900 l.nop
901
902 /* ...we are a kernel thread so invoke the requested callback */
903 l.jalr r20
904 l.or r3,r22,r0
905
9061:
897 /* _syscall_returns expect r11 to contain return value */ 907 /* _syscall_returns expect r11 to contain return value */
898 l.lwz r11,PT_GPR11(r1) 908 l.lwz r11,PT_GPR11(r1)
899 909
@@ -915,26 +925,6 @@ ENTRY(ret_from_fork)
915 l.j _syscall_return 925 l.j _syscall_return
916 l.nop 926 l.nop
917 927
918/* Since syscalls don't save call-clobbered registers, the args to
919 * kernel_thread_helper will need to be passed through callee-saved
920 * registers and copied to the parameter registers when the thread
921 * begins running.
922 *
923 * See arch/openrisc/kernel/process.c:
924 * The args are passed as follows:
925 * arg1 (r3) : passed in r20
926 * arg2 (r4) : passed in r22
927 */
928
929ENTRY(_kernel_thread_helper)
930 l.or r3,r20,r0
931 l.or r4,r22,r0
932 l.movhi r31,hi(kernel_thread_helper)
933 l.ori r31,r31,lo(kernel_thread_helper)
934 l.jr r31
935 l.nop
936
937
938/* ========================================================[ switch ] === */ 928/* ========================================================[ switch ] === */
939 929
940/* 930/*
@@ -1044,8 +1034,13 @@ ENTRY(_switch)
1044 /* Unwind stack to pre-switch state */ 1034 /* Unwind stack to pre-switch state */
1045 l.addi r1,r1,(INT_FRAME_SIZE) 1035 l.addi r1,r1,(INT_FRAME_SIZE)
1046 1036
1047 /* Return via the link-register back to where we 'came from', where that can be 1037 /* Return via the link-register back to where we 'came from', where
1048 * either schedule() or return_from_fork()... */ 1038 * that may be either schedule(), ret_from_fork(), or
1039 * ret_from_kernel_thread(). If we are returning to a new thread,
1040 * we are expected to have set up the arg to schedule_tail already,
1041 * hence we do so here unconditionally:
1042 */
1043 l.lwz r3,TI_STACK(r3) /* Load 'prev' as schedule_tail arg */
1049 l.jr r9 1044 l.jr r9
1050 l.nop 1045 l.nop
1051 1046
@@ -1076,22 +1071,18 @@ _fork_save_extra_regs_and_call:
1076 l.jr r29 1071 l.jr r29
1077 l.sw PT_GPR28(r1),r28 1072 l.sw PT_GPR28(r1),r28
1078 1073
1079ENTRY(sys_clone) 1074ENTRY(__sys_clone)
1080 l.movhi r29,hi(_sys_clone) 1075 l.movhi r29,hi(sys_clone)
1081 l.ori r29,r29,lo(_sys_clone) 1076 l.ori r29,r29,lo(sys_clone)
1082 l.j _fork_save_extra_regs_and_call 1077 l.j _fork_save_extra_regs_and_call
1083 l.addi r7,r1,0 1078 l.addi r7,r1,0
1084 1079
1085ENTRY(sys_fork) 1080ENTRY(__sys_fork)
1086 l.movhi r29,hi(_sys_fork) 1081 l.movhi r29,hi(sys_fork)
1087 l.ori r29,r29,lo(_sys_fork) 1082 l.ori r29,r29,lo(sys_fork)
1088 l.j _fork_save_extra_regs_and_call 1083 l.j _fork_save_extra_regs_and_call
1089 l.addi r3,r1,0 1084 l.addi r3,r1,0
1090 1085
1091ENTRY(sys_execve)
1092 l.j _sys_execve
1093 l.addi r6,r1,0
1094
1095ENTRY(sys_sigaltstack) 1086ENTRY(sys_sigaltstack)
1096 l.j _sys_sigaltstack 1087 l.j _sys_sigaltstack
1097 l.addi r5,r1,0 1088 l.addi r5,r1,0
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index c35f3ab1a8d..00c233bf0d0 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -109,66 +109,83 @@ void release_thread(struct task_struct *dead_task)
109 */ 109 */
110extern asmlinkage void ret_from_fork(void); 110extern asmlinkage void ret_from_fork(void);
111 111
112/*
113 * copy_thread
114 * @clone_flags: flags
115 * @usp: user stack pointer or fn for kernel thread
116 * @arg: arg to fn for kernel thread; always NULL for userspace thread
117 * @p: the newly created task
118 * @regs: CPU context to copy for userspace thread; always NULL for kthread
119 *
120 * At the top of a newly initialized kernel stack are two stacked pt_reg
121 * structures. The first (topmost) is the userspace context of the thread.
122 * The second is the kernelspace context of the thread.
123 *
124 * A kernel thread will not be returning to userspace, so the topmost pt_regs
125 * struct can be uninitialized; it _does_ need to exist, though, because
126 * a kernel thread can become a userspace thread by doing a kernel_execve, in
127 * which case the topmost context will be initialized and used for 'returning'
128 * to userspace.
129 *
130 * The second pt_reg struct needs to be initialized to 'return' to
131 * ret_from_fork. A kernel thread will need to set r20 to the address of
132 * a function to call into (with arg in r22); userspace threads need to set
133 * r20 to NULL in which case ret_from_fork will just continue a return to
134 * userspace.
135 *
136 * A kernel thread 'fn' may return; this is effectively what happens when
137 * kernel_execve is called. In that case, the userspace pt_regs must have
138 * been initialized (which kernel_execve takes care of, see start_thread
139 * below); ret_from_fork will then continue its execution causing the
140 * 'kernel thread' to return to userspace as a userspace thread.
141 */
142
112int 143int
113copy_thread(unsigned long clone_flags, unsigned long usp, 144copy_thread(unsigned long clone_flags, unsigned long usp,
114 unsigned long unused, struct task_struct *p, struct pt_regs *regs) 145 unsigned long arg, struct task_struct *p)
115{ 146{
116 struct pt_regs *childregs; 147 struct pt_regs *userregs;
117 struct pt_regs *kregs; 148 struct pt_regs *kregs;
118 unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; 149 unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
119 struct thread_info *ti;
120 unsigned long top_of_kernel_stack; 150 unsigned long top_of_kernel_stack;
121 151
122 top_of_kernel_stack = sp; 152 top_of_kernel_stack = sp;
123 153
124 p->set_child_tid = p->clear_child_tid = NULL; 154 p->set_child_tid = p->clear_child_tid = NULL;
125 155
126 /* Copy registers */ 156 /* Locate userspace context on stack... */
127 /* redzone */ 157 sp -= STACK_FRAME_OVERHEAD; /* redzone */
128 sp -= STACK_FRAME_OVERHEAD;
129 sp -= sizeof(struct pt_regs); 158 sp -= sizeof(struct pt_regs);
130 childregs = (struct pt_regs *)sp; 159 userregs = (struct pt_regs *) sp;
131 160
132 /* Copy parent registers */ 161 /* ...and kernel context */
133 *childregs = *regs; 162 sp -= STACK_FRAME_OVERHEAD; /* redzone */
163 sp -= sizeof(struct pt_regs);
164 kregs = (struct pt_regs *)sp;
134 165
135 if ((childregs->sr & SPR_SR_SM) == 1) { 166 if (unlikely(p->flags & PF_KTHREAD)) {
136 /* for kernel thread, set `current_thread_info' 167 memset(kregs, 0, sizeof(struct pt_regs));
137 * and stackptr in new task 168 kregs->gpr[20] = usp; /* fn, kernel thread */
138 */ 169 kregs->gpr[22] = arg;
139 childregs->sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
140 childregs->gpr[10] = (unsigned long)task_thread_info(p);
141 } else { 170 } else {
142 childregs->sp = usp; 171 *userregs = *current_pt_regs();
143 }
144
145 childregs->gpr[11] = 0; /* Result from fork() */
146 172
147 /* 173 if (usp)
148 * The way this works is that at some point in the future 174 userregs->sp = usp;
149 * some task will call _switch to switch to the new task. 175 userregs->gpr[11] = 0; /* Result from fork() */
150 * That will pop off the stack frame created below and start
151 * the new task running at ret_from_fork. The new task will
152 * do some house keeping and then return from the fork or clone
153 * system call, using the stack frame created above.
154 */
155 /* redzone */
156 sp -= STACK_FRAME_OVERHEAD;
157 sp -= sizeof(struct pt_regs);
158 kregs = (struct pt_regs *)sp;
159 176
160 ti = task_thread_info(p); 177 kregs->gpr[20] = 0; /* Userspace thread */
161 ti->ksp = sp; 178 }
162 179
163 /* kregs->sp must store the location of the 'pre-switch' kernel stack 180 /*
164 * pointer... for a newly forked process, this is simply the top of 181 * _switch wants the kernel stack page in pt_regs->sp so that it
165 * the kernel stack. 182 * can restore it to thread_info->ksp... see _switch for details.
166 */ 183 */
167 kregs->sp = top_of_kernel_stack; 184 kregs->sp = top_of_kernel_stack;
168 kregs->gpr[3] = (unsigned long)current; /* arg to schedule_tail */
169 kregs->gpr[10] = (unsigned long)task_thread_info(p);
170 kregs->gpr[9] = (unsigned long)ret_from_fork; 185 kregs->gpr[9] = (unsigned long)ret_from_fork;
171 186
187 task_thread_info(p)->ksp = (unsigned long)kregs;
188
172 return 0; 189 return 0;
173} 190}
174 191
@@ -177,16 +194,14 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
177 */ 194 */
178void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) 195void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
179{ 196{
180 unsigned long sr = regs->sr & ~SPR_SR_SM; 197 unsigned long sr = mfspr(SPR_SR) & ~SPR_SR_SM;
181 198
182 set_fs(USER_DS); 199 set_fs(USER_DS);
183 memset(regs->gpr, 0, sizeof(regs->gpr)); 200 memset(regs, 0, sizeof(struct pt_regs));
184 201
185 regs->pc = pc; 202 regs->pc = pc;
186 regs->sr = sr; 203 regs->sr = sr;
187 regs->sp = sp; 204 regs->sp = sp;
188
189/* printk("start thread, ksp = %lx\n", current_thread_info()->ksp);*/
190} 205}
191 206
192/* Fill in the fpu structure for a core dump. */ 207/* Fill in the fpu structure for a core dump. */
@@ -237,74 +252,9 @@ void dump_elf_thread(elf_greg_t *dest, struct pt_regs* regs)
237 dest[35] = 0; 252 dest[35] = 0;
238} 253}
239 254
240extern void _kernel_thread_helper(void);
241
242void __noreturn kernel_thread_helper(int (*fn) (void *), void *arg)
243{
244 do_exit(fn(arg));
245}
246
247/*
248 * Create a kernel thread.
249 */
250int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags)
251{
252 struct pt_regs regs;
253
254 memset(&regs, 0, sizeof(regs));
255
256 regs.gpr[20] = (unsigned long)fn;
257 regs.gpr[22] = (unsigned long)arg;
258 regs.sr = mfspr(SPR_SR);
259 regs.pc = (unsigned long)_kernel_thread_helper;
260
261 return do_fork(flags | CLONE_VM | CLONE_UNTRACED,
262 0, &regs, 0, NULL, NULL);
263}
264
265/*
266 * sys_execve() executes a new program.
267 */
268asmlinkage long _sys_execve(const char __user *name,
269 const char __user * const __user *argv,
270 const char __user * const __user *envp,
271 struct pt_regs *regs)
272{
273 int error;
274 struct filename *filename;
275
276 filename = getname(name);
277 error = PTR_ERR(filename);
278
279 if (IS_ERR(filename))
280 goto out;
281
282 error = do_execve(filename->name, argv, envp, regs);
283 putname(filename);
284
285out:
286 return error;
287}
288
289unsigned long get_wchan(struct task_struct *p) 255unsigned long get_wchan(struct task_struct *p)
290{ 256{
291 /* TODO */ 257 /* TODO */
292 258
293 return 0; 259 return 0;
294} 260}
295
296int kernel_execve(const char *filename, char *const argv[], char *const envp[])
297{
298 register long __res asm("r11") = __NR_execve;
299 register long __a asm("r3") = (long)(filename);
300 register long __b asm("r4") = (long)(argv);
301 register long __c asm("r5") = (long)(envp);
302 __asm__ volatile ("l.sys 1"
303 : "=r" (__res), "=r"(__a), "=r"(__b), "=r"(__c)
304 : "0"(__res), "1"(__a), "2"(__b), "3"(__c)
305 : "r6", "r7", "r8", "r12", "r13", "r15",
306 "r17", "r19", "r21", "r23", "r25", "r27",
307 "r29", "r31");
308 __asm__ volatile ("l.nop");
309 return __res;
310}
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 30110297f4f..ddedc8a7786 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -84,7 +84,6 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
84{ 84{
85 struct rt_sigframe *frame = (struct rt_sigframe __user *)regs->sp; 85 struct rt_sigframe *frame = (struct rt_sigframe __user *)regs->sp;
86 sigset_t set; 86 sigset_t set;
87 stack_t st;
88 87
89 /* 88 /*
90 * Since we stacked the signal on a dword boundary, 89 * Since we stacked the signal on a dword boundary,
@@ -104,11 +103,10 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
104 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 103 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
105 goto badframe; 104 goto badframe;
106 105
107 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
108 goto badframe;
109 /* It is more difficult to avoid calling this function than to 106 /* It is more difficult to avoid calling this function than to
110 call it and ignore errors. */ 107 call it and ignore errors. */
111 do_sigaltstack(&st, NULL, regs->sp); 108 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
109 goto badframe;
112 110
113 return regs->gpr[11]; 111 return regs->gpr[11];
114 112
diff --git a/arch/openrisc/kernel/sys_or32.c b/arch/openrisc/kernel/sys_or32.c
deleted file mode 100644
index 57060084c0c..00000000000
--- a/arch/openrisc/kernel/sys_or32.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * OpenRISC sys_or32.c
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * Modifications for the OpenRISC architecture:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 *
17 * This file contains various random system calls that
18 * have a non-standard calling sequence on some platforms.
19 * Since we don't have to do any backwards compatibility, our
20 * versions are done in the most "normal" way possible.
21 */
22
23#include <linux/errno.h>
24#include <linux/syscalls.h>
25#include <linux/mm.h>
26
27#include <asm/syscalls.h>
28
29/* These are secondary entry points as the primary entry points are defined in
30 * entry.S where we add the 'regs' parameter value
31 */
32
33asmlinkage long _sys_clone(unsigned long clone_flags, unsigned long newsp,
34 int __user *parent_tid, int __user *child_tid,
35 struct pt_regs *regs)
36{
37 long ret;
38
39 /* FIXME: Is alignment necessary? */
40 /* newsp = ALIGN(newsp, 4); */
41
42 if (!newsp)
43 newsp = regs->sp;
44
45 ret = do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
46
47 return ret;
48}
49
50asmlinkage int _sys_fork(struct pt_regs *regs)
51{
52#ifdef CONFIG_MMU
53 return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
54#else
55 return -EINVAL;
56#endif
57}
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 11def45b98c..e688a2be30f 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -22,6 +22,9 @@ config PARISC
22 select GENERIC_STRNCPY_FROM_USER 22 select GENERIC_STRNCPY_FROM_USER
23 select HAVE_MOD_ARCH_SPECIFIC 23 select HAVE_MOD_ARCH_SPECIFIC
24 select MODULES_USE_ELF_RELA 24 select MODULES_USE_ELF_RELA
25 select GENERIC_KERNEL_THREAD
26 select GENERIC_KERNEL_EXECVE
27 select CLONE_BACKWARDS
25 28
26 help 29 help
27 The PA-RISC microprocessor is designed by Hewlett-Packard and used 30 The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index bac8debecff..ff4c9faed54 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -3,3 +3,4 @@ generic-y += word-at-a-time.h auxvec.h user.h cputime.h emergency-restart.h \
3 segment.h topology.h vga.h device.h percpu.h hw_irq.h mutex.h \ 3 segment.h topology.h vga.h device.h percpu.h hw_irq.h mutex.h \
4 div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \ 4 div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \
5 poll.h xor.h clkdev.h exec.h 5 poll.h xor.h clkdev.h exec.h
6generic-y += trace_clock.h
diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h
index 0e8b7b8ce8a..09b54a57a48 100644
--- a/arch/parisc/include/asm/processor.h
+++ b/arch/parisc/include/asm/processor.h
@@ -326,7 +326,6 @@ struct mm_struct;
326 326
327/* Free all resources held by a thread. */ 327/* Free all resources held by a thread. */
328extern void release_thread(struct task_struct *); 328extern void release_thread(struct task_struct *);
329extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
330 329
331extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm); 330extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm);
332 331
diff --git a/arch/parisc/include/asm/signal.h b/arch/parisc/include/asm/signal.h
index 21abf4fc169..0fdb3c83595 100644
--- a/arch/parisc/include/asm/signal.h
+++ b/arch/parisc/include/asm/signal.h
@@ -34,8 +34,6 @@ struct k_sigaction {
34 struct sigaction sa; 34 struct sigaction sa;
35}; 35};
36 36
37#define ptrace_signal_deliver(regs, cookie) do { } while (0)
38
39#include <asm/sigcontext.h> 37#include <asm/sigcontext.h>
40 38
41#endif /* !__ASSEMBLY */ 39#endif /* !__ASSEMBLY */
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index 541639c3f60..1efef41659c 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -163,6 +163,10 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
163#define __ARCH_WANT_SYS_RT_SIGACTION 163#define __ARCH_WANT_SYS_RT_SIGACTION
164#define __ARCH_WANT_SYS_RT_SIGSUSPEND 164#define __ARCH_WANT_SYS_RT_SIGSUSPEND
165#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 165#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
166#define __ARCH_WANT_SYS_EXECVE
167#define __ARCH_WANT_SYS_FORK
168#define __ARCH_WANT_SYS_VFORK
169#define __ARCH_WANT_SYS_CLONE
166 170
167#endif /* __ASSEMBLY__ */ 171#endif /* __ASSEMBLY__ */
168 172
diff --git a/arch/parisc/include/uapi/asm/ioctls.h b/arch/parisc/include/uapi/asm/ioctls.h
index 054ec06f9e2..66719c38a36 100644
--- a/arch/parisc/include/uapi/asm/ioctls.h
+++ b/arch/parisc/include/uapi/asm/ioctls.h
@@ -55,6 +55,9 @@
55#define TIOCGDEV _IOR('T',0x32, int) /* Get primary device node of /dev/console */ 55#define TIOCGDEV _IOR('T',0x32, int) /* Get primary device node of /dev/console */
56#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ 56#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
57#define TIOCVHANGUP 0x5437 57#define TIOCVHANGUP 0x5437
58#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
59#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
60#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
58 61
59#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ 62#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
60#define FIOCLEX 0x5451 63#define FIOCLEX 0x5451
diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
index 12219ebce86..294d251ca7b 100644
--- a/arch/parisc/include/uapi/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
@@ -70,4 +70,15 @@
70#define MAP_FILE 0 70#define MAP_FILE 0
71#define MAP_VARIABLE 0 71#define MAP_VARIABLE 0
72 72
73/*
74 * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
75 * This gives us 6 bits, which is enough until someone invents 128 bit address
76 * spaces.
77 *
78 * Assume these are all power of twos.
79 * When 0 use the default page size.
80 */
81#define MAP_HUGE_SHIFT 26
82#define MAP_HUGE_MASK 0x3f
83
73#endif /* __PARISC_MMAN_H__ */ 84#endif /* __PARISC_MMAN_H__ */
diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
index 1b52c2c31a7..d9ff4731253 100644
--- a/arch/parisc/include/uapi/asm/socket.h
+++ b/arch/parisc/include/uapi/asm/socket.h
@@ -48,6 +48,7 @@
48/* Socket filtering */ 48/* Socket filtering */
49#define SO_ATTACH_FILTER 0x401a 49#define SO_ATTACH_FILTER 0x401a
50#define SO_DETACH_FILTER 0x401b 50#define SO_DETACH_FILTER 0x401b
51#define SO_GET_FILTER SO_ATTACH_FILTER
51 52
52#define SO_ACCEPTCONN 0x401c 53#define SO_ACCEPTCONN 0x401c
53 54
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 18670a07884..bfb44247d7a 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -708,59 +708,9 @@ ENTRY(end_fault_vector)
708 .import do_cpu_irq_mask,code 708 .import do_cpu_irq_mask,code
709 709
710 /* 710 /*
711 * r26 = function to be called
712 * r25 = argument to pass in
713 * r24 = flags for do_fork()
714 *
715 * Kernel threads don't ever return, so they don't need
716 * a true register context. We just save away the arguments
717 * for copy_thread/ret_ to properly set up the child.
718 */
719
720#define CLONE_VM 0x100 /* Must agree with <linux/sched.h> */
721#define CLONE_UNTRACED 0x00800000
722
723 .import do_fork
724ENTRY(__kernel_thread)
725 STREG %r2, -RP_OFFSET(%r30)
726
727 copy %r30, %r1
728 ldo PT_SZ_ALGN(%r30),%r30
729#ifdef CONFIG_64BIT
730 /* Yo, function pointers in wide mode are little structs... -PB */
731 ldd 24(%r26), %r2
732 STREG %r2, PT_GR27(%r1) /* Store childs %dp */
733 ldd 16(%r26), %r26
734
735 STREG %r22, PT_GR22(%r1) /* save r22 (arg5) */
736 copy %r0, %r22 /* user_tid */
737#endif
738 STREG %r26, PT_GR26(%r1) /* Store function & argument for child */
739 STREG %r25, PT_GR25(%r1)
740 ldil L%CLONE_UNTRACED, %r26
741 ldo CLONE_VM(%r26), %r26 /* Force CLONE_VM since only init_mm */
742 or %r26, %r24, %r26 /* will have kernel mappings. */
743 ldi 1, %r25 /* stack_start, signals kernel thread */
744 stw %r0, -52(%r30) /* user_tid */
745#ifdef CONFIG_64BIT
746 ldo -16(%r30),%r29 /* Reference param save area */
747#endif
748 BL do_fork, %r2
749 copy %r1, %r24 /* pt_regs */
750
751 /* Parent Returns here */
752
753 LDREG -PT_SZ_ALGN-RP_OFFSET(%r30), %r2
754 ldo -PT_SZ_ALGN(%r30), %r30
755 bv %r0(%r2)
756 nop
757ENDPROC(__kernel_thread)
758
759 /*
760 * Child Returns here 711 * Child Returns here
761 * 712 *
762 * copy_thread moved args from temp save area set up above 713 * copy_thread moved args into task save area.
763 * into task save area.
764 */ 714 */
765 715
766ENTRY(ret_from_kernel_thread) 716ENTRY(ret_from_kernel_thread)
@@ -769,51 +719,17 @@ ENTRY(ret_from_kernel_thread)
769 BL schedule_tail, %r2 719 BL schedule_tail, %r2
770 nop 720 nop
771 721
772 LDREG TI_TASK-THREAD_SZ_ALGN(%r30), %r1 722 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
773 LDREG TASK_PT_GR25(%r1), %r26 723 LDREG TASK_PT_GR25(%r1), %r26
774#ifdef CONFIG_64BIT 724#ifdef CONFIG_64BIT
775 LDREG TASK_PT_GR27(%r1), %r27 725 LDREG TASK_PT_GR27(%r1), %r27
776 LDREG TASK_PT_GR22(%r1), %r22
777#endif 726#endif
778 LDREG TASK_PT_GR26(%r1), %r1 727 LDREG TASK_PT_GR26(%r1), %r1
779 ble 0(%sr7, %r1) 728 ble 0(%sr7, %r1)
780 copy %r31, %r2 729 copy %r31, %r2
781 730 b finish_child_return
782#ifdef CONFIG_64BIT
783 ldo -16(%r30),%r29 /* Reference param save area */
784 loadgp /* Thread could have been in a module */
785#endif
786#ifndef CONFIG_64BIT
787 b sys_exit
788#else
789 load32 sys_exit, %r1
790 bv %r0(%r1)
791#endif
792 ldi 0, %r26
793ENDPROC(ret_from_kernel_thread)
794
795 .import sys_execve, code
796ENTRY(__execve)
797 copy %r2, %r15
798 copy %r30, %r16
799 ldo PT_SZ_ALGN(%r30), %r30
800 STREG %r26, PT_GR26(%r16)
801 STREG %r25, PT_GR25(%r16)
802 STREG %r24, PT_GR24(%r16)
803#ifdef CONFIG_64BIT
804 ldo -16(%r30),%r29 /* Reference param save area */
805#endif
806 BL sys_execve, %r2
807 copy %r16, %r26
808
809 cmpib,=,n 0,%r28,intr_return /* forward */
810
811 /* yes, this will trap and die. */
812 copy %r15, %r2
813 copy %r16, %r30
814 bv %r0(%r2)
815 nop 731 nop
816ENDPROC(__execve) 732ENDPROC(ret_from_kernel_thread)
817 733
818 734
819 /* 735 /*
@@ -1772,151 +1688,36 @@ dtlb_fault:
1772 LDREG PT_GR18(\regs),%r18 1688 LDREG PT_GR18(\regs),%r18
1773 .endm 1689 .endm
1774 1690
1775ENTRY(sys_fork_wrapper) 1691 .macro fork_like name
1692ENTRY(sys_\name\()_wrapper)
1776 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1 1693 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
1777 ldo TASK_REGS(%r1),%r1 1694 ldo TASK_REGS(%r1),%r1
1778 reg_save %r1 1695 reg_save %r1
1779 mfctl %cr27, %r3 1696 mfctl %cr27, %r28
1780 STREG %r3, PT_CR27(%r1) 1697 b sys_\name
1781 1698 STREG %r28, PT_CR27(%r1)
1782 STREG %r2,-RP_OFFSET(%r30) 1699ENDPROC(sys_\name\()_wrapper)
1783 ldo FRAME_SIZE(%r30),%r30 1700 .endm
1784#ifdef CONFIG_64BIT
1785 ldo -16(%r30),%r29 /* Reference param save area */
1786#endif
1787
1788 /* These are call-clobbered registers and therefore
1789 also syscall-clobbered (we hope). */
1790 STREG %r2,PT_GR19(%r1) /* save for child */
1791 STREG %r30,PT_GR21(%r1)
1792
1793 LDREG PT_GR30(%r1),%r25
1794 copy %r1,%r24
1795 BL sys_clone,%r2
1796 ldi SIGCHLD,%r26
1797
1798 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2
1799wrapper_exit:
1800 ldo -FRAME_SIZE(%r30),%r30 /* get the stackframe */
1801 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1802 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1803
1804 LDREG PT_CR27(%r1), %r3
1805 mtctl %r3, %cr27
1806 reg_restore %r1
1807 1701
1808 /* strace expects syscall # to be preserved in r20 */ 1702fork_like clone
1809 ldi __NR_fork,%r20 1703fork_like fork
1810 bv %r0(%r2) 1704fork_like vfork
1811 STREG %r20,PT_GR20(%r1)
1812ENDPROC(sys_fork_wrapper)
1813 1705
1814 /* Set the return value for the child */ 1706 /* Set the return value for the child */
1815ENTRY(child_return) 1707ENTRY(child_return)
1816 BL schedule_tail, %r2 1708 BL schedule_tail, %r2
1817 nop 1709 nop
1710finish_child_return:
1711 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
1712 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1818 1713
1819 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE-FRAME_SIZE(%r30), %r1 1714 LDREG PT_CR27(%r1), %r3
1820 LDREG TASK_PT_GR19(%r1),%r2 1715 mtctl %r3, %cr27
1821 b wrapper_exit 1716 reg_restore %r1
1717 b syscall_exit
1822 copy %r0,%r28 1718 copy %r0,%r28
1823ENDPROC(child_return) 1719ENDPROC(child_return)
1824 1720
1825
1826ENTRY(sys_clone_wrapper)
1827 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1828 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1829 reg_save %r1
1830 mfctl %cr27, %r3
1831 STREG %r3, PT_CR27(%r1)
1832
1833 STREG %r2,-RP_OFFSET(%r30)
1834 ldo FRAME_SIZE(%r30),%r30
1835#ifdef CONFIG_64BIT
1836 ldo -16(%r30),%r29 /* Reference param save area */
1837#endif
1838
1839 /* WARNING - Clobbers r19 and r21, userspace must save these! */
1840 STREG %r2,PT_GR19(%r1) /* save for child */
1841 STREG %r30,PT_GR21(%r1)
1842 BL sys_clone,%r2
1843 copy %r1,%r24
1844
1845 b wrapper_exit
1846 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2
1847ENDPROC(sys_clone_wrapper)
1848
1849
1850ENTRY(sys_vfork_wrapper)
1851 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1852 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1853 reg_save %r1
1854 mfctl %cr27, %r3
1855 STREG %r3, PT_CR27(%r1)
1856
1857 STREG %r2,-RP_OFFSET(%r30)
1858 ldo FRAME_SIZE(%r30),%r30
1859#ifdef CONFIG_64BIT
1860 ldo -16(%r30),%r29 /* Reference param save area */
1861#endif
1862
1863 STREG %r2,PT_GR19(%r1) /* save for child */
1864 STREG %r30,PT_GR21(%r1)
1865
1866 BL sys_vfork,%r2
1867 copy %r1,%r26
1868
1869 b wrapper_exit
1870 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2
1871ENDPROC(sys_vfork_wrapper)
1872
1873
1874 .macro execve_wrapper execve
1875 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1876 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1877
1878 /*
1879 * Do we need to save/restore r3-r18 here?
1880 * I don't think so. why would new thread need old
1881 * threads registers?
1882 */
1883
1884 /* %arg0 - %arg3 are already saved for us. */
1885
1886 STREG %r2,-RP_OFFSET(%r30)
1887 ldo FRAME_SIZE(%r30),%r30
1888#ifdef CONFIG_64BIT
1889 ldo -16(%r30),%r29 /* Reference param save area */
1890#endif
1891 BL \execve,%r2
1892 copy %r1,%arg0
1893
1894 ldo -FRAME_SIZE(%r30),%r30
1895 LDREG -RP_OFFSET(%r30),%r2
1896
1897 /* If exec succeeded we need to load the args */
1898
1899 ldo -1024(%r0),%r1
1900 cmpb,>>= %r28,%r1,error_\execve
1901 copy %r2,%r19
1902
1903error_\execve:
1904 bv %r0(%r19)
1905 nop
1906 .endm
1907
1908 .import sys_execve
1909ENTRY(sys_execve_wrapper)
1910 execve_wrapper sys_execve
1911ENDPROC(sys_execve_wrapper)
1912
1913#ifdef CONFIG_64BIT
1914 .import sys32_execve
1915ENTRY(sys32_execve_wrapper)
1916 execve_wrapper sys32_execve
1917ENDPROC(sys32_execve_wrapper)
1918#endif
1919
1920ENTRY(sys_rt_sigreturn_wrapper) 1721ENTRY(sys_rt_sigreturn_wrapper)
1921 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26 1722 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26
1922 ldo TASK_REGS(%r26),%r26 /* get pt regs */ 1723 ldo TASK_REGS(%r26),%r26 /* get pt regs */
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index 88238638aee..efc5e7d3053 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -186,13 +186,13 @@ static int __init pdc_console_tty_driver_init(void)
186 printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n"); 186 printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n");
187 pdc_cons.flags &= ~CON_BOOT; 187 pdc_cons.flags &= ~CON_BOOT;
188 188
189 tty_port_init(&tty_port);
190
191 pdc_console_tty_driver = alloc_tty_driver(1); 189 pdc_console_tty_driver = alloc_tty_driver(1);
192 190
193 if (!pdc_console_tty_driver) 191 if (!pdc_console_tty_driver)
194 return -ENOMEM; 192 return -ENOMEM;
195 193
194 tty_port_init(&tty_port);
195
196 pdc_console_tty_driver->driver_name = "pdc_cons"; 196 pdc_console_tty_driver->driver_name = "pdc_cons";
197 pdc_console_tty_driver->name = "ttyB"; 197 pdc_console_tty_driver->name = "ttyB";
198 pdc_console_tty_driver->major = MUX_MAJOR; 198 pdc_console_tty_driver->major = MUX_MAJOR;
@@ -207,6 +207,7 @@ static int __init pdc_console_tty_driver_init(void)
207 err = tty_register_driver(pdc_console_tty_driver); 207 err = tty_register_driver(pdc_console_tty_driver);
208 if (err) { 208 if (err) {
209 printk(KERN_ERR "Unable to register the PDC console TTY driver\n"); 209 printk(KERN_ERR "Unable to register the PDC console TTY driver\n");
210 tty_port_destroy(&tty_port);
210 return err; 211 return err;
211 } 212 }
212 213
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index cbc37216bf9..d13507246c5 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -52,6 +52,7 @@
52 52
53#include <asm/io.h> 53#include <asm/io.h>
54#include <asm/asm-offsets.h> 54#include <asm/asm-offsets.h>
55#include <asm/assembly.h>
55#include <asm/pdc.h> 56#include <asm/pdc.h>
56#include <asm/pdc_chassis.h> 57#include <asm/pdc_chassis.h>
57#include <asm/pgalloc.h> 58#include <asm/pgalloc.h>
@@ -165,23 +166,6 @@ void (*pm_power_off)(void) = machine_power_off;
165EXPORT_SYMBOL(pm_power_off); 166EXPORT_SYMBOL(pm_power_off);
166 167
167/* 168/*
168 * Create a kernel thread
169 */
170
171extern pid_t __kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
172pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
173{
174
175 /*
176 * FIXME: Once we are sure we don't need any debug here,
177 * kernel_thread can become a #define.
178 */
179
180 return __kernel_thread(fn, arg, flags);
181}
182EXPORT_SYMBOL(kernel_thread);
183
184/*
185 * Free current thread data structures etc.. 169 * Free current thread data structures etc..
186 */ 170 */
187void exit_thread(void) 171void exit_thread(void)
@@ -218,48 +202,11 @@ int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r)
218 return 1; 202 return 1;
219} 203}
220 204
221/* Note that "fork()" is implemented in terms of clone, with
222 parameters (SIGCHLD, regs->gr[30], regs). */
223int
224sys_clone(unsigned long clone_flags, unsigned long usp,
225 struct pt_regs *regs)
226{
227 /* Arugments from userspace are:
228 r26 = Clone flags.
229 r25 = Child stack.
230 r24 = parent_tidptr.
231 r23 = Is the TLS storage descriptor
232 r22 = child_tidptr
233
234 However, these last 3 args are only examined
235 if the proper flags are set. */
236 int __user *parent_tidptr = (int __user *)regs->gr[24];
237 int __user *child_tidptr = (int __user *)regs->gr[22];
238
239 /* usp must be word aligned. This also prevents users from
240 * passing in the value 1 (which is the signal for a special
241 * return for a kernel thread) */
242 usp = ALIGN(usp, 4);
243
244 /* A zero value for usp means use the current stack */
245 if (usp == 0)
246 usp = regs->gr[30];
247
248 return do_fork(clone_flags, usp, regs, 0, parent_tidptr, child_tidptr);
249}
250
251int
252sys_vfork(struct pt_regs *regs)
253{
254 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gr[30], regs, 0, NULL, NULL);
255}
256
257int 205int
258copy_thread(unsigned long clone_flags, unsigned long usp, 206copy_thread(unsigned long clone_flags, unsigned long usp,
259 unsigned long unused, /* in ia64 this is "user_stack_size" */ 207 unsigned long arg, struct task_struct *p)
260 struct task_struct * p, struct pt_regs * pregs)
261{ 208{
262 struct pt_regs * cregs = &(p->thread.regs); 209 struct pt_regs *cregs = &(p->thread.regs);
263 void *stack = task_stack_page(p); 210 void *stack = task_stack_page(p);
264 211
265 /* We have to use void * instead of a function pointer, because 212 /* We have to use void * instead of a function pointer, because
@@ -270,48 +217,39 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
270#ifdef CONFIG_HPUX 217#ifdef CONFIG_HPUX
271 extern void * const hpux_child_return; 218 extern void * const hpux_child_return;
272#endif 219#endif
220 if (unlikely(p->flags & PF_KTHREAD)) {
221 memset(cregs, 0, sizeof(struct pt_regs));
222 if (!usp) /* idle thread */
223 return 0;
273 224
274 *cregs = *pregs;
275
276 /* Set the return value for the child. Note that this is not
277 actually restored by the syscall exit path, but we put it
278 here for consistency in case of signals. */
279 cregs->gr[28] = 0; /* child */
280
281 /*
282 * We need to differentiate between a user fork and a
283 * kernel fork. We can't use user_mode, because the
284 * the syscall path doesn't save iaoq. Right now
285 * We rely on the fact that kernel_thread passes
286 * in zero for usp.
287 */
288 if (usp == 1) {
289 /* kernel thread */ 225 /* kernel thread */
290 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN;
291 /* Must exit via ret_from_kernel_thread in order 226 /* Must exit via ret_from_kernel_thread in order
292 * to call schedule_tail() 227 * to call schedule_tail()
293 */ 228 */
229 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;
294 cregs->kpc = (unsigned long) &ret_from_kernel_thread; 230 cregs->kpc = (unsigned long) &ret_from_kernel_thread;
295 /* 231 /*
296 * Copy function and argument to be called from 232 * Copy function and argument to be called from
297 * ret_from_kernel_thread. 233 * ret_from_kernel_thread.
298 */ 234 */
299#ifdef CONFIG_64BIT 235#ifdef CONFIG_64BIT
300 cregs->gr[27] = pregs->gr[27]; 236 cregs->gr[27] = ((unsigned long *)usp)[3];
237 cregs->gr[26] = ((unsigned long *)usp)[2];
238#else
239 cregs->gr[26] = usp;
301#endif 240#endif
302 cregs->gr[26] = pregs->gr[26]; 241 cregs->gr[25] = arg;
303 cregs->gr[25] = pregs->gr[25];
304 } else { 242 } else {
305 /* user thread */ 243 /* user thread */
306 /* 244 /* usp must be word aligned. This also prevents users from
307 * Note that the fork wrappers are responsible 245 * passing in the value 1 (which is the signal for a special
308 * for setting gr[21]. 246 * return for a kernel thread) */
309 */ 247 if (usp) {
310 248 usp = ALIGN(usp, 4);
311 /* Use same stack depth as parent */ 249 if (likely(usp))
312 cregs->ksp = (unsigned long)stack 250 cregs->gr[30] = usp;
313 + (pregs->gr[21] & (THREAD_SIZE - 1)); 251 }
314 cregs->gr[30] = usp; 252 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;
315 if (personality(p->personality) == PER_HPUX) { 253 if (personality(p->personality) == PER_HPUX) {
316#ifdef CONFIG_HPUX 254#ifdef CONFIG_HPUX
317 cregs->kpc = (unsigned long) &hpux_child_return; 255 cregs->kpc = (unsigned long) &hpux_child_return;
@@ -323,8 +261,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
323 } 261 }
324 /* Setup thread TLS area from the 4th parameter in clone */ 262 /* Setup thread TLS area from the 4th parameter in clone */
325 if (clone_flags & CLONE_SETTLS) 263 if (clone_flags & CLONE_SETTLS)
326 cregs->cr27 = pregs->gr[23]; 264 cregs->cr27 = cregs->gr[23];
327
328 } 265 }
329 266
330 return 0; 267 return 0;
@@ -335,39 +272,6 @@ unsigned long thread_saved_pc(struct task_struct *t)
335 return t->thread.regs.kpc; 272 return t->thread.regs.kpc;
336} 273}
337 274
338/*
339 * sys_execve() executes a new program.
340 */
341
342asmlinkage int sys_execve(struct pt_regs *regs)
343{
344 int error;
345 struct filename *filename;
346
347 filename = getname((const char __user *) regs->gr[26]);
348 error = PTR_ERR(filename);
349 if (IS_ERR(filename))
350 goto out;
351 error = do_execve(filename->name,
352 (const char __user *const __user *) regs->gr[25],
353 (const char __user *const __user *) regs->gr[24],
354 regs);
355 putname(filename);
356out:
357
358 return error;
359}
360
361extern int __execve(const char *filename,
362 const char *const argv[],
363 const char *const envp[], struct task_struct *task);
364int kernel_execve(const char *filename,
365 const char *const argv[],
366 const char *const envp[])
367{
368 return __execve(filename, argv, envp, current);
369}
370
371unsigned long 275unsigned long
372get_wchan(struct task_struct *p) 276get_wchan(struct task_struct *p)
373{ 277{
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index bf5b93a885d..9cfdaa19ab6 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -53,28 +53,6 @@
53#define DBG(x) 53#define DBG(x)
54#endif 54#endif
55 55
56/*
57 * sys32_execve() executes a new program.
58 */
59
60asmlinkage int sys32_execve(struct pt_regs *regs)
61{
62 int error;
63 struct filename *filename;
64
65 DBG(("sys32_execve(%p) r26 = 0x%lx\n", regs, regs->gr[26]));
66 filename = getname((const char __user *) regs->gr[26]);
67 error = PTR_ERR(filename);
68 if (IS_ERR(filename))
69 goto out;
70 error = compat_do_execve(filename->name, compat_ptr(regs->gr[25]),
71 compat_ptr(regs->gr[24]), regs);
72 putname(filename);
73out:
74
75 return error;
76}
77
78asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23, 56asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
79 int r22, int r21, int r20) 57 int r22, int r21, int r20)
80{ 58{
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 3735abd7f8f..54d950b067b 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -60,13 +60,13 @@
60 ENTRY_SAME(fork_wrapper) 60 ENTRY_SAME(fork_wrapper)
61 ENTRY_SAME(read) 61 ENTRY_SAME(read)
62 ENTRY_SAME(write) 62 ENTRY_SAME(write)
63 ENTRY_SAME(open) /* 5 */ 63 ENTRY_COMP(open) /* 5 */
64 ENTRY_SAME(close) 64 ENTRY_SAME(close)
65 ENTRY_SAME(waitpid) 65 ENTRY_SAME(waitpid)
66 ENTRY_SAME(creat) 66 ENTRY_SAME(creat)
67 ENTRY_SAME(link) 67 ENTRY_SAME(link)
68 ENTRY_SAME(unlink) /* 10 */ 68 ENTRY_SAME(unlink) /* 10 */
69 ENTRY_DIFF(execve_wrapper) 69 ENTRY_COMP(execve)
70 ENTRY_SAME(chdir) 70 ENTRY_SAME(chdir)
71 /* See comments in kernel/time.c!!! Maybe we don't need this? */ 71 /* See comments in kernel/time.c!!! Maybe we don't need this? */
72 ENTRY_COMP(time) 72 ENTRY_COMP(time)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a902a5c1c76..951a517a1a0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -144,6 +144,8 @@ config PPC
144 select GENERIC_KERNEL_THREAD 144 select GENERIC_KERNEL_THREAD
145 select HAVE_MOD_ARCH_SPECIFIC 145 select HAVE_MOD_ARCH_SPECIFIC
146 select MODULES_USE_ELF_RELA 146 select MODULES_USE_ELF_RELA
147 select GENERIC_KERNEL_EXECVE
148 select CLONE_BACKWARDS
147 149
148config EARLY_PRINTK 150config EARLY_PRINTK
149 bool 151 bool
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index a4fe15e33c6..650757c300d 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -1,4 +1,4 @@
1 1
2
3generic-y += clkdev.h 2generic-y += clkdev.h
4generic-y += rwsem.h 3generic-y += rwsem.h
4generic-y += trace_clock.h
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
index 487d46ff68a..483733bd06d 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -228,6 +228,8 @@ static inline cputime_t clock_t_to_cputime(const unsigned long clk)
228 228
229#define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct)) 229#define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct))
230 230
231static inline void arch_vtime_task_switch(struct task_struct *tsk) { }
232
231#endif /* __KERNEL__ */ 233#endif /* __KERNEL__ */
232#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 234#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
233#endif /* __POWERPC_CPUTIME_H */ 235#endif /* __POWERPC_CPUTIME_H */
diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index bf2c06c3387..d3d634274d2 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -50,64 +50,13 @@
50#ifndef _EPAPR_HCALLS_H 50#ifndef _EPAPR_HCALLS_H
51#define _EPAPR_HCALLS_H 51#define _EPAPR_HCALLS_H
52 52
53#include <uapi/asm/epapr_hcalls.h>
54
55#ifndef __ASSEMBLY__
53#include <linux/types.h> 56#include <linux/types.h>
54#include <linux/errno.h> 57#include <linux/errno.h>
55#include <asm/byteorder.h> 58#include <asm/byteorder.h>
56 59
57#define EV_BYTE_CHANNEL_SEND 1
58#define EV_BYTE_CHANNEL_RECEIVE 2
59#define EV_BYTE_CHANNEL_POLL 3
60#define EV_INT_SET_CONFIG 4
61#define EV_INT_GET_CONFIG 5
62#define EV_INT_SET_MASK 6
63#define EV_INT_GET_MASK 7
64#define EV_INT_IACK 9
65#define EV_INT_EOI 10
66#define EV_INT_SEND_IPI 11
67#define EV_INT_SET_TASK_PRIORITY 12
68#define EV_INT_GET_TASK_PRIORITY 13
69#define EV_DOORBELL_SEND 14
70#define EV_MSGSND 15
71#define EV_IDLE 16
72
73/* vendor ID: epapr */
74#define EV_LOCAL_VENDOR_ID 0 /* for private use */
75#define EV_EPAPR_VENDOR_ID 1
76#define EV_FSL_VENDOR_ID 2 /* Freescale Semiconductor */
77#define EV_IBM_VENDOR_ID 3 /* IBM */
78#define EV_GHS_VENDOR_ID 4 /* Green Hills Software */
79#define EV_ENEA_VENDOR_ID 5 /* Enea */
80#define EV_WR_VENDOR_ID 6 /* Wind River Systems */
81#define EV_AMCC_VENDOR_ID 7 /* Applied Micro Circuits */
82#define EV_KVM_VENDOR_ID 42 /* KVM */
83
84/* The max number of bytes that a byte channel can send or receive per call */
85#define EV_BYTE_CHANNEL_MAX_BYTES 16
86
87
88#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
89#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
90
91/* epapr error codes */
92#define EV_EPERM 1 /* Operation not permitted */
93#define EV_ENOENT 2 /* Entry Not Found */
94#define EV_EIO 3 /* I/O error occured */
95#define EV_EAGAIN 4 /* The operation had insufficient
96 * resources to complete and should be
97 * retried
98 */
99#define EV_ENOMEM 5 /* There was insufficient memory to
100 * complete the operation */
101#define EV_EFAULT 6 /* Bad guest address */
102#define EV_ENODEV 7 /* No such device */
103#define EV_EINVAL 8 /* An argument supplied to the hcall
104 was out of range or invalid */
105#define EV_INTERNAL 9 /* An internal error occured */
106#define EV_CONFIG 10 /* A configuration error was detected */
107#define EV_INVALID_STATE 11 /* The object is in an invalid state */
108#define EV_UNIMPLEMENTED 12 /* Unimplemented hypercall */
109#define EV_BUFFER_OVERFLOW 13 /* Caller-supplied buffer too small */
110
111/* 60/*
112 * Hypercall register clobber list 61 * Hypercall register clobber list
113 * 62 *
@@ -193,7 +142,7 @@ static inline unsigned int ev_int_set_config(unsigned int interrupt,
193 r5 = priority; 142 r5 = priority;
194 r6 = destination; 143 r6 = destination;
195 144
196 __asm__ __volatile__ ("sc 1" 145 asm volatile("bl epapr_hypercall_start"
197 : "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6) 146 : "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6)
198 : : EV_HCALL_CLOBBERS4 147 : : EV_HCALL_CLOBBERS4
199 ); 148 );
@@ -222,7 +171,7 @@ static inline unsigned int ev_int_get_config(unsigned int interrupt,
222 r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG); 171 r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
223 r3 = interrupt; 172 r3 = interrupt;
224 173
225 __asm__ __volatile__ ("sc 1" 174 asm volatile("bl epapr_hypercall_start"
226 : "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6) 175 : "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6)
227 : : EV_HCALL_CLOBBERS4 176 : : EV_HCALL_CLOBBERS4
228 ); 177 );
@@ -252,7 +201,7 @@ static inline unsigned int ev_int_set_mask(unsigned int interrupt,
252 r3 = interrupt; 201 r3 = interrupt;
253 r4 = mask; 202 r4 = mask;
254 203
255 __asm__ __volatile__ ("sc 1" 204 asm volatile("bl epapr_hypercall_start"
256 : "+r" (r11), "+r" (r3), "+r" (r4) 205 : "+r" (r11), "+r" (r3), "+r" (r4)
257 : : EV_HCALL_CLOBBERS2 206 : : EV_HCALL_CLOBBERS2
258 ); 207 );
@@ -277,7 +226,7 @@ static inline unsigned int ev_int_get_mask(unsigned int interrupt,
277 r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK); 226 r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
278 r3 = interrupt; 227 r3 = interrupt;
279 228
280 __asm__ __volatile__ ("sc 1" 229 asm volatile("bl epapr_hypercall_start"
281 : "+r" (r11), "+r" (r3), "=r" (r4) 230 : "+r" (r11), "+r" (r3), "=r" (r4)
282 : : EV_HCALL_CLOBBERS2 231 : : EV_HCALL_CLOBBERS2
283 ); 232 );
@@ -305,7 +254,7 @@ static inline unsigned int ev_int_eoi(unsigned int interrupt)
305 r11 = EV_HCALL_TOKEN(EV_INT_EOI); 254 r11 = EV_HCALL_TOKEN(EV_INT_EOI);
306 r3 = interrupt; 255 r3 = interrupt;
307 256
308 __asm__ __volatile__ ("sc 1" 257 asm volatile("bl epapr_hypercall_start"
309 : "+r" (r11), "+r" (r3) 258 : "+r" (r11), "+r" (r3)
310 : : EV_HCALL_CLOBBERS1 259 : : EV_HCALL_CLOBBERS1
311 ); 260 );
@@ -344,7 +293,7 @@ static inline unsigned int ev_byte_channel_send(unsigned int handle,
344 r7 = be32_to_cpu(p[2]); 293 r7 = be32_to_cpu(p[2]);
345 r8 = be32_to_cpu(p[3]); 294 r8 = be32_to_cpu(p[3]);
346 295
347 __asm__ __volatile__ ("sc 1" 296 asm volatile("bl epapr_hypercall_start"
348 : "+r" (r11), "+r" (r3), 297 : "+r" (r11), "+r" (r3),
349 "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8) 298 "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8)
350 : : EV_HCALL_CLOBBERS6 299 : : EV_HCALL_CLOBBERS6
@@ -383,7 +332,7 @@ static inline unsigned int ev_byte_channel_receive(unsigned int handle,
383 r3 = handle; 332 r3 = handle;
384 r4 = *count; 333 r4 = *count;
385 334
386 __asm__ __volatile__ ("sc 1" 335 asm volatile("bl epapr_hypercall_start"
387 : "+r" (r11), "+r" (r3), "+r" (r4), 336 : "+r" (r11), "+r" (r3), "+r" (r4),
388 "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8) 337 "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8)
389 : : EV_HCALL_CLOBBERS6 338 : : EV_HCALL_CLOBBERS6
@@ -421,7 +370,7 @@ static inline unsigned int ev_byte_channel_poll(unsigned int handle,
421 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL); 370 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
422 r3 = handle; 371 r3 = handle;
423 372
424 __asm__ __volatile__ ("sc 1" 373 asm volatile("bl epapr_hypercall_start"
425 : "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5) 374 : "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5)
426 : : EV_HCALL_CLOBBERS3 375 : : EV_HCALL_CLOBBERS3
427 ); 376 );
@@ -454,7 +403,7 @@ static inline unsigned int ev_int_iack(unsigned int handle,
454 r11 = EV_HCALL_TOKEN(EV_INT_IACK); 403 r11 = EV_HCALL_TOKEN(EV_INT_IACK);
455 r3 = handle; 404 r3 = handle;
456 405
457 __asm__ __volatile__ ("sc 1" 406 asm volatile("bl epapr_hypercall_start"
458 : "+r" (r11), "+r" (r3), "=r" (r4) 407 : "+r" (r11), "+r" (r3), "=r" (r4)
459 : : EV_HCALL_CLOBBERS2 408 : : EV_HCALL_CLOBBERS2
460 ); 409 );
@@ -478,7 +427,7 @@ static inline unsigned int ev_doorbell_send(unsigned int handle)
478 r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND); 427 r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
479 r3 = handle; 428 r3 = handle;
480 429
481 __asm__ __volatile__ ("sc 1" 430 asm volatile("bl epapr_hypercall_start"
482 : "+r" (r11), "+r" (r3) 431 : "+r" (r11), "+r" (r3)
483 : : EV_HCALL_CLOBBERS1 432 : : EV_HCALL_CLOBBERS1
484 ); 433 );
@@ -498,12 +447,12 @@ static inline unsigned int ev_idle(void)
498 447
499 r11 = EV_HCALL_TOKEN(EV_IDLE); 448 r11 = EV_HCALL_TOKEN(EV_IDLE);
500 449
501 __asm__ __volatile__ ("sc 1" 450 asm volatile("bl epapr_hypercall_start"
502 : "+r" (r11), "=r" (r3) 451 : "+r" (r11), "=r" (r3)
503 : : EV_HCALL_CLOBBERS1 452 : : EV_HCALL_CLOBBERS1
504 ); 453 );
505 454
506 return r3; 455 return r3;
507} 456}
508 457#endif /* !__ASSEMBLY__ */
509#endif 458#endif /* _EPAPR_HCALLS_H */
diff --git a/arch/powerpc/include/asm/fsl_hcalls.h b/arch/powerpc/include/asm/fsl_hcalls.h
index 922d9b5fe3d..3abb58394da 100644
--- a/arch/powerpc/include/asm/fsl_hcalls.h
+++ b/arch/powerpc/include/asm/fsl_hcalls.h
@@ -96,7 +96,7 @@ static inline unsigned int fh_send_nmi(unsigned int vcpu_mask)
96 r11 = FH_HCALL_TOKEN(FH_SEND_NMI); 96 r11 = FH_HCALL_TOKEN(FH_SEND_NMI);
97 r3 = vcpu_mask; 97 r3 = vcpu_mask;
98 98
99 __asm__ __volatile__ ("sc 1" 99 asm volatile("bl epapr_hypercall_start"
100 : "+r" (r11), "+r" (r3) 100 : "+r" (r11), "+r" (r3)
101 : : EV_HCALL_CLOBBERS1 101 : : EV_HCALL_CLOBBERS1
102 ); 102 );
@@ -151,7 +151,7 @@ static inline unsigned int fh_partition_get_dtprop(int handle,
151 r9 = (uint32_t)propvalue_addr; 151 r9 = (uint32_t)propvalue_addr;
152 r10 = *propvalue_len; 152 r10 = *propvalue_len;
153 153
154 __asm__ __volatile__ ("sc 1" 154 asm volatile("bl epapr_hypercall_start"
155 : "+r" (r11), 155 : "+r" (r11),
156 "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), 156 "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
157 "+r" (r8), "+r" (r9), "+r" (r10) 157 "+r" (r8), "+r" (r9), "+r" (r10)
@@ -205,7 +205,7 @@ static inline unsigned int fh_partition_set_dtprop(int handle,
205 r9 = (uint32_t)propvalue_addr; 205 r9 = (uint32_t)propvalue_addr;
206 r10 = propvalue_len; 206 r10 = propvalue_len;
207 207
208 __asm__ __volatile__ ("sc 1" 208 asm volatile("bl epapr_hypercall_start"
209 : "+r" (r11), 209 : "+r" (r11),
210 "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), 210 "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
211 "+r" (r8), "+r" (r9), "+r" (r10) 211 "+r" (r8), "+r" (r9), "+r" (r10)
@@ -229,7 +229,7 @@ static inline unsigned int fh_partition_restart(unsigned int partition)
229 r11 = FH_HCALL_TOKEN(FH_PARTITION_RESTART); 229 r11 = FH_HCALL_TOKEN(FH_PARTITION_RESTART);
230 r3 = partition; 230 r3 = partition;
231 231
232 __asm__ __volatile__ ("sc 1" 232 asm volatile("bl epapr_hypercall_start"
233 : "+r" (r11), "+r" (r3) 233 : "+r" (r11), "+r" (r3)
234 : : EV_HCALL_CLOBBERS1 234 : : EV_HCALL_CLOBBERS1
235 ); 235 );
@@ -262,7 +262,7 @@ static inline unsigned int fh_partition_get_status(unsigned int partition,
262 r11 = FH_HCALL_TOKEN(FH_PARTITION_GET_STATUS); 262 r11 = FH_HCALL_TOKEN(FH_PARTITION_GET_STATUS);
263 r3 = partition; 263 r3 = partition;
264 264
265 __asm__ __volatile__ ("sc 1" 265 asm volatile("bl epapr_hypercall_start"
266 : "+r" (r11), "+r" (r3), "=r" (r4) 266 : "+r" (r11), "+r" (r3), "=r" (r4)
267 : : EV_HCALL_CLOBBERS2 267 : : EV_HCALL_CLOBBERS2
268 ); 268 );
@@ -295,7 +295,7 @@ static inline unsigned int fh_partition_start(unsigned int partition,
295 r4 = entry_point; 295 r4 = entry_point;
296 r5 = load; 296 r5 = load;
297 297
298 __asm__ __volatile__ ("sc 1" 298 asm volatile("bl epapr_hypercall_start"
299 : "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5) 299 : "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5)
300 : : EV_HCALL_CLOBBERS3 300 : : EV_HCALL_CLOBBERS3
301 ); 301 );
@@ -317,7 +317,7 @@ static inline unsigned int fh_partition_stop(unsigned int partition)
317 r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP); 317 r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP);
318 r3 = partition; 318 r3 = partition;
319 319
320 __asm__ __volatile__ ("sc 1" 320 asm volatile("bl epapr_hypercall_start"
321 : "+r" (r11), "+r" (r3) 321 : "+r" (r11), "+r" (r3)
322 : : EV_HCALL_CLOBBERS1 322 : : EV_HCALL_CLOBBERS1
323 ); 323 );
@@ -376,7 +376,7 @@ static inline unsigned int fh_partition_memcpy(unsigned int source,
376#endif 376#endif
377 r7 = count; 377 r7 = count;
378 378
379 __asm__ __volatile__ ("sc 1" 379 asm volatile("bl epapr_hypercall_start"
380 : "+r" (r11), 380 : "+r" (r11),
381 "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7) 381 "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7)
382 : : EV_HCALL_CLOBBERS5 382 : : EV_HCALL_CLOBBERS5
@@ -399,7 +399,7 @@ static inline unsigned int fh_dma_enable(unsigned int liodn)
399 r11 = FH_HCALL_TOKEN(FH_DMA_ENABLE); 399 r11 = FH_HCALL_TOKEN(FH_DMA_ENABLE);
400 r3 = liodn; 400 r3 = liodn;
401 401
402 __asm__ __volatile__ ("sc 1" 402 asm volatile("bl epapr_hypercall_start"
403 : "+r" (r11), "+r" (r3) 403 : "+r" (r11), "+r" (r3)
404 : : EV_HCALL_CLOBBERS1 404 : : EV_HCALL_CLOBBERS1
405 ); 405 );
@@ -421,7 +421,7 @@ static inline unsigned int fh_dma_disable(unsigned int liodn)
421 r11 = FH_HCALL_TOKEN(FH_DMA_DISABLE); 421 r11 = FH_HCALL_TOKEN(FH_DMA_DISABLE);
422 r3 = liodn; 422 r3 = liodn;
423 423
424 __asm__ __volatile__ ("sc 1" 424 asm volatile("bl epapr_hypercall_start"
425 : "+r" (r11), "+r" (r3) 425 : "+r" (r11), "+r" (r3)
426 : : EV_HCALL_CLOBBERS1 426 : : EV_HCALL_CLOBBERS1
427 ); 427 );
@@ -447,7 +447,7 @@ static inline unsigned int fh_vmpic_get_msir(unsigned int interrupt,
447 r11 = FH_HCALL_TOKEN(FH_VMPIC_GET_MSIR); 447 r11 = FH_HCALL_TOKEN(FH_VMPIC_GET_MSIR);
448 r3 = interrupt; 448 r3 = interrupt;
449 449
450 __asm__ __volatile__ ("sc 1" 450 asm volatile("bl epapr_hypercall_start"
451 : "+r" (r11), "+r" (r3), "=r" (r4) 451 : "+r" (r11), "+r" (r3), "=r" (r4)
452 : : EV_HCALL_CLOBBERS2 452 : : EV_HCALL_CLOBBERS2
453 ); 453 );
@@ -469,7 +469,7 @@ static inline unsigned int fh_system_reset(void)
469 469
470 r11 = FH_HCALL_TOKEN(FH_SYSTEM_RESET); 470 r11 = FH_HCALL_TOKEN(FH_SYSTEM_RESET);
471 471
472 __asm__ __volatile__ ("sc 1" 472 asm volatile("bl epapr_hypercall_start"
473 : "+r" (r11), "=r" (r3) 473 : "+r" (r11), "=r" (r3)
474 : : EV_HCALL_CLOBBERS1 474 : : EV_HCALL_CLOBBERS1
475 ); 475 );
@@ -506,7 +506,7 @@ static inline unsigned int fh_err_get_info(int queue, uint32_t *bufsize,
506 r6 = addr_lo; 506 r6 = addr_lo;
507 r7 = peek; 507 r7 = peek;
508 508
509 __asm__ __volatile__ ("sc 1" 509 asm volatile("bl epapr_hypercall_start"
510 : "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), 510 : "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6),
511 "+r" (r7) 511 "+r" (r7)
512 : : EV_HCALL_CLOBBERS5 512 : : EV_HCALL_CLOBBERS5
@@ -542,7 +542,7 @@ static inline unsigned int fh_get_core_state(unsigned int handle,
542 r3 = handle; 542 r3 = handle;
543 r4 = vcpu; 543 r4 = vcpu;
544 544
545 __asm__ __volatile__ ("sc 1" 545 asm volatile("bl epapr_hypercall_start"
546 : "+r" (r11), "+r" (r3), "+r" (r4) 546 : "+r" (r11), "+r" (r3), "+r" (r4)
547 : : EV_HCALL_CLOBBERS2 547 : : EV_HCALL_CLOBBERS2
548 ); 548 );
@@ -572,7 +572,7 @@ static inline unsigned int fh_enter_nap(unsigned int handle, unsigned int vcpu)
572 r3 = handle; 572 r3 = handle;
573 r4 = vcpu; 573 r4 = vcpu;
574 574
575 __asm__ __volatile__ ("sc 1" 575 asm volatile("bl epapr_hypercall_start"
576 : "+r" (r11), "+r" (r3), "+r" (r4) 576 : "+r" (r11), "+r" (r3), "+r" (r4)
577 : : EV_HCALL_CLOBBERS2 577 : : EV_HCALL_CLOBBERS2
578 ); 578 );
@@ -597,7 +597,7 @@ static inline unsigned int fh_exit_nap(unsigned int handle, unsigned int vcpu)
597 r3 = handle; 597 r3 = handle;
598 r4 = vcpu; 598 r4 = vcpu;
599 599
600 __asm__ __volatile__ ("sc 1" 600 asm volatile("bl epapr_hypercall_start"
601 : "+r" (r11), "+r" (r3), "+r" (r4) 601 : "+r" (r11), "+r" (r3), "+r" (r4)
602 : : EV_HCALL_CLOBBERS2 602 : : EV_HCALL_CLOBBERS2
603 ); 603 );
@@ -618,7 +618,7 @@ static inline unsigned int fh_claim_device(unsigned int handle)
618 r11 = FH_HCALL_TOKEN(FH_CLAIM_DEVICE); 618 r11 = FH_HCALL_TOKEN(FH_CLAIM_DEVICE);
619 r3 = handle; 619 r3 = handle;
620 620
621 __asm__ __volatile__ ("sc 1" 621 asm volatile("bl epapr_hypercall_start"
622 : "+r" (r11), "+r" (r3) 622 : "+r" (r11), "+r" (r3)
623 : : EV_HCALL_CLOBBERS1 623 : : EV_HCALL_CLOBBERS1
624 ); 624 );
@@ -645,7 +645,7 @@ static inline unsigned int fh_partition_stop_dma(unsigned int handle)
645 r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP_DMA); 645 r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP_DMA);
646 r3 = handle; 646 r3 = handle;
647 647
648 __asm__ __volatile__ ("sc 1" 648 asm volatile("bl epapr_hypercall_start"
649 : "+r" (r11), "+r" (r3) 649 : "+r" (r11), "+r" (r3)
650 : : EV_HCALL_CLOBBERS1 650 : : EV_HCALL_CLOBBERS1
651 ); 651 );
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index 76fdcfef088..aabcdba8f6b 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -118,6 +118,7 @@
118 118
119#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ 119#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */
120#define RESUME_FLAG_HOST (1<<1) /* Resume host? */ 120#define RESUME_FLAG_HOST (1<<1) /* Resume host? */
121#define RESUME_FLAG_ARCH1 (1<<2)
121 122
122#define RESUME_GUEST 0 123#define RESUME_GUEST 0
123#define RESUME_GUEST_NV RESUME_FLAG_NV 124#define RESUME_GUEST_NV RESUME_FLAG_NV
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index 7aefdb3e1ce..5a56e1c5f85 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -81,6 +81,8 @@ struct kvmppc_vcpu_book3s {
81 u64 sdr1; 81 u64 sdr1;
82 u64 hior; 82 u64 hior;
83 u64 msr_mask; 83 u64 msr_mask;
84 u64 purr_offset;
85 u64 spurr_offset;
84#ifdef CONFIG_PPC_BOOK3S_32 86#ifdef CONFIG_PPC_BOOK3S_32
85 u32 vsid_pool[VSID_POOL_SIZE]; 87 u32 vsid_pool[VSID_POOL_SIZE];
86 u32 vsid_next; 88 u32 vsid_next;
@@ -157,10 +159,14 @@ extern void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long addr,
157extern void kvmppc_unpin_guest_page(struct kvm *kvm, void *addr); 159extern void kvmppc_unpin_guest_page(struct kvm *kvm, void *addr);
158extern long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags, 160extern long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
159 long pte_index, unsigned long pteh, unsigned long ptel); 161 long pte_index, unsigned long pteh, unsigned long ptel);
160extern long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags, 162extern long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
161 long pte_index, unsigned long pteh, unsigned long ptel); 163 long pte_index, unsigned long pteh, unsigned long ptel,
164 pgd_t *pgdir, bool realmode, unsigned long *idx_ret);
165extern long kvmppc_do_h_remove(struct kvm *kvm, unsigned long flags,
166 unsigned long pte_index, unsigned long avpn,
167 unsigned long *hpret);
162extern long kvmppc_hv_get_dirty_log(struct kvm *kvm, 168extern long kvmppc_hv_get_dirty_log(struct kvm *kvm,
163 struct kvm_memory_slot *memslot); 169 struct kvm_memory_slot *memslot, unsigned long *map);
164 170
165extern void kvmppc_entry_trampoline(void); 171extern void kvmppc_entry_trampoline(void);
166extern void kvmppc_hv_entry_trampoline(void); 172extern void kvmppc_hv_entry_trampoline(void);
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index 0dd1d86d3e3..38bec1dc992 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -50,6 +50,15 @@ extern int kvm_hpt_order; /* order of preallocated HPTs */
50#define HPTE_V_HVLOCK 0x40UL 50#define HPTE_V_HVLOCK 0x40UL
51#define HPTE_V_ABSENT 0x20UL 51#define HPTE_V_ABSENT 0x20UL
52 52
53/*
54 * We use this bit in the guest_rpte field of the revmap entry
55 * to indicate a modified HPTE.
56 */
57#define HPTE_GR_MODIFIED (1ul << 62)
58
59/* These bits are reserved in the guest view of the HPTE */
60#define HPTE_GR_RESERVED HPTE_GR_MODIFIED
61
53static inline long try_lock_hpte(unsigned long *hpte, unsigned long bits) 62static inline long try_lock_hpte(unsigned long *hpte, unsigned long bits)
54{ 63{
55 unsigned long tmp, old; 64 unsigned long tmp, old;
@@ -60,7 +69,7 @@ static inline long try_lock_hpte(unsigned long *hpte, unsigned long bits)
60 " ori %0,%0,%4\n" 69 " ori %0,%0,%4\n"
61 " stdcx. %0,0,%2\n" 70 " stdcx. %0,0,%2\n"
62 " beq+ 2f\n" 71 " beq+ 2f\n"
63 " li %1,%3\n" 72 " mr %1,%3\n"
64 "2: isync" 73 "2: isync"
65 : "=&r" (tmp), "=&r" (old) 74 : "=&r" (tmp), "=&r" (old)
66 : "r" (hpte), "r" (bits), "i" (HPTE_V_HVLOCK) 75 : "r" (hpte), "r" (bits), "i" (HPTE_V_HVLOCK)
@@ -237,4 +246,26 @@ static inline bool slot_is_aligned(struct kvm_memory_slot *memslot,
237 return !(memslot->base_gfn & mask) && !(memslot->npages & mask); 246 return !(memslot->base_gfn & mask) && !(memslot->npages & mask);
238} 247}
239 248
249/*
250 * This works for 4k, 64k and 16M pages on POWER7,
251 * and 4k and 16M pages on PPC970.
252 */
253static inline unsigned long slb_pgsize_encoding(unsigned long psize)
254{
255 unsigned long senc = 0;
256
257 if (psize > 0x1000) {
258 senc = SLB_VSID_L;
259 if (psize == 0x10000)
260 senc |= SLB_VSID_LP_01;
261 }
262 return senc;
263}
264
265static inline int is_vrma_hpte(unsigned long hpte_v)
266{
267 return (hpte_v & ~0xffffffUL) ==
268 (HPTE_V_1TB_SEG | (VRMA_VSID << (40 - 16)));
269}
270
240#endif /* __ASM_KVM_BOOK3S_64_H__ */ 271#endif /* __ASM_KVM_BOOK3S_64_H__ */
diff --git a/arch/powerpc/include/asm/kvm_booke_hv_asm.h b/arch/powerpc/include/asm/kvm_booke_hv_asm.h
index 30a600fa1b6..3a79f532571 100644
--- a/arch/powerpc/include/asm/kvm_booke_hv_asm.h
+++ b/arch/powerpc/include/asm/kvm_booke_hv_asm.h
@@ -17,6 +17,7 @@
17 * there are no exceptions for which we fall through directly to 17 * there are no exceptions for which we fall through directly to
18 * the normal host handler. 18 * the normal host handler.
19 * 19 *
20 * 32-bit host
20 * Expected inputs (normal exceptions): 21 * Expected inputs (normal exceptions):
21 * SCRATCH0 = saved r10 22 * SCRATCH0 = saved r10
22 * r10 = thread struct 23 * r10 = thread struct
@@ -33,14 +34,38 @@
33 * *(r8 + GPR9) = saved r9 34 * *(r8 + GPR9) = saved r9
34 * *(r8 + GPR10) = saved r10 (r10 not yet clobbered) 35 * *(r8 + GPR10) = saved r10 (r10 not yet clobbered)
35 * *(r8 + GPR11) = saved r11 36 * *(r8 + GPR11) = saved r11
37 *
38 * 64-bit host
39 * Expected inputs (GEN/GDBELL/DBG/MC exception types):
40 * r10 = saved CR
41 * r13 = PACA_POINTER
42 * *(r13 + PACA_EX##type + EX_R10) = saved r10
43 * *(r13 + PACA_EX##type + EX_R11) = saved r11
44 * SPRN_SPRG_##type##_SCRATCH = saved r13
45 *
46 * Expected inputs (CRIT exception type):
47 * r10 = saved CR
48 * r13 = PACA_POINTER
49 * *(r13 + PACA_EX##type + EX_R10) = saved r10
50 * *(r13 + PACA_EX##type + EX_R11) = saved r11
51 * *(r13 + PACA_EX##type + EX_R13) = saved r13
52 *
53 * Expected inputs (TLB exception type):
54 * r10 = saved CR
55 * r13 = PACA_POINTER
56 * *(r13 + PACA_EX##type + EX_TLB_R10) = saved r10
57 * *(r13 + PACA_EX##type + EX_TLB_R11) = saved r11
58 * SPRN_SPRG_GEN_SCRATCH = saved r13
59 *
60 * Only the bolted version of TLB miss exception handlers is supported now.
36 */ 61 */
37.macro DO_KVM intno srr1 62.macro DO_KVM intno srr1
38#ifdef CONFIG_KVM_BOOKE_HV 63#ifdef CONFIG_KVM_BOOKE_HV
39BEGIN_FTR_SECTION 64BEGIN_FTR_SECTION
40 mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */ 65 mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */
41 bf 3, kvmppc_resume_\intno\()_\srr1 66 bf 3, 1975f
42 b kvmppc_handler_\intno\()_\srr1 67 b kvmppc_handler_\intno\()_\srr1
43kvmppc_resume_\intno\()_\srr1: 681975:
44END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) 69END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
45#endif 70#endif
46.endm 71.endm
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 28e8f5e5c63..ca9bf459db6 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -46,7 +46,7 @@
46#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 46#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
47#endif 47#endif
48 48
49#ifdef CONFIG_KVM_BOOK3S_64_HV 49#if !defined(CONFIG_KVM_440)
50#include <linux/mmu_notifier.h> 50#include <linux/mmu_notifier.h>
51 51
52#define KVM_ARCH_WANT_MMU_NOTIFIER 52#define KVM_ARCH_WANT_MMU_NOTIFIER
@@ -204,7 +204,7 @@ struct revmap_entry {
204}; 204};
205 205
206/* 206/*
207 * We use the top bit of each memslot->rmap entry as a lock bit, 207 * We use the top bit of each memslot->arch.rmap entry as a lock bit,
208 * and bit 32 as a present flag. The bottom 32 bits are the 208 * and bit 32 as a present flag. The bottom 32 bits are the
209 * index in the guest HPT of a HPTE that points to the page. 209 * index in the guest HPT of a HPTE that points to the page.
210 */ 210 */
@@ -215,14 +215,17 @@ struct revmap_entry {
215#define KVMPPC_RMAP_PRESENT 0x100000000ul 215#define KVMPPC_RMAP_PRESENT 0x100000000ul
216#define KVMPPC_RMAP_INDEX 0xfffffffful 216#define KVMPPC_RMAP_INDEX 0xfffffffful
217 217
218/* Low-order bits in kvm->arch.slot_phys[][] */ 218/* Low-order bits in memslot->arch.slot_phys[] */
219#define KVMPPC_PAGE_ORDER_MASK 0x1f 219#define KVMPPC_PAGE_ORDER_MASK 0x1f
220#define KVMPPC_PAGE_NO_CACHE HPTE_R_I /* 0x20 */ 220#define KVMPPC_PAGE_NO_CACHE HPTE_R_I /* 0x20 */
221#define KVMPPC_PAGE_WRITETHRU HPTE_R_W /* 0x40 */ 221#define KVMPPC_PAGE_WRITETHRU HPTE_R_W /* 0x40 */
222#define KVMPPC_GOT_PAGE 0x80 222#define KVMPPC_GOT_PAGE 0x80
223 223
224struct kvm_arch_memory_slot { 224struct kvm_arch_memory_slot {
225#ifdef CONFIG_KVM_BOOK3S_64_HV
225 unsigned long *rmap; 226 unsigned long *rmap;
227 unsigned long *slot_phys;
228#endif /* CONFIG_KVM_BOOK3S_64_HV */
226}; 229};
227 230
228struct kvm_arch { 231struct kvm_arch {
@@ -243,12 +246,12 @@ struct kvm_arch {
243 int using_mmu_notifiers; 246 int using_mmu_notifiers;
244 u32 hpt_order; 247 u32 hpt_order;
245 atomic_t vcpus_running; 248 atomic_t vcpus_running;
249 u32 online_vcores;
246 unsigned long hpt_npte; 250 unsigned long hpt_npte;
247 unsigned long hpt_mask; 251 unsigned long hpt_mask;
252 atomic_t hpte_mod_interest;
248 spinlock_t slot_phys_lock; 253 spinlock_t slot_phys_lock;
249 unsigned long *slot_phys[KVM_MEM_SLOTS_NUM]; 254 cpumask_t need_tlb_flush;
250 int slot_npages[KVM_MEM_SLOTS_NUM];
251 unsigned short last_vcpu[NR_CPUS];
252 struct kvmppc_vcore *vcores[KVM_MAX_VCORES]; 255 struct kvmppc_vcore *vcores[KVM_MAX_VCORES];
253 struct kvmppc_linear_info *hpt_li; 256 struct kvmppc_linear_info *hpt_li;
254#endif /* CONFIG_KVM_BOOK3S_64_HV */ 257#endif /* CONFIG_KVM_BOOK3S_64_HV */
@@ -273,6 +276,7 @@ struct kvmppc_vcore {
273 int nap_count; 276 int nap_count;
274 int napping_threads; 277 int napping_threads;
275 u16 pcpu; 278 u16 pcpu;
279 u16 last_cpu;
276 u8 vcore_state; 280 u8 vcore_state;
277 u8 in_guest; 281 u8 in_guest;
278 struct list_head runnable_threads; 282 struct list_head runnable_threads;
@@ -288,9 +292,10 @@ struct kvmppc_vcore {
288 292
289/* Values for vcore_state */ 293/* Values for vcore_state */
290#define VCORE_INACTIVE 0 294#define VCORE_INACTIVE 0
291#define VCORE_RUNNING 1 295#define VCORE_SLEEPING 1
292#define VCORE_EXITING 2 296#define VCORE_STARTING 2
293#define VCORE_SLEEPING 3 297#define VCORE_RUNNING 3
298#define VCORE_EXITING 4
294 299
295/* 300/*
296 * Struct used to manage memory for a virtual processor area 301 * Struct used to manage memory for a virtual processor area
@@ -346,6 +351,27 @@ struct kvmppc_slb {
346 bool class : 1; 351 bool class : 1;
347}; 352};
348 353
354# ifdef CONFIG_PPC_FSL_BOOK3E
355#define KVMPPC_BOOKE_IAC_NUM 2
356#define KVMPPC_BOOKE_DAC_NUM 2
357# else
358#define KVMPPC_BOOKE_IAC_NUM 4
359#define KVMPPC_BOOKE_DAC_NUM 2
360# endif
361#define KVMPPC_BOOKE_MAX_IAC 4
362#define KVMPPC_BOOKE_MAX_DAC 2
363
364struct kvmppc_booke_debug_reg {
365 u32 dbcr0;
366 u32 dbcr1;
367 u32 dbcr2;
368#ifdef CONFIG_KVM_E500MC
369 u32 dbcr4;
370#endif
371 u64 iac[KVMPPC_BOOKE_MAX_IAC];
372 u64 dac[KVMPPC_BOOKE_MAX_DAC];
373};
374
349struct kvm_vcpu_arch { 375struct kvm_vcpu_arch {
350 ulong host_stack; 376 ulong host_stack;
351 u32 host_pid; 377 u32 host_pid;
@@ -380,13 +406,18 @@ struct kvm_vcpu_arch {
380 u32 host_mas4; 406 u32 host_mas4;
381 u32 host_mas6; 407 u32 host_mas6;
382 u32 shadow_epcr; 408 u32 shadow_epcr;
383 u32 epcr;
384 u32 shadow_msrp; 409 u32 shadow_msrp;
385 u32 eplc; 410 u32 eplc;
386 u32 epsc; 411 u32 epsc;
387 u32 oldpir; 412 u32 oldpir;
388#endif 413#endif
389 414
415#if defined(CONFIG_BOOKE)
416#if defined(CONFIG_KVM_BOOKE_HV) || defined(CONFIG_64BIT)
417 u32 epcr;
418#endif
419#endif
420
390#ifdef CONFIG_PPC_BOOK3S 421#ifdef CONFIG_PPC_BOOK3S
391 /* For Gekko paired singles */ 422 /* For Gekko paired singles */
392 u32 qpr[32]; 423 u32 qpr[32];
@@ -440,8 +471,6 @@ struct kvm_vcpu_arch {
440 471
441 u32 ccr0; 472 u32 ccr0;
442 u32 ccr1; 473 u32 ccr1;
443 u32 dbcr0;
444 u32 dbcr1;
445 u32 dbsr; 474 u32 dbsr;
446 475
447 u64 mmcr[3]; 476 u64 mmcr[3];
@@ -471,9 +500,12 @@ struct kvm_vcpu_arch {
471 ulong fault_esr; 500 ulong fault_esr;
472 ulong queued_dear; 501 ulong queued_dear;
473 ulong queued_esr; 502 ulong queued_esr;
503 spinlock_t wdt_lock;
504 struct timer_list wdt_timer;
474 u32 tlbcfg[4]; 505 u32 tlbcfg[4];
475 u32 mmucfg; 506 u32 mmucfg;
476 u32 epr; 507 u32 epr;
508 struct kvmppc_booke_debug_reg dbg_reg;
477#endif 509#endif
478 gpa_t paddr_accessed; 510 gpa_t paddr_accessed;
479 gva_t vaddr_accessed; 511 gva_t vaddr_accessed;
@@ -486,6 +518,7 @@ struct kvm_vcpu_arch {
486 u8 osi_needed; 518 u8 osi_needed;
487 u8 osi_enabled; 519 u8 osi_enabled;
488 u8 papr_enabled; 520 u8 papr_enabled;
521 u8 watchdog_enabled;
489 u8 sane; 522 u8 sane;
490 u8 cpu_type; 523 u8 cpu_type;
491 u8 hcall_needed; 524 u8 hcall_needed;
@@ -497,7 +530,6 @@ struct kvm_vcpu_arch {
497 u64 dec_jiffies; 530 u64 dec_jiffies;
498 u64 dec_expires; 531 u64 dec_expires;
499 unsigned long pending_exceptions; 532 unsigned long pending_exceptions;
500 u16 last_cpu;
501 u8 ceded; 533 u8 ceded;
502 u8 prodded; 534 u8 prodded;
503 u32 last_inst; 535 u32 last_inst;
@@ -534,13 +566,17 @@ struct kvm_vcpu_arch {
534 unsigned long dtl_index; 566 unsigned long dtl_index;
535 u64 stolen_logged; 567 u64 stolen_logged;
536 struct kvmppc_vpa slb_shadow; 568 struct kvmppc_vpa slb_shadow;
569
570 spinlock_t tbacct_lock;
571 u64 busy_stolen;
572 u64 busy_preempt;
537#endif 573#endif
538}; 574};
539 575
540/* Values for vcpu->arch.state */ 576/* Values for vcpu->arch.state */
541#define KVMPPC_VCPU_STOPPED 0 577#define KVMPPC_VCPU_NOTREADY 0
542#define KVMPPC_VCPU_BUSY_IN_HOST 1 578#define KVMPPC_VCPU_RUNNABLE 1
543#define KVMPPC_VCPU_RUNNABLE 2 579#define KVMPPC_VCPU_BUSY_IN_HOST 2
544 580
545/* Values for vcpu->arch.io_gpr */ 581/* Values for vcpu->arch.io_gpr */
546#define KVM_MMIO_REG_MASK 0x001f 582#define KVM_MMIO_REG_MASK 0x001f
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 9365860fb7f..2b119654b4c 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -21,7 +21,6 @@
21 21
22#include <uapi/asm/kvm_para.h> 22#include <uapi/asm/kvm_para.h>
23 23
24
25#ifdef CONFIG_KVM_GUEST 24#ifdef CONFIG_KVM_GUEST
26 25
27#include <linux/of.h> 26#include <linux/of.h>
@@ -55,7 +54,7 @@ static unsigned long kvm_hypercall(unsigned long *in,
55 unsigned long *out, 54 unsigned long *out,
56 unsigned long nr) 55 unsigned long nr)
57{ 56{
58 return HC_EV_UNIMPLEMENTED; 57 return EV_UNIMPLEMENTED;
59} 58}
60 59
61#endif 60#endif
@@ -66,7 +65,7 @@ static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2)
66 unsigned long out[8]; 65 unsigned long out[8];
67 unsigned long r; 66 unsigned long r;
68 67
69 r = kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 68 r = kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
70 *r2 = out[0]; 69 *r2 = out[0];
71 70
72 return r; 71 return r;
@@ -77,7 +76,7 @@ static inline long kvm_hypercall0(unsigned int nr)
77 unsigned long in[8]; 76 unsigned long in[8];
78 unsigned long out[8]; 77 unsigned long out[8];
79 78
80 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 79 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
81} 80}
82 81
83static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) 82static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
@@ -86,7 +85,7 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
86 unsigned long out[8]; 85 unsigned long out[8];
87 86
88 in[0] = p1; 87 in[0] = p1;
89 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 88 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
90} 89}
91 90
92static inline long kvm_hypercall2(unsigned int nr, unsigned long p1, 91static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
@@ -97,7 +96,7 @@ static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
97 96
98 in[0] = p1; 97 in[0] = p1;
99 in[1] = p2; 98 in[1] = p2;
100 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 99 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
101} 100}
102 101
103static inline long kvm_hypercall3(unsigned int nr, unsigned long p1, 102static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
@@ -109,7 +108,7 @@ static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
109 in[0] = p1; 108 in[0] = p1;
110 in[1] = p2; 109 in[1] = p2;
111 in[2] = p3; 110 in[2] = p3;
112 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 111 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
113} 112}
114 113
115static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, 114static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
@@ -123,7 +122,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
123 in[1] = p2; 122 in[1] = p2;
124 in[2] = p3; 123 in[2] = p3;
125 in[3] = p4; 124 in[3] = p4;
126 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 125 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
127} 126}
128 127
129 128
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index e006f0bdea9..572aa753061 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -28,6 +28,7 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/kvm_types.h> 29#include <linux/kvm_types.h>
30#include <linux/kvm_host.h> 30#include <linux/kvm_host.h>
31#include <linux/bug.h>
31#ifdef CONFIG_PPC_BOOK3S 32#ifdef CONFIG_PPC_BOOK3S
32#include <asm/kvm_book3s.h> 33#include <asm/kvm_book3s.h>
33#else 34#else
@@ -68,6 +69,8 @@ extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu);
68extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb); 69extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb);
69extern void kvmppc_decrementer_func(unsigned long data); 70extern void kvmppc_decrementer_func(unsigned long data);
70extern int kvmppc_sanity_check(struct kvm_vcpu *vcpu); 71extern int kvmppc_sanity_check(struct kvm_vcpu *vcpu);
72extern int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu);
73extern void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu);
71 74
72/* Core-specific hooks */ 75/* Core-specific hooks */
73 76
@@ -104,6 +107,7 @@ extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
104 struct kvm_interrupt *irq); 107 struct kvm_interrupt *irq);
105extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu, 108extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu,
106 struct kvm_interrupt *irq); 109 struct kvm_interrupt *irq);
110extern void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu);
107 111
108extern int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 112extern int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
109 unsigned int op, int *advance); 113 unsigned int op, int *advance);
@@ -111,6 +115,7 @@ extern int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn,
111 ulong val); 115 ulong val);
112extern int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, 116extern int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn,
113 ulong *val); 117 ulong *val);
118extern int kvmppc_core_check_requests(struct kvm_vcpu *vcpu);
114 119
115extern int kvmppc_booke_init(void); 120extern int kvmppc_booke_init(void);
116extern void kvmppc_booke_exit(void); 121extern void kvmppc_booke_exit(void);
@@ -139,16 +144,28 @@ extern struct kvmppc_linear_info *kvm_alloc_hpt(void);
139extern void kvm_release_hpt(struct kvmppc_linear_info *li); 144extern void kvm_release_hpt(struct kvmppc_linear_info *li);
140extern int kvmppc_core_init_vm(struct kvm *kvm); 145extern int kvmppc_core_init_vm(struct kvm *kvm);
141extern void kvmppc_core_destroy_vm(struct kvm *kvm); 146extern void kvmppc_core_destroy_vm(struct kvm *kvm);
147extern void kvmppc_core_free_memslot(struct kvm_memory_slot *free,
148 struct kvm_memory_slot *dont);
149extern int kvmppc_core_create_memslot(struct kvm_memory_slot *slot,
150 unsigned long npages);
142extern int kvmppc_core_prepare_memory_region(struct kvm *kvm, 151extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
152 struct kvm_memory_slot *memslot,
143 struct kvm_userspace_memory_region *mem); 153 struct kvm_userspace_memory_region *mem);
144extern void kvmppc_core_commit_memory_region(struct kvm *kvm, 154extern void kvmppc_core_commit_memory_region(struct kvm *kvm,
145 struct kvm_userspace_memory_region *mem); 155 struct kvm_userspace_memory_region *mem,
156 struct kvm_memory_slot old);
146extern int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, 157extern int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm,
147 struct kvm_ppc_smmu_info *info); 158 struct kvm_ppc_smmu_info *info);
159extern void kvmppc_core_flush_memslot(struct kvm *kvm,
160 struct kvm_memory_slot *memslot);
148 161
149extern int kvmppc_bookehv_init(void); 162extern int kvmppc_bookehv_init(void);
150extern void kvmppc_bookehv_exit(void); 163extern void kvmppc_bookehv_exit(void);
151 164
165extern int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu);
166
167extern int kvm_vm_ioctl_get_htab_fd(struct kvm *kvm, struct kvm_get_htab_fd *);
168
152/* 169/*
153 * Cuts out inst bits with ordering according to spec. 170 * Cuts out inst bits with ordering according to spec.
154 * That means the leftmost bit is zero. All given bits are included. 171 * That means the leftmost bit is zero. All given bits are included.
@@ -182,6 +199,41 @@ static inline u32 kvmppc_set_field(u64 inst, int msb, int lsb, int value)
182 return r; 199 return r;
183} 200}
184 201
202union kvmppc_one_reg {
203 u32 wval;
204 u64 dval;
205 vector128 vval;
206 u64 vsxval[2];
207 struct {
208 u64 addr;
209 u64 length;
210 } vpaval;
211};
212
213#define one_reg_size(id) \
214 (1ul << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
215
216#define get_reg_val(id, reg) ({ \
217 union kvmppc_one_reg __u; \
218 switch (one_reg_size(id)) { \
219 case 4: __u.wval = (reg); break; \
220 case 8: __u.dval = (reg); break; \
221 default: BUG(); \
222 } \
223 __u; \
224})
225
226
227#define set_reg_val(id, val) ({ \
228 u64 __v; \
229 switch (one_reg_size(id)) { \
230 case 4: __v = (val).wval; break; \
231 case 8: __v = (val).dval; break; \
232 default: BUG(); \
233 } \
234 __v; \
235})
236
185void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 237void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
186int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 238int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
187 239
@@ -190,6 +242,8 @@ int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
190 242
191int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg); 243int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg);
192int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg); 244int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg);
245int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *);
246int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *);
193 247
194void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid); 248void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid);
195 249
@@ -230,5 +284,36 @@ static inline void kvmppc_mmu_flush_icache(pfn_t pfn)
230 } 284 }
231} 285}
232 286
287/* Please call after prepare_to_enter. This function puts the lazy ee state
288 back to normal mode, without actually enabling interrupts. */
289static inline void kvmppc_lazy_ee_enable(void)
290{
291#ifdef CONFIG_PPC64
292 /* Only need to enable IRQs by hard enabling them after this */
293 local_paca->irq_happened = 0;
294 local_paca->soft_enabled = 1;
295#endif
296}
297
298static inline ulong kvmppc_get_ea_indexed(struct kvm_vcpu *vcpu, int ra, int rb)
299{
300 ulong ea;
301 ulong msr_64bit = 0;
302
303 ea = kvmppc_get_gpr(vcpu, rb);
304 if (ra)
305 ea += kvmppc_get_gpr(vcpu, ra);
306
307#if defined(CONFIG_PPC_BOOK3E_64)
308 msr_64bit = MSR_CM;
309#elif defined(CONFIG_PPC_BOOK3S_64)
310 msr_64bit = MSR_SF;
311#endif
312
313 if (!(vcpu->arch.shared->msr & msr_64bit))
314 ea = (uint32_t)ea;
315
316 return ea;
317}
233 318
234#endif /* __POWERPC_KVM_PPC_H__ */ 319#endif /* __POWERPC_KVM_PPC_H__ */
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h
index eeabcdbc30f..99d43e0c1e4 100644
--- a/arch/powerpc/include/asm/mmu-book3e.h
+++ b/arch/powerpc/include/asm/mmu-book3e.h
@@ -59,7 +59,7 @@
59#define MAS1_TSIZE_SHIFT 7 59#define MAS1_TSIZE_SHIFT 7
60#define MAS1_TSIZE(x) (((x) << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK) 60#define MAS1_TSIZE(x) (((x) << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK)
61 61
62#define MAS2_EPN 0xFFFFF000 62#define MAS2_EPN (~0xFFFUL)
63#define MAS2_X0 0x00000040 63#define MAS2_X0 0x00000040
64#define MAS2_X1 0x00000020 64#define MAS2_X1 0x00000020
65#define MAS2_W 0x00000010 65#define MAS2_W 0x00000010
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index 9673f73eb8d..2fdb47a19ef 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -121,6 +121,16 @@ extern char initial_stab[];
121#define PP_RXRX 3 /* Supervisor read, User read */ 121#define PP_RXRX 3 /* Supervisor read, User read */
122#define PP_RXXX (HPTE_R_PP0 | 2) /* Supervisor read, user none */ 122#define PP_RXXX (HPTE_R_PP0 | 2) /* Supervisor read, user none */
123 123
124/* Fields for tlbiel instruction in architecture 2.06 */
125#define TLBIEL_INVAL_SEL_MASK 0xc00 /* invalidation selector */
126#define TLBIEL_INVAL_PAGE 0x000 /* invalidate a single page */
127#define TLBIEL_INVAL_SET_LPID 0x800 /* invalidate a set for current LPID */
128#define TLBIEL_INVAL_SET 0xc00 /* invalidate a set for all LPIDs */
129#define TLBIEL_INVAL_SET_MASK 0xfff000 /* set number to inval. */
130#define TLBIEL_INVAL_SET_SHIFT 12
131
132#define POWER7_TLB_SETS 128 /* # sets in POWER7 TLB */
133
124#ifndef __ASSEMBLY__ 134#ifndef __ASSEMBLY__
125 135
126struct hash_pte { 136struct hash_pte {
diff --git a/arch/powerpc/include/asm/oprofile_impl.h b/arch/powerpc/include/asm/oprofile_impl.h
index 639dc96077a..d697b08994c 100644
--- a/arch/powerpc/include/asm/oprofile_impl.h
+++ b/arch/powerpc/include/asm/oprofile_impl.h
@@ -34,7 +34,7 @@ struct op_system_config {
34 unsigned long mmcra; 34 unsigned long mmcra;
35#ifdef CONFIG_OPROFILE_CELL 35#ifdef CONFIG_OPROFILE_CELL
36 /* Register for oprofile user tool to check cell kernel profiling 36 /* Register for oprofile user tool to check cell kernel profiling
37 * suport. 37 * support.
38 */ 38 */
39 unsigned long cell_support; 39 unsigned long cell_support;
40#endif 40#endif
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 5f73ce63fca..42b1f43b943 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -168,9 +168,12 @@
168#define PPC_INST_AND 0x7c000038 168#define PPC_INST_AND 0x7c000038
169#define PPC_INST_ANDDOT 0x7c000039 169#define PPC_INST_ANDDOT 0x7c000039
170#define PPC_INST_OR 0x7c000378 170#define PPC_INST_OR 0x7c000378
171#define PPC_INST_XOR 0x7c000278
171#define PPC_INST_ANDI 0x70000000 172#define PPC_INST_ANDI 0x70000000
172#define PPC_INST_ORI 0x60000000 173#define PPC_INST_ORI 0x60000000
173#define PPC_INST_ORIS 0x64000000 174#define PPC_INST_ORIS 0x64000000
175#define PPC_INST_XORI 0x68000000
176#define PPC_INST_XORIS 0x6c000000
174#define PPC_INST_NEG 0x7c0000d0 177#define PPC_INST_NEG 0x7c0000d0
175#define PPC_INST_BRANCH 0x48000000 178#define PPC_INST_BRANCH 0x48000000
176#define PPC_INST_BRANCH_COND 0x40800000 179#define PPC_INST_BRANCH_COND 0x40800000
diff --git a/arch/powerpc/include/asm/pte-hash64-64k.h b/arch/powerpc/include/asm/pte-hash64-64k.h
index eedf427c912..3e13e23e4fd 100644
--- a/arch/powerpc/include/asm/pte-hash64-64k.h
+++ b/arch/powerpc/include/asm/pte-hash64-64k.h
@@ -23,7 +23,7 @@
23 23
24/* Note the full page bits must be in the same location as for normal 24/* Note the full page bits must be in the same location as for normal
25 * 4k pages as the same assembly will be used to insert 64K pages 25 * 4k pages as the same assembly will be used to insert 64K pages
26 * wether the kernel has CONFIG_PPC_64K_PAGES or not 26 * whether the kernel has CONFIG_PPC_64K_PAGES or not
27 */ 27 */
28#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */ 28#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */
29#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */ 29#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index d24c1416396..97d37278ea2 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -518,6 +518,7 @@
518#define SRR1_WS_DEEPER 0x00020000 /* Some resources not maintained */ 518#define SRR1_WS_DEEPER 0x00020000 /* Some resources not maintained */
519#define SRR1_WS_DEEP 0x00010000 /* All resources maintained */ 519#define SRR1_WS_DEEP 0x00010000 /* All resources maintained */
520#define SRR1_PROGFPE 0x00100000 /* Floating Point Enabled */ 520#define SRR1_PROGFPE 0x00100000 /* Floating Point Enabled */
521#define SRR1_PROGILL 0x00080000 /* Illegal instruction */
521#define SRR1_PROGPRIV 0x00040000 /* Privileged instruction */ 522#define SRR1_PROGPRIV 0x00040000 /* Privileged instruction */
522#define SRR1_PROGTRAP 0x00020000 /* Trap */ 523#define SRR1_PROGTRAP 0x00020000 /* Trap */
523#define SRR1_PROGADDR 0x00010000 /* SRR0 contains subsequent addr */ 524#define SRR1_PROGADDR 0x00010000 /* SRR0 contains subsequent addr */
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 2d916c4982c..e07e6af5e1f 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -539,6 +539,13 @@
539#define TCR_FIE 0x00800000 /* FIT Interrupt Enable */ 539#define TCR_FIE 0x00800000 /* FIT Interrupt Enable */
540#define TCR_ARE 0x00400000 /* Auto Reload Enable */ 540#define TCR_ARE 0x00400000 /* Auto Reload Enable */
541 541
542#ifdef CONFIG_E500
543#define TCR_GET_WP(tcr) ((((tcr) & 0xC0000000) >> 30) | \
544 (((tcr) & 0x1E0000) >> 15))
545#else
546#define TCR_GET_WP(tcr) (((tcr) & 0xC0000000) >> 30)
547#endif
548
542/* Bit definitions for the TSR. */ 549/* Bit definitions for the TSR. */
543#define TSR_ENW 0x80000000 /* Enable Next Watchdog */ 550#define TSR_ENW 0x80000000 /* Enable Next Watchdog */
544#define TSR_WIS 0x40000000 /* WDT Interrupt Status */ 551#define TSR_WIS 0x40000000 /* WDT Interrupt Status */
diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h
index 189998bb61c..a101637725a 100644
--- a/arch/powerpc/include/asm/signal.h
+++ b/arch/powerpc/include/asm/signal.h
@@ -3,6 +3,4 @@
3 3
4#include <uapi/asm/signal.h> 4#include <uapi/asm/signal.h>
5 5
6struct pt_regs;
7#define ptrace_signal_deliver(regs, cookie) do { } while (0)
8#endif /* _ASM_POWERPC_SIGNAL_H */ 6#endif /* _ASM_POWERPC_SIGNAL_H */
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index e807e9d8e3f..5a4e437c238 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -67,6 +67,14 @@ void generic_mach_cpu_die(void);
67void generic_set_cpu_dead(unsigned int cpu); 67void generic_set_cpu_dead(unsigned int cpu);
68void generic_set_cpu_up(unsigned int cpu); 68void generic_set_cpu_up(unsigned int cpu);
69int generic_check_cpu_restart(unsigned int cpu); 69int generic_check_cpu_restart(unsigned int cpu);
70
71extern void inhibit_secondary_onlining(void);
72extern void uninhibit_secondary_onlining(void);
73
74#else /* HOTPLUG_CPU */
75static inline void inhibit_secondary_onlining(void) {}
76static inline void uninhibit_secondary_onlining(void) {}
77
70#endif 78#endif
71 79
72#ifdef CONFIG_PPC64 80#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/include/asm/smu.h b/arch/powerpc/include/asm/smu.h
index ae20ce1af4c..6e909f3e6a4 100644
--- a/arch/powerpc/include/asm/smu.h
+++ b/arch/powerpc/include/asm/smu.h
@@ -132,7 +132,7 @@
132 * 132 *
133 * At this point, the OF driver seems to have a limitation on transfer 133 * At this point, the OF driver seems to have a limitation on transfer
134 * sizes of 0xd bytes on reads and 0x5 bytes on writes. I do not know 134 * sizes of 0xd bytes on reads and 0x5 bytes on writes. I do not know
135 * wether this is just an OF limit due to some temporary buffer size 135 * whether this is just an OF limit due to some temporary buffer size
136 * or if this is an SMU imposed limit. This driver has the same limitation 136 * or if this is an SMU imposed limit. This driver has the same limitation
137 * for now as I use a 0x10 bytes temporary buffer as well 137 * for now as I use a 0x10 bytes temporary buffer as well
138 * 138 *
@@ -236,7 +236,7 @@
236 * 3 (optional): enable nmi? [0x00 or 0x01] 236 * 3 (optional): enable nmi? [0x00 or 0x01]
237 * 237 *
238 * Returns: 238 * Returns:
239 * If parameter 2 is 0x00 and parameter 3 is not specified, returns wether 239 * If parameter 2 is 0x00 and parameter 3 is not specified, returns whether
240 * NMI is enabled. Otherwise unknown. 240 * NMI is enabled. Otherwise unknown.
241 */ 241 */
242#define SMU_CMD_MISC_df_NMI_OPTION 0x04 242#define SMU_CMD_MISC_df_NMI_OPTION 0x04
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index 329db4ec12c..b5308d3e6d3 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -17,15 +17,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
17asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, 17asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
18 unsigned long prot, unsigned long flags, 18 unsigned long prot, unsigned long flags,
19 unsigned long fd, unsigned long pgoff); 19 unsigned long fd, unsigned long pgoff);
20asmlinkage int sys_clone(unsigned long clone_flags, unsigned long usp,
21 int __user *parent_tidp, void __user *child_threadptr,
22 int __user *child_tidp, int p6, struct pt_regs *regs);
23asmlinkage int sys_fork(unsigned long p1, unsigned long p2,
24 unsigned long p3, unsigned long p4, unsigned long p5,
25 unsigned long p6, struct pt_regs *regs);
26asmlinkage int sys_vfork(unsigned long p1, unsigned long p2,
27 unsigned long p3, unsigned long p4, unsigned long p5,
28 unsigned long p6, struct pt_regs *regs);
29asmlinkage long sys_pipe(int __user *fildes); 20asmlinkage long sys_pipe(int __user *fildes);
30asmlinkage long sys_pipe2(int __user *fildes, int flags); 21asmlinkage long sys_pipe2(int __user *fildes, int flags);
31asmlinkage long sys_rt_sigaction(int sig, 22asmlinkage long sys_rt_sigaction(int sig,
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 921dce6d844..76fe846ec40 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -56,7 +56,9 @@
56#define __ARCH_WANT_COMPAT_SYS_SENDFILE 56#define __ARCH_WANT_COMPAT_SYS_SENDFILE
57#endif 57#endif
58#define __ARCH_WANT_SYS_EXECVE 58#define __ARCH_WANT_SYS_EXECVE
59#define __ARCH_WANT_KERNEL_EXECVE 59#define __ARCH_WANT_SYS_FORK
60#define __ARCH_WANT_SYS_VFORK
61#define __ARCH_WANT_SYS_CLONE
60 62
61/* 63/*
62 * "Conditional" syscalls 64 * "Conditional" syscalls
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild
index a33c3c03bb2..f7bca637074 100644
--- a/arch/powerpc/include/uapi/asm/Kbuild
+++ b/arch/powerpc/include/uapi/asm/Kbuild
@@ -7,6 +7,7 @@ header-y += bootx.h
7header-y += byteorder.h 7header-y += byteorder.h
8header-y += cputable.h 8header-y += cputable.h
9header-y += elf.h 9header-y += elf.h
10header-y += epapr_hcalls.h
10header-y += errno.h 11header-y += errno.h
11header-y += fcntl.h 12header-y += fcntl.h
12header-y += ioctl.h 13header-y += ioctl.h
diff --git a/arch/powerpc/include/uapi/asm/epapr_hcalls.h b/arch/powerpc/include/uapi/asm/epapr_hcalls.h
new file mode 100644
index 00000000000..7f9c74b4670
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/epapr_hcalls.h
@@ -0,0 +1,98 @@
1/*
2 * ePAPR hcall interface
3 *
4 * Copyright 2008-2011 Freescale Semiconductor, Inc.
5 *
6 * Author: Timur Tabi <timur@freescale.com>
7 *
8 * This file is provided under a dual BSD/GPL license. When using or
9 * redistributing this file, you may do so under either license.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * * Neither the name of Freescale Semiconductor nor the
19 * names of its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 *
23 * ALTERNATIVELY, this software may be distributed under the terms of the
24 * GNU General Public License ("GPL") as published by the Free Software
25 * Foundation, either version 2 of that License or (at your option) any
26 * later version.
27 *
28 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
29 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
32 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING 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#ifndef _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
41#define _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
42
43#define EV_BYTE_CHANNEL_SEND 1
44#define EV_BYTE_CHANNEL_RECEIVE 2
45#define EV_BYTE_CHANNEL_POLL 3
46#define EV_INT_SET_CONFIG 4
47#define EV_INT_GET_CONFIG 5
48#define EV_INT_SET_MASK 6
49#define EV_INT_GET_MASK 7
50#define EV_INT_IACK 9
51#define EV_INT_EOI 10
52#define EV_INT_SEND_IPI 11
53#define EV_INT_SET_TASK_PRIORITY 12
54#define EV_INT_GET_TASK_PRIORITY 13
55#define EV_DOORBELL_SEND 14
56#define EV_MSGSND 15
57#define EV_IDLE 16
58
59/* vendor ID: epapr */
60#define EV_LOCAL_VENDOR_ID 0 /* for private use */
61#define EV_EPAPR_VENDOR_ID 1
62#define EV_FSL_VENDOR_ID 2 /* Freescale Semiconductor */
63#define EV_IBM_VENDOR_ID 3 /* IBM */
64#define EV_GHS_VENDOR_ID 4 /* Green Hills Software */
65#define EV_ENEA_VENDOR_ID 5 /* Enea */
66#define EV_WR_VENDOR_ID 6 /* Wind River Systems */
67#define EV_AMCC_VENDOR_ID 7 /* Applied Micro Circuits */
68#define EV_KVM_VENDOR_ID 42 /* KVM */
69
70/* The max number of bytes that a byte channel can send or receive per call */
71#define EV_BYTE_CHANNEL_MAX_BYTES 16
72
73
74#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
75#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
76
77/* epapr return codes */
78#define EV_SUCCESS 0
79#define EV_EPERM 1 /* Operation not permitted */
80#define EV_ENOENT 2 /* Entry Not Found */
81#define EV_EIO 3 /* I/O error occured */
82#define EV_EAGAIN 4 /* The operation had insufficient
83 * resources to complete and should be
84 * retried
85 */
86#define EV_ENOMEM 5 /* There was insufficient memory to
87 * complete the operation */
88#define EV_EFAULT 6 /* Bad guest address */
89#define EV_ENODEV 7 /* No such device */
90#define EV_EINVAL 8 /* An argument supplied to the hcall
91 was out of range or invalid */
92#define EV_INTERNAL 9 /* An internal error occured */
93#define EV_CONFIG 10 /* A configuration error was detected */
94#define EV_INVALID_STATE 11 /* The object is in an invalid state */
95#define EV_UNIMPLEMENTED 12 /* Unimplemented hypercall */
96#define EV_BUFFER_OVERFLOW 13 /* Caller-supplied buffer too small */
97
98#endif /* _UAPI_ASM_POWERPC_EPAPR_HCALLS_H */
diff --git a/arch/powerpc/include/uapi/asm/ioctls.h b/arch/powerpc/include/uapi/asm/ioctls.h
index e9b78870aaa..49a25796a61 100644
--- a/arch/powerpc/include/uapi/asm/ioctls.h
+++ b/arch/powerpc/include/uapi/asm/ioctls.h
@@ -97,6 +97,9 @@
97#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 97#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
98#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ 98#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
99#define TIOCVHANGUP 0x5437 99#define TIOCVHANGUP 0x5437
100#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
101#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
102#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
100 103
101#define TIOCSERCONFIG 0x5453 104#define TIOCSERCONFIG 0x5453
102#define TIOCSERGWILD 0x5454 105#define TIOCSERGWILD 0x5454
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h
index 1bea4d8ea6f..2fba8a66fb1 100644
--- a/arch/powerpc/include/uapi/asm/kvm.h
+++ b/arch/powerpc/include/uapi/asm/kvm.h
@@ -221,6 +221,12 @@ struct kvm_sregs {
221 221
222 __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */ 222 __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */
223 __u32 dbcr[3]; 223 __u32 dbcr[3];
224 /*
225 * iac/dac registers are 64bit wide, while this API
226 * interface provides only lower 32 bits on 64 bit
227 * processors. ONE_REG interface is added for 64bit
228 * iac/dac registers.
229 */
224 __u32 iac[4]; 230 __u32 iac[4];
225 __u32 dac[2]; 231 __u32 dac[2];
226 __u32 dvc[2]; 232 __u32 dvc[2];
@@ -325,6 +331,86 @@ struct kvm_book3e_206_tlb_params {
325 __u32 reserved[8]; 331 __u32 reserved[8];
326}; 332};
327 333
334/* For KVM_PPC_GET_HTAB_FD */
335struct kvm_get_htab_fd {
336 __u64 flags;
337 __u64 start_index;
338 __u64 reserved[2];
339};
340
341/* Values for kvm_get_htab_fd.flags */
342#define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1)
343#define KVM_GET_HTAB_WRITE ((__u64)0x2)
344
345/*
346 * Data read on the file descriptor is formatted as a series of
347 * records, each consisting of a header followed by a series of
348 * `n_valid' HPTEs (16 bytes each), which are all valid. Following
349 * those valid HPTEs there are `n_invalid' invalid HPTEs, which
350 * are not represented explicitly in the stream. The same format
351 * is used for writing.
352 */
353struct kvm_get_htab_header {
354 __u32 index;
355 __u16 n_valid;
356 __u16 n_invalid;
357};
358
328#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1) 359#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1)
360#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2)
361#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3)
362#define KVM_REG_PPC_IAC3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x4)
363#define KVM_REG_PPC_IAC4 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5)
364#define KVM_REG_PPC_DAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6)
365#define KVM_REG_PPC_DAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7)
366#define KVM_REG_PPC_DABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8)
367#define KVM_REG_PPC_DSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9)
368#define KVM_REG_PPC_PURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa)
369#define KVM_REG_PPC_SPURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb)
370#define KVM_REG_PPC_DAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc)
371#define KVM_REG_PPC_DSISR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd)
372#define KVM_REG_PPC_AMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe)
373#define KVM_REG_PPC_UAMOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf)
374
375#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10)
376#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11)
377#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12)
378
379#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18)
380#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19)
381#define KVM_REG_PPC_PMC3 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a)
382#define KVM_REG_PPC_PMC4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b)
383#define KVM_REG_PPC_PMC5 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c)
384#define KVM_REG_PPC_PMC6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d)
385#define KVM_REG_PPC_PMC7 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e)
386#define KVM_REG_PPC_PMC8 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f)
387
388/* 32 floating-point registers */
389#define KVM_REG_PPC_FPR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x20)
390#define KVM_REG_PPC_FPR(n) (KVM_REG_PPC_FPR0 + (n))
391#define KVM_REG_PPC_FPR31 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3f)
392
393/* 32 VMX/Altivec vector registers */
394#define KVM_REG_PPC_VR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x40)
395#define KVM_REG_PPC_VR(n) (KVM_REG_PPC_VR0 + (n))
396#define KVM_REG_PPC_VR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x5f)
397
398/* 32 double-width FP registers for VSX */
399/* High-order halves overlap with FP regs */
400#define KVM_REG_PPC_VSR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x60)
401#define KVM_REG_PPC_VSR(n) (KVM_REG_PPC_VSR0 + (n))
402#define KVM_REG_PPC_VSR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x7f)
403
404/* FP and vector status/control registers */
405#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80)
406#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81)
407
408/* Virtual processor areas */
409/* For SLB & DTL, address in high (first) half, length in low half */
410#define KVM_REG_PPC_VPA_ADDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x82)
411#define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83)
412#define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84)
413
414#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85)
329 415
330#endif /* __LINUX_KVM_POWERPC_H */ 416#endif /* __LINUX_KVM_POWERPC_H */
diff --git a/arch/powerpc/include/uapi/asm/kvm_para.h b/arch/powerpc/include/uapi/asm/kvm_para.h
index 5e04383a1db..ed0e0254b47 100644
--- a/arch/powerpc/include/uapi/asm/kvm_para.h
+++ b/arch/powerpc/include/uapi/asm/kvm_para.h
@@ -75,9 +75,10 @@ struct kvm_vcpu_arch_shared {
75}; 75};
76 76
77#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */ 77#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
78#define HC_VENDOR_KVM (42 << 16) 78
79#define HC_EV_SUCCESS 0 79#define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
80#define HC_EV_UNIMPLEMENTED 12 80
81#include <uapi/asm/epapr_hcalls.h>
81 82
82#define KVM_FEATURE_MAGIC_PAGE 1 83#define KVM_FEATURE_MAGIC_PAGE 1
83 84
diff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h
index 3d5179bb122..eb0b1864d40 100644
--- a/arch/powerpc/include/uapi/asm/socket.h
+++ b/arch/powerpc/include/uapi/asm/socket.h
@@ -47,6 +47,7 @@
47/* Socket filtering */ 47/* Socket filtering */
48#define SO_ATTACH_FILTER 26 48#define SO_ATTACH_FILTER 26
49#define SO_DETACH_FILTER 27 49#define SO_DETACH_FILTER 27
50#define SO_GET_FILTER SO_ATTACH_FILTER
50 51
51#define SO_PEERNAME 28 52#define SO_PEERNAME 28
52#define SO_TIMESTAMP 29 53#define SO_TIMESTAMP 29
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 7523539cfe9..4e23ba2f3ca 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -441,8 +441,7 @@ int main(void)
441 DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr)); 441 DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr));
442 DEFINE(KVM_HOST_SDR1, offsetof(struct kvm, arch.host_sdr1)); 442 DEFINE(KVM_HOST_SDR1, offsetof(struct kvm, arch.host_sdr1));
443 DEFINE(KVM_TLBIE_LOCK, offsetof(struct kvm, arch.tlbie_lock)); 443 DEFINE(KVM_TLBIE_LOCK, offsetof(struct kvm, arch.tlbie_lock));
444 DEFINE(KVM_ONLINE_CPUS, offsetof(struct kvm, online_vcpus.counter)); 444 DEFINE(KVM_NEED_FLUSH, offsetof(struct kvm, arch.need_tlb_flush.bits));
445 DEFINE(KVM_LAST_VCPU, offsetof(struct kvm, arch.last_vcpu));
446 DEFINE(KVM_LPCR, offsetof(struct kvm, arch.lpcr)); 445 DEFINE(KVM_LPCR, offsetof(struct kvm, arch.lpcr));
447 DEFINE(KVM_RMOR, offsetof(struct kvm, arch.rmor)); 446 DEFINE(KVM_RMOR, offsetof(struct kvm, arch.rmor));
448 DEFINE(KVM_VRMA_SLB_V, offsetof(struct kvm, arch.vrma_slb_v)); 447 DEFINE(KVM_VRMA_SLB_V, offsetof(struct kvm, arch.vrma_slb_v));
@@ -470,7 +469,6 @@ int main(void)
470 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb)); 469 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb));
471 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max)); 470 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max));
472 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr)); 471 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr));
473 DEFINE(VCPU_LAST_CPU, offsetof(struct kvm_vcpu, arch.last_cpu));
474 DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr)); 472 DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr));
475 DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar)); 473 DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar));
476 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); 474 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 9499385676e..d22e73e4618 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -444,11 +444,6 @@ ret_from_kernel_thread:
444 PPC440EP_ERR42 444 PPC440EP_ERR42
445 blrl 445 blrl
446 li r3,0 446 li r3,0
447 b do_exit # no return
448
449 .globl __ret_from_kernel_execve
450__ret_from_kernel_execve:
451 addi r1,r3,-STACK_FRAME_OVERHEAD
452 b ret_from_syscall 447 b ret_from_syscall
453 448
454/* Traced system call support */ 449/* Traced system call support */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 56e0ff0878b..e9a906c2723 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -373,17 +373,11 @@ _GLOBAL(ret_from_fork)
373_GLOBAL(ret_from_kernel_thread) 373_GLOBAL(ret_from_kernel_thread)
374 bl .schedule_tail 374 bl .schedule_tail
375 REST_NVGPRS(r1) 375 REST_NVGPRS(r1)
376 REST_GPR(2,r1) 376 ld r14, 0(r14)
377 mtlr r14 377 mtlr r14
378 mr r3,r15 378 mr r3,r15
379 blrl 379 blrl
380 li r3,0 380 li r3,0
381 b .do_exit # no return
382
383_GLOBAL(__ret_from_kernel_execve)
384 addi r1,r3,-STACK_FRAME_OVERHEAD
385 li r10,1
386 std r10,SOFTE(r1)
387 b syscall_exit 381 b syscall_exit
388 382
389 .section ".toc","aw" 383 .section ".toc","aw"
diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
index 697b390ebfd..62c0dc23782 100644
--- a/arch/powerpc/kernel/epapr_hcalls.S
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -8,13 +8,41 @@
8 */ 8 */
9 9
10#include <linux/threads.h> 10#include <linux/threads.h>
11#include <asm/epapr_hcalls.h>
11#include <asm/reg.h> 12#include <asm/reg.h>
12#include <asm/page.h> 13#include <asm/page.h>
13#include <asm/cputable.h> 14#include <asm/cputable.h>
14#include <asm/thread_info.h> 15#include <asm/thread_info.h>
15#include <asm/ppc_asm.h> 16#include <asm/ppc_asm.h>
17#include <asm/asm-compat.h>
16#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
17 19
20/* epapr_ev_idle() was derived from e500_idle() */
21_GLOBAL(epapr_ev_idle)
22 CURRENT_THREAD_INFO(r3, r1)
23 PPC_LL r4, TI_LOCAL_FLAGS(r3) /* set napping bit */
24 ori r4, r4,_TLF_NAPPING /* so when we take an exception */
25 PPC_STL r4, TI_LOCAL_FLAGS(r3) /* it will return to our caller */
26
27 wrteei 1
28
29idle_loop:
30 LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
31
32.global epapr_ev_idle_start
33epapr_ev_idle_start:
34 li r3, -1
35 nop
36 nop
37 nop
38
39 /*
40 * Guard against spurious wakeups from a hypervisor --
41 * only interrupt will cause us to return to LR due to
42 * _TLF_NAPPING.
43 */
44 b idle_loop
45
18/* Hypercall entry point. Will be patched with device tree instructions. */ 46/* Hypercall entry point. Will be patched with device tree instructions. */
19.global epapr_hypercall_start 47.global epapr_hypercall_start
20epapr_hypercall_start: 48epapr_hypercall_start:
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index 028aeae370b..f3eab8594d9 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -21,6 +21,10 @@
21#include <asm/epapr_hcalls.h> 21#include <asm/epapr_hcalls.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/code-patching.h> 23#include <asm/code-patching.h>
24#include <asm/machdep.h>
25
26extern void epapr_ev_idle(void);
27extern u32 epapr_ev_idle_start[];
24 28
25bool epapr_paravirt_enabled; 29bool epapr_paravirt_enabled;
26 30
@@ -41,8 +45,13 @@ static int __init epapr_paravirt_init(void)
41 if (len % 4 || len > (4 * 4)) 45 if (len % 4 || len > (4 * 4))
42 return -ENODEV; 46 return -ENODEV;
43 47
44 for (i = 0; i < (len / 4); i++) 48 for (i = 0; i < (len / 4); i++) {
45 patch_instruction(epapr_hypercall_start + i, insts[i]); 49 patch_instruction(epapr_hypercall_start + i, insts[i]);
50 patch_instruction(epapr_ev_idle_start + i, insts[i]);
51 }
52
53 if (of_get_property(hyper_node, "has-idle", NULL))
54 ppc_md.power_save = epapr_ev_idle;
46 55
47 epapr_paravirt_enabled = true; 56 epapr_paravirt_enabled = true;
48 57
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 867db1de894..a61b133c4f9 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -419,7 +419,7 @@ static void kvm_map_magic_page(void *data)
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, HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE); 422 kvm_hypercall(in, out, KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE));
423 423
424 *features = out[0]; 424 *features = out[0];
425} 425}
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index bedd12e1cfb..0733b05eb85 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -387,7 +387,7 @@ void __init find_legacy_serial_ports(void)
387 of_node_put(parent); 387 of_node_put(parent);
388 continue; 388 continue;
389 } 389 }
390 /* Check for known pciclass, and also check wether we have 390 /* Check for known pciclass, and also check whether we have
391 * a device with child nodes for ports or not 391 * a device with child nodes for ports or not
392 */ 392 */
393 if (of_device_is_compatible(np, "pciclass,0700") || 393 if (of_device_is_compatible(np, "pciclass,0700") ||
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 2049f2d00ff..9db8ec07ec9 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -82,7 +82,7 @@ static int __devinit of_pci_phb_probe(struct platform_device *dev)
82 return -ENXIO; 82 return -ENXIO;
83 83
84 /* Claim resources. This might need some rework as well depending 84 /* Claim resources. This might need some rework as well depending
85 * wether we are doing probe-only or not, like assigning unassigned 85 * whether we are doing probe-only or not, like assigning unassigned
86 * resources etc... 86 * resources etc...
87 */ 87 */
88 pcibios_claim_one_bus(phb->bus); 88 pcibios_claim_one_bus(phb->bus);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 7f94f760dd0..abc0d085699 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1428,8 +1428,6 @@ void __init pcibios_resource_survey(void)
1428 ppc_md.pcibios_fixup(); 1428 ppc_md.pcibios_fixup();
1429} 1429}
1430 1430
1431#ifdef CONFIG_HOTPLUG
1432
1433/* This is used by the PCI hotplug driver to allocate resource 1431/* This is used by the PCI hotplug driver to allocate resource
1434 * of newly plugged busses. We can try to consolidate with the 1432 * of newly plugged busses. We can try to consolidate with the
1435 * rest of the code later, for now, keep it as-is as our main 1433 * rest of the code later, for now, keep it as-is as our main
@@ -1488,8 +1486,6 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1488} 1486}
1489EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); 1487EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1490 1488
1491#endif /* CONFIG_HOTPLUG */
1492
1493int pcibios_enable_device(struct pci_dev *dev, int mask) 1489int pcibios_enable_device(struct pci_dev *dev, int mask)
1494{ 1490{
1495 if (ppc_md.pcibios_enable_device_hook) 1491 if (ppc_md.pcibios_enable_device_hook)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 4ff190ff24a..2cbe6768fdd 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -74,8 +74,6 @@ static int __init pcibios_init(void)
74 74
75subsys_initcall(pcibios_init); 75subsys_initcall(pcibios_init);
76 76
77#ifdef CONFIG_HOTPLUG
78
79int pcibios_unmap_io_space(struct pci_bus *bus) 77int pcibios_unmap_io_space(struct pci_bus *bus)
80{ 78{
81 struct pci_controller *hose; 79 struct pci_controller *hose;
@@ -124,8 +122,6 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
124} 122}
125EXPORT_SYMBOL_GPL(pcibios_unmap_io_space); 123EXPORT_SYMBOL_GPL(pcibios_unmap_io_space);
126 124
127#endif /* CONFIG_HOTPLUG */
128
129static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose) 125static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose)
130{ 126{
131 struct vm_struct *area; 127 struct vm_struct *area;
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 19e4288d848..78b8766fd79 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -43,6 +43,7 @@
43#include <asm/dcr.h> 43#include <asm/dcr.h>
44#include <asm/ftrace.h> 44#include <asm/ftrace.h>
45#include <asm/switch_to.h> 45#include <asm/switch_to.h>
46#include <asm/epapr_hcalls.h>
46 47
47#ifdef CONFIG_PPC32 48#ifdef CONFIG_PPC32
48extern void transfer_to_handler(void); 49extern void transfer_to_handler(void);
@@ -191,3 +192,7 @@ EXPORT_SYMBOL(__arch_hweight64);
191#ifdef CONFIG_PPC_BOOK3S_64 192#ifdef CONFIG_PPC_BOOK3S_64
192EXPORT_SYMBOL_GPL(mmu_psize_defs); 193EXPORT_SYMBOL_GPL(mmu_psize_defs);
193#endif 194#endif
195
196#ifdef CONFIG_EPAPR_PARAVIRT
197EXPORT_SYMBOL(epapr_hypercall_start);
198#endif
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ba48233500f..81430674e71 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -733,8 +733,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
733extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ 733extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */
734 734
735int copy_thread(unsigned long clone_flags, unsigned long usp, 735int copy_thread(unsigned long clone_flags, unsigned long usp,
736 unsigned long arg, struct task_struct *p, 736 unsigned long arg, struct task_struct *p)
737 struct pt_regs *regs)
738{ 737{
739 struct pt_regs *childregs, *kregs; 738 struct pt_regs *childregs, *kregs;
740 extern void ret_from_fork(void); 739 extern void ret_from_fork(void);
@@ -745,25 +744,25 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
745 /* Copy registers */ 744 /* Copy registers */
746 sp -= sizeof(struct pt_regs); 745 sp -= sizeof(struct pt_regs);
747 childregs = (struct pt_regs *) sp; 746 childregs = (struct pt_regs *) sp;
748 if (!regs) { 747 if (unlikely(p->flags & PF_KTHREAD)) {
749 /* for kernel thread, set `current' and stackptr in new task */ 748 struct thread_info *ti = (void *)task_stack_page(p);
750 memset(childregs, 0, sizeof(struct pt_regs)); 749 memset(childregs, 0, sizeof(struct pt_regs));
751 childregs->gpr[1] = sp + sizeof(struct pt_regs); 750 childregs->gpr[1] = sp + sizeof(struct pt_regs);
751 childregs->gpr[14] = usp; /* function */
752#ifdef CONFIG_PPC64 752#ifdef CONFIG_PPC64
753 childregs->gpr[14] = *(unsigned long *)usp;
754 childregs->gpr[2] = ((unsigned long *)usp)[1],
755 clear_tsk_thread_flag(p, TIF_32BIT); 753 clear_tsk_thread_flag(p, TIF_32BIT);
756#else 754 childregs->softe = 1;
757 childregs->gpr[14] = usp; /* function */
758 childregs->gpr[2] = (unsigned long) p;
759#endif 755#endif
760 childregs->gpr[15] = arg; 756 childregs->gpr[15] = arg;
761 p->thread.regs = NULL; /* no user register state */ 757 p->thread.regs = NULL; /* no user register state */
758 ti->flags |= _TIF_RESTOREALL;
762 f = ret_from_kernel_thread; 759 f = ret_from_kernel_thread;
763 } else { 760 } else {
761 struct pt_regs *regs = current_pt_regs();
764 CHECK_FULL_REGS(regs); 762 CHECK_FULL_REGS(regs);
765 *childregs = *regs; 763 *childregs = *regs;
766 childregs->gpr[1] = usp; 764 if (usp)
765 childregs->gpr[1] = usp;
767 p->thread.regs = childregs; 766 p->thread.regs = childregs;
768 childregs->gpr[3] = 0; /* Result from fork() */ 767 childregs->gpr[3] = 0; /* Result from fork() */
769 if (clone_flags & CLONE_SETTLS) { 768 if (clone_flags & CLONE_SETTLS) {
@@ -1027,51 +1026,6 @@ int get_unalign_ctl(struct task_struct *tsk, unsigned long adr)
1027 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); 1026 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr);
1028} 1027}
1029 1028
1030#define TRUNC_PTR(x) ((typeof(x))(((unsigned long)(x)) & 0xffffffff))
1031
1032int sys_clone(unsigned long clone_flags, unsigned long usp,
1033 int __user *parent_tidp, void __user *child_threadptr,
1034 int __user *child_tidp, int p6,
1035 struct pt_regs *regs)
1036{
1037 CHECK_FULL_REGS(regs);
1038 if (usp == 0)
1039 usp = regs->gpr[1]; /* stack pointer for child */
1040#ifdef CONFIG_PPC64
1041 if (is_32bit_task()) {
1042 parent_tidp = TRUNC_PTR(parent_tidp);
1043 child_tidp = TRUNC_PTR(child_tidp);
1044 }
1045#endif
1046 return do_fork(clone_flags, usp, regs, 0, parent_tidp, child_tidp);
1047}
1048
1049int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3,
1050 unsigned long p4, unsigned long p5, unsigned long p6,
1051 struct pt_regs *regs)
1052{
1053 CHECK_FULL_REGS(regs);
1054 return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL);
1055}
1056
1057int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3,
1058 unsigned long p4, unsigned long p5, unsigned long p6,
1059 struct pt_regs *regs)
1060{
1061 CHECK_FULL_REGS(regs);
1062 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1],
1063 regs, 0, NULL, NULL);
1064}
1065
1066void __ret_from_kernel_execve(struct pt_regs *normal)
1067__noreturn;
1068
1069void ret_from_kernel_execve(struct pt_regs *normal)
1070{
1071 set_thread_flag(TIF_RESTOREALL);
1072 __ret_from_kernel_execve(normal);
1073}
1074
1075static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, 1029static inline int valid_irq_stack(unsigned long sp, struct task_struct *p,
1076 unsigned long nbytes) 1030 unsigned long nbytes)
1077{ 1031{
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index a2dc75793bd..3b997118df5 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -158,10 +158,8 @@ static int do_signal(struct pt_regs *regs)
158 158
159void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 159void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
160{ 160{
161 if (thread_info_flags & _TIF_UPROBE) { 161 if (thread_info_flags & _TIF_UPROBE)
162 clear_thread_flag(TIF_UPROBE);
163 uprobe_notify_resume(regs); 162 uprobe_notify_resume(regs);
164 }
165 163
166 if (thread_info_flags & _TIF_SIGPENDING) 164 if (thread_info_flags & _TIF_SIGPENDING)
167 do_signal(regs); 165 do_signal(regs);
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index d183f8719a5..1ca045d4432 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -83,7 +83,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
83 * the context). This is very important because we must ensure we 83 * the context). This is very important because we must ensure we
84 * don't lose the VRSAVE content that may have been set prior to 84 * don't lose the VRSAVE content that may have been set prior to
85 * the process doing its first vector operation 85 * the process doing its first vector operation
86 * Userland shall check AT_HWCAP to know wether it can rely on the 86 * Userland shall check AT_HWCAP to know whether it can rely on the
87 * v_regs pointer or not 87 * v_regs pointer or not
88 */ 88 */
89#ifdef CONFIG_ALTIVEC 89#ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 2b952b5386f..e5b133ebd8a 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -427,6 +427,45 @@ int generic_check_cpu_restart(unsigned int cpu)
427{ 427{
428 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE; 428 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE;
429} 429}
430
431static atomic_t secondary_inhibit_count;
432
433/*
434 * Don't allow secondary CPU threads to come online
435 */
436void inhibit_secondary_onlining(void)
437{
438 /*
439 * This makes secondary_inhibit_count stable during cpu
440 * online/offline operations.
441 */
442 get_online_cpus();
443
444 atomic_inc(&secondary_inhibit_count);
445 put_online_cpus();
446}
447EXPORT_SYMBOL_GPL(inhibit_secondary_onlining);
448
449/*
450 * Allow secondary CPU threads to come online again
451 */
452void uninhibit_secondary_onlining(void)
453{
454 get_online_cpus();
455 atomic_dec(&secondary_inhibit_count);
456 put_online_cpus();
457}
458EXPORT_SYMBOL_GPL(uninhibit_secondary_onlining);
459
460static int secondaries_inhibited(void)
461{
462 return atomic_read(&secondary_inhibit_count);
463}
464
465#else /* HOTPLUG_CPU */
466
467#define secondaries_inhibited() 0
468
430#endif 469#endif
431 470
432static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle) 471static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
@@ -445,6 +484,13 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
445{ 484{
446 int rc, c; 485 int rc, c;
447 486
487 /*
488 * Don't allow secondary threads to come online if inhibited
489 */
490 if (threads_per_core > 1 && secondaries_inhibited() &&
491 cpu % threads_per_core != 0)
492 return -EBUSY;
493
448 if (smp_ops == NULL || 494 if (smp_ops == NULL ||
449 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))) 495 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
450 return -EINVAL; 496 return -EINVAL;
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index cf357a059dd..3ce1f864c2d 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -607,7 +607,7 @@ static void register_nodes(void)
607 607
608int sysfs_add_device_to_node(struct device *dev, int nid) 608int sysfs_add_device_to_node(struct device *dev, int nid)
609{ 609{
610 struct node *node = &node_devices[nid]; 610 struct node *node = node_devices[nid];
611 return sysfs_create_link(&node->dev.kobj, &dev->kobj, 611 return sysfs_create_link(&node->dev.kobj, &dev->kobj,
612 kobject_name(&dev->kobj)); 612 kobject_name(&dev->kobj));
613} 613}
@@ -615,7 +615,7 @@ EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
615 615
616void sysfs_remove_device_from_node(struct device *dev, int nid) 616void sysfs_remove_device_from_node(struct device *dev, int nid)
617{ 617{
618 struct node *node = &node_devices[nid]; 618 struct node *node = node_devices[nid];
619 sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj)); 619 sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj));
620} 620}
621EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); 621EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index ce4cb772dc7..b3b14352b05 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -297,6 +297,8 @@ static u64 vtime_delta(struct task_struct *tsk,
297 u64 now, nowscaled, deltascaled; 297 u64 now, nowscaled, deltascaled;
298 u64 udelta, delta, user_scaled; 298 u64 udelta, delta, user_scaled;
299 299
300 WARN_ON_ONCE(!irqs_disabled());
301
300 now = mftb(); 302 now = mftb();
301 nowscaled = read_spurr(now); 303 nowscaled = read_spurr(now);
302 get_paca()->system_time += now - get_paca()->starttime; 304 get_paca()->system_time += now - get_paca()->starttime;
@@ -355,15 +357,15 @@ void vtime_account_idle(struct task_struct *tsk)
355} 357}
356 358
357/* 359/*
358 * Transfer the user and system times accumulated in the paca 360 * Transfer the user time accumulated in the paca
359 * by the exception entry and exit code to the generic process 361 * by the exception entry and exit code to the generic
360 * user and system time records. 362 * process user time records.
361 * Must be called with interrupts disabled. 363 * Must be called with interrupts disabled.
362 * Assumes that vtime_account() has been called recently 364 * Assumes that vtime_account_system/idle() has been called
363 * (i.e. since the last entry from usermode) so that 365 * recently (i.e. since the last entry from usermode) so that
364 * get_paca()->user_time_scaled is up to date. 366 * get_paca()->user_time_scaled is up to date.
365 */ 367 */
366void account_process_tick(struct task_struct *tsk, int user_tick) 368void vtime_account_user(struct task_struct *tsk)
367{ 369{
368 cputime_t utime, utimescaled; 370 cputime_t utime, utimescaled;
369 371
@@ -375,12 +377,6 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
375 account_user_time(tsk, utime, utimescaled); 377 account_user_time(tsk, utime, utimescaled);
376} 378}
377 379
378void vtime_task_switch(struct task_struct *prev)
379{
380 vtime_account(prev);
381 account_process_tick(prev, 0);
382}
383
384#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */ 380#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */
385#define calc_cputime_factors() 381#define calc_cputime_factors()
386#endif 382#endif
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index d2d46d1014f..bc77834dbf4 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -64,6 +64,8 @@ int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
64 autask->saved_trap_nr = current->thread.trap_nr; 64 autask->saved_trap_nr = current->thread.trap_nr;
65 current->thread.trap_nr = UPROBE_TRAP_NR; 65 current->thread.trap_nr = UPROBE_TRAP_NR;
66 regs->nip = current->utask->xol_vaddr; 66 regs->nip = current->utask->xol_vaddr;
67
68 user_enable_single_step(current);
67 return 0; 69 return 0;
68} 70}
69 71
@@ -119,6 +121,8 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
119 * to be executed. 121 * to be executed.
120 */ 122 */
121 regs->nip = utask->vaddr + MAX_UINSN_BYTES; 123 regs->nip = utask->vaddr + MAX_UINSN_BYTES;
124
125 user_disable_single_step(current);
122 return 0; 126 return 0;
123} 127}
124 128
@@ -162,6 +166,8 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
162 166
163 current->thread.trap_nr = utask->autask.saved_trap_nr; 167 current->thread.trap_nr = utask->autask.saved_trap_nr;
164 instruction_pointer_set(regs, utask->vaddr); 168 instruction_pointer_set(regs, utask->vaddr);
169
170 user_disable_single_step(current);
165} 171}
166 172
167/* 173/*
diff --git a/arch/powerpc/kvm/44x.c b/arch/powerpc/kvm/44x.c
index 50e7dbc7356..3d7fd21c65f 100644
--- a/arch/powerpc/kvm/44x.c
+++ b/arch/powerpc/kvm/44x.c
@@ -83,6 +83,7 @@ int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
83 vcpu_44x->shadow_refs[i].gtlb_index = -1; 83 vcpu_44x->shadow_refs[i].gtlb_index = -1;
84 84
85 vcpu->arch.cpu_type = KVM_CPU_440; 85 vcpu->arch.cpu_type = KVM_CPU_440;
86 vcpu->arch.pvr = mfspr(SPRN_PVR);
86 87
87 return 0; 88 return 0;
88} 89}
diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
index c8c61578fdf..35ec0a8547d 100644
--- a/arch/powerpc/kvm/44x_emulate.c
+++ b/arch/powerpc/kvm/44x_emulate.c
@@ -27,12 +27,70 @@
27#include "booke.h" 27#include "booke.h"
28#include "44x_tlb.h" 28#include "44x_tlb.h"
29 29
30#define XOP_MFDCRX 259
30#define XOP_MFDCR 323 31#define XOP_MFDCR 323
32#define XOP_MTDCRX 387
31#define XOP_MTDCR 451 33#define XOP_MTDCR 451
32#define XOP_TLBSX 914 34#define XOP_TLBSX 914
33#define XOP_ICCCI 966 35#define XOP_ICCCI 966
34#define XOP_TLBWE 978 36#define XOP_TLBWE 978
35 37
38static int emulate_mtdcr(struct kvm_vcpu *vcpu, int rs, int dcrn)
39{
40 /* emulate some access in kernel */
41 switch (dcrn) {
42 case DCRN_CPR0_CONFIG_ADDR:
43 vcpu->arch.cpr0_cfgaddr = kvmppc_get_gpr(vcpu, rs);
44 return EMULATE_DONE;
45 default:
46 vcpu->run->dcr.dcrn = dcrn;
47 vcpu->run->dcr.data = kvmppc_get_gpr(vcpu, rs);
48 vcpu->run->dcr.is_write = 1;
49 vcpu->arch.dcr_is_write = 1;
50 vcpu->arch.dcr_needed = 1;
51 kvmppc_account_exit(vcpu, DCR_EXITS);
52 return EMULATE_DO_DCR;
53 }
54}
55
56static int emulate_mfdcr(struct kvm_vcpu *vcpu, int rt, int dcrn)
57{
58 /* The guest may access CPR0 registers to determine the timebase
59 * frequency, and it must know the real host frequency because it
60 * can directly access the timebase registers.
61 *
62 * It would be possible to emulate those accesses in userspace,
63 * but userspace can really only figure out the end frequency.
64 * We could decompose that into the factors that compute it, but
65 * that's tricky math, and it's easier to just report the real
66 * CPR0 values.
67 */
68 switch (dcrn) {
69 case DCRN_CPR0_CONFIG_ADDR:
70 kvmppc_set_gpr(vcpu, rt, vcpu->arch.cpr0_cfgaddr);
71 break;
72 case DCRN_CPR0_CONFIG_DATA:
73 local_irq_disable();
74 mtdcr(DCRN_CPR0_CONFIG_ADDR,
75 vcpu->arch.cpr0_cfgaddr);
76 kvmppc_set_gpr(vcpu, rt,
77 mfdcr(DCRN_CPR0_CONFIG_DATA));
78 local_irq_enable();
79 break;
80 default:
81 vcpu->run->dcr.dcrn = dcrn;
82 vcpu->run->dcr.data = 0;
83 vcpu->run->dcr.is_write = 0;
84 vcpu->arch.dcr_is_write = 0;
85 vcpu->arch.io_gpr = rt;
86 vcpu->arch.dcr_needed = 1;
87 kvmppc_account_exit(vcpu, DCR_EXITS);
88 return EMULATE_DO_DCR;
89 }
90
91 return EMULATE_DONE;
92}
93
36int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 94int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
37 unsigned int inst, int *advance) 95 unsigned int inst, int *advance)
38{ 96{
@@ -50,55 +108,21 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
50 switch (get_xop(inst)) { 108 switch (get_xop(inst)) {
51 109
52 case XOP_MFDCR: 110 case XOP_MFDCR:
53 /* The guest may access CPR0 registers to determine the timebase 111 emulated = emulate_mfdcr(vcpu, rt, dcrn);
54 * frequency, and it must know the real host frequency because it 112 break;
55 * can directly access the timebase registers.
56 *
57 * It would be possible to emulate those accesses in userspace,
58 * but userspace can really only figure out the end frequency.
59 * We could decompose that into the factors that compute it, but
60 * that's tricky math, and it's easier to just report the real
61 * CPR0 values.
62 */
63 switch (dcrn) {
64 case DCRN_CPR0_CONFIG_ADDR:
65 kvmppc_set_gpr(vcpu, rt, vcpu->arch.cpr0_cfgaddr);
66 break;
67 case DCRN_CPR0_CONFIG_DATA:
68 local_irq_disable();
69 mtdcr(DCRN_CPR0_CONFIG_ADDR,
70 vcpu->arch.cpr0_cfgaddr);
71 kvmppc_set_gpr(vcpu, rt,
72 mfdcr(DCRN_CPR0_CONFIG_DATA));
73 local_irq_enable();
74 break;
75 default:
76 run->dcr.dcrn = dcrn;
77 run->dcr.data = 0;
78 run->dcr.is_write = 0;
79 vcpu->arch.io_gpr = rt;
80 vcpu->arch.dcr_needed = 1;
81 kvmppc_account_exit(vcpu, DCR_EXITS);
82 emulated = EMULATE_DO_DCR;
83 }
84 113
114 case XOP_MFDCRX:
115 emulated = emulate_mfdcr(vcpu, rt,
116 kvmppc_get_gpr(vcpu, ra));
85 break; 117 break;
86 118
87 case XOP_MTDCR: 119 case XOP_MTDCR:
88 /* emulate some access in kernel */ 120 emulated = emulate_mtdcr(vcpu, rs, dcrn);
89 switch (dcrn) { 121 break;
90 case DCRN_CPR0_CONFIG_ADDR:
91 vcpu->arch.cpr0_cfgaddr = kvmppc_get_gpr(vcpu, rs);
92 break;
93 default:
94 run->dcr.dcrn = dcrn;
95 run->dcr.data = kvmppc_get_gpr(vcpu, rs);
96 run->dcr.is_write = 1;
97 vcpu->arch.dcr_needed = 1;
98 kvmppc_account_exit(vcpu, DCR_EXITS);
99 emulated = EMULATE_DO_DCR;
100 }
101 122
123 case XOP_MTDCRX:
124 emulated = emulate_mtdcr(vcpu, rs,
125 kvmppc_get_gpr(vcpu, ra));
102 break; 126 break;
103 127
104 case XOP_TLBWE: 128 case XOP_TLBWE:
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index f4dacb9c57f..4730c953f43 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -20,6 +20,7 @@ config KVM
20 bool 20 bool
21 select PREEMPT_NOTIFIERS 21 select PREEMPT_NOTIFIERS
22 select ANON_INODES 22 select ANON_INODES
23 select HAVE_KVM_EVENTFD
23 24
24config KVM_BOOK3S_HANDLER 25config KVM_BOOK3S_HANDLER
25 bool 26 bool
@@ -36,6 +37,7 @@ config KVM_BOOK3S_64_HANDLER
36config KVM_BOOK3S_PR 37config KVM_BOOK3S_PR
37 bool 38 bool
38 select KVM_MMIO 39 select KVM_MMIO
40 select MMU_NOTIFIER
39 41
40config KVM_BOOK3S_32 42config KVM_BOOK3S_32
41 tristate "KVM support for PowerPC book3s_32 processors" 43 tristate "KVM support for PowerPC book3s_32 processors"
@@ -123,6 +125,7 @@ config KVM_E500V2
123 depends on EXPERIMENTAL && E500 && !PPC_E500MC 125 depends on EXPERIMENTAL && E500 && !PPC_E500MC
124 select KVM 126 select KVM
125 select KVM_MMIO 127 select KVM_MMIO
128 select MMU_NOTIFIER
126 ---help--- 129 ---help---
127 Support running unmodified E500 guest kernels in virtual machines on 130 Support running unmodified E500 guest kernels in virtual machines on
128 E500v2 host processors. 131 E500v2 host processors.
@@ -138,6 +141,7 @@ config KVM_E500MC
138 select KVM 141 select KVM
139 select KVM_MMIO 142 select KVM_MMIO
140 select KVM_BOOKE_HV 143 select KVM_BOOKE_HV
144 select MMU_NOTIFIER
141 ---help--- 145 ---help---
142 Support running unmodified E500MC/E5500 (32-bit) guest kernels in 146 Support running unmodified E500MC/E5500 (32-bit) guest kernels in
143 virtual machines on E500MC/E5500 host processors. 147 virtual machines on E500MC/E5500 host processors.
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index c2a08636e6d..1e473d46322 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -6,7 +6,8 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
6 6
7ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm 7ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
8 8
9common-objs-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o) 9common-objs-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o \
10 eventfd.o)
10 11
11CFLAGS_44x_tlb.o := -I. 12CFLAGS_44x_tlb.o := -I.
12CFLAGS_e500_tlb.o := -I. 13CFLAGS_e500_tlb.o := -I.
@@ -72,10 +73,12 @@ kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HV) := \
72 book3s_hv_rmhandlers.o \ 73 book3s_hv_rmhandlers.o \
73 book3s_hv_rm_mmu.o \ 74 book3s_hv_rm_mmu.o \
74 book3s_64_vio_hv.o \ 75 book3s_64_vio_hv.o \
76 book3s_hv_ras.o \
75 book3s_hv_builtin.o 77 book3s_hv_builtin.o
76 78
77kvm-book3s_64-module-objs := \ 79kvm-book3s_64-module-objs := \
78 ../../../virt/kvm/kvm_main.o \ 80 ../../../virt/kvm/kvm_main.o \
81 ../../../virt/kvm/eventfd.o \
79 powerpc.o \ 82 powerpc.o \
80 emulate.o \ 83 emulate.o \
81 book3s.o \ 84 book3s.o \
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 3f2a8360c85..a4b64528524 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -411,6 +411,15 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
411 return 0; 411 return 0;
412} 412}
413 413
414int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu)
415{
416 return 0;
417}
418
419void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu)
420{
421}
422
414int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 423int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
415{ 424{
416 int i; 425 int i;
@@ -476,6 +485,122 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
476 return -ENOTSUPP; 485 return -ENOTSUPP;
477} 486}
478 487
488int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
489{
490 int r;
491 union kvmppc_one_reg val;
492 int size;
493 long int i;
494
495 size = one_reg_size(reg->id);
496 if (size > sizeof(val))
497 return -EINVAL;
498
499 r = kvmppc_get_one_reg(vcpu, reg->id, &val);
500
501 if (r == -EINVAL) {
502 r = 0;
503 switch (reg->id) {
504 case KVM_REG_PPC_DAR:
505 val = get_reg_val(reg->id, vcpu->arch.shared->dar);
506 break;
507 case KVM_REG_PPC_DSISR:
508 val = get_reg_val(reg->id, vcpu->arch.shared->dsisr);
509 break;
510 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
511 i = reg->id - KVM_REG_PPC_FPR0;
512 val = get_reg_val(reg->id, vcpu->arch.fpr[i]);
513 break;
514 case KVM_REG_PPC_FPSCR:
515 val = get_reg_val(reg->id, vcpu->arch.fpscr);
516 break;
517#ifdef CONFIG_ALTIVEC
518 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
519 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
520 r = -ENXIO;
521 break;
522 }
523 val.vval = vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0];
524 break;
525 case KVM_REG_PPC_VSCR:
526 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
527 r = -ENXIO;
528 break;
529 }
530 val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]);
531 break;
532#endif /* CONFIG_ALTIVEC */
533 default:
534 r = -EINVAL;
535 break;
536 }
537 }
538 if (r)
539 return r;
540
541 if (copy_to_user((char __user *)(unsigned long)reg->addr, &val, size))
542 r = -EFAULT;
543
544 return r;
545}
546
547int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
548{
549 int r;
550 union kvmppc_one_reg val;
551 int size;
552 long int i;
553
554 size = one_reg_size(reg->id);
555 if (size > sizeof(val))
556 return -EINVAL;
557
558 if (copy_from_user(&val, (char __user *)(unsigned long)reg->addr, size))
559 return -EFAULT;
560
561 r = kvmppc_set_one_reg(vcpu, reg->id, &val);
562
563 if (r == -EINVAL) {
564 r = 0;
565 switch (reg->id) {
566 case KVM_REG_PPC_DAR:
567 vcpu->arch.shared->dar = set_reg_val(reg->id, val);
568 break;
569 case KVM_REG_PPC_DSISR:
570 vcpu->arch.shared->dsisr = set_reg_val(reg->id, val);
571 break;
572 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
573 i = reg->id - KVM_REG_PPC_FPR0;
574 vcpu->arch.fpr[i] = set_reg_val(reg->id, val);
575 break;
576 case KVM_REG_PPC_FPSCR:
577 vcpu->arch.fpscr = set_reg_val(reg->id, val);
578 break;
579#ifdef CONFIG_ALTIVEC
580 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
581 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
582 r = -ENXIO;
583 break;
584 }
585 vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0] = val.vval;
586 break;
587 case KVM_REG_PPC_VSCR:
588 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
589 r = -ENXIO;
590 break;
591 }
592 vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val);
593 break;
594#endif /* CONFIG_ALTIVEC */
595 default:
596 r = -EINVAL;
597 break;
598 }
599 }
600
601 return r;
602}
603
479int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, 604int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
480 struct kvm_translation *tr) 605 struct kvm_translation *tr)
481{ 606{
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index b0f625a3334..00e619bf608 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -155,7 +155,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
155 155
156 /* Get host physical address for gpa */ 156 /* Get host physical address for gpa */
157 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT); 157 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT);
158 if (is_error_pfn(hpaddr)) { 158 if (is_error_noslot_pfn(hpaddr)) {
159 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", 159 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n",
160 orig_pte->eaddr); 160 orig_pte->eaddr);
161 r = -EINVAL; 161 r = -EINVAL;
@@ -254,6 +254,7 @@ next_pteg:
254 254
255 kvmppc_mmu_hpte_cache_map(vcpu, pte); 255 kvmppc_mmu_hpte_cache_map(vcpu, pte);
256 256
257 kvm_release_pfn_clean(hpaddr >> PAGE_SHIFT);
257out: 258out:
258 return r; 259 return r;
259} 260}
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index 4d72f9ebc55..ead58e31729 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -93,7 +93,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
93 93
94 /* Get host physical address for gpa */ 94 /* Get host physical address for gpa */
95 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT); 95 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT);
96 if (is_error_pfn(hpaddr)) { 96 if (is_error_noslot_pfn(hpaddr)) {
97 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", orig_pte->eaddr); 97 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", orig_pte->eaddr);
98 r = -EINVAL; 98 r = -EINVAL;
99 goto out; 99 goto out;
@@ -171,6 +171,7 @@ map_again:
171 171
172 kvmppc_mmu_hpte_cache_map(vcpu, pte); 172 kvmppc_mmu_hpte_cache_map(vcpu, pte);
173 } 173 }
174 kvm_release_pfn_clean(hpaddr >> PAGE_SHIFT);
174 175
175out: 176out:
176 return r; 177 return r;
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index d95d11322a1..8cc18abd6dd 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -24,6 +24,9 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/hugetlb.h> 25#include <linux/hugetlb.h>
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/srcu.h>
28#include <linux/anon_inodes.h>
29#include <linux/file.h>
27 30
28#include <asm/tlbflush.h> 31#include <asm/tlbflush.h>
29#include <asm/kvm_ppc.h> 32#include <asm/kvm_ppc.h>
@@ -40,6 +43,11 @@
40/* Power architecture requires HPT is at least 256kB */ 43/* Power architecture requires HPT is at least 256kB */
41#define PPC_MIN_HPT_ORDER 18 44#define PPC_MIN_HPT_ORDER 18
42 45
46static long kvmppc_virtmode_do_h_enter(struct kvm *kvm, unsigned long flags,
47 long pte_index, unsigned long pteh,
48 unsigned long ptel, unsigned long *pte_idx_ret);
49static void kvmppc_rmap_reset(struct kvm *kvm);
50
43long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp) 51long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
44{ 52{
45 unsigned long hpt; 53 unsigned long hpt;
@@ -137,10 +145,11 @@ long kvmppc_alloc_reset_hpt(struct kvm *kvm, u32 *htab_orderp)
137 /* Set the entire HPT to 0, i.e. invalid HPTEs */ 145 /* Set the entire HPT to 0, i.e. invalid HPTEs */
138 memset((void *)kvm->arch.hpt_virt, 0, 1ul << order); 146 memset((void *)kvm->arch.hpt_virt, 0, 1ul << order);
139 /* 147 /*
140 * Set the whole last_vcpu array to an invalid vcpu number. 148 * Reset all the reverse-mapping chains for all memslots
141 * This ensures that each vcpu will flush its TLB on next entry.
142 */ 149 */
143 memset(kvm->arch.last_vcpu, 0xff, sizeof(kvm->arch.last_vcpu)); 150 kvmppc_rmap_reset(kvm);
151 /* Ensure that each vcpu will flush its TLB on next entry. */
152 cpumask_setall(&kvm->arch.need_tlb_flush);
144 *htab_orderp = order; 153 *htab_orderp = order;
145 err = 0; 154 err = 0;
146 } else { 155 } else {
@@ -184,6 +193,7 @@ void kvmppc_map_vrma(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot,
184 unsigned long addr, hash; 193 unsigned long addr, hash;
185 unsigned long psize; 194 unsigned long psize;
186 unsigned long hp0, hp1; 195 unsigned long hp0, hp1;
196 unsigned long idx_ret;
187 long ret; 197 long ret;
188 struct kvm *kvm = vcpu->kvm; 198 struct kvm *kvm = vcpu->kvm;
189 199
@@ -215,7 +225,8 @@ void kvmppc_map_vrma(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot,
215 hash = (hash << 3) + 7; 225 hash = (hash << 3) + 7;
216 hp_v = hp0 | ((addr >> 16) & ~0x7fUL); 226 hp_v = hp0 | ((addr >> 16) & ~0x7fUL);
217 hp_r = hp1 | addr; 227 hp_r = hp1 | addr;
218 ret = kvmppc_virtmode_h_enter(vcpu, H_EXACT, hash, hp_v, hp_r); 228 ret = kvmppc_virtmode_do_h_enter(kvm, H_EXACT, hash, hp_v, hp_r,
229 &idx_ret);
219 if (ret != H_SUCCESS) { 230 if (ret != H_SUCCESS) {
220 pr_err("KVM: map_vrma at %lx failed, ret=%ld\n", 231 pr_err("KVM: map_vrma at %lx failed, ret=%ld\n",
221 addr, ret); 232 addr, ret);
@@ -260,7 +271,7 @@ static void kvmppc_mmu_book3s_64_hv_reset_msr(struct kvm_vcpu *vcpu)
260 271
261/* 272/*
262 * This is called to get a reference to a guest page if there isn't 273 * This is called to get a reference to a guest page if there isn't
263 * one already in the kvm->arch.slot_phys[][] arrays. 274 * one already in the memslot->arch.slot_phys[] array.
264 */ 275 */
265static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn, 276static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn,
266 struct kvm_memory_slot *memslot, 277 struct kvm_memory_slot *memslot,
@@ -275,7 +286,7 @@ static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn,
275 struct vm_area_struct *vma; 286 struct vm_area_struct *vma;
276 unsigned long pfn, i, npages; 287 unsigned long pfn, i, npages;
277 288
278 physp = kvm->arch.slot_phys[memslot->id]; 289 physp = memslot->arch.slot_phys;
279 if (!physp) 290 if (!physp)
280 return -EINVAL; 291 return -EINVAL;
281 if (physp[gfn - memslot->base_gfn]) 292 if (physp[gfn - memslot->base_gfn])
@@ -353,15 +364,10 @@ static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn,
353 return err; 364 return err;
354} 365}
355 366
356/* 367long kvmppc_virtmode_do_h_enter(struct kvm *kvm, unsigned long flags,
357 * We come here on a H_ENTER call from the guest when we are not 368 long pte_index, unsigned long pteh,
358 * using mmu notifiers and we don't have the requested page pinned 369 unsigned long ptel, unsigned long *pte_idx_ret)
359 * already.
360 */
361long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
362 long pte_index, unsigned long pteh, unsigned long ptel)
363{ 370{
364 struct kvm *kvm = vcpu->kvm;
365 unsigned long psize, gpa, gfn; 371 unsigned long psize, gpa, gfn;
366 struct kvm_memory_slot *memslot; 372 struct kvm_memory_slot *memslot;
367 long ret; 373 long ret;
@@ -389,8 +395,8 @@ long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
389 do_insert: 395 do_insert:
390 /* Protect linux PTE lookup from page table destruction */ 396 /* Protect linux PTE lookup from page table destruction */
391 rcu_read_lock_sched(); /* this disables preemption too */ 397 rcu_read_lock_sched(); /* this disables preemption too */
392 vcpu->arch.pgdir = current->mm->pgd; 398 ret = kvmppc_do_h_enter(kvm, flags, pte_index, pteh, ptel,
393 ret = kvmppc_h_enter(vcpu, flags, pte_index, pteh, ptel); 399 current->mm->pgd, false, pte_idx_ret);
394 rcu_read_unlock_sched(); 400 rcu_read_unlock_sched();
395 if (ret == H_TOO_HARD) { 401 if (ret == H_TOO_HARD) {
396 /* this can't happen */ 402 /* this can't happen */
@@ -401,6 +407,19 @@ long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
401 407
402} 408}
403 409
410/*
411 * We come here on a H_ENTER call from the guest when we are not
412 * using mmu notifiers and we don't have the requested page pinned
413 * already.
414 */
415long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
416 long pte_index, unsigned long pteh,
417 unsigned long ptel)
418{
419 return kvmppc_virtmode_do_h_enter(vcpu->kvm, flags, pte_index,
420 pteh, ptel, &vcpu->arch.gpr[4]);
421}
422
404static struct kvmppc_slb *kvmppc_mmu_book3s_hv_find_slbe(struct kvm_vcpu *vcpu, 423static struct kvmppc_slb *kvmppc_mmu_book3s_hv_find_slbe(struct kvm_vcpu *vcpu,
405 gva_t eaddr) 424 gva_t eaddr)
406{ 425{
@@ -570,7 +589,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
570 struct kvm *kvm = vcpu->kvm; 589 struct kvm *kvm = vcpu->kvm;
571 unsigned long *hptep, hpte[3], r; 590 unsigned long *hptep, hpte[3], r;
572 unsigned long mmu_seq, psize, pte_size; 591 unsigned long mmu_seq, psize, pte_size;
573 unsigned long gfn, hva, pfn; 592 unsigned long gpa, gfn, hva, pfn;
574 struct kvm_memory_slot *memslot; 593 struct kvm_memory_slot *memslot;
575 unsigned long *rmap; 594 unsigned long *rmap;
576 struct revmap_entry *rev; 595 struct revmap_entry *rev;
@@ -608,15 +627,14 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
608 627
609 /* Translate the logical address and get the page */ 628 /* Translate the logical address and get the page */
610 psize = hpte_page_size(hpte[0], r); 629 psize = hpte_page_size(hpte[0], r);
611 gfn = hpte_rpn(r, psize); 630 gpa = (r & HPTE_R_RPN & ~(psize - 1)) | (ea & (psize - 1));
631 gfn = gpa >> PAGE_SHIFT;
612 memslot = gfn_to_memslot(kvm, gfn); 632 memslot = gfn_to_memslot(kvm, gfn);
613 633
614 /* No memslot means it's an emulated MMIO region */ 634 /* No memslot means it's an emulated MMIO region */
615 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID)) { 635 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID))
616 unsigned long gpa = (gfn << PAGE_SHIFT) | (ea & (psize - 1));
617 return kvmppc_hv_emulate_mmio(run, vcpu, gpa, ea, 636 return kvmppc_hv_emulate_mmio(run, vcpu, gpa, ea,
618 dsisr & DSISR_ISSTORE); 637 dsisr & DSISR_ISSTORE);
619 }
620 638
621 if (!kvm->arch.using_mmu_notifiers) 639 if (!kvm->arch.using_mmu_notifiers)
622 return -EFAULT; /* should never get here */ 640 return -EFAULT; /* should never get here */
@@ -710,7 +728,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
710 728
711 /* Check if we might have been invalidated; let the guest retry if so */ 729 /* Check if we might have been invalidated; let the guest retry if so */
712 ret = RESUME_GUEST; 730 ret = RESUME_GUEST;
713 if (mmu_notifier_retry(vcpu, mmu_seq)) { 731 if (mmu_notifier_retry(vcpu->kvm, mmu_seq)) {
714 unlock_rmap(rmap); 732 unlock_rmap(rmap);
715 goto out_unlock; 733 goto out_unlock;
716 } 734 }
@@ -756,6 +774,25 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
756 goto out_put; 774 goto out_put;
757} 775}
758 776
777static void kvmppc_rmap_reset(struct kvm *kvm)
778{
779 struct kvm_memslots *slots;
780 struct kvm_memory_slot *memslot;
781 int srcu_idx;
782
783 srcu_idx = srcu_read_lock(&kvm->srcu);
784 slots = kvm->memslots;
785 kvm_for_each_memslot(memslot, slots) {
786 /*
787 * This assumes it is acceptable to lose reference and
788 * change bits across a reset.
789 */
790 memset(memslot->arch.rmap, 0,
791 memslot->npages * sizeof(*memslot->arch.rmap));
792 }
793 srcu_read_unlock(&kvm->srcu, srcu_idx);
794}
795
759static int kvm_handle_hva_range(struct kvm *kvm, 796static int kvm_handle_hva_range(struct kvm *kvm,
760 unsigned long start, 797 unsigned long start,
761 unsigned long end, 798 unsigned long end,
@@ -850,7 +887,8 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
850 psize = hpte_page_size(hptep[0], ptel); 887 psize = hpte_page_size(hptep[0], ptel);
851 if ((hptep[0] & HPTE_V_VALID) && 888 if ((hptep[0] & HPTE_V_VALID) &&
852 hpte_rpn(ptel, psize) == gfn) { 889 hpte_rpn(ptel, psize) == gfn) {
853 hptep[0] |= HPTE_V_ABSENT; 890 if (kvm->arch.using_mmu_notifiers)
891 hptep[0] |= HPTE_V_ABSENT;
854 kvmppc_invalidate_hpte(kvm, hptep, i); 892 kvmppc_invalidate_hpte(kvm, hptep, i);
855 /* Harvest R and C */ 893 /* Harvest R and C */
856 rcbits = hptep[1] & (HPTE_R_R | HPTE_R_C); 894 rcbits = hptep[1] & (HPTE_R_R | HPTE_R_C);
@@ -877,6 +915,28 @@ int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
877 return 0; 915 return 0;
878} 916}
879 917
918void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot)
919{
920 unsigned long *rmapp;
921 unsigned long gfn;
922 unsigned long n;
923
924 rmapp = memslot->arch.rmap;
925 gfn = memslot->base_gfn;
926 for (n = memslot->npages; n; --n) {
927 /*
928 * Testing the present bit without locking is OK because
929 * the memslot has been marked invalid already, and hence
930 * no new HPTEs referencing this page can be created,
931 * thus the present bit can't go from 0 to 1.
932 */
933 if (*rmapp & KVMPPC_RMAP_PRESENT)
934 kvm_unmap_rmapp(kvm, rmapp, gfn);
935 ++rmapp;
936 ++gfn;
937 }
938}
939
880static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 940static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
881 unsigned long gfn) 941 unsigned long gfn)
882{ 942{
@@ -1030,16 +1090,16 @@ static int kvm_test_clear_dirty(struct kvm *kvm, unsigned long *rmapp)
1030 return ret; 1090 return ret;
1031} 1091}
1032 1092
1033long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot) 1093long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot,
1094 unsigned long *map)
1034{ 1095{
1035 unsigned long i; 1096 unsigned long i;
1036 unsigned long *rmapp, *map; 1097 unsigned long *rmapp;
1037 1098
1038 preempt_disable(); 1099 preempt_disable();
1039 rmapp = memslot->arch.rmap; 1100 rmapp = memslot->arch.rmap;
1040 map = memslot->dirty_bitmap;
1041 for (i = 0; i < memslot->npages; ++i) { 1101 for (i = 0; i < memslot->npages; ++i) {
1042 if (kvm_test_clear_dirty(kvm, rmapp)) 1102 if (kvm_test_clear_dirty(kvm, rmapp) && map)
1043 __set_bit_le(i, map); 1103 __set_bit_le(i, map);
1044 ++rmapp; 1104 ++rmapp;
1045 } 1105 }
@@ -1057,20 +1117,22 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
1057 unsigned long hva, psize, offset; 1117 unsigned long hva, psize, offset;
1058 unsigned long pa; 1118 unsigned long pa;
1059 unsigned long *physp; 1119 unsigned long *physp;
1120 int srcu_idx;
1060 1121
1122 srcu_idx = srcu_read_lock(&kvm->srcu);
1061 memslot = gfn_to_memslot(kvm, gfn); 1123 memslot = gfn_to_memslot(kvm, gfn);
1062 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID)) 1124 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID))
1063 return NULL; 1125 goto err;
1064 if (!kvm->arch.using_mmu_notifiers) { 1126 if (!kvm->arch.using_mmu_notifiers) {
1065 physp = kvm->arch.slot_phys[memslot->id]; 1127 physp = memslot->arch.slot_phys;
1066 if (!physp) 1128 if (!physp)
1067 return NULL; 1129 goto err;
1068 physp += gfn - memslot->base_gfn; 1130 physp += gfn - memslot->base_gfn;
1069 pa = *physp; 1131 pa = *physp;
1070 if (!pa) { 1132 if (!pa) {
1071 if (kvmppc_get_guest_page(kvm, gfn, memslot, 1133 if (kvmppc_get_guest_page(kvm, gfn, memslot,
1072 PAGE_SIZE) < 0) 1134 PAGE_SIZE) < 0)
1073 return NULL; 1135 goto err;
1074 pa = *physp; 1136 pa = *physp;
1075 } 1137 }
1076 page = pfn_to_page(pa >> PAGE_SHIFT); 1138 page = pfn_to_page(pa >> PAGE_SHIFT);
@@ -1079,9 +1141,11 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
1079 hva = gfn_to_hva_memslot(memslot, gfn); 1141 hva = gfn_to_hva_memslot(memslot, gfn);
1080 npages = get_user_pages_fast(hva, 1, 1, pages); 1142 npages = get_user_pages_fast(hva, 1, 1, pages);
1081 if (npages < 1) 1143 if (npages < 1)
1082 return NULL; 1144 goto err;
1083 page = pages[0]; 1145 page = pages[0];
1084 } 1146 }
1147 srcu_read_unlock(&kvm->srcu, srcu_idx);
1148
1085 psize = PAGE_SIZE; 1149 psize = PAGE_SIZE;
1086 if (PageHuge(page)) { 1150 if (PageHuge(page)) {
1087 page = compound_head(page); 1151 page = compound_head(page);
@@ -1091,6 +1155,10 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
1091 if (nb_ret) 1155 if (nb_ret)
1092 *nb_ret = psize - offset; 1156 *nb_ret = psize - offset;
1093 return page_address(page) + offset; 1157 return page_address(page) + offset;
1158
1159 err:
1160 srcu_read_unlock(&kvm->srcu, srcu_idx);
1161 return NULL;
1094} 1162}
1095 1163
1096void kvmppc_unpin_guest_page(struct kvm *kvm, void *va) 1164void kvmppc_unpin_guest_page(struct kvm *kvm, void *va)
@@ -1100,6 +1168,348 @@ void kvmppc_unpin_guest_page(struct kvm *kvm, void *va)
1100 put_page(page); 1168 put_page(page);
1101} 1169}
1102 1170
1171/*
1172 * Functions for reading and writing the hash table via reads and
1173 * writes on a file descriptor.
1174 *
1175 * Reads return the guest view of the hash table, which has to be
1176 * pieced together from the real hash table and the guest_rpte
1177 * values in the revmap array.
1178 *
1179 * On writes, each HPTE written is considered in turn, and if it
1180 * is valid, it is written to the HPT as if an H_ENTER with the
1181 * exact flag set was done. When the invalid count is non-zero
1182 * in the header written to the stream, the kernel will make
1183 * sure that that many HPTEs are invalid, and invalidate them
1184 * if not.
1185 */
1186
1187struct kvm_htab_ctx {
1188 unsigned long index;
1189 unsigned long flags;
1190 struct kvm *kvm;
1191 int first_pass;
1192};
1193
1194#define HPTE_SIZE (2 * sizeof(unsigned long))
1195
1196static long record_hpte(unsigned long flags, unsigned long *hptp,
1197 unsigned long *hpte, struct revmap_entry *revp,
1198 int want_valid, int first_pass)
1199{
1200 unsigned long v, r;
1201 int ok = 1;
1202 int valid, dirty;
1203
1204 /* Unmodified entries are uninteresting except on the first pass */
1205 dirty = !!(revp->guest_rpte & HPTE_GR_MODIFIED);
1206 if (!first_pass && !dirty)
1207 return 0;
1208
1209 valid = 0;
1210 if (hptp[0] & (HPTE_V_VALID | HPTE_V_ABSENT)) {
1211 valid = 1;
1212 if ((flags & KVM_GET_HTAB_BOLTED_ONLY) &&
1213 !(hptp[0] & HPTE_V_BOLTED))
1214 valid = 0;
1215 }
1216 if (valid != want_valid)
1217 return 0;
1218
1219 v = r = 0;
1220 if (valid || dirty) {
1221 /* lock the HPTE so it's stable and read it */
1222 preempt_disable();
1223 while (!try_lock_hpte(hptp, HPTE_V_HVLOCK))
1224 cpu_relax();
1225 v = hptp[0];
1226 if (v & HPTE_V_ABSENT) {
1227 v &= ~HPTE_V_ABSENT;
1228 v |= HPTE_V_VALID;
1229 }
1230 /* re-evaluate valid and dirty from synchronized HPTE value */
1231 valid = !!(v & HPTE_V_VALID);
1232 if ((flags & KVM_GET_HTAB_BOLTED_ONLY) && !(v & HPTE_V_BOLTED))
1233 valid = 0;
1234 r = revp->guest_rpte | (hptp[1] & (HPTE_R_R | HPTE_R_C));
1235 dirty = !!(revp->guest_rpte & HPTE_GR_MODIFIED);
1236 /* only clear modified if this is the right sort of entry */
1237 if (valid == want_valid && dirty) {
1238 r &= ~HPTE_GR_MODIFIED;
1239 revp->guest_rpte = r;
1240 }
1241 asm volatile(PPC_RELEASE_BARRIER "" : : : "memory");
1242 hptp[0] &= ~HPTE_V_HVLOCK;
1243 preempt_enable();
1244 if (!(valid == want_valid && (first_pass || dirty)))
1245 ok = 0;
1246 }
1247 hpte[0] = v;
1248 hpte[1] = r;
1249 return ok;
1250}
1251
1252static ssize_t kvm_htab_read(struct file *file, char __user *buf,
1253 size_t count, loff_t *ppos)
1254{
1255 struct kvm_htab_ctx *ctx = file->private_data;
1256 struct kvm *kvm = ctx->kvm;
1257 struct kvm_get_htab_header hdr;
1258 unsigned long *hptp;
1259 struct revmap_entry *revp;
1260 unsigned long i, nb, nw;
1261 unsigned long __user *lbuf;
1262 struct kvm_get_htab_header __user *hptr;
1263 unsigned long flags;
1264 int first_pass;
1265 unsigned long hpte[2];
1266
1267 if (!access_ok(VERIFY_WRITE, buf, count))
1268 return -EFAULT;
1269
1270 first_pass = ctx->first_pass;
1271 flags = ctx->flags;
1272
1273 i = ctx->index;
1274 hptp = (unsigned long *)(kvm->arch.hpt_virt + (i * HPTE_SIZE));
1275 revp = kvm->arch.revmap + i;
1276 lbuf = (unsigned long __user *)buf;
1277
1278 nb = 0;
1279 while (nb + sizeof(hdr) + HPTE_SIZE < count) {
1280 /* Initialize header */
1281 hptr = (struct kvm_get_htab_header __user *)buf;
1282 hdr.n_valid = 0;
1283 hdr.n_invalid = 0;
1284 nw = nb;
1285 nb += sizeof(hdr);
1286 lbuf = (unsigned long __user *)(buf + sizeof(hdr));
1287
1288 /* Skip uninteresting entries, i.e. clean on not-first pass */
1289 if (!first_pass) {
1290 while (i < kvm->arch.hpt_npte &&
1291 !(revp->guest_rpte & HPTE_GR_MODIFIED)) {
1292 ++i;
1293 hptp += 2;
1294 ++revp;
1295 }
1296 }
1297 hdr.index = i;
1298
1299 /* Grab a series of valid entries */
1300 while (i < kvm->arch.hpt_npte &&
1301 hdr.n_valid < 0xffff &&
1302 nb + HPTE_SIZE < count &&
1303 record_hpte(flags, hptp, hpte, revp, 1, first_pass)) {
1304 /* valid entry, write it out */
1305 ++hdr.n_valid;
1306 if (__put_user(hpte[0], lbuf) ||
1307 __put_user(hpte[1], lbuf + 1))
1308 return -EFAULT;
1309 nb += HPTE_SIZE;
1310 lbuf += 2;
1311 ++i;
1312 hptp += 2;
1313 ++revp;
1314 }
1315 /* Now skip invalid entries while we can */
1316 while (i < kvm->arch.hpt_npte &&
1317 hdr.n_invalid < 0xffff &&
1318 record_hpte(flags, hptp, hpte, revp, 0, first_pass)) {
1319 /* found an invalid entry */
1320 ++hdr.n_invalid;
1321 ++i;
1322 hptp += 2;
1323 ++revp;
1324 }
1325
1326 if (hdr.n_valid || hdr.n_invalid) {
1327 /* write back the header */
1328 if (__copy_to_user(hptr, &hdr, sizeof(hdr)))
1329 return -EFAULT;
1330 nw = nb;
1331 buf = (char __user *)lbuf;
1332 } else {
1333 nb = nw;
1334 }
1335
1336 /* Check if we've wrapped around the hash table */
1337 if (i >= kvm->arch.hpt_npte) {
1338 i = 0;
1339 ctx->first_pass = 0;
1340 break;
1341 }
1342 }
1343
1344 ctx->index = i;
1345
1346 return nb;
1347}
1348
1349static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
1350 size_t count, loff_t *ppos)
1351{
1352 struct kvm_htab_ctx *ctx = file->private_data;
1353 struct kvm *kvm = ctx->kvm;
1354 struct kvm_get_htab_header hdr;
1355 unsigned long i, j;
1356 unsigned long v, r;
1357 unsigned long __user *lbuf;
1358 unsigned long *hptp;
1359 unsigned long tmp[2];
1360 ssize_t nb;
1361 long int err, ret;
1362 int rma_setup;
1363
1364 if (!access_ok(VERIFY_READ, buf, count))
1365 return -EFAULT;
1366
1367 /* lock out vcpus from running while we're doing this */
1368 mutex_lock(&kvm->lock);
1369 rma_setup = kvm->arch.rma_setup_done;
1370 if (rma_setup) {
1371 kvm->arch.rma_setup_done = 0; /* temporarily */
1372 /* order rma_setup_done vs. vcpus_running */
1373 smp_mb();
1374 if (atomic_read(&kvm->arch.vcpus_running)) {
1375 kvm->arch.rma_setup_done = 1;
1376 mutex_unlock(&kvm->lock);
1377 return -EBUSY;
1378 }
1379 }
1380
1381 err = 0;
1382 for (nb = 0; nb + sizeof(hdr) <= count; ) {
1383 err = -EFAULT;
1384 if (__copy_from_user(&hdr, buf, sizeof(hdr)))
1385 break;
1386
1387 err = 0;
1388 if (nb + hdr.n_valid * HPTE_SIZE > count)
1389 break;
1390
1391 nb += sizeof(hdr);
1392 buf += sizeof(hdr);
1393
1394 err = -EINVAL;
1395 i = hdr.index;
1396 if (i >= kvm->arch.hpt_npte ||
1397 i + hdr.n_valid + hdr.n_invalid > kvm->arch.hpt_npte)
1398 break;
1399
1400 hptp = (unsigned long *)(kvm->arch.hpt_virt + (i * HPTE_SIZE));
1401 lbuf = (unsigned long __user *)buf;
1402 for (j = 0; j < hdr.n_valid; ++j) {
1403 err = -EFAULT;
1404 if (__get_user(v, lbuf) || __get_user(r, lbuf + 1))
1405 goto out;
1406 err = -EINVAL;
1407 if (!(v & HPTE_V_VALID))
1408 goto out;
1409 lbuf += 2;
1410 nb += HPTE_SIZE;
1411
1412 if (hptp[0] & (HPTE_V_VALID | HPTE_V_ABSENT))
1413 kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
1414 err = -EIO;
1415 ret = kvmppc_virtmode_do_h_enter(kvm, H_EXACT, i, v, r,
1416 tmp);
1417 if (ret != H_SUCCESS) {
1418 pr_err("kvm_htab_write ret %ld i=%ld v=%lx "
1419 "r=%lx\n", ret, i, v, r);
1420 goto out;
1421 }
1422 if (!rma_setup && is_vrma_hpte(v)) {
1423 unsigned long psize = hpte_page_size(v, r);
1424 unsigned long senc = slb_pgsize_encoding(psize);
1425 unsigned long lpcr;
1426
1427 kvm->arch.vrma_slb_v = senc | SLB_VSID_B_1T |
1428 (VRMA_VSID << SLB_VSID_SHIFT_1T);
1429 lpcr = kvm->arch.lpcr & ~LPCR_VRMASD;
1430 lpcr |= senc << (LPCR_VRMASD_SH - 4);
1431 kvm->arch.lpcr = lpcr;
1432 rma_setup = 1;
1433 }
1434 ++i;
1435 hptp += 2;
1436 }
1437
1438 for (j = 0; j < hdr.n_invalid; ++j) {
1439 if (hptp[0] & (HPTE_V_VALID | HPTE_V_ABSENT))
1440 kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
1441 ++i;
1442 hptp += 2;
1443 }
1444 err = 0;
1445 }
1446
1447 out:
1448 /* Order HPTE updates vs. rma_setup_done */
1449 smp_wmb();
1450 kvm->arch.rma_setup_done = rma_setup;
1451 mutex_unlock(&kvm->lock);
1452
1453 if (err)
1454 return err;
1455 return nb;
1456}
1457
1458static int kvm_htab_release(struct inode *inode, struct file *filp)
1459{
1460 struct kvm_htab_ctx *ctx = filp->private_data;
1461
1462 filp->private_data = NULL;
1463 if (!(ctx->flags & KVM_GET_HTAB_WRITE))
1464 atomic_dec(&ctx->kvm->arch.hpte_mod_interest);
1465 kvm_put_kvm(ctx->kvm);
1466 kfree(ctx);
1467 return 0;
1468}
1469
1470static struct file_operations kvm_htab_fops = {
1471 .read = kvm_htab_read,
1472 .write = kvm_htab_write,
1473 .llseek = default_llseek,
1474 .release = kvm_htab_release,
1475};
1476
1477int kvm_vm_ioctl_get_htab_fd(struct kvm *kvm, struct kvm_get_htab_fd *ghf)
1478{
1479 int ret;
1480 struct kvm_htab_ctx *ctx;
1481 int rwflag;
1482
1483 /* reject flags we don't recognize */
1484 if (ghf->flags & ~(KVM_GET_HTAB_BOLTED_ONLY | KVM_GET_HTAB_WRITE))
1485 return -EINVAL;
1486 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
1487 if (!ctx)
1488 return -ENOMEM;
1489 kvm_get_kvm(kvm);
1490 ctx->kvm = kvm;
1491 ctx->index = ghf->start_index;
1492 ctx->flags = ghf->flags;
1493 ctx->first_pass = 1;
1494
1495 rwflag = (ghf->flags & KVM_GET_HTAB_WRITE) ? O_WRONLY : O_RDONLY;
1496 ret = anon_inode_getfd("kvm-htab", &kvm_htab_fops, ctx, rwflag);
1497 if (ret < 0) {
1498 kvm_put_kvm(kvm);
1499 return ret;
1500 }
1501
1502 if (rwflag == O_RDONLY) {
1503 mutex_lock(&kvm->slots_lock);
1504 atomic_inc(&kvm->arch.hpte_mod_interest);
1505 /* make sure kvmppc_do_h_enter etc. see the increment */
1506 synchronize_srcu_expedited(&kvm->srcu);
1507 mutex_unlock(&kvm->slots_lock);
1508 }
1509
1510 return ret;
1511}
1512
1103void kvmppc_mmu_book3s_hv_init(struct kvm_vcpu *vcpu) 1513void kvmppc_mmu_book3s_hv_init(struct kvm_vcpu *vcpu)
1104{ 1514{
1105 struct kvmppc_mmu *mmu = &vcpu->arch.mmu; 1515 struct kvmppc_mmu *mmu = &vcpu->arch.mmu;
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index b9a989dc76c..d31a716f7f2 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -22,6 +22,7 @@
22#include <asm/kvm_book3s.h> 22#include <asm/kvm_book3s.h>
23#include <asm/reg.h> 23#include <asm/reg.h>
24#include <asm/switch_to.h> 24#include <asm/switch_to.h>
25#include <asm/time.h>
25 26
26#define OP_19_XOP_RFID 18 27#define OP_19_XOP_RFID 18
27#define OP_19_XOP_RFI 50 28#define OP_19_XOP_RFI 50
@@ -395,6 +396,12 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
395 (mfmsr() & MSR_HV)) 396 (mfmsr() & MSR_HV))
396 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; 397 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
397 break; 398 break;
399 case SPRN_PURR:
400 to_book3s(vcpu)->purr_offset = spr_val - get_tb();
401 break;
402 case SPRN_SPURR:
403 to_book3s(vcpu)->spurr_offset = spr_val - get_tb();
404 break;
398 case SPRN_GQR0: 405 case SPRN_GQR0:
399 case SPRN_GQR1: 406 case SPRN_GQR1:
400 case SPRN_GQR2: 407 case SPRN_GQR2:
@@ -412,6 +419,7 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
412 case SPRN_CTRLF: 419 case SPRN_CTRLF:
413 case SPRN_CTRLT: 420 case SPRN_CTRLT:
414 case SPRN_L2CR: 421 case SPRN_L2CR:
422 case SPRN_DSCR:
415 case SPRN_MMCR0_GEKKO: 423 case SPRN_MMCR0_GEKKO:
416 case SPRN_MMCR1_GEKKO: 424 case SPRN_MMCR1_GEKKO:
417 case SPRN_PMC1_GEKKO: 425 case SPRN_PMC1_GEKKO:
@@ -483,9 +491,15 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
483 *spr_val = to_book3s(vcpu)->hid[5]; 491 *spr_val = to_book3s(vcpu)->hid[5];
484 break; 492 break;
485 case SPRN_CFAR: 493 case SPRN_CFAR:
486 case SPRN_PURR: 494 case SPRN_DSCR:
487 *spr_val = 0; 495 *spr_val = 0;
488 break; 496 break;
497 case SPRN_PURR:
498 *spr_val = get_tb() + to_book3s(vcpu)->purr_offset;
499 break;
500 case SPRN_SPURR:
501 *spr_val = get_tb() + to_book3s(vcpu)->purr_offset;
502 break;
489 case SPRN_GQR0: 503 case SPRN_GQR0:
490 case SPRN_GQR1: 504 case SPRN_GQR1:
491 case SPRN_GQR2: 505 case SPRN_GQR2:
diff --git a/arch/powerpc/kvm/book3s_exports.c b/arch/powerpc/kvm/book3s_exports.c
index a150817d6d4..7057a02f090 100644
--- a/arch/powerpc/kvm/book3s_exports.c
+++ b/arch/powerpc/kvm/book3s_exports.c
@@ -28,8 +28,5 @@ EXPORT_SYMBOL_GPL(kvmppc_load_up_fpu);
28#ifdef CONFIG_ALTIVEC 28#ifdef CONFIG_ALTIVEC
29EXPORT_SYMBOL_GPL(kvmppc_load_up_altivec); 29EXPORT_SYMBOL_GPL(kvmppc_load_up_altivec);
30#endif 30#endif
31#ifdef CONFIG_VSX
32EXPORT_SYMBOL_GPL(kvmppc_load_up_vsx);
33#endif
34#endif 31#endif
35 32
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 721d4603a23..71d0c90b62b 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -30,6 +30,7 @@
30#include <linux/cpumask.h> 30#include <linux/cpumask.h>
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 34
34#include <asm/reg.h> 35#include <asm/reg.h>
35#include <asm/cputable.h> 36#include <asm/cputable.h>
@@ -46,6 +47,7 @@
46#include <asm/page.h> 47#include <asm/page.h>
47#include <asm/hvcall.h> 48#include <asm/hvcall.h>
48#include <asm/switch_to.h> 49#include <asm/switch_to.h>
50#include <asm/smp.h>
49#include <linux/gfp.h> 51#include <linux/gfp.h>
50#include <linux/vmalloc.h> 52#include <linux/vmalloc.h>
51#include <linux/highmem.h> 53#include <linux/highmem.h>
@@ -55,25 +57,77 @@
55/* #define EXIT_DEBUG_SIMPLE */ 57/* #define EXIT_DEBUG_SIMPLE */
56/* #define EXIT_DEBUG_INT */ 58/* #define EXIT_DEBUG_INT */
57 59
60/* Used to indicate that a guest page fault needs to be handled */
61#define RESUME_PAGE_FAULT (RESUME_GUEST | RESUME_FLAG_ARCH1)
62
63/* Used as a "null" value for timebase values */
64#define TB_NIL (~(u64)0)
65
58static void kvmppc_end_cede(struct kvm_vcpu *vcpu); 66static void kvmppc_end_cede(struct kvm_vcpu *vcpu);
59static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu); 67static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu);
60 68
69/*
70 * We use the vcpu_load/put functions to measure stolen time.
71 * Stolen time is counted as time when either the vcpu is able to
72 * run as part of a virtual core, but the task running the vcore
73 * is preempted or sleeping, or when the vcpu needs something done
74 * in the kernel by the task running the vcpu, but that task is
75 * preempted or sleeping. Those two things have to be counted
76 * separately, since one of the vcpu tasks will take on the job
77 * of running the core, and the other vcpu tasks in the vcore will
78 * sleep waiting for it to do that, but that sleep shouldn't count
79 * as stolen time.
80 *
81 * Hence we accumulate stolen time when the vcpu can run as part of
82 * a vcore using vc->stolen_tb, and the stolen time when the vcpu
83 * needs its task to do other things in the kernel (for example,
84 * service a page fault) in busy_stolen. We don't accumulate
85 * stolen time for a vcore when it is inactive, or for a vcpu
86 * when it is in state RUNNING or NOTREADY. NOTREADY is a bit of
87 * a misnomer; it means that the vcpu task is not executing in
88 * the KVM_VCPU_RUN ioctl, i.e. it is in userspace or elsewhere in
89 * the kernel. We don't have any way of dividing up that time
90 * between time that the vcpu is genuinely stopped, time that
91 * the task is actively working on behalf of the vcpu, and time
92 * that the task is preempted, so we don't count any of it as
93 * stolen.
94 *
95 * Updates to busy_stolen are protected by arch.tbacct_lock;
96 * updates to vc->stolen_tb are protected by the arch.tbacct_lock
97 * of the vcpu that has taken responsibility for running the vcore
98 * (i.e. vc->runner). The stolen times are measured in units of
99 * timebase ticks. (Note that the != TB_NIL checks below are
100 * purely defensive; they should never fail.)
101 */
102
61void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 103void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
62{ 104{
63 struct kvmppc_vcore *vc = vcpu->arch.vcore; 105 struct kvmppc_vcore *vc = vcpu->arch.vcore;
64 106
65 local_paca->kvm_hstate.kvm_vcpu = vcpu; 107 spin_lock(&vcpu->arch.tbacct_lock);
66 local_paca->kvm_hstate.kvm_vcore = vc; 108 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE &&
67 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE) 109 vc->preempt_tb != TB_NIL) {
68 vc->stolen_tb += mftb() - vc->preempt_tb; 110 vc->stolen_tb += mftb() - vc->preempt_tb;
111 vc->preempt_tb = TB_NIL;
112 }
113 if (vcpu->arch.state == KVMPPC_VCPU_BUSY_IN_HOST &&
114 vcpu->arch.busy_preempt != TB_NIL) {
115 vcpu->arch.busy_stolen += mftb() - vcpu->arch.busy_preempt;
116 vcpu->arch.busy_preempt = TB_NIL;
117 }
118 spin_unlock(&vcpu->arch.tbacct_lock);
69} 119}
70 120
71void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) 121void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
72{ 122{
73 struct kvmppc_vcore *vc = vcpu->arch.vcore; 123 struct kvmppc_vcore *vc = vcpu->arch.vcore;
74 124
125 spin_lock(&vcpu->arch.tbacct_lock);
75 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE) 126 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE)
76 vc->preempt_tb = mftb(); 127 vc->preempt_tb = mftb();
128 if (vcpu->arch.state == KVMPPC_VCPU_BUSY_IN_HOST)
129 vcpu->arch.busy_preempt = mftb();
130 spin_unlock(&vcpu->arch.tbacct_lock);
77} 131}
78 132
79void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr) 133void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr)
@@ -142,6 +196,22 @@ static void init_vpa(struct kvm_vcpu *vcpu, struct lppaca *vpa)
142 vpa->yield_count = 1; 196 vpa->yield_count = 1;
143} 197}
144 198
199static int set_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *v,
200 unsigned long addr, unsigned long len)
201{
202 /* check address is cacheline aligned */
203 if (addr & (L1_CACHE_BYTES - 1))
204 return -EINVAL;
205 spin_lock(&vcpu->arch.vpa_update_lock);
206 if (v->next_gpa != addr || v->len != len) {
207 v->next_gpa = addr;
208 v->len = addr ? len : 0;
209 v->update_pending = 1;
210 }
211 spin_unlock(&vcpu->arch.vpa_update_lock);
212 return 0;
213}
214
145/* Length for a per-processor buffer is passed in at offset 4 in the buffer */ 215/* Length for a per-processor buffer is passed in at offset 4 in the buffer */
146struct reg_vpa { 216struct reg_vpa {
147 u32 dummy; 217 u32 dummy;
@@ -317,10 +387,16 @@ static void kvmppc_update_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *vpap)
317 387
318static void kvmppc_update_vpas(struct kvm_vcpu *vcpu) 388static void kvmppc_update_vpas(struct kvm_vcpu *vcpu)
319{ 389{
390 if (!(vcpu->arch.vpa.update_pending ||
391 vcpu->arch.slb_shadow.update_pending ||
392 vcpu->arch.dtl.update_pending))
393 return;
394
320 spin_lock(&vcpu->arch.vpa_update_lock); 395 spin_lock(&vcpu->arch.vpa_update_lock);
321 if (vcpu->arch.vpa.update_pending) { 396 if (vcpu->arch.vpa.update_pending) {
322 kvmppc_update_vpa(vcpu, &vcpu->arch.vpa); 397 kvmppc_update_vpa(vcpu, &vcpu->arch.vpa);
323 init_vpa(vcpu, vcpu->arch.vpa.pinned_addr); 398 if (vcpu->arch.vpa.pinned_addr)
399 init_vpa(vcpu, vcpu->arch.vpa.pinned_addr);
324 } 400 }
325 if (vcpu->arch.dtl.update_pending) { 401 if (vcpu->arch.dtl.update_pending) {
326 kvmppc_update_vpa(vcpu, &vcpu->arch.dtl); 402 kvmppc_update_vpa(vcpu, &vcpu->arch.dtl);
@@ -332,24 +408,61 @@ static void kvmppc_update_vpas(struct kvm_vcpu *vcpu)
332 spin_unlock(&vcpu->arch.vpa_update_lock); 408 spin_unlock(&vcpu->arch.vpa_update_lock);
333} 409}
334 410
411/*
412 * Return the accumulated stolen time for the vcore up until `now'.
413 * The caller should hold the vcore lock.
414 */
415static u64 vcore_stolen_time(struct kvmppc_vcore *vc, u64 now)
416{
417 u64 p;
418
419 /*
420 * If we are the task running the vcore, then since we hold
421 * the vcore lock, we can't be preempted, so stolen_tb/preempt_tb
422 * can't be updated, so we don't need the tbacct_lock.
423 * If the vcore is inactive, it can't become active (since we
424 * hold the vcore lock), so the vcpu load/put functions won't
425 * update stolen_tb/preempt_tb, and we don't need tbacct_lock.
426 */
427 if (vc->vcore_state != VCORE_INACTIVE &&
428 vc->runner->arch.run_task != current) {
429 spin_lock(&vc->runner->arch.tbacct_lock);
430 p = vc->stolen_tb;
431 if (vc->preempt_tb != TB_NIL)
432 p += now - vc->preempt_tb;
433 spin_unlock(&vc->runner->arch.tbacct_lock);
434 } else {
435 p = vc->stolen_tb;
436 }
437 return p;
438}
439
335static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu, 440static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
336 struct kvmppc_vcore *vc) 441 struct kvmppc_vcore *vc)
337{ 442{
338 struct dtl_entry *dt; 443 struct dtl_entry *dt;
339 struct lppaca *vpa; 444 struct lppaca *vpa;
340 unsigned long old_stolen; 445 unsigned long stolen;
446 unsigned long core_stolen;
447 u64 now;
341 448
342 dt = vcpu->arch.dtl_ptr; 449 dt = vcpu->arch.dtl_ptr;
343 vpa = vcpu->arch.vpa.pinned_addr; 450 vpa = vcpu->arch.vpa.pinned_addr;
344 old_stolen = vcpu->arch.stolen_logged; 451 now = mftb();
345 vcpu->arch.stolen_logged = vc->stolen_tb; 452 core_stolen = vcore_stolen_time(vc, now);
453 stolen = core_stolen - vcpu->arch.stolen_logged;
454 vcpu->arch.stolen_logged = core_stolen;
455 spin_lock(&vcpu->arch.tbacct_lock);
456 stolen += vcpu->arch.busy_stolen;
457 vcpu->arch.busy_stolen = 0;
458 spin_unlock(&vcpu->arch.tbacct_lock);
346 if (!dt || !vpa) 459 if (!dt || !vpa)
347 return; 460 return;
348 memset(dt, 0, sizeof(struct dtl_entry)); 461 memset(dt, 0, sizeof(struct dtl_entry));
349 dt->dispatch_reason = 7; 462 dt->dispatch_reason = 7;
350 dt->processor_id = vc->pcpu + vcpu->arch.ptid; 463 dt->processor_id = vc->pcpu + vcpu->arch.ptid;
351 dt->timebase = mftb(); 464 dt->timebase = now;
352 dt->enqueue_to_dispatch_time = vc->stolen_tb - old_stolen; 465 dt->enqueue_to_dispatch_time = stolen;
353 dt->srr0 = kvmppc_get_pc(vcpu); 466 dt->srr0 = kvmppc_get_pc(vcpu);
354 dt->srr1 = vcpu->arch.shregs.msr; 467 dt->srr1 = vcpu->arch.shregs.msr;
355 ++dt; 468 ++dt;
@@ -366,13 +479,16 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
366 unsigned long req = kvmppc_get_gpr(vcpu, 3); 479 unsigned long req = kvmppc_get_gpr(vcpu, 3);
367 unsigned long target, ret = H_SUCCESS; 480 unsigned long target, ret = H_SUCCESS;
368 struct kvm_vcpu *tvcpu; 481 struct kvm_vcpu *tvcpu;
482 int idx;
369 483
370 switch (req) { 484 switch (req) {
371 case H_ENTER: 485 case H_ENTER:
486 idx = srcu_read_lock(&vcpu->kvm->srcu);
372 ret = kvmppc_virtmode_h_enter(vcpu, kvmppc_get_gpr(vcpu, 4), 487 ret = kvmppc_virtmode_h_enter(vcpu, kvmppc_get_gpr(vcpu, 4),
373 kvmppc_get_gpr(vcpu, 5), 488 kvmppc_get_gpr(vcpu, 5),
374 kvmppc_get_gpr(vcpu, 6), 489 kvmppc_get_gpr(vcpu, 6),
375 kvmppc_get_gpr(vcpu, 7)); 490 kvmppc_get_gpr(vcpu, 7));
491 srcu_read_unlock(&vcpu->kvm->srcu, idx);
376 break; 492 break;
377 case H_CEDE: 493 case H_CEDE:
378 break; 494 break;
@@ -429,6 +545,17 @@ static int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
429 case BOOK3S_INTERRUPT_PERFMON: 545 case BOOK3S_INTERRUPT_PERFMON:
430 r = RESUME_GUEST; 546 r = RESUME_GUEST;
431 break; 547 break;
548 case BOOK3S_INTERRUPT_MACHINE_CHECK:
549 /*
550 * Deliver a machine check interrupt to the guest.
551 * We have to do this, even if the host has handled the
552 * machine check, because machine checks use SRR0/1 and
553 * the interrupt might have trashed guest state in them.
554 */
555 kvmppc_book3s_queue_irqprio(vcpu,
556 BOOK3S_INTERRUPT_MACHINE_CHECK);
557 r = RESUME_GUEST;
558 break;
432 case BOOK3S_INTERRUPT_PROGRAM: 559 case BOOK3S_INTERRUPT_PROGRAM:
433 { 560 {
434 ulong flags; 561 ulong flags;
@@ -470,12 +597,12 @@ static int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
470 * have been handled already. 597 * have been handled already.
471 */ 598 */
472 case BOOK3S_INTERRUPT_H_DATA_STORAGE: 599 case BOOK3S_INTERRUPT_H_DATA_STORAGE:
473 r = kvmppc_book3s_hv_page_fault(run, vcpu, 600 r = RESUME_PAGE_FAULT;
474 vcpu->arch.fault_dar, vcpu->arch.fault_dsisr);
475 break; 601 break;
476 case BOOK3S_INTERRUPT_H_INST_STORAGE: 602 case BOOK3S_INTERRUPT_H_INST_STORAGE:
477 r = kvmppc_book3s_hv_page_fault(run, vcpu, 603 vcpu->arch.fault_dar = kvmppc_get_pc(vcpu);
478 kvmppc_get_pc(vcpu), 0); 604 vcpu->arch.fault_dsisr = 0;
605 r = RESUME_PAGE_FAULT;
479 break; 606 break;
480 /* 607 /*
481 * This occurs if the guest executes an illegal instruction. 608 * This occurs if the guest executes an illegal instruction.
@@ -535,36 +662,174 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
535 return 0; 662 return 0;
536} 663}
537 664
538int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 665int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
539{ 666{
540 int r = -EINVAL; 667 int r = 0;
668 long int i;
541 669
542 switch (reg->id) { 670 switch (id) {
543 case KVM_REG_PPC_HIOR: 671 case KVM_REG_PPC_HIOR:
544 r = put_user(0, (u64 __user *)reg->addr); 672 *val = get_reg_val(id, 0);
673 break;
674 case KVM_REG_PPC_DABR:
675 *val = get_reg_val(id, vcpu->arch.dabr);
676 break;
677 case KVM_REG_PPC_DSCR:
678 *val = get_reg_val(id, vcpu->arch.dscr);
679 break;
680 case KVM_REG_PPC_PURR:
681 *val = get_reg_val(id, vcpu->arch.purr);
682 break;
683 case KVM_REG_PPC_SPURR:
684 *val = get_reg_val(id, vcpu->arch.spurr);
685 break;
686 case KVM_REG_PPC_AMR:
687 *val = get_reg_val(id, vcpu->arch.amr);
688 break;
689 case KVM_REG_PPC_UAMOR:
690 *val = get_reg_val(id, vcpu->arch.uamor);
691 break;
692 case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCRA:
693 i = id - KVM_REG_PPC_MMCR0;
694 *val = get_reg_val(id, vcpu->arch.mmcr[i]);
695 break;
696 case KVM_REG_PPC_PMC1 ... KVM_REG_PPC_PMC8:
697 i = id - KVM_REG_PPC_PMC1;
698 *val = get_reg_val(id, vcpu->arch.pmc[i]);
699 break;
700#ifdef CONFIG_VSX
701 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
702 if (cpu_has_feature(CPU_FTR_VSX)) {
703 /* VSX => FP reg i is stored in arch.vsr[2*i] */
704 long int i = id - KVM_REG_PPC_FPR0;
705 *val = get_reg_val(id, vcpu->arch.vsr[2 * i]);
706 } else {
707 /* let generic code handle it */
708 r = -EINVAL;
709 }
710 break;
711 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31:
712 if (cpu_has_feature(CPU_FTR_VSX)) {
713 long int i = id - KVM_REG_PPC_VSR0;
714 val->vsxval[0] = vcpu->arch.vsr[2 * i];
715 val->vsxval[1] = vcpu->arch.vsr[2 * i + 1];
716 } else {
717 r = -ENXIO;
718 }
719 break;
720#endif /* CONFIG_VSX */
721 case KVM_REG_PPC_VPA_ADDR:
722 spin_lock(&vcpu->arch.vpa_update_lock);
723 *val = get_reg_val(id, vcpu->arch.vpa.next_gpa);
724 spin_unlock(&vcpu->arch.vpa_update_lock);
725 break;
726 case KVM_REG_PPC_VPA_SLB:
727 spin_lock(&vcpu->arch.vpa_update_lock);
728 val->vpaval.addr = vcpu->arch.slb_shadow.next_gpa;
729 val->vpaval.length = vcpu->arch.slb_shadow.len;
730 spin_unlock(&vcpu->arch.vpa_update_lock);
731 break;
732 case KVM_REG_PPC_VPA_DTL:
733 spin_lock(&vcpu->arch.vpa_update_lock);
734 val->vpaval.addr = vcpu->arch.dtl.next_gpa;
735 val->vpaval.length = vcpu->arch.dtl.len;
736 spin_unlock(&vcpu->arch.vpa_update_lock);
545 break; 737 break;
546 default: 738 default:
739 r = -EINVAL;
547 break; 740 break;
548 } 741 }
549 742
550 return r; 743 return r;
551} 744}
552 745
553int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 746int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
554{ 747{
555 int r = -EINVAL; 748 int r = 0;
749 long int i;
750 unsigned long addr, len;
556 751
557 switch (reg->id) { 752 switch (id) {
558 case KVM_REG_PPC_HIOR: 753 case KVM_REG_PPC_HIOR:
559 {
560 u64 hior;
561 /* Only allow this to be set to zero */ 754 /* Only allow this to be set to zero */
562 r = get_user(hior, (u64 __user *)reg->addr); 755 if (set_reg_val(id, *val))
563 if (!r && (hior != 0))
564 r = -EINVAL; 756 r = -EINVAL;
565 break; 757 break;
566 } 758 case KVM_REG_PPC_DABR:
759 vcpu->arch.dabr = set_reg_val(id, *val);
760 break;
761 case KVM_REG_PPC_DSCR:
762 vcpu->arch.dscr = set_reg_val(id, *val);
763 break;
764 case KVM_REG_PPC_PURR:
765 vcpu->arch.purr = set_reg_val(id, *val);
766 break;
767 case KVM_REG_PPC_SPURR:
768 vcpu->arch.spurr = set_reg_val(id, *val);
769 break;
770 case KVM_REG_PPC_AMR:
771 vcpu->arch.amr = set_reg_val(id, *val);
772 break;
773 case KVM_REG_PPC_UAMOR:
774 vcpu->arch.uamor = set_reg_val(id, *val);
775 break;
776 case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCRA:
777 i = id - KVM_REG_PPC_MMCR0;
778 vcpu->arch.mmcr[i] = set_reg_val(id, *val);
779 break;
780 case KVM_REG_PPC_PMC1 ... KVM_REG_PPC_PMC8:
781 i = id - KVM_REG_PPC_PMC1;
782 vcpu->arch.pmc[i] = set_reg_val(id, *val);
783 break;
784#ifdef CONFIG_VSX
785 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
786 if (cpu_has_feature(CPU_FTR_VSX)) {
787 /* VSX => FP reg i is stored in arch.vsr[2*i] */
788 long int i = id - KVM_REG_PPC_FPR0;
789 vcpu->arch.vsr[2 * i] = set_reg_val(id, *val);
790 } else {
791 /* let generic code handle it */
792 r = -EINVAL;
793 }
794 break;
795 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31:
796 if (cpu_has_feature(CPU_FTR_VSX)) {
797 long int i = id - KVM_REG_PPC_VSR0;
798 vcpu->arch.vsr[2 * i] = val->vsxval[0];
799 vcpu->arch.vsr[2 * i + 1] = val->vsxval[1];
800 } else {
801 r = -ENXIO;
802 }
803 break;
804#endif /* CONFIG_VSX */
805 case KVM_REG_PPC_VPA_ADDR:
806 addr = set_reg_val(id, *val);
807 r = -EINVAL;
808 if (!addr && (vcpu->arch.slb_shadow.next_gpa ||
809 vcpu->arch.dtl.next_gpa))
810 break;
811 r = set_vpa(vcpu, &vcpu->arch.vpa, addr, sizeof(struct lppaca));
812 break;
813 case KVM_REG_PPC_VPA_SLB:
814 addr = val->vpaval.addr;
815 len = val->vpaval.length;
816 r = -EINVAL;
817 if (addr && !vcpu->arch.vpa.next_gpa)
818 break;
819 r = set_vpa(vcpu, &vcpu->arch.slb_shadow, addr, len);
820 break;
821 case KVM_REG_PPC_VPA_DTL:
822 addr = val->vpaval.addr;
823 len = val->vpaval.length;
824 r = -EINVAL;
825 if (addr && (len < sizeof(struct dtl_entry) ||
826 !vcpu->arch.vpa.next_gpa))
827 break;
828 len -= len % sizeof(struct dtl_entry);
829 r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len);
830 break;
567 default: 831 default:
832 r = -EINVAL;
568 break; 833 break;
569 } 834 }
570 835
@@ -599,20 +864,18 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
599 goto free_vcpu; 864 goto free_vcpu;
600 865
601 vcpu->arch.shared = &vcpu->arch.shregs; 866 vcpu->arch.shared = &vcpu->arch.shregs;
602 vcpu->arch.last_cpu = -1;
603 vcpu->arch.mmcr[0] = MMCR0_FC; 867 vcpu->arch.mmcr[0] = MMCR0_FC;
604 vcpu->arch.ctrl = CTRL_RUNLATCH; 868 vcpu->arch.ctrl = CTRL_RUNLATCH;
605 /* default to host PVR, since we can't spoof it */ 869 /* default to host PVR, since we can't spoof it */
606 vcpu->arch.pvr = mfspr(SPRN_PVR); 870 vcpu->arch.pvr = mfspr(SPRN_PVR);
607 kvmppc_set_pvr(vcpu, vcpu->arch.pvr); 871 kvmppc_set_pvr(vcpu, vcpu->arch.pvr);
608 spin_lock_init(&vcpu->arch.vpa_update_lock); 872 spin_lock_init(&vcpu->arch.vpa_update_lock);
873 spin_lock_init(&vcpu->arch.tbacct_lock);
874 vcpu->arch.busy_preempt = TB_NIL;
609 875
610 kvmppc_mmu_book3s_hv_init(vcpu); 876 kvmppc_mmu_book3s_hv_init(vcpu);
611 877
612 /* 878 vcpu->arch.state = KVMPPC_VCPU_NOTREADY;
613 * We consider the vcpu stopped until we see the first run ioctl for it.
614 */
615 vcpu->arch.state = KVMPPC_VCPU_STOPPED;
616 879
617 init_waitqueue_head(&vcpu->arch.cpu_run); 880 init_waitqueue_head(&vcpu->arch.cpu_run);
618 881
@@ -624,9 +887,10 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
624 INIT_LIST_HEAD(&vcore->runnable_threads); 887 INIT_LIST_HEAD(&vcore->runnable_threads);
625 spin_lock_init(&vcore->lock); 888 spin_lock_init(&vcore->lock);
626 init_waitqueue_head(&vcore->wq); 889 init_waitqueue_head(&vcore->wq);
627 vcore->preempt_tb = mftb(); 890 vcore->preempt_tb = TB_NIL;
628 } 891 }
629 kvm->arch.vcores[core] = vcore; 892 kvm->arch.vcores[core] = vcore;
893 kvm->arch.online_vcores++;
630 } 894 }
631 mutex_unlock(&kvm->lock); 895 mutex_unlock(&kvm->lock);
632 896
@@ -637,7 +901,6 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
637 ++vcore->num_threads; 901 ++vcore->num_threads;
638 spin_unlock(&vcore->lock); 902 spin_unlock(&vcore->lock);
639 vcpu->arch.vcore = vcore; 903 vcpu->arch.vcore = vcore;
640 vcpu->arch.stolen_logged = vcore->stolen_tb;
641 904
642 vcpu->arch.cpu_type = KVM_CPU_3S_64; 905 vcpu->arch.cpu_type = KVM_CPU_3S_64;
643 kvmppc_sanity_check(vcpu); 906 kvmppc_sanity_check(vcpu);
@@ -697,17 +960,18 @@ extern void xics_wake_cpu(int cpu);
697static void kvmppc_remove_runnable(struct kvmppc_vcore *vc, 960static void kvmppc_remove_runnable(struct kvmppc_vcore *vc,
698 struct kvm_vcpu *vcpu) 961 struct kvm_vcpu *vcpu)
699{ 962{
700 struct kvm_vcpu *v; 963 u64 now;
701 964
702 if (vcpu->arch.state != KVMPPC_VCPU_RUNNABLE) 965 if (vcpu->arch.state != KVMPPC_VCPU_RUNNABLE)
703 return; 966 return;
967 spin_lock(&vcpu->arch.tbacct_lock);
968 now = mftb();
969 vcpu->arch.busy_stolen += vcore_stolen_time(vc, now) -
970 vcpu->arch.stolen_logged;
971 vcpu->arch.busy_preempt = now;
704 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST; 972 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST;
973 spin_unlock(&vcpu->arch.tbacct_lock);
705 --vc->n_runnable; 974 --vc->n_runnable;
706 ++vc->n_busy;
707 /* decrement the physical thread id of each following vcpu */
708 v = vcpu;
709 list_for_each_entry_continue(v, &vc->runnable_threads, arch.run_list)
710 --v->arch.ptid;
711 list_del(&vcpu->arch.run_list); 975 list_del(&vcpu->arch.run_list);
712} 976}
713 977
@@ -720,6 +984,7 @@ static int kvmppc_grab_hwthread(int cpu)
720 984
721 /* Ensure the thread won't go into the kernel if it wakes */ 985 /* Ensure the thread won't go into the kernel if it wakes */
722 tpaca->kvm_hstate.hwthread_req = 1; 986 tpaca->kvm_hstate.hwthread_req = 1;
987 tpaca->kvm_hstate.kvm_vcpu = NULL;
723 988
724 /* 989 /*
725 * If the thread is already executing in the kernel (e.g. handling 990 * If the thread is already executing in the kernel (e.g. handling
@@ -769,7 +1034,6 @@ static void kvmppc_start_thread(struct kvm_vcpu *vcpu)
769 smp_wmb(); 1034 smp_wmb();
770#if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP) 1035#if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP)
771 if (vcpu->arch.ptid) { 1036 if (vcpu->arch.ptid) {
772 kvmppc_grab_hwthread(cpu);
773 xics_wake_cpu(cpu); 1037 xics_wake_cpu(cpu);
774 ++vc->n_woken; 1038 ++vc->n_woken;
775 } 1039 }
@@ -795,7 +1059,8 @@ static void kvmppc_wait_for_nap(struct kvmppc_vcore *vc)
795 1059
796/* 1060/*
797 * Check that we are on thread 0 and that any other threads in 1061 * Check that we are on thread 0 and that any other threads in
798 * this core are off-line. 1062 * this core are off-line. Then grab the threads so they can't
1063 * enter the kernel.
799 */ 1064 */
800static int on_primary_thread(void) 1065static int on_primary_thread(void)
801{ 1066{
@@ -807,6 +1072,17 @@ static int on_primary_thread(void)
807 while (++thr < threads_per_core) 1072 while (++thr < threads_per_core)
808 if (cpu_online(cpu + thr)) 1073 if (cpu_online(cpu + thr))
809 return 0; 1074 return 0;
1075
1076 /* Grab all hw threads so they can't go into the kernel */
1077 for (thr = 1; thr < threads_per_core; ++thr) {
1078 if (kvmppc_grab_hwthread(cpu + thr)) {
1079 /* Couldn't grab one; let the others go */
1080 do {
1081 kvmppc_release_hwthread(cpu + thr);
1082 } while (--thr > 0);
1083 return 0;
1084 }
1085 }
810 return 1; 1086 return 1;
811} 1087}
812 1088
@@ -814,21 +1090,24 @@ static int on_primary_thread(void)
814 * Run a set of guest threads on a physical core. 1090 * Run a set of guest threads on a physical core.
815 * Called with vc->lock held. 1091 * Called with vc->lock held.
816 */ 1092 */
817static int kvmppc_run_core(struct kvmppc_vcore *vc) 1093static void kvmppc_run_core(struct kvmppc_vcore *vc)
818{ 1094{
819 struct kvm_vcpu *vcpu, *vcpu0, *vnext; 1095 struct kvm_vcpu *vcpu, *vcpu0, *vnext;
820 long ret; 1096 long ret;
821 u64 now; 1097 u64 now;
822 int ptid, i, need_vpa_update; 1098 int ptid, i, need_vpa_update;
1099 int srcu_idx;
1100 struct kvm_vcpu *vcpus_to_update[threads_per_core];
823 1101
824 /* don't start if any threads have a signal pending */ 1102 /* don't start if any threads have a signal pending */
825 need_vpa_update = 0; 1103 need_vpa_update = 0;
826 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) { 1104 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
827 if (signal_pending(vcpu->arch.run_task)) 1105 if (signal_pending(vcpu->arch.run_task))
828 return 0; 1106 return;
829 need_vpa_update |= vcpu->arch.vpa.update_pending | 1107 if (vcpu->arch.vpa.update_pending ||
830 vcpu->arch.slb_shadow.update_pending | 1108 vcpu->arch.slb_shadow.update_pending ||
831 vcpu->arch.dtl.update_pending; 1109 vcpu->arch.dtl.update_pending)
1110 vcpus_to_update[need_vpa_update++] = vcpu;
832 } 1111 }
833 1112
834 /* 1113 /*
@@ -838,7 +1117,7 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
838 vc->n_woken = 0; 1117 vc->n_woken = 0;
839 vc->nap_count = 0; 1118 vc->nap_count = 0;
840 vc->entry_exit_count = 0; 1119 vc->entry_exit_count = 0;
841 vc->vcore_state = VCORE_RUNNING; 1120 vc->vcore_state = VCORE_STARTING;
842 vc->in_guest = 0; 1121 vc->in_guest = 0;
843 vc->napping_threads = 0; 1122 vc->napping_threads = 0;
844 1123
@@ -848,24 +1127,12 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
848 */ 1127 */
849 if (need_vpa_update) { 1128 if (need_vpa_update) {
850 spin_unlock(&vc->lock); 1129 spin_unlock(&vc->lock);
851 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) 1130 for (i = 0; i < need_vpa_update; ++i)
852 kvmppc_update_vpas(vcpu); 1131 kvmppc_update_vpas(vcpus_to_update[i]);
853 spin_lock(&vc->lock); 1132 spin_lock(&vc->lock);
854 } 1133 }
855 1134
856 /* 1135 /*
857 * Make sure we are running on thread 0, and that
858 * secondary threads are offline.
859 * XXX we should also block attempts to bring any
860 * secondary threads online.
861 */
862 if (threads_per_core > 1 && !on_primary_thread()) {
863 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list)
864 vcpu->arch.ret = -EBUSY;
865 goto out;
866 }
867
868 /*
869 * Assign physical thread IDs, first to non-ceded vcpus 1136 * Assign physical thread IDs, first to non-ceded vcpus
870 * and then to ceded ones. 1137 * and then to ceded ones.
871 */ 1138 */
@@ -879,28 +1146,36 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
879 } 1146 }
880 } 1147 }
881 if (!vcpu0) 1148 if (!vcpu0)
882 return 0; /* nothing to run */ 1149 goto out; /* nothing to run; should never happen */
883 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) 1150 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list)
884 if (vcpu->arch.ceded) 1151 if (vcpu->arch.ceded)
885 vcpu->arch.ptid = ptid++; 1152 vcpu->arch.ptid = ptid++;
886 1153
887 vc->stolen_tb += mftb() - vc->preempt_tb; 1154 /*
1155 * Make sure we are running on thread 0, and that
1156 * secondary threads are offline.
1157 */
1158 if (threads_per_core > 1 && !on_primary_thread()) {
1159 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list)
1160 vcpu->arch.ret = -EBUSY;
1161 goto out;
1162 }
1163
888 vc->pcpu = smp_processor_id(); 1164 vc->pcpu = smp_processor_id();
889 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) { 1165 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
890 kvmppc_start_thread(vcpu); 1166 kvmppc_start_thread(vcpu);
891 kvmppc_create_dtl_entry(vcpu, vc); 1167 kvmppc_create_dtl_entry(vcpu, vc);
892 } 1168 }
893 /* Grab any remaining hw threads so they can't go into the kernel */
894 for (i = ptid; i < threads_per_core; ++i)
895 kvmppc_grab_hwthread(vc->pcpu + i);
896 1169
1170 vc->vcore_state = VCORE_RUNNING;
897 preempt_disable(); 1171 preempt_disable();
898 spin_unlock(&vc->lock); 1172 spin_unlock(&vc->lock);
899 1173
900 kvm_guest_enter(); 1174 kvm_guest_enter();
1175
1176 srcu_idx = srcu_read_lock(&vcpu0->kvm->srcu);
1177
901 __kvmppc_vcore_entry(NULL, vcpu0); 1178 __kvmppc_vcore_entry(NULL, vcpu0);
902 for (i = 0; i < threads_per_core; ++i)
903 kvmppc_release_hwthread(vc->pcpu + i);
904 1179
905 spin_lock(&vc->lock); 1180 spin_lock(&vc->lock);
906 /* disable sending of IPIs on virtual external irqs */ 1181 /* disable sending of IPIs on virtual external irqs */
@@ -909,10 +1184,14 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
909 /* wait for secondary threads to finish writing their state to memory */ 1184 /* wait for secondary threads to finish writing their state to memory */
910 if (vc->nap_count < vc->n_woken) 1185 if (vc->nap_count < vc->n_woken)
911 kvmppc_wait_for_nap(vc); 1186 kvmppc_wait_for_nap(vc);
1187 for (i = 0; i < threads_per_core; ++i)
1188 kvmppc_release_hwthread(vc->pcpu + i);
912 /* prevent other vcpu threads from doing kvmppc_start_thread() now */ 1189 /* prevent other vcpu threads from doing kvmppc_start_thread() now */
913 vc->vcore_state = VCORE_EXITING; 1190 vc->vcore_state = VCORE_EXITING;
914 spin_unlock(&vc->lock); 1191 spin_unlock(&vc->lock);
915 1192
1193 srcu_read_unlock(&vcpu0->kvm->srcu, srcu_idx);
1194
916 /* make sure updates to secondary vcpu structs are visible now */ 1195 /* make sure updates to secondary vcpu structs are visible now */
917 smp_mb(); 1196 smp_mb();
918 kvm_guest_exit(); 1197 kvm_guest_exit();
@@ -920,6 +1199,7 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
920 preempt_enable(); 1199 preempt_enable();
921 kvm_resched(vcpu); 1200 kvm_resched(vcpu);
922 1201
1202 spin_lock(&vc->lock);
923 now = get_tb(); 1203 now = get_tb();
924 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) { 1204 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
925 /* cancel pending dec exception if dec is positive */ 1205 /* cancel pending dec exception if dec is positive */
@@ -943,10 +1223,8 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
943 } 1223 }
944 } 1224 }
945 1225
946 spin_lock(&vc->lock);
947 out: 1226 out:
948 vc->vcore_state = VCORE_INACTIVE; 1227 vc->vcore_state = VCORE_INACTIVE;
949 vc->preempt_tb = mftb();
950 list_for_each_entry_safe(vcpu, vnext, &vc->runnable_threads, 1228 list_for_each_entry_safe(vcpu, vnext, &vc->runnable_threads,
951 arch.run_list) { 1229 arch.run_list) {
952 if (vcpu->arch.ret != RESUME_GUEST) { 1230 if (vcpu->arch.ret != RESUME_GUEST) {
@@ -954,8 +1232,6 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
954 wake_up(&vcpu->arch.cpu_run); 1232 wake_up(&vcpu->arch.cpu_run);
955 } 1233 }
956 } 1234 }
957
958 return 1;
959} 1235}
960 1236
961/* 1237/*
@@ -979,20 +1255,11 @@ static void kvmppc_wait_for_exec(struct kvm_vcpu *vcpu, int wait_state)
979static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) 1255static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc)
980{ 1256{
981 DEFINE_WAIT(wait); 1257 DEFINE_WAIT(wait);
982 struct kvm_vcpu *v;
983 int all_idle = 1;
984 1258
985 prepare_to_wait(&vc->wq, &wait, TASK_INTERRUPTIBLE); 1259 prepare_to_wait(&vc->wq, &wait, TASK_INTERRUPTIBLE);
986 vc->vcore_state = VCORE_SLEEPING; 1260 vc->vcore_state = VCORE_SLEEPING;
987 spin_unlock(&vc->lock); 1261 spin_unlock(&vc->lock);
988 list_for_each_entry(v, &vc->runnable_threads, arch.run_list) { 1262 schedule();
989 if (!v->arch.ceded || v->arch.pending_exceptions) {
990 all_idle = 0;
991 break;
992 }
993 }
994 if (all_idle)
995 schedule();
996 finish_wait(&vc->wq, &wait); 1263 finish_wait(&vc->wq, &wait);
997 spin_lock(&vc->lock); 1264 spin_lock(&vc->lock);
998 vc->vcore_state = VCORE_INACTIVE; 1265 vc->vcore_state = VCORE_INACTIVE;
@@ -1001,13 +1268,13 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc)
1001static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 1268static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1002{ 1269{
1003 int n_ceded; 1270 int n_ceded;
1004 int prev_state;
1005 struct kvmppc_vcore *vc; 1271 struct kvmppc_vcore *vc;
1006 struct kvm_vcpu *v, *vn; 1272 struct kvm_vcpu *v, *vn;
1007 1273
1008 kvm_run->exit_reason = 0; 1274 kvm_run->exit_reason = 0;
1009 vcpu->arch.ret = RESUME_GUEST; 1275 vcpu->arch.ret = RESUME_GUEST;
1010 vcpu->arch.trap = 0; 1276 vcpu->arch.trap = 0;
1277 kvmppc_update_vpas(vcpu);
1011 1278
1012 /* 1279 /*
1013 * Synchronize with other threads in this virtual core 1280 * Synchronize with other threads in this virtual core
@@ -1017,8 +1284,9 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1017 vcpu->arch.ceded = 0; 1284 vcpu->arch.ceded = 0;
1018 vcpu->arch.run_task = current; 1285 vcpu->arch.run_task = current;
1019 vcpu->arch.kvm_run = kvm_run; 1286 vcpu->arch.kvm_run = kvm_run;
1020 prev_state = vcpu->arch.state; 1287 vcpu->arch.stolen_logged = vcore_stolen_time(vc, mftb());
1021 vcpu->arch.state = KVMPPC_VCPU_RUNNABLE; 1288 vcpu->arch.state = KVMPPC_VCPU_RUNNABLE;
1289 vcpu->arch.busy_preempt = TB_NIL;
1022 list_add_tail(&vcpu->arch.run_list, &vc->runnable_threads); 1290 list_add_tail(&vcpu->arch.run_list, &vc->runnable_threads);
1023 ++vc->n_runnable; 1291 ++vc->n_runnable;
1024 1292
@@ -1027,33 +1295,26 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1027 * If the vcore is already running, we may be able to start 1295 * If the vcore is already running, we may be able to start
1028 * this thread straight away and have it join in. 1296 * this thread straight away and have it join in.
1029 */ 1297 */
1030 if (prev_state == KVMPPC_VCPU_STOPPED) { 1298 if (!signal_pending(current)) {
1031 if (vc->vcore_state == VCORE_RUNNING && 1299 if (vc->vcore_state == VCORE_RUNNING &&
1032 VCORE_EXIT_COUNT(vc) == 0) { 1300 VCORE_EXIT_COUNT(vc) == 0) {
1033 vcpu->arch.ptid = vc->n_runnable - 1; 1301 vcpu->arch.ptid = vc->n_runnable - 1;
1302 kvmppc_create_dtl_entry(vcpu, vc);
1034 kvmppc_start_thread(vcpu); 1303 kvmppc_start_thread(vcpu);
1304 } else if (vc->vcore_state == VCORE_SLEEPING) {
1305 wake_up(&vc->wq);
1035 } 1306 }
1036 1307
1037 } else if (prev_state == KVMPPC_VCPU_BUSY_IN_HOST) 1308 }
1038 --vc->n_busy;
1039 1309
1040 while (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE && 1310 while (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE &&
1041 !signal_pending(current)) { 1311 !signal_pending(current)) {
1042 if (vc->n_busy || vc->vcore_state != VCORE_INACTIVE) { 1312 if (vc->vcore_state != VCORE_INACTIVE) {
1043 spin_unlock(&vc->lock); 1313 spin_unlock(&vc->lock);
1044 kvmppc_wait_for_exec(vcpu, TASK_INTERRUPTIBLE); 1314 kvmppc_wait_for_exec(vcpu, TASK_INTERRUPTIBLE);
1045 spin_lock(&vc->lock); 1315 spin_lock(&vc->lock);
1046 continue; 1316 continue;
1047 } 1317 }
1048 vc->runner = vcpu;
1049 n_ceded = 0;
1050 list_for_each_entry(v, &vc->runnable_threads, arch.run_list)
1051 n_ceded += v->arch.ceded;
1052 if (n_ceded == vc->n_runnable)
1053 kvmppc_vcore_blocked(vc);
1054 else
1055 kvmppc_run_core(vc);
1056
1057 list_for_each_entry_safe(v, vn, &vc->runnable_threads, 1318 list_for_each_entry_safe(v, vn, &vc->runnable_threads,
1058 arch.run_list) { 1319 arch.run_list) {
1059 kvmppc_core_prepare_to_enter(v); 1320 kvmppc_core_prepare_to_enter(v);
@@ -1065,22 +1326,40 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1065 wake_up(&v->arch.cpu_run); 1326 wake_up(&v->arch.cpu_run);
1066 } 1327 }
1067 } 1328 }
1329 if (!vc->n_runnable || vcpu->arch.state != KVMPPC_VCPU_RUNNABLE)
1330 break;
1331 vc->runner = vcpu;
1332 n_ceded = 0;
1333 list_for_each_entry(v, &vc->runnable_threads, arch.run_list)
1334 if (!v->arch.pending_exceptions)
1335 n_ceded += v->arch.ceded;
1336 if (n_ceded == vc->n_runnable)
1337 kvmppc_vcore_blocked(vc);
1338 else
1339 kvmppc_run_core(vc);
1068 vc->runner = NULL; 1340 vc->runner = NULL;
1069 } 1341 }
1070 1342
1071 if (signal_pending(current)) { 1343 while (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE &&
1072 if (vc->vcore_state == VCORE_RUNNING || 1344 (vc->vcore_state == VCORE_RUNNING ||
1073 vc->vcore_state == VCORE_EXITING) { 1345 vc->vcore_state == VCORE_EXITING)) {
1074 spin_unlock(&vc->lock); 1346 spin_unlock(&vc->lock);
1075 kvmppc_wait_for_exec(vcpu, TASK_UNINTERRUPTIBLE); 1347 kvmppc_wait_for_exec(vcpu, TASK_UNINTERRUPTIBLE);
1076 spin_lock(&vc->lock); 1348 spin_lock(&vc->lock);
1077 } 1349 }
1078 if (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE) { 1350
1079 kvmppc_remove_runnable(vc, vcpu); 1351 if (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE) {
1080 vcpu->stat.signal_exits++; 1352 kvmppc_remove_runnable(vc, vcpu);
1081 kvm_run->exit_reason = KVM_EXIT_INTR; 1353 vcpu->stat.signal_exits++;
1082 vcpu->arch.ret = -EINTR; 1354 kvm_run->exit_reason = KVM_EXIT_INTR;
1083 } 1355 vcpu->arch.ret = -EINTR;
1356 }
1357
1358 if (vc->n_runnable && vc->vcore_state == VCORE_INACTIVE) {
1359 /* Wake up some vcpu to run the core */
1360 v = list_first_entry(&vc->runnable_threads,
1361 struct kvm_vcpu, arch.run_list);
1362 wake_up(&v->arch.cpu_run);
1084 } 1363 }
1085 1364
1086 spin_unlock(&vc->lock); 1365 spin_unlock(&vc->lock);
@@ -1090,6 +1369,7 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1090int kvmppc_vcpu_run(struct kvm_run *run, struct kvm_vcpu *vcpu) 1369int kvmppc_vcpu_run(struct kvm_run *run, struct kvm_vcpu *vcpu)
1091{ 1370{
1092 int r; 1371 int r;
1372 int srcu_idx;
1093 1373
1094 if (!vcpu->arch.sane) { 1374 if (!vcpu->arch.sane) {
1095 run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 1375 run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
@@ -1120,6 +1400,7 @@ int kvmppc_vcpu_run(struct kvm_run *run, struct kvm_vcpu *vcpu)
1120 flush_vsx_to_thread(current); 1400 flush_vsx_to_thread(current);
1121 vcpu->arch.wqp = &vcpu->arch.vcore->wq; 1401 vcpu->arch.wqp = &vcpu->arch.vcore->wq;
1122 vcpu->arch.pgdir = current->mm->pgd; 1402 vcpu->arch.pgdir = current->mm->pgd;
1403 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST;
1123 1404
1124 do { 1405 do {
1125 r = kvmppc_run_vcpu(run, vcpu); 1406 r = kvmppc_run_vcpu(run, vcpu);
@@ -1128,10 +1409,16 @@ int kvmppc_vcpu_run(struct kvm_run *run, struct kvm_vcpu *vcpu)
1128 !(vcpu->arch.shregs.msr & MSR_PR)) { 1409 !(vcpu->arch.shregs.msr & MSR_PR)) {
1129 r = kvmppc_pseries_do_hcall(vcpu); 1410 r = kvmppc_pseries_do_hcall(vcpu);
1130 kvmppc_core_prepare_to_enter(vcpu); 1411 kvmppc_core_prepare_to_enter(vcpu);
1412 } else if (r == RESUME_PAGE_FAULT) {
1413 srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
1414 r = kvmppc_book3s_hv_page_fault(run, vcpu,
1415 vcpu->arch.fault_dar, vcpu->arch.fault_dsisr);
1416 srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx);
1131 } 1417 }
1132 } while (r == RESUME_GUEST); 1418 } while (r == RESUME_GUEST);
1133 1419
1134 out: 1420 out:
1421 vcpu->arch.state = KVMPPC_VCPU_NOTREADY;
1135 atomic_dec(&vcpu->kvm->arch.vcpus_running); 1422 atomic_dec(&vcpu->kvm->arch.vcpus_running);
1136 return r; 1423 return r;
1137} 1424}
@@ -1273,7 +1560,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
1273 n = kvm_dirty_bitmap_bytes(memslot); 1560 n = kvm_dirty_bitmap_bytes(memslot);
1274 memset(memslot->dirty_bitmap, 0, n); 1561 memset(memslot->dirty_bitmap, 0, n);
1275 1562
1276 r = kvmppc_hv_get_dirty_log(kvm, memslot); 1563 r = kvmppc_hv_get_dirty_log(kvm, memslot, memslot->dirty_bitmap);
1277 if (r) 1564 if (r)
1278 goto out; 1565 goto out;
1279 1566
@@ -1287,67 +1574,88 @@ out:
1287 return r; 1574 return r;
1288} 1575}
1289 1576
1290static unsigned long slb_pgsize_encoding(unsigned long psize) 1577static void unpin_slot(struct kvm_memory_slot *memslot)
1291{ 1578{
1292 unsigned long senc = 0; 1579 unsigned long *physp;
1580 unsigned long j, npages, pfn;
1581 struct page *page;
1293 1582
1294 if (psize > 0x1000) { 1583 physp = memslot->arch.slot_phys;
1295 senc = SLB_VSID_L; 1584 npages = memslot->npages;
1296 if (psize == 0x10000) 1585 if (!physp)
1297 senc |= SLB_VSID_LP_01; 1586 return;
1587 for (j = 0; j < npages; j++) {
1588 if (!(physp[j] & KVMPPC_GOT_PAGE))
1589 continue;
1590 pfn = physp[j] >> PAGE_SHIFT;
1591 page = pfn_to_page(pfn);
1592 SetPageDirty(page);
1593 put_page(page);
1594 }
1595}
1596
1597void kvmppc_core_free_memslot(struct kvm_memory_slot *free,
1598 struct kvm_memory_slot *dont)
1599{
1600 if (!dont || free->arch.rmap != dont->arch.rmap) {
1601 vfree(free->arch.rmap);
1602 free->arch.rmap = NULL;
1603 }
1604 if (!dont || free->arch.slot_phys != dont->arch.slot_phys) {
1605 unpin_slot(free);
1606 vfree(free->arch.slot_phys);
1607 free->arch.slot_phys = NULL;
1298 } 1608 }
1299 return senc; 1609}
1610
1611int kvmppc_core_create_memslot(struct kvm_memory_slot *slot,
1612 unsigned long npages)
1613{
1614 slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap));
1615 if (!slot->arch.rmap)
1616 return -ENOMEM;
1617 slot->arch.slot_phys = NULL;
1618
1619 return 0;
1300} 1620}
1301 1621
1302int kvmppc_core_prepare_memory_region(struct kvm *kvm, 1622int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1303 struct kvm_userspace_memory_region *mem) 1623 struct kvm_memory_slot *memslot,
1624 struct kvm_userspace_memory_region *mem)
1304{ 1625{
1305 unsigned long npages;
1306 unsigned long *phys; 1626 unsigned long *phys;
1307 1627
1308 /* Allocate a slot_phys array */ 1628 /* Allocate a slot_phys array if needed */
1309 phys = kvm->arch.slot_phys[mem->slot]; 1629 phys = memslot->arch.slot_phys;
1310 if (!kvm->arch.using_mmu_notifiers && !phys) { 1630 if (!kvm->arch.using_mmu_notifiers && !phys && memslot->npages) {
1311 npages = mem->memory_size >> PAGE_SHIFT; 1631 phys = vzalloc(memslot->npages * sizeof(unsigned long));
1312 phys = vzalloc(npages * sizeof(unsigned long));
1313 if (!phys) 1632 if (!phys)
1314 return -ENOMEM; 1633 return -ENOMEM;
1315 kvm->arch.slot_phys[mem->slot] = phys; 1634 memslot->arch.slot_phys = phys;
1316 kvm->arch.slot_npages[mem->slot] = npages;
1317 } 1635 }
1318 1636
1319 return 0; 1637 return 0;
1320} 1638}
1321 1639
1322static void unpin_slot(struct kvm *kvm, int slot_id) 1640void kvmppc_core_commit_memory_region(struct kvm *kvm,
1641 struct kvm_userspace_memory_region *mem,
1642 struct kvm_memory_slot old)
1323{ 1643{
1324 unsigned long *physp; 1644 unsigned long npages = mem->memory_size >> PAGE_SHIFT;
1325 unsigned long j, npages, pfn; 1645 struct kvm_memory_slot *memslot;
1326 struct page *page;
1327 1646
1328 physp = kvm->arch.slot_phys[slot_id]; 1647 if (npages && old.npages) {
1329 npages = kvm->arch.slot_npages[slot_id]; 1648 /*
1330 if (physp) { 1649 * If modifying a memslot, reset all the rmap dirty bits.
1331 spin_lock(&kvm->arch.slot_phys_lock); 1650 * If this is a new memslot, we don't need to do anything
1332 for (j = 0; j < npages; j++) { 1651 * since the rmap array starts out as all zeroes,
1333 if (!(physp[j] & KVMPPC_GOT_PAGE)) 1652 * i.e. no pages are dirty.
1334 continue; 1653 */
1335 pfn = physp[j] >> PAGE_SHIFT; 1654 memslot = id_to_memslot(kvm->memslots, mem->slot);
1336 page = pfn_to_page(pfn); 1655 kvmppc_hv_get_dirty_log(kvm, memslot, NULL);
1337 SetPageDirty(page);
1338 put_page(page);
1339 }
1340 kvm->arch.slot_phys[slot_id] = NULL;
1341 spin_unlock(&kvm->arch.slot_phys_lock);
1342 vfree(physp);
1343 } 1656 }
1344} 1657}
1345 1658
1346void kvmppc_core_commit_memory_region(struct kvm *kvm,
1347 struct kvm_userspace_memory_region *mem)
1348{
1349}
1350
1351static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) 1659static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1352{ 1660{
1353 int err = 0; 1661 int err = 0;
@@ -1362,6 +1670,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1362 unsigned long rmls; 1670 unsigned long rmls;
1363 unsigned long *physp; 1671 unsigned long *physp;
1364 unsigned long i, npages; 1672 unsigned long i, npages;
1673 int srcu_idx;
1365 1674
1366 mutex_lock(&kvm->lock); 1675 mutex_lock(&kvm->lock);
1367 if (kvm->arch.rma_setup_done) 1676 if (kvm->arch.rma_setup_done)
@@ -1377,12 +1686,13 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1377 } 1686 }
1378 1687
1379 /* Look up the memslot for guest physical address 0 */ 1688 /* Look up the memslot for guest physical address 0 */
1689 srcu_idx = srcu_read_lock(&kvm->srcu);
1380 memslot = gfn_to_memslot(kvm, 0); 1690 memslot = gfn_to_memslot(kvm, 0);
1381 1691
1382 /* We must have some memory at 0 by now */ 1692 /* We must have some memory at 0 by now */
1383 err = -EINVAL; 1693 err = -EINVAL;
1384 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID)) 1694 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID))
1385 goto out; 1695 goto out_srcu;
1386 1696
1387 /* Look up the VMA for the start of this memory slot */ 1697 /* Look up the VMA for the start of this memory slot */
1388 hva = memslot->userspace_addr; 1698 hva = memslot->userspace_addr;
@@ -1406,14 +1716,14 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1406 err = -EPERM; 1716 err = -EPERM;
1407 if (cpu_has_feature(CPU_FTR_ARCH_201)) { 1717 if (cpu_has_feature(CPU_FTR_ARCH_201)) {
1408 pr_err("KVM: CPU requires an RMO\n"); 1718 pr_err("KVM: CPU requires an RMO\n");
1409 goto out; 1719 goto out_srcu;
1410 } 1720 }
1411 1721
1412 /* We can handle 4k, 64k or 16M pages in the VRMA */ 1722 /* We can handle 4k, 64k or 16M pages in the VRMA */
1413 err = -EINVAL; 1723 err = -EINVAL;
1414 if (!(psize == 0x1000 || psize == 0x10000 || 1724 if (!(psize == 0x1000 || psize == 0x10000 ||
1415 psize == 0x1000000)) 1725 psize == 0x1000000))
1416 goto out; 1726 goto out_srcu;
1417 1727
1418 /* Update VRMASD field in the LPCR */ 1728 /* Update VRMASD field in the LPCR */
1419 senc = slb_pgsize_encoding(psize); 1729 senc = slb_pgsize_encoding(psize);
@@ -1436,7 +1746,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1436 err = -EINVAL; 1746 err = -EINVAL;
1437 if (rmls < 0) { 1747 if (rmls < 0) {
1438 pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size); 1748 pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size);
1439 goto out; 1749 goto out_srcu;
1440 } 1750 }
1441 atomic_inc(&ri->use_count); 1751 atomic_inc(&ri->use_count);
1442 kvm->arch.rma = ri; 1752 kvm->arch.rma = ri;
@@ -1465,17 +1775,24 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1465 /* Initialize phys addrs of pages in RMO */ 1775 /* Initialize phys addrs of pages in RMO */
1466 npages = ri->npages; 1776 npages = ri->npages;
1467 porder = __ilog2(npages); 1777 porder = __ilog2(npages);
1468 physp = kvm->arch.slot_phys[memslot->id]; 1778 physp = memslot->arch.slot_phys;
1469 spin_lock(&kvm->arch.slot_phys_lock); 1779 if (physp) {
1470 for (i = 0; i < npages; ++i) 1780 if (npages > memslot->npages)
1471 physp[i] = ((ri->base_pfn + i) << PAGE_SHIFT) + porder; 1781 npages = memslot->npages;
1472 spin_unlock(&kvm->arch.slot_phys_lock); 1782 spin_lock(&kvm->arch.slot_phys_lock);
1783 for (i = 0; i < npages; ++i)
1784 physp[i] = ((ri->base_pfn + i) << PAGE_SHIFT) +
1785 porder;
1786 spin_unlock(&kvm->arch.slot_phys_lock);
1787 }
1473 } 1788 }
1474 1789
1475 /* Order updates to kvm->arch.lpcr etc. vs. rma_setup_done */ 1790 /* Order updates to kvm->arch.lpcr etc. vs. rma_setup_done */
1476 smp_wmb(); 1791 smp_wmb();
1477 kvm->arch.rma_setup_done = 1; 1792 kvm->arch.rma_setup_done = 1;
1478 err = 0; 1793 err = 0;
1794 out_srcu:
1795 srcu_read_unlock(&kvm->srcu, srcu_idx);
1479 out: 1796 out:
1480 mutex_unlock(&kvm->lock); 1797 mutex_unlock(&kvm->lock);
1481 return err; 1798 return err;
@@ -1496,6 +1813,13 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1496 return -ENOMEM; 1813 return -ENOMEM;
1497 kvm->arch.lpid = lpid; 1814 kvm->arch.lpid = lpid;
1498 1815
1816 /*
1817 * Since we don't flush the TLB when tearing down a VM,
1818 * and this lpid might have previously been used,
1819 * make sure we flush on each core before running the new VM.
1820 */
1821 cpumask_setall(&kvm->arch.need_tlb_flush);
1822
1499 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables); 1823 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables);
1500 1824
1501 kvm->arch.rma = NULL; 1825 kvm->arch.rma = NULL;
@@ -1523,16 +1847,19 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1523 1847
1524 kvm->arch.using_mmu_notifiers = !!cpu_has_feature(CPU_FTR_ARCH_206); 1848 kvm->arch.using_mmu_notifiers = !!cpu_has_feature(CPU_FTR_ARCH_206);
1525 spin_lock_init(&kvm->arch.slot_phys_lock); 1849 spin_lock_init(&kvm->arch.slot_phys_lock);
1850
1851 /*
1852 * Don't allow secondary CPU threads to come online
1853 * while any KVM VMs exist.
1854 */
1855 inhibit_secondary_onlining();
1856
1526 return 0; 1857 return 0;
1527} 1858}
1528 1859
1529void kvmppc_core_destroy_vm(struct kvm *kvm) 1860void kvmppc_core_destroy_vm(struct kvm *kvm)
1530{ 1861{
1531 unsigned long i; 1862 uninhibit_secondary_onlining();
1532
1533 if (!kvm->arch.using_mmu_notifiers)
1534 for (i = 0; i < KVM_MEM_SLOTS_NUM; i++)
1535 unpin_slot(kvm, i);
1536 1863
1537 if (kvm->arch.rma) { 1864 if (kvm->arch.rma) {
1538 kvm_release_rma(kvm->arch.rma); 1865 kvm_release_rma(kvm->arch.rma);
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index fb4eac290fe..ec0a9e5de10 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -157,8 +157,8 @@ static void __init kvm_linear_init_one(ulong size, int count, int type)
157 linear_info = alloc_bootmem(count * sizeof(struct kvmppc_linear_info)); 157 linear_info = alloc_bootmem(count * sizeof(struct kvmppc_linear_info));
158 for (i = 0; i < count; ++i) { 158 for (i = 0; i < count; ++i) {
159 linear = alloc_bootmem_align(size, size); 159 linear = alloc_bootmem_align(size, size);
160 pr_info("Allocated KVM %s at %p (%ld MB)\n", typestr, linear, 160 pr_debug("Allocated KVM %s at %p (%ld MB)\n", typestr, linear,
161 size >> 20); 161 size >> 20);
162 linear_info[i].base_virt = linear; 162 linear_info[i].base_virt = linear;
163 linear_info[i].base_pfn = __pa(linear) >> PAGE_SHIFT; 163 linear_info[i].base_pfn = __pa(linear) >> PAGE_SHIFT;
164 linear_info[i].npages = npages; 164 linear_info[i].npages = npages;
diff --git a/arch/powerpc/kvm/book3s_hv_ras.c b/arch/powerpc/kvm/book3s_hv_ras.c
new file mode 100644
index 00000000000..35f3cf0269b
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_hv_ras.c
@@ -0,0 +1,144 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * Copyright 2012 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
7 */
8
9#include <linux/types.h>
10#include <linux/string.h>
11#include <linux/kvm.h>
12#include <linux/kvm_host.h>
13#include <linux/kernel.h>
14#include <asm/opal.h>
15
16/* SRR1 bits for machine check on POWER7 */
17#define SRR1_MC_LDSTERR (1ul << (63-42))
18#define SRR1_MC_IFETCH_SH (63-45)
19#define SRR1_MC_IFETCH_MASK 0x7
20#define SRR1_MC_IFETCH_SLBPAR 2 /* SLB parity error */
21#define SRR1_MC_IFETCH_SLBMULTI 3 /* SLB multi-hit */
22#define SRR1_MC_IFETCH_SLBPARMULTI 4 /* SLB parity + multi-hit */
23#define SRR1_MC_IFETCH_TLBMULTI 5 /* I-TLB multi-hit */
24
25/* DSISR bits for machine check on POWER7 */
26#define DSISR_MC_DERAT_MULTI 0x800 /* D-ERAT multi-hit */
27#define DSISR_MC_TLB_MULTI 0x400 /* D-TLB multi-hit */
28#define DSISR_MC_SLB_PARITY 0x100 /* SLB parity error */
29#define DSISR_MC_SLB_MULTI 0x080 /* SLB multi-hit */
30#define DSISR_MC_SLB_PARMULTI 0x040 /* SLB parity + multi-hit */
31
32/* POWER7 SLB flush and reload */
33static void reload_slb(struct kvm_vcpu *vcpu)
34{
35 struct slb_shadow *slb;
36 unsigned long i, n;
37
38 /* First clear out SLB */
39 asm volatile("slbmte %0,%0; slbia" : : "r" (0));
40
41 /* Do they have an SLB shadow buffer registered? */
42 slb = vcpu->arch.slb_shadow.pinned_addr;
43 if (!slb)
44 return;
45
46 /* Sanity check */
47 n = min_t(u32, slb->persistent, SLB_MIN_SIZE);
48 if ((void *) &slb->save_area[n] > vcpu->arch.slb_shadow.pinned_end)
49 return;
50
51 /* Load up the SLB from that */
52 for (i = 0; i < n; ++i) {
53 unsigned long rb = slb->save_area[i].esid;
54 unsigned long rs = slb->save_area[i].vsid;
55
56 rb = (rb & ~0xFFFul) | i; /* insert entry number */
57 asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb));
58 }
59}
60
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/*
74 * 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.
76 *
77 * Returns: 0 => exit guest, 1 => deliver machine check to guest
78 */
79static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
80{
81 unsigned long srr1 = vcpu->arch.shregs.msr;
82 struct opal_machine_check_event *opal_evt;
83 long handled = 1;
84
85 if (srr1 & SRR1_MC_LDSTERR) {
86 /* error on load/store */
87 unsigned long dsisr = vcpu->arch.shregs.dsisr;
88
89 if (dsisr & (DSISR_MC_SLB_PARMULTI | DSISR_MC_SLB_MULTI |
90 DSISR_MC_SLB_PARITY | DSISR_MC_DERAT_MULTI)) {
91 /* flush and reload SLB; flushes D-ERAT too */
92 reload_slb(vcpu);
93 dsisr &= ~(DSISR_MC_SLB_PARMULTI | DSISR_MC_SLB_MULTI |
94 DSISR_MC_SLB_PARITY | DSISR_MC_DERAT_MULTI);
95 }
96 if (dsisr & DSISR_MC_TLB_MULTI) {
97 flush_tlb_power7(vcpu);
98 dsisr &= ~DSISR_MC_TLB_MULTI;
99 }
100 /* Any other errors we don't understand? */
101 if (dsisr & 0xffffffffUL)
102 handled = 0;
103 }
104
105 switch ((srr1 >> SRR1_MC_IFETCH_SH) & SRR1_MC_IFETCH_MASK) {
106 case 0:
107 break;
108 case SRR1_MC_IFETCH_SLBPAR:
109 case SRR1_MC_IFETCH_SLBMULTI:
110 case SRR1_MC_IFETCH_SLBPARMULTI:
111 reload_slb(vcpu);
112 break;
113 case SRR1_MC_IFETCH_TLBMULTI:
114 flush_tlb_power7(vcpu);
115 break;
116 default:
117 handled = 0;
118 }
119
120 /*
121 * See if OPAL has already handled the condition.
122 * We assume that if the condition is recovered then OPAL
123 * will have generated an error log event that we will pick
124 * up and log later.
125 */
126 opal_evt = local_paca->opal_mc_evt;
127 if (opal_evt->version == OpalMCE_V1 &&
128 (opal_evt->severity == OpalMCE_SEV_NO_ERROR ||
129 opal_evt->disposition == OpalMCE_DISPOSITION_RECOVERED))
130 handled = 1;
131
132 if (handled)
133 opal_evt->in_use = 0;
134
135 return handled;
136}
137
138long kvmppc_realmode_machine_check(struct kvm_vcpu *vcpu)
139{
140 if (cpu_has_feature(CPU_FTR_ARCH_206))
141 return kvmppc_realmode_mc_power7(vcpu);
142
143 return 0;
144}
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index fb0e821622d..19c93bae1ae 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -35,6 +35,37 @@ static void *real_vmalloc_addr(void *x)
35 return __va(addr); 35 return __va(addr);
36} 36}
37 37
38/* Return 1 if we need to do a global tlbie, 0 if we can use tlbiel */
39static int global_invalidates(struct kvm *kvm, unsigned long flags)
40{
41 int global;
42
43 /*
44 * If there is only one vcore, and it's currently running,
45 * we can use tlbiel as long as we mark all other physical
46 * cores as potentially having stale TLB entries for this lpid.
47 * If we're not using MMU notifiers, we never take pages away
48 * from the guest, so we can use tlbiel if requested.
49 * Otherwise, don't use tlbiel.
50 */
51 if (kvm->arch.online_vcores == 1 && local_paca->kvm_hstate.kvm_vcore)
52 global = 0;
53 else if (kvm->arch.using_mmu_notifiers)
54 global = 1;
55 else
56 global = !(flags & H_LOCAL);
57
58 if (!global) {
59 /* any other core might now have stale TLB entries... */
60 smp_wmb();
61 cpumask_setall(&kvm->arch.need_tlb_flush);
62 cpumask_clear_cpu(local_paca->kvm_hstate.kvm_vcore->pcpu,
63 &kvm->arch.need_tlb_flush);
64 }
65
66 return global;
67}
68
38/* 69/*
39 * Add this HPTE into the chain for the real page. 70 * Add this HPTE into the chain for the real page.
40 * Must be called with the chain locked; it unlocks the chain. 71 * Must be called with the chain locked; it unlocks the chain.
@@ -59,13 +90,24 @@ void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
59 head->back = pte_index; 90 head->back = pte_index;
60 } else { 91 } else {
61 rev->forw = rev->back = pte_index; 92 rev->forw = rev->back = pte_index;
62 i = pte_index; 93 *rmap = (*rmap & ~KVMPPC_RMAP_INDEX) |
94 pte_index | KVMPPC_RMAP_PRESENT;
63 } 95 }
64 smp_wmb(); 96 unlock_rmap(rmap);
65 *rmap = i | KVMPPC_RMAP_REFERENCED | KVMPPC_RMAP_PRESENT; /* unlock */
66} 97}
67EXPORT_SYMBOL_GPL(kvmppc_add_revmap_chain); 98EXPORT_SYMBOL_GPL(kvmppc_add_revmap_chain);
68 99
100/*
101 * Note modification of an HPTE; set the HPTE modified bit
102 * if anyone is interested.
103 */
104static inline void note_hpte_modification(struct kvm *kvm,
105 struct revmap_entry *rev)
106{
107 if (atomic_read(&kvm->arch.hpte_mod_interest))
108 rev->guest_rpte |= HPTE_GR_MODIFIED;
109}
110
69/* Remove this HPTE from the chain for a real page */ 111/* Remove this HPTE from the chain for a real page */
70static void remove_revmap_chain(struct kvm *kvm, long pte_index, 112static void remove_revmap_chain(struct kvm *kvm, long pte_index,
71 struct revmap_entry *rev, 113 struct revmap_entry *rev,
@@ -81,7 +123,7 @@ static void remove_revmap_chain(struct kvm *kvm, long pte_index,
81 ptel = rev->guest_rpte |= rcbits; 123 ptel = rev->guest_rpte |= rcbits;
82 gfn = hpte_rpn(ptel, hpte_page_size(hpte_v, ptel)); 124 gfn = hpte_rpn(ptel, hpte_page_size(hpte_v, ptel));
83 memslot = __gfn_to_memslot(kvm_memslots(kvm), gfn); 125 memslot = __gfn_to_memslot(kvm_memslots(kvm), gfn);
84 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID)) 126 if (!memslot)
85 return; 127 return;
86 128
87 rmap = real_vmalloc_addr(&memslot->arch.rmap[gfn - memslot->base_gfn]); 129 rmap = real_vmalloc_addr(&memslot->arch.rmap[gfn - memslot->base_gfn]);
@@ -103,14 +145,14 @@ static void remove_revmap_chain(struct kvm *kvm, long pte_index,
103 unlock_rmap(rmap); 145 unlock_rmap(rmap);
104} 146}
105 147
106static pte_t lookup_linux_pte(struct kvm_vcpu *vcpu, unsigned long hva, 148static pte_t lookup_linux_pte(pgd_t *pgdir, unsigned long hva,
107 int writing, unsigned long *pte_sizep) 149 int writing, unsigned long *pte_sizep)
108{ 150{
109 pte_t *ptep; 151 pte_t *ptep;
110 unsigned long ps = *pte_sizep; 152 unsigned long ps = *pte_sizep;
111 unsigned int shift; 153 unsigned int shift;
112 154
113 ptep = find_linux_pte_or_hugepte(vcpu->arch.pgdir, hva, &shift); 155 ptep = find_linux_pte_or_hugepte(pgdir, hva, &shift);
114 if (!ptep) 156 if (!ptep)
115 return __pte(0); 157 return __pte(0);
116 if (shift) 158 if (shift)
@@ -130,15 +172,15 @@ static inline void unlock_hpte(unsigned long *hpte, unsigned long hpte_v)
130 hpte[0] = hpte_v; 172 hpte[0] = hpte_v;
131} 173}
132 174
133long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags, 175long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
134 long pte_index, unsigned long pteh, unsigned long ptel) 176 long pte_index, unsigned long pteh, unsigned long ptel,
177 pgd_t *pgdir, bool realmode, unsigned long *pte_idx_ret)
135{ 178{
136 struct kvm *kvm = vcpu->kvm;
137 unsigned long i, pa, gpa, gfn, psize; 179 unsigned long i, pa, gpa, gfn, psize;
138 unsigned long slot_fn, hva; 180 unsigned long slot_fn, hva;
139 unsigned long *hpte; 181 unsigned long *hpte;
140 struct revmap_entry *rev; 182 struct revmap_entry *rev;
141 unsigned long g_ptel = ptel; 183 unsigned long g_ptel;
142 struct kvm_memory_slot *memslot; 184 struct kvm_memory_slot *memslot;
143 unsigned long *physp, pte_size; 185 unsigned long *physp, pte_size;
144 unsigned long is_io; 186 unsigned long is_io;
@@ -147,13 +189,14 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
147 unsigned int writing; 189 unsigned int writing;
148 unsigned long mmu_seq; 190 unsigned long mmu_seq;
149 unsigned long rcbits; 191 unsigned long rcbits;
150 bool realmode = vcpu->arch.vcore->vcore_state == VCORE_RUNNING;
151 192
152 psize = hpte_page_size(pteh, ptel); 193 psize = hpte_page_size(pteh, ptel);
153 if (!psize) 194 if (!psize)
154 return H_PARAMETER; 195 return H_PARAMETER;
155 writing = hpte_is_writable(ptel); 196 writing = hpte_is_writable(ptel);
156 pteh &= ~(HPTE_V_HVLOCK | HPTE_V_ABSENT | HPTE_V_VALID); 197 pteh &= ~(HPTE_V_HVLOCK | HPTE_V_ABSENT | HPTE_V_VALID);
198 ptel &= ~HPTE_GR_RESERVED;
199 g_ptel = ptel;
157 200
158 /* used later to detect if we might have been invalidated */ 201 /* used later to detect if we might have been invalidated */
159 mmu_seq = kvm->mmu_notifier_seq; 202 mmu_seq = kvm->mmu_notifier_seq;
@@ -183,7 +226,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
183 rmap = &memslot->arch.rmap[slot_fn]; 226 rmap = &memslot->arch.rmap[slot_fn];
184 227
185 if (!kvm->arch.using_mmu_notifiers) { 228 if (!kvm->arch.using_mmu_notifiers) {
186 physp = kvm->arch.slot_phys[memslot->id]; 229 physp = memslot->arch.slot_phys;
187 if (!physp) 230 if (!physp)
188 return H_PARAMETER; 231 return H_PARAMETER;
189 physp += slot_fn; 232 physp += slot_fn;
@@ -201,7 +244,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
201 244
202 /* Look up the Linux PTE for the backing page */ 245 /* Look up the Linux PTE for the backing page */
203 pte_size = psize; 246 pte_size = psize;
204 pte = lookup_linux_pte(vcpu, hva, writing, &pte_size); 247 pte = lookup_linux_pte(pgdir, hva, writing, &pte_size);
205 if (pte_present(pte)) { 248 if (pte_present(pte)) {
206 if (writing && !pte_write(pte)) 249 if (writing && !pte_write(pte))
207 /* make the actual HPTE be read-only */ 250 /* make the actual HPTE be read-only */
@@ -210,6 +253,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
210 pa = pte_pfn(pte) << PAGE_SHIFT; 253 pa = pte_pfn(pte) << PAGE_SHIFT;
211 } 254 }
212 } 255 }
256
213 if (pte_size < psize) 257 if (pte_size < psize)
214 return H_PARAMETER; 258 return H_PARAMETER;
215 if (pa && pte_size > psize) 259 if (pa && pte_size > psize)
@@ -287,8 +331,10 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
287 rev = &kvm->arch.revmap[pte_index]; 331 rev = &kvm->arch.revmap[pte_index];
288 if (realmode) 332 if (realmode)
289 rev = real_vmalloc_addr(rev); 333 rev = real_vmalloc_addr(rev);
290 if (rev) 334 if (rev) {
291 rev->guest_rpte = g_ptel; 335 rev->guest_rpte = g_ptel;
336 note_hpte_modification(kvm, rev);
337 }
292 338
293 /* Link HPTE into reverse-map chain */ 339 /* Link HPTE into reverse-map chain */
294 if (pteh & HPTE_V_VALID) { 340 if (pteh & HPTE_V_VALID) {
@@ -297,7 +343,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
297 lock_rmap(rmap); 343 lock_rmap(rmap);
298 /* Check for pending invalidations under the rmap chain lock */ 344 /* Check for pending invalidations under the rmap chain lock */
299 if (kvm->arch.using_mmu_notifiers && 345 if (kvm->arch.using_mmu_notifiers &&
300 mmu_notifier_retry(vcpu, mmu_seq)) { 346 mmu_notifier_retry(kvm, mmu_seq)) {
301 /* inval in progress, write a non-present HPTE */ 347 /* inval in progress, write a non-present HPTE */
302 pteh |= HPTE_V_ABSENT; 348 pteh |= HPTE_V_ABSENT;
303 pteh &= ~HPTE_V_VALID; 349 pteh &= ~HPTE_V_VALID;
@@ -318,10 +364,17 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
318 hpte[0] = pteh; 364 hpte[0] = pteh;
319 asm volatile("ptesync" : : : "memory"); 365 asm volatile("ptesync" : : : "memory");
320 366
321 vcpu->arch.gpr[4] = pte_index; 367 *pte_idx_ret = pte_index;
322 return H_SUCCESS; 368 return H_SUCCESS;
323} 369}
324EXPORT_SYMBOL_GPL(kvmppc_h_enter); 370EXPORT_SYMBOL_GPL(kvmppc_do_h_enter);
371
372long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
373 long pte_index, unsigned long pteh, unsigned long ptel)
374{
375 return kvmppc_do_h_enter(vcpu->kvm, flags, pte_index, pteh, ptel,
376 vcpu->arch.pgdir, true, &vcpu->arch.gpr[4]);
377}
325 378
326#define LOCK_TOKEN (*(u32 *)(&get_paca()->lock_token)) 379#define LOCK_TOKEN (*(u32 *)(&get_paca()->lock_token))
327 380
@@ -343,11 +396,10 @@ static inline int try_lock_tlbie(unsigned int *lock)
343 return old == 0; 396 return old == 0;
344} 397}
345 398
346long kvmppc_h_remove(struct kvm_vcpu *vcpu, unsigned long flags, 399long kvmppc_do_h_remove(struct kvm *kvm, unsigned long flags,
347 unsigned long pte_index, unsigned long avpn, 400 unsigned long pte_index, unsigned long avpn,
348 unsigned long va) 401 unsigned long *hpret)
349{ 402{
350 struct kvm *kvm = vcpu->kvm;
351 unsigned long *hpte; 403 unsigned long *hpte;
352 unsigned long v, r, rb; 404 unsigned long v, r, rb;
353 struct revmap_entry *rev; 405 struct revmap_entry *rev;
@@ -369,7 +421,7 @@ long kvmppc_h_remove(struct kvm_vcpu *vcpu, unsigned long flags,
369 if (v & HPTE_V_VALID) { 421 if (v & HPTE_V_VALID) {
370 hpte[0] &= ~HPTE_V_VALID; 422 hpte[0] &= ~HPTE_V_VALID;
371 rb = compute_tlbie_rb(v, hpte[1], pte_index); 423 rb = compute_tlbie_rb(v, hpte[1], pte_index);
372 if (!(flags & H_LOCAL) && atomic_read(&kvm->online_vcpus) > 1) { 424 if (global_invalidates(kvm, flags)) {
373 while (!try_lock_tlbie(&kvm->arch.tlbie_lock)) 425 while (!try_lock_tlbie(&kvm->arch.tlbie_lock))
374 cpu_relax(); 426 cpu_relax();
375 asm volatile("ptesync" : : : "memory"); 427 asm volatile("ptesync" : : : "memory");
@@ -385,13 +437,22 @@ long kvmppc_h_remove(struct kvm_vcpu *vcpu, unsigned long flags,
385 /* Read PTE low word after tlbie to get final R/C values */ 437 /* Read PTE low word after tlbie to get final R/C values */
386 remove_revmap_chain(kvm, pte_index, rev, v, hpte[1]); 438 remove_revmap_chain(kvm, pte_index, rev, v, hpte[1]);
387 } 439 }
388 r = rev->guest_rpte; 440 r = rev->guest_rpte & ~HPTE_GR_RESERVED;
441 note_hpte_modification(kvm, rev);
389 unlock_hpte(hpte, 0); 442 unlock_hpte(hpte, 0);
390 443
391 vcpu->arch.gpr[4] = v; 444 hpret[0] = v;
392 vcpu->arch.gpr[5] = r; 445 hpret[1] = r;
393 return H_SUCCESS; 446 return H_SUCCESS;
394} 447}
448EXPORT_SYMBOL_GPL(kvmppc_do_h_remove);
449
450long kvmppc_h_remove(struct kvm_vcpu *vcpu, unsigned long flags,
451 unsigned long pte_index, unsigned long avpn)
452{
453 return kvmppc_do_h_remove(vcpu->kvm, flags, pte_index, avpn,
454 &vcpu->arch.gpr[4]);
455}
395 456
396long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu) 457long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
397{ 458{
@@ -459,6 +520,7 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
459 520
460 args[j] = ((0x80 | flags) << 56) + pte_index; 521 args[j] = ((0x80 | flags) << 56) + pte_index;
461 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]); 522 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
523 note_hpte_modification(kvm, rev);
462 524
463 if (!(hp[0] & HPTE_V_VALID)) { 525 if (!(hp[0] & HPTE_V_VALID)) {
464 /* insert R and C bits from PTE */ 526 /* insert R and C bits from PTE */
@@ -534,8 +596,6 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
534 return H_NOT_FOUND; 596 return H_NOT_FOUND;
535 } 597 }
536 598
537 if (atomic_read(&kvm->online_vcpus) == 1)
538 flags |= H_LOCAL;
539 v = hpte[0]; 599 v = hpte[0];
540 bits = (flags << 55) & HPTE_R_PP0; 600 bits = (flags << 55) & HPTE_R_PP0;
541 bits |= (flags << 48) & HPTE_R_KEY_HI; 601 bits |= (flags << 48) & HPTE_R_KEY_HI;
@@ -548,6 +608,7 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
548 if (rev) { 608 if (rev) {
549 r = (rev->guest_rpte & ~mask) | bits; 609 r = (rev->guest_rpte & ~mask) | bits;
550 rev->guest_rpte = r; 610 rev->guest_rpte = r;
611 note_hpte_modification(kvm, rev);
551 } 612 }
552 r = (hpte[1] & ~mask) | bits; 613 r = (hpte[1] & ~mask) | bits;
553 614
@@ -555,7 +616,7 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
555 if (v & HPTE_V_VALID) { 616 if (v & HPTE_V_VALID) {
556 rb = compute_tlbie_rb(v, r, pte_index); 617 rb = compute_tlbie_rb(v, r, pte_index);
557 hpte[0] = v & ~HPTE_V_VALID; 618 hpte[0] = v & ~HPTE_V_VALID;
558 if (!(flags & H_LOCAL)) { 619 if (global_invalidates(kvm, flags)) {
559 while(!try_lock_tlbie(&kvm->arch.tlbie_lock)) 620 while(!try_lock_tlbie(&kvm->arch.tlbie_lock))
560 cpu_relax(); 621 cpu_relax();
561 asm volatile("ptesync" : : : "memory"); 622 asm volatile("ptesync" : : : "memory");
@@ -568,6 +629,28 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
568 asm volatile("tlbiel %0" : : "r" (rb)); 629 asm volatile("tlbiel %0" : : "r" (rb));
569 asm volatile("ptesync" : : : "memory"); 630 asm volatile("ptesync" : : : "memory");
570 } 631 }
632 /*
633 * If the host has this page as readonly but the guest
634 * wants to make it read/write, reduce the permissions.
635 * Checking the host permissions involves finding the
636 * memslot and then the Linux PTE for the page.
637 */
638 if (hpte_is_writable(r) && kvm->arch.using_mmu_notifiers) {
639 unsigned long psize, gfn, hva;
640 struct kvm_memory_slot *memslot;
641 pgd_t *pgdir = vcpu->arch.pgdir;
642 pte_t pte;
643
644 psize = hpte_page_size(v, r);
645 gfn = ((r & HPTE_R_RPN) & ~(psize - 1)) >> PAGE_SHIFT;
646 memslot = __gfn_to_memslot(kvm_memslots(kvm), gfn);
647 if (memslot) {
648 hva = __gfn_to_hva_memslot(memslot, gfn);
649 pte = lookup_linux_pte(pgdir, hva, 1, &psize);
650 if (pte_present(pte) && !pte_write(pte))
651 r = hpte_make_readonly(r);
652 }
653 }
571 } 654 }
572 hpte[1] = r; 655 hpte[1] = r;
573 eieio(); 656 eieio();
@@ -599,8 +682,10 @@ long kvmppc_h_read(struct kvm_vcpu *vcpu, unsigned long flags,
599 v &= ~HPTE_V_ABSENT; 682 v &= ~HPTE_V_ABSENT;
600 v |= HPTE_V_VALID; 683 v |= HPTE_V_VALID;
601 } 684 }
602 if (v & HPTE_V_VALID) 685 if (v & HPTE_V_VALID) {
603 r = rev[i].guest_rpte | (r & (HPTE_R_R | HPTE_R_C)); 686 r = rev[i].guest_rpte | (r & (HPTE_R_R | HPTE_R_C));
687 r &= ~HPTE_GR_RESERVED;
688 }
604 vcpu->arch.gpr[4 + i * 2] = v; 689 vcpu->arch.gpr[4 + i * 2] = v;
605 vcpu->arch.gpr[5 + i * 2] = r; 690 vcpu->arch.gpr[5 + i * 2] = r;
606 } 691 }
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 74a24bbb963..10b6c358dd7 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -27,6 +27,7 @@
27#include <asm/asm-offsets.h> 27#include <asm/asm-offsets.h>
28#include <asm/exception-64s.h> 28#include <asm/exception-64s.h>
29#include <asm/kvm_book3s_asm.h> 29#include <asm/kvm_book3s_asm.h>
30#include <asm/mmu-hash64.h>
30 31
31/***************************************************************************** 32/*****************************************************************************
32 * * 33 * *
@@ -134,8 +135,11 @@ kvm_start_guest:
134 135
13527: /* XXX should handle hypervisor maintenance interrupts etc. here */ 13627: /* XXX should handle hypervisor maintenance interrupts etc. here */
136 137
138 /* reload vcpu pointer after clearing the IPI */
139 ld r4,HSTATE_KVM_VCPU(r13)
140 cmpdi r4,0
137 /* if we have no vcpu to run, go back to sleep */ 141 /* if we have no vcpu to run, go back to sleep */
138 beq cr1,kvm_no_guest 142 beq kvm_no_guest
139 143
140 /* were we napping due to cede? */ 144 /* were we napping due to cede? */
141 lbz r0,HSTATE_NAPPING(r13) 145 lbz r0,HSTATE_NAPPING(r13)
@@ -310,7 +314,33 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
310 mtspr SPRN_SDR1,r6 /* switch to partition page table */ 314 mtspr SPRN_SDR1,r6 /* switch to partition page table */
311 mtspr SPRN_LPID,r7 315 mtspr SPRN_LPID,r7
312 isync 316 isync
317
318 /* See if we need to flush the TLB */
319 lhz r6,PACAPACAINDEX(r13) /* test_bit(cpu, need_tlb_flush) */
320 clrldi r7,r6,64-6 /* extract bit number (6 bits) */
321 srdi r6,r6,6 /* doubleword number */
322 sldi r6,r6,3 /* address offset */
323 add r6,r6,r9
324 addi r6,r6,KVM_NEED_FLUSH /* dword in kvm->arch.need_tlb_flush */
313 li r0,1 325 li r0,1
326 sld r0,r0,r7
327 ld r7,0(r6)
328 and. r7,r7,r0
329 beq 22f
33023: ldarx r7,0,r6 /* if set, clear the bit */
331 andc r7,r7,r0
332 stdcx. r7,0,r6
333 bne 23b
334 li r6,128 /* and flush the TLB */
335 mtctr r6
336 li r7,0x800 /* IS field = 0b10 */
337 ptesync
33828: tlbiel r7
339 addi r7,r7,0x1000
340 bdnz 28b
341 ptesync
342
34322: li r0,1
314 stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */ 344 stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */
315 b 10f 345 b 10f
316 346
@@ -333,36 +363,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
333 mr r9,r4 363 mr r9,r4
334 blt hdec_soon 364 blt hdec_soon
335 365
336 /*
337 * Invalidate the TLB if we could possibly have stale TLB
338 * entries for this partition on this core due to the use
339 * of tlbiel.
340 * XXX maybe only need this on primary thread?
341 */
342 ld r9,VCPU_KVM(r4) /* pointer to struct kvm */
343 lwz r5,VCPU_VCPUID(r4)
344 lhz r6,PACAPACAINDEX(r13)
345 rldimi r6,r5,0,62 /* XXX map as if threads 1:1 p:v */
346 lhz r8,VCPU_LAST_CPU(r4)
347 sldi r7,r6,1 /* see if this is the same vcpu */
348 add r7,r7,r9 /* as last ran on this pcpu */
349 lhz r0,KVM_LAST_VCPU(r7)
350 cmpw r6,r8 /* on the same cpu core as last time? */
351 bne 3f
352 cmpw r0,r5 /* same vcpu as this core last ran? */
353 beq 1f
3543: sth r6,VCPU_LAST_CPU(r4) /* if not, invalidate partition TLB */
355 sth r5,KVM_LAST_VCPU(r7)
356 li r6,128
357 mtctr r6
358 li r7,0x800 /* IS field = 0b10 */
359 ptesync
3602: tlbiel r7
361 addi r7,r7,0x1000
362 bdnz 2b
363 ptesync
3641:
365
366 /* Save purr/spurr */ 366 /* Save purr/spurr */
367 mfspr r5,SPRN_PURR 367 mfspr r5,SPRN_PURR
368 mfspr r6,SPRN_SPURR 368 mfspr r6,SPRN_SPURR
@@ -679,8 +679,7 @@ BEGIN_FTR_SECTION
6791: 6791:
680END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 680END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
681 681
682nohpte_cont: 682guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */
683hcall_real_cont: /* r9 = vcpu, r12 = trap, r13 = paca */
684 /* Save DEC */ 683 /* Save DEC */
685 mfspr r5,SPRN_DEC 684 mfspr r5,SPRN_DEC
686 mftb r6 685 mftb r6
@@ -701,6 +700,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
701 std r6, VCPU_FAULT_DAR(r9) 700 std r6, VCPU_FAULT_DAR(r9)
702 stw r7, VCPU_FAULT_DSISR(r9) 701 stw r7, VCPU_FAULT_DSISR(r9)
703 702
703 /* See if it is a machine check */
704 cmpwi r12, BOOK3S_INTERRUPT_MACHINE_CHECK
705 beq machine_check_realmode
706mc_cont:
707
704 /* Save guest CTRL register, set runlatch to 1 */ 708 /* Save guest CTRL register, set runlatch to 1 */
7056: mfspr r6,SPRN_CTRLF 7096: mfspr r6,SPRN_CTRLF
706 stw r6,VCPU_CTRL(r9) 710 stw r6,VCPU_CTRL(r9)
@@ -1113,38 +1117,41 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1113 /* 1117 /*
1114 * For external and machine check interrupts, we need 1118 * For external and machine check interrupts, we need
1115 * to call the Linux handler to process the interrupt. 1119 * to call the Linux handler to process the interrupt.
1116 * We do that by jumping to the interrupt vector address 1120 * We do that by jumping to absolute address 0x500 for
1117 * which we have in r12. The [h]rfid at the end of the 1121 * external interrupts, or the machine_check_fwnmi label
1122 * for machine checks (since firmware might have patched
1123 * the vector area at 0x200). The [h]rfid at the end of the
1118 * handler will return to the book3s_hv_interrupts.S code. 1124 * handler will return to the book3s_hv_interrupts.S code.
1119 * For other interrupts we do the rfid to get back 1125 * For other interrupts we do the rfid to get back
1120 * to the book3s_interrupts.S code here. 1126 * to the book3s_hv_interrupts.S code here.
1121 */ 1127 */
1122 ld r8, HSTATE_VMHANDLER(r13) 1128 ld r8, HSTATE_VMHANDLER(r13)
1123 ld r7, HSTATE_HOST_MSR(r13) 1129 ld r7, HSTATE_HOST_MSR(r13)
1124 1130
1131 cmpwi cr1, r12, BOOK3S_INTERRUPT_MACHINE_CHECK
1125 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL 1132 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
1133BEGIN_FTR_SECTION
1126 beq 11f 1134 beq 11f
1127 cmpwi r12, BOOK3S_INTERRUPT_MACHINE_CHECK 1135END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1128 1136
1129 /* RFI into the highmem handler, or branch to interrupt handler */ 1137 /* RFI into the highmem handler, or branch to interrupt handler */
113012: mfmsr r6 1138 mfmsr r6
1131 mtctr r12
1132 li r0, MSR_RI 1139 li r0, MSR_RI
1133 andc r6, r6, r0 1140 andc r6, r6, r0
1134 mtmsrd r6, 1 /* Clear RI in MSR */ 1141 mtmsrd r6, 1 /* Clear RI in MSR */
1135 mtsrr0 r8 1142 mtsrr0 r8
1136 mtsrr1 r7 1143 mtsrr1 r7
1137 beqctr 1144 beqa 0x500 /* external interrupt (PPC970) */
1145 beq cr1, 13f /* machine check */
1138 RFI 1146 RFI
1139 1147
114011: 1148 /* On POWER7, we have external interrupts set to use HSRR0/1 */
1141BEGIN_FTR_SECTION 114911: mtspr SPRN_HSRR0, r8
1142 b 12b
1143END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1144 mtspr SPRN_HSRR0, r8
1145 mtspr SPRN_HSRR1, r7 1150 mtspr SPRN_HSRR1, r7
1146 ba 0x500 1151 ba 0x500
1147 1152
115313: b machine_check_fwnmi
1154
1148/* 1155/*
1149 * Check whether an HDSI is an HPTE not found fault or something else. 1156 * Check whether an HDSI is an HPTE not found fault or something else.
1150 * If it is an HPTE not found fault that is due to the guest accessing 1157 * If it is an HPTE not found fault that is due to the guest accessing
@@ -1177,7 +1184,7 @@ kvmppc_hdsi:
1177 cmpdi r3, 0 /* retry the instruction */ 1184 cmpdi r3, 0 /* retry the instruction */
1178 beq 6f 1185 beq 6f
1179 cmpdi r3, -1 /* handle in kernel mode */ 1186 cmpdi r3, -1 /* handle in kernel mode */
1180 beq nohpte_cont 1187 beq guest_exit_cont
1181 cmpdi r3, -2 /* MMIO emulation; need instr word */ 1188 cmpdi r3, -2 /* MMIO emulation; need instr word */
1182 beq 2f 1189 beq 2f
1183 1190
@@ -1191,6 +1198,7 @@ kvmppc_hdsi:
1191 li r10, BOOK3S_INTERRUPT_DATA_STORAGE 1198 li r10, BOOK3S_INTERRUPT_DATA_STORAGE
1192 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */ 1199 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */
1193 rotldi r11, r11, 63 1200 rotldi r11, r11, 63
1201fast_interrupt_c_return:
11946: ld r7, VCPU_CTR(r9) 12026: ld r7, VCPU_CTR(r9)
1195 lwz r8, VCPU_XER(r9) 1203 lwz r8, VCPU_XER(r9)
1196 mtctr r7 1204 mtctr r7
@@ -1223,7 +1231,7 @@ kvmppc_hdsi:
1223 /* Unset guest mode. */ 1231 /* Unset guest mode. */
1224 li r0, KVM_GUEST_MODE_NONE 1232 li r0, KVM_GUEST_MODE_NONE
1225 stb r0, HSTATE_IN_GUEST(r13) 1233 stb r0, HSTATE_IN_GUEST(r13)
1226 b nohpte_cont 1234 b guest_exit_cont
1227 1235
1228/* 1236/*
1229 * Similarly for an HISI, reflect it to the guest as an ISI unless 1237 * Similarly for an HISI, reflect it to the guest as an ISI unless
@@ -1249,9 +1257,9 @@ kvmppc_hisi:
1249 ld r11, VCPU_MSR(r9) 1257 ld r11, VCPU_MSR(r9)
1250 li r12, BOOK3S_INTERRUPT_H_INST_STORAGE 1258 li r12, BOOK3S_INTERRUPT_H_INST_STORAGE
1251 cmpdi r3, 0 /* retry the instruction */ 1259 cmpdi r3, 0 /* retry the instruction */
1252 beq 6f 1260 beq fast_interrupt_c_return
1253 cmpdi r3, -1 /* handle in kernel mode */ 1261 cmpdi r3, -1 /* handle in kernel mode */
1254 beq nohpte_cont 1262 beq guest_exit_cont
1255 1263
1256 /* Synthesize an ISI for the guest */ 1264 /* Synthesize an ISI for the guest */
1257 mr r11, r3 1265 mr r11, r3
@@ -1260,12 +1268,7 @@ kvmppc_hisi:
1260 li r10, BOOK3S_INTERRUPT_INST_STORAGE 1268 li r10, BOOK3S_INTERRUPT_INST_STORAGE
1261 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */ 1269 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */
1262 rotldi r11, r11, 63 1270 rotldi r11, r11, 63
12636: ld r7, VCPU_CTR(r9) 1271 b fast_interrupt_c_return
1264 lwz r8, VCPU_XER(r9)
1265 mtctr r7
1266 mtxer r8
1267 mr r4, r9
1268 b fast_guest_return
1269 1272
12703: ld r6, VCPU_KVM(r9) /* not relocated, use VRMA */ 12733: ld r6, VCPU_KVM(r9) /* not relocated, use VRMA */
1271 ld r5, KVM_VRMA_SLB_V(r6) 1274 ld r5, KVM_VRMA_SLB_V(r6)
@@ -1281,14 +1284,14 @@ kvmppc_hisi:
1281hcall_try_real_mode: 1284hcall_try_real_mode:
1282 ld r3,VCPU_GPR(R3)(r9) 1285 ld r3,VCPU_GPR(R3)(r9)
1283 andi. r0,r11,MSR_PR 1286 andi. r0,r11,MSR_PR
1284 bne hcall_real_cont 1287 bne guest_exit_cont
1285 clrrdi r3,r3,2 1288 clrrdi r3,r3,2
1286 cmpldi r3,hcall_real_table_end - hcall_real_table 1289 cmpldi r3,hcall_real_table_end - hcall_real_table
1287 bge hcall_real_cont 1290 bge guest_exit_cont
1288 LOAD_REG_ADDR(r4, hcall_real_table) 1291 LOAD_REG_ADDR(r4, hcall_real_table)
1289 lwzx r3,r3,r4 1292 lwzx r3,r3,r4
1290 cmpwi r3,0 1293 cmpwi r3,0
1291 beq hcall_real_cont 1294 beq guest_exit_cont
1292 add r3,r3,r4 1295 add r3,r3,r4
1293 mtctr r3 1296 mtctr r3
1294 mr r3,r9 /* get vcpu pointer */ 1297 mr r3,r9 /* get vcpu pointer */
@@ -1309,7 +1312,7 @@ hcall_real_fallback:
1309 li r12,BOOK3S_INTERRUPT_SYSCALL 1312 li r12,BOOK3S_INTERRUPT_SYSCALL
1310 ld r9, HSTATE_KVM_VCPU(r13) 1313 ld r9, HSTATE_KVM_VCPU(r13)
1311 1314
1312 b hcall_real_cont 1315 b guest_exit_cont
1313 1316
1314 .globl hcall_real_table 1317 .globl hcall_real_table
1315hcall_real_table: 1318hcall_real_table:
@@ -1568,6 +1571,21 @@ kvm_cede_exit:
1568 li r3,H_TOO_HARD 1571 li r3,H_TOO_HARD
1569 blr 1572 blr
1570 1573
1574 /* Try to handle a machine check in real mode */
1575machine_check_realmode:
1576 mr r3, r9 /* get vcpu pointer */
1577 bl .kvmppc_realmode_machine_check
1578 nop
1579 cmpdi r3, 0 /* continue exiting from guest? */
1580 ld r9, HSTATE_KVM_VCPU(r13)
1581 li r12, BOOK3S_INTERRUPT_MACHINE_CHECK
1582 beq mc_cont
1583 /* If not, deliver a machine check. SRR0/1 are already set */
1584 li r10, BOOK3S_INTERRUPT_MACHINE_CHECK
1585 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */
1586 rotldi r11, r11, 63
1587 b fast_interrupt_c_return
1588
1571secondary_too_late: 1589secondary_too_late:
1572 ld r5,HSTATE_KVM_VCORE(r13) 1590 ld r5,HSTATE_KVM_VCORE(r13)
1573 HMT_LOW 1591 HMT_LOW
@@ -1587,6 +1605,10 @@ secondary_too_late:
1587 .endr 1605 .endr
1588 1606
1589secondary_nap: 1607secondary_nap:
1608 /* Clear our vcpu pointer so we don't come back in early */
1609 li r0, 0
1610 std r0, HSTATE_KVM_VCPU(r13)
1611 lwsync
1590 /* Clear any pending IPI - assume we're a secondary thread */ 1612 /* Clear any pending IPI - assume we're a secondary thread */
1591 ld r5, HSTATE_XICS_PHYS(r13) 1613 ld r5, HSTATE_XICS_PHYS(r13)
1592 li r7, XICS_XIRR 1614 li r7, XICS_XIRR
@@ -1612,8 +1634,6 @@ secondary_nap:
1612kvm_no_guest: 1634kvm_no_guest:
1613 li r0, KVM_HWTHREAD_IN_NAP 1635 li r0, KVM_HWTHREAD_IN_NAP
1614 stb r0, HSTATE_HWTHREAD_STATE(r13) 1636 stb r0, HSTATE_HWTHREAD_STATE(r13)
1615 li r0, 0
1616 std r0, HSTATE_KVM_VCPU(r13)
1617 1637
1618 li r3, LPCR_PECE0 1638 li r3, LPCR_PECE0
1619 mfspr r4, SPRN_LPCR 1639 mfspr r4, SPRN_LPCR
diff --git a/arch/powerpc/kvm/book3s_mmu_hpte.c b/arch/powerpc/kvm/book3s_mmu_hpte.c
index 41cb0017e75..2c86b0d6371 100644
--- a/arch/powerpc/kvm/book3s_mmu_hpte.c
+++ b/arch/powerpc/kvm/book3s_mmu_hpte.c
@@ -114,11 +114,6 @@ static void invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
114 hlist_del_init_rcu(&pte->list_vpte); 114 hlist_del_init_rcu(&pte->list_vpte);
115 hlist_del_init_rcu(&pte->list_vpte_long); 115 hlist_del_init_rcu(&pte->list_vpte_long);
116 116
117 if (pte->pte.may_write)
118 kvm_release_pfn_dirty(pte->pfn);
119 else
120 kvm_release_pfn_clean(pte->pfn);
121
122 spin_unlock(&vcpu3s->mmu_lock); 117 spin_unlock(&vcpu3s->mmu_lock);
123 118
124 vcpu3s->hpte_cache_count--; 119 vcpu3s->hpte_cache_count--;
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 05c28f59f77..28d38adeca7 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -52,8 +52,6 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
52#define MSR_USER32 MSR_USER 52#define MSR_USER32 MSR_USER
53#define MSR_USER64 MSR_USER 53#define MSR_USER64 MSR_USER
54#define HW_PAGE_SIZE PAGE_SIZE 54#define HW_PAGE_SIZE PAGE_SIZE
55#define __hard_irq_disable local_irq_disable
56#define __hard_irq_enable local_irq_enable
57#endif 55#endif
58 56
59void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 57void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
@@ -66,7 +64,7 @@ void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
66 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max; 64 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max;
67 svcpu_put(svcpu); 65 svcpu_put(svcpu);
68#endif 66#endif
69 67 vcpu->cpu = smp_processor_id();
70#ifdef CONFIG_PPC_BOOK3S_32 68#ifdef CONFIG_PPC_BOOK3S_32
71 current->thread.kvm_shadow_vcpu = to_book3s(vcpu)->shadow_vcpu; 69 current->thread.kvm_shadow_vcpu = to_book3s(vcpu)->shadow_vcpu;
72#endif 70#endif
@@ -83,17 +81,71 @@ void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
83 svcpu_put(svcpu); 81 svcpu_put(svcpu);
84#endif 82#endif
85 83
86 kvmppc_giveup_ext(vcpu, MSR_FP); 84 kvmppc_giveup_ext(vcpu, MSR_FP | MSR_VEC | MSR_VSX);
87 kvmppc_giveup_ext(vcpu, MSR_VEC); 85 vcpu->cpu = -1;
88 kvmppc_giveup_ext(vcpu, MSR_VSX); 86}
87
88int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
89{
90 int r = 1; /* Indicate we want to get back into the guest */
91
92 /* We misuse TLB_FLUSH to indicate that we want to clear
93 all shadow cache entries */
94 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu))
95 kvmppc_mmu_pte_flush(vcpu, 0, 0);
96
97 return r;
98}
99
100/************* MMU Notifiers *************/
101
102int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
103{
104 trace_kvm_unmap_hva(hva);
105
106 /*
107 * Flush all shadow tlb entries everywhere. This is slow, but
108 * we are 100% sure that we catch the to be unmapped page
109 */
110 kvm_flush_remote_tlbs(kvm);
111
112 return 0;
113}
114
115int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
116{
117 /* kvm_unmap_hva flushes everything anyways */
118 kvm_unmap_hva(kvm, start);
119
120 return 0;
121}
122
123int kvm_age_hva(struct kvm *kvm, unsigned long hva)
124{
125 /* XXX could be more clever ;) */
126 return 0;
127}
128
129int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
130{
131 /* XXX could be more clever ;) */
132 return 0;
89} 133}
90 134
135void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
136{
137 /* The page will get remapped properly on its next fault */
138 kvm_unmap_hva(kvm, hva);
139}
140
141/*****************************************/
142
91static void kvmppc_recalc_shadow_msr(struct kvm_vcpu *vcpu) 143static void kvmppc_recalc_shadow_msr(struct kvm_vcpu *vcpu)
92{ 144{
93 ulong smsr = vcpu->arch.shared->msr; 145 ulong smsr = vcpu->arch.shared->msr;
94 146
95 /* Guest MSR values */ 147 /* Guest MSR values */
96 smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE | MSR_DE; 148 smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE;
97 /* Process MSR values */ 149 /* Process MSR values */
98 smsr |= MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_PR | MSR_EE; 150 smsr |= MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_PR | MSR_EE;
99 /* External providers the guest reserved */ 151 /* External providers the guest reserved */
@@ -379,10 +431,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
379 431
380static inline int get_fpr_index(int i) 432static inline int get_fpr_index(int i)
381{ 433{
382#ifdef CONFIG_VSX 434 return i * TS_FPRWIDTH;
383 i *= 2;
384#endif
385 return i;
386} 435}
387 436
388/* Give up external provider (FPU, Altivec, VSX) */ 437/* Give up external provider (FPU, Altivec, VSX) */
@@ -396,41 +445,49 @@ void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr)
396 u64 *thread_fpr = (u64*)t->fpr; 445 u64 *thread_fpr = (u64*)t->fpr;
397 int i; 446 int i;
398 447
399 if (!(vcpu->arch.guest_owned_ext & msr)) 448 /*
449 * VSX instructions can access FP and vector registers, so if
450 * we are giving up VSX, make sure we give up FP and VMX as well.
451 */
452 if (msr & MSR_VSX)
453 msr |= MSR_FP | MSR_VEC;
454
455 msr &= vcpu->arch.guest_owned_ext;
456 if (!msr)
400 return; 457 return;
401 458
402#ifdef DEBUG_EXT 459#ifdef DEBUG_EXT
403 printk(KERN_INFO "Giving up ext 0x%lx\n", msr); 460 printk(KERN_INFO "Giving up ext 0x%lx\n", msr);
404#endif 461#endif
405 462
406 switch (msr) { 463 if (msr & MSR_FP) {
407 case MSR_FP: 464 /*
465 * Note that on CPUs with VSX, giveup_fpu stores
466 * both the traditional FP registers and the added VSX
467 * registers into thread.fpr[].
468 */
408 giveup_fpu(current); 469 giveup_fpu(current);
409 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) 470 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++)
410 vcpu_fpr[i] = thread_fpr[get_fpr_index(i)]; 471 vcpu_fpr[i] = thread_fpr[get_fpr_index(i)];
411 472
412 vcpu->arch.fpscr = t->fpscr.val; 473 vcpu->arch.fpscr = t->fpscr.val;
413 break; 474
414 case MSR_VEC: 475#ifdef CONFIG_VSX
476 if (cpu_has_feature(CPU_FTR_VSX))
477 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr) / 2; i++)
478 vcpu_vsx[i] = thread_fpr[get_fpr_index(i) + 1];
479#endif
480 }
481
415#ifdef CONFIG_ALTIVEC 482#ifdef CONFIG_ALTIVEC
483 if (msr & MSR_VEC) {
416 giveup_altivec(current); 484 giveup_altivec(current);
417 memcpy(vcpu->arch.vr, t->vr, sizeof(vcpu->arch.vr)); 485 memcpy(vcpu->arch.vr, t->vr, sizeof(vcpu->arch.vr));
418 vcpu->arch.vscr = t->vscr; 486 vcpu->arch.vscr = t->vscr;
419#endif
420 break;
421 case MSR_VSX:
422#ifdef CONFIG_VSX
423 __giveup_vsx(current);
424 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr); i++)
425 vcpu_vsx[i] = thread_fpr[get_fpr_index(i) + 1];
426#endif
427 break;
428 default:
429 BUG();
430 } 487 }
488#endif
431 489
432 vcpu->arch.guest_owned_ext &= ~msr; 490 vcpu->arch.guest_owned_ext &= ~(msr | MSR_VSX);
433 current->thread.regs->msr &= ~msr;
434 kvmppc_recalc_shadow_msr(vcpu); 491 kvmppc_recalc_shadow_msr(vcpu);
435} 492}
436 493
@@ -490,47 +547,56 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
490 return RESUME_GUEST; 547 return RESUME_GUEST;
491 } 548 }
492 549
493 /* We already own the ext */ 550 if (msr == MSR_VSX) {
494 if (vcpu->arch.guest_owned_ext & msr) { 551 /* No VSX? Give an illegal instruction interrupt */
495 return RESUME_GUEST; 552#ifdef CONFIG_VSX
553 if (!cpu_has_feature(CPU_FTR_VSX))
554#endif
555 {
556 kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
557 return RESUME_GUEST;
558 }
559
560 /*
561 * We have to load up all the FP and VMX registers before
562 * we can let the guest use VSX instructions.
563 */
564 msr = MSR_FP | MSR_VEC | MSR_VSX;
496 } 565 }
497 566
567 /* See if we already own all the ext(s) needed */
568 msr &= ~vcpu->arch.guest_owned_ext;
569 if (!msr)
570 return RESUME_GUEST;
571
498#ifdef DEBUG_EXT 572#ifdef DEBUG_EXT
499 printk(KERN_INFO "Loading up ext 0x%lx\n", msr); 573 printk(KERN_INFO "Loading up ext 0x%lx\n", msr);
500#endif 574#endif
501 575
502 current->thread.regs->msr |= msr; 576 current->thread.regs->msr |= msr;
503 577
504 switch (msr) { 578 if (msr & MSR_FP) {
505 case MSR_FP:
506 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) 579 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++)
507 thread_fpr[get_fpr_index(i)] = vcpu_fpr[i]; 580 thread_fpr[get_fpr_index(i)] = vcpu_fpr[i];
508 581#ifdef CONFIG_VSX
582 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr) / 2; i++)
583 thread_fpr[get_fpr_index(i) + 1] = vcpu_vsx[i];
584#endif
509 t->fpscr.val = vcpu->arch.fpscr; 585 t->fpscr.val = vcpu->arch.fpscr;
510 t->fpexc_mode = 0; 586 t->fpexc_mode = 0;
511 kvmppc_load_up_fpu(); 587 kvmppc_load_up_fpu();
512 break; 588 }
513 case MSR_VEC: 589
590 if (msr & MSR_VEC) {
514#ifdef CONFIG_ALTIVEC 591#ifdef CONFIG_ALTIVEC
515 memcpy(t->vr, vcpu->arch.vr, sizeof(vcpu->arch.vr)); 592 memcpy(t->vr, vcpu->arch.vr, sizeof(vcpu->arch.vr));
516 t->vscr = vcpu->arch.vscr; 593 t->vscr = vcpu->arch.vscr;
517 t->vrsave = -1; 594 t->vrsave = -1;
518 kvmppc_load_up_altivec(); 595 kvmppc_load_up_altivec();
519#endif 596#endif
520 break;
521 case MSR_VSX:
522#ifdef CONFIG_VSX
523 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr); i++)
524 thread_fpr[get_fpr_index(i) + 1] = vcpu_vsx[i];
525 kvmppc_load_up_vsx();
526#endif
527 break;
528 default:
529 BUG();
530 } 597 }
531 598
532 vcpu->arch.guest_owned_ext |= msr; 599 vcpu->arch.guest_owned_ext |= msr;
533
534 kvmppc_recalc_shadow_msr(vcpu); 600 kvmppc_recalc_shadow_msr(vcpu);
535 601
536 return RESUME_GUEST; 602 return RESUME_GUEST;
@@ -540,18 +606,18 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
540 unsigned int exit_nr) 606 unsigned int exit_nr)
541{ 607{
542 int r = RESUME_HOST; 608 int r = RESUME_HOST;
609 int s;
543 610
544 vcpu->stat.sum_exits++; 611 vcpu->stat.sum_exits++;
545 612
546 run->exit_reason = KVM_EXIT_UNKNOWN; 613 run->exit_reason = KVM_EXIT_UNKNOWN;
547 run->ready_for_interrupt_injection = 1; 614 run->ready_for_interrupt_injection = 1;
548 615
549 /* We get here with MSR.EE=0, so enable it to be a nice citizen */ 616 /* We get here with MSR.EE=1 */
550 __hard_irq_enable(); 617
618 trace_kvm_exit(exit_nr, vcpu);
619 kvm_guest_exit();
551 620
552 trace_kvm_book3s_exit(exit_nr, vcpu);
553 preempt_enable();
554 kvm_resched(vcpu);
555 switch (exit_nr) { 621 switch (exit_nr) {
556 case BOOK3S_INTERRUPT_INST_STORAGE: 622 case BOOK3S_INTERRUPT_INST_STORAGE:
557 { 623 {
@@ -802,7 +868,6 @@ program_interrupt:
802 } 868 }
803 } 869 }
804 870
805 preempt_disable();
806 if (!(r & RESUME_HOST)) { 871 if (!(r & RESUME_HOST)) {
807 /* To avoid clobbering exit_reason, only check for signals if 872 /* To avoid clobbering exit_reason, only check for signals if
808 * we aren't already exiting to userspace for some other 873 * we aren't already exiting to userspace for some other
@@ -814,20 +879,13 @@ program_interrupt:
814 * and if we really did time things so badly, then we just exit 879 * and if we really did time things so badly, then we just exit
815 * again due to a host external interrupt. 880 * again due to a host external interrupt.
816 */ 881 */
817 __hard_irq_disable(); 882 local_irq_disable();
818 if (signal_pending(current)) { 883 s = kvmppc_prepare_to_enter(vcpu);
819 __hard_irq_enable(); 884 if (s <= 0) {
820#ifdef EXIT_DEBUG 885 local_irq_enable();
821 printk(KERN_EMERG "KVM: Going back to host\n"); 886 r = s;
822#endif
823 vcpu->stat.signal_exits++;
824 run->exit_reason = KVM_EXIT_INTR;
825 r = -EINTR;
826 } else { 887 } else {
827 /* In case an interrupt came in that was triggered 888 kvmppc_lazy_ee_enable();
828 * from userspace (like DEC), we need to check what
829 * to inject now! */
830 kvmppc_core_prepare_to_enter(vcpu);
831 } 889 }
832 } 890 }
833 891
@@ -899,34 +957,59 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
899 return 0; 957 return 0;
900} 958}
901 959
902int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 960int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
903{ 961{
904 int r = -EINVAL; 962 int r = 0;
905 963
906 switch (reg->id) { 964 switch (id) {
907 case KVM_REG_PPC_HIOR: 965 case KVM_REG_PPC_HIOR:
908 r = copy_to_user((u64 __user *)(long)reg->addr, 966 *val = get_reg_val(id, to_book3s(vcpu)->hior);
909 &to_book3s(vcpu)->hior, sizeof(u64));
910 break; 967 break;
968#ifdef CONFIG_VSX
969 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: {
970 long int i = id - KVM_REG_PPC_VSR0;
971
972 if (!cpu_has_feature(CPU_FTR_VSX)) {
973 r = -ENXIO;
974 break;
975 }
976 val->vsxval[0] = vcpu->arch.fpr[i];
977 val->vsxval[1] = vcpu->arch.vsr[i];
978 break;
979 }
980#endif /* CONFIG_VSX */
911 default: 981 default:
982 r = -EINVAL;
912 break; 983 break;
913 } 984 }
914 985
915 return r; 986 return r;
916} 987}
917 988
918int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 989int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
919{ 990{
920 int r = -EINVAL; 991 int r = 0;
921 992
922 switch (reg->id) { 993 switch (id) {
923 case KVM_REG_PPC_HIOR: 994 case KVM_REG_PPC_HIOR:
924 r = copy_from_user(&to_book3s(vcpu)->hior, 995 to_book3s(vcpu)->hior = set_reg_val(id, *val);
925 (u64 __user *)(long)reg->addr, sizeof(u64)); 996 to_book3s(vcpu)->hior_explicit = true;
926 if (!r) 997 break;
927 to_book3s(vcpu)->hior_explicit = true; 998#ifdef CONFIG_VSX
999 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: {
1000 long int i = id - KVM_REG_PPC_VSR0;
1001
1002 if (!cpu_has_feature(CPU_FTR_VSX)) {
1003 r = -ENXIO;
1004 break;
1005 }
1006 vcpu->arch.fpr[i] = val->vsxval[0];
1007 vcpu->arch.vsr[i] = val->vsxval[1];
928 break; 1008 break;
1009 }
1010#endif /* CONFIG_VSX */
929 default: 1011 default:
1012 r = -EINVAL;
930 break; 1013 break;
931 } 1014 }
932 1015
@@ -1020,8 +1103,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1020#endif 1103#endif
1021 ulong ext_msr; 1104 ulong ext_msr;
1022 1105
1023 preempt_disable();
1024
1025 /* Check if we can run the vcpu at all */ 1106 /* Check if we can run the vcpu at all */
1026 if (!vcpu->arch.sane) { 1107 if (!vcpu->arch.sane) {
1027 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 1108 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
@@ -1029,21 +1110,16 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1029 goto out; 1110 goto out;
1030 } 1111 }
1031 1112
1032 kvmppc_core_prepare_to_enter(vcpu);
1033
1034 /* 1113 /*
1035 * Interrupts could be timers for the guest which we have to inject 1114 * Interrupts could be timers for the guest which we have to inject
1036 * again, so let's postpone them until we're in the guest and if we 1115 * again, so let's postpone them until we're in the guest and if we
1037 * really did time things so badly, then we just exit again due to 1116 * really did time things so badly, then we just exit again due to
1038 * a host external interrupt. 1117 * a host external interrupt.
1039 */ 1118 */
1040 __hard_irq_disable(); 1119 local_irq_disable();
1041 1120 ret = kvmppc_prepare_to_enter(vcpu);
1042 /* No need to go into the guest when all we do is going out */ 1121 if (ret <= 0) {
1043 if (signal_pending(current)) { 1122 local_irq_enable();
1044 __hard_irq_enable();
1045 kvm_run->exit_reason = KVM_EXIT_INTR;
1046 ret = -EINTR;
1047 goto out; 1123 goto out;
1048 } 1124 }
1049 1125
@@ -1070,7 +1146,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1070 /* Save VSX state in stack */ 1146 /* Save VSX state in stack */
1071 used_vsr = current->thread.used_vsr; 1147 used_vsr = current->thread.used_vsr;
1072 if (used_vsr && (current->thread.regs->msr & MSR_VSX)) 1148 if (used_vsr && (current->thread.regs->msr & MSR_VSX))
1073 __giveup_vsx(current); 1149 __giveup_vsx(current);
1074#endif 1150#endif
1075 1151
1076 /* Remember the MSR with disabled extensions */ 1152 /* Remember the MSR with disabled extensions */
@@ -1080,20 +1156,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1080 if (vcpu->arch.shared->msr & MSR_FP) 1156 if (vcpu->arch.shared->msr & MSR_FP)
1081 kvmppc_handle_ext(vcpu, BOOK3S_INTERRUPT_FP_UNAVAIL, MSR_FP); 1157 kvmppc_handle_ext(vcpu, BOOK3S_INTERRUPT_FP_UNAVAIL, MSR_FP);
1082 1158
1083 kvm_guest_enter(); 1159 kvmppc_lazy_ee_enable();
1084 1160
1085 ret = __kvmppc_vcpu_run(kvm_run, vcpu); 1161 ret = __kvmppc_vcpu_run(kvm_run, vcpu);
1086 1162
1087 kvm_guest_exit(); 1163 /* No need for kvm_guest_exit. It's done in handle_exit.
1088 1164 We also get here with interrupts enabled. */
1089 current->thread.regs->msr = ext_msr;
1090 1165
1091 /* Make sure we save the guest FPU/Altivec/VSX state */ 1166 /* Make sure we save the guest FPU/Altivec/VSX state */
1092 kvmppc_giveup_ext(vcpu, MSR_FP); 1167 kvmppc_giveup_ext(vcpu, MSR_FP | MSR_VEC | MSR_VSX);
1093 kvmppc_giveup_ext(vcpu, MSR_VEC); 1168
1094 kvmppc_giveup_ext(vcpu, MSR_VSX); 1169 current->thread.regs->msr = ext_msr;
1095 1170
1096 /* Restore FPU state from stack */ 1171 /* Restore FPU/VSX state from stack */
1097 memcpy(current->thread.fpr, fpr, sizeof(current->thread.fpr)); 1172 memcpy(current->thread.fpr, fpr, sizeof(current->thread.fpr));
1098 current->thread.fpscr.val = fpscr; 1173 current->thread.fpscr.val = fpscr;
1099 current->thread.fpexc_mode = fpexc_mode; 1174 current->thread.fpexc_mode = fpexc_mode;
@@ -1113,7 +1188,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1113#endif 1188#endif
1114 1189
1115out: 1190out:
1116 preempt_enable(); 1191 vcpu->mode = OUTSIDE_GUEST_MODE;
1117 return ret; 1192 return ret;
1118} 1193}
1119 1194
@@ -1181,14 +1256,31 @@ int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, struct kvm_ppc_smmu_info *info)
1181} 1256}
1182#endif /* CONFIG_PPC64 */ 1257#endif /* CONFIG_PPC64 */
1183 1258
1259void kvmppc_core_free_memslot(struct kvm_memory_slot *free,
1260 struct kvm_memory_slot *dont)
1261{
1262}
1263
1264int kvmppc_core_create_memslot(struct kvm_memory_slot *slot,
1265 unsigned long npages)
1266{
1267 return 0;
1268}
1269
1184int kvmppc_core_prepare_memory_region(struct kvm *kvm, 1270int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1271 struct kvm_memory_slot *memslot,
1185 struct kvm_userspace_memory_region *mem) 1272 struct kvm_userspace_memory_region *mem)
1186{ 1273{
1187 return 0; 1274 return 0;
1188} 1275}
1189 1276
1190void kvmppc_core_commit_memory_region(struct kvm *kvm, 1277void kvmppc_core_commit_memory_region(struct kvm *kvm,
1191 struct kvm_userspace_memory_region *mem) 1278 struct kvm_userspace_memory_region *mem,
1279 struct kvm_memory_slot old)
1280{
1281}
1282
1283void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot)
1192{ 1284{
1193} 1285}
1194 1286
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S
index 9ecf6e35cd8..8f7633e3afb 100644
--- a/arch/powerpc/kvm/book3s_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_rmhandlers.S
@@ -170,20 +170,21 @@ kvmppc_handler_skip_ins:
170 * Call kvmppc_handler_trampoline_enter in real mode 170 * Call kvmppc_handler_trampoline_enter in real mode
171 * 171 *
172 * On entry, r4 contains the guest shadow MSR 172 * On entry, r4 contains the guest shadow MSR
173 * MSR.EE has to be 0 when calling this function
173 */ 174 */
174_GLOBAL(kvmppc_entry_trampoline) 175_GLOBAL(kvmppc_entry_trampoline)
175 mfmsr r5 176 mfmsr r5
176 LOAD_REG_ADDR(r7, kvmppc_handler_trampoline_enter) 177 LOAD_REG_ADDR(r7, kvmppc_handler_trampoline_enter)
177 toreal(r7) 178 toreal(r7)
178 179
179 li r9, MSR_RI
180 ori r9, r9, MSR_EE
181 andc r9, r5, r9 /* Clear EE and RI in MSR value */
182 li r6, MSR_IR | MSR_DR 180 li r6, MSR_IR | MSR_DR
183 ori r6, r6, MSR_EE 181 andc r6, r5, r6 /* Clear DR and IR in MSR value */
184 andc r6, r5, r6 /* Clear EE, DR and IR in MSR value */ 182 /*
185 MTMSR_EERI(r9) /* Clear EE and RI in MSR */ 183 * Set EE in HOST_MSR so that it's enabled when we get into our
186 mtsrr0 r7 /* before we set srr0/1 */ 184 * C exit handler function
185 */
186 ori r5, r5, MSR_EE
187 mtsrr0 r7
187 mtsrr1 r6 188 mtsrr1 r6
188 RFI 189 RFI
189 190
@@ -233,8 +234,5 @@ define_load_up(fpu)
233#ifdef CONFIG_ALTIVEC 234#ifdef CONFIG_ALTIVEC
234define_load_up(altivec) 235define_load_up(altivec)
235#endif 236#endif
236#ifdef CONFIG_VSX
237define_load_up(vsx)
238#endif
239 237
240#include "book3s_segment.S" 238#include "book3s_segment.S"
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index d25a097c852..69f11401578 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -36,9 +36,11 @@
36#include <asm/dbell.h> 36#include <asm/dbell.h>
37#include <asm/hw_irq.h> 37#include <asm/hw_irq.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/time.h>
39 40
40#include "timing.h" 41#include "timing.h"
41#include "booke.h" 42#include "booke.h"
43#include "trace.h"
42 44
43unsigned long kvmppc_booke_handlers; 45unsigned long kvmppc_booke_handlers;
44 46
@@ -62,6 +64,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
62 { "halt_wakeup", VCPU_STAT(halt_wakeup) }, 64 { "halt_wakeup", VCPU_STAT(halt_wakeup) },
63 { "doorbell", VCPU_STAT(dbell_exits) }, 65 { "doorbell", VCPU_STAT(dbell_exits) },
64 { "guest doorbell", VCPU_STAT(gdbell_exits) }, 66 { "guest doorbell", VCPU_STAT(gdbell_exits) },
67 { "remote_tlb_flush", VM_STAT(remote_tlb_flush) },
65 { NULL } 68 { NULL }
66}; 69};
67 70
@@ -120,6 +123,16 @@ static void kvmppc_vcpu_sync_spe(struct kvm_vcpu *vcpu)
120} 123}
121#endif 124#endif
122 125
126static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu)
127{
128#if defined(CONFIG_PPC_FPU) && !defined(CONFIG_KVM_BOOKE_HV)
129 /* We always treat the FP bit as enabled from the host
130 perspective, so only need to adjust the shadow MSR */
131 vcpu->arch.shadow_msr &= ~MSR_FP;
132 vcpu->arch.shadow_msr |= vcpu->arch.shared->msr & MSR_FP;
133#endif
134}
135
123/* 136/*
124 * Helper function for "full" MSR writes. No need to call this if only 137 * Helper function for "full" MSR writes. No need to call this if only
125 * EE/CE/ME/DE/RI are changing. 138 * EE/CE/ME/DE/RI are changing.
@@ -136,11 +149,13 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
136 149
137 kvmppc_mmu_msr_notify(vcpu, old_msr); 150 kvmppc_mmu_msr_notify(vcpu, old_msr);
138 kvmppc_vcpu_sync_spe(vcpu); 151 kvmppc_vcpu_sync_spe(vcpu);
152 kvmppc_vcpu_sync_fpu(vcpu);
139} 153}
140 154
141static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu, 155static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu,
142 unsigned int priority) 156 unsigned int priority)
143{ 157{
158 trace_kvm_booke_queue_irqprio(vcpu, priority);
144 set_bit(priority, &vcpu->arch.pending_exceptions); 159 set_bit(priority, &vcpu->arch.pending_exceptions);
145} 160}
146 161
@@ -206,6 +221,16 @@ void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu,
206 clear_bit(BOOKE_IRQPRIO_EXTERNAL_LEVEL, &vcpu->arch.pending_exceptions); 221 clear_bit(BOOKE_IRQPRIO_EXTERNAL_LEVEL, &vcpu->arch.pending_exceptions);
207} 222}
208 223
224static void kvmppc_core_queue_watchdog(struct kvm_vcpu *vcpu)
225{
226 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_WATCHDOG);
227}
228
229static void kvmppc_core_dequeue_watchdog(struct kvm_vcpu *vcpu)
230{
231 clear_bit(BOOKE_IRQPRIO_WATCHDOG, &vcpu->arch.pending_exceptions);
232}
233
209static void set_guest_srr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1) 234static void set_guest_srr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1)
210{ 235{
211#ifdef CONFIG_KVM_BOOKE_HV 236#ifdef CONFIG_KVM_BOOKE_HV
@@ -287,6 +312,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
287 bool crit; 312 bool crit;
288 bool keep_irq = false; 313 bool keep_irq = false;
289 enum int_class int_class; 314 enum int_class int_class;
315 ulong new_msr = vcpu->arch.shared->msr;
290 316
291 /* Truncate crit indicators in 32 bit mode */ 317 /* Truncate crit indicators in 32 bit mode */
292 if (!(vcpu->arch.shared->msr & MSR_SF)) { 318 if (!(vcpu->arch.shared->msr & MSR_SF)) {
@@ -325,6 +351,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
325 msr_mask = MSR_CE | MSR_ME | MSR_DE; 351 msr_mask = MSR_CE | MSR_ME | MSR_DE;
326 int_class = INT_CLASS_NONCRIT; 352 int_class = INT_CLASS_NONCRIT;
327 break; 353 break;
354 case BOOKE_IRQPRIO_WATCHDOG:
328 case BOOKE_IRQPRIO_CRITICAL: 355 case BOOKE_IRQPRIO_CRITICAL:
329 case BOOKE_IRQPRIO_DBELL_CRIT: 356 case BOOKE_IRQPRIO_DBELL_CRIT:
330 allowed = vcpu->arch.shared->msr & MSR_CE; 357 allowed = vcpu->arch.shared->msr & MSR_CE;
@@ -381,7 +408,13 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
381 set_guest_esr(vcpu, vcpu->arch.queued_esr); 408 set_guest_esr(vcpu, vcpu->arch.queued_esr);
382 if (update_dear == true) 409 if (update_dear == true)
383 set_guest_dear(vcpu, vcpu->arch.queued_dear); 410 set_guest_dear(vcpu, vcpu->arch.queued_dear);
384 kvmppc_set_msr(vcpu, vcpu->arch.shared->msr & msr_mask); 411
412 new_msr &= msr_mask;
413#if defined(CONFIG_64BIT)
414 if (vcpu->arch.epcr & SPRN_EPCR_ICM)
415 new_msr |= MSR_CM;
416#endif
417 kvmppc_set_msr(vcpu, new_msr);
385 418
386 if (!keep_irq) 419 if (!keep_irq)
387 clear_bit(priority, &vcpu->arch.pending_exceptions); 420 clear_bit(priority, &vcpu->arch.pending_exceptions);
@@ -404,12 +437,121 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
404 return allowed; 437 return allowed;
405} 438}
406 439
440/*
441 * Return the number of jiffies until the next timeout. If the timeout is
442 * longer than the NEXT_TIMER_MAX_DELTA, then return NEXT_TIMER_MAX_DELTA
443 * because the larger value can break the timer APIs.
444 */
445static unsigned long watchdog_next_timeout(struct kvm_vcpu *vcpu)
446{
447 u64 tb, wdt_tb, wdt_ticks = 0;
448 u64 nr_jiffies = 0;
449 u32 period = TCR_GET_WP(vcpu->arch.tcr);
450
451 wdt_tb = 1ULL << (63 - period);
452 tb = get_tb();
453 /*
454 * The watchdog timeout will hapeen when TB bit corresponding
455 * to watchdog will toggle from 0 to 1.
456 */
457 if (tb & wdt_tb)
458 wdt_ticks = wdt_tb;
459
460 wdt_ticks += wdt_tb - (tb & (wdt_tb - 1));
461
462 /* Convert timebase ticks to jiffies */
463 nr_jiffies = wdt_ticks;
464
465 if (do_div(nr_jiffies, tb_ticks_per_jiffy))
466 nr_jiffies++;
467
468 return min_t(unsigned long long, nr_jiffies, NEXT_TIMER_MAX_DELTA);
469}
470
471static void arm_next_watchdog(struct kvm_vcpu *vcpu)
472{
473 unsigned long nr_jiffies;
474 unsigned long flags;
475
476 /*
477 * If TSR_ENW and TSR_WIS are not set then no need to exit to
478 * userspace, so clear the KVM_REQ_WATCHDOG request.
479 */
480 if ((vcpu->arch.tsr & (TSR_ENW | TSR_WIS)) != (TSR_ENW | TSR_WIS))
481 clear_bit(KVM_REQ_WATCHDOG, &vcpu->requests);
482
483 spin_lock_irqsave(&vcpu->arch.wdt_lock, flags);
484 nr_jiffies = watchdog_next_timeout(vcpu);
485 /*
486 * If the number of jiffies of watchdog timer >= NEXT_TIMER_MAX_DELTA
487 * then do not run the watchdog timer as this can break timer APIs.
488 */
489 if (nr_jiffies < NEXT_TIMER_MAX_DELTA)
490 mod_timer(&vcpu->arch.wdt_timer, jiffies + nr_jiffies);
491 else
492 del_timer(&vcpu->arch.wdt_timer);
493 spin_unlock_irqrestore(&vcpu->arch.wdt_lock, flags);
494}
495
496void kvmppc_watchdog_func(unsigned long data)
497{
498 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
499 u32 tsr, new_tsr;
500 int final;
501
502 do {
503 new_tsr = tsr = vcpu->arch.tsr;
504 final = 0;
505
506 /* Time out event */
507 if (tsr & TSR_ENW) {
508 if (tsr & TSR_WIS)
509 final = 1;
510 else
511 new_tsr = tsr | TSR_WIS;
512 } else {
513 new_tsr = tsr | TSR_ENW;
514 }
515 } while (cmpxchg(&vcpu->arch.tsr, tsr, new_tsr) != tsr);
516
517 if (new_tsr & TSR_WIS) {
518 smp_wmb();
519 kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu);
520 kvm_vcpu_kick(vcpu);
521 }
522
523 /*
524 * If this is final watchdog expiry and some action is required
525 * then exit to userspace.
526 */
527 if (final && (vcpu->arch.tcr & TCR_WRC_MASK) &&
528 vcpu->arch.watchdog_enabled) {
529 smp_wmb();
530 kvm_make_request(KVM_REQ_WATCHDOG, vcpu);
531 kvm_vcpu_kick(vcpu);
532 }
533
534 /*
535 * Stop running the watchdog timer after final expiration to
536 * prevent the host from being flooded with timers if the
537 * guest sets a short period.
538 * Timers will resume when TSR/TCR is updated next time.
539 */
540 if (!final)
541 arm_next_watchdog(vcpu);
542}
543
407static void update_timer_ints(struct kvm_vcpu *vcpu) 544static void update_timer_ints(struct kvm_vcpu *vcpu)
408{ 545{
409 if ((vcpu->arch.tcr & TCR_DIE) && (vcpu->arch.tsr & TSR_DIS)) 546 if ((vcpu->arch.tcr & TCR_DIE) && (vcpu->arch.tsr & TSR_DIS))
410 kvmppc_core_queue_dec(vcpu); 547 kvmppc_core_queue_dec(vcpu);
411 else 548 else
412 kvmppc_core_dequeue_dec(vcpu); 549 kvmppc_core_dequeue_dec(vcpu);
550
551 if ((vcpu->arch.tcr & TCR_WIE) && (vcpu->arch.tsr & TSR_WIS))
552 kvmppc_core_queue_watchdog(vcpu);
553 else
554 kvmppc_core_dequeue_watchdog(vcpu);
413} 555}
414 556
415static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) 557static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
@@ -417,13 +559,6 @@ static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
417 unsigned long *pending = &vcpu->arch.pending_exceptions; 559 unsigned long *pending = &vcpu->arch.pending_exceptions;
418 unsigned int priority; 560 unsigned int priority;
419 561
420 if (vcpu->requests) {
421 if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
422 smp_mb();
423 update_timer_ints(vcpu);
424 }
425 }
426
427 priority = __ffs(*pending); 562 priority = __ffs(*pending);
428 while (priority < BOOKE_IRQPRIO_MAX) { 563 while (priority < BOOKE_IRQPRIO_MAX) {
429 if (kvmppc_booke_irqprio_deliver(vcpu, priority)) 564 if (kvmppc_booke_irqprio_deliver(vcpu, priority))
@@ -459,37 +594,20 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
459 return r; 594 return r;
460} 595}
461 596
462/* 597int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
463 * Common checks before entering the guest world. Call with interrupts
464 * disabled.
465 *
466 * returns !0 if a signal is pending and check_signal is true
467 */
468static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
469{ 598{
470 int r = 0; 599 int r = 1; /* Indicate we want to get back into the guest */
471 600
472 WARN_ON_ONCE(!irqs_disabled()); 601 if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu))
473 while (true) { 602 update_timer_ints(vcpu);
474 if (need_resched()) { 603#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
475 local_irq_enable(); 604 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu))
476 cond_resched(); 605 kvmppc_core_flush_tlb(vcpu);
477 local_irq_disable(); 606#endif
478 continue;
479 }
480
481 if (signal_pending(current)) {
482 r = 1;
483 break;
484 }
485
486 if (kvmppc_core_prepare_to_enter(vcpu)) {
487 /* interrupts got enabled in between, so we
488 are back at square 1 */
489 continue;
490 }
491 607
492 break; 608 if (kvm_check_request(KVM_REQ_WATCHDOG, vcpu)) {
609 vcpu->run->exit_reason = KVM_EXIT_WATCHDOG;
610 r = 0;
493 } 611 }
494 612
495 return r; 613 return r;
@@ -497,7 +615,7 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
497 615
498int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 616int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
499{ 617{
500 int ret; 618 int ret, s;
501#ifdef CONFIG_PPC_FPU 619#ifdef CONFIG_PPC_FPU
502 unsigned int fpscr; 620 unsigned int fpscr;
503 int fpexc_mode; 621 int fpexc_mode;
@@ -510,11 +628,13 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
510 } 628 }
511 629
512 local_irq_disable(); 630 local_irq_disable();
513 if (kvmppc_prepare_to_enter(vcpu)) { 631 s = kvmppc_prepare_to_enter(vcpu);
514 kvm_run->exit_reason = KVM_EXIT_INTR; 632 if (s <= 0) {
515 ret = -EINTR; 633 local_irq_enable();
634 ret = s;
516 goto out; 635 goto out;
517 } 636 }
637 kvmppc_lazy_ee_enable();
518 638
519 kvm_guest_enter(); 639 kvm_guest_enter();
520 640
@@ -542,6 +662,9 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
542 662
543 ret = __kvmppc_vcpu_run(kvm_run, vcpu); 663 ret = __kvmppc_vcpu_run(kvm_run, vcpu);
544 664
665 /* No need for kvm_guest_exit. It's done in handle_exit.
666 We also get here with interrupts enabled. */
667
545#ifdef CONFIG_PPC_FPU 668#ifdef CONFIG_PPC_FPU
546 kvmppc_save_guest_fp(vcpu); 669 kvmppc_save_guest_fp(vcpu);
547 670
@@ -557,10 +680,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
557 current->thread.fpexc_mode = fpexc_mode; 680 current->thread.fpexc_mode = fpexc_mode;
558#endif 681#endif
559 682
560 kvm_guest_exit();
561
562out: 683out:
563 local_irq_enable(); 684 vcpu->mode = OUTSIDE_GUEST_MODE;
564 return ret; 685 return ret;
565} 686}
566 687
@@ -668,6 +789,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
668 unsigned int exit_nr) 789 unsigned int exit_nr)
669{ 790{
670 int r = RESUME_HOST; 791 int r = RESUME_HOST;
792 int s;
671 793
672 /* update before a new last_exit_type is rewritten */ 794 /* update before a new last_exit_type is rewritten */
673 kvmppc_update_timing_stats(vcpu); 795 kvmppc_update_timing_stats(vcpu);
@@ -677,6 +799,9 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
677 799
678 local_irq_enable(); 800 local_irq_enable();
679 801
802 trace_kvm_exit(exit_nr, vcpu);
803 kvm_guest_exit();
804
680 run->exit_reason = KVM_EXIT_UNKNOWN; 805 run->exit_reason = KVM_EXIT_UNKNOWN;
681 run->ready_for_interrupt_injection = 1; 806 run->ready_for_interrupt_injection = 1;
682 807
@@ -971,10 +1096,12 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
971 */ 1096 */
972 if (!(r & RESUME_HOST)) { 1097 if (!(r & RESUME_HOST)) {
973 local_irq_disable(); 1098 local_irq_disable();
974 if (kvmppc_prepare_to_enter(vcpu)) { 1099 s = kvmppc_prepare_to_enter(vcpu);
975 run->exit_reason = KVM_EXIT_INTR; 1100 if (s <= 0) {
976 r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV); 1101 local_irq_enable();
977 kvmppc_account_exit(vcpu, SIGNAL_EXITS); 1102 r = (s << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
1103 } else {
1104 kvmppc_lazy_ee_enable();
978 } 1105 }
979 } 1106 }
980 1107
@@ -1011,6 +1138,21 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
1011 return r; 1138 return r;
1012} 1139}
1013 1140
1141int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu)
1142{
1143 /* setup watchdog timer once */
1144 spin_lock_init(&vcpu->arch.wdt_lock);
1145 setup_timer(&vcpu->arch.wdt_timer, kvmppc_watchdog_func,
1146 (unsigned long)vcpu);
1147
1148 return 0;
1149}
1150
1151void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu)
1152{
1153 del_timer_sync(&vcpu->arch.wdt_timer);
1154}
1155
1014int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 1156int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1015{ 1157{
1016 int i; 1158 int i;
@@ -1106,7 +1248,13 @@ static int set_sregs_base(struct kvm_vcpu *vcpu,
1106 } 1248 }
1107 1249
1108 if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR) { 1250 if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR) {
1251 u32 old_tsr = vcpu->arch.tsr;
1252
1109 vcpu->arch.tsr = sregs->u.e.tsr; 1253 vcpu->arch.tsr = sregs->u.e.tsr;
1254
1255 if ((old_tsr ^ vcpu->arch.tsr) & (TSR_ENW | TSR_WIS))
1256 arm_next_watchdog(vcpu);
1257
1110 update_timer_ints(vcpu); 1258 update_timer_ints(vcpu);
1111 } 1259 }
1112 1260
@@ -1221,12 +1369,70 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1221 1369
1222int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 1370int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1223{ 1371{
1224 return -EINVAL; 1372 int r = -EINVAL;
1373
1374 switch (reg->id) {
1375 case KVM_REG_PPC_IAC1:
1376 case KVM_REG_PPC_IAC2:
1377 case KVM_REG_PPC_IAC3:
1378 case KVM_REG_PPC_IAC4: {
1379 int iac = reg->id - KVM_REG_PPC_IAC1;
1380 r = copy_to_user((u64 __user *)(long)reg->addr,
1381 &vcpu->arch.dbg_reg.iac[iac], sizeof(u64));
1382 break;
1383 }
1384 case KVM_REG_PPC_DAC1:
1385 case KVM_REG_PPC_DAC2: {
1386 int dac = reg->id - KVM_REG_PPC_DAC1;
1387 r = copy_to_user((u64 __user *)(long)reg->addr,
1388 &vcpu->arch.dbg_reg.dac[dac], sizeof(u64));
1389 break;
1390 }
1391#if defined(CONFIG_64BIT)
1392 case KVM_REG_PPC_EPCR:
1393 r = put_user(vcpu->arch.epcr, (u32 __user *)(long)reg->addr);
1394 break;
1395#endif
1396 default:
1397 break;
1398 }
1399 return r;
1225} 1400}
1226 1401
1227int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 1402int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1228{ 1403{
1229 return -EINVAL; 1404 int r = -EINVAL;
1405
1406 switch (reg->id) {
1407 case KVM_REG_PPC_IAC1:
1408 case KVM_REG_PPC_IAC2:
1409 case KVM_REG_PPC_IAC3:
1410 case KVM_REG_PPC_IAC4: {
1411 int iac = reg->id - KVM_REG_PPC_IAC1;
1412 r = copy_from_user(&vcpu->arch.dbg_reg.iac[iac],
1413 (u64 __user *)(long)reg->addr, sizeof(u64));
1414 break;
1415 }
1416 case KVM_REG_PPC_DAC1:
1417 case KVM_REG_PPC_DAC2: {
1418 int dac = reg->id - KVM_REG_PPC_DAC1;
1419 r = copy_from_user(&vcpu->arch.dbg_reg.dac[dac],
1420 (u64 __user *)(long)reg->addr, sizeof(u64));
1421 break;
1422 }
1423#if defined(CONFIG_64BIT)
1424 case KVM_REG_PPC_EPCR: {
1425 u32 new_epcr;
1426 r = get_user(new_epcr, (u32 __user *)(long)reg->addr);
1427 if (r == 0)
1428 kvmppc_set_epcr(vcpu, new_epcr);
1429 break;
1430 }
1431#endif
1432 default:
1433 break;
1434 }
1435 return r;
1230} 1436}
1231 1437
1232int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 1438int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
@@ -1253,20 +1459,50 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
1253 return -ENOTSUPP; 1459 return -ENOTSUPP;
1254} 1460}
1255 1461
1462void kvmppc_core_free_memslot(struct kvm_memory_slot *free,
1463 struct kvm_memory_slot *dont)
1464{
1465}
1466
1467int kvmppc_core_create_memslot(struct kvm_memory_slot *slot,
1468 unsigned long npages)
1469{
1470 return 0;
1471}
1472
1256int kvmppc_core_prepare_memory_region(struct kvm *kvm, 1473int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1474 struct kvm_memory_slot *memslot,
1257 struct kvm_userspace_memory_region *mem) 1475 struct kvm_userspace_memory_region *mem)
1258{ 1476{
1259 return 0; 1477 return 0;
1260} 1478}
1261 1479
1262void kvmppc_core_commit_memory_region(struct kvm *kvm, 1480void kvmppc_core_commit_memory_region(struct kvm *kvm,
1263 struct kvm_userspace_memory_region *mem) 1481 struct kvm_userspace_memory_region *mem,
1482 struct kvm_memory_slot old)
1483{
1484}
1485
1486void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot)
1487{
1488}
1489
1490void kvmppc_set_epcr(struct kvm_vcpu *vcpu, u32 new_epcr)
1264{ 1491{
1492#if defined(CONFIG_64BIT)
1493 vcpu->arch.epcr = new_epcr;
1494#ifdef CONFIG_KVM_BOOKE_HV
1495 vcpu->arch.shadow_epcr &= ~SPRN_EPCR_GICM;
1496 if (vcpu->arch.epcr & SPRN_EPCR_ICM)
1497 vcpu->arch.shadow_epcr |= SPRN_EPCR_GICM;
1498#endif
1499#endif
1265} 1500}
1266 1501
1267void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr) 1502void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr)
1268{ 1503{
1269 vcpu->arch.tcr = new_tcr; 1504 vcpu->arch.tcr = new_tcr;
1505 arm_next_watchdog(vcpu);
1270 update_timer_ints(vcpu); 1506 update_timer_ints(vcpu);
1271} 1507}
1272 1508
@@ -1281,6 +1517,14 @@ void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits)
1281void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits) 1517void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits)
1282{ 1518{
1283 clear_bits(tsr_bits, &vcpu->arch.tsr); 1519 clear_bits(tsr_bits, &vcpu->arch.tsr);
1520
1521 /*
1522 * We may have stopped the watchdog due to
1523 * being stuck on final expiration.
1524 */
1525 if (tsr_bits & (TSR_ENW | TSR_WIS))
1526 arm_next_watchdog(vcpu);
1527
1284 update_timer_ints(vcpu); 1528 update_timer_ints(vcpu);
1285} 1529}
1286 1530
@@ -1298,12 +1542,14 @@ void kvmppc_decrementer_func(unsigned long data)
1298 1542
1299void kvmppc_booke_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 1543void kvmppc_booke_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1300{ 1544{
1545 vcpu->cpu = smp_processor_id();
1301 current->thread.kvm_vcpu = vcpu; 1546 current->thread.kvm_vcpu = vcpu;
1302} 1547}
1303 1548
1304void kvmppc_booke_vcpu_put(struct kvm_vcpu *vcpu) 1549void kvmppc_booke_vcpu_put(struct kvm_vcpu *vcpu)
1305{ 1550{
1306 current->thread.kvm_vcpu = NULL; 1551 current->thread.kvm_vcpu = NULL;
1552 vcpu->cpu = -1;
1307} 1553}
1308 1554
1309int __init kvmppc_booke_init(void) 1555int __init kvmppc_booke_init(void)
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index ba61974c1e2..e9b88e433f6 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -69,6 +69,7 @@ extern unsigned long kvmppc_booke_handlers;
69void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr); 69void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr);
70void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr); 70void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr);
71 71
72void kvmppc_set_epcr(struct kvm_vcpu *vcpu, u32 new_epcr);
72void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr); 73void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr);
73void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits); 74void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
74void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits); 75void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c
index 12834bb608a..4685b8cf224 100644
--- a/arch/powerpc/kvm/booke_emulate.c
+++ b/arch/powerpc/kvm/booke_emulate.c
@@ -133,10 +133,10 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
133 vcpu->arch.csrr1 = spr_val; 133 vcpu->arch.csrr1 = spr_val;
134 break; 134 break;
135 case SPRN_DBCR0: 135 case SPRN_DBCR0:
136 vcpu->arch.dbcr0 = spr_val; 136 vcpu->arch.dbg_reg.dbcr0 = spr_val;
137 break; 137 break;
138 case SPRN_DBCR1: 138 case SPRN_DBCR1:
139 vcpu->arch.dbcr1 = spr_val; 139 vcpu->arch.dbg_reg.dbcr1 = spr_val;
140 break; 140 break;
141 case SPRN_DBSR: 141 case SPRN_DBSR:
142 vcpu->arch.dbsr &= ~spr_val; 142 vcpu->arch.dbsr &= ~spr_val;
@@ -145,6 +145,14 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
145 kvmppc_clr_tsr_bits(vcpu, spr_val); 145 kvmppc_clr_tsr_bits(vcpu, spr_val);
146 break; 146 break;
147 case SPRN_TCR: 147 case SPRN_TCR:
148 /*
149 * WRC is a 2-bit field that is supposed to preserve its
150 * value once written to non-zero.
151 */
152 if (vcpu->arch.tcr & TCR_WRC_MASK) {
153 spr_val &= ~TCR_WRC_MASK;
154 spr_val |= vcpu->arch.tcr & TCR_WRC_MASK;
155 }
148 kvmppc_set_tcr(vcpu, spr_val); 156 kvmppc_set_tcr(vcpu, spr_val);
149 break; 157 break;
150 158
@@ -229,7 +237,17 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
229 case SPRN_IVOR15: 237 case SPRN_IVOR15:
230 vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG] = spr_val; 238 vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG] = spr_val;
231 break; 239 break;
232 240 case SPRN_MCSR:
241 vcpu->arch.mcsr &= ~spr_val;
242 break;
243#if defined(CONFIG_64BIT)
244 case SPRN_EPCR:
245 kvmppc_set_epcr(vcpu, spr_val);
246#ifdef CONFIG_KVM_BOOKE_HV
247 mtspr(SPRN_EPCR, vcpu->arch.shadow_epcr);
248#endif
249 break;
250#endif
233 default: 251 default:
234 emulated = EMULATE_FAIL; 252 emulated = EMULATE_FAIL;
235 } 253 }
@@ -258,10 +276,10 @@ int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
258 *spr_val = vcpu->arch.csrr1; 276 *spr_val = vcpu->arch.csrr1;
259 break; 277 break;
260 case SPRN_DBCR0: 278 case SPRN_DBCR0:
261 *spr_val = vcpu->arch.dbcr0; 279 *spr_val = vcpu->arch.dbg_reg.dbcr0;
262 break; 280 break;
263 case SPRN_DBCR1: 281 case SPRN_DBCR1:
264 *spr_val = vcpu->arch.dbcr1; 282 *spr_val = vcpu->arch.dbg_reg.dbcr1;
265 break; 283 break;
266 case SPRN_DBSR: 284 case SPRN_DBSR:
267 *spr_val = vcpu->arch.dbsr; 285 *spr_val = vcpu->arch.dbsr;
@@ -321,6 +339,14 @@ int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
321 case SPRN_IVOR15: 339 case SPRN_IVOR15:
322 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG]; 340 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG];
323 break; 341 break;
342 case SPRN_MCSR:
343 *spr_val = vcpu->arch.mcsr;
344 break;
345#if defined(CONFIG_64BIT)
346 case SPRN_EPCR:
347 *spr_val = vcpu->arch.epcr;
348 break;
349#endif
324 350
325 default: 351 default:
326 emulated = EMULATE_FAIL; 352 emulated = EMULATE_FAIL;
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index 099fe8272b5..e8ed7d659c5 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -16,6 +16,7 @@
16 * 16 *
17 * Author: Varun Sethi <varun.sethi@freescale.com> 17 * Author: Varun Sethi <varun.sethi@freescale.com>
18 * Author: Scott Wood <scotwood@freescale.com> 18 * Author: Scott Wood <scotwood@freescale.com>
19 * Author: Mihai Caraman <mihai.caraman@freescale.com>
19 * 20 *
20 * This file is derived from arch/powerpc/kvm/booke_interrupts.S 21 * This file is derived from arch/powerpc/kvm/booke_interrupts.S
21 */ 22 */
@@ -30,31 +31,33 @@
30#include <asm/bitsperlong.h> 31#include <asm/bitsperlong.h>
31#include <asm/thread_info.h> 32#include <asm/thread_info.h>
32 33
34#ifdef CONFIG_64BIT
35#include <asm/exception-64e.h>
36#else
33#include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */ 37#include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */
34 38#endif
35#define GET_VCPU(vcpu, thread) \
36 PPC_LL vcpu, THREAD_KVM_VCPU(thread)
37 39
38#define LONGBYTES (BITS_PER_LONG / 8) 40#define LONGBYTES (BITS_PER_LONG / 8)
39 41
40#define VCPU_GUEST_SPRG(n) (VCPU_GUEST_SPRGS + (n * LONGBYTES)) 42#define VCPU_GUEST_SPRG(n) (VCPU_GUEST_SPRGS + (n * LONGBYTES))
41 43
42/* The host stack layout: */ 44/* The host stack layout: */
43#define HOST_R1 (0 * LONGBYTES) /* Implied by stwu. */ 45#define HOST_R1 0 /* Implied by stwu. */
44#define HOST_CALLEE_LR (1 * LONGBYTES) 46#define HOST_CALLEE_LR PPC_LR_STKOFF
45#define HOST_RUN (2 * LONGBYTES) /* struct kvm_run */ 47#define HOST_RUN (HOST_CALLEE_LR + LONGBYTES)
46/* 48/*
47 * r2 is special: it holds 'current', and it made nonvolatile in the 49 * r2 is special: it holds 'current', and it made nonvolatile in the
48 * kernel with the -ffixed-r2 gcc option. 50 * kernel with the -ffixed-r2 gcc option.
49 */ 51 */
50#define HOST_R2 (3 * LONGBYTES) 52#define HOST_R2 (HOST_RUN + LONGBYTES)
51#define HOST_CR (4 * LONGBYTES) 53#define HOST_CR (HOST_R2 + LONGBYTES)
52#define HOST_NV_GPRS (5 * LONGBYTES) 54#define HOST_NV_GPRS (HOST_CR + LONGBYTES)
53#define __HOST_NV_GPR(n) (HOST_NV_GPRS + ((n - 14) * LONGBYTES)) 55#define __HOST_NV_GPR(n) (HOST_NV_GPRS + ((n - 14) * LONGBYTES))
54#define HOST_NV_GPR(n) __HOST_NV_GPR(__REG_##n) 56#define HOST_NV_GPR(n) __HOST_NV_GPR(__REG_##n)
55#define HOST_MIN_STACK_SIZE (HOST_NV_GPR(R31) + LONGBYTES) 57#define HOST_MIN_STACK_SIZE (HOST_NV_GPR(R31) + LONGBYTES)
56#define HOST_STACK_SIZE ((HOST_MIN_STACK_SIZE + 15) & ~15) /* Align. */ 58#define HOST_STACK_SIZE ((HOST_MIN_STACK_SIZE + 15) & ~15) /* Align. */
57#define HOST_STACK_LR (HOST_STACK_SIZE + LONGBYTES) /* In caller stack frame. */ 59/* LR in caller stack frame. */
60#define HOST_STACK_LR (HOST_STACK_SIZE + PPC_LR_STKOFF)
58 61
59#define NEED_EMU 0x00000001 /* emulation -- save nv regs */ 62#define NEED_EMU 0x00000001 /* emulation -- save nv regs */
60#define NEED_DEAR 0x00000002 /* save faulting DEAR */ 63#define NEED_DEAR 0x00000002 /* save faulting DEAR */
@@ -201,12 +204,128 @@
201 b kvmppc_resume_host 204 b kvmppc_resume_host
202.endm 205.endm
203 206
207#ifdef CONFIG_64BIT
208/* Exception types */
209#define EX_GEN 1
210#define EX_GDBELL 2
211#define EX_DBG 3
212#define EX_MC 4
213#define EX_CRIT 5
214#define EX_TLB 6
215
216/*
217 * For input register values, see arch/powerpc/include/asm/kvm_booke_hv_asm.h
218 */
219.macro kvm_handler intno type scratch, paca_ex, ex_r10, ex_r11, srr0, srr1, flags
220 _GLOBAL(kvmppc_handler_\intno\()_\srr1)
221 mr r11, r4
222 /*
223 * Get vcpu from Paca: paca->__current.thread->kvm_vcpu
224 */
225 PPC_LL r4, PACACURRENT(r13)
226 PPC_LL r4, (THREAD + THREAD_KVM_VCPU)(r4)
227 stw r10, VCPU_CR(r4)
228 PPC_STL r11, VCPU_GPR(R4)(r4)
229 PPC_STL r5, VCPU_GPR(R5)(r4)
230 .if \type == EX_CRIT
231 PPC_LL r5, (\paca_ex + EX_R13)(r13)
232 .else
233 mfspr r5, \scratch
234 .endif
235 PPC_STL r6, VCPU_GPR(R6)(r4)
236 PPC_STL r8, VCPU_GPR(R8)(r4)
237 PPC_STL r9, VCPU_GPR(R9)(r4)
238 PPC_STL r5, VCPU_GPR(R13)(r4)
239 PPC_LL r6, (\paca_ex + \ex_r10)(r13)
240 PPC_LL r8, (\paca_ex + \ex_r11)(r13)
241 PPC_STL r3, VCPU_GPR(R3)(r4)
242 PPC_STL r7, VCPU_GPR(R7)(r4)
243 PPC_STL r12, VCPU_GPR(R12)(r4)
244 PPC_STL r6, VCPU_GPR(R10)(r4)
245 PPC_STL r8, VCPU_GPR(R11)(r4)
246 mfctr r5
247 PPC_STL r5, VCPU_CTR(r4)
248 mfspr r5, \srr0
249 mfspr r6, \srr1
250 kvm_handler_common \intno, \srr0, \flags
251.endm
252
253#define EX_PARAMS(type) \
254 EX_##type, \
255 SPRN_SPRG_##type##_SCRATCH, \
256 PACA_EX##type, \
257 EX_R10, \
258 EX_R11
259
260#define EX_PARAMS_TLB \
261 EX_TLB, \
262 SPRN_SPRG_GEN_SCRATCH, \
263 PACA_EXTLB, \
264 EX_TLB_R10, \
265 EX_TLB_R11
266
267kvm_handler BOOKE_INTERRUPT_CRITICAL, EX_PARAMS(CRIT), \
268 SPRN_CSRR0, SPRN_CSRR1, 0
269kvm_handler BOOKE_INTERRUPT_MACHINE_CHECK, EX_PARAMS(MC), \
270 SPRN_MCSRR0, SPRN_MCSRR1, 0
271kvm_handler BOOKE_INTERRUPT_DATA_STORAGE, EX_PARAMS(GEN), \
272 SPRN_SRR0, SPRN_SRR1,(NEED_EMU | NEED_DEAR | NEED_ESR)
273kvm_handler BOOKE_INTERRUPT_INST_STORAGE, EX_PARAMS(GEN), \
274 SPRN_SRR0, SPRN_SRR1, NEED_ESR
275kvm_handler BOOKE_INTERRUPT_EXTERNAL, EX_PARAMS(GEN), \
276 SPRN_SRR0, SPRN_SRR1, 0
277kvm_handler BOOKE_INTERRUPT_ALIGNMENT, EX_PARAMS(GEN), \
278 SPRN_SRR0, SPRN_SRR1,(NEED_DEAR | NEED_ESR)
279kvm_handler BOOKE_INTERRUPT_PROGRAM, EX_PARAMS(GEN), \
280 SPRN_SRR0, SPRN_SRR1,NEED_ESR
281kvm_handler BOOKE_INTERRUPT_FP_UNAVAIL, EX_PARAMS(GEN), \
282 SPRN_SRR0, SPRN_SRR1, 0
283kvm_handler BOOKE_INTERRUPT_AP_UNAVAIL, EX_PARAMS(GEN), \
284 SPRN_SRR0, SPRN_SRR1, 0
285kvm_handler BOOKE_INTERRUPT_DECREMENTER, EX_PARAMS(GEN), \
286 SPRN_SRR0, SPRN_SRR1, 0
287kvm_handler BOOKE_INTERRUPT_FIT, EX_PARAMS(GEN), \
288 SPRN_SRR0, SPRN_SRR1, 0
289kvm_handler BOOKE_INTERRUPT_WATCHDOG, EX_PARAMS(CRIT),\
290 SPRN_CSRR0, SPRN_CSRR1, 0
291/*
292 * Only bolted TLB miss exception handlers are supported for now
293 */
294kvm_handler BOOKE_INTERRUPT_DTLB_MISS, EX_PARAMS_TLB, \
295 SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
296kvm_handler BOOKE_INTERRUPT_ITLB_MISS, EX_PARAMS_TLB, \
297 SPRN_SRR0, SPRN_SRR1, 0
298kvm_handler BOOKE_INTERRUPT_SPE_UNAVAIL, EX_PARAMS(GEN), \
299 SPRN_SRR0, SPRN_SRR1, 0
300kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA, EX_PARAMS(GEN), \
301 SPRN_SRR0, SPRN_SRR1, 0
302kvm_handler BOOKE_INTERRUPT_SPE_FP_ROUND, EX_PARAMS(GEN), \
303 SPRN_SRR0, SPRN_SRR1, 0
304kvm_handler BOOKE_INTERRUPT_PERFORMANCE_MONITOR, EX_PARAMS(GEN), \
305 SPRN_SRR0, SPRN_SRR1, 0
306kvm_handler BOOKE_INTERRUPT_DOORBELL, EX_PARAMS(GEN), \
307 SPRN_SRR0, SPRN_SRR1, 0
308kvm_handler BOOKE_INTERRUPT_DOORBELL_CRITICAL, EX_PARAMS(CRIT), \
309 SPRN_CSRR0, SPRN_CSRR1, 0
310kvm_handler BOOKE_INTERRUPT_HV_PRIV, EX_PARAMS(GEN), \
311 SPRN_SRR0, SPRN_SRR1, NEED_EMU
312kvm_handler BOOKE_INTERRUPT_HV_SYSCALL, EX_PARAMS(GEN), \
313 SPRN_SRR0, SPRN_SRR1, 0
314kvm_handler BOOKE_INTERRUPT_GUEST_DBELL, EX_PARAMS(GDBELL), \
315 SPRN_GSRR0, SPRN_GSRR1, 0
316kvm_handler BOOKE_INTERRUPT_GUEST_DBELL_CRIT, EX_PARAMS(CRIT), \
317 SPRN_CSRR0, SPRN_CSRR1, 0
318kvm_handler BOOKE_INTERRUPT_DEBUG, EX_PARAMS(DBG), \
319 SPRN_DSRR0, SPRN_DSRR1, 0
320kvm_handler BOOKE_INTERRUPT_DEBUG, EX_PARAMS(CRIT), \
321 SPRN_CSRR0, SPRN_CSRR1, 0
322#else
204/* 323/*
205 * For input register values, see arch/powerpc/include/asm/kvm_booke_hv_asm.h 324 * For input register values, see arch/powerpc/include/asm/kvm_booke_hv_asm.h
206 */ 325 */
207.macro kvm_handler intno srr0, srr1, flags 326.macro kvm_handler intno srr0, srr1, flags
208_GLOBAL(kvmppc_handler_\intno\()_\srr1) 327_GLOBAL(kvmppc_handler_\intno\()_\srr1)
209 GET_VCPU(r11, r10) 328 PPC_LL r11, THREAD_KVM_VCPU(r10)
210 PPC_STL r3, VCPU_GPR(R3)(r11) 329 PPC_STL r3, VCPU_GPR(R3)(r11)
211 mfspr r3, SPRN_SPRG_RSCRATCH0 330 mfspr r3, SPRN_SPRG_RSCRATCH0
212 PPC_STL r4, VCPU_GPR(R4)(r11) 331 PPC_STL r4, VCPU_GPR(R4)(r11)
@@ -233,7 +352,7 @@ _GLOBAL(kvmppc_handler_\intno\()_\srr1)
233.macro kvm_lvl_handler intno scratch srr0, srr1, flags 352.macro kvm_lvl_handler intno scratch srr0, srr1, flags
234_GLOBAL(kvmppc_handler_\intno\()_\srr1) 353_GLOBAL(kvmppc_handler_\intno\()_\srr1)
235 mfspr r10, SPRN_SPRG_THREAD 354 mfspr r10, SPRN_SPRG_THREAD
236 GET_VCPU(r11, r10) 355 PPC_LL r11, THREAD_KVM_VCPU(r10)
237 PPC_STL r3, VCPU_GPR(R3)(r11) 356 PPC_STL r3, VCPU_GPR(R3)(r11)
238 mfspr r3, \scratch 357 mfspr r3, \scratch
239 PPC_STL r4, VCPU_GPR(R4)(r11) 358 PPC_STL r4, VCPU_GPR(R4)(r11)
@@ -295,7 +414,7 @@ kvm_lvl_handler BOOKE_INTERRUPT_DEBUG, \
295 SPRN_SPRG_RSCRATCH_CRIT, SPRN_CSRR0, SPRN_CSRR1, 0 414 SPRN_SPRG_RSCRATCH_CRIT, SPRN_CSRR0, SPRN_CSRR1, 0
296kvm_lvl_handler BOOKE_INTERRUPT_DEBUG, \ 415kvm_lvl_handler BOOKE_INTERRUPT_DEBUG, \
297 SPRN_SPRG_RSCRATCH_DBG, SPRN_DSRR0, SPRN_DSRR1, 0 416 SPRN_SPRG_RSCRATCH_DBG, SPRN_DSRR0, SPRN_DSRR1, 0
298 417#endif
299 418
300/* Registers: 419/* Registers:
301 * SPRG_SCRATCH0: guest r10 420 * SPRG_SCRATCH0: guest r10
diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h
index aa8b81428bf..c70d37ed770 100644
--- a/arch/powerpc/kvm/e500.h
+++ b/arch/powerpc/kvm/e500.h
@@ -27,8 +27,7 @@
27#define E500_TLB_NUM 2 27#define E500_TLB_NUM 2
28 28
29#define E500_TLB_VALID 1 29#define E500_TLB_VALID 1
30#define E500_TLB_DIRTY 2 30#define E500_TLB_BITMAP 2
31#define E500_TLB_BITMAP 4
32 31
33struct tlbe_ref { 32struct tlbe_ref {
34 pfn_t pfn; 33 pfn_t pfn;
@@ -130,9 +129,9 @@ int kvmppc_e500_emul_mt_mmucsr0(struct kvmppc_vcpu_e500 *vcpu_e500,
130 ulong value); 129 ulong value);
131int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu); 130int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu);
132int kvmppc_e500_emul_tlbre(struct kvm_vcpu *vcpu); 131int kvmppc_e500_emul_tlbre(struct kvm_vcpu *vcpu);
133int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, int ra, int rb); 132int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, gva_t ea);
134int kvmppc_e500_emul_tlbilx(struct kvm_vcpu *vcpu, int rt, int ra, int rb); 133int kvmppc_e500_emul_tlbilx(struct kvm_vcpu *vcpu, int type, gva_t ea);
135int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb); 134int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, gva_t ea);
136int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500); 135int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500);
137void kvmppc_e500_tlb_uninit(struct kvmppc_vcpu_e500 *vcpu_e500); 136void kvmppc_e500_tlb_uninit(struct kvmppc_vcpu_e500 *vcpu_e500);
138 137
@@ -155,7 +154,7 @@ get_tlb_size(const struct kvm_book3e_206_tlb_entry *tlbe)
155 154
156static inline gva_t get_tlb_eaddr(const struct kvm_book3e_206_tlb_entry *tlbe) 155static inline gva_t get_tlb_eaddr(const struct kvm_book3e_206_tlb_entry *tlbe)
157{ 156{
158 return tlbe->mas2 & 0xfffff000; 157 return tlbe->mas2 & MAS2_EPN;
159} 158}
160 159
161static inline u64 get_tlb_bytes(const struct kvm_book3e_206_tlb_entry *tlbe) 160static inline u64 get_tlb_bytes(const struct kvm_book3e_206_tlb_entry *tlbe)
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index e04b0ef55ce..e78f353a836 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -89,6 +89,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
89 int ra = get_ra(inst); 89 int ra = get_ra(inst);
90 int rb = get_rb(inst); 90 int rb = get_rb(inst);
91 int rt = get_rt(inst); 91 int rt = get_rt(inst);
92 gva_t ea;
92 93
93 switch (get_op(inst)) { 94 switch (get_op(inst)) {
94 case 31: 95 case 31:
@@ -113,15 +114,20 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
113 break; 114 break;
114 115
115 case XOP_TLBSX: 116 case XOP_TLBSX:
116 emulated = kvmppc_e500_emul_tlbsx(vcpu,rb); 117 ea = kvmppc_get_ea_indexed(vcpu, ra, rb);
118 emulated = kvmppc_e500_emul_tlbsx(vcpu, ea);
117 break; 119 break;
118 120
119 case XOP_TLBILX: 121 case XOP_TLBILX: {
120 emulated = kvmppc_e500_emul_tlbilx(vcpu, rt, ra, rb); 122 int type = rt & 0x3;
123 ea = kvmppc_get_ea_indexed(vcpu, ra, rb);
124 emulated = kvmppc_e500_emul_tlbilx(vcpu, type, ea);
121 break; 125 break;
126 }
122 127
123 case XOP_TLBIVAX: 128 case XOP_TLBIVAX:
124 emulated = kvmppc_e500_emul_tlbivax(vcpu, ra, rb); 129 ea = kvmppc_get_ea_indexed(vcpu, ra, rb);
130 emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
125 break; 131 break;
126 132
127 default: 133 default:
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index ff38b664195..cf3f1801237 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -304,17 +304,13 @@ static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
304 ref->flags = E500_TLB_VALID; 304 ref->flags = E500_TLB_VALID;
305 305
306 if (tlbe_is_writable(gtlbe)) 306 if (tlbe_is_writable(gtlbe))
307 ref->flags |= E500_TLB_DIRTY; 307 kvm_set_pfn_dirty(pfn);
308} 308}
309 309
310static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref) 310static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref)
311{ 311{
312 if (ref->flags & E500_TLB_VALID) { 312 if (ref->flags & E500_TLB_VALID) {
313 if (ref->flags & E500_TLB_DIRTY) 313 trace_kvm_booke206_ref_release(ref->pfn, ref->flags);
314 kvm_release_pfn_dirty(ref->pfn);
315 else
316 kvm_release_pfn_clean(ref->pfn);
317
318 ref->flags = 0; 314 ref->flags = 0;
319 } 315 }
320} 316}
@@ -357,6 +353,13 @@ static void clear_tlb_refs(struct kvmppc_vcpu_e500 *vcpu_e500)
357 clear_tlb_privs(vcpu_e500); 353 clear_tlb_privs(vcpu_e500);
358} 354}
359 355
356void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu)
357{
358 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
359 clear_tlb_refs(vcpu_e500);
360 clear_tlb1_bitmap(vcpu_e500);
361}
362
360static inline void kvmppc_e500_deliver_tlb_miss(struct kvm_vcpu *vcpu, 363static inline void kvmppc_e500_deliver_tlb_miss(struct kvm_vcpu *vcpu,
361 unsigned int eaddr, int as) 364 unsigned int eaddr, int as)
362{ 365{
@@ -412,7 +415,8 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
412 struct tlbe_ref *ref) 415 struct tlbe_ref *ref)
413{ 416{
414 struct kvm_memory_slot *slot; 417 struct kvm_memory_slot *slot;
415 unsigned long pfn, hva; 418 unsigned long pfn = 0; /* silence GCC warning */
419 unsigned long hva;
416 int pfnmap = 0; 420 int pfnmap = 0;
417 int tsize = BOOK3E_PAGESZ_4K; 421 int tsize = BOOK3E_PAGESZ_4K;
418 422
@@ -521,7 +525,7 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
521 if (likely(!pfnmap)) { 525 if (likely(!pfnmap)) {
522 unsigned long tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT); 526 unsigned long tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT);
523 pfn = gfn_to_pfn_memslot(slot, gfn); 527 pfn = gfn_to_pfn_memslot(slot, gfn);
524 if (is_error_pfn(pfn)) { 528 if (is_error_noslot_pfn(pfn)) {
525 printk(KERN_ERR "Couldn't get real page for gfn %lx!\n", 529 printk(KERN_ERR "Couldn't get real page for gfn %lx!\n",
526 (long)gfn); 530 (long)gfn);
527 return; 531 return;
@@ -541,6 +545,9 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
541 545
542 /* Clear i-cache for new pages */ 546 /* Clear i-cache for new pages */
543 kvmppc_mmu_flush_icache(pfn); 547 kvmppc_mmu_flush_icache(pfn);
548
549 /* Drop refcount on page, so that mmu notifiers can clear it */
550 kvm_release_pfn_clean(pfn);
544} 551}
545 552
546/* XXX only map the one-one case, for now use TLB0 */ 553/* XXX only map the one-one case, for now use TLB0 */
@@ -682,14 +689,11 @@ int kvmppc_e500_emul_mt_mmucsr0(struct kvmppc_vcpu_e500 *vcpu_e500, ulong value)
682 return EMULATE_DONE; 689 return EMULATE_DONE;
683} 690}
684 691
685int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, int ra, int rb) 692int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, gva_t ea)
686{ 693{
687 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 694 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
688 unsigned int ia; 695 unsigned int ia;
689 int esel, tlbsel; 696 int esel, tlbsel;
690 gva_t ea;
691
692 ea = ((ra) ? kvmppc_get_gpr(vcpu, ra) : 0) + kvmppc_get_gpr(vcpu, rb);
693 697
694 ia = (ea >> 2) & 0x1; 698 ia = (ea >> 2) & 0x1;
695 699
@@ -716,7 +720,7 @@ int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, int ra, int rb)
716} 720}
717 721
718static void tlbilx_all(struct kvmppc_vcpu_e500 *vcpu_e500, int tlbsel, 722static void tlbilx_all(struct kvmppc_vcpu_e500 *vcpu_e500, int tlbsel,
719 int pid, int rt) 723 int pid, int type)
720{ 724{
721 struct kvm_book3e_206_tlb_entry *tlbe; 725 struct kvm_book3e_206_tlb_entry *tlbe;
722 int tid, esel; 726 int tid, esel;
@@ -725,7 +729,7 @@ static void tlbilx_all(struct kvmppc_vcpu_e500 *vcpu_e500, int tlbsel,
725 for (esel = 0; esel < vcpu_e500->gtlb_params[tlbsel].entries; esel++) { 729 for (esel = 0; esel < vcpu_e500->gtlb_params[tlbsel].entries; esel++) {
726 tlbe = get_entry(vcpu_e500, tlbsel, esel); 730 tlbe = get_entry(vcpu_e500, tlbsel, esel);
727 tid = get_tlb_tid(tlbe); 731 tid = get_tlb_tid(tlbe);
728 if (rt == 0 || tid == pid) { 732 if (type == 0 || tid == pid) {
729 inval_gtlbe_on_host(vcpu_e500, tlbsel, esel); 733 inval_gtlbe_on_host(vcpu_e500, tlbsel, esel);
730 kvmppc_e500_gtlbe_invalidate(vcpu_e500, tlbsel, esel); 734 kvmppc_e500_gtlbe_invalidate(vcpu_e500, tlbsel, esel);
731 } 735 }
@@ -733,14 +737,9 @@ static void tlbilx_all(struct kvmppc_vcpu_e500 *vcpu_e500, int tlbsel,
733} 737}
734 738
735static void tlbilx_one(struct kvmppc_vcpu_e500 *vcpu_e500, int pid, 739static void tlbilx_one(struct kvmppc_vcpu_e500 *vcpu_e500, int pid,
736 int ra, int rb) 740 gva_t ea)
737{ 741{
738 int tlbsel, esel; 742 int tlbsel, esel;
739 gva_t ea;
740
741 ea = kvmppc_get_gpr(&vcpu_e500->vcpu, rb);
742 if (ra)
743 ea += kvmppc_get_gpr(&vcpu_e500->vcpu, ra);
744 743
745 for (tlbsel = 0; tlbsel < 2; tlbsel++) { 744 for (tlbsel = 0; tlbsel < 2; tlbsel++) {
746 esel = kvmppc_e500_tlb_index(vcpu_e500, ea, tlbsel, pid, -1); 745 esel = kvmppc_e500_tlb_index(vcpu_e500, ea, tlbsel, pid, -1);
@@ -752,16 +751,16 @@ static void tlbilx_one(struct kvmppc_vcpu_e500 *vcpu_e500, int pid,
752 } 751 }
753} 752}
754 753
755int kvmppc_e500_emul_tlbilx(struct kvm_vcpu *vcpu, int rt, int ra, int rb) 754int kvmppc_e500_emul_tlbilx(struct kvm_vcpu *vcpu, int type, gva_t ea)
756{ 755{
757 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 756 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
758 int pid = get_cur_spid(vcpu); 757 int pid = get_cur_spid(vcpu);
759 758
760 if (rt == 0 || rt == 1) { 759 if (type == 0 || type == 1) {
761 tlbilx_all(vcpu_e500, 0, pid, rt); 760 tlbilx_all(vcpu_e500, 0, pid, type);
762 tlbilx_all(vcpu_e500, 1, pid, rt); 761 tlbilx_all(vcpu_e500, 1, pid, type);
763 } else if (rt == 3) { 762 } else if (type == 3) {
764 tlbilx_one(vcpu_e500, pid, ra, rb); 763 tlbilx_one(vcpu_e500, pid, ea);
765 } 764 }
766 765
767 return EMULATE_DONE; 766 return EMULATE_DONE;
@@ -786,16 +785,13 @@ int kvmppc_e500_emul_tlbre(struct kvm_vcpu *vcpu)
786 return EMULATE_DONE; 785 return EMULATE_DONE;
787} 786}
788 787
789int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) 788int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, gva_t ea)
790{ 789{
791 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 790 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
792 int as = !!get_cur_sas(vcpu); 791 int as = !!get_cur_sas(vcpu);
793 unsigned int pid = get_cur_spid(vcpu); 792 unsigned int pid = get_cur_spid(vcpu);
794 int esel, tlbsel; 793 int esel, tlbsel;
795 struct kvm_book3e_206_tlb_entry *gtlbe = NULL; 794 struct kvm_book3e_206_tlb_entry *gtlbe = NULL;
796 gva_t ea;
797
798 ea = kvmppc_get_gpr(vcpu, rb);
799 795
800 for (tlbsel = 0; tlbsel < 2; tlbsel++) { 796 for (tlbsel = 0; tlbsel < 2; tlbsel++) {
801 esel = kvmppc_e500_tlb_index(vcpu_e500, ea, tlbsel, pid, as); 797 esel = kvmppc_e500_tlb_index(vcpu_e500, ea, tlbsel, pid, as);
@@ -875,6 +871,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
875 871
876 gtlbe->mas1 = vcpu->arch.shared->mas1; 872 gtlbe->mas1 = vcpu->arch.shared->mas1;
877 gtlbe->mas2 = vcpu->arch.shared->mas2; 873 gtlbe->mas2 = vcpu->arch.shared->mas2;
874 if (!(vcpu->arch.shared->msr & MSR_CM))
875 gtlbe->mas2 &= 0xffffffffUL;
878 gtlbe->mas7_3 = vcpu->arch.shared->mas7_3; 876 gtlbe->mas7_3 = vcpu->arch.shared->mas7_3;
879 877
880 trace_kvm_booke206_gtlb_write(vcpu->arch.shared->mas0, gtlbe->mas1, 878 trace_kvm_booke206_gtlb_write(vcpu->arch.shared->mas0, gtlbe->mas1,
@@ -1039,8 +1037,12 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 eaddr, gpa_t gpaddr,
1039 sesel = 0; /* unused */ 1037 sesel = 0; /* unused */
1040 priv = &vcpu_e500->gtlb_priv[tlbsel][esel]; 1038 priv = &vcpu_e500->gtlb_priv[tlbsel][esel];
1041 1039
1042 kvmppc_e500_setup_stlbe(vcpu, gtlbe, BOOK3E_PAGESZ_4K, 1040 /* Only triggers after clear_tlb_refs */
1043 &priv->ref, eaddr, &stlbe); 1041 if (unlikely(!(priv->ref.flags & E500_TLB_VALID)))
1042 kvmppc_e500_tlb0_map(vcpu_e500, esel, &stlbe);
1043 else
1044 kvmppc_e500_setup_stlbe(vcpu, gtlbe, BOOK3E_PAGESZ_4K,
1045 &priv->ref, eaddr, &stlbe);
1044 break; 1046 break;
1045 1047
1046 case 1: { 1048 case 1: {
@@ -1060,6 +1062,49 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 eaddr, gpa_t gpaddr,
1060 write_stlbe(vcpu_e500, gtlbe, &stlbe, stlbsel, sesel); 1062 write_stlbe(vcpu_e500, gtlbe, &stlbe, stlbsel, sesel);
1061} 1063}
1062 1064
1065/************* MMU Notifiers *************/
1066
1067int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
1068{
1069 trace_kvm_unmap_hva(hva);
1070
1071 /*
1072 * Flush all shadow tlb entries everywhere. This is slow, but
1073 * we are 100% sure that we catch the to be unmapped page
1074 */
1075 kvm_flush_remote_tlbs(kvm);
1076
1077 return 0;
1078}
1079
1080int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
1081{
1082 /* kvm_unmap_hva flushes everything anyways */
1083 kvm_unmap_hva(kvm, start);
1084
1085 return 0;
1086}
1087
1088int kvm_age_hva(struct kvm *kvm, unsigned long hva)
1089{
1090 /* XXX could be more clever ;) */
1091 return 0;
1092}
1093
1094int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
1095{
1096 /* XXX could be more clever ;) */
1097 return 0;
1098}
1099
1100void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
1101{
1102 /* The page will get remapped properly on its next fault */
1103 kvm_unmap_hva(kvm, hva);
1104}
1105
1106/*****************************************/
1107
1063static void free_gtlb(struct kvmppc_vcpu_e500 *vcpu_e500) 1108static void free_gtlb(struct kvmppc_vcpu_e500 *vcpu_e500)
1064{ 1109{
1065 int i; 1110 int i;
@@ -1081,6 +1126,8 @@ static void free_gtlb(struct kvmppc_vcpu_e500 *vcpu_e500)
1081 } 1126 }
1082 1127
1083 vcpu_e500->num_shared_tlb_pages = 0; 1128 vcpu_e500->num_shared_tlb_pages = 0;
1129
1130 kfree(vcpu_e500->shared_tlb_pages);
1084 vcpu_e500->shared_tlb_pages = NULL; 1131 vcpu_e500->shared_tlb_pages = NULL;
1085 } else { 1132 } else {
1086 kfree(vcpu_e500->gtlb_arch); 1133 kfree(vcpu_e500->gtlb_arch);
@@ -1178,21 +1225,27 @@ int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu,
1178 } 1225 }
1179 1226
1180 virt = vmap(pages, num_pages, VM_MAP, PAGE_KERNEL); 1227 virt = vmap(pages, num_pages, VM_MAP, PAGE_KERNEL);
1181 if (!virt) 1228 if (!virt) {
1229 ret = -ENOMEM;
1182 goto err_put_page; 1230 goto err_put_page;
1231 }
1183 1232
1184 privs[0] = kzalloc(sizeof(struct tlbe_priv) * params.tlb_sizes[0], 1233 privs[0] = kzalloc(sizeof(struct tlbe_priv) * params.tlb_sizes[0],
1185 GFP_KERNEL); 1234 GFP_KERNEL);
1186 privs[1] = kzalloc(sizeof(struct tlbe_priv) * params.tlb_sizes[1], 1235 privs[1] = kzalloc(sizeof(struct tlbe_priv) * params.tlb_sizes[1],
1187 GFP_KERNEL); 1236 GFP_KERNEL);
1188 1237
1189 if (!privs[0] || !privs[1]) 1238 if (!privs[0] || !privs[1]) {
1190 goto err_put_page; 1239 ret = -ENOMEM;
1240 goto err_privs;
1241 }
1191 1242
1192 g2h_bitmap = kzalloc(sizeof(u64) * params.tlb_sizes[1], 1243 g2h_bitmap = kzalloc(sizeof(u64) * params.tlb_sizes[1],
1193 GFP_KERNEL); 1244 GFP_KERNEL);
1194 if (!g2h_bitmap) 1245 if (!g2h_bitmap) {
1195 goto err_put_page; 1246 ret = -ENOMEM;
1247 goto err_privs;
1248 }
1196 1249
1197 free_gtlb(vcpu_e500); 1250 free_gtlb(vcpu_e500);
1198 1251
@@ -1232,10 +1285,11 @@ int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu,
1232 kvmppc_recalc_tlb1map_range(vcpu_e500); 1285 kvmppc_recalc_tlb1map_range(vcpu_e500);
1233 return 0; 1286 return 0;
1234 1287
1235err_put_page: 1288err_privs:
1236 kfree(privs[0]); 1289 kfree(privs[0]);
1237 kfree(privs[1]); 1290 kfree(privs[1]);
1238 1291
1292err_put_page:
1239 for (i = 0; i < num_pages; i++) 1293 for (i = 0; i < num_pages; i++)
1240 put_page(pages[i]); 1294 put_page(pages[i]);
1241 1295
@@ -1332,7 +1386,7 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500)
1332 if (!vcpu_e500->gtlb_priv[1]) 1386 if (!vcpu_e500->gtlb_priv[1])
1333 goto err; 1387 goto err;
1334 1388
1335 vcpu_e500->g2h_tlb1_map = kzalloc(sizeof(unsigned int) * 1389 vcpu_e500->g2h_tlb1_map = kzalloc(sizeof(u64) *
1336 vcpu_e500->gtlb_params[1].entries, 1390 vcpu_e500->gtlb_params[1].entries,
1337 GFP_KERNEL); 1391 GFP_KERNEL);
1338 if (!vcpu_e500->g2h_tlb1_map) 1392 if (!vcpu_e500->g2h_tlb1_map)
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index ee04abaefe2..b0855e5d890 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -131,6 +131,125 @@ u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb)
131 return vcpu->arch.dec - jd; 131 return vcpu->arch.dec - jd;
132} 132}
133 133
134static int kvmppc_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
135{
136 enum emulation_result emulated = EMULATE_DONE;
137 ulong spr_val = kvmppc_get_gpr(vcpu, rs);
138
139 switch (sprn) {
140 case SPRN_SRR0:
141 vcpu->arch.shared->srr0 = spr_val;
142 break;
143 case SPRN_SRR1:
144 vcpu->arch.shared->srr1 = spr_val;
145 break;
146
147 /* XXX We need to context-switch the timebase for
148 * watchdog and FIT. */
149 case SPRN_TBWL: break;
150 case SPRN_TBWU: break;
151
152 case SPRN_MSSSR0: break;
153
154 case SPRN_DEC:
155 vcpu->arch.dec = spr_val;
156 kvmppc_emulate_dec(vcpu);
157 break;
158
159 case SPRN_SPRG0:
160 vcpu->arch.shared->sprg0 = spr_val;
161 break;
162 case SPRN_SPRG1:
163 vcpu->arch.shared->sprg1 = spr_val;
164 break;
165 case SPRN_SPRG2:
166 vcpu->arch.shared->sprg2 = spr_val;
167 break;
168 case SPRN_SPRG3:
169 vcpu->arch.shared->sprg3 = spr_val;
170 break;
171
172 default:
173 emulated = kvmppc_core_emulate_mtspr(vcpu, sprn,
174 spr_val);
175 if (emulated == EMULATE_FAIL)
176 printk(KERN_INFO "mtspr: unknown spr "
177 "0x%x\n", sprn);
178 break;
179 }
180
181 kvmppc_set_exit_type(vcpu, EMULATED_MTSPR_EXITS);
182
183 return emulated;
184}
185
186static int kvmppc_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
187{
188 enum emulation_result emulated = EMULATE_DONE;
189 ulong spr_val = 0;
190
191 switch (sprn) {
192 case SPRN_SRR0:
193 spr_val = vcpu->arch.shared->srr0;
194 break;
195 case SPRN_SRR1:
196 spr_val = vcpu->arch.shared->srr1;
197 break;
198 case SPRN_PVR:
199 spr_val = vcpu->arch.pvr;
200 break;
201 case SPRN_PIR:
202 spr_val = vcpu->vcpu_id;
203 break;
204 case SPRN_MSSSR0:
205 spr_val = 0;
206 break;
207
208 /* Note: mftb and TBRL/TBWL are user-accessible, so
209 * the guest can always access the real TB anyways.
210 * In fact, we probably will never see these traps. */
211 case SPRN_TBWL:
212 spr_val = get_tb() >> 32;
213 break;
214 case SPRN_TBWU:
215 spr_val = get_tb();
216 break;
217
218 case SPRN_SPRG0:
219 spr_val = vcpu->arch.shared->sprg0;
220 break;
221 case SPRN_SPRG1:
222 spr_val = vcpu->arch.shared->sprg1;
223 break;
224 case SPRN_SPRG2:
225 spr_val = vcpu->arch.shared->sprg2;
226 break;
227 case SPRN_SPRG3:
228 spr_val = vcpu->arch.shared->sprg3;
229 break;
230 /* Note: SPRG4-7 are user-readable, so we don't get
231 * a trap. */
232
233 case SPRN_DEC:
234 spr_val = kvmppc_get_dec(vcpu, get_tb());
235 break;
236 default:
237 emulated = kvmppc_core_emulate_mfspr(vcpu, sprn,
238 &spr_val);
239 if (unlikely(emulated == EMULATE_FAIL)) {
240 printk(KERN_INFO "mfspr: unknown spr "
241 "0x%x\n", sprn);
242 }
243 break;
244 }
245
246 if (emulated == EMULATE_DONE)
247 kvmppc_set_gpr(vcpu, rt, spr_val);
248 kvmppc_set_exit_type(vcpu, EMULATED_MFSPR_EXITS);
249
250 return emulated;
251}
252
134/* XXX to do: 253/* XXX to do:
135 * lhax 254 * lhax
136 * lhaux 255 * lhaux
@@ -156,7 +275,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
156 int sprn = get_sprn(inst); 275 int sprn = get_sprn(inst);
157 enum emulation_result emulated = EMULATE_DONE; 276 enum emulation_result emulated = EMULATE_DONE;
158 int advance = 1; 277 int advance = 1;
159 ulong spr_val = 0;
160 278
161 /* this default type might be overwritten by subcategories */ 279 /* this default type might be overwritten by subcategories */
162 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS); 280 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS);
@@ -236,62 +354,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
236 break; 354 break;
237 355
238 case OP_31_XOP_MFSPR: 356 case OP_31_XOP_MFSPR:
239 switch (sprn) { 357 emulated = kvmppc_emulate_mfspr(vcpu, sprn, rt);
240 case SPRN_SRR0:
241 spr_val = vcpu->arch.shared->srr0;
242 break;
243 case SPRN_SRR1:
244 spr_val = vcpu->arch.shared->srr1;
245 break;
246 case SPRN_PVR:
247 spr_val = vcpu->arch.pvr;
248 break;
249 case SPRN_PIR:
250 spr_val = vcpu->vcpu_id;
251 break;
252 case SPRN_MSSSR0:
253 spr_val = 0;
254 break;
255
256 /* Note: mftb and TBRL/TBWL are user-accessible, so
257 * the guest can always access the real TB anyways.
258 * In fact, we probably will never see these traps. */
259 case SPRN_TBWL:
260 spr_val = get_tb() >> 32;
261 break;
262 case SPRN_TBWU:
263 spr_val = get_tb();
264 break;
265
266 case SPRN_SPRG0:
267 spr_val = vcpu->arch.shared->sprg0;
268 break;
269 case SPRN_SPRG1:
270 spr_val = vcpu->arch.shared->sprg1;
271 break;
272 case SPRN_SPRG2:
273 spr_val = vcpu->arch.shared->sprg2;
274 break;
275 case SPRN_SPRG3:
276 spr_val = vcpu->arch.shared->sprg3;
277 break;
278 /* Note: SPRG4-7 are user-readable, so we don't get
279 * a trap. */
280
281 case SPRN_DEC:
282 spr_val = kvmppc_get_dec(vcpu, get_tb());
283 break;
284 default:
285 emulated = kvmppc_core_emulate_mfspr(vcpu, sprn,
286 &spr_val);
287 if (unlikely(emulated == EMULATE_FAIL)) {
288 printk(KERN_INFO "mfspr: unknown spr "
289 "0x%x\n", sprn);
290 }
291 break;
292 }
293 kvmppc_set_gpr(vcpu, rt, spr_val);
294 kvmppc_set_exit_type(vcpu, EMULATED_MFSPR_EXITS);
295 break; 358 break;
296 359
297 case OP_31_XOP_STHX: 360 case OP_31_XOP_STHX:
@@ -308,49 +371,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
308 break; 371 break;
309 372
310 case OP_31_XOP_MTSPR: 373 case OP_31_XOP_MTSPR:
311 spr_val = kvmppc_get_gpr(vcpu, rs); 374 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs);
312 switch (sprn) {
313 case SPRN_SRR0:
314 vcpu->arch.shared->srr0 = spr_val;
315 break;
316 case SPRN_SRR1:
317 vcpu->arch.shared->srr1 = spr_val;
318 break;
319
320 /* XXX We need to context-switch the timebase for
321 * watchdog and FIT. */
322 case SPRN_TBWL: break;
323 case SPRN_TBWU: break;
324
325 case SPRN_MSSSR0: break;
326
327 case SPRN_DEC:
328 vcpu->arch.dec = spr_val;
329 kvmppc_emulate_dec(vcpu);
330 break;
331
332 case SPRN_SPRG0:
333 vcpu->arch.shared->sprg0 = spr_val;
334 break;
335 case SPRN_SPRG1:
336 vcpu->arch.shared->sprg1 = spr_val;
337 break;
338 case SPRN_SPRG2:
339 vcpu->arch.shared->sprg2 = spr_val;
340 break;
341 case SPRN_SPRG3:
342 vcpu->arch.shared->sprg3 = spr_val;
343 break;
344
345 default:
346 emulated = kvmppc_core_emulate_mtspr(vcpu, sprn,
347 spr_val);
348 if (emulated == EMULATE_FAIL)
349 printk(KERN_INFO "mtspr: unknown spr "
350 "0x%x\n", sprn);
351 break;
352 }
353 kvmppc_set_exit_type(vcpu, EMULATED_MTSPR_EXITS);
354 break; 375 break;
355 376
356 case OP_31_XOP_DCBI: 377 case OP_31_XOP_DCBI:
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 4d213b8b0fb..70739a08956 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -30,6 +30,7 @@
30#include <asm/kvm_ppc.h> 30#include <asm/kvm_ppc.h>
31#include <asm/tlbflush.h> 31#include <asm/tlbflush.h>
32#include <asm/cputhreads.h> 32#include <asm/cputhreads.h>
33#include <asm/irqflags.h>
33#include "timing.h" 34#include "timing.h"
34#include "../mm/mmu_decl.h" 35#include "../mm/mmu_decl.h"
35 36
@@ -38,8 +39,7 @@
38 39
39int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) 40int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
40{ 41{
41 return !(v->arch.shared->msr & MSR_WE) || 42 return !!(v->arch.pending_exceptions) ||
42 !!(v->arch.pending_exceptions) ||
43 v->requests; 43 v->requests;
44} 44}
45 45
@@ -48,6 +48,85 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
48 return 1; 48 return 1;
49} 49}
50 50
51#ifndef CONFIG_KVM_BOOK3S_64_HV
52/*
53 * Common checks before entering the guest world. Call with interrupts
54 * disabled.
55 *
56 * returns:
57 *
58 * == 1 if we're ready to go into guest state
59 * <= 0 if we need to go back to the host with return value
60 */
61int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
62{
63 int r = 1;
64
65 WARN_ON_ONCE(!irqs_disabled());
66 while (true) {
67 if (need_resched()) {
68 local_irq_enable();
69 cond_resched();
70 local_irq_disable();
71 continue;
72 }
73
74 if (signal_pending(current)) {
75 kvmppc_account_exit(vcpu, SIGNAL_EXITS);
76 vcpu->run->exit_reason = KVM_EXIT_INTR;
77 r = -EINTR;
78 break;
79 }
80
81 vcpu->mode = IN_GUEST_MODE;
82
83 /*
84 * Reading vcpu->requests must happen after setting vcpu->mode,
85 * so we don't miss a request because the requester sees
86 * OUTSIDE_GUEST_MODE and assumes we'll be checking requests
87 * before next entering the guest (and thus doesn't IPI).
88 */
89 smp_mb();
90
91 if (vcpu->requests) {
92 /* Make sure we process requests preemptable */
93 local_irq_enable();
94 trace_kvm_check_requests(vcpu);
95 r = kvmppc_core_check_requests(vcpu);
96 local_irq_disable();
97 if (r > 0)
98 continue;
99 break;
100 }
101
102 if (kvmppc_core_prepare_to_enter(vcpu)) {
103 /* interrupts got enabled in between, so we
104 are back at square 1 */
105 continue;
106 }
107
108#ifdef CONFIG_PPC64
109 /* lazy EE magic */
110 hard_irq_disable();
111 if (lazy_irq_pending()) {
112 /* Got an interrupt in between, try again */
113 local_irq_enable();
114 local_irq_disable();
115 kvm_guest_exit();
116 continue;
117 }
118
119 trace_hardirqs_on();
120#endif
121
122 kvm_guest_enter();
123 break;
124 }
125
126 return r;
127}
128#endif /* CONFIG_KVM_BOOK3S_64_HV */
129
51int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) 130int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
52{ 131{
53 int nr = kvmppc_get_gpr(vcpu, 11); 132 int nr = kvmppc_get_gpr(vcpu, 11);
@@ -67,18 +146,18 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
67 } 146 }
68 147
69 switch (nr) { 148 switch (nr) {
70 case HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE: 149 case KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE):
71 { 150 {
72 vcpu->arch.magic_page_pa = param1; 151 vcpu->arch.magic_page_pa = param1;
73 vcpu->arch.magic_page_ea = param2; 152 vcpu->arch.magic_page_ea = param2;
74 153
75 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7; 154 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7;
76 155
77 r = HC_EV_SUCCESS; 156 r = EV_SUCCESS;
78 break; 157 break;
79 } 158 }
80 case HC_VENDOR_KVM | KVM_HC_FEATURES: 159 case KVM_HCALL_TOKEN(KVM_HC_FEATURES):
81 r = HC_EV_SUCCESS; 160 r = EV_SUCCESS;
82#if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2) 161#if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2)
83 /* XXX Missing magic page on 44x */ 162 /* XXX Missing magic page on 44x */
84 r2 |= (1 << KVM_FEATURE_MAGIC_PAGE); 163 r2 |= (1 << KVM_FEATURE_MAGIC_PAGE);
@@ -86,8 +165,13 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
86 165
87 /* Second return value is in r4 */ 166 /* Second return value is in r4 */
88 break; 167 break;
168 case EV_HCALL_TOKEN(EV_IDLE):
169 r = EV_SUCCESS;
170 kvm_vcpu_block(vcpu);
171 clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
172 break;
89 default: 173 default:
90 r = HC_EV_UNIMPLEMENTED; 174 r = EV_UNIMPLEMENTED;
91 break; 175 break;
92 } 176 }
93 177
@@ -220,6 +304,7 @@ int kvm_dev_ioctl_check_extension(long ext)
220 switch (ext) { 304 switch (ext) {
221#ifdef CONFIG_BOOKE 305#ifdef CONFIG_BOOKE
222 case KVM_CAP_PPC_BOOKE_SREGS: 306 case KVM_CAP_PPC_BOOKE_SREGS:
307 case KVM_CAP_PPC_BOOKE_WATCHDOG:
223#else 308#else
224 case KVM_CAP_PPC_SEGSTATE: 309 case KVM_CAP_PPC_SEGSTATE:
225 case KVM_CAP_PPC_HIOR: 310 case KVM_CAP_PPC_HIOR:
@@ -229,6 +314,7 @@ int kvm_dev_ioctl_check_extension(long ext)
229 case KVM_CAP_PPC_IRQ_LEVEL: 314 case KVM_CAP_PPC_IRQ_LEVEL:
230 case KVM_CAP_ENABLE_CAP: 315 case KVM_CAP_ENABLE_CAP:
231 case KVM_CAP_ONE_REG: 316 case KVM_CAP_ONE_REG:
317 case KVM_CAP_IOEVENTFD:
232 r = 1; 318 r = 1;
233 break; 319 break;
234#ifndef CONFIG_KVM_BOOK3S_64_HV 320#ifndef CONFIG_KVM_BOOK3S_64_HV
@@ -260,10 +346,22 @@ int kvm_dev_ioctl_check_extension(long ext)
260 if (cpu_has_feature(CPU_FTR_ARCH_201)) 346 if (cpu_has_feature(CPU_FTR_ARCH_201))
261 r = 2; 347 r = 2;
262 break; 348 break;
349#endif
263 case KVM_CAP_SYNC_MMU: 350 case KVM_CAP_SYNC_MMU:
351#ifdef CONFIG_KVM_BOOK3S_64_HV
264 r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0; 352 r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0;
353#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)
354 r = 1;
355#else
356 r = 0;
357 break;
358#endif
359#ifdef CONFIG_KVM_BOOK3S_64_HV
360 case KVM_CAP_PPC_HTAB_FD:
361 r = 1;
265 break; 362 break;
266#endif 363#endif
364 break;
267 case KVM_CAP_NR_VCPUS: 365 case KVM_CAP_NR_VCPUS:
268 /* 366 /*
269 * Recommending a number of CPUs is somewhat arbitrary; we 367 * Recommending a number of CPUs is somewhat arbitrary; we
@@ -302,19 +400,12 @@ long kvm_arch_dev_ioctl(struct file *filp,
302void kvm_arch_free_memslot(struct kvm_memory_slot *free, 400void kvm_arch_free_memslot(struct kvm_memory_slot *free,
303 struct kvm_memory_slot *dont) 401 struct kvm_memory_slot *dont)
304{ 402{
305 if (!dont || free->arch.rmap != dont->arch.rmap) { 403 kvmppc_core_free_memslot(free, dont);
306 vfree(free->arch.rmap);
307 free->arch.rmap = NULL;
308 }
309} 404}
310 405
311int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 406int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
312{ 407{
313 slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap)); 408 return kvmppc_core_create_memslot(slot, npages);
314 if (!slot->arch.rmap)
315 return -ENOMEM;
316
317 return 0;
318} 409}
319 410
320int kvm_arch_prepare_memory_region(struct kvm *kvm, 411int kvm_arch_prepare_memory_region(struct kvm *kvm,
@@ -323,7 +414,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
323 struct kvm_userspace_memory_region *mem, 414 struct kvm_userspace_memory_region *mem,
324 int user_alloc) 415 int user_alloc)
325{ 416{
326 return kvmppc_core_prepare_memory_region(kvm, mem); 417 return kvmppc_core_prepare_memory_region(kvm, memslot, mem);
327} 418}
328 419
329void kvm_arch_commit_memory_region(struct kvm *kvm, 420void kvm_arch_commit_memory_region(struct kvm *kvm,
@@ -331,7 +422,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
331 struct kvm_memory_slot old, 422 struct kvm_memory_slot old,
332 int user_alloc) 423 int user_alloc)
333{ 424{
334 kvmppc_core_commit_memory_region(kvm, mem); 425 kvmppc_core_commit_memory_region(kvm, mem, old);
335} 426}
336 427
337void kvm_arch_flush_shadow_all(struct kvm *kvm) 428void kvm_arch_flush_shadow_all(struct kvm *kvm)
@@ -341,6 +432,7 @@ void kvm_arch_flush_shadow_all(struct kvm *kvm)
341void kvm_arch_flush_shadow_memslot(struct kvm *kvm, 432void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
342 struct kvm_memory_slot *slot) 433 struct kvm_memory_slot *slot)
343{ 434{
435 kvmppc_core_flush_memslot(kvm, slot);
344} 436}
345 437
346struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) 438struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
@@ -354,6 +446,11 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
354 return vcpu; 446 return vcpu;
355} 447}
356 448
449int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
450{
451 return 0;
452}
453
357void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) 454void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
358{ 455{
359 /* Make sure we're not using the vcpu anymore */ 456 /* Make sure we're not using the vcpu anymore */
@@ -390,6 +487,8 @@ enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer)
390 487
391int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) 488int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
392{ 489{
490 int ret;
491
393 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); 492 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
394 tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu); 493 tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
395 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup; 494 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
@@ -398,13 +497,14 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
398#ifdef CONFIG_KVM_EXIT_TIMING 497#ifdef CONFIG_KVM_EXIT_TIMING
399 mutex_init(&vcpu->arch.exit_timing_lock); 498 mutex_init(&vcpu->arch.exit_timing_lock);
400#endif 499#endif
401 500 ret = kvmppc_subarch_vcpu_init(vcpu);
402 return 0; 501 return ret;
403} 502}
404 503
405void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) 504void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
406{ 505{
407 kvmppc_mmu_destroy(vcpu); 506 kvmppc_mmu_destroy(vcpu);
507 kvmppc_subarch_vcpu_uninit(vcpu);
408} 508}
409 509
410void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 510void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
@@ -420,7 +520,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
420 mtspr(SPRN_VRSAVE, vcpu->arch.vrsave); 520 mtspr(SPRN_VRSAVE, vcpu->arch.vrsave);
421#endif 521#endif
422 kvmppc_core_vcpu_load(vcpu, cpu); 522 kvmppc_core_vcpu_load(vcpu, cpu);
423 vcpu->cpu = smp_processor_id();
424} 523}
425 524
426void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 525void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
@@ -429,7 +528,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
429#ifdef CONFIG_BOOKE 528#ifdef CONFIG_BOOKE
430 vcpu->arch.vrsave = mfspr(SPRN_VRSAVE); 529 vcpu->arch.vrsave = mfspr(SPRN_VRSAVE);
431#endif 530#endif
432 vcpu->cpu = -1;
433} 531}
434 532
435int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, 533int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
@@ -527,6 +625,13 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
527 vcpu->mmio_is_write = 0; 625 vcpu->mmio_is_write = 0;
528 vcpu->arch.mmio_sign_extend = 0; 626 vcpu->arch.mmio_sign_extend = 0;
529 627
628 if (!kvm_io_bus_read(vcpu->kvm, KVM_MMIO_BUS, run->mmio.phys_addr,
629 bytes, &run->mmio.data)) {
630 kvmppc_complete_mmio_load(vcpu, run);
631 vcpu->mmio_needed = 0;
632 return EMULATE_DONE;
633 }
634
530 return EMULATE_DO_MMIO; 635 return EMULATE_DO_MMIO;
531} 636}
532 637
@@ -536,8 +641,8 @@ int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
536{ 641{
537 int r; 642 int r;
538 643
539 r = kvmppc_handle_load(run, vcpu, rt, bytes, is_bigendian);
540 vcpu->arch.mmio_sign_extend = 1; 644 vcpu->arch.mmio_sign_extend = 1;
645 r = kvmppc_handle_load(run, vcpu, rt, bytes, is_bigendian);
541 646
542 return r; 647 return r;
543} 648}
@@ -575,6 +680,13 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
575 } 680 }
576 } 681 }
577 682
683 if (!kvm_io_bus_write(vcpu->kvm, KVM_MMIO_BUS, run->mmio.phys_addr,
684 bytes, &run->mmio.data)) {
685 kvmppc_complete_mmio_load(vcpu, run);
686 vcpu->mmio_needed = 0;
687 return EMULATE_DONE;
688 }
689
578 return EMULATE_DO_MMIO; 690 return EMULATE_DO_MMIO;
579} 691}
580 692
@@ -649,6 +761,12 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
649 r = 0; 761 r = 0;
650 vcpu->arch.papr_enabled = true; 762 vcpu->arch.papr_enabled = true;
651 break; 763 break;
764#ifdef CONFIG_BOOKE
765 case KVM_CAP_PPC_BOOKE_WATCHDOG:
766 r = 0;
767 vcpu->arch.watchdog_enabled = true;
768 break;
769#endif
652#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC) 770#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
653 case KVM_CAP_SW_TLB: { 771 case KVM_CAP_SW_TLB: {
654 struct kvm_config_tlb cfg; 772 struct kvm_config_tlb cfg;
@@ -751,9 +869,16 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
751 869
752static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo) 870static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
753{ 871{
872 u32 inst_nop = 0x60000000;
873#ifdef CONFIG_KVM_BOOKE_HV
874 u32 inst_sc1 = 0x44000022;
875 pvinfo->hcall[0] = inst_sc1;
876 pvinfo->hcall[1] = inst_nop;
877 pvinfo->hcall[2] = inst_nop;
878 pvinfo->hcall[3] = inst_nop;
879#else
754 u32 inst_lis = 0x3c000000; 880 u32 inst_lis = 0x3c000000;
755 u32 inst_ori = 0x60000000; 881 u32 inst_ori = 0x60000000;
756 u32 inst_nop = 0x60000000;
757 u32 inst_sc = 0x44000002; 882 u32 inst_sc = 0x44000002;
758 u32 inst_imm_mask = 0xffff; 883 u32 inst_imm_mask = 0xffff;
759 884
@@ -770,6 +895,9 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
770 pvinfo->hcall[1] = inst_ori | (KVM_SC_MAGIC_R0 & inst_imm_mask); 895 pvinfo->hcall[1] = inst_ori | (KVM_SC_MAGIC_R0 & inst_imm_mask);
771 pvinfo->hcall[2] = inst_sc; 896 pvinfo->hcall[2] = inst_sc;
772 pvinfo->hcall[3] = inst_nop; 897 pvinfo->hcall[3] = inst_nop;
898#endif
899
900 pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE;
773 901
774 return 0; 902 return 0;
775} 903}
@@ -832,6 +960,17 @@ long kvm_arch_vm_ioctl(struct file *filp,
832 r = 0; 960 r = 0;
833 break; 961 break;
834 } 962 }
963
964 case KVM_PPC_GET_HTAB_FD: {
965 struct kvm *kvm = filp->private_data;
966 struct kvm_get_htab_fd ghf;
967
968 r = -EFAULT;
969 if (copy_from_user(&ghf, argp, sizeof(ghf)))
970 break;
971 r = kvm_vm_ioctl_get_htab_fd(kvm, &ghf);
972 break;
973 }
835#endif /* CONFIG_KVM_BOOK3S_64_HV */ 974#endif /* CONFIG_KVM_BOOK3S_64_HV */
836 975
837#ifdef CONFIG_PPC_BOOK3S_64 976#ifdef CONFIG_PPC_BOOK3S_64
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index ddb6a2149d4..e326489a542 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -31,6 +31,126 @@ TRACE_EVENT(kvm_ppc_instr,
31 __entry->inst, __entry->pc, __entry->emulate) 31 __entry->inst, __entry->pc, __entry->emulate)
32); 32);
33 33
34#ifdef CONFIG_PPC_BOOK3S
35#define kvm_trace_symbol_exit \
36 {0x100, "SYSTEM_RESET"}, \
37 {0x200, "MACHINE_CHECK"}, \
38 {0x300, "DATA_STORAGE"}, \
39 {0x380, "DATA_SEGMENT"}, \
40 {0x400, "INST_STORAGE"}, \
41 {0x480, "INST_SEGMENT"}, \
42 {0x500, "EXTERNAL"}, \
43 {0x501, "EXTERNAL_LEVEL"}, \
44 {0x502, "EXTERNAL_HV"}, \
45 {0x600, "ALIGNMENT"}, \
46 {0x700, "PROGRAM"}, \
47 {0x800, "FP_UNAVAIL"}, \
48 {0x900, "DECREMENTER"}, \
49 {0x980, "HV_DECREMENTER"}, \
50 {0xc00, "SYSCALL"}, \
51 {0xd00, "TRACE"}, \
52 {0xe00, "H_DATA_STORAGE"}, \
53 {0xe20, "H_INST_STORAGE"}, \
54 {0xe40, "H_EMUL_ASSIST"}, \
55 {0xf00, "PERFMON"}, \
56 {0xf20, "ALTIVEC"}, \
57 {0xf40, "VSX"}
58#else
59#define kvm_trace_symbol_exit \
60 {0, "CRITICAL"}, \
61 {1, "MACHINE_CHECK"}, \
62 {2, "DATA_STORAGE"}, \
63 {3, "INST_STORAGE"}, \
64 {4, "EXTERNAL"}, \
65 {5, "ALIGNMENT"}, \
66 {6, "PROGRAM"}, \
67 {7, "FP_UNAVAIL"}, \
68 {8, "SYSCALL"}, \
69 {9, "AP_UNAVAIL"}, \
70 {10, "DECREMENTER"}, \
71 {11, "FIT"}, \
72 {12, "WATCHDOG"}, \
73 {13, "DTLB_MISS"}, \
74 {14, "ITLB_MISS"}, \
75 {15, "DEBUG"}, \
76 {32, "SPE_UNAVAIL"}, \
77 {33, "SPE_FP_DATA"}, \
78 {34, "SPE_FP_ROUND"}, \
79 {35, "PERFORMANCE_MONITOR"}, \
80 {36, "DOORBELL"}, \
81 {37, "DOORBELL_CRITICAL"}, \
82 {38, "GUEST_DBELL"}, \
83 {39, "GUEST_DBELL_CRIT"}, \
84 {40, "HV_SYSCALL"}, \
85 {41, "HV_PRIV"}
86#endif
87
88TRACE_EVENT(kvm_exit,
89 TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
90 TP_ARGS(exit_nr, vcpu),
91
92 TP_STRUCT__entry(
93 __field( unsigned int, exit_nr )
94 __field( unsigned long, pc )
95 __field( unsigned long, msr )
96 __field( unsigned long, dar )
97#ifdef CONFIG_KVM_BOOK3S_PR
98 __field( unsigned long, srr1 )
99#endif
100 __field( unsigned long, last_inst )
101 ),
102
103 TP_fast_assign(
104#ifdef CONFIG_KVM_BOOK3S_PR
105 struct kvmppc_book3s_shadow_vcpu *svcpu;
106#endif
107 __entry->exit_nr = exit_nr;
108 __entry->pc = kvmppc_get_pc(vcpu);
109 __entry->dar = kvmppc_get_fault_dar(vcpu);
110 __entry->msr = vcpu->arch.shared->msr;
111#ifdef CONFIG_KVM_BOOK3S_PR
112 svcpu = svcpu_get(vcpu);
113 __entry->srr1 = svcpu->shadow_srr1;
114 svcpu_put(svcpu);
115#endif
116 __entry->last_inst = vcpu->arch.last_inst;
117 ),
118
119 TP_printk("exit=%s"
120 " | pc=0x%lx"
121 " | msr=0x%lx"
122 " | dar=0x%lx"
123#ifdef CONFIG_KVM_BOOK3S_PR
124 " | srr1=0x%lx"
125#endif
126 " | last_inst=0x%lx"
127 ,
128 __print_symbolic(__entry->exit_nr, kvm_trace_symbol_exit),
129 __entry->pc,
130 __entry->msr,
131 __entry->dar,
132#ifdef CONFIG_KVM_BOOK3S_PR
133 __entry->srr1,
134#endif
135 __entry->last_inst
136 )
137);
138
139TRACE_EVENT(kvm_unmap_hva,
140 TP_PROTO(unsigned long hva),
141 TP_ARGS(hva),
142
143 TP_STRUCT__entry(
144 __field( unsigned long, hva )
145 ),
146
147 TP_fast_assign(
148 __entry->hva = hva;
149 ),
150
151 TP_printk("unmap hva 0x%lx\n", __entry->hva)
152);
153
34TRACE_EVENT(kvm_stlb_inval, 154TRACE_EVENT(kvm_stlb_inval,
35 TP_PROTO(unsigned int stlb_index), 155 TP_PROTO(unsigned int stlb_index),
36 TP_ARGS(stlb_index), 156 TP_ARGS(stlb_index),
@@ -98,41 +218,31 @@ TRACE_EVENT(kvm_gtlb_write,
98 __entry->word1, __entry->word2) 218 __entry->word1, __entry->word2)
99); 219);
100 220
101 221TRACE_EVENT(kvm_check_requests,
102/************************************************************************* 222 TP_PROTO(struct kvm_vcpu *vcpu),
103 * Book3S trace points * 223 TP_ARGS(vcpu),
104 *************************************************************************/
105
106#ifdef CONFIG_KVM_BOOK3S_PR
107
108TRACE_EVENT(kvm_book3s_exit,
109 TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
110 TP_ARGS(exit_nr, vcpu),
111 224
112 TP_STRUCT__entry( 225 TP_STRUCT__entry(
113 __field( unsigned int, exit_nr ) 226 __field( __u32, cpu_nr )
114 __field( unsigned long, pc ) 227 __field( __u32, requests )
115 __field( unsigned long, msr )
116 __field( unsigned long, dar )
117 __field( unsigned long, srr1 )
118 ), 228 ),
119 229
120 TP_fast_assign( 230 TP_fast_assign(
121 struct kvmppc_book3s_shadow_vcpu *svcpu; 231 __entry->cpu_nr = vcpu->vcpu_id;
122 __entry->exit_nr = exit_nr; 232 __entry->requests = vcpu->requests;
123 __entry->pc = kvmppc_get_pc(vcpu);
124 __entry->dar = kvmppc_get_fault_dar(vcpu);
125 __entry->msr = vcpu->arch.shared->msr;
126 svcpu = svcpu_get(vcpu);
127 __entry->srr1 = svcpu->shadow_srr1;
128 svcpu_put(svcpu);
129 ), 233 ),
130 234
131 TP_printk("exit=0x%x | pc=0x%lx | msr=0x%lx | dar=0x%lx | srr1=0x%lx", 235 TP_printk("vcpu=%x requests=%x",
132 __entry->exit_nr, __entry->pc, __entry->msr, __entry->dar, 236 __entry->cpu_nr, __entry->requests)
133 __entry->srr1)
134); 237);
135 238
239
240/*************************************************************************
241 * Book3S trace points *
242 *************************************************************************/
243
244#ifdef CONFIG_KVM_BOOK3S_PR
245
136TRACE_EVENT(kvm_book3s_reenter, 246TRACE_EVENT(kvm_book3s_reenter,
137 TP_PROTO(int r, struct kvm_vcpu *vcpu), 247 TP_PROTO(int r, struct kvm_vcpu *vcpu),
138 TP_ARGS(r, vcpu), 248 TP_ARGS(r, vcpu),
@@ -395,6 +505,44 @@ TRACE_EVENT(kvm_booke206_gtlb_write,
395 __entry->mas2, __entry->mas7_3) 505 __entry->mas2, __entry->mas7_3)
396); 506);
397 507
508TRACE_EVENT(kvm_booke206_ref_release,
509 TP_PROTO(__u64 pfn, __u32 flags),
510 TP_ARGS(pfn, flags),
511
512 TP_STRUCT__entry(
513 __field( __u64, pfn )
514 __field( __u32, flags )
515 ),
516
517 TP_fast_assign(
518 __entry->pfn = pfn;
519 __entry->flags = flags;
520 ),
521
522 TP_printk("pfn=%llx flags=%x",
523 __entry->pfn, __entry->flags)
524);
525
526TRACE_EVENT(kvm_booke_queue_irqprio,
527 TP_PROTO(struct kvm_vcpu *vcpu, unsigned int priority),
528 TP_ARGS(vcpu, priority),
529
530 TP_STRUCT__entry(
531 __field( __u32, cpu_nr )
532 __field( __u32, priority )
533 __field( unsigned long, pending )
534 ),
535
536 TP_fast_assign(
537 __entry->cpu_nr = vcpu->vcpu_id;
538 __entry->priority = priority;
539 __entry->pending = vcpu->arch.pending_exceptions;
540 ),
541
542 TP_printk("vcpu=%x prio=%x pending=%lx",
543 __entry->cpu_nr, __entry->priority, __entry->pending)
544);
545
398#endif 546#endif
399 547
400#endif /* _TRACE_KVM_H */ 548#endif /* _TRACE_KVM_H */
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 0a6b28336eb..3a8489a354e 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -113,19 +113,6 @@ static int store_updates_sp(struct pt_regs *regs)
113#define MM_FAULT_CONTINUE -1 113#define MM_FAULT_CONTINUE -1
114#define MM_FAULT_ERR(sig) (sig) 114#define MM_FAULT_ERR(sig) (sig)
115 115
116static int out_of_memory(struct pt_regs *regs)
117{
118 /*
119 * We ran out of memory, or some other thing happened to us that made
120 * us unable to handle the page fault gracefully.
121 */
122 up_read(&current->mm->mmap_sem);
123 if (!user_mode(regs))
124 return MM_FAULT_ERR(SIGKILL);
125 pagefault_out_of_memory();
126 return MM_FAULT_RETURN;
127}
128
129static int do_sigbus(struct pt_regs *regs, unsigned long address) 116static int do_sigbus(struct pt_regs *regs, unsigned long address)
130{ 117{
131 siginfo_t info; 118 siginfo_t info;
@@ -169,8 +156,18 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
169 return MM_FAULT_CONTINUE; 156 return MM_FAULT_CONTINUE;
170 157
171 /* Out of memory */ 158 /* Out of memory */
172 if (fault & VM_FAULT_OOM) 159 if (fault & VM_FAULT_OOM) {
173 return out_of_memory(regs); 160 up_read(&current->mm->mmap_sem);
161
162 /*
163 * We ran out of memory, or some other thing happened to us that
164 * made us unable to handle the page fault gracefully.
165 */
166 if (!user_mode(regs))
167 return MM_FAULT_ERR(SIGKILL);
168 pagefault_out_of_memory();
169 return MM_FAULT_RETURN;
170 }
174 171
175 /* Bus error. x86 handles HWPOISON here, we'll add this if/when 172 /* Bus error. x86 handles HWPOISON here, we'll add this if/when
176 * we support the feature in HW 173 * we support the feature in HW
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 5829d2a950d..cf9dada734b 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -722,7 +722,7 @@ void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
722} 722}
723 723
724/* 724/*
725 * is_hugepage_only_range() is used by generic code to verify wether 725 * is_hugepage_only_range() is used by generic code to verify whether
726 * a normal mmap mapping (non hugetlbfs) is valid on a given area. 726 * a normal mmap mapping (non hugetlbfs) is valid on a given area.
727 * 727 *
728 * until the generic code provides a more generic hook and/or starts 728 * until the generic code provides a more generic hook and/or starts
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 1fc8109bf2f..8a5dfaf5c6b 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -134,6 +134,12 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
134 ___PPC_RS(a) | IMM_L(i)) 134 ___PPC_RS(a) | IMM_L(i))
135#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | ___PPC_RA(d) | \ 135#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | ___PPC_RA(d) | \
136 ___PPC_RS(a) | IMM_L(i)) 136 ___PPC_RS(a) | IMM_L(i))
137#define PPC_XOR(d, a, b) EMIT(PPC_INST_XOR | ___PPC_RA(d) | \
138 ___PPC_RS(a) | ___PPC_RB(b))
139#define PPC_XORI(d, a, i) EMIT(PPC_INST_XORI | ___PPC_RA(d) | \
140 ___PPC_RS(a) | IMM_L(i))
141#define PPC_XORIS(d, a, i) EMIT(PPC_INST_XORIS | ___PPC_RA(d) | \
142 ___PPC_RS(a) | IMM_L(i))
137#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | ___PPC_RA(d) | \ 143#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | ___PPC_RA(d) | \
138 ___PPC_RS(a) | ___PPC_RB(s)) 144 ___PPC_RS(a) | ___PPC_RB(s))
139#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \ 145#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index dd1130642d0..e834f1ec23c 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -13,6 +13,8 @@
13#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/filter.h> 15#include <linux/filter.h>
16#include <linux/if_vlan.h>
17
16#include "bpf_jit.h" 18#include "bpf_jit.h"
17 19
18#ifndef __BIG_ENDIAN 20#ifndef __BIG_ENDIAN
@@ -89,6 +91,8 @@ static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image,
89 case BPF_S_ANC_IFINDEX: 91 case BPF_S_ANC_IFINDEX:
90 case BPF_S_ANC_MARK: 92 case BPF_S_ANC_MARK:
91 case BPF_S_ANC_RXHASH: 93 case BPF_S_ANC_RXHASH:
94 case BPF_S_ANC_VLAN_TAG:
95 case BPF_S_ANC_VLAN_TAG_PRESENT:
92 case BPF_S_ANC_CPU: 96 case BPF_S_ANC_CPU:
93 case BPF_S_ANC_QUEUE: 97 case BPF_S_ANC_QUEUE:
94 case BPF_S_LD_W_ABS: 98 case BPF_S_LD_W_ABS:
@@ -232,6 +236,17 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
232 if (K >= 65536) 236 if (K >= 65536)
233 PPC_ORIS(r_A, r_A, IMM_H(K)); 237 PPC_ORIS(r_A, r_A, IMM_H(K));
234 break; 238 break;
239 case BPF_S_ANC_ALU_XOR_X:
240 case BPF_S_ALU_XOR_X: /* A ^= X */
241 ctx->seen |= SEEN_XREG;
242 PPC_XOR(r_A, r_A, r_X);
243 break;
244 case BPF_S_ALU_XOR_K: /* A ^= K */
245 if (IMM_L(K))
246 PPC_XORI(r_A, r_A, IMM_L(K));
247 if (K >= 65536)
248 PPC_XORIS(r_A, r_A, IMM_H(K));
249 break;
235 case BPF_S_ALU_LSH_X: /* A <<= X; */ 250 case BPF_S_ALU_LSH_X: /* A <<= X; */
236 ctx->seen |= SEEN_XREG; 251 ctx->seen |= SEEN_XREG;
237 PPC_SLW(r_A, r_A, r_X); 252 PPC_SLW(r_A, r_A, r_X);
@@ -371,6 +386,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
371 PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, 386 PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
372 rxhash)); 387 rxhash));
373 break; 388 break;
389 case BPF_S_ANC_VLAN_TAG:
390 case BPF_S_ANC_VLAN_TAG_PRESENT:
391 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
392 PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
393 vlan_tci));
394 if (filter[i].code == BPF_S_ANC_VLAN_TAG)
395 PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
396 else
397 PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
398 break;
374 case BPF_S_ANC_QUEUE: 399 case BPF_S_ANC_QUEUE:
375 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 400 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
376 queue_mapping) != 2); 401 queue_mapping) != 2);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index 028470b9588..a51cb07bd66 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -526,7 +526,7 @@ EXPORT_SYMBOL(mpc52xx_gpt_timer_period);
526 526
527#define WDT_IDENTITY "mpc52xx watchdog on GPT0" 527#define WDT_IDENTITY "mpc52xx watchdog on GPT0"
528 528
529/* wdt_is_active stores wether or not the /dev/watchdog device is opened */ 529/* wdt_is_active stores whether or not the /dev/watchdog device is opened */
530static unsigned long wdt_is_active; 530static unsigned long wdt_is_active;
531 531
532/* wdt-capable gpt */ 532/* wdt-capable gpt */
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index e7a896acd98..48a920d5148 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -90,6 +90,7 @@ config MPIC
90config PPC_EPAPR_HV_PIC 90config PPC_EPAPR_HV_PIC
91 bool 91 bool
92 default n 92 default n
93 select EPAPR_PARAVIRT
93 94
94config MPIC_WEIRD 95config MPIC_WEIRD
95 bool 96 bool
diff --git a/arch/powerpc/platforms/cell/celleb_pci.c b/arch/powerpc/platforms/cell/celleb_pci.c
index abc8af43ea7..173568140a3 100644
--- a/arch/powerpc/platforms/cell/celleb_pci.c
+++ b/arch/powerpc/platforms/cell/celleb_pci.c
@@ -401,11 +401,11 @@ error:
401 } else { 401 } else {
402 if (config && *config) { 402 if (config && *config) {
403 size = 256; 403 size = 256;
404 free_bootmem((unsigned long)(*config), size); 404 free_bootmem(__pa(*config), size);
405 } 405 }
406 if (res && *res) { 406 if (res && *res) {
407 size = sizeof(struct celleb_pci_resource); 407 size = sizeof(struct celleb_pci_resource);
408 free_bootmem((unsigned long)(*res), size); 408 free_bootmem(__pa(*res), size);
409 } 409 }
410 } 410 }
411 411
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index dca21366674..e56bb651da1 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -728,7 +728,7 @@ static struct cbe_iommu * __init cell_iommu_alloc(struct device_node *np)
728 nid, np->full_name); 728 nid, np->full_name);
729 729
730 /* XXX todo: If we can have multiple windows on the same IOMMU, which 730 /* XXX todo: If we can have multiple windows on the same IOMMU, which
731 * isn't the case today, we probably want here to check wether the 731 * isn't the case today, we probably want here to check whether the
732 * iommu for that node is already setup. 732 * iommu for that node is already setup.
733 * However, there might be issue with getting the size right so let's 733 * However, there might be issue with getting the size right so let's
734 * ignore that for now. We might want to completely get rid of the 734 * ignore that for now. We might want to completely get rid of the
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index d8b7cc8a66c..8e299447127 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -148,7 +148,7 @@ static int spider_set_irq_type(struct irq_data *d, unsigned int type)
148 148
149 /* Configure the source. One gross hack that was there before and 149 /* Configure the source. One gross hack that was there before and
150 * that I've kept around is the priority to the BE which I set to 150 * that I've kept around is the priority to the BE which I set to
151 * be the same as the interrupt source number. I don't know wether 151 * be the same as the interrupt source number. I don't know whether
152 * that's supposed to make any kind of sense however, we'll have to 152 * that's supposed to make any kind of sense however, we'll have to
153 * decide that, but for now, I'm not changing the behaviour. 153 * decide that, but for now, I'm not changing the behaviour.
154 */ 154 */
@@ -220,7 +220,7 @@ static void spider_irq_cascade(unsigned int irq, struct irq_desc *desc)
220/* For hooking up the cascace we have a problem. Our device-tree is 220/* For hooking up the cascace we have a problem. Our device-tree is
221 * crap and we don't know on which BE iic interrupt we are hooked on at 221 * crap and we don't know on which BE iic interrupt we are hooked on at
222 * least not the "standard" way. We can reconstitute it based on two 222 * least not the "standard" way. We can reconstitute it based on two
223 * informations though: which BE node we are connected to and wether 223 * informations though: which BE node we are connected to and whether
224 * we are connected to IOIF0 or IOIF1. Right now, we really only care 224 * we are connected to IOIF0 or IOIF1. Right now, we really only care
225 * about the IBM cell blade and we know that its firmware gives us an 225 * about the IBM cell blade and we know that its firmware gives us an
226 * interrupt-map property which is pretty strange. 226 * interrupt-map property which is pretty strange.
@@ -232,7 +232,7 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
232 int imaplen, intsize, unit; 232 int imaplen, intsize, unit;
233 struct device_node *iic; 233 struct device_node *iic;
234 234
235 /* First, we check wether we have a real "interrupts" in the device 235 /* First, we check whether we have a real "interrupts" in the device
236 * tree in case the device-tree is ever fixed 236 * tree in case the device-tree is ever fixed
237 */ 237 */
238 struct of_irq oirq; 238 struct of_irq oirq;
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index b0c3777528a..d588e48dff7 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -686,7 +686,7 @@ static int pmf_add_functions(struct pmf_device *dev, void *driverdata)
686 int count = 0; 686 int count = 0;
687 687
688 for (pp = dev->node->properties; pp != 0; pp = pp->next) { 688 for (pp = dev->node->properties; pp != 0; pp = pp->next) {
689 char *name; 689 const char *name;
690 if (strncmp(pp->name, PP_PREFIX, plen) != 0) 690 if (strncmp(pp->name, PP_PREFIX, plen) != 0)
691 continue; 691 continue;
692 name = pp->name + plen; 692 name = pp->name + plen;
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index c4e630576ff..31036b56670 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -529,7 +529,7 @@ static int __init pmac_pic_probe_mpic(void)
529void __init pmac_pic_init(void) 529void __init pmac_pic_init(void)
530{ 530{
531 /* We configure the OF parsing based on our oldworld vs. newworld 531 /* We configure the OF parsing based on our oldworld vs. newworld
532 * platform type and wether we were booted by BootX. 532 * platform type and whether we were booted by BootX.
533 */ 533 */
534#ifdef CONFIG_PPC32 534#ifdef CONFIG_PPC32
535 if (!pmac_newworld) 535 if (!pmac_newworld)
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 45d00e5fe14..4d806b41960 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -36,7 +36,7 @@ static struct cpuidle_state *cpuidle_state_table;
36static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) 36static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
37{ 37{
38 38
39 *kt_before = ktime_get_real(); 39 *kt_before = ktime_get();
40 *in_purr = mfspr(SPRN_PURR); 40 *in_purr = mfspr(SPRN_PURR);
41 /* 41 /*
42 * Indicate to the HV that we are idle. Now would be 42 * Indicate to the HV that we are idle. Now would be
@@ -50,7 +50,7 @@ static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before)
50 get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr; 50 get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr;
51 get_lppaca()->idle = 0; 51 get_lppaca()->idle = 0;
52 52
53 return ktime_to_us(ktime_sub(ktime_get_real(), kt_before)); 53 return ktime_to_us(ktime_sub(ktime_get(), kt_before));
54} 54}
55 55
56static int snooze_loop(struct cpuidle_device *dev, 56static int snooze_loop(struct cpuidle_device *dev,
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 39f71fba9b3..2f4668136b2 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -281,12 +281,11 @@ static struct property *new_property(const char *name, const int length,
281 if (!new) 281 if (!new)
282 return NULL; 282 return NULL;
283 283
284 if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL))) 284 if (!(new->name = kstrdup(name, GFP_KERNEL)))
285 goto cleanup; 285 goto cleanup;
286 if (!(new->value = kmalloc(length + 1, GFP_KERNEL))) 286 if (!(new->value = kmalloc(length + 1, GFP_KERNEL)))
287 goto cleanup; 287 goto cleanup;
288 288
289 strcpy(new->name, name);
290 memcpy(new->value, value, length); 289 memcpy(new->value, value, length);
291 *(((char *)new->value) + length) = 0; 290 *(((char *)new->value) + length) = 0;
292 new->length = length; 291 new->length = length;
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 51ffafae561..63c5f04ea58 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -236,7 +236,6 @@ static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc)
236 u32 intr_index; 236 u32 intr_index;
237 u32 have_shift = 0; 237 u32 have_shift = 0;
238 struct fsl_msi_cascade_data *cascade_data; 238 struct fsl_msi_cascade_data *cascade_data;
239 unsigned int ret;
240 239
241 cascade_data = irq_get_handler_data(irq); 240 cascade_data = irq_get_handler_data(irq);
242 msi_data = cascade_data->msi_data; 241 msi_data = cascade_data->msi_data;
@@ -268,7 +267,9 @@ static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc)
268 case FSL_PIC_IP_IPIC: 267 case FSL_PIC_IP_IPIC:
269 msir_value = fsl_msi_read(msi_data->msi_regs, msir_index * 0x4); 268 msir_value = fsl_msi_read(msi_data->msi_regs, msir_index * 0x4);
270 break; 269 break;
271 case FSL_PIC_IP_VMPIC: 270#ifdef CONFIG_EPAPR_PARAVIRT
271 case FSL_PIC_IP_VMPIC: {
272 unsigned int ret;
272 ret = fh_vmpic_get_msir(virq_to_hw(irq), &msir_value); 273 ret = fh_vmpic_get_msir(virq_to_hw(irq), &msir_value);
273 if (ret) { 274 if (ret) {
274 pr_err("fsl-msi: fh_vmpic_get_msir() failed for " 275 pr_err("fsl-msi: fh_vmpic_get_msir() failed for "
@@ -277,6 +278,8 @@ static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc)
277 } 278 }
278 break; 279 break;
279 } 280 }
281#endif
282 }
280 283
281 while (msir_value) { 284 while (msir_value) {
282 intr_index = ffs(msir_value) - 1; 285 intr_index = ffs(msir_value) - 1;
@@ -508,10 +511,12 @@ static const struct of_device_id fsl_of_msi_ids[] = {
508 .compatible = "fsl,ipic-msi", 511 .compatible = "fsl,ipic-msi",
509 .data = &ipic_msi_feature, 512 .data = &ipic_msi_feature,
510 }, 513 },
514#ifdef CONFIG_EPAPR_PARAVIRT
511 { 515 {
512 .compatible = "fsl,vmpic-msi", 516 .compatible = "fsl,vmpic-msi",
513 .data = &vmpic_msi_feature, 517 .data = &vmpic_msi_feature,
514 }, 518 },
519#endif
515 {} 520 {}
516}; 521};
517 522
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index ffb93ae9379..01b62a62c63 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -136,7 +136,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
136 u32 pcicsrbar = 0, pcicsrbar_sz; 136 u32 pcicsrbar = 0, pcicsrbar_sz;
137 u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL | 137 u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL |
138 PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP; 138 PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP;
139 char *name = hose->dn->full_name; 139 const char *name = hose->dn->full_name;
140 const u64 *reg; 140 const u64 *reg;
141 int len; 141 int len;
142 142
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index c449dbd1c93..97118dc3d28 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -253,6 +253,7 @@ struct platform_diu_data_ops diu_ops;
253EXPORT_SYMBOL(diu_ops); 253EXPORT_SYMBOL(diu_ops);
254#endif 254#endif
255 255
256#ifdef CONFIG_EPAPR_PARAVIRT
256/* 257/*
257 * Restart the current partition 258 * Restart the current partition
258 * 259 *
@@ -278,3 +279,4 @@ void fsl_hv_halt(void)
278 pr_info("hv exit\n"); 279 pr_info("hv exit\n");
279 fh_partition_stop(-1); 280 fh_partition_stop(-1);
280} 281}
282#endif
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c
index 702256a1ca1..9193e12df69 100644
--- a/arch/powerpc/sysdev/scom.c
+++ b/arch/powerpc/sysdev/scom.c
@@ -157,7 +157,7 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
157 ent->map = SCOM_MAP_INVALID; 157 ent->map = SCOM_MAP_INVALID;
158 spin_lock_init(&ent->lock); 158 spin_lock_init(&ent->lock);
159 snprintf(ent->name, 8, "scom%d", i); 159 snprintf(ent->name, 8, "scom%d", i);
160 ent->blob.data = dn->full_name; 160 ent->blob.data = (void*) dn->full_name;
161 ent->blob.size = strlen(dn->full_name); 161 ent->blob.size = strlen(dn->full_name);
162 162
163 dir = debugfs_create_dir(ent->name, root); 163 dir = debugfs_create_dir(ent->name, root);
diff --git a/arch/s390/Kbuild b/arch/s390/Kbuild
index cc45d25487b..647c3eccc3d 100644
--- a/arch/s390/Kbuild
+++ b/arch/s390/Kbuild
@@ -6,3 +6,4 @@ obj-$(CONFIG_S390_HYPFS_FS) += hypfs/
6obj-$(CONFIG_APPLDATA_BASE) += appldata/ 6obj-$(CONFIG_APPLDATA_BASE) += appldata/
7obj-$(CONFIG_MATHEMU) += math-emu/ 7obj-$(CONFIG_MATHEMU) += math-emu/
8obj-y += net/ 8obj-y += net/
9obj-$(CONFIG_PCI) += pci/
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index d385f396dfe..32425af9d68 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -34,12 +34,6 @@ config GENERIC_BUG
34config GENERIC_BUG_RELATIVE_POINTERS 34config GENERIC_BUG_RELATIVE_POINTERS
35 def_bool y 35 def_bool y
36 36
37config NO_IOMEM
38 def_bool y
39
40config NO_DMA
41 def_bool y
42
43config ARCH_DMA_ADDR_T_64BIT 37config ARCH_DMA_ADDR_T_64BIT
44 def_bool 64BIT 38 def_bool 64BIT
45 39
@@ -58,6 +52,12 @@ config KEXEC
58config AUDIT_ARCH 52config AUDIT_ARCH
59 def_bool y 53 def_bool y
60 54
55config NO_IOPORT
56 def_bool y
57
58config PCI_QUIRKS
59 def_bool n
60
61config S390 61config S390
62 def_bool y 62 def_bool y
63 select USE_GENERIC_SMP_HELPERS if SMP 63 select USE_GENERIC_SMP_HELPERS if SMP
@@ -138,8 +138,10 @@ config S390
138 select KTIME_SCALAR if 32BIT 138 select KTIME_SCALAR if 32BIT
139 select HAVE_ARCH_SECCOMP_FILTER 139 select HAVE_ARCH_SECCOMP_FILTER
140 select GENERIC_KERNEL_THREAD 140 select GENERIC_KERNEL_THREAD
141 select GENERIC_KERNEL_EXECVE
141 select HAVE_MOD_ARCH_SPECIFIC 142 select HAVE_MOD_ARCH_SPECIFIC
142 select MODULES_USE_ELF_RELA 143 select MODULES_USE_ELF_RELA
144 select CLONE_BACKWARDS2
143 145
144config SCHED_OMIT_FRAME_POINTER 146config SCHED_OMIT_FRAME_POINTER
145 def_bool y 147 def_bool y
@@ -169,6 +171,10 @@ config HAVE_MARCH_Z196_FEATURES
169 def_bool n 171 def_bool n
170 select HAVE_MARCH_Z10_FEATURES 172 select HAVE_MARCH_Z10_FEATURES
171 173
174config HAVE_MARCH_ZEC12_FEATURES
175 def_bool n
176 select HAVE_MARCH_Z196_FEATURES
177
172choice 178choice
173 prompt "Processor type" 179 prompt "Processor type"
174 default MARCH_G5 180 default MARCH_G5
@@ -220,6 +226,13 @@ config MARCH_Z196
220 (2818 and 2817 series). The kernel will be slightly faster but will 226 (2818 and 2817 series). The kernel will be slightly faster but will
221 not work on older machines. 227 not work on older machines.
222 228
229config MARCH_ZEC12
230 bool "IBM zEC12"
231 select HAVE_MARCH_ZEC12_FEATURES if 64BIT
232 help
233 Select this to enable optimizations for IBM zEC12 (2827 series). The
234 kernel will be slightly faster but will not work on older machines.
235
223endchoice 236endchoice
224 237
225config 64BIT 238config 64BIT
@@ -424,6 +437,53 @@ config QDIO
424 437
425 If unsure, say Y. 438 If unsure, say Y.
426 439
440menuconfig PCI
441 bool "PCI support"
442 default n
443 depends on 64BIT
444 select ARCH_SUPPORTS_MSI
445 select PCI_MSI
446 help
447 Enable PCI support.
448
449if PCI
450
451config PCI_NR_FUNCTIONS
452 int "Maximum number of PCI functions (1-4096)"
453 range 1 4096
454 default "64"
455 help
456 This allows you to specify the maximum number of PCI functions which
457 this kernel will support.
458
459source "drivers/pci/Kconfig"
460source "drivers/pci/pcie/Kconfig"
461source "drivers/pci/hotplug/Kconfig"
462
463endif # PCI
464
465config PCI_DOMAINS
466 def_bool PCI
467
468config HAS_IOMEM
469 def_bool PCI
470
471config IOMMU_HELPER
472 def_bool PCI
473
474config HAS_DMA
475 def_bool PCI
476 select HAVE_DMA_API_DEBUG
477
478config NEED_SG_DMA_LENGTH
479 def_bool PCI
480
481config HAVE_DMA_ATTRS
482 def_bool PCI
483
484config NEED_DMA_MAP_STATE
485 def_bool PCI
486
427config CHSC_SCH 487config CHSC_SCH
428 def_tristate m 488 def_tristate m
429 prompt "Support for CHSC subchannels" 489 prompt "Support for CHSC subchannels"
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 49e76e8b477..4b8e08b56f4 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -41,6 +41,7 @@ cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990)
41cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109) 41cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109)
42cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10) 42cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10)
43cflags-$(CONFIG_MARCH_Z196) += $(call cc-option,-march=z196) 43cflags-$(CONFIG_MARCH_Z196) += $(call cc-option,-march=z196)
44cflags-$(CONFIG_MARCH_ZEC12) += $(call cc-option,-march=zEC12)
44 45
45#KBUILD_IMAGE is necessary for make rpm 46#KBUILD_IMAGE is necessary for make rpm
46KBUILD_IMAGE :=arch/s390/boot/image 47KBUILD_IMAGE :=arch/s390/boot/image
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index da3c1a7dcd8..b4dbade8ca2 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -325,7 +325,8 @@ static int ecb_aes_crypt(struct blkcipher_desc *desc, long func, void *param,
325 u8 *in = walk->src.virt.addr; 325 u8 *in = walk->src.virt.addr;
326 326
327 ret = crypt_s390_km(func, param, out, in, n); 327 ret = crypt_s390_km(func, param, out, in, n);
328 BUG_ON((ret < 0) || (ret != n)); 328 if (ret < 0 || ret != n)
329 return -EIO;
329 330
330 nbytes &= AES_BLOCK_SIZE - 1; 331 nbytes &= AES_BLOCK_SIZE - 1;
331 ret = blkcipher_walk_done(desc, walk, nbytes); 332 ret = blkcipher_walk_done(desc, walk, nbytes);
@@ -457,7 +458,8 @@ static int cbc_aes_crypt(struct blkcipher_desc *desc, long func, void *param,
457 u8 *in = walk->src.virt.addr; 458 u8 *in = walk->src.virt.addr;
458 459
459 ret = crypt_s390_kmc(func, param, out, in, n); 460 ret = crypt_s390_kmc(func, param, out, in, n);
460 BUG_ON((ret < 0) || (ret != n)); 461 if (ret < 0 || ret != n)
462 return -EIO;
461 463
462 nbytes &= AES_BLOCK_SIZE - 1; 464 nbytes &= AES_BLOCK_SIZE - 1;
463 ret = blkcipher_walk_done(desc, walk, nbytes); 465 ret = blkcipher_walk_done(desc, walk, nbytes);
@@ -625,7 +627,8 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func,
625 memcpy(xts_ctx->pcc.tweak, walk->iv, sizeof(xts_ctx->pcc.tweak)); 627 memcpy(xts_ctx->pcc.tweak, walk->iv, sizeof(xts_ctx->pcc.tweak));
626 param = xts_ctx->pcc.key + offset; 628 param = xts_ctx->pcc.key + offset;
627 ret = crypt_s390_pcc(func, param); 629 ret = crypt_s390_pcc(func, param);
628 BUG_ON(ret < 0); 630 if (ret < 0)
631 return -EIO;
629 632
630 memcpy(xts_ctx->xts_param, xts_ctx->pcc.xts, 16); 633 memcpy(xts_ctx->xts_param, xts_ctx->pcc.xts, 16);
631 param = xts_ctx->key + offset; 634 param = xts_ctx->key + offset;
@@ -636,7 +639,8 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func,
636 in = walk->src.virt.addr; 639 in = walk->src.virt.addr;
637 640
638 ret = crypt_s390_km(func, param, out, in, n); 641 ret = crypt_s390_km(func, param, out, in, n);
639 BUG_ON(ret < 0 || ret != n); 642 if (ret < 0 || ret != n)
643 return -EIO;
640 644
641 nbytes &= AES_BLOCK_SIZE - 1; 645 nbytes &= AES_BLOCK_SIZE - 1;
642 ret = blkcipher_walk_done(desc, walk, nbytes); 646 ret = blkcipher_walk_done(desc, walk, nbytes);
@@ -769,7 +773,8 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
769 crypto_inc(ctrblk + i, AES_BLOCK_SIZE); 773 crypto_inc(ctrblk + i, AES_BLOCK_SIZE);
770 } 774 }
771 ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk); 775 ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk);
772 BUG_ON(ret < 0 || ret != n); 776 if (ret < 0 || ret != n)
777 return -EIO;
773 if (n > AES_BLOCK_SIZE) 778 if (n > AES_BLOCK_SIZE)
774 memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE, 779 memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE,
775 AES_BLOCK_SIZE); 780 AES_BLOCK_SIZE);
@@ -788,7 +793,8 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
788 in = walk->src.virt.addr; 793 in = walk->src.virt.addr;
789 ret = crypt_s390_kmctr(func, sctx->key, buf, in, 794 ret = crypt_s390_kmctr(func, sctx->key, buf, in,
790 AES_BLOCK_SIZE, ctrblk); 795 AES_BLOCK_SIZE, ctrblk);
791 BUG_ON(ret < 0 || ret != AES_BLOCK_SIZE); 796 if (ret < 0 || ret != AES_BLOCK_SIZE)
797 return -EIO;
792 memcpy(out, buf, nbytes); 798 memcpy(out, buf, nbytes);
793 crypto_inc(ctrblk, AES_BLOCK_SIZE); 799 crypto_inc(ctrblk, AES_BLOCK_SIZE);
794 ret = blkcipher_walk_done(desc, walk, 0); 800 ret = blkcipher_walk_done(desc, walk, 0);
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index b49fb96f420..bcca01c9989 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -94,7 +94,8 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func,
94 u8 *in = walk->src.virt.addr; 94 u8 *in = walk->src.virt.addr;
95 95
96 ret = crypt_s390_km(func, key, out, in, n); 96 ret = crypt_s390_km(func, key, out, in, n);
97 BUG_ON((ret < 0) || (ret != n)); 97 if (ret < 0 || ret != n)
98 return -EIO;
98 99
99 nbytes &= DES_BLOCK_SIZE - 1; 100 nbytes &= DES_BLOCK_SIZE - 1;
100 ret = blkcipher_walk_done(desc, walk, nbytes); 101 ret = blkcipher_walk_done(desc, walk, nbytes);
@@ -120,7 +121,8 @@ static int cbc_desall_crypt(struct blkcipher_desc *desc, long func,
120 u8 *in = walk->src.virt.addr; 121 u8 *in = walk->src.virt.addr;
121 122
122 ret = crypt_s390_kmc(func, iv, out, in, n); 123 ret = crypt_s390_kmc(func, iv, out, in, n);
123 BUG_ON((ret < 0) || (ret != n)); 124 if (ret < 0 || ret != n)
125 return -EIO;
124 126
125 nbytes &= DES_BLOCK_SIZE - 1; 127 nbytes &= DES_BLOCK_SIZE - 1;
126 ret = blkcipher_walk_done(desc, walk, nbytes); 128 ret = blkcipher_walk_done(desc, walk, nbytes);
@@ -386,7 +388,8 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
386 crypto_inc(ctrblk + i, DES_BLOCK_SIZE); 388 crypto_inc(ctrblk + i, DES_BLOCK_SIZE);
387 } 389 }
388 ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk); 390 ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk);
389 BUG_ON((ret < 0) || (ret != n)); 391 if (ret < 0 || ret != n)
392 return -EIO;
390 if (n > DES_BLOCK_SIZE) 393 if (n > DES_BLOCK_SIZE)
391 memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE, 394 memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE,
392 DES_BLOCK_SIZE); 395 DES_BLOCK_SIZE);
@@ -404,7 +407,8 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
404 in = walk->src.virt.addr; 407 in = walk->src.virt.addr;
405 ret = crypt_s390_kmctr(func, ctx->key, buf, in, 408 ret = crypt_s390_kmctr(func, ctx->key, buf, in,
406 DES_BLOCK_SIZE, ctrblk); 409 DES_BLOCK_SIZE, ctrblk);
407 BUG_ON(ret < 0 || ret != DES_BLOCK_SIZE); 410 if (ret < 0 || ret != DES_BLOCK_SIZE)
411 return -EIO;
408 memcpy(out, buf, nbytes); 412 memcpy(out, buf, nbytes);
409 crypto_inc(ctrblk, DES_BLOCK_SIZE); 413 crypto_inc(ctrblk, DES_BLOCK_SIZE);
410 ret = blkcipher_walk_done(desc, walk, 0); 414 ret = blkcipher_walk_done(desc, walk, 0);
diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c
index 1ebd3a15cca..d43485d142e 100644
--- a/arch/s390/crypto/ghash_s390.c
+++ b/arch/s390/crypto/ghash_s390.c
@@ -72,14 +72,16 @@ static int ghash_update(struct shash_desc *desc,
72 if (!dctx->bytes) { 72 if (!dctx->bytes) {
73 ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, 73 ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf,
74 GHASH_BLOCK_SIZE); 74 GHASH_BLOCK_SIZE);
75 BUG_ON(ret != GHASH_BLOCK_SIZE); 75 if (ret != GHASH_BLOCK_SIZE)
76 return -EIO;
76 } 77 }
77 } 78 }
78 79
79 n = srclen & ~(GHASH_BLOCK_SIZE - 1); 80 n = srclen & ~(GHASH_BLOCK_SIZE - 1);
80 if (n) { 81 if (n) {
81 ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n); 82 ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n);
82 BUG_ON(ret != n); 83 if (ret != n)
84 return -EIO;
83 src += n; 85 src += n;
84 srclen -= n; 86 srclen -= n;
85 } 87 }
@@ -92,7 +94,7 @@ static int ghash_update(struct shash_desc *desc,
92 return 0; 94 return 0;
93} 95}
94 96
95static void ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) 97static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx)
96{ 98{
97 u8 *buf = dctx->buffer; 99 u8 *buf = dctx->buffer;
98 int ret; 100 int ret;
@@ -103,21 +105,24 @@ static void ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx)
103 memset(pos, 0, dctx->bytes); 105 memset(pos, 0, dctx->bytes);
104 106
105 ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE); 107 ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE);
106 BUG_ON(ret != GHASH_BLOCK_SIZE); 108 if (ret != GHASH_BLOCK_SIZE)
109 return -EIO;
107 } 110 }
108 111
109 dctx->bytes = 0; 112 dctx->bytes = 0;
113 return 0;
110} 114}
111 115
112static int ghash_final(struct shash_desc *desc, u8 *dst) 116static int ghash_final(struct shash_desc *desc, u8 *dst)
113{ 117{
114 struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); 118 struct ghash_desc_ctx *dctx = shash_desc_ctx(desc);
115 struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); 119 struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
120 int ret;
116 121
117 ghash_flush(ctx, dctx); 122 ret = ghash_flush(ctx, dctx);
118 memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE); 123 if (!ret)
119 124 memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE);
120 return 0; 125 return ret;
121} 126}
122 127
123static struct shash_alg ghash_alg = { 128static struct shash_alg ghash_alg = {
diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c
index bd37d09b9d3..8620b0ec9c4 100644
--- a/arch/s390/crypto/sha_common.c
+++ b/arch/s390/crypto/sha_common.c
@@ -36,7 +36,8 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
36 if (index) { 36 if (index) {
37 memcpy(ctx->buf + index, data, bsize - index); 37 memcpy(ctx->buf + index, data, bsize - index);
38 ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, bsize); 38 ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, bsize);
39 BUG_ON(ret != bsize); 39 if (ret != bsize)
40 return -EIO;
40 data += bsize - index; 41 data += bsize - index;
41 len -= bsize - index; 42 len -= bsize - index;
42 index = 0; 43 index = 0;
@@ -46,7 +47,8 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
46 if (len >= bsize) { 47 if (len >= bsize) {
47 ret = crypt_s390_kimd(ctx->func, ctx->state, data, 48 ret = crypt_s390_kimd(ctx->func, ctx->state, data,
48 len & ~(bsize - 1)); 49 len & ~(bsize - 1));
49 BUG_ON(ret != (len & ~(bsize - 1))); 50 if (ret != (len & ~(bsize - 1)))
51 return -EIO;
50 data += ret; 52 data += ret;
51 len -= ret; 53 len -= ret;
52 } 54 }
@@ -88,7 +90,8 @@ int s390_sha_final(struct shash_desc *desc, u8 *out)
88 memcpy(ctx->buf + end - 8, &bits, sizeof(bits)); 90 memcpy(ctx->buf + end - 8, &bits, sizeof(bits));
89 91
90 ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, end); 92 ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, end);
91 BUG_ON(ret != end); 93 if (ret != end)
94 return -EIO;
92 95
93 /* copy digest to out */ 96 /* copy digest to out */
94 memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm)); 97 memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm));
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index 0633dc6d254..f313f9cbcf4 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -1,3 +1,4 @@
1 1
2 2
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += trace_clock.h
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 6f573890fb2..15422933c60 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -640,6 +640,87 @@ static inline unsigned long find_first_bit(const unsigned long * addr,
640} 640}
641#define find_first_bit find_first_bit 641#define find_first_bit find_first_bit
642 642
643/*
644 * Big endian variant whichs starts bit counting from left using
645 * the flogr (find leftmost one) instruction.
646 */
647static inline unsigned long __flo_word(unsigned long nr, unsigned long val)
648{
649 register unsigned long bit asm("2") = val;
650 register unsigned long out asm("3");
651
652 asm volatile (
653 " .insn rre,0xb9830000,%[bit],%[bit]\n"
654 : [bit] "+d" (bit), [out] "=d" (out) : : "cc");
655 return nr + bit;
656}
657
658/*
659 * 64 bit special left bitops format:
660 * order in memory:
661 * 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
662 * 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
663 * 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
664 * 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
665 * after that follows the next long with bit numbers
666 * 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
667 * 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
668 * 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
669 * 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f
670 * The reason for this bit ordering is the fact that
671 * the hardware sets bits in a bitmap starting at bit 0
672 * and we don't want to scan the bitmap from the 'wrong
673 * end'.
674 */
675static inline unsigned long find_first_bit_left(const unsigned long *addr,
676 unsigned long size)
677{
678 unsigned long bytes, bits;
679
680 if (!size)
681 return 0;
682 bytes = __ffs_word_loop(addr, size);
683 bits = __flo_word(bytes * 8, __load_ulong_be(addr, bytes));
684 return (bits < size) ? bits : size;
685}
686
687static inline int find_next_bit_left(const unsigned long *addr,
688 unsigned long size,
689 unsigned long offset)
690{
691 const unsigned long *p;
692 unsigned long bit, set;
693
694 if (offset >= size)
695 return size;
696 bit = offset & (__BITOPS_WORDSIZE - 1);
697 offset -= bit;
698 size -= offset;
699 p = addr + offset / __BITOPS_WORDSIZE;
700 if (bit) {
701 set = __flo_word(0, *p & (~0UL << bit));
702 if (set >= size)
703 return size + offset;
704 if (set < __BITOPS_WORDSIZE)
705 return set + offset;
706 offset += __BITOPS_WORDSIZE;
707 size -= __BITOPS_WORDSIZE;
708 p++;
709 }
710 return offset + find_first_bit_left(p, size);
711}
712
713#define for_each_set_bit_left(bit, addr, size) \
714 for ((bit) = find_first_bit_left((addr), (size)); \
715 (bit) < (size); \
716 (bit) = find_next_bit_left((addr), (size), (bit) + 1))
717
718/* same as for_each_set_bit() but use bit as value to start with */
719#define for_each_set_bit_left_cont(bit, addr, size) \
720 for ((bit) = find_next_bit_left((addr), (size), (bit)); \
721 (bit) < (size); \
722 (bit) = find_next_bit_left((addr), (size), (bit) + 1))
723
643/** 724/**
644 * find_next_zero_bit - find the first zero bit in a memory region 725 * find_next_zero_bit - find the first zero bit in a memory region
645 * @addr: The address to base the search on 726 * @addr: The address to base the search on
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index 1cb4bb3f32d..6d1f3573f0d 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -18,6 +18,9 @@ struct irb;
18struct ccw1; 18struct ccw1;
19struct ccw_dev_id; 19struct ccw_dev_id;
20 20
21/* from asm/schid.h */
22struct subchannel_id;
23
21/* simplified initializers for struct ccw_device: 24/* simplified initializers for struct ccw_device:
22 * CCW_DEVICE and CCW_DEVICE_DEVTYPE initialize one 25 * CCW_DEVICE and CCW_DEVICE_DEVTYPE initialize one
23 * entry in your MODULE_DEVICE_TABLE and set the match_flag correctly */ 26 * entry in your MODULE_DEVICE_TABLE and set the match_flag correctly */
@@ -223,8 +226,7 @@ extern int ccw_device_force_console(void);
223 226
224int ccw_device_siosl(struct ccw_device *); 227int ccw_device_siosl(struct ccw_device *);
225 228
226// FIXME: these have to go 229extern void ccw_device_get_schid(struct ccw_device *, struct subchannel_id *);
227extern int _ccw_device_get_subchannel_number(struct ccw_device *);
228 230
229extern void *ccw_device_get_chp_desc(struct ccw_device *, int); 231extern void *ccw_device_get_chp_desc(struct ccw_device *, int);
230#endif /* _S390_CCWDEV_H_ */ 232#endif /* _S390_CCWDEV_H_ */
diff --git a/arch/s390/include/asm/ccwgroup.h b/arch/s390/include/asm/ccwgroup.h
index 01a905eb11e..23723ce5ca7 100644
--- a/arch/s390/include/asm/ccwgroup.h
+++ b/arch/s390/include/asm/ccwgroup.h
@@ -59,6 +59,9 @@ extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
59int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv, 59int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv,
60 int num_devices, const char *buf); 60 int num_devices, const char *buf);
61 61
62extern int ccwgroup_set_online(struct ccwgroup_device *gdev);
63extern int ccwgroup_set_offline(struct ccwgroup_device *gdev);
64
62extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); 65extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
63extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); 66extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
64 67
diff --git a/arch/s390/include/asm/clp.h b/arch/s390/include/asm/clp.h
new file mode 100644
index 00000000000..6c3aecc245f
--- /dev/null
+++ b/arch/s390/include/asm/clp.h
@@ -0,0 +1,28 @@
1#ifndef _ASM_S390_CLP_H
2#define _ASM_S390_CLP_H
3
4/* CLP common request & response block size */
5#define CLP_BLK_SIZE (PAGE_SIZE * 2)
6
7struct clp_req_hdr {
8 u16 len;
9 u16 cmd;
10} __packed;
11
12struct clp_rsp_hdr {
13 u16 len;
14 u16 rsp;
15} __packed;
16
17/* CLP Response Codes */
18#define CLP_RC_OK 0x0010 /* Command request successfully */
19#define CLP_RC_CMD 0x0020 /* Command code not recognized */
20#define CLP_RC_PERM 0x0030 /* Command not authorized */
21#define CLP_RC_FMT 0x0040 /* Invalid command request format */
22#define CLP_RC_LEN 0x0050 /* Invalid command request length */
23#define CLP_RC_8K 0x0060 /* Command requires 8K LPCB */
24#define CLP_RC_RESNOT0 0x0070 /* Reserved field not zero */
25#define CLP_RC_NODATA 0x0080 /* No data available */
26#define CLP_RC_FC_UNKNOWN 0x0100 /* Function code not recognized */
27
28#endif
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 023d5ae2448..d2ff41370c0 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -14,6 +14,7 @@
14 14
15 15
16#define __ARCH_HAS_VTIME_ACCOUNT 16#define __ARCH_HAS_VTIME_ACCOUNT
17#define __ARCH_HAS_VTIME_TASK_SWITCH
17 18
18/* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */ 19/* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */
19 20
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h
new file mode 100644
index 00000000000..8a32f7dfd3a
--- /dev/null
+++ b/arch/s390/include/asm/dma-mapping.h
@@ -0,0 +1,76 @@
1#ifndef _ASM_S390_DMA_MAPPING_H
2#define _ASM_S390_DMA_MAPPING_H
3
4#include <linux/kernel.h>
5#include <linux/types.h>
6#include <linux/mm.h>
7#include <linux/scatterlist.h>
8#include <linux/dma-attrs.h>
9#include <linux/dma-debug.h>
10#include <linux/io.h>
11
12#define DMA_ERROR_CODE (~(dma_addr_t) 0x0)
13
14extern struct dma_map_ops s390_dma_ops;
15
16static inline struct dma_map_ops *get_dma_ops(struct device *dev)
17{
18 return &s390_dma_ops;
19}
20
21extern int dma_set_mask(struct device *dev, u64 mask);
22extern int dma_is_consistent(struct device *dev, dma_addr_t dma_handle);
23extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
24 enum dma_data_direction direction);
25
26#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
27#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
28
29#include <asm-generic/dma-mapping-common.h>
30
31static inline int dma_supported(struct device *dev, u64 mask)
32{
33 struct dma_map_ops *dma_ops = get_dma_ops(dev);
34
35 if (dma_ops->dma_supported == NULL)
36 return 1;
37 return dma_ops->dma_supported(dev, mask);
38}
39
40static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
41{
42 if (!dev->dma_mask)
43 return 0;
44 return addr + size - 1 <= *dev->dma_mask;
45}
46
47static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
48{
49 struct dma_map_ops *dma_ops = get_dma_ops(dev);
50
51 if (dma_ops->mapping_error)
52 return dma_ops->mapping_error(dev, dma_addr);
53 return (dma_addr == 0UL);
54}
55
56static inline void *dma_alloc_coherent(struct device *dev, size_t size,
57 dma_addr_t *dma_handle, gfp_t flag)
58{
59 struct dma_map_ops *ops = get_dma_ops(dev);
60 void *ret;
61
62 ret = ops->alloc(dev, size, dma_handle, flag, NULL);
63 debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
64 return ret;
65}
66
67static inline void dma_free_coherent(struct device *dev, size_t size,
68 void *cpu_addr, dma_addr_t dma_handle)
69{
70 struct dma_map_ops *dma_ops = get_dma_ops(dev);
71
72 dma_ops->free(dev, size, cpu_addr, dma_handle, NULL);
73 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
74}
75
76#endif /* _ASM_S390_DMA_MAPPING_H */
diff --git a/arch/s390/include/asm/dma.h b/arch/s390/include/asm/dma.h
index 6fb6de4f15b..de015d85e3e 100644
--- a/arch/s390/include/asm/dma.h
+++ b/arch/s390/include/asm/dma.h
@@ -1,14 +1,13 @@
1/* 1#ifndef _ASM_S390_DMA_H
2 * S390 version 2#define _ASM_S390_DMA_H
3 */
4
5#ifndef _ASM_DMA_H
6#define _ASM_DMA_H
7 3
8#include <asm/io.h> /* need byte IO */ 4#include <asm/io.h>
9 5
6/*
7 * MAX_DMA_ADDRESS is ambiguous because on s390 its completely unrelated
8 * to DMA. It _is_ used for the s390 memory zone split at 2GB caused
9 * by the 31 bit heritage.
10 */
10#define MAX_DMA_ADDRESS 0x80000000 11#define MAX_DMA_ADDRESS 0x80000000
11 12
12#define free_dma(x) do { } while (0) 13#endif /* _ASM_S390_DMA_H */
13
14#endif /* _ASM_DMA_H */
diff --git a/arch/s390/include/asm/hw_irq.h b/arch/s390/include/asm/hw_irq.h
new file mode 100644
index 00000000000..7e3d2586c1f
--- /dev/null
+++ b/arch/s390/include/asm/hw_irq.h
@@ -0,0 +1,22 @@
1#ifndef _HW_IRQ_H
2#define _HW_IRQ_H
3
4#include <linux/msi.h>
5#include <linux/pci.h>
6
7static inline struct msi_desc *irq_get_msi_desc(unsigned int irq)
8{
9 return __irq_get_msi_desc(irq);
10}
11
12/* Must be called with msi map lock held */
13static inline int irq_set_msi_desc(unsigned int irq, struct msi_desc *msi)
14{
15 if (!msi)
16 return -EINVAL;
17
18 msi->irq = irq;
19 return 0;
20}
21
22#endif
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index 559e921a6bb..16c3eb164f4 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -9,9 +9,9 @@
9#ifndef _S390_IO_H 9#ifndef _S390_IO_H
10#define _S390_IO_H 10#define _S390_IO_H
11 11
12#include <linux/kernel.h>
12#include <asm/page.h> 13#include <asm/page.h>
13 14#include <asm/pci_io.h>
14#define IO_SPACE_LIMIT 0xffffffff
15 15
16/* 16/*
17 * Change virtual addresses to physical addresses and vv. 17 * Change virtual addresses to physical addresses and vv.
@@ -24,10 +24,11 @@ static inline unsigned long virt_to_phys(volatile void * address)
24 " lra %0,0(%1)\n" 24 " lra %0,0(%1)\n"
25 " jz 0f\n" 25 " jz 0f\n"
26 " la %0,0\n" 26 " la %0,0\n"
27 "0:" 27 "0:"
28 : "=a" (real_address) : "a" (address) : "cc"); 28 : "=a" (real_address) : "a" (address) : "cc");
29 return real_address; 29 return real_address;
30} 30}
31#define virt_to_phys virt_to_phys
31 32
32static inline void * phys_to_virt(unsigned long address) 33static inline void * phys_to_virt(unsigned long address)
33{ 34{
@@ -42,4 +43,50 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
42 */ 43 */
43#define xlate_dev_kmem_ptr(p) p 44#define xlate_dev_kmem_ptr(p) p
44 45
46#define IO_SPACE_LIMIT 0
47
48#ifdef CONFIG_PCI
49
50#define ioremap_nocache(addr, size) ioremap(addr, size)
51#define ioremap_wc ioremap_nocache
52
53/* TODO: s390 cannot support io_remap_pfn_range... */
54#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
55 remap_pfn_range(vma, vaddr, pfn, size, prot)
56
57static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
58{
59 return (void __iomem *) offset;
60}
61
62static inline void iounmap(volatile void __iomem *addr)
63{
64}
65
66/*
67 * s390 needs a private implementation of pci_iomap since ioremap with its
68 * offset parameter isn't sufficient. That's because BAR spaces are not
69 * disjunctive on s390 so we need the bar parameter of pci_iomap to find
70 * the corresponding device and create the mapping cookie.
71 */
72#define pci_iomap pci_iomap
73#define pci_iounmap pci_iounmap
74
75#define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count)
76#define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count)
77#define memset_io(dst, val, count) zpci_memset_io(dst, val, count)
78
79#define __raw_readb zpci_read_u8
80#define __raw_readw zpci_read_u16
81#define __raw_readl zpci_read_u32
82#define __raw_readq zpci_read_u64
83#define __raw_writeb zpci_write_u8
84#define __raw_writew zpci_write_u16
85#define __raw_writel zpci_write_u32
86#define __raw_writeq zpci_write_u64
87
88#endif /* CONFIG_PCI */
89
90#include <asm-generic/io.h>
91
45#endif 92#endif
diff --git a/arch/s390/include/asm/irq.h b/arch/s390/include/asm/irq.h
index 6703dd986fd..e6972f85d2b 100644
--- a/arch/s390/include/asm/irq.h
+++ b/arch/s390/include/asm/irq.h
@@ -33,6 +33,8 @@ enum interruption_class {
33 IOINT_APB, 33 IOINT_APB,
34 IOINT_ADM, 34 IOINT_ADM,
35 IOINT_CSC, 35 IOINT_CSC,
36 IOINT_PCI,
37 IOINT_MSI,
36 NMI_NMI, 38 NMI_NMI,
37 NR_IRQS, 39 NR_IRQS,
38}; 40};
@@ -51,4 +53,14 @@ void service_subclass_irq_unregister(void);
51void measurement_alert_subclass_register(void); 53void measurement_alert_subclass_register(void);
52void measurement_alert_subclass_unregister(void); 54void measurement_alert_subclass_unregister(void);
53 55
56#ifdef CONFIG_LOCKDEP
57# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
58# define disable_irq_nosync_lockdep_irqsave(irq, flags) \
59 disable_irq_nosync(irq)
60# define disable_irq_lockdep(irq) disable_irq(irq)
61# define enable_irq_lockdep(irq) enable_irq(irq)
62# define enable_irq_lockdep_irqrestore(irq, flags) \
63 enable_irq(irq)
64#endif
65
54#endif /* _ASM_IRQ_H */ 66#endif /* _ASM_IRQ_H */
diff --git a/arch/s390/include/asm/isc.h b/arch/s390/include/asm/isc.h
index 5ae606456b0..68d7d68300f 100644
--- a/arch/s390/include/asm/isc.h
+++ b/arch/s390/include/asm/isc.h
@@ -18,6 +18,7 @@
18#define CHSC_SCH_ISC 7 /* CHSC subchannels */ 18#define CHSC_SCH_ISC 7 /* CHSC subchannels */
19/* Adapter interrupts. */ 19/* Adapter interrupts. */
20#define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */ 20#define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */
21#define PCI_ISC 2 /* PCI I/O subchannels */
21#define AP_ISC 6 /* adjunct processor (crypto) devices */ 22#define AP_ISC 6 /* adjunct processor (crypto) devices */
22 23
23/* Functions for registration of I/O interruption subclasses */ 24/* Functions for registration of I/O interruption subclasses */
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 6d5367060a5..a86ad408407 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -30,6 +30,8 @@
30#include <asm/setup.h> 30#include <asm/setup.h>
31#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
32 32
33void storage_key_init_range(unsigned long start, unsigned long end);
34
33static unsigned long pfmf(unsigned long function, unsigned long address) 35static unsigned long pfmf(unsigned long function, unsigned long address)
34{ 36{
35 asm volatile( 37 asm volatile(
@@ -158,6 +160,9 @@ static inline int page_reset_referenced(unsigned long addr)
158 * race against modification of the referenced bit. This function 160 * race against modification of the referenced bit. This function
159 * should therefore only be called if it is not mapped in any 161 * should therefore only be called if it is not mapped in any
160 * address space. 162 * address space.
163 *
164 * Note that the bit gets set whenever page content is changed. That means
165 * also when the page is modified by DMA or from inside the kernel.
161 */ 166 */
162#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 167#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
163static inline int page_test_and_clear_dirty(unsigned long pfn, int mapped) 168static inline int page_test_and_clear_dirty(unsigned long pfn, int mapped)
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 42a145c9ddd..a6175ad0c42 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -1,10 +1,158 @@
1#ifndef __ASM_S390_PCI_H 1#ifndef __ASM_S390_PCI_H
2#define __ASM_S390_PCI_H 2#define __ASM_S390_PCI_H
3 3
4/* S/390 systems don't have a PCI bus. This file is just here because some stupid .c code 4/* must be set before including asm-generic/pci.h */
5 * includes it even if CONFIG_PCI is not set.
6 */
7#define PCI_DMA_BUS_IS_PHYS (0) 5#define PCI_DMA_BUS_IS_PHYS (0)
6/* must be set before including pci_clp.h */
7#define PCI_BAR_COUNT 6
8 8
9#endif /* __ASM_S390_PCI_H */ 9#include <asm-generic/pci.h>
10#include <asm-generic/pci-dma-compat.h>
11#include <asm/pci_clp.h>
10 12
13#define PCIBIOS_MIN_IO 0x1000
14#define PCIBIOS_MIN_MEM 0x10000000
15
16#define pcibios_assign_all_busses() (0)
17
18void __iomem *pci_iomap(struct pci_dev *, int, unsigned long);
19void pci_iounmap(struct pci_dev *, void __iomem *);
20int pci_domain_nr(struct pci_bus *);
21int pci_proc_domain(struct pci_bus *);
22
23/* MSI arch hooks */
24#define arch_setup_msi_irqs arch_setup_msi_irqs
25#define arch_teardown_msi_irqs arch_teardown_msi_irqs
26
27#define ZPCI_BUS_NR 0 /* default bus number */
28#define ZPCI_DEVFN 0 /* default device number */
29
30/* PCI Function Controls */
31#define ZPCI_FC_FN_ENABLED 0x80
32#define ZPCI_FC_ERROR 0x40
33#define ZPCI_FC_BLOCKED 0x20
34#define ZPCI_FC_DMA_ENABLED 0x10
35
36struct msi_map {
37 unsigned long irq;
38 struct msi_desc *msi;
39 struct hlist_node msi_chain;
40};
41
42#define ZPCI_NR_MSI_VECS 64
43#define ZPCI_MSI_MASK (ZPCI_NR_MSI_VECS - 1)
44
45enum zpci_state {
46 ZPCI_FN_STATE_RESERVED,
47 ZPCI_FN_STATE_STANDBY,
48 ZPCI_FN_STATE_CONFIGURED,
49 ZPCI_FN_STATE_ONLINE,
50 NR_ZPCI_FN_STATES,
51};
52
53struct zpci_bar_struct {
54 u32 val; /* bar start & 3 flag bits */
55 u8 size; /* order 2 exponent */
56 u16 map_idx; /* index into bar mapping array */
57};
58
59/* Private data per function */
60struct zpci_dev {
61 struct pci_dev *pdev;
62 struct pci_bus *bus;
63 struct list_head entry; /* list of all zpci_devices, needed for hotplug, etc. */
64
65 enum zpci_state state;
66 u32 fid; /* function ID, used by sclp */
67 u32 fh; /* function handle, used by insn's */
68 u16 pchid; /* physical channel ID */
69 u8 pfgid; /* function group ID */
70 u16 domain;
71
72 /* IRQ stuff */
73 u64 msi_addr; /* MSI address */
74 struct zdev_irq_map *irq_map;
75 struct msi_map *msi_map[ZPCI_NR_MSI_VECS];
76 unsigned int aisb; /* number of the summary bit */
77
78 /* DMA stuff */
79 unsigned long *dma_table;
80 spinlock_t dma_table_lock;
81 int tlb_refresh;
82
83 spinlock_t iommu_bitmap_lock;
84 unsigned long *iommu_bitmap;
85 unsigned long iommu_size;
86 unsigned long iommu_pages;
87 unsigned int next_bit;
88
89 struct zpci_bar_struct bars[PCI_BAR_COUNT];
90
91 u64 start_dma; /* Start of available DMA addresses */
92 u64 end_dma; /* End of available DMA addresses */
93 u64 dma_mask; /* DMA address space mask */
94
95 enum pci_bus_speed max_bus_speed;
96};
97
98struct pci_hp_callback_ops {
99 int (*create_slot) (struct zpci_dev *zdev);
100 void (*remove_slot) (struct zpci_dev *zdev);
101};
102
103static inline bool zdev_enabled(struct zpci_dev *zdev)
104{
105 return (zdev->fh & (1UL << 31)) ? true : false;
106}
107
108/* -----------------------------------------------------------------------------
109 Prototypes
110----------------------------------------------------------------------------- */
111/* Base stuff */
112struct zpci_dev *zpci_alloc_device(void);
113int zpci_create_device(struct zpci_dev *);
114int zpci_enable_device(struct zpci_dev *);
115void zpci_stop_device(struct zpci_dev *);
116void zpci_free_device(struct zpci_dev *);
117int zpci_scan_device(struct zpci_dev *);
118int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64);
119int zpci_unregister_ioat(struct zpci_dev *, u8);
120
121/* CLP */
122int clp_find_pci_devices(void);
123int clp_add_pci_device(u32, u32, int);
124int clp_enable_fh(struct zpci_dev *, u8);
125int clp_disable_fh(struct zpci_dev *);
126
127/* MSI */
128struct msi_desc *__irq_get_msi_desc(unsigned int);
129int zpci_msi_set_mask_bits(struct msi_desc *, u32, u32);
130int zpci_setup_msi_irq(struct zpci_dev *, struct msi_desc *, unsigned int, int);
131void zpci_teardown_msi_irq(struct zpci_dev *, struct msi_desc *);
132int zpci_msihash_init(void);
133void zpci_msihash_exit(void);
134
135/* Error handling and recovery */
136void zpci_event_error(void *);
137void zpci_event_availability(void *);
138
139/* Helpers */
140struct zpci_dev *get_zdev(struct pci_dev *);
141struct zpci_dev *get_zdev_by_fid(u32);
142bool zpci_fid_present(u32);
143
144/* sysfs */
145int zpci_sysfs_add_device(struct device *);
146void zpci_sysfs_remove_device(struct device *);
147
148/* DMA */
149int zpci_dma_init(void);
150void zpci_dma_exit(void);
151
152/* Hotplug */
153extern struct mutex zpci_list_lock;
154extern struct list_head zpci_list;
155extern struct pci_hp_callback_ops hotplug_ops;
156extern unsigned int pci_probe;
157
158#endif
diff --git a/arch/s390/include/asm/pci_clp.h b/arch/s390/include/asm/pci_clp.h
new file mode 100644
index 00000000000..d31d739f868
--- /dev/null
+++ b/arch/s390/include/asm/pci_clp.h
@@ -0,0 +1,182 @@
1#ifndef _ASM_S390_PCI_CLP_H
2#define _ASM_S390_PCI_CLP_H
3
4#include <asm/clp.h>
5
6/*
7 * Call Logical Processor - Command Codes
8 */
9#define CLP_LIST_PCI 0x0002
10#define CLP_QUERY_PCI_FN 0x0003
11#define CLP_QUERY_PCI_FNGRP 0x0004
12#define CLP_SET_PCI_FN 0x0005
13
14/* PCI function handle list entry */
15struct clp_fh_list_entry {
16 u16 device_id;
17 u16 vendor_id;
18 u32 config_state : 1;
19 u32 : 31;
20 u32 fid; /* PCI function id */
21 u32 fh; /* PCI function handle */
22} __packed;
23
24#define CLP_RC_SETPCIFN_FH 0x0101 /* Invalid PCI fn handle */
25#define CLP_RC_SETPCIFN_FHOP 0x0102 /* Fn handle not valid for op */
26#define CLP_RC_SETPCIFN_DMAAS 0x0103 /* Invalid DMA addr space */
27#define CLP_RC_SETPCIFN_RES 0x0104 /* Insufficient resources */
28#define CLP_RC_SETPCIFN_ALRDY 0x0105 /* Fn already in requested state */
29#define CLP_RC_SETPCIFN_ERR 0x0106 /* Fn in permanent error state */
30#define CLP_RC_SETPCIFN_RECPND 0x0107 /* Error recovery pending */
31#define CLP_RC_SETPCIFN_BUSY 0x0108 /* Fn busy */
32#define CLP_RC_LISTPCI_BADRT 0x010a /* Resume token not recognized */
33#define CLP_RC_QUERYPCIFG_PFGID 0x010b /* Unrecognized PFGID */
34
35/* request or response block header length */
36#define LIST_PCI_HDR_LEN 32
37
38/* Number of function handles fitting in response block */
39#define CLP_FH_LIST_NR_ENTRIES \
40 ((CLP_BLK_SIZE - 2 * LIST_PCI_HDR_LEN) \
41 / sizeof(struct clp_fh_list_entry))
42
43#define CLP_SET_ENABLE_PCI_FN 0 /* Yes, 0 enables it */
44#define CLP_SET_DISABLE_PCI_FN 1 /* Yes, 1 disables it */
45
46#define CLP_UTIL_STR_LEN 64
47
48/* List PCI functions request */
49struct clp_req_list_pci {
50 struct clp_req_hdr hdr;
51 u32 fmt : 4; /* cmd request block format */
52 u32 : 28;
53 u64 reserved1;
54 u64 resume_token;
55 u64 reserved2;
56} __packed;
57
58/* List PCI functions response */
59struct clp_rsp_list_pci {
60 struct clp_rsp_hdr hdr;
61 u32 fmt : 4; /* cmd request block format */
62 u32 : 28;
63 u64 reserved1;
64 u64 resume_token;
65 u32 reserved2;
66 u16 max_fn;
67 u8 reserved3;
68 u8 entry_size;
69 struct clp_fh_list_entry fh_list[CLP_FH_LIST_NR_ENTRIES];
70} __packed;
71
72/* Query PCI function request */
73struct clp_req_query_pci {
74 struct clp_req_hdr hdr;
75 u32 fmt : 4; /* cmd request block format */
76 u32 : 28;
77 u64 reserved1;
78 u32 fh; /* function handle */
79 u32 reserved2;
80 u64 reserved3;
81} __packed;
82
83/* Query PCI function response */
84struct clp_rsp_query_pci {
85 struct clp_rsp_hdr hdr;
86 u32 fmt : 4; /* cmd request block format */
87 u32 : 28;
88 u64 reserved1;
89 u16 vfn; /* virtual fn number */
90 u16 : 7;
91 u16 util_str_avail : 1; /* utility string available? */
92 u16 pfgid : 8; /* pci function group id */
93 u32 fid; /* pci function id */
94 u8 bar_size[PCI_BAR_COUNT];
95 u16 pchid;
96 u32 bar[PCI_BAR_COUNT];
97 u64 reserved2;
98 u64 sdma; /* start dma as */
99 u64 edma; /* end dma as */
100 u64 reserved3[6];
101 u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */
102} __packed;
103
104/* Query PCI function group request */
105struct clp_req_query_pci_grp {
106 struct clp_req_hdr hdr;
107 u32 fmt : 4; /* cmd request block format */
108 u32 : 28;
109 u64 reserved1;
110 u32 : 24;
111 u32 pfgid : 8; /* function group id */
112 u32 reserved2;
113 u64 reserved3;
114} __packed;
115
116/* Query PCI function group response */
117struct clp_rsp_query_pci_grp {
118 struct clp_rsp_hdr hdr;
119 u32 fmt : 4; /* cmd request block format */
120 u32 : 28;
121 u64 reserved1;
122 u16 : 4;
123 u16 noi : 12; /* number of interrupts */
124 u8 version;
125 u8 : 6;
126 u8 frame : 1;
127 u8 refresh : 1; /* TLB refresh mode */
128 u16 reserved2;
129 u16 mui;
130 u64 reserved3;
131 u64 dasm; /* dma address space mask */
132 u64 msia; /* MSI address */
133 u64 reserved4;
134 u64 reserved5;
135} __packed;
136
137/* Set PCI function request */
138struct clp_req_set_pci {
139 struct clp_req_hdr hdr;
140 u32 fmt : 4; /* cmd request block format */
141 u32 : 28;
142 u64 reserved1;
143 u32 fh; /* function handle */
144 u16 reserved2;
145 u8 oc; /* operation controls */
146 u8 ndas; /* number of dma spaces */
147 u64 reserved3;
148} __packed;
149
150/* Set PCI function response */
151struct clp_rsp_set_pci {
152 struct clp_rsp_hdr hdr;
153 u32 fmt : 4; /* cmd request block format */
154 u32 : 28;
155 u64 reserved1;
156 u32 fh; /* function handle */
157 u32 reserved3;
158 u64 reserved4;
159} __packed;
160
161/* Combined request/response block structures used by clp insn */
162struct clp_req_rsp_list_pci {
163 struct clp_req_list_pci request;
164 struct clp_rsp_list_pci response;
165} __packed;
166
167struct clp_req_rsp_set_pci {
168 struct clp_req_set_pci request;
169 struct clp_rsp_set_pci response;
170} __packed;
171
172struct clp_req_rsp_query_pci {
173 struct clp_req_query_pci request;
174 struct clp_rsp_query_pci response;
175} __packed;
176
177struct clp_req_rsp_query_pci_grp {
178 struct clp_req_query_pci_grp request;
179 struct clp_rsp_query_pci_grp response;
180} __packed;
181
182#endif
diff --git a/arch/s390/include/asm/pci_dma.h b/arch/s390/include/asm/pci_dma.h
new file mode 100644
index 00000000000..30b4c179c38
--- /dev/null
+++ b/arch/s390/include/asm/pci_dma.h
@@ -0,0 +1,196 @@
1#ifndef _ASM_S390_PCI_DMA_H
2#define _ASM_S390_PCI_DMA_H
3
4/* I/O Translation Anchor (IOTA) */
5enum zpci_ioat_dtype {
6 ZPCI_IOTA_STO = 0,
7 ZPCI_IOTA_RTTO = 1,
8 ZPCI_IOTA_RSTO = 2,
9 ZPCI_IOTA_RFTO = 3,
10 ZPCI_IOTA_PFAA = 4,
11 ZPCI_IOTA_IOPFAA = 5,
12 ZPCI_IOTA_IOPTO = 7
13};
14
15#define ZPCI_IOTA_IOT_ENABLED 0x800UL
16#define ZPCI_IOTA_DT_ST (ZPCI_IOTA_STO << 2)
17#define ZPCI_IOTA_DT_RT (ZPCI_IOTA_RTTO << 2)
18#define ZPCI_IOTA_DT_RS (ZPCI_IOTA_RSTO << 2)
19#define ZPCI_IOTA_DT_RF (ZPCI_IOTA_RFTO << 2)
20#define ZPCI_IOTA_DT_PF (ZPCI_IOTA_PFAA << 2)
21#define ZPCI_IOTA_FS_4K 0
22#define ZPCI_IOTA_FS_1M 1
23#define ZPCI_IOTA_FS_2G 2
24#define ZPCI_KEY (PAGE_DEFAULT_KEY << 5)
25
26#define ZPCI_IOTA_STO_FLAG (ZPCI_IOTA_IOT_ENABLED | ZPCI_KEY | ZPCI_IOTA_DT_ST)
27#define ZPCI_IOTA_RTTO_FLAG (ZPCI_IOTA_IOT_ENABLED | ZPCI_KEY | ZPCI_IOTA_DT_RT)
28#define ZPCI_IOTA_RSTO_FLAG (ZPCI_IOTA_IOT_ENABLED | ZPCI_KEY | ZPCI_IOTA_DT_RS)
29#define ZPCI_IOTA_RFTO_FLAG (ZPCI_IOTA_IOT_ENABLED | ZPCI_KEY | ZPCI_IOTA_DT_RF)
30#define ZPCI_IOTA_RFAA_FLAG (ZPCI_IOTA_IOT_ENABLED | ZPCI_KEY | ZPCI_IOTA_DT_PF | ZPCI_IOTA_FS_2G)
31
32/* I/O Region and segment tables */
33#define ZPCI_INDEX_MASK 0x7ffUL
34
35#define ZPCI_TABLE_TYPE_MASK 0xc
36#define ZPCI_TABLE_TYPE_RFX 0xc
37#define ZPCI_TABLE_TYPE_RSX 0x8
38#define ZPCI_TABLE_TYPE_RTX 0x4
39#define ZPCI_TABLE_TYPE_SX 0x0
40
41#define ZPCI_TABLE_LEN_RFX 0x3
42#define ZPCI_TABLE_LEN_RSX 0x3
43#define ZPCI_TABLE_LEN_RTX 0x3
44
45#define ZPCI_TABLE_OFFSET_MASK 0xc0
46#define ZPCI_TABLE_SIZE 0x4000
47#define ZPCI_TABLE_ALIGN ZPCI_TABLE_SIZE
48#define ZPCI_TABLE_ENTRY_SIZE (sizeof(unsigned long))
49#define ZPCI_TABLE_ENTRIES (ZPCI_TABLE_SIZE / ZPCI_TABLE_ENTRY_SIZE)
50
51#define ZPCI_TABLE_BITS 11
52#define ZPCI_PT_BITS 8
53#define ZPCI_ST_SHIFT (ZPCI_PT_BITS + PAGE_SHIFT)
54#define ZPCI_RT_SHIFT (ZPCI_ST_SHIFT + ZPCI_TABLE_BITS)
55
56#define ZPCI_RTE_FLAG_MASK 0x3fffUL
57#define ZPCI_RTE_ADDR_MASK (~ZPCI_RTE_FLAG_MASK)
58#define ZPCI_STE_FLAG_MASK 0x7ffUL
59#define ZPCI_STE_ADDR_MASK (~ZPCI_STE_FLAG_MASK)
60
61/* I/O Page tables */
62#define ZPCI_PTE_VALID_MASK 0x400
63#define ZPCI_PTE_INVALID 0x400
64#define ZPCI_PTE_VALID 0x000
65#define ZPCI_PT_SIZE 0x800
66#define ZPCI_PT_ALIGN ZPCI_PT_SIZE
67#define ZPCI_PT_ENTRIES (ZPCI_PT_SIZE / ZPCI_TABLE_ENTRY_SIZE)
68#define ZPCI_PT_MASK (ZPCI_PT_ENTRIES - 1)
69
70#define ZPCI_PTE_FLAG_MASK 0xfffUL
71#define ZPCI_PTE_ADDR_MASK (~ZPCI_PTE_FLAG_MASK)
72
73/* Shared bits */
74#define ZPCI_TABLE_VALID 0x00
75#define ZPCI_TABLE_INVALID 0x20
76#define ZPCI_TABLE_PROTECTED 0x200
77#define ZPCI_TABLE_UNPROTECTED 0x000
78
79#define ZPCI_TABLE_VALID_MASK 0x20
80#define ZPCI_TABLE_PROT_MASK 0x200
81
82static inline unsigned int calc_rtx(dma_addr_t ptr)
83{
84 return ((unsigned long) ptr >> ZPCI_RT_SHIFT) & ZPCI_INDEX_MASK;
85}
86
87static inline unsigned int calc_sx(dma_addr_t ptr)
88{
89 return ((unsigned long) ptr >> ZPCI_ST_SHIFT) & ZPCI_INDEX_MASK;
90}
91
92static inline unsigned int calc_px(dma_addr_t ptr)
93{
94 return ((unsigned long) ptr >> PAGE_SHIFT) & ZPCI_PT_MASK;
95}
96
97static inline void set_pt_pfaa(unsigned long *entry, void *pfaa)
98{
99 *entry &= ZPCI_PTE_FLAG_MASK;
100 *entry |= ((unsigned long) pfaa & ZPCI_PTE_ADDR_MASK);
101}
102
103static inline void set_rt_sto(unsigned long *entry, void *sto)
104{
105 *entry &= ZPCI_RTE_FLAG_MASK;
106 *entry |= ((unsigned long) sto & ZPCI_RTE_ADDR_MASK);
107 *entry |= ZPCI_TABLE_TYPE_RTX;
108}
109
110static inline void set_st_pto(unsigned long *entry, void *pto)
111{
112 *entry &= ZPCI_STE_FLAG_MASK;
113 *entry |= ((unsigned long) pto & ZPCI_STE_ADDR_MASK);
114 *entry |= ZPCI_TABLE_TYPE_SX;
115}
116
117static inline void validate_rt_entry(unsigned long *entry)
118{
119 *entry &= ~ZPCI_TABLE_VALID_MASK;
120 *entry &= ~ZPCI_TABLE_OFFSET_MASK;
121 *entry |= ZPCI_TABLE_VALID;
122 *entry |= ZPCI_TABLE_LEN_RTX;
123}
124
125static inline void validate_st_entry(unsigned long *entry)
126{
127 *entry &= ~ZPCI_TABLE_VALID_MASK;
128 *entry |= ZPCI_TABLE_VALID;
129}
130
131static inline void invalidate_table_entry(unsigned long *entry)
132{
133 *entry &= ~ZPCI_TABLE_VALID_MASK;
134 *entry |= ZPCI_TABLE_INVALID;
135}
136
137static inline void invalidate_pt_entry(unsigned long *entry)
138{
139 WARN_ON_ONCE((*entry & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_INVALID);
140 *entry &= ~ZPCI_PTE_VALID_MASK;
141 *entry |= ZPCI_PTE_INVALID;
142}
143
144static inline void validate_pt_entry(unsigned long *entry)
145{
146 WARN_ON_ONCE((*entry & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID);
147 *entry &= ~ZPCI_PTE_VALID_MASK;
148 *entry |= ZPCI_PTE_VALID;
149}
150
151static inline void entry_set_protected(unsigned long *entry)
152{
153 *entry &= ~ZPCI_TABLE_PROT_MASK;
154 *entry |= ZPCI_TABLE_PROTECTED;
155}
156
157static inline void entry_clr_protected(unsigned long *entry)
158{
159 *entry &= ~ZPCI_TABLE_PROT_MASK;
160 *entry |= ZPCI_TABLE_UNPROTECTED;
161}
162
163static inline int reg_entry_isvalid(unsigned long entry)
164{
165 return (entry & ZPCI_TABLE_VALID_MASK) == ZPCI_TABLE_VALID;
166}
167
168static inline int pt_entry_isvalid(unsigned long entry)
169{
170 return (entry & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID;
171}
172
173static inline int entry_isprotected(unsigned long entry)
174{
175 return (entry & ZPCI_TABLE_PROT_MASK) == ZPCI_TABLE_PROTECTED;
176}
177
178static inline unsigned long *get_rt_sto(unsigned long entry)
179{
180 return ((entry & ZPCI_TABLE_TYPE_MASK) == ZPCI_TABLE_TYPE_RTX)
181 ? (unsigned long *) (entry & ZPCI_RTE_ADDR_MASK)
182 : NULL;
183}
184
185static inline unsigned long *get_st_pto(unsigned long entry)
186{
187 return ((entry & ZPCI_TABLE_TYPE_MASK) == ZPCI_TABLE_TYPE_SX)
188 ? (unsigned long *) (entry & ZPCI_STE_ADDR_MASK)
189 : NULL;
190}
191
192/* Prototypes */
193int zpci_dma_init_device(struct zpci_dev *);
194void zpci_dma_exit_device(struct zpci_dev *);
195
196#endif
diff --git a/arch/s390/include/asm/pci_insn.h b/arch/s390/include/asm/pci_insn.h
new file mode 100644
index 00000000000..1486a98d5da
--- /dev/null
+++ b/arch/s390/include/asm/pci_insn.h
@@ -0,0 +1,280 @@
1#ifndef _ASM_S390_PCI_INSN_H
2#define _ASM_S390_PCI_INSN_H
3
4#include <linux/delay.h>
5
6#define ZPCI_INSN_BUSY_DELAY 1 /* 1 microsecond */
7
8/* Load/Store status codes */
9#define ZPCI_PCI_ST_FUNC_NOT_ENABLED 4
10#define ZPCI_PCI_ST_FUNC_IN_ERR 8
11#define ZPCI_PCI_ST_BLOCKED 12
12#define ZPCI_PCI_ST_INSUF_RES 16
13#define ZPCI_PCI_ST_INVAL_AS 20
14#define ZPCI_PCI_ST_FUNC_ALREADY_ENABLED 24
15#define ZPCI_PCI_ST_DMA_AS_NOT_ENABLED 28
16#define ZPCI_PCI_ST_2ND_OP_IN_INV_AS 36
17#define ZPCI_PCI_ST_FUNC_NOT_AVAIL 40
18#define ZPCI_PCI_ST_ALREADY_IN_RQ_STATE 44
19
20/* Load/Store return codes */
21#define ZPCI_PCI_LS_OK 0
22#define ZPCI_PCI_LS_ERR 1
23#define ZPCI_PCI_LS_BUSY 2
24#define ZPCI_PCI_LS_INVAL_HANDLE 3
25
26/* Load/Store address space identifiers */
27#define ZPCI_PCIAS_MEMIO_0 0
28#define ZPCI_PCIAS_MEMIO_1 1
29#define ZPCI_PCIAS_MEMIO_2 2
30#define ZPCI_PCIAS_MEMIO_3 3
31#define ZPCI_PCIAS_MEMIO_4 4
32#define ZPCI_PCIAS_MEMIO_5 5
33#define ZPCI_PCIAS_CFGSPC 15
34
35/* Modify PCI Function Controls */
36#define ZPCI_MOD_FC_REG_INT 2
37#define ZPCI_MOD_FC_DEREG_INT 3
38#define ZPCI_MOD_FC_REG_IOAT 4
39#define ZPCI_MOD_FC_DEREG_IOAT 5
40#define ZPCI_MOD_FC_REREG_IOAT 6
41#define ZPCI_MOD_FC_RESET_ERROR 7
42#define ZPCI_MOD_FC_RESET_BLOCK 9
43#define ZPCI_MOD_FC_SET_MEASURE 10
44
45/* FIB function controls */
46#define ZPCI_FIB_FC_ENABLED 0x80
47#define ZPCI_FIB_FC_ERROR 0x40
48#define ZPCI_FIB_FC_LS_BLOCKED 0x20
49#define ZPCI_FIB_FC_DMAAS_REG 0x10
50
51/* FIB function controls */
52#define ZPCI_FIB_FC_ENABLED 0x80
53#define ZPCI_FIB_FC_ERROR 0x40
54#define ZPCI_FIB_FC_LS_BLOCKED 0x20
55#define ZPCI_FIB_FC_DMAAS_REG 0x10
56
57/* Function Information Block */
58struct zpci_fib {
59 u32 fmt : 8; /* format */
60 u32 : 24;
61 u32 reserved1;
62 u8 fc; /* function controls */
63 u8 reserved2;
64 u16 reserved3;
65 u32 reserved4;
66 u64 pba; /* PCI base address */
67 u64 pal; /* PCI address limit */
68 u64 iota; /* I/O Translation Anchor */
69 u32 : 1;
70 u32 isc : 3; /* Interrupt subclass */
71 u32 noi : 12; /* Number of interrupts */
72 u32 : 2;
73 u32 aibvo : 6; /* Adapter interrupt bit vector offset */
74 u32 sum : 1; /* Adapter int summary bit enabled */
75 u32 : 1;
76 u32 aisbo : 6; /* Adapter int summary bit offset */
77 u32 reserved5;
78 u64 aibv; /* Adapter int bit vector address */
79 u64 aisb; /* Adapter int summary bit address */
80 u64 fmb_addr; /* Function measurement block address and key */
81 u64 reserved6;
82 u64 reserved7;
83} __packed;
84
85/* Modify PCI Function Controls */
86static inline u8 __mpcifc(u64 req, struct zpci_fib *fib, u8 *status)
87{
88 u8 cc;
89
90 asm volatile (
91 " .insn rxy,0xe300000000d0,%[req],%[fib]\n"
92 " ipm %[cc]\n"
93 " srl %[cc],28\n"
94 : [cc] "=d" (cc), [req] "+d" (req), [fib] "+Q" (*fib)
95 : : "cc");
96 *status = req >> 24 & 0xff;
97 return cc;
98}
99
100static inline int mpcifc_instr(u64 req, struct zpci_fib *fib)
101{
102 u8 cc, status;
103
104 do {
105 cc = __mpcifc(req, fib, &status);
106 if (cc == 2)
107 msleep(ZPCI_INSN_BUSY_DELAY);
108 } while (cc == 2);
109
110 if (cc)
111 printk_once(KERN_ERR "%s: error cc: %d status: %d\n",
112 __func__, cc, status);
113 return (cc) ? -EIO : 0;
114}
115
116/* Refresh PCI Translations */
117static inline u8 __rpcit(u64 fn, u64 addr, u64 range, u8 *status)
118{
119 register u64 __addr asm("2") = addr;
120 register u64 __range asm("3") = range;
121 u8 cc;
122
123 asm volatile (
124 " .insn rre,0xb9d30000,%[fn],%[addr]\n"
125 " ipm %[cc]\n"
126 " srl %[cc],28\n"
127 : [cc] "=d" (cc), [fn] "+d" (fn)
128 : [addr] "d" (__addr), "d" (__range)
129 : "cc");
130 *status = fn >> 24 & 0xff;
131 return cc;
132}
133
134static inline int rpcit_instr(u64 fn, u64 addr, u64 range)
135{
136 u8 cc, status;
137
138 do {
139 cc = __rpcit(fn, addr, range, &status);
140 if (cc == 2)
141 udelay(ZPCI_INSN_BUSY_DELAY);
142 } while (cc == 2);
143
144 if (cc)
145 printk_once(KERN_ERR "%s: error cc: %d status: %d dma_addr: %Lx size: %Lx\n",
146 __func__, cc, status, addr, range);
147 return (cc) ? -EIO : 0;
148}
149
150/* Store PCI function controls */
151static inline u8 __stpcifc(u32 handle, u8 space, struct zpci_fib *fib, u8 *status)
152{
153 u64 fn = (u64) handle << 32 | space << 16;
154 u8 cc;
155
156 asm volatile (
157 " .insn rxy,0xe300000000d4,%[fn],%[fib]\n"
158 " ipm %[cc]\n"
159 " srl %[cc],28\n"
160 : [cc] "=d" (cc), [fn] "+d" (fn), [fib] "=m" (*fib)
161 : : "cc");
162 *status = fn >> 24 & 0xff;
163 return cc;
164}
165
166/* Set Interruption Controls */
167static inline void sic_instr(u16 ctl, char *unused, u8 isc)
168{
169 asm volatile (
170 " .insn rsy,0xeb00000000d1,%[ctl],%[isc],%[u]\n"
171 : : [ctl] "d" (ctl), [isc] "d" (isc << 27), [u] "Q" (*unused));
172}
173
174/* PCI Load */
175static inline u8 __pcilg(u64 *data, u64 req, u64 offset, u8 *status)
176{
177 register u64 __req asm("2") = req;
178 register u64 __offset asm("3") = offset;
179 u64 __data;
180 u8 cc;
181
182 asm volatile (
183 " .insn rre,0xb9d20000,%[data],%[req]\n"
184 " ipm %[cc]\n"
185 " srl %[cc],28\n"
186 : [cc] "=d" (cc), [data] "=d" (__data), [req] "+d" (__req)
187 : "d" (__offset)
188 : "cc");
189 *status = __req >> 24 & 0xff;
190 *data = __data;
191 return cc;
192}
193
194static inline int pcilg_instr(u64 *data, u64 req, u64 offset)
195{
196 u8 cc, status;
197
198 do {
199 cc = __pcilg(data, req, offset, &status);
200 if (cc == 2)
201 udelay(ZPCI_INSN_BUSY_DELAY);
202 } while (cc == 2);
203
204 if (cc) {
205 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
206 __func__, cc, status, req, offset);
207 /* TODO: on IO errors set data to 0xff...
208 * here or in users of pcilg (le conversion)?
209 */
210 }
211 return (cc) ? -EIO : 0;
212}
213
214/* PCI Store */
215static inline u8 __pcistg(u64 data, u64 req, u64 offset, u8 *status)
216{
217 register u64 __req asm("2") = req;
218 register u64 __offset asm("3") = offset;
219 u8 cc;
220
221 asm volatile (
222 " .insn rre,0xb9d00000,%[data],%[req]\n"
223 " ipm %[cc]\n"
224 " srl %[cc],28\n"
225 : [cc] "=d" (cc), [req] "+d" (__req)
226 : "d" (__offset), [data] "d" (data)
227 : "cc");
228 *status = __req >> 24 & 0xff;
229 return cc;
230}
231
232static inline int pcistg_instr(u64 data, u64 req, u64 offset)
233{
234 u8 cc, status;
235
236 do {
237 cc = __pcistg(data, req, offset, &status);
238 if (cc == 2)
239 udelay(ZPCI_INSN_BUSY_DELAY);
240 } while (cc == 2);
241
242 if (cc)
243 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
244 __func__, cc, status, req, offset);
245 return (cc) ? -EIO : 0;
246}
247
248/* PCI Store Block */
249static inline u8 __pcistb(const u64 *data, u64 req, u64 offset, u8 *status)
250{
251 u8 cc;
252
253 asm volatile (
254 " .insn rsy,0xeb00000000d0,%[req],%[offset],%[data]\n"
255 " ipm %[cc]\n"
256 " srl %[cc],28\n"
257 : [cc] "=d" (cc), [req] "+d" (req)
258 : [offset] "d" (offset), [data] "Q" (*data)
259 : "cc");
260 *status = req >> 24 & 0xff;
261 return cc;
262}
263
264static inline int pcistb_instr(const u64 *data, u64 req, u64 offset)
265{
266 u8 cc, status;
267
268 do {
269 cc = __pcistb(data, req, offset, &status);
270 if (cc == 2)
271 udelay(ZPCI_INSN_BUSY_DELAY);
272 } while (cc == 2);
273
274 if (cc)
275 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
276 __func__, cc, status, req, offset);
277 return (cc) ? -EIO : 0;
278}
279
280#endif
diff --git a/arch/s390/include/asm/pci_io.h b/arch/s390/include/asm/pci_io.h
new file mode 100644
index 00000000000..5fd81f31d6c
--- /dev/null
+++ b/arch/s390/include/asm/pci_io.h
@@ -0,0 +1,194 @@
1#ifndef _ASM_S390_PCI_IO_H
2#define _ASM_S390_PCI_IO_H
3
4#ifdef CONFIG_PCI
5
6#include <linux/kernel.h>
7#include <linux/slab.h>
8#include <asm/pci_insn.h>
9
10/* I/O Map */
11#define ZPCI_IOMAP_MAX_ENTRIES 0x7fff
12#define ZPCI_IOMAP_ADDR_BASE 0x8000000000000000ULL
13#define ZPCI_IOMAP_ADDR_IDX_MASK 0x7fff000000000000ULL
14#define ZPCI_IOMAP_ADDR_OFF_MASK 0x0000ffffffffffffULL
15
16struct zpci_iomap_entry {
17 u32 fh;
18 u8 bar;
19};
20
21extern struct zpci_iomap_entry *zpci_iomap_start;
22
23#define ZPCI_IDX(addr) \
24 (((__force u64) addr & ZPCI_IOMAP_ADDR_IDX_MASK) >> 48)
25#define ZPCI_OFFSET(addr) \
26 ((__force u64) addr & ZPCI_IOMAP_ADDR_OFF_MASK)
27
28#define ZPCI_CREATE_REQ(handle, space, len) \
29 ((u64) handle << 32 | space << 16 | len)
30
31#define zpci_read(LENGTH, RETTYPE) \
32static inline RETTYPE zpci_read_##RETTYPE(const volatile void __iomem *addr) \
33{ \
34 struct zpci_iomap_entry *entry = &zpci_iomap_start[ZPCI_IDX(addr)]; \
35 u64 req = ZPCI_CREATE_REQ(entry->fh, entry->bar, LENGTH); \
36 u64 data; \
37 int rc; \
38 \
39 rc = pcilg_instr(&data, req, ZPCI_OFFSET(addr)); \
40 if (rc) \
41 data = -1ULL; \
42 return (RETTYPE) data; \
43}
44
45#define zpci_write(LENGTH, VALTYPE) \
46static inline void zpci_write_##VALTYPE(VALTYPE val, \
47 const volatile void __iomem *addr) \
48{ \
49 struct zpci_iomap_entry *entry = &zpci_iomap_start[ZPCI_IDX(addr)]; \
50 u64 req = ZPCI_CREATE_REQ(entry->fh, entry->bar, LENGTH); \
51 u64 data = (VALTYPE) val; \
52 \
53 pcistg_instr(data, req, ZPCI_OFFSET(addr)); \
54}
55
56zpci_read(8, u64)
57zpci_read(4, u32)
58zpci_read(2, u16)
59zpci_read(1, u8)
60zpci_write(8, u64)
61zpci_write(4, u32)
62zpci_write(2, u16)
63zpci_write(1, u8)
64
65static inline int zpci_write_single(u64 req, const u64 *data, u64 offset, u8 len)
66{
67 u64 val;
68
69 switch (len) {
70 case 1:
71 val = (u64) *((u8 *) data);
72 break;
73 case 2:
74 val = (u64) *((u16 *) data);
75 break;
76 case 4:
77 val = (u64) *((u32 *) data);
78 break;
79 case 8:
80 val = (u64) *((u64 *) data);
81 break;
82 default:
83 val = 0; /* let FW report error */
84 break;
85 }
86 return pcistg_instr(val, req, offset);
87}
88
89static inline int zpci_read_single(u64 req, u64 *dst, u64 offset, u8 len)
90{
91 u64 data;
92 u8 cc;
93
94 cc = pcilg_instr(&data, req, offset);
95 switch (len) {
96 case 1:
97 *((u8 *) dst) = (u8) data;
98 break;
99 case 2:
100 *((u16 *) dst) = (u16) data;
101 break;
102 case 4:
103 *((u32 *) dst) = (u32) data;
104 break;
105 case 8:
106 *((u64 *) dst) = (u64) data;
107 break;
108 }
109 return cc;
110}
111
112static inline int zpci_write_block(u64 req, const u64 *data, u64 offset)
113{
114 return pcistb_instr(data, req, offset);
115}
116
117static inline u8 zpci_get_max_write_size(u64 src, u64 dst, int len, int max)
118{
119 int count = len > max ? max : len, size = 1;
120
121 while (!(src & 0x1) && !(dst & 0x1) && ((size << 1) <= count)) {
122 dst = dst >> 1;
123 src = src >> 1;
124 size = size << 1;
125 }
126 return size;
127}
128
129static inline int zpci_memcpy_fromio(void *dst,
130 const volatile void __iomem *src,
131 unsigned long n)
132{
133 struct zpci_iomap_entry *entry = &zpci_iomap_start[ZPCI_IDX(src)];
134 u64 req, offset = ZPCI_OFFSET(src);
135 int size, rc = 0;
136
137 while (n > 0) {
138 size = zpci_get_max_write_size((u64) src, (u64) dst, n, 8);
139 req = ZPCI_CREATE_REQ(entry->fh, entry->bar, size);
140 rc = zpci_read_single(req, dst, offset, size);
141 if (rc)
142 break;
143 offset += size;
144 dst += size;
145 n -= size;
146 }
147 return rc;
148}
149
150static inline int zpci_memcpy_toio(volatile void __iomem *dst,
151 const void *src, unsigned long n)
152{
153 struct zpci_iomap_entry *entry = &zpci_iomap_start[ZPCI_IDX(dst)];
154 u64 req, offset = ZPCI_OFFSET(dst);
155 int size, rc = 0;
156
157 if (!src)
158 return -EINVAL;
159
160 while (n > 0) {
161 size = zpci_get_max_write_size((u64) dst, (u64) src, n, 128);
162 req = ZPCI_CREATE_REQ(entry->fh, entry->bar, size);
163
164 if (size > 8) /* main path */
165 rc = zpci_write_block(req, src, offset);
166 else
167 rc = zpci_write_single(req, src, offset, size);
168 if (rc)
169 break;
170 offset += size;
171 src += size;
172 n -= size;
173 }
174 return rc;
175}
176
177static inline int zpci_memset_io(volatile void __iomem *dst,
178 unsigned char val, size_t count)
179{
180 u8 *src = kmalloc(count, GFP_KERNEL);
181 int rc;
182
183 if (src == NULL)
184 return -ENOMEM;
185 memset(src, val, count);
186
187 rc = zpci_memcpy_toio(dst, src, count);
188 kfree(src);
189 return rc;
190}
191
192#endif /* CONFIG_PCI */
193
194#endif /* _ASM_S390_PCI_IO_H */
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 2d3b7cb2600..c928dc1938f 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -35,7 +35,6 @@
35extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); 35extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096)));
36extern void paging_init(void); 36extern void paging_init(void);
37extern void vmem_map_init(void); 37extern void vmem_map_init(void);
38extern void fault_init(void);
39 38
40/* 39/*
41 * The S390 doesn't have any external MMU info: the kernel page 40 * The S390 doesn't have any external MMU info: the kernel page
@@ -55,16 +54,7 @@ extern unsigned long zero_page_mask;
55#define ZERO_PAGE(vaddr) \ 54#define ZERO_PAGE(vaddr) \
56 (virt_to_page((void *)(empty_zero_page + \ 55 (virt_to_page((void *)(empty_zero_page + \
57 (((unsigned long)(vaddr)) &zero_page_mask)))) 56 (((unsigned long)(vaddr)) &zero_page_mask))))
58 57#define __HAVE_COLOR_ZERO_PAGE
59#define is_zero_pfn is_zero_pfn
60static inline int is_zero_pfn(unsigned long pfn)
61{
62 extern unsigned long zero_pfn;
63 unsigned long offset_from_zero_pfn = pfn - zero_pfn;
64 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
65}
66
67#define my_zero_pfn(addr) page_to_pfn(ZERO_PAGE(addr))
68 58
69#endif /* !__ASSEMBLY__ */ 59#endif /* !__ASSEMBLY__ */
70 60
@@ -345,6 +335,8 @@ extern unsigned long MODULES_END;
345#define _REGION3_ENTRY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH) 335#define _REGION3_ENTRY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH)
346#define _REGION3_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INV) 336#define _REGION3_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INV)
347 337
338#define _REGION3_ENTRY_LARGE 0x400 /* RTTE-format control, large page */
339
348/* Bits in the segment table entry */ 340/* Bits in the segment table entry */
349#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */ 341#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
350#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */ 342#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */
@@ -444,6 +436,7 @@ static inline int pgd_bad(pgd_t pgd) { return 0; }
444 436
445static inline int pud_present(pud_t pud) { return 1; } 437static inline int pud_present(pud_t pud) { return 1; }
446static inline int pud_none(pud_t pud) { return 0; } 438static inline int pud_none(pud_t pud) { return 0; }
439static inline int pud_large(pud_t pud) { return 0; }
447static inline int pud_bad(pud_t pud) { return 0; } 440static inline int pud_bad(pud_t pud) { return 0; }
448 441
449#else /* CONFIG_64BIT */ 442#else /* CONFIG_64BIT */
@@ -489,6 +482,13 @@ static inline int pud_none(pud_t pud)
489 return (pud_val(pud) & _REGION_ENTRY_INV) != 0UL; 482 return (pud_val(pud) & _REGION_ENTRY_INV) != 0UL;
490} 483}
491 484
485static inline int pud_large(pud_t pud)
486{
487 if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) != _REGION_ENTRY_TYPE_R3)
488 return 0;
489 return !!(pud_val(pud) & _REGION3_ENTRY_LARGE);
490}
491
492static inline int pud_bad(pud_t pud) 492static inline int pud_bad(pud_t pud)
493{ 493{
494 /* 494 /*
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
index e62a555557e..833788693f0 100644
--- a/arch/s390/include/asm/sclp.h
+++ b/arch/s390/include/asm/sclp.h
@@ -55,5 +55,7 @@ int sclp_chp_read_info(struct sclp_chp_info *info);
55void sclp_get_ipl_info(struct sclp_ipl_info *info); 55void sclp_get_ipl_info(struct sclp_ipl_info *info);
56bool sclp_has_linemode(void); 56bool sclp_has_linemode(void);
57bool sclp_has_vt220(void); 57bool sclp_has_vt220(void);
58int sclp_pci_configure(u32 fid);
59int sclp_pci_deconfigure(u32 fid);
58 60
59#endif /* _ASM_S390_SCLP_H */ 61#endif /* _ASM_S390_SCLP_H */
diff --git a/arch/s390/include/asm/signal.h b/arch/s390/include/asm/signal.h
index bffdbdd5b3d..db7ddfaf5b7 100644
--- a/arch/s390/include/asm/signal.h
+++ b/arch/s390/include/asm/signal.h
@@ -39,6 +39,4 @@ struct k_sigaction {
39 struct sigaction sa; 39 struct sigaction sa;
40}; 40};
41 41
42#define ptrace_signal_deliver(regs, cookie) do { } while (0)
43
44#endif 42#endif
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index 9935cbd6a46..05425b18c0a 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -8,32 +8,34 @@ struct cpu;
8 8
9#ifdef CONFIG_SCHED_BOOK 9#ifdef CONFIG_SCHED_BOOK
10 10
11extern unsigned char cpu_socket_id[NR_CPUS]; 11struct cpu_topology_s390 {
12#define topology_physical_package_id(cpu) (cpu_socket_id[cpu]) 12 unsigned short core_id;
13 unsigned short socket_id;
14 unsigned short book_id;
15 cpumask_t core_mask;
16 cpumask_t book_mask;
17};
18
19extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
20
21#define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id)
22#define topology_core_id(cpu) (cpu_topology[cpu].core_id)
23#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_mask)
24#define topology_book_id(cpu) (cpu_topology[cpu].book_id)
25#define topology_book_cpumask(cpu) (&cpu_topology[cpu].book_mask)
13 26
14extern unsigned char cpu_core_id[NR_CPUS]; 27#define mc_capable() 1
15extern cpumask_t cpu_core_map[NR_CPUS];
16 28
17static inline const struct cpumask *cpu_coregroup_mask(int cpu) 29static inline const struct cpumask *cpu_coregroup_mask(int cpu)
18{ 30{
19 return &cpu_core_map[cpu]; 31 return &cpu_topology[cpu].core_mask;
20} 32}
21 33
22#define topology_core_id(cpu) (cpu_core_id[cpu])
23#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
24#define mc_capable() (1)
25
26extern unsigned char cpu_book_id[NR_CPUS];
27extern cpumask_t cpu_book_map[NR_CPUS];
28
29static inline const struct cpumask *cpu_book_mask(int cpu) 34static inline const struct cpumask *cpu_book_mask(int cpu)
30{ 35{
31 return &cpu_book_map[cpu]; 36 return &cpu_topology[cpu].book_mask;
32} 37}
33 38
34#define topology_book_id(cpu) (cpu_book_id[cpu])
35#define topology_book_cpumask(cpu) (&cpu_book_map[cpu])
36
37int topology_cpu_init(struct cpu *); 39int topology_cpu_init(struct cpu *);
38int topology_set_cpu_management(int fc); 40int topology_set_cpu_management(int fc);
39void topology_schedule_update(void); 41void topology_schedule_update(void);
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index bbbae41fa9a..086bb8eaf6a 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -54,7 +54,9 @@
54# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 54# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
55# endif 55# endif
56#define __ARCH_WANT_SYS_EXECVE 56#define __ARCH_WANT_SYS_EXECVE
57#define __ARCH_WANT_KERNEL_EXECVE 57#define __ARCH_WANT_SYS_FORK
58#define __ARCH_WANT_SYS_VFORK
59#define __ARCH_WANT_SYS_CLONE
58 60
59/* 61/*
60 * "Conditional" syscalls 62 * "Conditional" syscalls
diff --git a/arch/s390/include/asm/vga.h b/arch/s390/include/asm/vga.h
new file mode 100644
index 00000000000..d375526c261
--- /dev/null
+++ b/arch/s390/include/asm/vga.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_S390_VGA_H
2#define _ASM_S390_VGA_H
3
4/* Avoid compile errors due to missing asm/vga.h */
5
6#endif /* _ASM_S390_VGA_H */
diff --git a/arch/s390/include/uapi/asm/socket.h b/arch/s390/include/uapi/asm/socket.h
index 69718cd6d63..436d07c23be 100644
--- a/arch/s390/include/uapi/asm/socket.h
+++ b/arch/s390/include/uapi/asm/socket.h
@@ -46,6 +46,7 @@
46/* Socket filtering */ 46/* Socket filtering */
47#define SO_ATTACH_FILTER 26 47#define SO_ATTACH_FILTER 26
48#define SO_DETACH_FILTER 27 48#define SO_DETACH_FILTER 27
49#define SO_GET_FILTER SO_ATTACH_FILTER
49 50
50#define SO_PEERNAME 28 51#define SO_PEERNAME 28
51#define SO_TIMESTAMP 29 52#define SO_TIMESTAMP 29
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 4da52fe3174..2ac311ef5c9 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -23,7 +23,7 @@ CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w
23obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o \ 23obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o \
24 processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o \ 24 processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o \
25 debug.o irq.o ipl.o dis.o diag.o mem_detect.o sclp.o vdso.o \ 25 debug.o irq.o ipl.o dis.o diag.o mem_detect.o sclp.o vdso.o \
26 sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o 26 sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o
27 27
28obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 28obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index ad79b846535..827e094a2f4 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -28,7 +28,7 @@ ENTRY(sys32_open_wrapper)
28 llgtr %r2,%r2 # const char * 28 llgtr %r2,%r2 # const char *
29 lgfr %r3,%r3 # int 29 lgfr %r3,%r3 # int
30 lgfr %r4,%r4 # int 30 lgfr %r4,%r4 # int
31 jg sys_open # branch to system call 31 jg compat_sys_open # branch to system call
32 32
33ENTRY(sys32_close_wrapper) 33ENTRY(sys32_close_wrapper)
34 llgfr %r2,%r2 # unsigned int 34 llgfr %r2,%r2 # unsigned int
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index f00286bd2ef..a7f9abd98cf 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -83,22 +83,29 @@ enum {
83 U4_12, /* 4 bit unsigned value starting at 12 */ 83 U4_12, /* 4 bit unsigned value starting at 12 */
84 U4_16, /* 4 bit unsigned value starting at 16 */ 84 U4_16, /* 4 bit unsigned value starting at 16 */
85 U4_20, /* 4 bit unsigned value starting at 20 */ 85 U4_20, /* 4 bit unsigned value starting at 20 */
86 U4_24, /* 4 bit unsigned value starting at 24 */
87 U4_28, /* 4 bit unsigned value starting at 28 */
86 U4_32, /* 4 bit unsigned value starting at 32 */ 88 U4_32, /* 4 bit unsigned value starting at 32 */
89 U4_36, /* 4 bit unsigned value starting at 36 */
87 U8_8, /* 8 bit unsigned value starting at 8 */ 90 U8_8, /* 8 bit unsigned value starting at 8 */
88 U8_16, /* 8 bit unsigned value starting at 16 */ 91 U8_16, /* 8 bit unsigned value starting at 16 */
89 U8_24, /* 8 bit unsigned value starting at 24 */ 92 U8_24, /* 8 bit unsigned value starting at 24 */
90 U8_32, /* 8 bit unsigned value starting at 32 */ 93 U8_32, /* 8 bit unsigned value starting at 32 */
91 I8_8, /* 8 bit signed value starting at 8 */ 94 I8_8, /* 8 bit signed value starting at 8 */
92 I8_32, /* 8 bit signed value starting at 32 */ 95 I8_32, /* 8 bit signed value starting at 32 */
96 J12_12, /* PC relative offset at 12 */
93 I16_16, /* 16 bit signed value starting at 16 */ 97 I16_16, /* 16 bit signed value starting at 16 */
94 I16_32, /* 32 bit signed value starting at 16 */ 98 I16_32, /* 32 bit signed value starting at 16 */
95 U16_16, /* 16 bit unsigned value starting at 16 */ 99 U16_16, /* 16 bit unsigned value starting at 16 */
96 U16_32, /* 32 bit unsigned value starting at 16 */ 100 U16_32, /* 32 bit unsigned value starting at 16 */
97 J16_16, /* PC relative jump offset at 16 */ 101 J16_16, /* PC relative jump offset at 16 */
102 J16_32, /* PC relative offset at 16 */
103 I24_24, /* 24 bit signed value starting at 24 */
98 J32_16, /* PC relative long offset at 16 */ 104 J32_16, /* PC relative long offset at 16 */
99 I32_16, /* 32 bit signed value starting at 16 */ 105 I32_16, /* 32 bit signed value starting at 16 */
100 U32_16, /* 32 bit unsigned value starting at 16 */ 106 U32_16, /* 32 bit unsigned value starting at 16 */
101 M_16, /* 4 bit optional mask starting at 16 */ 107 M_16, /* 4 bit optional mask starting at 16 */
108 M_20, /* 4 bit optional mask starting at 20 */
102 RO_28, /* optional GPR starting at position 28 */ 109 RO_28, /* optional GPR starting at position 28 */
103}; 110};
104 111
@@ -109,6 +116,8 @@ enum {
109enum { 116enum {
110 INSTR_INVALID, 117 INSTR_INVALID,
111 INSTR_E, 118 INSTR_E,
119 INSTR_IE_UU,
120 INSTR_MII_UPI,
112 INSTR_RIE_R0IU, INSTR_RIE_R0UU, INSTR_RIE_RRP, INSTR_RIE_RRPU, 121 INSTR_RIE_R0IU, INSTR_RIE_R0UU, INSTR_RIE_RRP, INSTR_RIE_RRPU,
113 INSTR_RIE_RRUUU, INSTR_RIE_RUPI, INSTR_RIE_RUPU, INSTR_RIE_RRI0, 122 INSTR_RIE_RRUUU, INSTR_RIE_RUPI, INSTR_RIE_RUPU, INSTR_RIE_RRI0,
114 INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, INSTR_RIL_UP, 123 INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, INSTR_RIL_UP,
@@ -118,13 +127,15 @@ enum {
118 INSTR_RRE_FF, INSTR_RRE_FR, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF, 127 INSTR_RRE_FF, INSTR_RRE_FR, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF,
119 INSTR_RRE_RR, INSTR_RRE_RR_OPT, 128 INSTR_RRE_RR, INSTR_RRE_RR_OPT,
120 INSTR_RRF_0UFF, INSTR_RRF_F0FF, INSTR_RRF_F0FF2, INSTR_RRF_F0FR, 129 INSTR_RRF_0UFF, INSTR_RRF_F0FF, INSTR_RRF_F0FF2, INSTR_RRF_F0FR,
121 INSTR_RRF_FFRU, INSTR_RRF_FUFF, INSTR_RRF_M0RR, INSTR_RRF_R0RR, 130 INSTR_RRF_FFRU, INSTR_RRF_FUFF, INSTR_RRF_FUFF2, INSTR_RRF_M0RR,
122 INSTR_RRF_R0RR2, INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF, 131 INSTR_RRF_R0RR, INSTR_RRF_R0RR2, INSTR_RRF_RMRR, INSTR_RRF_RURR,
123 INSTR_RRF_U0RR, INSTR_RRF_UUFF, INSTR_RRR_F0FF, INSTR_RRS_RRRDU, 132 INSTR_RRF_U0FF, INSTR_RRF_U0RF, INSTR_RRF_U0RR, INSTR_RRF_UUFF,
133 INSTR_RRF_UUFR, INSTR_RRF_UURF,
134 INSTR_RRR_F0FF, INSTR_RRS_RRRDU,
124 INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR, 135 INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR,
125 INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD, 136 INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD,
126 INSTR_RSI_RRP, 137 INSTR_RSI_RRP,
127 INSTR_RSL_R0RD, 138 INSTR_RSL_LRDFU, INSTR_RSL_R0RD,
128 INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, INSTR_RSY_RURD, 139 INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, INSTR_RSY_RURD,
129 INSTR_RSY_RDRM, 140 INSTR_RSY_RDRM,
130 INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, INSTR_RS_RRRD, 141 INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, INSTR_RS_RRRD,
@@ -136,6 +147,7 @@ enum {
136 INSTR_SIL_RDI, INSTR_SIL_RDU, 147 INSTR_SIL_RDI, INSTR_SIL_RDU,
137 INSTR_SIY_IRD, INSTR_SIY_URD, 148 INSTR_SIY_IRD, INSTR_SIY_URD,
138 INSTR_SI_URD, 149 INSTR_SI_URD,
150 INSTR_SMI_U0RDP,
139 INSTR_SSE_RDRD, 151 INSTR_SSE_RDRD,
140 INSTR_SSF_RRDRD, INSTR_SSF_RRDRD2, 152 INSTR_SSF_RRDRD, INSTR_SSF_RRDRD2,
141 INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, INSTR_SS_LLRDRD, INSTR_SS_RRRDRD, 153 INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, INSTR_SS_LLRDRD, INSTR_SS_RRRDRD,
@@ -191,31 +203,42 @@ static const struct operand operands[] =
191 [U4_12] = { 4, 12, 0 }, 203 [U4_12] = { 4, 12, 0 },
192 [U4_16] = { 4, 16, 0 }, 204 [U4_16] = { 4, 16, 0 },
193 [U4_20] = { 4, 20, 0 }, 205 [U4_20] = { 4, 20, 0 },
206 [U4_24] = { 4, 24, 0 },
207 [U4_28] = { 4, 28, 0 },
194 [U4_32] = { 4, 32, 0 }, 208 [U4_32] = { 4, 32, 0 },
209 [U4_36] = { 4, 36, 0 },
195 [U8_8] = { 8, 8, 0 }, 210 [U8_8] = { 8, 8, 0 },
196 [U8_16] = { 8, 16, 0 }, 211 [U8_16] = { 8, 16, 0 },
197 [U8_24] = { 8, 24, 0 }, 212 [U8_24] = { 8, 24, 0 },
198 [U8_32] = { 8, 32, 0 }, 213 [U8_32] = { 8, 32, 0 },
214 [J12_12] = { 12, 12, OPERAND_PCREL },
199 [I16_16] = { 16, 16, OPERAND_SIGNED }, 215 [I16_16] = { 16, 16, OPERAND_SIGNED },
200 [U16_16] = { 16, 16, 0 }, 216 [U16_16] = { 16, 16, 0 },
201 [U16_32] = { 16, 32, 0 }, 217 [U16_32] = { 16, 32, 0 },
202 [J16_16] = { 16, 16, OPERAND_PCREL }, 218 [J16_16] = { 16, 16, OPERAND_PCREL },
219 [J16_32] = { 16, 32, OPERAND_PCREL },
203 [I16_32] = { 16, 32, OPERAND_SIGNED }, 220 [I16_32] = { 16, 32, OPERAND_SIGNED },
221 [I24_24] = { 24, 24, OPERAND_SIGNED },
204 [J32_16] = { 32, 16, OPERAND_PCREL }, 222 [J32_16] = { 32, 16, OPERAND_PCREL },
205 [I32_16] = { 32, 16, OPERAND_SIGNED }, 223 [I32_16] = { 32, 16, OPERAND_SIGNED },
206 [U32_16] = { 32, 16, 0 }, 224 [U32_16] = { 32, 16, 0 },
207 [M_16] = { 4, 16, 0 }, 225 [M_16] = { 4, 16, 0 },
226 [M_20] = { 4, 20, 0 },
208 [RO_28] = { 4, 28, OPERAND_GPR } 227 [RO_28] = { 4, 28, OPERAND_GPR }
209}; 228};
210 229
211static const unsigned char formats[][7] = { 230static const unsigned char formats[][7] = {
212 [INSTR_E] = { 0xff, 0,0,0,0,0,0 }, 231 [INSTR_E] = { 0xff, 0,0,0,0,0,0 },
232 [INSTR_IE_UU] = { 0xff, U4_24,U4_28,0,0,0,0 },
233 [INSTR_MII_UPI] = { 0xff, U4_8,J12_12,I24_24 },
234 [INSTR_RIE_R0IU] = { 0xff, R_8,I16_16,U4_32,0,0,0 },
213 [INSTR_RIE_R0UU] = { 0xff, R_8,U16_16,U4_32,0,0,0 }, 235 [INSTR_RIE_R0UU] = { 0xff, R_8,U16_16,U4_32,0,0,0 },
236 [INSTR_RIE_RRI0] = { 0xff, R_8,R_12,I16_16,0,0,0 },
214 [INSTR_RIE_RRPU] = { 0xff, R_8,R_12,U4_32,J16_16,0,0 }, 237 [INSTR_RIE_RRPU] = { 0xff, R_8,R_12,U4_32,J16_16,0,0 },
215 [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, 238 [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
216 [INSTR_RIE_RRUUU] = { 0xff, R_8,R_12,U8_16,U8_24,U8_32,0 }, 239 [INSTR_RIE_RRUUU] = { 0xff, R_8,R_12,U8_16,U8_24,U8_32,0 },
217 [INSTR_RIE_RUPI] = { 0xff, R_8,I8_32,U4_12,J16_16,0,0 }, 240 [INSTR_RIE_RUPI] = { 0xff, R_8,I8_32,U4_12,J16_16,0,0 },
218 [INSTR_RIE_RRI0] = { 0xff, R_8,R_12,I16_16,0,0,0 }, 241 [INSTR_RIE_RUPU] = { 0xff, R_8,U8_32,U4_12,J16_16,0,0 },
219 [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 }, 242 [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 },
220 [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 }, 243 [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 },
221 [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 }, 244 [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 },
@@ -245,14 +268,18 @@ static const unsigned char formats[][7] = {
245 [INSTR_RRF_F0FR] = { 0xff, F_24,F_16,R_28,0,0,0 }, 268 [INSTR_RRF_F0FR] = { 0xff, F_24,F_16,R_28,0,0,0 },
246 [INSTR_RRF_FFRU] = { 0xff, F_24,F_16,R_28,U4_20,0,0 }, 269 [INSTR_RRF_FFRU] = { 0xff, F_24,F_16,R_28,U4_20,0,0 },
247 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 }, 270 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },
271 [INSTR_RRF_FUFF2] = { 0xff, F_24,F_28,F_16,U4_20,0,0 },
248 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 }, 272 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 },
249 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 }, 273 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 },
250 [INSTR_RRF_R0RR2] = { 0xff, R_24,R_28,R_16,0,0,0 }, 274 [INSTR_RRF_R0RR2] = { 0xff, R_24,R_28,R_16,0,0,0 },
275 [INSTR_RRF_RMRR] = { 0xff, R_24,R_16,R_28,M_20,0,0 },
251 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 }, 276 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },
252 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 }, 277 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 },
253 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 }, 278 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 },
254 [INSTR_RRF_U0RR] = { 0xff, R_24,R_28,U4_16,0,0,0 }, 279 [INSTR_RRF_U0RR] = { 0xff, R_24,R_28,U4_16,0,0,0 },
255 [INSTR_RRF_UUFF] = { 0xff, F_24,U4_16,F_28,U4_20,0,0 }, 280 [INSTR_RRF_UUFF] = { 0xff, F_24,U4_16,F_28,U4_20,0,0 },
281 [INSTR_RRF_UUFR] = { 0xff, F_24,U4_16,R_28,U4_20,0,0 },
282 [INSTR_RRF_UURF] = { 0xff, R_24,U4_16,F_28,U4_20,0,0 },
256 [INSTR_RRR_F0FF] = { 0xff, F_24,F_28,F_16,0,0,0 }, 283 [INSTR_RRR_F0FF] = { 0xff, F_24,F_28,F_16,0,0,0 },
257 [INSTR_RRS_RRRDU] = { 0xff, R_8,R_12,U4_32,D_20,B_16,0 }, 284 [INSTR_RRS_RRRDU] = { 0xff, R_8,R_12,U4_32,D_20,B_16,0 },
258 [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 }, 285 [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 },
@@ -264,12 +291,13 @@ static const unsigned char formats[][7] = {
264 [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 }, 291 [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
265 [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, 292 [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
266 [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, 293 [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
294 [INSTR_RSL_LRDFU] = { 0xff, F_32,D_20,L4_8,B_16,U4_36,0 },
267 [INSTR_RSL_R0RD] = { 0xff, D_20,L4_8,B_16,0,0,0 }, 295 [INSTR_RSL_R0RD] = { 0xff, D_20,L4_8,B_16,0,0,0 },
268 [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 }, 296 [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },
269 [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 }, 297 [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },
298 [INSTR_RSY_RDRM] = { 0xff, R_8,D20_20,B_16,U4_12,0,0 },
270 [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 }, 299 [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },
271 [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 }, 300 [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 },
272 [INSTR_RSY_RDRM] = { 0xff, R_8,D20_20,B_16,U4_12,0,0 },
273 [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 }, 301 [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 },
274 [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 }, 302 [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
275 [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 }, 303 [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 },
@@ -289,9 +317,10 @@ static const unsigned char formats[][7] = {
289 [INSTR_SIY_IRD] = { 0xff, D20_20,B_16,I8_8,0,0,0 }, 317 [INSTR_SIY_IRD] = { 0xff, D20_20,B_16,I8_8,0,0,0 },
290 [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 }, 318 [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 },
291 [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 }, 319 [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 },
320 [INSTR_SMI_U0RDP] = { 0xff, U4_8,J16_32,D_20,B_16,0,0 },
292 [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 }, 321 [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 },
293 [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 }, 322 [INSTR_SSF_RRDRD] = { 0x0f, D_20,B_16,D_36,B_32,R_8,0 },
294 [INSTR_SSF_RRDRD2]= { 0x00, R_8,D_20,B_16,D_36,B_32,0 }, 323 [INSTR_SSF_RRDRD2]= { 0x0f, R_8,D_20,B_16,D_36,B_32,0 },
295 [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 }, 324 [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 },
296 [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 }, 325 [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 },
297 [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 }, 326 [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 },
@@ -304,46 +333,157 @@ static const unsigned char formats[][7] = {
304 333
305enum { 334enum {
306 LONG_INSN_ALGHSIK, 335 LONG_INSN_ALGHSIK,
336 LONG_INSN_ALHHHR,
337 LONG_INSN_ALHHLR,
307 LONG_INSN_ALHSIK, 338 LONG_INSN_ALHSIK,
339 LONG_INSN_ALSIHN,
340 LONG_INSN_CDFBRA,
341 LONG_INSN_CDGBRA,
342 LONG_INSN_CDGTRA,
343 LONG_INSN_CDLFBR,
344 LONG_INSN_CDLFTR,
345 LONG_INSN_CDLGBR,
346 LONG_INSN_CDLGTR,
347 LONG_INSN_CEFBRA,
348 LONG_INSN_CEGBRA,
349 LONG_INSN_CELFBR,
350 LONG_INSN_CELGBR,
351 LONG_INSN_CFDBRA,
352 LONG_INSN_CFEBRA,
353 LONG_INSN_CFXBRA,
354 LONG_INSN_CGDBRA,
355 LONG_INSN_CGDTRA,
356 LONG_INSN_CGEBRA,
357 LONG_INSN_CGXBRA,
358 LONG_INSN_CGXTRA,
359 LONG_INSN_CLFDBR,
360 LONG_INSN_CLFDTR,
361 LONG_INSN_CLFEBR,
308 LONG_INSN_CLFHSI, 362 LONG_INSN_CLFHSI,
363 LONG_INSN_CLFXBR,
364 LONG_INSN_CLFXTR,
365 LONG_INSN_CLGDBR,
366 LONG_INSN_CLGDTR,
367 LONG_INSN_CLGEBR,
309 LONG_INSN_CLGFRL, 368 LONG_INSN_CLGFRL,
310 LONG_INSN_CLGHRL, 369 LONG_INSN_CLGHRL,
311 LONG_INSN_CLGHSI, 370 LONG_INSN_CLGHSI,
371 LONG_INSN_CLGXBR,
372 LONG_INSN_CLGXTR,
312 LONG_INSN_CLHHSI, 373 LONG_INSN_CLHHSI,
374 LONG_INSN_CXFBRA,
375 LONG_INSN_CXGBRA,
376 LONG_INSN_CXGTRA,
377 LONG_INSN_CXLFBR,
378 LONG_INSN_CXLFTR,
379 LONG_INSN_CXLGBR,
380 LONG_INSN_CXLGTR,
381 LONG_INSN_FIDBRA,
382 LONG_INSN_FIEBRA,
383 LONG_INSN_FIXBRA,
384 LONG_INSN_LDXBRA,
385 LONG_INSN_LEDBRA,
386 LONG_INSN_LEXBRA,
387 LONG_INSN_LLGFAT,
313 LONG_INSN_LLGFRL, 388 LONG_INSN_LLGFRL,
314 LONG_INSN_LLGHRL, 389 LONG_INSN_LLGHRL,
390 LONG_INSN_LLGTAT,
315 LONG_INSN_POPCNT, 391 LONG_INSN_POPCNT,
392 LONG_INSN_RIEMIT,
393 LONG_INSN_RINEXT,
394 LONG_INSN_RISBGN,
316 LONG_INSN_RISBHG, 395 LONG_INSN_RISBHG,
317 LONG_INSN_RISBLG, 396 LONG_INSN_RISBLG,
318 LONG_INSN_RINEXT, 397 LONG_INSN_SLHHHR,
319 LONG_INSN_RIEMIT, 398 LONG_INSN_SLHHLR,
320 LONG_INSN_TABORT, 399 LONG_INSN_TABORT,
321 LONG_INSN_TBEGIN, 400 LONG_INSN_TBEGIN,
322 LONG_INSN_TBEGINC, 401 LONG_INSN_TBEGINC,
402 LONG_INSN_PCISTG,
403 LONG_INSN_MPCIFC,
404 LONG_INSN_STPCIFC,
405 LONG_INSN_PCISTB,
323}; 406};
324 407
325static char *long_insn_name[] = { 408static char *long_insn_name[] = {
326 [LONG_INSN_ALGHSIK] = "alghsik", 409 [LONG_INSN_ALGHSIK] = "alghsik",
410 [LONG_INSN_ALHHHR] = "alhhhr",
411 [LONG_INSN_ALHHLR] = "alhhlr",
327 [LONG_INSN_ALHSIK] = "alhsik", 412 [LONG_INSN_ALHSIK] = "alhsik",
413 [LONG_INSN_ALSIHN] = "alsihn",
414 [LONG_INSN_CDFBRA] = "cdfbra",
415 [LONG_INSN_CDGBRA] = "cdgbra",
416 [LONG_INSN_CDGTRA] = "cdgtra",
417 [LONG_INSN_CDLFBR] = "cdlfbr",
418 [LONG_INSN_CDLFTR] = "cdlftr",
419 [LONG_INSN_CDLGBR] = "cdlgbr",
420 [LONG_INSN_CDLGTR] = "cdlgtr",
421 [LONG_INSN_CEFBRA] = "cefbra",
422 [LONG_INSN_CEGBRA] = "cegbra",
423 [LONG_INSN_CELFBR] = "celfbr",
424 [LONG_INSN_CELGBR] = "celgbr",
425 [LONG_INSN_CFDBRA] = "cfdbra",
426 [LONG_INSN_CFEBRA] = "cfebra",
427 [LONG_INSN_CFXBRA] = "cfxbra",
428 [LONG_INSN_CGDBRA] = "cgdbra",
429 [LONG_INSN_CGDTRA] = "cgdtra",
430 [LONG_INSN_CGEBRA] = "cgebra",
431 [LONG_INSN_CGXBRA] = "cgxbra",
432 [LONG_INSN_CGXTRA] = "cgxtra",
433 [LONG_INSN_CLFDBR] = "clfdbr",
434 [LONG_INSN_CLFDTR] = "clfdtr",
435 [LONG_INSN_CLFEBR] = "clfebr",
328 [LONG_INSN_CLFHSI] = "clfhsi", 436 [LONG_INSN_CLFHSI] = "clfhsi",
437 [LONG_INSN_CLFXBR] = "clfxbr",
438 [LONG_INSN_CLFXTR] = "clfxtr",
439 [LONG_INSN_CLGDBR] = "clgdbr",
440 [LONG_INSN_CLGDTR] = "clgdtr",
441 [LONG_INSN_CLGEBR] = "clgebr",
329 [LONG_INSN_CLGFRL] = "clgfrl", 442 [LONG_INSN_CLGFRL] = "clgfrl",
330 [LONG_INSN_CLGHRL] = "clghrl", 443 [LONG_INSN_CLGHRL] = "clghrl",
331 [LONG_INSN_CLGHSI] = "clghsi", 444 [LONG_INSN_CLGHSI] = "clghsi",
445 [LONG_INSN_CLGXBR] = "clgxbr",
446 [LONG_INSN_CLGXTR] = "clgxtr",
332 [LONG_INSN_CLHHSI] = "clhhsi", 447 [LONG_INSN_CLHHSI] = "clhhsi",
448 [LONG_INSN_CXFBRA] = "cxfbra",
449 [LONG_INSN_CXGBRA] = "cxgbra",
450 [LONG_INSN_CXGTRA] = "cxgtra",
451 [LONG_INSN_CXLFBR] = "cxlfbr",
452 [LONG_INSN_CXLFTR] = "cxlftr",
453 [LONG_INSN_CXLGBR] = "cxlgbr",
454 [LONG_INSN_CXLGTR] = "cxlgtr",
455 [LONG_INSN_FIDBRA] = "fidbra",
456 [LONG_INSN_FIEBRA] = "fiebra",
457 [LONG_INSN_FIXBRA] = "fixbra",
458 [LONG_INSN_LDXBRA] = "ldxbra",
459 [LONG_INSN_LEDBRA] = "ledbra",
460 [LONG_INSN_LEXBRA] = "lexbra",
461 [LONG_INSN_LLGFAT] = "llgfat",
333 [LONG_INSN_LLGFRL] = "llgfrl", 462 [LONG_INSN_LLGFRL] = "llgfrl",
334 [LONG_INSN_LLGHRL] = "llghrl", 463 [LONG_INSN_LLGHRL] = "llghrl",
464 [LONG_INSN_LLGTAT] = "llgtat",
335 [LONG_INSN_POPCNT] = "popcnt", 465 [LONG_INSN_POPCNT] = "popcnt",
466 [LONG_INSN_RIEMIT] = "riemit",
467 [LONG_INSN_RINEXT] = "rinext",
468 [LONG_INSN_RISBGN] = "risbgn",
336 [LONG_INSN_RISBHG] = "risbhg", 469 [LONG_INSN_RISBHG] = "risbhg",
337 [LONG_INSN_RISBLG] = "risblg", 470 [LONG_INSN_RISBLG] = "risblg",
338 [LONG_INSN_RINEXT] = "rinext", 471 [LONG_INSN_SLHHHR] = "slhhhr",
339 [LONG_INSN_RIEMIT] = "riemit", 472 [LONG_INSN_SLHHLR] = "slhhlr",
340 [LONG_INSN_TABORT] = "tabort", 473 [LONG_INSN_TABORT] = "tabort",
341 [LONG_INSN_TBEGIN] = "tbegin", 474 [LONG_INSN_TBEGIN] = "tbegin",
342 [LONG_INSN_TBEGINC] = "tbeginc", 475 [LONG_INSN_TBEGINC] = "tbeginc",
476 [LONG_INSN_PCISTG] = "pcistg",
477 [LONG_INSN_MPCIFC] = "mpcifc",
478 [LONG_INSN_STPCIFC] = "stpcifc",
479 [LONG_INSN_PCISTB] = "pcistb",
343}; 480};
344 481
345static struct insn opcode[] = { 482static struct insn opcode[] = {
346#ifdef CONFIG_64BIT 483#ifdef CONFIG_64BIT
484 { "bprp", 0xc5, INSTR_MII_UPI },
485 { "bpp", 0xc7, INSTR_SMI_U0RDP },
486 { "trtr", 0xd0, INSTR_SS_L0RDRD },
347 { "lmd", 0xef, INSTR_SS_RRRDRD3 }, 487 { "lmd", 0xef, INSTR_SS_RRRDRD3 },
348#endif 488#endif
349 { "spm", 0x04, INSTR_RR_R0 }, 489 { "spm", 0x04, INSTR_RR_R0 },
@@ -378,7 +518,6 @@ static struct insn opcode[] = {
378 { "lcdr", 0x23, INSTR_RR_FF }, 518 { "lcdr", 0x23, INSTR_RR_FF },
379 { "hdr", 0x24, INSTR_RR_FF }, 519 { "hdr", 0x24, INSTR_RR_FF },
380 { "ldxr", 0x25, INSTR_RR_FF }, 520 { "ldxr", 0x25, INSTR_RR_FF },
381 { "lrdr", 0x25, INSTR_RR_FF },
382 { "mxr", 0x26, INSTR_RR_FF }, 521 { "mxr", 0x26, INSTR_RR_FF },
383 { "mxdr", 0x27, INSTR_RR_FF }, 522 { "mxdr", 0x27, INSTR_RR_FF },
384 { "ldr", 0x28, INSTR_RR_FF }, 523 { "ldr", 0x28, INSTR_RR_FF },
@@ -395,7 +534,6 @@ static struct insn opcode[] = {
395 { "lcer", 0x33, INSTR_RR_FF }, 534 { "lcer", 0x33, INSTR_RR_FF },
396 { "her", 0x34, INSTR_RR_FF }, 535 { "her", 0x34, INSTR_RR_FF },
397 { "ledr", 0x35, INSTR_RR_FF }, 536 { "ledr", 0x35, INSTR_RR_FF },
398 { "lrer", 0x35, INSTR_RR_FF },
399 { "axr", 0x36, INSTR_RR_FF }, 537 { "axr", 0x36, INSTR_RR_FF },
400 { "sxr", 0x37, INSTR_RR_FF }, 538 { "sxr", 0x37, INSTR_RR_FF },
401 { "ler", 0x38, INSTR_RR_FF }, 539 { "ler", 0x38, INSTR_RR_FF },
@@ -403,7 +541,6 @@ static struct insn opcode[] = {
403 { "aer", 0x3a, INSTR_RR_FF }, 541 { "aer", 0x3a, INSTR_RR_FF },
404 { "ser", 0x3b, INSTR_RR_FF }, 542 { "ser", 0x3b, INSTR_RR_FF },
405 { "mder", 0x3c, INSTR_RR_FF }, 543 { "mder", 0x3c, INSTR_RR_FF },
406 { "mer", 0x3c, INSTR_RR_FF },
407 { "der", 0x3d, INSTR_RR_FF }, 544 { "der", 0x3d, INSTR_RR_FF },
408 { "aur", 0x3e, INSTR_RR_FF }, 545 { "aur", 0x3e, INSTR_RR_FF },
409 { "sur", 0x3f, INSTR_RR_FF }, 546 { "sur", 0x3f, INSTR_RR_FF },
@@ -454,7 +591,6 @@ static struct insn opcode[] = {
454 { "ae", 0x7a, INSTR_RX_FRRD }, 591 { "ae", 0x7a, INSTR_RX_FRRD },
455 { "se", 0x7b, INSTR_RX_FRRD }, 592 { "se", 0x7b, INSTR_RX_FRRD },
456 { "mde", 0x7c, INSTR_RX_FRRD }, 593 { "mde", 0x7c, INSTR_RX_FRRD },
457 { "me", 0x7c, INSTR_RX_FRRD },
458 { "de", 0x7d, INSTR_RX_FRRD }, 594 { "de", 0x7d, INSTR_RX_FRRD },
459 { "au", 0x7e, INSTR_RX_FRRD }, 595 { "au", 0x7e, INSTR_RX_FRRD },
460 { "su", 0x7f, INSTR_RX_FRRD }, 596 { "su", 0x7f, INSTR_RX_FRRD },
@@ -534,9 +670,9 @@ static struct insn opcode[] = {
534 670
535static struct insn opcode_01[] = { 671static struct insn opcode_01[] = {
536#ifdef CONFIG_64BIT 672#ifdef CONFIG_64BIT
537 { "sam64", 0x0e, INSTR_E },
538 { "pfpo", 0x0a, INSTR_E },
539 { "ptff", 0x04, INSTR_E }, 673 { "ptff", 0x04, INSTR_E },
674 { "pfpo", 0x0a, INSTR_E },
675 { "sam64", 0x0e, INSTR_E },
540#endif 676#endif
541 { "pr", 0x01, INSTR_E }, 677 { "pr", 0x01, INSTR_E },
542 { "upt", 0x02, INSTR_E }, 678 { "upt", 0x02, INSTR_E },
@@ -605,19 +741,28 @@ static struct insn opcode_aa[] = {
605 741
606static struct insn opcode_b2[] = { 742static struct insn opcode_b2[] = {
607#ifdef CONFIG_64BIT 743#ifdef CONFIG_64BIT
608 { "sske", 0x2b, INSTR_RRF_M0RR },
609 { "stckf", 0x7c, INSTR_S_RD }, 744 { "stckf", 0x7c, INSTR_S_RD },
610 { "cu21", 0xa6, INSTR_RRF_M0RR }, 745 { "lpp", 0x80, INSTR_S_RD },
611 { "cuutf", 0xa6, INSTR_RRF_M0RR }, 746 { "lcctl", 0x84, INSTR_S_RD },
612 { "cu12", 0xa7, INSTR_RRF_M0RR }, 747 { "lpctl", 0x85, INSTR_S_RD },
613 { "cutfu", 0xa7, INSTR_RRF_M0RR }, 748 { "qsi", 0x86, INSTR_S_RD },
749 { "lsctl", 0x87, INSTR_S_RD },
750 { "qctri", 0x8e, INSTR_S_RD },
614 { "stfle", 0xb0, INSTR_S_RD }, 751 { "stfle", 0xb0, INSTR_S_RD },
615 { "lpswe", 0xb2, INSTR_S_RD }, 752 { "lpswe", 0xb2, INSTR_S_RD },
753 { "srnmb", 0xb8, INSTR_S_RD },
616 { "srnmt", 0xb9, INSTR_S_RD }, 754 { "srnmt", 0xb9, INSTR_S_RD },
617 { "lfas", 0xbd, INSTR_S_RD }, 755 { "lfas", 0xbd, INSTR_S_RD },
618 { "etndg", 0xec, INSTR_RRE_R0 }, 756 { "scctr", 0xe0, INSTR_RRE_RR },
757 { "spctr", 0xe1, INSTR_RRE_RR },
758 { "ecctr", 0xe4, INSTR_RRE_RR },
759 { "epctr", 0xe5, INSTR_RRE_RR },
760 { "ppa", 0xe8, INSTR_RRF_U0RR },
761 { "etnd", 0xec, INSTR_RRE_R0 },
762 { "ecpga", 0xed, INSTR_RRE_RR },
763 { "tend", 0xf8, INSTR_S_00 },
764 { "niai", 0xfa, INSTR_IE_UU },
619 { { 0, LONG_INSN_TABORT }, 0xfc, INSTR_S_RD }, 765 { { 0, LONG_INSN_TABORT }, 0xfc, INSTR_S_RD },
620 { "tend", 0xf8, INSTR_S_RD },
621#endif 766#endif
622 { "stidp", 0x02, INSTR_S_RD }, 767 { "stidp", 0x02, INSTR_S_RD },
623 { "sck", 0x04, INSTR_S_RD }, 768 { "sck", 0x04, INSTR_S_RD },
@@ -635,8 +780,8 @@ static struct insn opcode_b2[] = {
635 { "sie", 0x14, INSTR_S_RD }, 780 { "sie", 0x14, INSTR_S_RD },
636 { "pc", 0x18, INSTR_S_RD }, 781 { "pc", 0x18, INSTR_S_RD },
637 { "sac", 0x19, INSTR_S_RD }, 782 { "sac", 0x19, INSTR_S_RD },
638 { "servc", 0x20, INSTR_RRE_RR },
639 { "cfc", 0x1a, INSTR_S_RD }, 783 { "cfc", 0x1a, INSTR_S_RD },
784 { "servc", 0x20, INSTR_RRE_RR },
640 { "ipte", 0x21, INSTR_RRE_RR }, 785 { "ipte", 0x21, INSTR_RRE_RR },
641 { "ipm", 0x22, INSTR_RRE_R0 }, 786 { "ipm", 0x22, INSTR_RRE_R0 },
642 { "ivsk", 0x23, INSTR_RRE_RR }, 787 { "ivsk", 0x23, INSTR_RRE_RR },
@@ -647,9 +792,9 @@ static struct insn opcode_b2[] = {
647 { "pt", 0x28, INSTR_RRE_RR }, 792 { "pt", 0x28, INSTR_RRE_RR },
648 { "iske", 0x29, INSTR_RRE_RR }, 793 { "iske", 0x29, INSTR_RRE_RR },
649 { "rrbe", 0x2a, INSTR_RRE_RR }, 794 { "rrbe", 0x2a, INSTR_RRE_RR },
650 { "sske", 0x2b, INSTR_RRE_RR }, 795 { "sske", 0x2b, INSTR_RRF_M0RR },
651 { "tb", 0x2c, INSTR_RRE_0R }, 796 { "tb", 0x2c, INSTR_RRE_0R },
652 { "dxr", 0x2d, INSTR_RRE_F0 }, 797 { "dxr", 0x2d, INSTR_RRE_FF },
653 { "pgin", 0x2e, INSTR_RRE_RR }, 798 { "pgin", 0x2e, INSTR_RRE_RR },
654 { "pgout", 0x2f, INSTR_RRE_RR }, 799 { "pgout", 0x2f, INSTR_RRE_RR },
655 { "csch", 0x30, INSTR_S_00 }, 800 { "csch", 0x30, INSTR_S_00 },
@@ -667,8 +812,8 @@ static struct insn opcode_b2[] = {
667 { "schm", 0x3c, INSTR_S_00 }, 812 { "schm", 0x3c, INSTR_S_00 },
668 { "bakr", 0x40, INSTR_RRE_RR }, 813 { "bakr", 0x40, INSTR_RRE_RR },
669 { "cksm", 0x41, INSTR_RRE_RR }, 814 { "cksm", 0x41, INSTR_RRE_RR },
670 { "sqdr", 0x44, INSTR_RRE_F0 }, 815 { "sqdr", 0x44, INSTR_RRE_FF },
671 { "sqer", 0x45, INSTR_RRE_F0 }, 816 { "sqer", 0x45, INSTR_RRE_FF },
672 { "stura", 0x46, INSTR_RRE_RR }, 817 { "stura", 0x46, INSTR_RRE_RR },
673 { "msta", 0x47, INSTR_RRE_R0 }, 818 { "msta", 0x47, INSTR_RRE_R0 },
674 { "palb", 0x48, INSTR_RRE_00 }, 819 { "palb", 0x48, INSTR_RRE_00 },
@@ -694,14 +839,14 @@ static struct insn opcode_b2[] = {
694 { "rp", 0x77, INSTR_S_RD }, 839 { "rp", 0x77, INSTR_S_RD },
695 { "stcke", 0x78, INSTR_S_RD }, 840 { "stcke", 0x78, INSTR_S_RD },
696 { "sacf", 0x79, INSTR_S_RD }, 841 { "sacf", 0x79, INSTR_S_RD },
697 { "spp", 0x80, INSTR_S_RD },
698 { "stsi", 0x7d, INSTR_S_RD }, 842 { "stsi", 0x7d, INSTR_S_RD },
843 { "spp", 0x80, INSTR_S_RD },
699 { "srnm", 0x99, INSTR_S_RD }, 844 { "srnm", 0x99, INSTR_S_RD },
700 { "stfpc", 0x9c, INSTR_S_RD }, 845 { "stfpc", 0x9c, INSTR_S_RD },
701 { "lfpc", 0x9d, INSTR_S_RD }, 846 { "lfpc", 0x9d, INSTR_S_RD },
702 { "tre", 0xa5, INSTR_RRE_RR }, 847 { "tre", 0xa5, INSTR_RRE_RR },
703 { "cuutf", 0xa6, INSTR_RRE_RR }, 848 { "cuutf", 0xa6, INSTR_RRF_M0RR },
704 { "cutfu", 0xa7, INSTR_RRE_RR }, 849 { "cutfu", 0xa7, INSTR_RRF_M0RR },
705 { "stfl", 0xb1, INSTR_S_RD }, 850 { "stfl", 0xb1, INSTR_S_RD },
706 { "trap4", 0xff, INSTR_S_RD }, 851 { "trap4", 0xff, INSTR_S_RD },
707 { "", 0, INSTR_INVALID } 852 { "", 0, INSTR_INVALID }
@@ -715,72 +860,87 @@ static struct insn opcode_b3[] = {
715 { "myr", 0x3b, INSTR_RRF_F0FF }, 860 { "myr", 0x3b, INSTR_RRF_F0FF },
716 { "mayhr", 0x3c, INSTR_RRF_F0FF }, 861 { "mayhr", 0x3c, INSTR_RRF_F0FF },
717 { "myhr", 0x3d, INSTR_RRF_F0FF }, 862 { "myhr", 0x3d, INSTR_RRF_F0FF },
718 { "cegbr", 0xa4, INSTR_RRE_RR },
719 { "cdgbr", 0xa5, INSTR_RRE_RR },
720 { "cxgbr", 0xa6, INSTR_RRE_RR },
721 { "cgebr", 0xa8, INSTR_RRF_U0RF },
722 { "cgdbr", 0xa9, INSTR_RRF_U0RF },
723 { "cgxbr", 0xaa, INSTR_RRF_U0RF },
724 { "cfer", 0xb8, INSTR_RRF_U0RF },
725 { "cfdr", 0xb9, INSTR_RRF_U0RF },
726 { "cfxr", 0xba, INSTR_RRF_U0RF },
727 { "cegr", 0xc4, INSTR_RRE_RR },
728 { "cdgr", 0xc5, INSTR_RRE_RR },
729 { "cxgr", 0xc6, INSTR_RRE_RR },
730 { "cger", 0xc8, INSTR_RRF_U0RF },
731 { "cgdr", 0xc9, INSTR_RRF_U0RF },
732 { "cgxr", 0xca, INSTR_RRF_U0RF },
733 { "lpdfr", 0x70, INSTR_RRE_FF }, 863 { "lpdfr", 0x70, INSTR_RRE_FF },
734 { "lndfr", 0x71, INSTR_RRE_FF }, 864 { "lndfr", 0x71, INSTR_RRE_FF },
735 { "cpsdr", 0x72, INSTR_RRF_F0FF2 }, 865 { "cpsdr", 0x72, INSTR_RRF_F0FF2 },
736 { "lcdfr", 0x73, INSTR_RRE_FF }, 866 { "lcdfr", 0x73, INSTR_RRE_FF },
867 { "sfasr", 0x85, INSTR_RRE_R0 },
868 { { 0, LONG_INSN_CELFBR }, 0x90, INSTR_RRF_UUFR },
869 { { 0, LONG_INSN_CDLFBR }, 0x91, INSTR_RRF_UUFR },
870 { { 0, LONG_INSN_CXLFBR }, 0x92, INSTR_RRF_UURF },
871 { { 0, LONG_INSN_CEFBRA }, 0x94, INSTR_RRF_UUFR },
872 { { 0, LONG_INSN_CDFBRA }, 0x95, INSTR_RRF_UUFR },
873 { { 0, LONG_INSN_CXFBRA }, 0x96, INSTR_RRF_UURF },
874 { { 0, LONG_INSN_CFEBRA }, 0x98, INSTR_RRF_UURF },
875 { { 0, LONG_INSN_CFDBRA }, 0x99, INSTR_RRF_UURF },
876 { { 0, LONG_INSN_CFXBRA }, 0x9a, INSTR_RRF_UUFR },
877 { { 0, LONG_INSN_CLFEBR }, 0x9c, INSTR_RRF_UURF },
878 { { 0, LONG_INSN_CLFDBR }, 0x9d, INSTR_RRF_UURF },
879 { { 0, LONG_INSN_CLFXBR }, 0x9e, INSTR_RRF_UUFR },
880 { { 0, LONG_INSN_CELGBR }, 0xa0, INSTR_RRF_UUFR },
881 { { 0, LONG_INSN_CDLGBR }, 0xa1, INSTR_RRF_UUFR },
882 { { 0, LONG_INSN_CXLGBR }, 0xa2, INSTR_RRF_UURF },
883 { { 0, LONG_INSN_CEGBRA }, 0xa4, INSTR_RRF_UUFR },
884 { { 0, LONG_INSN_CDGBRA }, 0xa5, INSTR_RRF_UUFR },
885 { { 0, LONG_INSN_CXGBRA }, 0xa6, INSTR_RRF_UURF },
886 { { 0, LONG_INSN_CGEBRA }, 0xa8, INSTR_RRF_UURF },
887 { { 0, LONG_INSN_CGDBRA }, 0xa9, INSTR_RRF_UURF },
888 { { 0, LONG_INSN_CGXBRA }, 0xaa, INSTR_RRF_UUFR },
889 { { 0, LONG_INSN_CLGEBR }, 0xac, INSTR_RRF_UURF },
890 { { 0, LONG_INSN_CLGDBR }, 0xad, INSTR_RRF_UURF },
891 { { 0, LONG_INSN_CLGXBR }, 0xae, INSTR_RRF_UUFR },
737 { "ldgr", 0xc1, INSTR_RRE_FR }, 892 { "ldgr", 0xc1, INSTR_RRE_FR },
893 { "cegr", 0xc4, INSTR_RRE_FR },
894 { "cdgr", 0xc5, INSTR_RRE_FR },
895 { "cxgr", 0xc6, INSTR_RRE_FR },
896 { "cger", 0xc8, INSTR_RRF_U0RF },
897 { "cgdr", 0xc9, INSTR_RRF_U0RF },
898 { "cgxr", 0xca, INSTR_RRF_U0RF },
738 { "lgdr", 0xcd, INSTR_RRE_RF }, 899 { "lgdr", 0xcd, INSTR_RRE_RF },
739 { "adtr", 0xd2, INSTR_RRR_F0FF }, 900 { "mdtra", 0xd0, INSTR_RRF_FUFF2 },
740 { "axtr", 0xda, INSTR_RRR_F0FF }, 901 { "ddtra", 0xd1, INSTR_RRF_FUFF2 },
741 { "cdtr", 0xe4, INSTR_RRE_FF }, 902 { "adtra", 0xd2, INSTR_RRF_FUFF2 },
742 { "cxtr", 0xec, INSTR_RRE_FF }, 903 { "sdtra", 0xd3, INSTR_RRF_FUFF2 },
904 { "ldetr", 0xd4, INSTR_RRF_0UFF },
905 { "ledtr", 0xd5, INSTR_RRF_UUFF },
906 { "ltdtr", 0xd6, INSTR_RRE_FF },
907 { "fidtr", 0xd7, INSTR_RRF_UUFF },
908 { "mxtra", 0xd8, INSTR_RRF_FUFF2 },
909 { "dxtra", 0xd9, INSTR_RRF_FUFF2 },
910 { "axtra", 0xda, INSTR_RRF_FUFF2 },
911 { "sxtra", 0xdb, INSTR_RRF_FUFF2 },
912 { "lxdtr", 0xdc, INSTR_RRF_0UFF },
913 { "ldxtr", 0xdd, INSTR_RRF_UUFF },
914 { "ltxtr", 0xde, INSTR_RRE_FF },
915 { "fixtr", 0xdf, INSTR_RRF_UUFF },
743 { "kdtr", 0xe0, INSTR_RRE_FF }, 916 { "kdtr", 0xe0, INSTR_RRE_FF },
744 { "kxtr", 0xe8, INSTR_RRE_FF }, 917 { { 0, LONG_INSN_CGDTRA }, 0xe1, INSTR_RRF_UURF },
745 { "cedtr", 0xf4, INSTR_RRE_FF },
746 { "cextr", 0xfc, INSTR_RRE_FF },
747 { "cdgtr", 0xf1, INSTR_RRE_FR },
748 { "cxgtr", 0xf9, INSTR_RRE_FR },
749 { "cdstr", 0xf3, INSTR_RRE_FR },
750 { "cxstr", 0xfb, INSTR_RRE_FR },
751 { "cdutr", 0xf2, INSTR_RRE_FR },
752 { "cxutr", 0xfa, INSTR_RRE_FR },
753 { "cgdtr", 0xe1, INSTR_RRF_U0RF },
754 { "cgxtr", 0xe9, INSTR_RRF_U0RF },
755 { "csdtr", 0xe3, INSTR_RRE_RF },
756 { "csxtr", 0xeb, INSTR_RRE_RF },
757 { "cudtr", 0xe2, INSTR_RRE_RF }, 918 { "cudtr", 0xe2, INSTR_RRE_RF },
758 { "cuxtr", 0xea, INSTR_RRE_RF }, 919 { "csdtr", 0xe3, INSTR_RRE_RF },
759 { "ddtr", 0xd1, INSTR_RRR_F0FF }, 920 { "cdtr", 0xe4, INSTR_RRE_FF },
760 { "dxtr", 0xd9, INSTR_RRR_F0FF },
761 { "eedtr", 0xe5, INSTR_RRE_RF }, 921 { "eedtr", 0xe5, INSTR_RRE_RF },
762 { "eextr", 0xed, INSTR_RRE_RF },
763 { "esdtr", 0xe7, INSTR_RRE_RF }, 922 { "esdtr", 0xe7, INSTR_RRE_RF },
923 { "kxtr", 0xe8, INSTR_RRE_FF },
924 { { 0, LONG_INSN_CGXTRA }, 0xe9, INSTR_RRF_UUFR },
925 { "cuxtr", 0xea, INSTR_RRE_RF },
926 { "csxtr", 0xeb, INSTR_RRE_RF },
927 { "cxtr", 0xec, INSTR_RRE_FF },
928 { "eextr", 0xed, INSTR_RRE_RF },
764 { "esxtr", 0xef, INSTR_RRE_RF }, 929 { "esxtr", 0xef, INSTR_RRE_RF },
765 { "iedtr", 0xf6, INSTR_RRF_F0FR }, 930 { { 0, LONG_INSN_CDGTRA }, 0xf1, INSTR_RRF_UUFR },
766 { "iextr", 0xfe, INSTR_RRF_F0FR }, 931 { "cdutr", 0xf2, INSTR_RRE_FR },
767 { "ltdtr", 0xd6, INSTR_RRE_FF }, 932 { "cdstr", 0xf3, INSTR_RRE_FR },
768 { "ltxtr", 0xde, INSTR_RRE_FF }, 933 { "cedtr", 0xf4, INSTR_RRE_FF },
769 { "fidtr", 0xd7, INSTR_RRF_UUFF },
770 { "fixtr", 0xdf, INSTR_RRF_UUFF },
771 { "ldetr", 0xd4, INSTR_RRF_0UFF },
772 { "lxdtr", 0xdc, INSTR_RRF_0UFF },
773 { "ledtr", 0xd5, INSTR_RRF_UUFF },
774 { "ldxtr", 0xdd, INSTR_RRF_UUFF },
775 { "mdtr", 0xd0, INSTR_RRR_F0FF },
776 { "mxtr", 0xd8, INSTR_RRR_F0FF },
777 { "qadtr", 0xf5, INSTR_RRF_FUFF }, 934 { "qadtr", 0xf5, INSTR_RRF_FUFF },
778 { "qaxtr", 0xfd, INSTR_RRF_FUFF }, 935 { "iedtr", 0xf6, INSTR_RRF_F0FR },
779 { "rrdtr", 0xf7, INSTR_RRF_FFRU }, 936 { "rrdtr", 0xf7, INSTR_RRF_FFRU },
937 { { 0, LONG_INSN_CXGTRA }, 0xf9, INSTR_RRF_UURF },
938 { "cxutr", 0xfa, INSTR_RRE_FR },
939 { "cxstr", 0xfb, INSTR_RRE_FR },
940 { "cextr", 0xfc, INSTR_RRE_FF },
941 { "qaxtr", 0xfd, INSTR_RRF_FUFF },
942 { "iextr", 0xfe, INSTR_RRF_F0FR },
780 { "rrxtr", 0xff, INSTR_RRF_FFRU }, 943 { "rrxtr", 0xff, INSTR_RRF_FFRU },
781 { "sfasr", 0x85, INSTR_RRE_R0 },
782 { "sdtr", 0xd3, INSTR_RRR_F0FF },
783 { "sxtr", 0xdb, INSTR_RRR_F0FF },
784#endif 944#endif
785 { "lpebr", 0x00, INSTR_RRE_FF }, 945 { "lpebr", 0x00, INSTR_RRE_FF },
786 { "lnebr", 0x01, INSTR_RRE_FF }, 946 { "lnebr", 0x01, INSTR_RRE_FF },
@@ -827,10 +987,10 @@ static struct insn opcode_b3[] = {
827 { "lnxbr", 0x41, INSTR_RRE_FF }, 987 { "lnxbr", 0x41, INSTR_RRE_FF },
828 { "ltxbr", 0x42, INSTR_RRE_FF }, 988 { "ltxbr", 0x42, INSTR_RRE_FF },
829 { "lcxbr", 0x43, INSTR_RRE_FF }, 989 { "lcxbr", 0x43, INSTR_RRE_FF },
830 { "ledbr", 0x44, INSTR_RRE_FF }, 990 { { 0, LONG_INSN_LEDBRA }, 0x44, INSTR_RRF_UUFF },
831 { "ldxbr", 0x45, INSTR_RRE_FF }, 991 { { 0, LONG_INSN_LDXBRA }, 0x45, INSTR_RRF_UUFF },
832 { "lexbr", 0x46, INSTR_RRE_FF }, 992 { { 0, LONG_INSN_LEXBRA }, 0x46, INSTR_RRF_UUFF },
833 { "fixbr", 0x47, INSTR_RRF_U0FF }, 993 { { 0, LONG_INSN_FIXBRA }, 0x47, INSTR_RRF_UUFF },
834 { "kxbr", 0x48, INSTR_RRE_FF }, 994 { "kxbr", 0x48, INSTR_RRE_FF },
835 { "cxbr", 0x49, INSTR_RRE_FF }, 995 { "cxbr", 0x49, INSTR_RRE_FF },
836 { "axbr", 0x4a, INSTR_RRE_FF }, 996 { "axbr", 0x4a, INSTR_RRE_FF },
@@ -840,24 +1000,24 @@ static struct insn opcode_b3[] = {
840 { "tbedr", 0x50, INSTR_RRF_U0FF }, 1000 { "tbedr", 0x50, INSTR_RRF_U0FF },
841 { "tbdr", 0x51, INSTR_RRF_U0FF }, 1001 { "tbdr", 0x51, INSTR_RRF_U0FF },
842 { "diebr", 0x53, INSTR_RRF_FUFF }, 1002 { "diebr", 0x53, INSTR_RRF_FUFF },
843 { "fiebr", 0x57, INSTR_RRF_U0FF }, 1003 { { 0, LONG_INSN_FIEBRA }, 0x57, INSTR_RRF_UUFF },
844 { "thder", 0x58, INSTR_RRE_RR }, 1004 { "thder", 0x58, INSTR_RRE_FF },
845 { "thdr", 0x59, INSTR_RRE_RR }, 1005 { "thdr", 0x59, INSTR_RRE_FF },
846 { "didbr", 0x5b, INSTR_RRF_FUFF }, 1006 { "didbr", 0x5b, INSTR_RRF_FUFF },
847 { "fidbr", 0x5f, INSTR_RRF_U0FF }, 1007 { { 0, LONG_INSN_FIDBRA }, 0x5f, INSTR_RRF_UUFF },
848 { "lpxr", 0x60, INSTR_RRE_FF }, 1008 { "lpxr", 0x60, INSTR_RRE_FF },
849 { "lnxr", 0x61, INSTR_RRE_FF }, 1009 { "lnxr", 0x61, INSTR_RRE_FF },
850 { "ltxr", 0x62, INSTR_RRE_FF }, 1010 { "ltxr", 0x62, INSTR_RRE_FF },
851 { "lcxr", 0x63, INSTR_RRE_FF }, 1011 { "lcxr", 0x63, INSTR_RRE_FF },
852 { "lxr", 0x65, INSTR_RRE_RR }, 1012 { "lxr", 0x65, INSTR_RRE_FF },
853 { "lexr", 0x66, INSTR_RRE_FF }, 1013 { "lexr", 0x66, INSTR_RRE_FF },
854 { "fixr", 0x67, INSTR_RRF_U0FF }, 1014 { "fixr", 0x67, INSTR_RRE_FF },
855 { "cxr", 0x69, INSTR_RRE_FF }, 1015 { "cxr", 0x69, INSTR_RRE_FF },
856 { "lzer", 0x74, INSTR_RRE_R0 }, 1016 { "lzer", 0x74, INSTR_RRE_F0 },
857 { "lzdr", 0x75, INSTR_RRE_R0 }, 1017 { "lzdr", 0x75, INSTR_RRE_F0 },
858 { "lzxr", 0x76, INSTR_RRE_R0 }, 1018 { "lzxr", 0x76, INSTR_RRE_F0 },
859 { "fier", 0x77, INSTR_RRF_U0FF }, 1019 { "fier", 0x77, INSTR_RRE_FF },
860 { "fidr", 0x7f, INSTR_RRF_U0FF }, 1020 { "fidr", 0x7f, INSTR_RRE_FF },
861 { "sfpc", 0x84, INSTR_RRE_RR_OPT }, 1021 { "sfpc", 0x84, INSTR_RRE_RR_OPT },
862 { "efpc", 0x8c, INSTR_RRE_RR_OPT }, 1022 { "efpc", 0x8c, INSTR_RRE_RR_OPT },
863 { "cefbr", 0x94, INSTR_RRE_RF }, 1023 { "cefbr", 0x94, INSTR_RRE_RF },
@@ -866,9 +1026,12 @@ static struct insn opcode_b3[] = {
866 { "cfebr", 0x98, INSTR_RRF_U0RF }, 1026 { "cfebr", 0x98, INSTR_RRF_U0RF },
867 { "cfdbr", 0x99, INSTR_RRF_U0RF }, 1027 { "cfdbr", 0x99, INSTR_RRF_U0RF },
868 { "cfxbr", 0x9a, INSTR_RRF_U0RF }, 1028 { "cfxbr", 0x9a, INSTR_RRF_U0RF },
869 { "cefr", 0xb4, INSTR_RRE_RF }, 1029 { "cefr", 0xb4, INSTR_RRE_FR },
870 { "cdfr", 0xb5, INSTR_RRE_RF }, 1030 { "cdfr", 0xb5, INSTR_RRE_FR },
871 { "cxfr", 0xb6, INSTR_RRE_RF }, 1031 { "cxfr", 0xb6, INSTR_RRE_FR },
1032 { "cfer", 0xb8, INSTR_RRF_U0RF },
1033 { "cfdr", 0xb9, INSTR_RRF_U0RF },
1034 { "cfxr", 0xba, INSTR_RRF_U0RF },
872 { "", 0, INSTR_INVALID } 1035 { "", 0, INSTR_INVALID }
873}; 1036};
874 1037
@@ -910,7 +1073,23 @@ static struct insn opcode_b9[] = {
910 { "lhr", 0x27, INSTR_RRE_RR }, 1073 { "lhr", 0x27, INSTR_RRE_RR },
911 { "cgfr", 0x30, INSTR_RRE_RR }, 1074 { "cgfr", 0x30, INSTR_RRE_RR },
912 { "clgfr", 0x31, INSTR_RRE_RR }, 1075 { "clgfr", 0x31, INSTR_RRE_RR },
1076 { "cfdtr", 0x41, INSTR_RRF_UURF },
1077 { { 0, LONG_INSN_CLGDTR }, 0x42, INSTR_RRF_UURF },
1078 { { 0, LONG_INSN_CLFDTR }, 0x43, INSTR_RRF_UURF },
913 { "bctgr", 0x46, INSTR_RRE_RR }, 1079 { "bctgr", 0x46, INSTR_RRE_RR },
1080 { "cfxtr", 0x49, INSTR_RRF_UURF },
1081 { { 0, LONG_INSN_CLGXTR }, 0x4a, INSTR_RRF_UUFR },
1082 { { 0, LONG_INSN_CLFXTR }, 0x4b, INSTR_RRF_UUFR },
1083 { "cdftr", 0x51, INSTR_RRF_UUFR },
1084 { { 0, LONG_INSN_CDLGTR }, 0x52, INSTR_RRF_UUFR },
1085 { { 0, LONG_INSN_CDLFTR }, 0x53, INSTR_RRF_UUFR },
1086 { "cxftr", 0x59, INSTR_RRF_UURF },
1087 { { 0, LONG_INSN_CXLGTR }, 0x5a, INSTR_RRF_UURF },
1088 { { 0, LONG_INSN_CXLFTR }, 0x5b, INSTR_RRF_UUFR },
1089 { "cgrt", 0x60, INSTR_RRF_U0RR },
1090 { "clgrt", 0x61, INSTR_RRF_U0RR },
1091 { "crt", 0x72, INSTR_RRF_U0RR },
1092 { "clrt", 0x73, INSTR_RRF_U0RR },
914 { "ngr", 0x80, INSTR_RRE_RR }, 1093 { "ngr", 0x80, INSTR_RRE_RR },
915 { "ogr", 0x81, INSTR_RRE_RR }, 1094 { "ogr", 0x81, INSTR_RRE_RR },
916 { "xgr", 0x82, INSTR_RRE_RR }, 1095 { "xgr", 0x82, INSTR_RRE_RR },
@@ -923,32 +1102,34 @@ static struct insn opcode_b9[] = {
923 { "slbgr", 0x89, INSTR_RRE_RR }, 1102 { "slbgr", 0x89, INSTR_RRE_RR },
924 { "cspg", 0x8a, INSTR_RRE_RR }, 1103 { "cspg", 0x8a, INSTR_RRE_RR },
925 { "idte", 0x8e, INSTR_RRF_R0RR }, 1104 { "idte", 0x8e, INSTR_RRF_R0RR },
1105 { "crdte", 0x8f, INSTR_RRF_RMRR },
926 { "llcr", 0x94, INSTR_RRE_RR }, 1106 { "llcr", 0x94, INSTR_RRE_RR },
927 { "llhr", 0x95, INSTR_RRE_RR }, 1107 { "llhr", 0x95, INSTR_RRE_RR },
928 { "esea", 0x9d, INSTR_RRE_R0 }, 1108 { "esea", 0x9d, INSTR_RRE_R0 },
1109 { "ptf", 0xa2, INSTR_RRE_R0 },
929 { "lptea", 0xaa, INSTR_RRF_RURR }, 1110 { "lptea", 0xaa, INSTR_RRF_RURR },
1111 { "rrbm", 0xae, INSTR_RRE_RR },
1112 { "pfmf", 0xaf, INSTR_RRE_RR },
930 { "cu14", 0xb0, INSTR_RRF_M0RR }, 1113 { "cu14", 0xb0, INSTR_RRF_M0RR },
931 { "cu24", 0xb1, INSTR_RRF_M0RR }, 1114 { "cu24", 0xb1, INSTR_RRF_M0RR },
932 { "cu41", 0xb2, INSTR_RRF_M0RR }, 1115 { "cu41", 0xb2, INSTR_RRE_RR },
933 { "cu42", 0xb3, INSTR_RRF_M0RR }, 1116 { "cu42", 0xb3, INSTR_RRE_RR },
934 { "crt", 0x72, INSTR_RRF_U0RR },
935 { "cgrt", 0x60, INSTR_RRF_U0RR },
936 { "clrt", 0x73, INSTR_RRF_U0RR },
937 { "clgrt", 0x61, INSTR_RRF_U0RR },
938 { "ptf", 0xa2, INSTR_RRE_R0 },
939 { "pfmf", 0xaf, INSTR_RRE_RR },
940 { "trte", 0xbf, INSTR_RRF_M0RR },
941 { "trtre", 0xbd, INSTR_RRF_M0RR }, 1117 { "trtre", 0xbd, INSTR_RRF_M0RR },
1118 { "srstu", 0xbe, INSTR_RRE_RR },
1119 { "trte", 0xbf, INSTR_RRF_M0RR },
942 { "ahhhr", 0xc8, INSTR_RRF_R0RR2 }, 1120 { "ahhhr", 0xc8, INSTR_RRF_R0RR2 },
943 { "shhhr", 0xc9, INSTR_RRF_R0RR2 }, 1121 { "shhhr", 0xc9, INSTR_RRF_R0RR2 },
944 { "alhhh", 0xca, INSTR_RRF_R0RR2 }, 1122 { { 0, LONG_INSN_ALHHHR }, 0xca, INSTR_RRF_R0RR2 },
945 { "alhhl", 0xca, INSTR_RRF_R0RR2 }, 1123 { { 0, LONG_INSN_SLHHHR }, 0xcb, INSTR_RRF_R0RR2 },
946 { "slhhh", 0xcb, INSTR_RRF_R0RR2 }, 1124 { "chhr", 0xcd, INSTR_RRE_RR },
947 { "chhr ", 0xcd, INSTR_RRE_RR },
948 { "clhhr", 0xcf, INSTR_RRE_RR }, 1125 { "clhhr", 0xcf, INSTR_RRE_RR },
1126 { { 0, LONG_INSN_PCISTG }, 0xd0, INSTR_RRE_RR },
1127 { "pcilg", 0xd2, INSTR_RRE_RR },
1128 { "rpcit", 0xd3, INSTR_RRE_RR },
949 { "ahhlr", 0xd8, INSTR_RRF_R0RR2 }, 1129 { "ahhlr", 0xd8, INSTR_RRF_R0RR2 },
950 { "shhlr", 0xd9, INSTR_RRF_R0RR2 }, 1130 { "shhlr", 0xd9, INSTR_RRF_R0RR2 },
951 { "slhhl", 0xdb, INSTR_RRF_R0RR2 }, 1131 { { 0, LONG_INSN_ALHHLR }, 0xda, INSTR_RRF_R0RR2 },
1132 { { 0, LONG_INSN_SLHHLR }, 0xdb, INSTR_RRF_R0RR2 },
952 { "chlr", 0xdd, INSTR_RRE_RR }, 1133 { "chlr", 0xdd, INSTR_RRE_RR },
953 { "clhlr", 0xdf, INSTR_RRE_RR }, 1134 { "clhlr", 0xdf, INSTR_RRE_RR },
954 { { 0, LONG_INSN_POPCNT }, 0xe1, INSTR_RRE_RR }, 1135 { { 0, LONG_INSN_POPCNT }, 0xe1, INSTR_RRE_RR },
@@ -976,13 +1157,9 @@ static struct insn opcode_b9[] = {
976 { "kimd", 0x3e, INSTR_RRE_RR }, 1157 { "kimd", 0x3e, INSTR_RRE_RR },
977 { "klmd", 0x3f, INSTR_RRE_RR }, 1158 { "klmd", 0x3f, INSTR_RRE_RR },
978 { "epsw", 0x8d, INSTR_RRE_RR }, 1159 { "epsw", 0x8d, INSTR_RRE_RR },
979 { "trtt", 0x90, INSTR_RRE_RR },
980 { "trtt", 0x90, INSTR_RRF_M0RR }, 1160 { "trtt", 0x90, INSTR_RRF_M0RR },
981 { "trto", 0x91, INSTR_RRE_RR },
982 { "trto", 0x91, INSTR_RRF_M0RR }, 1161 { "trto", 0x91, INSTR_RRF_M0RR },
983 { "trot", 0x92, INSTR_RRE_RR },
984 { "trot", 0x92, INSTR_RRF_M0RR }, 1162 { "trot", 0x92, INSTR_RRF_M0RR },
985 { "troo", 0x93, INSTR_RRE_RR },
986 { "troo", 0x93, INSTR_RRF_M0RR }, 1163 { "troo", 0x93, INSTR_RRF_M0RR },
987 { "mlr", 0x96, INSTR_RRE_RR }, 1164 { "mlr", 0x96, INSTR_RRE_RR },
988 { "dlr", 0x97, INSTR_RRE_RR }, 1165 { "dlr", 0x97, INSTR_RRE_RR },
@@ -1013,6 +1190,8 @@ static struct insn opcode_c0[] = {
1013 1190
1014static struct insn opcode_c2[] = { 1191static struct insn opcode_c2[] = {
1015#ifdef CONFIG_64BIT 1192#ifdef CONFIG_64BIT
1193 { "msgfi", 0x00, INSTR_RIL_RI },
1194 { "msfi", 0x01, INSTR_RIL_RI },
1016 { "slgfi", 0x04, INSTR_RIL_RU }, 1195 { "slgfi", 0x04, INSTR_RIL_RU },
1017 { "slfi", 0x05, INSTR_RIL_RU }, 1196 { "slfi", 0x05, INSTR_RIL_RU },
1018 { "agfi", 0x08, INSTR_RIL_RI }, 1197 { "agfi", 0x08, INSTR_RIL_RI },
@@ -1023,43 +1202,41 @@ static struct insn opcode_c2[] = {
1023 { "cfi", 0x0d, INSTR_RIL_RI }, 1202 { "cfi", 0x0d, INSTR_RIL_RI },
1024 { "clgfi", 0x0e, INSTR_RIL_RU }, 1203 { "clgfi", 0x0e, INSTR_RIL_RU },
1025 { "clfi", 0x0f, INSTR_RIL_RU }, 1204 { "clfi", 0x0f, INSTR_RIL_RU },
1026 { "msfi", 0x01, INSTR_RIL_RI },
1027 { "msgfi", 0x00, INSTR_RIL_RI },
1028#endif 1205#endif
1029 { "", 0, INSTR_INVALID } 1206 { "", 0, INSTR_INVALID }
1030}; 1207};
1031 1208
1032static struct insn opcode_c4[] = { 1209static struct insn opcode_c4[] = {
1033#ifdef CONFIG_64BIT 1210#ifdef CONFIG_64BIT
1034 { "lrl", 0x0d, INSTR_RIL_RP }, 1211 { "llhrl", 0x02, INSTR_RIL_RP },
1212 { "lghrl", 0x04, INSTR_RIL_RP },
1213 { "lhrl", 0x05, INSTR_RIL_RP },
1214 { { 0, LONG_INSN_LLGHRL }, 0x06, INSTR_RIL_RP },
1215 { "sthrl", 0x07, INSTR_RIL_RP },
1035 { "lgrl", 0x08, INSTR_RIL_RP }, 1216 { "lgrl", 0x08, INSTR_RIL_RP },
1217 { "stgrl", 0x0b, INSTR_RIL_RP },
1036 { "lgfrl", 0x0c, INSTR_RIL_RP }, 1218 { "lgfrl", 0x0c, INSTR_RIL_RP },
1037 { "lhrl", 0x05, INSTR_RIL_RP }, 1219 { "lrl", 0x0d, INSTR_RIL_RP },
1038 { "lghrl", 0x04, INSTR_RIL_RP },
1039 { { 0, LONG_INSN_LLGFRL }, 0x0e, INSTR_RIL_RP }, 1220 { { 0, LONG_INSN_LLGFRL }, 0x0e, INSTR_RIL_RP },
1040 { "llhrl", 0x02, INSTR_RIL_RP },
1041 { { 0, LONG_INSN_LLGHRL }, 0x06, INSTR_RIL_RP },
1042 { "strl", 0x0f, INSTR_RIL_RP }, 1221 { "strl", 0x0f, INSTR_RIL_RP },
1043 { "stgrl", 0x0b, INSTR_RIL_RP },
1044 { "sthrl", 0x07, INSTR_RIL_RP },
1045#endif 1222#endif
1046 { "", 0, INSTR_INVALID } 1223 { "", 0, INSTR_INVALID }
1047}; 1224};
1048 1225
1049static struct insn opcode_c6[] = { 1226static struct insn opcode_c6[] = {
1050#ifdef CONFIG_64BIT 1227#ifdef CONFIG_64BIT
1051 { "crl", 0x0d, INSTR_RIL_RP }, 1228 { "exrl", 0x00, INSTR_RIL_RP },
1052 { "cgrl", 0x08, INSTR_RIL_RP }, 1229 { "pfdrl", 0x02, INSTR_RIL_UP },
1053 { "cgfrl", 0x0c, INSTR_RIL_RP },
1054 { "chrl", 0x05, INSTR_RIL_RP },
1055 { "cghrl", 0x04, INSTR_RIL_RP }, 1230 { "cghrl", 0x04, INSTR_RIL_RP },
1056 { "clrl", 0x0f, INSTR_RIL_RP }, 1231 { "chrl", 0x05, INSTR_RIL_RP },
1232 { { 0, LONG_INSN_CLGHRL }, 0x06, INSTR_RIL_RP },
1233 { "clhrl", 0x07, INSTR_RIL_RP },
1234 { "cgrl", 0x08, INSTR_RIL_RP },
1057 { "clgrl", 0x0a, INSTR_RIL_RP }, 1235 { "clgrl", 0x0a, INSTR_RIL_RP },
1236 { "cgfrl", 0x0c, INSTR_RIL_RP },
1237 { "crl", 0x0d, INSTR_RIL_RP },
1058 { { 0, LONG_INSN_CLGFRL }, 0x0e, INSTR_RIL_RP }, 1238 { { 0, LONG_INSN_CLGFRL }, 0x0e, INSTR_RIL_RP },
1059 { "clhrl", 0x07, INSTR_RIL_RP }, 1239 { "clrl", 0x0f, INSTR_RIL_RP },
1060 { { 0, LONG_INSN_CLGHRL }, 0x06, INSTR_RIL_RP },
1061 { "pfdrl", 0x02, INSTR_RIL_UP },
1062 { "exrl", 0x00, INSTR_RIL_RP },
1063#endif 1240#endif
1064 { "", 0, INSTR_INVALID } 1241 { "", 0, INSTR_INVALID }
1065}; 1242};
@@ -1070,7 +1247,7 @@ static struct insn opcode_c8[] = {
1070 { "ectg", 0x01, INSTR_SSF_RRDRD }, 1247 { "ectg", 0x01, INSTR_SSF_RRDRD },
1071 { "csst", 0x02, INSTR_SSF_RRDRD }, 1248 { "csst", 0x02, INSTR_SSF_RRDRD },
1072 { "lpd", 0x04, INSTR_SSF_RRDRD2 }, 1249 { "lpd", 0x04, INSTR_SSF_RRDRD2 },
1073 { "lpdg ", 0x05, INSTR_SSF_RRDRD2 }, 1250 { "lpdg", 0x05, INSTR_SSF_RRDRD2 },
1074#endif 1251#endif
1075 { "", 0, INSTR_INVALID } 1252 { "", 0, INSTR_INVALID }
1076}; 1253};
@@ -1080,9 +1257,9 @@ static struct insn opcode_cc[] = {
1080 { "brcth", 0x06, INSTR_RIL_RP }, 1257 { "brcth", 0x06, INSTR_RIL_RP },
1081 { "aih", 0x08, INSTR_RIL_RI }, 1258 { "aih", 0x08, INSTR_RIL_RI },
1082 { "alsih", 0x0a, INSTR_RIL_RI }, 1259 { "alsih", 0x0a, INSTR_RIL_RI },
1083 { "alsih", 0x0b, INSTR_RIL_RI }, 1260 { { 0, LONG_INSN_ALSIHN }, 0x0b, INSTR_RIL_RI },
1084 { "cih", 0x0d, INSTR_RIL_RI }, 1261 { "cih", 0x0d, INSTR_RIL_RI },
1085 { "clih ", 0x0f, INSTR_RIL_RI }, 1262 { "clih", 0x0f, INSTR_RIL_RI },
1086#endif 1263#endif
1087 { "", 0, INSTR_INVALID } 1264 { "", 0, INSTR_INVALID }
1088}; 1265};
@@ -1116,11 +1293,15 @@ static struct insn opcode_e3[] = {
1116 { "cg", 0x20, INSTR_RXY_RRRD }, 1293 { "cg", 0x20, INSTR_RXY_RRRD },
1117 { "clg", 0x21, INSTR_RXY_RRRD }, 1294 { "clg", 0x21, INSTR_RXY_RRRD },
1118 { "stg", 0x24, INSTR_RXY_RRRD }, 1295 { "stg", 0x24, INSTR_RXY_RRRD },
1296 { "ntstg", 0x25, INSTR_RXY_RRRD },
1119 { "cvdy", 0x26, INSTR_RXY_RRRD }, 1297 { "cvdy", 0x26, INSTR_RXY_RRRD },
1120 { "cvdg", 0x2e, INSTR_RXY_RRRD }, 1298 { "cvdg", 0x2e, INSTR_RXY_RRRD },
1121 { "strvg", 0x2f, INSTR_RXY_RRRD }, 1299 { "strvg", 0x2f, INSTR_RXY_RRRD },
1122 { "cgf", 0x30, INSTR_RXY_RRRD }, 1300 { "cgf", 0x30, INSTR_RXY_RRRD },
1123 { "clgf", 0x31, INSTR_RXY_RRRD }, 1301 { "clgf", 0x31, INSTR_RXY_RRRD },
1302 { "ltgf", 0x32, INSTR_RXY_RRRD },
1303 { "cgh", 0x34, INSTR_RXY_RRRD },
1304 { "pfd", 0x36, INSTR_RXY_URRD },
1124 { "strvh", 0x3f, INSTR_RXY_RRRD }, 1305 { "strvh", 0x3f, INSTR_RXY_RRRD },
1125 { "bctg", 0x46, INSTR_RXY_RRRD }, 1306 { "bctg", 0x46, INSTR_RXY_RRRD },
1126 { "sty", 0x50, INSTR_RXY_RRRD }, 1307 { "sty", 0x50, INSTR_RXY_RRRD },
@@ -1133,21 +1314,25 @@ static struct insn opcode_e3[] = {
1133 { "cy", 0x59, INSTR_RXY_RRRD }, 1314 { "cy", 0x59, INSTR_RXY_RRRD },
1134 { "ay", 0x5a, INSTR_RXY_RRRD }, 1315 { "ay", 0x5a, INSTR_RXY_RRRD },
1135 { "sy", 0x5b, INSTR_RXY_RRRD }, 1316 { "sy", 0x5b, INSTR_RXY_RRRD },
1317 { "mfy", 0x5c, INSTR_RXY_RRRD },
1136 { "aly", 0x5e, INSTR_RXY_RRRD }, 1318 { "aly", 0x5e, INSTR_RXY_RRRD },
1137 { "sly", 0x5f, INSTR_RXY_RRRD }, 1319 { "sly", 0x5f, INSTR_RXY_RRRD },
1138 { "sthy", 0x70, INSTR_RXY_RRRD }, 1320 { "sthy", 0x70, INSTR_RXY_RRRD },
1139 { "lay", 0x71, INSTR_RXY_RRRD }, 1321 { "lay", 0x71, INSTR_RXY_RRRD },
1140 { "stcy", 0x72, INSTR_RXY_RRRD }, 1322 { "stcy", 0x72, INSTR_RXY_RRRD },
1141 { "icy", 0x73, INSTR_RXY_RRRD }, 1323 { "icy", 0x73, INSTR_RXY_RRRD },
1324 { "laey", 0x75, INSTR_RXY_RRRD },
1142 { "lb", 0x76, INSTR_RXY_RRRD }, 1325 { "lb", 0x76, INSTR_RXY_RRRD },
1143 { "lgb", 0x77, INSTR_RXY_RRRD }, 1326 { "lgb", 0x77, INSTR_RXY_RRRD },
1144 { "lhy", 0x78, INSTR_RXY_RRRD }, 1327 { "lhy", 0x78, INSTR_RXY_RRRD },
1145 { "chy", 0x79, INSTR_RXY_RRRD }, 1328 { "chy", 0x79, INSTR_RXY_RRRD },
1146 { "ahy", 0x7a, INSTR_RXY_RRRD }, 1329 { "ahy", 0x7a, INSTR_RXY_RRRD },
1147 { "shy", 0x7b, INSTR_RXY_RRRD }, 1330 { "shy", 0x7b, INSTR_RXY_RRRD },
1331 { "mhy", 0x7c, INSTR_RXY_RRRD },
1148 { "ng", 0x80, INSTR_RXY_RRRD }, 1332 { "ng", 0x80, INSTR_RXY_RRRD },
1149 { "og", 0x81, INSTR_RXY_RRRD }, 1333 { "og", 0x81, INSTR_RXY_RRRD },
1150 { "xg", 0x82, INSTR_RXY_RRRD }, 1334 { "xg", 0x82, INSTR_RXY_RRRD },
1335 { "lgat", 0x85, INSTR_RXY_RRRD },
1151 { "mlg", 0x86, INSTR_RXY_RRRD }, 1336 { "mlg", 0x86, INSTR_RXY_RRRD },
1152 { "dlg", 0x87, INSTR_RXY_RRRD }, 1337 { "dlg", 0x87, INSTR_RXY_RRRD },
1153 { "alcg", 0x88, INSTR_RXY_RRRD }, 1338 { "alcg", 0x88, INSTR_RXY_RRRD },
@@ -1158,23 +1343,22 @@ static struct insn opcode_e3[] = {
1158 { "llgh", 0x91, INSTR_RXY_RRRD }, 1343 { "llgh", 0x91, INSTR_RXY_RRRD },
1159 { "llc", 0x94, INSTR_RXY_RRRD }, 1344 { "llc", 0x94, INSTR_RXY_RRRD },
1160 { "llh", 0x95, INSTR_RXY_RRRD }, 1345 { "llh", 0x95, INSTR_RXY_RRRD },
1161 { "cgh", 0x34, INSTR_RXY_RRRD }, 1346 { { 0, LONG_INSN_LLGTAT }, 0x9c, INSTR_RXY_RRRD },
1162 { "laey", 0x75, INSTR_RXY_RRRD }, 1347 { { 0, LONG_INSN_LLGFAT }, 0x9d, INSTR_RXY_RRRD },
1163 { "ltgf", 0x32, INSTR_RXY_RRRD }, 1348 { "lat", 0x9f, INSTR_RXY_RRRD },
1164 { "mfy", 0x5c, INSTR_RXY_RRRD },
1165 { "mhy", 0x7c, INSTR_RXY_RRRD },
1166 { "pfd", 0x36, INSTR_RXY_URRD },
1167 { "lbh", 0xc0, INSTR_RXY_RRRD }, 1349 { "lbh", 0xc0, INSTR_RXY_RRRD },
1168 { "llch", 0xc2, INSTR_RXY_RRRD }, 1350 { "llch", 0xc2, INSTR_RXY_RRRD },
1169 { "stch", 0xc3, INSTR_RXY_RRRD }, 1351 { "stch", 0xc3, INSTR_RXY_RRRD },
1170 { "lhh", 0xc4, INSTR_RXY_RRRD }, 1352 { "lhh", 0xc4, INSTR_RXY_RRRD },
1171 { "llhh", 0xc6, INSTR_RXY_RRRD }, 1353 { "llhh", 0xc6, INSTR_RXY_RRRD },
1172 { "sthh", 0xc7, INSTR_RXY_RRRD }, 1354 { "sthh", 0xc7, INSTR_RXY_RRRD },
1355 { "lfhat", 0xc8, INSTR_RXY_RRRD },
1173 { "lfh", 0xca, INSTR_RXY_RRRD }, 1356 { "lfh", 0xca, INSTR_RXY_RRRD },
1174 { "stfh", 0xcb, INSTR_RXY_RRRD }, 1357 { "stfh", 0xcb, INSTR_RXY_RRRD },
1175 { "chf", 0xcd, INSTR_RXY_RRRD }, 1358 { "chf", 0xcd, INSTR_RXY_RRRD },
1176 { "clhf", 0xcf, INSTR_RXY_RRRD }, 1359 { "clhf", 0xcf, INSTR_RXY_RRRD },
1177 { "ntstg", 0x25, INSTR_RXY_RRRD }, 1360 { { 0, LONG_INSN_MPCIFC }, 0xd0, INSTR_RXY_RRRD },
1361 { { 0, LONG_INSN_STPCIFC }, 0xd4, INSTR_RXY_RRRD },
1178#endif 1362#endif
1179 { "lrv", 0x1e, INSTR_RXY_RRRD }, 1363 { "lrv", 0x1e, INSTR_RXY_RRRD },
1180 { "lrvh", 0x1f, INSTR_RXY_RRRD }, 1364 { "lrvh", 0x1f, INSTR_RXY_RRRD },
@@ -1189,15 +1373,15 @@ static struct insn opcode_e3[] = {
1189static struct insn opcode_e5[] = { 1373static struct insn opcode_e5[] = {
1190#ifdef CONFIG_64BIT 1374#ifdef CONFIG_64BIT
1191 { "strag", 0x02, INSTR_SSE_RDRD }, 1375 { "strag", 0x02, INSTR_SSE_RDRD },
1376 { "mvhhi", 0x44, INSTR_SIL_RDI },
1377 { "mvghi", 0x48, INSTR_SIL_RDI },
1378 { "mvhi", 0x4c, INSTR_SIL_RDI },
1192 { "chhsi", 0x54, INSTR_SIL_RDI }, 1379 { "chhsi", 0x54, INSTR_SIL_RDI },
1193 { "chsi", 0x5c, INSTR_SIL_RDI },
1194 { "cghsi", 0x58, INSTR_SIL_RDI },
1195 { { 0, LONG_INSN_CLHHSI }, 0x55, INSTR_SIL_RDU }, 1380 { { 0, LONG_INSN_CLHHSI }, 0x55, INSTR_SIL_RDU },
1196 { { 0, LONG_INSN_CLFHSI }, 0x5d, INSTR_SIL_RDU }, 1381 { "cghsi", 0x58, INSTR_SIL_RDI },
1197 { { 0, LONG_INSN_CLGHSI }, 0x59, INSTR_SIL_RDU }, 1382 { { 0, LONG_INSN_CLGHSI }, 0x59, INSTR_SIL_RDU },
1198 { "mvhhi", 0x44, INSTR_SIL_RDI }, 1383 { "chsi", 0x5c, INSTR_SIL_RDI },
1199 { "mvhi", 0x4c, INSTR_SIL_RDI }, 1384 { { 0, LONG_INSN_CLFHSI }, 0x5d, INSTR_SIL_RDU },
1200 { "mvghi", 0x48, INSTR_SIL_RDI },
1201 { { 0, LONG_INSN_TBEGIN }, 0x60, INSTR_SIL_RDU }, 1385 { { 0, LONG_INSN_TBEGIN }, 0x60, INSTR_SIL_RDU },
1202 { { 0, LONG_INSN_TBEGINC }, 0x61, INSTR_SIL_RDU }, 1386 { { 0, LONG_INSN_TBEGINC }, 0x61, INSTR_SIL_RDU },
1203#endif 1387#endif
@@ -1220,9 +1404,11 @@ static struct insn opcode_eb[] = {
1220 { "rllg", 0x1c, INSTR_RSY_RRRD }, 1404 { "rllg", 0x1c, INSTR_RSY_RRRD },
1221 { "clmh", 0x20, INSTR_RSY_RURD }, 1405 { "clmh", 0x20, INSTR_RSY_RURD },
1222 { "clmy", 0x21, INSTR_RSY_RURD }, 1406 { "clmy", 0x21, INSTR_RSY_RURD },
1407 { "clt", 0x23, INSTR_RSY_RURD },
1223 { "stmg", 0x24, INSTR_RSY_RRRD }, 1408 { "stmg", 0x24, INSTR_RSY_RRRD },
1224 { "stctg", 0x25, INSTR_RSY_CCRD }, 1409 { "stctg", 0x25, INSTR_RSY_CCRD },
1225 { "stmh", 0x26, INSTR_RSY_RRRD }, 1410 { "stmh", 0x26, INSTR_RSY_RRRD },
1411 { "clgt", 0x2b, INSTR_RSY_RURD },
1226 { "stcmh", 0x2c, INSTR_RSY_RURD }, 1412 { "stcmh", 0x2c, INSTR_RSY_RURD },
1227 { "stcmy", 0x2d, INSTR_RSY_RURD }, 1413 { "stcmy", 0x2d, INSTR_RSY_RURD },
1228 { "lctlg", 0x2f, INSTR_RSY_CCRD }, 1414 { "lctlg", 0x2f, INSTR_RSY_CCRD },
@@ -1231,16 +1417,17 @@ static struct insn opcode_eb[] = {
1231 { "cdsg", 0x3e, INSTR_RSY_RRRD }, 1417 { "cdsg", 0x3e, INSTR_RSY_RRRD },
1232 { "bxhg", 0x44, INSTR_RSY_RRRD }, 1418 { "bxhg", 0x44, INSTR_RSY_RRRD },
1233 { "bxleg", 0x45, INSTR_RSY_RRRD }, 1419 { "bxleg", 0x45, INSTR_RSY_RRRD },
1420 { "ecag", 0x4c, INSTR_RSY_RRRD },
1234 { "tmy", 0x51, INSTR_SIY_URD }, 1421 { "tmy", 0x51, INSTR_SIY_URD },
1235 { "mviy", 0x52, INSTR_SIY_URD }, 1422 { "mviy", 0x52, INSTR_SIY_URD },
1236 { "niy", 0x54, INSTR_SIY_URD }, 1423 { "niy", 0x54, INSTR_SIY_URD },
1237 { "cliy", 0x55, INSTR_SIY_URD }, 1424 { "cliy", 0x55, INSTR_SIY_URD },
1238 { "oiy", 0x56, INSTR_SIY_URD }, 1425 { "oiy", 0x56, INSTR_SIY_URD },
1239 { "xiy", 0x57, INSTR_SIY_URD }, 1426 { "xiy", 0x57, INSTR_SIY_URD },
1240 { "lric", 0x60, INSTR_RSY_RDRM }, 1427 { "asi", 0x6a, INSTR_SIY_IRD },
1241 { "stric", 0x61, INSTR_RSY_RDRM }, 1428 { "alsi", 0x6e, INSTR_SIY_IRD },
1242 { "mric", 0x62, INSTR_RSY_RDRM }, 1429 { "agsi", 0x7a, INSTR_SIY_IRD },
1243 { "icmh", 0x80, INSTR_RSE_RURD }, 1430 { "algsi", 0x7e, INSTR_SIY_IRD },
1244 { "icmh", 0x80, INSTR_RSY_RURD }, 1431 { "icmh", 0x80, INSTR_RSY_RURD },
1245 { "icmy", 0x81, INSTR_RSY_RURD }, 1432 { "icmy", 0x81, INSTR_RSY_RURD },
1246 { "clclu", 0x8f, INSTR_RSY_RRRD }, 1433 { "clclu", 0x8f, INSTR_RSY_RRRD },
@@ -1249,11 +1436,8 @@ static struct insn opcode_eb[] = {
1249 { "lmy", 0x98, INSTR_RSY_RRRD }, 1436 { "lmy", 0x98, INSTR_RSY_RRRD },
1250 { "lamy", 0x9a, INSTR_RSY_AARD }, 1437 { "lamy", 0x9a, INSTR_RSY_AARD },
1251 { "stamy", 0x9b, INSTR_RSY_AARD }, 1438 { "stamy", 0x9b, INSTR_RSY_AARD },
1252 { "asi", 0x6a, INSTR_SIY_IRD }, 1439 { { 0, LONG_INSN_PCISTB }, 0xd0, INSTR_RSY_RRRD },
1253 { "agsi", 0x7a, INSTR_SIY_IRD }, 1440 { "sic", 0xd1, INSTR_RSY_RRRD },
1254 { "alsi", 0x6e, INSTR_SIY_IRD },
1255 { "algsi", 0x7e, INSTR_SIY_IRD },
1256 { "ecag", 0x4c, INSTR_RSY_RRRD },
1257 { "srak", 0xdc, INSTR_RSY_RRRD }, 1441 { "srak", 0xdc, INSTR_RSY_RRRD },
1258 { "slak", 0xdd, INSTR_RSY_RRRD }, 1442 { "slak", 0xdd, INSTR_RSY_RRRD },
1259 { "srlk", 0xde, INSTR_RSY_RRRD }, 1443 { "srlk", 0xde, INSTR_RSY_RRRD },
@@ -1272,6 +1456,9 @@ static struct insn opcode_eb[] = {
1272 { "lax", 0xf7, INSTR_RSY_RRRD }, 1456 { "lax", 0xf7, INSTR_RSY_RRRD },
1273 { "laa", 0xf8, INSTR_RSY_RRRD }, 1457 { "laa", 0xf8, INSTR_RSY_RRRD },
1274 { "laal", 0xfa, INSTR_RSY_RRRD }, 1458 { "laal", 0xfa, INSTR_RSY_RRRD },
1459 { "lric", 0x60, INSTR_RSY_RDRM },
1460 { "stric", 0x61, INSTR_RSY_RDRM },
1461 { "mric", 0x62, INSTR_RSY_RDRM },
1275#endif 1462#endif
1276 { "rll", 0x1d, INSTR_RSY_RRRD }, 1463 { "rll", 0x1d, INSTR_RSY_RRRD },
1277 { "mvclu", 0x8e, INSTR_RSY_RRRD }, 1464 { "mvclu", 0x8e, INSTR_RSY_RRRD },
@@ -1283,36 +1470,37 @@ static struct insn opcode_ec[] = {
1283#ifdef CONFIG_64BIT 1470#ifdef CONFIG_64BIT
1284 { "brxhg", 0x44, INSTR_RIE_RRP }, 1471 { "brxhg", 0x44, INSTR_RIE_RRP },
1285 { "brxlg", 0x45, INSTR_RIE_RRP }, 1472 { "brxlg", 0x45, INSTR_RIE_RRP },
1286 { "crb", 0xf6, INSTR_RRS_RRRDU }, 1473 { { 0, LONG_INSN_RISBLG }, 0x51, INSTR_RIE_RRUUU },
1287 { "cgrb", 0xe4, INSTR_RRS_RRRDU }, 1474 { "rnsbg", 0x54, INSTR_RIE_RRUUU },
1288 { "crj", 0x76, INSTR_RIE_RRPU }, 1475 { "risbg", 0x55, INSTR_RIE_RRUUU },
1476 { "rosbg", 0x56, INSTR_RIE_RRUUU },
1477 { "rxsbg", 0x57, INSTR_RIE_RRUUU },
1478 { { 0, LONG_INSN_RISBGN }, 0x59, INSTR_RIE_RRUUU },
1479 { { 0, LONG_INSN_RISBHG }, 0x5D, INSTR_RIE_RRUUU },
1289 { "cgrj", 0x64, INSTR_RIE_RRPU }, 1480 { "cgrj", 0x64, INSTR_RIE_RRPU },
1290 { "cib", 0xfe, INSTR_RIS_RURDI }, 1481 { "clgrj", 0x65, INSTR_RIE_RRPU },
1291 { "cgib", 0xfc, INSTR_RIS_RURDI },
1292 { "cij", 0x7e, INSTR_RIE_RUPI },
1293 { "cgij", 0x7c, INSTR_RIE_RUPI },
1294 { "cit", 0x72, INSTR_RIE_R0IU },
1295 { "cgit", 0x70, INSTR_RIE_R0IU }, 1482 { "cgit", 0x70, INSTR_RIE_R0IU },
1296 { "clrb", 0xf7, INSTR_RRS_RRRDU }, 1483 { "clgit", 0x71, INSTR_RIE_R0UU },
1297 { "clgrb", 0xe5, INSTR_RRS_RRRDU }, 1484 { "cit", 0x72, INSTR_RIE_R0IU },
1485 { "clfit", 0x73, INSTR_RIE_R0UU },
1486 { "crj", 0x76, INSTR_RIE_RRPU },
1298 { "clrj", 0x77, INSTR_RIE_RRPU }, 1487 { "clrj", 0x77, INSTR_RIE_RRPU },
1299 { "clgrj", 0x65, INSTR_RIE_RRPU }, 1488 { "cgij", 0x7c, INSTR_RIE_RUPI },
1300 { "clib", 0xff, INSTR_RIS_RURDU },
1301 { "clgib", 0xfd, INSTR_RIS_RURDU },
1302 { "clij", 0x7f, INSTR_RIE_RUPU },
1303 { "clgij", 0x7d, INSTR_RIE_RUPU }, 1489 { "clgij", 0x7d, INSTR_RIE_RUPU },
1304 { "clfit", 0x73, INSTR_RIE_R0UU }, 1490 { "cij", 0x7e, INSTR_RIE_RUPI },
1305 { "clgit", 0x71, INSTR_RIE_R0UU }, 1491 { "clij", 0x7f, INSTR_RIE_RUPU },
1306 { "rnsbg", 0x54, INSTR_RIE_RRUUU },
1307 { "rxsbg", 0x57, INSTR_RIE_RRUUU },
1308 { "rosbg", 0x56, INSTR_RIE_RRUUU },
1309 { "risbg", 0x55, INSTR_RIE_RRUUU },
1310 { { 0, LONG_INSN_RISBLG }, 0x51, INSTR_RIE_RRUUU },
1311 { { 0, LONG_INSN_RISBHG }, 0x5D, INSTR_RIE_RRUUU },
1312 { "ahik", 0xd8, INSTR_RIE_RRI0 }, 1492 { "ahik", 0xd8, INSTR_RIE_RRI0 },
1313 { "aghik", 0xd9, INSTR_RIE_RRI0 }, 1493 { "aghik", 0xd9, INSTR_RIE_RRI0 },
1314 { { 0, LONG_INSN_ALHSIK }, 0xda, INSTR_RIE_RRI0 }, 1494 { { 0, LONG_INSN_ALHSIK }, 0xda, INSTR_RIE_RRI0 },
1315 { { 0, LONG_INSN_ALGHSIK }, 0xdb, INSTR_RIE_RRI0 }, 1495 { { 0, LONG_INSN_ALGHSIK }, 0xdb, INSTR_RIE_RRI0 },
1496 { "cgrb", 0xe4, INSTR_RRS_RRRDU },
1497 { "clgrb", 0xe5, INSTR_RRS_RRRDU },
1498 { "crb", 0xf6, INSTR_RRS_RRRDU },
1499 { "clrb", 0xf7, INSTR_RRS_RRRDU },
1500 { "cgib", 0xfc, INSTR_RIS_RURDI },
1501 { "clgib", 0xfd, INSTR_RIS_RURDU },
1502 { "cib", 0xfe, INSTR_RIS_RURDI },
1503 { "clib", 0xff, INSTR_RIS_RURDU },
1316#endif 1504#endif
1317 { "", 0, INSTR_INVALID } 1505 { "", 0, INSTR_INVALID }
1318}; 1506};
@@ -1325,20 +1513,24 @@ static struct insn opcode_ed[] = {
1325 { "my", 0x3b, INSTR_RXF_FRRDF }, 1513 { "my", 0x3b, INSTR_RXF_FRRDF },
1326 { "mayh", 0x3c, INSTR_RXF_FRRDF }, 1514 { "mayh", 0x3c, INSTR_RXF_FRRDF },
1327 { "myh", 0x3d, INSTR_RXF_FRRDF }, 1515 { "myh", 0x3d, INSTR_RXF_FRRDF },
1328 { "ley", 0x64, INSTR_RXY_FRRD },
1329 { "ldy", 0x65, INSTR_RXY_FRRD },
1330 { "stey", 0x66, INSTR_RXY_FRRD },
1331 { "stdy", 0x67, INSTR_RXY_FRRD },
1332 { "sldt", 0x40, INSTR_RXF_FRRDF }, 1516 { "sldt", 0x40, INSTR_RXF_FRRDF },
1333 { "slxt", 0x48, INSTR_RXF_FRRDF },
1334 { "srdt", 0x41, INSTR_RXF_FRRDF }, 1517 { "srdt", 0x41, INSTR_RXF_FRRDF },
1518 { "slxt", 0x48, INSTR_RXF_FRRDF },
1335 { "srxt", 0x49, INSTR_RXF_FRRDF }, 1519 { "srxt", 0x49, INSTR_RXF_FRRDF },
1336 { "tdcet", 0x50, INSTR_RXE_FRRD }, 1520 { "tdcet", 0x50, INSTR_RXE_FRRD },
1337 { "tdcdt", 0x54, INSTR_RXE_FRRD },
1338 { "tdcxt", 0x58, INSTR_RXE_FRRD },
1339 { "tdget", 0x51, INSTR_RXE_FRRD }, 1521 { "tdget", 0x51, INSTR_RXE_FRRD },
1522 { "tdcdt", 0x54, INSTR_RXE_FRRD },
1340 { "tdgdt", 0x55, INSTR_RXE_FRRD }, 1523 { "tdgdt", 0x55, INSTR_RXE_FRRD },
1524 { "tdcxt", 0x58, INSTR_RXE_FRRD },
1341 { "tdgxt", 0x59, INSTR_RXE_FRRD }, 1525 { "tdgxt", 0x59, INSTR_RXE_FRRD },
1526 { "ley", 0x64, INSTR_RXY_FRRD },
1527 { "ldy", 0x65, INSTR_RXY_FRRD },
1528 { "stey", 0x66, INSTR_RXY_FRRD },
1529 { "stdy", 0x67, INSTR_RXY_FRRD },
1530 { "czdt", 0xa8, INSTR_RSL_LRDFU },
1531 { "czxt", 0xa9, INSTR_RSL_LRDFU },
1532 { "cdzt", 0xaa, INSTR_RSL_LRDFU },
1533 { "cxzt", 0xab, INSTR_RSL_LRDFU },
1342#endif 1534#endif
1343 { "ldeb", 0x04, INSTR_RXE_FRRD }, 1535 { "ldeb", 0x04, INSTR_RXE_FRRD },
1344 { "lxdb", 0x05, INSTR_RXE_FRRD }, 1536 { "lxdb", 0x05, INSTR_RXE_FRRD },
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index ef46f66bc0d..55022852326 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -231,12 +231,12 @@ sysc_work:
231 jo sysc_mcck_pending 231 jo sysc_mcck_pending
232 tm __TI_flags+3(%r12),_TIF_NEED_RESCHED 232 tm __TI_flags+3(%r12),_TIF_NEED_RESCHED
233 jo sysc_reschedule 233 jo sysc_reschedule
234 tm __TI_flags+3(%r12),_TIF_PER_TRAP
235 jo sysc_singlestep
234 tm __TI_flags+3(%r12),_TIF_SIGPENDING 236 tm __TI_flags+3(%r12),_TIF_SIGPENDING
235 jo sysc_sigpending 237 jo sysc_sigpending
236 tm __TI_flags+3(%r12),_TIF_NOTIFY_RESUME 238 tm __TI_flags+3(%r12),_TIF_NOTIFY_RESUME
237 jo sysc_notify_resume 239 jo sysc_notify_resume
238 tm __TI_flags+3(%r12),_TIF_PER_TRAP
239 jo sysc_singlestep
240 j sysc_return # beware of critical section cleanup 240 j sysc_return # beware of critical section cleanup
241 241
242# 242#
@@ -259,7 +259,6 @@ sysc_mcck_pending:
259# _TIF_SIGPENDING is set, call do_signal 259# _TIF_SIGPENDING is set, call do_signal
260# 260#
261sysc_sigpending: 261sysc_sigpending:
262 ni __TI_flags+3(%r12),255-_TIF_PER_TRAP # clear TIF_PER_TRAP
263 lr %r2,%r11 # pass pointer to pt_regs 262 lr %r2,%r11 # pass pointer to pt_regs
264 l %r1,BASED(.Ldo_signal) 263 l %r1,BASED(.Ldo_signal)
265 basr %r14,%r1 # call do_signal 264 basr %r14,%r1 # call do_signal
@@ -286,7 +285,7 @@ sysc_notify_resume:
286# _TIF_PER_TRAP is set, call do_per_trap 285# _TIF_PER_TRAP is set, call do_per_trap
287# 286#
288sysc_singlestep: 287sysc_singlestep:
289 ni __TI_flags+3(%r12),255-(_TIF_SYSCALL | _TIF_PER_TRAP) 288 ni __TI_flags+3(%r12),255-_TIF_PER_TRAP
290 lr %r2,%r11 # pass pointer to pt_regs 289 lr %r2,%r11 # pass pointer to pt_regs
291 l %r1,BASED(.Ldo_per_trap) 290 l %r1,BASED(.Ldo_per_trap)
292 la %r14,BASED(sysc_return) 291 la %r14,BASED(sysc_return)
@@ -330,40 +329,18 @@ ENTRY(ret_from_fork)
330 la %r11,STACK_FRAME_OVERHEAD(%r15) 329 la %r11,STACK_FRAME_OVERHEAD(%r15)
331 l %r12,__LC_THREAD_INFO 330 l %r12,__LC_THREAD_INFO
332 l %r13,__LC_SVC_NEW_PSW+4 331 l %r13,__LC_SVC_NEW_PSW+4
333 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ?
334 je 1f
335 l %r1,BASED(.Lschedule_tail)
336 basr %r14,%r1 # call schedule_tail
337 TRACE_IRQS_ON
338 ssm __LC_SVC_NEW_PSW # reenable interrupts
339 j sysc_tracenogo
340
3411: # it's a kernel thread
342 st %r15,__PT_R15(%r11) # store stack pointer for new kthread
343 l %r1,BASED(.Lschedule_tail) 332 l %r1,BASED(.Lschedule_tail)
344 basr %r14,%r1 # call schedule_tail 333 basr %r14,%r1 # call schedule_tail
345 TRACE_IRQS_ON 334 TRACE_IRQS_ON
346 ssm __LC_SVC_NEW_PSW # reenable interrupts 335 ssm __LC_SVC_NEW_PSW # reenable interrupts
347 lm %r9,%r11,__PT_R9(%r11) # load gprs 336 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ?
337 jne sysc_tracenogo
338 # it's a kernel thread
339 lm %r9,%r10,__PT_R9(%r11) # load gprs
348ENTRY(kernel_thread_starter) 340ENTRY(kernel_thread_starter)
349 la %r2,0(%r10) 341 la %r2,0(%r10)
350 basr %r14,%r9 342 basr %r14,%r9
351 la %r2,0 343 j sysc_tracenogo
352 br %r11 # do_exit
353
354#
355# kernel_execve function needs to deal with pt_regs that is not
356# at the usual place
357#
358ENTRY(ret_from_kernel_execve)
359 ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts
360 lr %r15,%r2
361 lr %r11,%r2
362 ahi %r15,-STACK_FRAME_OVERHEAD
363 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
364 l %r12,__LC_THREAD_INFO
365 ssm __LC_SVC_NEW_PSW # reenable interrupts
366 j sysc_return
367 344
368/* 345/*
369 * Program check handler routine 346 * Program check handler routine
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index d0d3f69a734..2711936fe70 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -6,7 +6,6 @@
6#include <asm/ptrace.h> 6#include <asm/ptrace.h>
7#include <asm/cputime.h> 7#include <asm/cputime.h>
8 8
9extern void (*pgm_check_table[128])(struct pt_regs *);
10extern void *restart_stack; 9extern void *restart_stack;
11 10
12void system_call(void); 11void system_call(void);
@@ -25,6 +24,26 @@ void do_protection_exception(struct pt_regs *regs);
25void do_dat_exception(struct pt_regs *regs); 24void do_dat_exception(struct pt_regs *regs);
26void do_asce_exception(struct pt_regs *regs); 25void do_asce_exception(struct pt_regs *regs);
27 26
27void addressing_exception(struct pt_regs *regs);
28void data_exception(struct pt_regs *regs);
29void default_trap_handler(struct pt_regs *regs);
30void divide_exception(struct pt_regs *regs);
31void execute_exception(struct pt_regs *regs);
32void hfp_divide_exception(struct pt_regs *regs);
33void hfp_overflow_exception(struct pt_regs *regs);
34void hfp_significance_exception(struct pt_regs *regs);
35void hfp_sqrt_exception(struct pt_regs *regs);
36void hfp_underflow_exception(struct pt_regs *regs);
37void illegal_op(struct pt_regs *regs);
38void operand_exception(struct pt_regs *regs);
39void overflow_exception(struct pt_regs *regs);
40void privileged_op(struct pt_regs *regs);
41void space_switch_exception(struct pt_regs *regs);
42void special_op_exception(struct pt_regs *regs);
43void specification_exception(struct pt_regs *regs);
44void transaction_exception(struct pt_regs *regs);
45void translation_exception(struct pt_regs *regs);
46
28void do_per_trap(struct pt_regs *regs); 47void do_per_trap(struct pt_regs *regs);
29void syscall_trace(struct pt_regs *regs, int entryexit); 48void syscall_trace(struct pt_regs *regs, int entryexit);
30void kernel_stack_overflow(struct pt_regs * regs); 49void kernel_stack_overflow(struct pt_regs * regs);
@@ -54,10 +73,6 @@ long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
54long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args); 73long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
55long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, 74long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
56 u32 len_low); 75 u32 len_low);
57long sys_fork(void);
58long sys_clone(unsigned long newsp, unsigned long clone_flags,
59 int __user *parent_tidptr, int __user *child_tidptr);
60long sys_vfork(void);
61long sys_sigsuspend(int history0, int history1, old_sigset_t mask); 76long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
62long sys_sigaction(int sig, const struct old_sigaction __user *act, 77long sys_sigaction(int sig, const struct old_sigaction __user *act,
63 struct old_sigaction __user *oact); 78 struct old_sigaction __user *oact);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 07d8de35398..6d34e0c97a3 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -80,14 +80,21 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
80#endif 80#endif
81 .endm 81 .endm
82 82
83 .macro HANDLE_SIE_INTERCEPT scratch 83 .macro HANDLE_SIE_INTERCEPT scratch,pgmcheck
84#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) 84#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
85 tmhh %r8,0x0001 # interrupting from user ? 85 tmhh %r8,0x0001 # interrupting from user ?
86 jnz .+42 86 jnz .+42
87 lgr \scratch,%r9 87 lgr \scratch,%r9
88 slg \scratch,BASED(.Lsie_loop) 88 slg \scratch,BASED(.Lsie_loop)
89 clg \scratch,BASED(.Lsie_length) 89 clg \scratch,BASED(.Lsie_length)
90 .if \pgmcheck
91 # Some program interrupts are suppressing (e.g. protection).
92 # We must also check the instruction after SIE in that case.
93 # do_protection_exception will rewind to rewind_pad
94 jh .+22
95 .else
90 jhe .+22 96 jhe .+22
97 .endif
91 lg %r9,BASED(.Lsie_loop) 98 lg %r9,BASED(.Lsie_loop)
92 SPP BASED(.Lhost_id) # set host id 99 SPP BASED(.Lhost_id) # set host id
93#endif 100#endif
@@ -262,12 +269,12 @@ sysc_work:
262 jo sysc_mcck_pending 269 jo sysc_mcck_pending
263 tm __TI_flags+7(%r12),_TIF_NEED_RESCHED 270 tm __TI_flags+7(%r12),_TIF_NEED_RESCHED
264 jo sysc_reschedule 271 jo sysc_reschedule
272 tm __TI_flags+7(%r12),_TIF_PER_TRAP
273 jo sysc_singlestep
265 tm __TI_flags+7(%r12),_TIF_SIGPENDING 274 tm __TI_flags+7(%r12),_TIF_SIGPENDING
266 jo sysc_sigpending 275 jo sysc_sigpending
267 tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME 276 tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME
268 jo sysc_notify_resume 277 jo sysc_notify_resume
269 tm __TI_flags+7(%r12),_TIF_PER_TRAP
270 jo sysc_singlestep
271 j sysc_return # beware of critical section cleanup 278 j sysc_return # beware of critical section cleanup
272 279
273# 280#
@@ -288,7 +295,6 @@ sysc_mcck_pending:
288# _TIF_SIGPENDING is set, call do_signal 295# _TIF_SIGPENDING is set, call do_signal
289# 296#
290sysc_sigpending: 297sysc_sigpending:
291 ni __TI_flags+7(%r12),255-_TIF_PER_TRAP # clear TIF_PER_TRAP
292 lgr %r2,%r11 # pass pointer to pt_regs 298 lgr %r2,%r11 # pass pointer to pt_regs
293 brasl %r14,do_signal 299 brasl %r14,do_signal
294 tm __TI_flags+7(%r12),_TIF_SYSCALL 300 tm __TI_flags+7(%r12),_TIF_SYSCALL
@@ -313,7 +319,7 @@ sysc_notify_resume:
313# _TIF_PER_TRAP is set, call do_per_trap 319# _TIF_PER_TRAP is set, call do_per_trap
314# 320#
315sysc_singlestep: 321sysc_singlestep:
316 ni __TI_flags+7(%r12),255-(_TIF_SYSCALL | _TIF_PER_TRAP) 322 ni __TI_flags+7(%r12),255-_TIF_PER_TRAP
317 lgr %r2,%r11 # pass pointer to pt_regs 323 lgr %r2,%r11 # pass pointer to pt_regs
318 larl %r14,sysc_return 324 larl %r14,sysc_return
319 jg do_per_trap 325 jg do_per_trap
@@ -352,33 +358,17 @@ sysc_tracenogo:
352ENTRY(ret_from_fork) 358ENTRY(ret_from_fork)
353 la %r11,STACK_FRAME_OVERHEAD(%r15) 359 la %r11,STACK_FRAME_OVERHEAD(%r15)
354 lg %r12,__LC_THREAD_INFO 360 lg %r12,__LC_THREAD_INFO
355 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ?
356 je 1f
357 brasl %r14,schedule_tail
358 TRACE_IRQS_ON
359 ssm __LC_SVC_NEW_PSW # reenable interrupts
360 j sysc_tracenogo
3611: # it's a kernel thread
362 stg %r15,__PT_R15(%r11) # store stack pointer for new kthread
363 brasl %r14,schedule_tail 361 brasl %r14,schedule_tail
364 TRACE_IRQS_ON 362 TRACE_IRQS_ON
365 ssm __LC_SVC_NEW_PSW # reenable interrupts 363 ssm __LC_SVC_NEW_PSW # reenable interrupts
366 lmg %r9,%r11,__PT_R9(%r11) # load gprs 364 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ?
365 jne sysc_tracenogo
366 # it's a kernel thread
367 lmg %r9,%r10,__PT_R9(%r11) # load gprs
367ENTRY(kernel_thread_starter) 368ENTRY(kernel_thread_starter)
368 la %r2,0(%r10) 369 la %r2,0(%r10)
369 basr %r14,%r9 370 basr %r14,%r9
370 la %r2,0 371 j sysc_tracenogo
371 br %r11 # do_exit
372
373ENTRY(ret_from_kernel_execve)
374 ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts
375 lgr %r15,%r2
376 lgr %r11,%r2
377 aghi %r15,-STACK_FRAME_OVERHEAD
378 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
379 lg %r12,__LC_THREAD_INFO
380 ssm __LC_SVC_NEW_PSW # reenable interrupts
381 j sysc_return
382 372
383/* 373/*
384 * Program check handler routine 374 * Program check handler routine
@@ -391,7 +381,7 @@ ENTRY(pgm_check_handler)
391 lg %r12,__LC_THREAD_INFO 381 lg %r12,__LC_THREAD_INFO
392 larl %r13,system_call 382 larl %r13,system_call
393 lmg %r8,%r9,__LC_PGM_OLD_PSW 383 lmg %r8,%r9,__LC_PGM_OLD_PSW
394 HANDLE_SIE_INTERCEPT %r14 384 HANDLE_SIE_INTERCEPT %r14,1
395 tmhh %r8,0x0001 # test problem state bit 385 tmhh %r8,0x0001 # test problem state bit
396 jnz 1f # -> fault in user space 386 jnz 1f # -> fault in user space
397 tmhh %r8,0x4000 # PER bit set in old PSW ? 387 tmhh %r8,0x4000 # PER bit set in old PSW ?
@@ -429,9 +419,9 @@ ENTRY(pgm_check_handler)
429 larl %r1,pgm_check_table 419 larl %r1,pgm_check_table
430 llgh %r10,__PT_INT_CODE+2(%r11) 420 llgh %r10,__PT_INT_CODE+2(%r11)
431 nill %r10,0x007f 421 nill %r10,0x007f
432 sll %r10,3 422 sll %r10,2
433 je sysc_return 423 je sysc_return
434 lg %r1,0(%r10,%r1) # load address of handler routine 424 lgf %r1,0(%r10,%r1) # load address of handler routine
435 lgr %r2,%r11 # pass pointer to pt_regs 425 lgr %r2,%r11 # pass pointer to pt_regs
436 basr %r14,%r1 # branch to interrupt-handler 426 basr %r14,%r1 # branch to interrupt-handler
437 j sysc_return 427 j sysc_return
@@ -467,7 +457,7 @@ ENTRY(io_int_handler)
467 lg %r12,__LC_THREAD_INFO 457 lg %r12,__LC_THREAD_INFO
468 larl %r13,system_call 458 larl %r13,system_call
469 lmg %r8,%r9,__LC_IO_OLD_PSW 459 lmg %r8,%r9,__LC_IO_OLD_PSW
470 HANDLE_SIE_INTERCEPT %r14 460 HANDLE_SIE_INTERCEPT %r14,0
471 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT 461 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT
472 tmhh %r8,0x0001 # interrupting from user? 462 tmhh %r8,0x0001 # interrupting from user?
473 jz io_skip 463 jz io_skip
@@ -613,7 +603,7 @@ ENTRY(ext_int_handler)
613 lg %r12,__LC_THREAD_INFO 603 lg %r12,__LC_THREAD_INFO
614 larl %r13,system_call 604 larl %r13,system_call
615 lmg %r8,%r9,__LC_EXT_OLD_PSW 605 lmg %r8,%r9,__LC_EXT_OLD_PSW
616 HANDLE_SIE_INTERCEPT %r14 606 HANDLE_SIE_INTERCEPT %r14,0
617 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT 607 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT
618 tmhh %r8,0x0001 # interrupting from user ? 608 tmhh %r8,0x0001 # interrupting from user ?
619 jz ext_skip 609 jz ext_skip
@@ -661,7 +651,7 @@ ENTRY(mcck_int_handler)
661 lg %r12,__LC_THREAD_INFO 651 lg %r12,__LC_THREAD_INFO
662 larl %r13,system_call 652 larl %r13,system_call
663 lmg %r8,%r9,__LC_MCK_OLD_PSW 653 lmg %r8,%r9,__LC_MCK_OLD_PSW
664 HANDLE_SIE_INTERCEPT %r14 654 HANDLE_SIE_INTERCEPT %r14,0
665 tm __LC_MCCK_CODE,0x80 # system damage? 655 tm __LC_MCCK_CODE,0x80 # system damage?
666 jo mcck_panic # yes -> rest of mcck code invalid 656 jo mcck_panic # yes -> rest of mcck code invalid
667 lghi %r14,__LC_CPU_TIMER_SAVE_AREA 657 lghi %r14,__LC_CPU_TIMER_SAVE_AREA
@@ -960,6 +950,13 @@ ENTRY(sie64a)
960 stg %r3,__SF_EMPTY+8(%r15) # save guest register save area 950 stg %r3,__SF_EMPTY+8(%r15) # save guest register save area
961 xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # host id == 0 951 xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # host id == 0
962 lmg %r0,%r13,0(%r3) # load guest gprs 0-13 952 lmg %r0,%r13,0(%r3) # load guest gprs 0-13
953# some program checks are suppressing. C code (e.g. do_protection_exception)
954# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other
955# instructions in the sie_loop should not cause program interrupts. So
956# lets use a nop (47 00 00 00) as a landing pad.
957# See also HANDLE_SIE_INTERCEPT
958rewind_pad:
959 nop 0
963sie_loop: 960sie_loop:
964 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 961 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
965 tm __TI_flags+7(%r14),_TIF_EXIT_SIE 962 tm __TI_flags+7(%r14),_TIF_EXIT_SIE
@@ -999,6 +996,7 @@ sie_fault:
999.Lhost_id: 996.Lhost_id:
1000 .quad 0 997 .quad 0
1001 998
999 EX_TABLE(rewind_pad,sie_fault)
1002 EX_TABLE(sie_loop,sie_fault) 1000 EX_TABLE(sie_loop,sie_fault)
1003#endif 1001#endif
1004 1002
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index 984726cbce1..fd8db63dfc9 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -393,30 +393,35 @@ ENTRY(startup_kdump)
393 xc 0x300(256),0x300 393 xc 0x300(256),0x300
394 xc 0xe00(256),0xe00 394 xc 0xe00(256),0xe00
395 stck __LC_LAST_UPDATE_CLOCK 395 stck __LC_LAST_UPDATE_CLOCK
396 spt 5f-.LPG0(%r13) 396 spt 6f-.LPG0(%r13)
397 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) 397 mvc __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
398 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST 398 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
399#ifndef CONFIG_MARCH_G5 399#ifndef CONFIG_MARCH_G5
400 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 400 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
401 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list 401 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list
402 tm __LC_STFL_FAC_LIST,0x01 # stfle available ? 402 tm __LC_STFL_FAC_LIST,0x01 # stfle available ?
403 jz 0f 403 jz 0f
404 la %r0,0 404 la %r0,1
405 .insn s,0xb2b00000,__LC_STFL_FAC_LIST # store facility list extended 405 .insn s,0xb2b00000,__LC_STFL_FAC_LIST # store facility list extended
4060: l %r0,__LC_STFL_FAC_LIST 406 # verify if all required facilities are supported by the machine
407 n %r0,2f+8-.LPG0(%r13) 4070: la %r1,__LC_STFL_FAC_LIST
408 cl %r0,2f+8-.LPG0(%r13) 408 la %r2,3f+8-.LPG0(%r13)
409 jne 1f 409 l %r3,0(%r2)
410 l %r0,__LC_STFL_FAC_LIST+4 4101: l %r0,0(%r1)
411 n %r0,2f+12-.LPG0(%r13) 411 n %r0,4(%r2)
412 cl %r0,2f+12-.LPG0(%r13) 412 cl %r0,4(%r2)
413 je 3f 413 jne 2f
4141: l %r15,.Lstack-.LPG0(%r13) 414 la %r1,4(%r1)
415 la %r2,4(%r2)
416 ahi %r3,-1
417 jnz 1b
418 j 4f
4192: l %r15,.Lstack-.LPG0(%r13)
415 ahi %r15,-96 420 ahi %r15,-96
416 la %r2,.Lals_string-.LPG0(%r13) 421 la %r2,.Lals_string-.LPG0(%r13)
417 l %r3,.Lsclp_print-.LPG0(%r13) 422 l %r3,.Lsclp_print-.LPG0(%r13)
418 basr %r14,%r3 423 basr %r14,%r3
419 lpsw 2f-.LPG0(%r13) # machine type not good enough, crash 424 lpsw 3f-.LPG0(%r13) # machine type not good enough, crash
420.Lals_string: 425.Lals_string:
421 .asciz "The Linux kernel requires more recent processor hardware" 426 .asciz "The Linux kernel requires more recent processor hardware"
422.Lsclp_print: 427.Lsclp_print:
@@ -424,33 +429,42 @@ ENTRY(startup_kdump)
424.Lstack: 429.Lstack:
425 .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER)) 430 .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
426 .align 16 431 .align 16
4272: .long 0x000a0000,0x8badcccc 4323: .long 0x000a0000,0x8badcccc
433
434# List of facilities that are required. If not all facilities are present
435# the kernel will crash. Format is number of facility words with bits set,
436# followed by the facility words.
437
428#if defined(CONFIG_64BIT) 438#if defined(CONFIG_64BIT)
429#if defined(CONFIG_MARCH_Z196) 439#if defined(CONFIG_MARCH_ZEC12)
430 .long 0xc100efe3, 0xf46c0000 440 .long 3, 0xc100efe3, 0xf46ce000, 0x00400000
441#elif defined(CONFIG_MARCH_Z196)
442 .long 2, 0xc100efe3, 0xf46c0000
431#elif defined(CONFIG_MARCH_Z10) 443#elif defined(CONFIG_MARCH_Z10)
432 .long 0xc100efe3, 0xf0680000 444 .long 2, 0xc100efe3, 0xf0680000
433#elif defined(CONFIG_MARCH_Z9_109) 445#elif defined(CONFIG_MARCH_Z9_109)
434 .long 0xc100efc3, 0x00000000 446 .long 1, 0xc100efc3
435#elif defined(CONFIG_MARCH_Z990) 447#elif defined(CONFIG_MARCH_Z990)
436 .long 0xc0002000, 0x00000000 448 .long 1, 0xc0002000
437#elif defined(CONFIG_MARCH_Z900) 449#elif defined(CONFIG_MARCH_Z900)
438 .long 0xc0000000, 0x00000000 450 .long 1, 0xc0000000
439#endif 451#endif
440#else 452#else
441#if defined(CONFIG_MARCH_Z196) 453#if defined(CONFIG_MARCH_ZEC12)
442 .long 0x8100c880, 0x00000000 454 .long 1, 0x8100c880
455#elif defined(CONFIG_MARCH_Z196)
456 .long 1, 0x8100c880
443#elif defined(CONFIG_MARCH_Z10) 457#elif defined(CONFIG_MARCH_Z10)
444 .long 0x8100c880, 0x00000000 458 .long 1, 0x8100c880
445#elif defined(CONFIG_MARCH_Z9_109) 459#elif defined(CONFIG_MARCH_Z9_109)
446 .long 0x8100c880, 0x00000000 460 .long 1, 0x8100c880
447#elif defined(CONFIG_MARCH_Z990) 461#elif defined(CONFIG_MARCH_Z990)
448 .long 0x80002000, 0x00000000 462 .long 1, 0x80002000
449#elif defined(CONFIG_MARCH_Z900) 463#elif defined(CONFIG_MARCH_Z900)
450 .long 0x80000000, 0x00000000 464 .long 1, 0x80000000
451#endif 465#endif
452#endif 466#endif
4533: 4674:
454#endif 468#endif
455 469
456#ifdef CONFIG_64BIT 470#ifdef CONFIG_64BIT
@@ -459,14 +473,14 @@ ENTRY(startup_kdump)
459 jg startup_continue 473 jg startup_continue
460#else 474#else
461 /* Continue with 31bit startup code in head31.S */ 475 /* Continue with 31bit startup code in head31.S */
462 l %r13,4f-.LPG0(%r13) 476 l %r13,5f-.LPG0(%r13)
463 b 0(%r13) 477 b 0(%r13)
464 .align 8 478 .align 8
4654: .long startup_continue 4795: .long startup_continue
466#endif 480#endif
467 481
468 .align 8 482 .align 8
4695: .long 0x7fffffff,0xffffffff 4836: .long 0x7fffffff,0xffffffff
470 484
471#include "head_kdump.S" 485#include "head_kdump.S"
472 486
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 6cdc55b26d6..bf24293970c 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -58,6 +58,8 @@ static const struct irq_class intrclass_names[] = {
58 [IOINT_APB] = {.name = "APB", .desc = "[I/O] AP Bus"}, 58 [IOINT_APB] = {.name = "APB", .desc = "[I/O] AP Bus"},
59 [IOINT_ADM] = {.name = "ADM", .desc = "[I/O] EADM Subchannel"}, 59 [IOINT_ADM] = {.name = "ADM", .desc = "[I/O] EADM Subchannel"},
60 [IOINT_CSC] = {.name = "CSC", .desc = "[I/O] CHSC Subchannel"}, 60 [IOINT_CSC] = {.name = "CSC", .desc = "[I/O] CHSC Subchannel"},
61 [IOINT_PCI] = {.name = "PCI", .desc = "[I/O] PCI Interrupt" },
62 [IOINT_MSI] = {.name = "MSI", .desc = "[I/O] MSI Interrupt" },
61 [NMI_NMI] = {.name = "NMI", .desc = "[NMI] Machine Check"}, 63 [NMI_NMI] = {.name = "NMI", .desc = "[NMI] Machine Check"},
62}; 64};
63 65
diff --git a/arch/s390/kernel/pgm_check.S b/arch/s390/kernel/pgm_check.S
new file mode 100644
index 00000000000..14bdecb6192
--- /dev/null
+++ b/arch/s390/kernel/pgm_check.S
@@ -0,0 +1,152 @@
1/*
2 * Program check table.
3 *
4 * Copyright IBM Corp. 2012
5 */
6
7#include <linux/linkage.h>
8
9#ifdef CONFIG_32BIT
10#define PGM_CHECK_64BIT(handler) .long default_trap_handler
11#else
12#define PGM_CHECK_64BIT(handler) .long handler
13#endif
14
15#define PGM_CHECK(handler) .long handler
16#define PGM_CHECK_DEFAULT PGM_CHECK(default_trap_handler)
17
18/*
19 * The program check table contains exactly 128 (0x00-0x7f) entries. Each
20 * line defines the 31 and/or 64 bit function to be called corresponding
21 * to the program check interruption code.
22 */
23.section .rodata, "a"
24ENTRY(pgm_check_table)
25PGM_CHECK_DEFAULT /* 00 */
26PGM_CHECK(illegal_op) /* 01 */
27PGM_CHECK(privileged_op) /* 02 */
28PGM_CHECK(execute_exception) /* 03 */
29PGM_CHECK(do_protection_exception) /* 04 */
30PGM_CHECK(addressing_exception) /* 05 */
31PGM_CHECK(specification_exception) /* 06 */
32PGM_CHECK(data_exception) /* 07 */
33PGM_CHECK(overflow_exception) /* 08 */
34PGM_CHECK(divide_exception) /* 09 */
35PGM_CHECK(overflow_exception) /* 0a */
36PGM_CHECK(divide_exception) /* 0b */
37PGM_CHECK(hfp_overflow_exception) /* 0c */
38PGM_CHECK(hfp_underflow_exception) /* 0d */
39PGM_CHECK(hfp_significance_exception) /* 0e */
40PGM_CHECK(hfp_divide_exception) /* 0f */
41PGM_CHECK(do_dat_exception) /* 10 */
42PGM_CHECK(do_dat_exception) /* 11 */
43PGM_CHECK(translation_exception) /* 12 */
44PGM_CHECK(special_op_exception) /* 13 */
45PGM_CHECK_DEFAULT /* 14 */
46PGM_CHECK(operand_exception) /* 15 */
47PGM_CHECK_DEFAULT /* 16 */
48PGM_CHECK_DEFAULT /* 17 */
49PGM_CHECK_64BIT(transaction_exception) /* 18 */
50PGM_CHECK_DEFAULT /* 19 */
51PGM_CHECK_DEFAULT /* 1a */
52PGM_CHECK_DEFAULT /* 1b */
53PGM_CHECK(space_switch_exception) /* 1c */
54PGM_CHECK(hfp_sqrt_exception) /* 1d */
55PGM_CHECK_DEFAULT /* 1e */
56PGM_CHECK_DEFAULT /* 1f */
57PGM_CHECK_DEFAULT /* 20 */
58PGM_CHECK_DEFAULT /* 21 */
59PGM_CHECK_DEFAULT /* 22 */
60PGM_CHECK_DEFAULT /* 23 */
61PGM_CHECK_DEFAULT /* 24 */
62PGM_CHECK_DEFAULT /* 25 */
63PGM_CHECK_DEFAULT /* 26 */
64PGM_CHECK_DEFAULT /* 27 */
65PGM_CHECK_DEFAULT /* 28 */
66PGM_CHECK_DEFAULT /* 29 */
67PGM_CHECK_DEFAULT /* 2a */
68PGM_CHECK_DEFAULT /* 2b */
69PGM_CHECK_DEFAULT /* 2c */
70PGM_CHECK_DEFAULT /* 2d */
71PGM_CHECK_DEFAULT /* 2e */
72PGM_CHECK_DEFAULT /* 2f */
73PGM_CHECK_DEFAULT /* 30 */
74PGM_CHECK_DEFAULT /* 31 */
75PGM_CHECK_DEFAULT /* 32 */
76PGM_CHECK_DEFAULT /* 33 */
77PGM_CHECK_DEFAULT /* 34 */
78PGM_CHECK_DEFAULT /* 35 */
79PGM_CHECK_DEFAULT /* 36 */
80PGM_CHECK_DEFAULT /* 37 */
81PGM_CHECK_64BIT(do_asce_exception) /* 38 */
82PGM_CHECK_64BIT(do_dat_exception) /* 39 */
83PGM_CHECK_64BIT(do_dat_exception) /* 3a */
84PGM_CHECK_64BIT(do_dat_exception) /* 3b */
85PGM_CHECK_DEFAULT /* 3c */
86PGM_CHECK_DEFAULT /* 3d */
87PGM_CHECK_DEFAULT /* 3e */
88PGM_CHECK_DEFAULT /* 3f */
89PGM_CHECK_DEFAULT /* 40 */
90PGM_CHECK_DEFAULT /* 41 */
91PGM_CHECK_DEFAULT /* 42 */
92PGM_CHECK_DEFAULT /* 43 */
93PGM_CHECK_DEFAULT /* 44 */
94PGM_CHECK_DEFAULT /* 45 */
95PGM_CHECK_DEFAULT /* 46 */
96PGM_CHECK_DEFAULT /* 47 */
97PGM_CHECK_DEFAULT /* 48 */
98PGM_CHECK_DEFAULT /* 49 */
99PGM_CHECK_DEFAULT /* 4a */
100PGM_CHECK_DEFAULT /* 4b */
101PGM_CHECK_DEFAULT /* 4c */
102PGM_CHECK_DEFAULT /* 4d */
103PGM_CHECK_DEFAULT /* 4e */
104PGM_CHECK_DEFAULT /* 4f */
105PGM_CHECK_DEFAULT /* 50 */
106PGM_CHECK_DEFAULT /* 51 */
107PGM_CHECK_DEFAULT /* 52 */
108PGM_CHECK_DEFAULT /* 53 */
109PGM_CHECK_DEFAULT /* 54 */
110PGM_CHECK_DEFAULT /* 55 */
111PGM_CHECK_DEFAULT /* 56 */
112PGM_CHECK_DEFAULT /* 57 */
113PGM_CHECK_DEFAULT /* 58 */
114PGM_CHECK_DEFAULT /* 59 */
115PGM_CHECK_DEFAULT /* 5a */
116PGM_CHECK_DEFAULT /* 5b */
117PGM_CHECK_DEFAULT /* 5c */
118PGM_CHECK_DEFAULT /* 5d */
119PGM_CHECK_DEFAULT /* 5e */
120PGM_CHECK_DEFAULT /* 5f */
121PGM_CHECK_DEFAULT /* 60 */
122PGM_CHECK_DEFAULT /* 61 */
123PGM_CHECK_DEFAULT /* 62 */
124PGM_CHECK_DEFAULT /* 63 */
125PGM_CHECK_DEFAULT /* 64 */
126PGM_CHECK_DEFAULT /* 65 */
127PGM_CHECK_DEFAULT /* 66 */
128PGM_CHECK_DEFAULT /* 67 */
129PGM_CHECK_DEFAULT /* 68 */
130PGM_CHECK_DEFAULT /* 69 */
131PGM_CHECK_DEFAULT /* 6a */
132PGM_CHECK_DEFAULT /* 6b */
133PGM_CHECK_DEFAULT /* 6c */
134PGM_CHECK_DEFAULT /* 6d */
135PGM_CHECK_DEFAULT /* 6e */
136PGM_CHECK_DEFAULT /* 6f */
137PGM_CHECK_DEFAULT /* 70 */
138PGM_CHECK_DEFAULT /* 71 */
139PGM_CHECK_DEFAULT /* 72 */
140PGM_CHECK_DEFAULT /* 73 */
141PGM_CHECK_DEFAULT /* 74 */
142PGM_CHECK_DEFAULT /* 75 */
143PGM_CHECK_DEFAULT /* 76 */
144PGM_CHECK_DEFAULT /* 77 */
145PGM_CHECK_DEFAULT /* 78 */
146PGM_CHECK_DEFAULT /* 79 */
147PGM_CHECK_DEFAULT /* 7a */
148PGM_CHECK_DEFAULT /* 7b */
149PGM_CHECK_DEFAULT /* 7c */
150PGM_CHECK_DEFAULT /* 7d */
151PGM_CHECK_DEFAULT /* 7e */
152PGM_CHECK_DEFAULT /* 7f */
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index cd31ad457a9..536d64579d9 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -117,8 +117,7 @@ void release_thread(struct task_struct *dead_task)
117} 117}
118 118
119int copy_thread(unsigned long clone_flags, unsigned long new_stackp, 119int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
120 unsigned long arg, 120 unsigned long arg, struct task_struct *p)
121 struct task_struct *p, struct pt_regs *regs)
122{ 121{
123 struct thread_info *ti; 122 struct thread_info *ti;
124 struct fake_frame 123 struct fake_frame
@@ -150,7 +149,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
150 frame->sf.gprs[9] = (unsigned long) frame; 149 frame->sf.gprs[9] = (unsigned long) frame;
151 150
152 /* Store access registers to kernel stack of new process. */ 151 /* Store access registers to kernel stack of new process. */
153 if (unlikely(!regs)) { 152 if (unlikely(p->flags & PF_KTHREAD)) {
154 /* kernel thread */ 153 /* kernel thread */
155 memset(&frame->childregs, 0, sizeof(struct pt_regs)); 154 memset(&frame->childregs, 0, sizeof(struct pt_regs));
156 frame->childregs.psw.mask = psw_kernel_bits | PSW_MASK_DAT | 155 frame->childregs.psw.mask = psw_kernel_bits | PSW_MASK_DAT |
@@ -164,9 +163,10 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
164 163
165 return 0; 164 return 0;
166 } 165 }
167 frame->childregs = *regs; 166 frame->childregs = *current_pt_regs();
168 frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */ 167 frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */
169 frame->childregs.gprs[15] = new_stackp; 168 if (new_stackp)
169 frame->childregs.gprs[15] = new_stackp;
170 170
171 /* Don't copy runtime instrumentation info */ 171 /* Don't copy runtime instrumentation info */
172 p->thread.ri_cb = NULL; 172 p->thread.ri_cb = NULL;
@@ -183,57 +183,24 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
183 sizeof(s390_fp_regs)); 183 sizeof(s390_fp_regs));
184 /* Set a new TLS ? */ 184 /* Set a new TLS ? */
185 if (clone_flags & CLONE_SETTLS) 185 if (clone_flags & CLONE_SETTLS)
186 p->thread.acrs[0] = regs->gprs[6]; 186 p->thread.acrs[0] = frame->childregs.gprs[6];
187#else /* CONFIG_64BIT */ 187#else /* CONFIG_64BIT */
188 /* Save the fpu registers to new thread structure. */ 188 /* Save the fpu registers to new thread structure. */
189 save_fp_regs(&p->thread.fp_regs); 189 save_fp_regs(&p->thread.fp_regs);
190 /* Set a new TLS ? */ 190 /* Set a new TLS ? */
191 if (clone_flags & CLONE_SETTLS) { 191 if (clone_flags & CLONE_SETTLS) {
192 unsigned long tls = frame->childregs.gprs[6];
192 if (is_compat_task()) { 193 if (is_compat_task()) {
193 p->thread.acrs[0] = (unsigned int) regs->gprs[6]; 194 p->thread.acrs[0] = (unsigned int)tls;
194 } else { 195 } else {
195 p->thread.acrs[0] = (unsigned int)(regs->gprs[6] >> 32); 196 p->thread.acrs[0] = (unsigned int)(tls >> 32);
196 p->thread.acrs[1] = (unsigned int) regs->gprs[6]; 197 p->thread.acrs[1] = (unsigned int)tls;
197 } 198 }
198 } 199 }
199#endif /* CONFIG_64BIT */ 200#endif /* CONFIG_64BIT */
200 return 0; 201 return 0;
201} 202}
202 203
203SYSCALL_DEFINE0(fork)
204{
205 struct pt_regs *regs = task_pt_regs(current);
206 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL);
207}
208
209SYSCALL_DEFINE4(clone, unsigned long, newsp, unsigned long, clone_flags,
210 int __user *, parent_tidptr, int __user *, child_tidptr)
211{
212 struct pt_regs *regs = task_pt_regs(current);
213
214 if (!newsp)
215 newsp = regs->gprs[15];
216 return do_fork(clone_flags, newsp, regs, 0,
217 parent_tidptr, child_tidptr);
218}
219
220/*
221 * This is trivial, and on the face of it looks like it
222 * could equally well be done in user mode.
223 *
224 * Not so, for quite unobvious reasons - register pressure.
225 * In user mode vfork() cannot have a stack frame, and if
226 * done by calling the "clone()" system call directly, you
227 * do not have enough call-clobbered registers to hold all
228 * the information you need.
229 */
230SYSCALL_DEFINE0(vfork)
231{
232 struct pt_regs *regs = task_pt_regs(current);
233 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
234 regs->gprs[15], regs, 0, NULL, NULL);
235}
236
237asmlinkage void execve_tail(void) 204asmlinkage void execve_tail(void)
238{ 205{
239 current->thread.fp_regs.fpc = 0; 206 current->thread.fp_regs.fpc = 0;
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index b1f2be9aaaa..2568590973a 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -777,40 +777,6 @@ static void __init reserve_crashkernel(void)
777#endif 777#endif
778} 778}
779 779
780static void __init init_storage_keys(unsigned long start, unsigned long end)
781{
782 unsigned long boundary, function, size;
783
784 while (start < end) {
785 if (MACHINE_HAS_EDAT2) {
786 /* set storage keys for a 2GB frame */
787 function = 0x22000 | PAGE_DEFAULT_KEY;
788 size = 1UL << 31;
789 boundary = (start + size) & ~(size - 1);
790 if (boundary <= end) {
791 do {
792 start = pfmf(function, start);
793 } while (start < boundary);
794 continue;
795 }
796 }
797 if (MACHINE_HAS_EDAT1) {
798 /* set storage keys for a 1MB frame */
799 function = 0x21000 | PAGE_DEFAULT_KEY;
800 size = 1UL << 20;
801 boundary = (start + size) & ~(size - 1);
802 if (boundary <= end) {
803 do {
804 start = pfmf(function, start);
805 } while (start < boundary);
806 continue;
807 }
808 }
809 page_set_storage_key(start, PAGE_DEFAULT_KEY, 0);
810 start += PAGE_SIZE;
811 }
812}
813
814static void __init setup_memory(void) 780static void __init setup_memory(void)
815{ 781{
816 unsigned long bootmap_size; 782 unsigned long bootmap_size;
@@ -889,7 +855,7 @@ static void __init setup_memory(void)
889 memblock_add_node(PFN_PHYS(start_chunk), 855 memblock_add_node(PFN_PHYS(start_chunk),
890 PFN_PHYS(end_chunk - start_chunk), 0); 856 PFN_PHYS(end_chunk - start_chunk), 0);
891 pfn = max(start_chunk, start_pfn); 857 pfn = max(start_chunk, start_pfn);
892 init_storage_keys(PFN_PHYS(pfn), PFN_PHYS(end_chunk)); 858 storage_key_init_range(PFN_PHYS(pfn), PFN_PHYS(end_chunk));
893 } 859 }
894 860
895 psw_set_key(PAGE_DEFAULT_KEY); 861 psw_set_key(PAGE_DEFAULT_KEY);
@@ -1040,6 +1006,9 @@ static void __init setup_hwcaps(void)
1040 case 0x2818: 1006 case 0x2818:
1041 strcpy(elf_platform, "z196"); 1007 strcpy(elf_platform, "z196");
1042 break; 1008 break;
1009 case 0x2827:
1010 strcpy(elf_platform, "zEC12");
1011 break;
1043 } 1012 }
1044} 1013}
1045 1014
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index d1259d87507..c3ff70a7b24 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -461,6 +461,8 @@ void do_signal(struct pt_regs *regs)
461 /* Restart system call with magic TIF bit. */ 461 /* Restart system call with magic TIF bit. */
462 regs->gprs[2] = regs->orig_gpr2; 462 regs->gprs[2] = regs->orig_gpr2;
463 set_thread_flag(TIF_SYSCALL); 463 set_thread_flag(TIF_SYSCALL);
464 if (test_thread_flag(TIF_SINGLE_STEP))
465 set_thread_flag(TIF_PER_TRAP);
464 break; 466 break;
465 } 467 }
466 } 468 }
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index dd55f7c2010..f1aba87cceb 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -29,48 +29,38 @@ struct mask_info {
29 cpumask_t mask; 29 cpumask_t mask;
30}; 30};
31 31
32static int topology_enabled = 1; 32static void set_topology_timer(void);
33static void topology_work_fn(struct work_struct *work); 33static void topology_work_fn(struct work_struct *work);
34static struct sysinfo_15_1_x *tl_info; 34static struct sysinfo_15_1_x *tl_info;
35static void set_topology_timer(void);
36static DECLARE_WORK(topology_work, topology_work_fn);
37/* topology_lock protects the core linked list */
38static DEFINE_SPINLOCK(topology_lock);
39 35
40static struct mask_info core_info; 36static int topology_enabled = 1;
41cpumask_t cpu_core_map[NR_CPUS]; 37static DECLARE_WORK(topology_work, topology_work_fn);
42unsigned char cpu_core_id[NR_CPUS];
43unsigned char cpu_socket_id[NR_CPUS];
44 38
39/* topology_lock protects the socket and book linked lists */
40static DEFINE_SPINLOCK(topology_lock);
41static struct mask_info socket_info;
45static struct mask_info book_info; 42static struct mask_info book_info;
46cpumask_t cpu_book_map[NR_CPUS]; 43
47unsigned char cpu_book_id[NR_CPUS]; 44struct cpu_topology_s390 cpu_topology[NR_CPUS];
48 45
49static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) 46static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
50{ 47{
51 cpumask_t mask; 48 cpumask_t mask;
52 49
53 cpumask_clear(&mask); 50 cpumask_copy(&mask, cpumask_of(cpu));
54 if (!topology_enabled || !MACHINE_HAS_TOPOLOGY) { 51 if (!topology_enabled || !MACHINE_HAS_TOPOLOGY)
55 cpumask_copy(&mask, cpumask_of(cpu));
56 return mask; 52 return mask;
53 for (; info; info = info->next) {
54 if (cpumask_test_cpu(cpu, &info->mask))
55 return info->mask;
57 } 56 }
58 while (info) {
59 if (cpumask_test_cpu(cpu, &info->mask)) {
60 mask = info->mask;
61 break;
62 }
63 info = info->next;
64 }
65 if (cpumask_empty(&mask))
66 cpumask_copy(&mask, cpumask_of(cpu));
67 return mask; 57 return mask;
68} 58}
69 59
70static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu, 60static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu,
71 struct mask_info *book, 61 struct mask_info *book,
72 struct mask_info *core, 62 struct mask_info *socket,
73 int one_core_per_cpu) 63 int one_socket_per_cpu)
74{ 64{
75 unsigned int cpu; 65 unsigned int cpu;
76 66
@@ -80,28 +70,28 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu,
80 70
81 rcpu = TOPOLOGY_CPU_BITS - 1 - cpu + tl_cpu->origin; 71 rcpu = TOPOLOGY_CPU_BITS - 1 - cpu + tl_cpu->origin;
82 lcpu = smp_find_processor_id(rcpu); 72 lcpu = smp_find_processor_id(rcpu);
83 if (lcpu >= 0) { 73 if (lcpu < 0)
84 cpumask_set_cpu(lcpu, &book->mask); 74 continue;
85 cpu_book_id[lcpu] = book->id; 75 cpumask_set_cpu(lcpu, &book->mask);
86 cpumask_set_cpu(lcpu, &core->mask); 76 cpu_topology[lcpu].book_id = book->id;
87 cpu_core_id[lcpu] = rcpu; 77 cpumask_set_cpu(lcpu, &socket->mask);
88 if (one_core_per_cpu) { 78 cpu_topology[lcpu].core_id = rcpu;
89 cpu_socket_id[lcpu] = rcpu; 79 if (one_socket_per_cpu) {
90 core = core->next; 80 cpu_topology[lcpu].socket_id = rcpu;
91 } else { 81 socket = socket->next;
92 cpu_socket_id[lcpu] = core->id; 82 } else {
93 } 83 cpu_topology[lcpu].socket_id = socket->id;
94 smp_cpu_set_polarization(lcpu, tl_cpu->pp);
95 } 84 }
85 smp_cpu_set_polarization(lcpu, tl_cpu->pp);
96 } 86 }
97 return core; 87 return socket;
98} 88}
99 89
100static void clear_masks(void) 90static void clear_masks(void)
101{ 91{
102 struct mask_info *info; 92 struct mask_info *info;
103 93
104 info = &core_info; 94 info = &socket_info;
105 while (info) { 95 while (info) {
106 cpumask_clear(&info->mask); 96 cpumask_clear(&info->mask);
107 info = info->next; 97 info = info->next;
@@ -120,9 +110,9 @@ static union topology_entry *next_tle(union topology_entry *tle)
120 return (union topology_entry *)((struct topology_container *)tle + 1); 110 return (union topology_entry *)((struct topology_container *)tle + 1);
121} 111}
122 112
123static void __tl_to_cores_generic(struct sysinfo_15_1_x *info) 113static void __tl_to_masks_generic(struct sysinfo_15_1_x *info)
124{ 114{
125 struct mask_info *core = &core_info; 115 struct mask_info *socket = &socket_info;
126 struct mask_info *book = &book_info; 116 struct mask_info *book = &book_info;
127 union topology_entry *tle, *end; 117 union topology_entry *tle, *end;
128 118
@@ -135,11 +125,11 @@ static void __tl_to_cores_generic(struct sysinfo_15_1_x *info)
135 book->id = tle->container.id; 125 book->id = tle->container.id;
136 break; 126 break;
137 case 1: 127 case 1:
138 core = core->next; 128 socket = socket->next;
139 core->id = tle->container.id; 129 socket->id = tle->container.id;
140 break; 130 break;
141 case 0: 131 case 0:
142 add_cpus_to_mask(&tle->cpu, book, core, 0); 132 add_cpus_to_mask(&tle->cpu, book, socket, 0);
143 break; 133 break;
144 default: 134 default:
145 clear_masks(); 135 clear_masks();
@@ -149,9 +139,9 @@ static void __tl_to_cores_generic(struct sysinfo_15_1_x *info)
149 } 139 }
150} 140}
151 141
152static void __tl_to_cores_z10(struct sysinfo_15_1_x *info) 142static void __tl_to_masks_z10(struct sysinfo_15_1_x *info)
153{ 143{
154 struct mask_info *core = &core_info; 144 struct mask_info *socket = &socket_info;
155 struct mask_info *book = &book_info; 145 struct mask_info *book = &book_info;
156 union topology_entry *tle, *end; 146 union topology_entry *tle, *end;
157 147
@@ -164,7 +154,7 @@ static void __tl_to_cores_z10(struct sysinfo_15_1_x *info)
164 book->id = tle->container.id; 154 book->id = tle->container.id;
165 break; 155 break;
166 case 0: 156 case 0:
167 core = add_cpus_to_mask(&tle->cpu, book, core, 1); 157 socket = add_cpus_to_mask(&tle->cpu, book, socket, 1);
168 break; 158 break;
169 default: 159 default:
170 clear_masks(); 160 clear_masks();
@@ -174,20 +164,20 @@ static void __tl_to_cores_z10(struct sysinfo_15_1_x *info)
174 } 164 }
175} 165}
176 166
177static void tl_to_cores(struct sysinfo_15_1_x *info) 167static void tl_to_masks(struct sysinfo_15_1_x *info)
178{ 168{
179 struct cpuid cpu_id; 169 struct cpuid cpu_id;
180 170
181 get_cpu_id(&cpu_id);
182 spin_lock_irq(&topology_lock); 171 spin_lock_irq(&topology_lock);
172 get_cpu_id(&cpu_id);
183 clear_masks(); 173 clear_masks();
184 switch (cpu_id.machine) { 174 switch (cpu_id.machine) {
185 case 0x2097: 175 case 0x2097:
186 case 0x2098: 176 case 0x2098:
187 __tl_to_cores_z10(info); 177 __tl_to_masks_z10(info);
188 break; 178 break;
189 default: 179 default:
190 __tl_to_cores_generic(info); 180 __tl_to_masks_generic(info);
191 } 181 }
192 spin_unlock_irq(&topology_lock); 182 spin_unlock_irq(&topology_lock);
193} 183}
@@ -232,15 +222,20 @@ int topology_set_cpu_management(int fc)
232 return rc; 222 return rc;
233} 223}
234 224
235static void update_cpu_core_map(void) 225static void update_cpu_masks(void)
236{ 226{
237 unsigned long flags; 227 unsigned long flags;
238 int cpu; 228 int cpu;
239 229
240 spin_lock_irqsave(&topology_lock, flags); 230 spin_lock_irqsave(&topology_lock, flags);
241 for_each_possible_cpu(cpu) { 231 for_each_possible_cpu(cpu) {
242 cpu_core_map[cpu] = cpu_group_map(&core_info, cpu); 232 cpu_topology[cpu].core_mask = cpu_group_map(&socket_info, cpu);
243 cpu_book_map[cpu] = cpu_group_map(&book_info, cpu); 233 cpu_topology[cpu].book_mask = cpu_group_map(&book_info, cpu);
234 if (!MACHINE_HAS_TOPOLOGY) {
235 cpu_topology[cpu].core_id = cpu;
236 cpu_topology[cpu].socket_id = cpu;
237 cpu_topology[cpu].book_id = cpu;
238 }
244 } 239 }
245 spin_unlock_irqrestore(&topology_lock, flags); 240 spin_unlock_irqrestore(&topology_lock, flags);
246} 241}
@@ -260,13 +255,13 @@ int arch_update_cpu_topology(void)
260 int cpu; 255 int cpu;
261 256
262 if (!MACHINE_HAS_TOPOLOGY) { 257 if (!MACHINE_HAS_TOPOLOGY) {
263 update_cpu_core_map(); 258 update_cpu_masks();
264 topology_update_polarization_simple(); 259 topology_update_polarization_simple();
265 return 0; 260 return 0;
266 } 261 }
267 store_topology(info); 262 store_topology(info);
268 tl_to_cores(info); 263 tl_to_masks(info);
269 update_cpu_core_map(); 264 update_cpu_masks();
270 for_each_online_cpu(cpu) { 265 for_each_online_cpu(cpu) {
271 dev = get_cpu_device(cpu); 266 dev = get_cpu_device(cpu);
272 kobject_uevent(&dev->kobj, KOBJ_CHANGE); 267 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
@@ -355,7 +350,7 @@ void __init s390_init_cpu_topology(void)
355 for (i = 0; i < TOPOLOGY_NR_MAG; i++) 350 for (i = 0; i < TOPOLOGY_NR_MAG; i++)
356 printk(KERN_CONT " %d", info->mag[i]); 351 printk(KERN_CONT " %d", info->mag[i]);
357 printk(KERN_CONT " / %d\n", info->mnest); 352 printk(KERN_CONT " / %d\n", info->mnest);
358 alloc_masks(info, &core_info, 1); 353 alloc_masks(info, &socket_info, 1);
359 alloc_masks(info, &book_info, 2); 354 alloc_masks(info, &book_info, 2);
360} 355}
361 356
@@ -454,7 +449,7 @@ static int __init topology_init(void)
454 } 449 }
455 set_topology_timer(); 450 set_topology_timer();
456out: 451out:
457 update_cpu_core_map(); 452 update_cpu_masks();
458 return device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching); 453 return device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching);
459} 454}
460device_initcall(topology_init); 455device_initcall(topology_init);
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 3d2b0fa37db..70ecfc5fe8f 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -41,8 +41,6 @@
41#include <asm/ipl.h> 41#include <asm/ipl.h>
42#include "entry.h" 42#include "entry.h"
43 43
44void (*pgm_check_table[128])(struct pt_regs *regs);
45
46int show_unhandled_signals = 1; 44int show_unhandled_signals = 1;
47 45
48#define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) 46#define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; })
@@ -350,7 +348,7 @@ void __kprobes do_per_trap(struct pt_regs *regs)
350 force_sig_info(SIGTRAP, &info, current); 348 force_sig_info(SIGTRAP, &info, current);
351} 349}
352 350
353static void default_trap_handler(struct pt_regs *regs) 351void default_trap_handler(struct pt_regs *regs)
354{ 352{
355 if (user_mode(regs)) { 353 if (user_mode(regs)) {
356 report_user_fault(regs, SIGSEGV); 354 report_user_fault(regs, SIGSEGV);
@@ -360,9 +358,9 @@ static void default_trap_handler(struct pt_regs *regs)
360} 358}
361 359
362#define DO_ERROR_INFO(name, signr, sicode, str) \ 360#define DO_ERROR_INFO(name, signr, sicode, str) \
363static void name(struct pt_regs *regs) \ 361void name(struct pt_regs *regs) \
364{ \ 362{ \
365 do_trap(regs, signr, sicode, str); \ 363 do_trap(regs, signr, sicode, str); \
366} 364}
367 365
368DO_ERROR_INFO(addressing_exception, SIGILL, ILL_ILLADR, 366DO_ERROR_INFO(addressing_exception, SIGILL, ILL_ILLADR,
@@ -417,7 +415,7 @@ static inline void do_fp_trap(struct pt_regs *regs, int fpc)
417 do_trap(regs, SIGFPE, si_code, "floating point exception"); 415 do_trap(regs, SIGFPE, si_code, "floating point exception");
418} 416}
419 417
420static void __kprobes illegal_op(struct pt_regs *regs) 418void __kprobes illegal_op(struct pt_regs *regs)
421{ 419{
422 siginfo_t info; 420 siginfo_t info;
423 __u8 opcode[6]; 421 __u8 opcode[6];
@@ -536,7 +534,7 @@ DO_ERROR_INFO(specification_exception, SIGILL, ILL_ILLOPN,
536 "specification exception"); 534 "specification exception");
537#endif 535#endif
538 536
539static void data_exception(struct pt_regs *regs) 537void data_exception(struct pt_regs *regs)
540{ 538{
541 __u16 __user *location; 539 __u16 __user *location;
542 int signal = 0; 540 int signal = 0;
@@ -611,7 +609,7 @@ static void data_exception(struct pt_regs *regs)
611 do_trap(regs, signal, ILL_ILLOPN, "data exception"); 609 do_trap(regs, signal, ILL_ILLOPN, "data exception");
612} 610}
613 611
614static void space_switch_exception(struct pt_regs *regs) 612void space_switch_exception(struct pt_regs *regs)
615{ 613{
616 /* Set user psw back to home space mode. */ 614 /* Set user psw back to home space mode. */
617 if (user_mode(regs)) 615 if (user_mode(regs))
@@ -629,43 +627,7 @@ void __kprobes kernel_stack_overflow(struct pt_regs * regs)
629 panic("Corrupt kernel stack, can't continue."); 627 panic("Corrupt kernel stack, can't continue.");
630} 628}
631 629
632/* init is done in lowcore.S and head.S */
633
634void __init trap_init(void) 630void __init trap_init(void)
635{ 631{
636 int i;
637
638 for (i = 0; i < 128; i++)
639 pgm_check_table[i] = &default_trap_handler;
640 pgm_check_table[1] = &illegal_op;
641 pgm_check_table[2] = &privileged_op;
642 pgm_check_table[3] = &execute_exception;
643 pgm_check_table[4] = &do_protection_exception;
644 pgm_check_table[5] = &addressing_exception;
645 pgm_check_table[6] = &specification_exception;
646 pgm_check_table[7] = &data_exception;
647 pgm_check_table[8] = &overflow_exception;
648 pgm_check_table[9] = &divide_exception;
649 pgm_check_table[0x0A] = &overflow_exception;
650 pgm_check_table[0x0B] = &divide_exception;
651 pgm_check_table[0x0C] = &hfp_overflow_exception;
652 pgm_check_table[0x0D] = &hfp_underflow_exception;
653 pgm_check_table[0x0E] = &hfp_significance_exception;
654 pgm_check_table[0x0F] = &hfp_divide_exception;
655 pgm_check_table[0x10] = &do_dat_exception;
656 pgm_check_table[0x11] = &do_dat_exception;
657 pgm_check_table[0x12] = &translation_exception;
658 pgm_check_table[0x13] = &special_op_exception;
659#ifdef CONFIG_64BIT
660 pgm_check_table[0x18] = &transaction_exception;
661 pgm_check_table[0x38] = &do_asce_exception;
662 pgm_check_table[0x39] = &do_dat_exception;
663 pgm_check_table[0x3A] = &do_dat_exception;
664 pgm_check_table[0x3B] = &do_dat_exception;
665#endif /* CONFIG_64BIT */
666 pgm_check_table[0x15] = &operand_exception;
667 pgm_check_table[0x1C] = &space_switch_exception;
668 pgm_check_table[0x1D] = &hfp_sqrt_exception;
669 /* Enable machine checks early. */
670 local_mcck_enable(); 632 local_mcck_enable();
671} 633}
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 79033442789..e84b8b68444 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -112,7 +112,12 @@ void vtime_task_switch(struct task_struct *prev)
112 S390_lowcore.system_timer = ti->system_timer; 112 S390_lowcore.system_timer = ti->system_timer;
113} 113}
114 114
115void account_process_tick(struct task_struct *tsk, int user_tick) 115/*
116 * In s390, accounting pending user time also implies
117 * accounting system time in order to correctly compute
118 * the stolen time accounting.
119 */
120void vtime_account_user(struct task_struct *tsk)
116{ 121{
117 if (do_account_vtime(tsk, HARDIRQ_OFFSET)) 122 if (do_account_vtime(tsk, HARDIRQ_OFFSET))
118 virt_timer_expire(); 123 virt_timer_expire();
@@ -127,6 +132,8 @@ void vtime_account(struct task_struct *tsk)
127 struct thread_info *ti = task_thread_info(tsk); 132 struct thread_info *ti = task_thread_info(tsk);
128 u64 timer, system; 133 u64 timer, system;
129 134
135 WARN_ON_ONCE(!irqs_disabled());
136
130 timer = S390_lowcore.last_update_timer; 137 timer = S390_lowcore.last_update_timer;
131 S390_lowcore.last_update_timer = get_vtimer(); 138 S390_lowcore.last_update_timer = get_vtimer();
132 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 139 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
@@ -140,6 +147,10 @@ void vtime_account(struct task_struct *tsk)
140} 147}
141EXPORT_SYMBOL_GPL(vtime_account); 148EXPORT_SYMBOL_GPL(vtime_account);
142 149
150void vtime_account_system(struct task_struct *tsk)
151__attribute__((alias("vtime_account")));
152EXPORT_SYMBOL_GPL(vtime_account_system);
153
143void __kprobes vtime_stop_cpu(void) 154void __kprobes vtime_stop_cpu(void)
144{ 155{
145 struct s390_idle_data *idle = &__get_cpu_var(s390_idle); 156 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index ff1e2f8ef94..c30615e605a 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -629,10 +629,27 @@ int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
629 break; 629 break;
630 case KVM_S390_SIGP_STOP: 630 case KVM_S390_SIGP_STOP:
631 case KVM_S390_RESTART: 631 case KVM_S390_RESTART:
632 VCPU_EVENT(vcpu, 3, "inject: type %x", s390int->type);
633 inti->type = s390int->type;
634 break;
632 case KVM_S390_INT_EXTERNAL_CALL: 635 case KVM_S390_INT_EXTERNAL_CALL:
636 if (s390int->parm & 0xffff0000) {
637 kfree(inti);
638 return -EINVAL;
639 }
640 VCPU_EVENT(vcpu, 3, "inject: external call source-cpu:%u",
641 s390int->parm);
642 inti->type = s390int->type;
643 inti->extcall.code = s390int->parm;
644 break;
633 case KVM_S390_INT_EMERGENCY: 645 case KVM_S390_INT_EMERGENCY:
634 VCPU_EVENT(vcpu, 3, "inject: type %x", s390int->type); 646 if (s390int->parm & 0xffff0000) {
647 kfree(inti);
648 return -EINVAL;
649 }
650 VCPU_EVENT(vcpu, 3, "inject: emergency %u\n", s390int->parm);
635 inti->type = s390int->type; 651 inti->type = s390int->type;
652 inti->emerg.code = s390int->parm;
636 break; 653 break;
637 case KVM_S390_INT_VIRTIO: 654 case KVM_S390_INT_VIRTIO:
638 case KVM_S390_INT_SERVICE: 655 case KVM_S390_INT_SERVICE:
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ecced9d1898..c9011bfaabb 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -355,6 +355,11 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
355 atomic_set_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); 355 atomic_set_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
356} 356}
357 357
358int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
359{
360 return 0;
361}
362
358int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) 363int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
359{ 364{
360 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | 365 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH |
@@ -608,9 +613,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
608 kvm_s390_deliver_pending_interrupts(vcpu); 613 kvm_s390_deliver_pending_interrupts(vcpu);
609 614
610 vcpu->arch.sie_block->icptcode = 0; 615 vcpu->arch.sie_block->icptcode = 0;
611 local_irq_disable();
612 kvm_guest_enter(); 616 kvm_guest_enter();
613 local_irq_enable();
614 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 617 VCPU_EVENT(vcpu, 6, "entering sie flags %x",
615 atomic_read(&vcpu->arch.sie_block->cpuflags)); 618 atomic_read(&vcpu->arch.sie_block->cpuflags));
616 trace_kvm_s390_sie_enter(vcpu, 619 trace_kvm_s390_sie_enter(vcpu,
@@ -629,9 +632,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
629 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 632 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
630 vcpu->arch.sie_block->icptcode); 633 vcpu->arch.sie_block->icptcode);
631 trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); 634 trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
632 local_irq_disable();
633 kvm_guest_exit(); 635 kvm_guest_exit();
634 local_irq_enable();
635 636
636 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); 637 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
637 return rc; 638 return rc;
@@ -997,7 +998,7 @@ static int __init kvm_s390_init(void)
997 } 998 }
998 memcpy(facilities, S390_lowcore.stfle_fac_list, 16); 999 memcpy(facilities, S390_lowcore.stfle_fac_list, 16);
999 facilities[0] &= 0xff00fff3f47c0000ULL; 1000 facilities[0] &= 0xff00fff3f47c0000ULL;
1000 facilities[1] &= 0x201c000000000000ULL; 1001 facilities[1] &= 0x001c000000000000ULL;
1001 return 0; 1002 return 0;
1002} 1003}
1003 1004
diff --git a/arch/s390/mm/Makefile b/arch/s390/mm/Makefile
index 1bea6d1f55a..640bea12303 100644
--- a/arch/s390/mm/Makefile
+++ b/arch/s390/mm/Makefile
@@ -2,9 +2,9 @@
2# Makefile for the linux s390-specific parts of the memory manager. 2# Makefile for the linux s390-specific parts of the memory manager.
3# 3#
4 4
5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o maccess.o \ 5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o maccess.o
6 page-states.o gup.o extable.o 6obj-y += page-states.o gup.o extable.o pageattr.o
7obj-$(CONFIG_CMM) += cmm.o 7
8obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 8obj-$(CONFIG_CMM) += cmm.o
9obj-$(CONFIG_DEBUG_SET_MODULE_RONX) += pageattr.o 9obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
10obj-$(CONFIG_S390_PTDUMP) += dump_pagetables.o 10obj-$(CONFIG_S390_PTDUMP) += dump_pagetables.o
diff --git a/arch/s390/mm/dump_pagetables.c b/arch/s390/mm/dump_pagetables.c
index cbc6668acb8..04e4892247d 100644
--- a/arch/s390/mm/dump_pagetables.c
+++ b/arch/s390/mm/dump_pagetables.c
@@ -150,6 +150,7 @@ static void walk_pmd_level(struct seq_file *m, struct pg_state *st,
150static void walk_pud_level(struct seq_file *m, struct pg_state *st, 150static void walk_pud_level(struct seq_file *m, struct pg_state *st,
151 pgd_t *pgd, unsigned long addr) 151 pgd_t *pgd, unsigned long addr)
152{ 152{
153 unsigned int prot;
153 pud_t *pud; 154 pud_t *pud;
154 int i; 155 int i;
155 156
@@ -157,7 +158,11 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st,
157 st->current_address = addr; 158 st->current_address = addr;
158 pud = pud_offset(pgd, addr); 159 pud = pud_offset(pgd, addr);
159 if (!pud_none(*pud)) 160 if (!pud_none(*pud))
160 walk_pmd_level(m, st, pud, addr); 161 if (pud_large(*pud)) {
162 prot = pud_val(*pud) & _PAGE_RO;
163 note_page(m, st, prot, 2);
164 } else
165 walk_pmd_level(m, st, pud, addr);
161 else 166 else
162 note_page(m, st, _PAGE_INVALID, 2); 167 note_page(m, st, _PAGE_INVALID, 2);
163 addr += PUD_SIZE; 168 addr += PUD_SIZE;
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 04ad4001a28..42601d6e166 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -49,15 +49,19 @@
49#define VM_FAULT_BADCONTEXT 0x010000 49#define VM_FAULT_BADCONTEXT 0x010000
50#define VM_FAULT_BADMAP 0x020000 50#define VM_FAULT_BADMAP 0x020000
51#define VM_FAULT_BADACCESS 0x040000 51#define VM_FAULT_BADACCESS 0x040000
52#define VM_FAULT_SIGNAL 0x080000 52#define VM_FAULT_SIGNAL 0x080000
53 53
54static unsigned long store_indication; 54static unsigned long store_indication __read_mostly;
55 55
56void fault_init(void) 56#ifdef CONFIG_64BIT
57static int __init fault_init(void)
57{ 58{
58 if (test_facility(2) && test_facility(75)) 59 if (test_facility(75))
59 store_indication = 0xc00; 60 store_indication = 0xc00;
61 return 0;
60} 62}
63early_initcall(fault_init);
64#endif
61 65
62static inline int notify_page_fault(struct pt_regs *regs) 66static inline int notify_page_fault(struct pt_regs *regs)
63{ 67{
@@ -273,10 +277,16 @@ static inline int do_exception(struct pt_regs *regs, int access)
273 unsigned int flags; 277 unsigned int flags;
274 int fault; 278 int fault;
275 279
280 tsk = current;
281 /*
282 * The instruction that caused the program check has
283 * been nullified. Don't signal single step via SIGTRAP.
284 */
285 clear_tsk_thread_flag(tsk, TIF_PER_TRAP);
286
276 if (notify_page_fault(regs)) 287 if (notify_page_fault(regs))
277 return 0; 288 return 0;
278 289
279 tsk = current;
280 mm = tsk->mm; 290 mm = tsk->mm;
281 trans_exc_code = regs->int_parm_long; 291 trans_exc_code = regs->int_parm_long;
282 292
@@ -372,11 +382,6 @@ retry:
372 goto retry; 382 goto retry;
373 } 383 }
374 } 384 }
375 /*
376 * The instruction that caused the program check will
377 * be repeated. Don't signal single step via SIGTRAP.
378 */
379 clear_tsk_thread_flag(tsk, TIF_PER_TRAP);
380 fault = 0; 385 fault = 0;
381out_up: 386out_up:
382 up_read(&mm->mmap_sem); 387 up_read(&mm->mmap_sem);
@@ -423,6 +428,12 @@ void __kprobes do_asce_exception(struct pt_regs *regs)
423 struct vm_area_struct *vma; 428 struct vm_area_struct *vma;
424 unsigned long trans_exc_code; 429 unsigned long trans_exc_code;
425 430
431 /*
432 * The instruction that caused the program check has
433 * been nullified. Don't signal single step via SIGTRAP.
434 */
435 clear_tsk_thread_flag(current, TIF_PER_TRAP);
436
426 trans_exc_code = regs->int_parm_long; 437 trans_exc_code = regs->int_parm_long;
427 if (unlikely(!user_space_fault(trans_exc_code) || in_atomic() || !mm)) 438 if (unlikely(!user_space_fault(trans_exc_code) || in_atomic() || !mm))
428 goto no_context; 439 goto no_context;
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 81e596c65de..ae672f41c46 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -125,7 +125,6 @@ void __init paging_init(void)
125 max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS); 125 max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS);
126 max_zone_pfns[ZONE_NORMAL] = max_low_pfn; 126 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
127 free_area_init_nodes(max_zone_pfns); 127 free_area_init_nodes(max_zone_pfns);
128 fault_init();
129} 128}
130 129
131void __init mem_init(void) 130void __init mem_init(void)
@@ -159,34 +158,6 @@ void __init mem_init(void)
159 PFN_ALIGN((unsigned long)&_eshared) - 1); 158 PFN_ALIGN((unsigned long)&_eshared) - 1);
160} 159}
161 160
162#ifdef CONFIG_DEBUG_PAGEALLOC
163void kernel_map_pages(struct page *page, int numpages, int enable)
164{
165 pgd_t *pgd;
166 pud_t *pud;
167 pmd_t *pmd;
168 pte_t *pte;
169 unsigned long address;
170 int i;
171
172 for (i = 0; i < numpages; i++) {
173 address = page_to_phys(page + i);
174 pgd = pgd_offset_k(address);
175 pud = pud_offset(pgd, address);
176 pmd = pmd_offset(pud, address);
177 pte = pte_offset_kernel(pmd, address);
178 if (!enable) {
179 __ptep_ipte(address, pte);
180 pte_val(*pte) = _PAGE_TYPE_EMPTY;
181 continue;
182 }
183 *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW));
184 /* Flush cpu write queue. */
185 mb();
186 }
187}
188#endif
189
190void free_init_pages(char *what, unsigned long begin, unsigned long end) 161void free_init_pages(char *what, unsigned long begin, unsigned long end)
191{ 162{
192 unsigned long addr = begin; 163 unsigned long addr = begin;
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c
index 00be01c4b4f..29ccee3651f 100644
--- a/arch/s390/mm/pageattr.c
+++ b/arch/s390/mm/pageattr.c
@@ -2,11 +2,46 @@
2 * Copyright IBM Corp. 2011 2 * Copyright IBM Corp. 2011
3 * Author(s): Jan Glauber <jang@linux.vnet.ibm.com> 3 * Author(s): Jan Glauber <jang@linux.vnet.ibm.com>
4 */ 4 */
5#include <linux/hugetlb.h>
5#include <linux/module.h> 6#include <linux/module.h>
6#include <linux/mm.h> 7#include <linux/mm.h>
7#include <linux/hugetlb.h>
8#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
9#include <asm/pgtable.h> 9#include <asm/pgtable.h>
10#include <asm/page.h>
11
12void storage_key_init_range(unsigned long start, unsigned long end)
13{
14 unsigned long boundary, function, size;
15
16 while (start < end) {
17 if (MACHINE_HAS_EDAT2) {
18 /* set storage keys for a 2GB frame */
19 function = 0x22000 | PAGE_DEFAULT_KEY;
20 size = 1UL << 31;
21 boundary = (start + size) & ~(size - 1);
22 if (boundary <= end) {
23 do {
24 start = pfmf(function, start);
25 } while (start < boundary);
26 continue;
27 }
28 }
29 if (MACHINE_HAS_EDAT1) {
30 /* set storage keys for a 1MB frame */
31 function = 0x21000 | PAGE_DEFAULT_KEY;
32 size = 1UL << 20;
33 boundary = (start + size) & ~(size - 1);
34 if (boundary <= end) {
35 do {
36 start = pfmf(function, start);
37 } while (start < boundary);
38 continue;
39 }
40 }
41 page_set_storage_key(start, PAGE_DEFAULT_KEY, 0);
42 start += PAGE_SIZE;
43 }
44}
10 45
11static pte_t *walk_page_table(unsigned long addr) 46static pte_t *walk_page_table(unsigned long addr)
12{ 47{
@@ -19,7 +54,7 @@ static pte_t *walk_page_table(unsigned long addr)
19 if (pgd_none(*pgdp)) 54 if (pgd_none(*pgdp))
20 return NULL; 55 return NULL;
21 pudp = pud_offset(pgdp, addr); 56 pudp = pud_offset(pgdp, addr);
22 if (pud_none(*pudp)) 57 if (pud_none(*pudp) || pud_large(*pudp))
23 return NULL; 58 return NULL;
24 pmdp = pmd_offset(pudp, addr); 59 pmdp = pmd_offset(pudp, addr);
25 if (pmd_none(*pmdp) || pmd_large(*pmdp)) 60 if (pmd_none(*pmdp) || pmd_large(*pmdp))
@@ -70,3 +105,46 @@ int set_memory_x(unsigned long addr, int numpages)
70{ 105{
71 return 0; 106 return 0;
72} 107}
108
109#ifdef CONFIG_DEBUG_PAGEALLOC
110void kernel_map_pages(struct page *page, int numpages, int enable)
111{
112 unsigned long address;
113 pgd_t *pgd;
114 pud_t *pud;
115 pmd_t *pmd;
116 pte_t *pte;
117 int i;
118
119 for (i = 0; i < numpages; i++) {
120 address = page_to_phys(page + i);
121 pgd = pgd_offset_k(address);
122 pud = pud_offset(pgd, address);
123 pmd = pmd_offset(pud, address);
124 pte = pte_offset_kernel(pmd, address);
125 if (!enable) {
126 __ptep_ipte(address, pte);
127 pte_val(*pte) = _PAGE_TYPE_EMPTY;
128 continue;
129 }
130 *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW));
131 }
132}
133
134#ifdef CONFIG_HIBERNATION
135bool kernel_page_present(struct page *page)
136{
137 unsigned long addr;
138 int cc;
139
140 addr = page_to_phys(page);
141 asm volatile(
142 " lra %1,0(%1)\n"
143 " ipm %0\n"
144 " srl %0,28"
145 : "=d" (cc), "+a" (addr) : : "cc");
146 return cc == 0;
147}
148#endif /* CONFIG_HIBERNATION */
149
150#endif /* CONFIG_DEBUG_PAGEALLOC */
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index c8188a18af0..ae44d2a3431 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -881,22 +881,6 @@ int s390_enable_sie(void)
881} 881}
882EXPORT_SYMBOL_GPL(s390_enable_sie); 882EXPORT_SYMBOL_GPL(s390_enable_sie);
883 883
884#if defined(CONFIG_DEBUG_PAGEALLOC) && defined(CONFIG_HIBERNATION)
885bool kernel_page_present(struct page *page)
886{
887 unsigned long addr;
888 int cc;
889
890 addr = page_to_phys(page);
891 asm volatile(
892 " lra %1,0(%1)\n"
893 " ipm %0\n"
894 " srl %0,28"
895 : "=d" (cc), "+a" (addr) : : "cc");
896 return cc == 0;
897}
898#endif /* CONFIG_HIBERNATION && CONFIG_DEBUG_PAGEALLOC */
899
900#ifdef CONFIG_TRANSPARENT_HUGEPAGE 884#ifdef CONFIG_TRANSPARENT_HUGEPAGE
901int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address, 885int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address,
902 pmd_t *pmdp) 886 pmd_t *pmdp)
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 387c7c60b5b..6ed1426d27c 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -89,6 +89,7 @@ static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
89 int ret = -ENOMEM; 89 int ret = -ENOMEM;
90 90
91 while (address < end) { 91 while (address < end) {
92 pte = mk_pte_phys(address, __pgprot(ro ? _PAGE_RO : 0));
92 pg_dir = pgd_offset_k(address); 93 pg_dir = pgd_offset_k(address);
93 if (pgd_none(*pg_dir)) { 94 if (pgd_none(*pg_dir)) {
94 pu_dir = vmem_pud_alloc(); 95 pu_dir = vmem_pud_alloc();
@@ -96,18 +97,24 @@ static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
96 goto out; 97 goto out;
97 pgd_populate(&init_mm, pg_dir, pu_dir); 98 pgd_populate(&init_mm, pg_dir, pu_dir);
98 } 99 }
99
100 pu_dir = pud_offset(pg_dir, address); 100 pu_dir = pud_offset(pg_dir, address);
101#if defined(CONFIG_64BIT) && !defined(CONFIG_DEBUG_PAGEALLOC)
102 if (MACHINE_HAS_EDAT2 && pud_none(*pu_dir) && address &&
103 !(address & ~PUD_MASK) && (address + PUD_SIZE <= end)) {
104 pte_val(pte) |= _REGION3_ENTRY_LARGE;
105 pte_val(pte) |= _REGION_ENTRY_TYPE_R3;
106 pud_val(*pu_dir) = pte_val(pte);
107 address += PUD_SIZE;
108 continue;
109 }
110#endif
101 if (pud_none(*pu_dir)) { 111 if (pud_none(*pu_dir)) {
102 pm_dir = vmem_pmd_alloc(); 112 pm_dir = vmem_pmd_alloc();
103 if (!pm_dir) 113 if (!pm_dir)
104 goto out; 114 goto out;
105 pud_populate(&init_mm, pu_dir, pm_dir); 115 pud_populate(&init_mm, pu_dir, pm_dir);
106 } 116 }
107
108 pte = mk_pte_phys(address, __pgprot(ro ? _PAGE_RO : 0));
109 pm_dir = pmd_offset(pu_dir, address); 117 pm_dir = pmd_offset(pu_dir, address);
110
111#if defined(CONFIG_64BIT) && !defined(CONFIG_DEBUG_PAGEALLOC) 118#if defined(CONFIG_64BIT) && !defined(CONFIG_DEBUG_PAGEALLOC)
112 if (MACHINE_HAS_EDAT1 && pmd_none(*pm_dir) && address && 119 if (MACHINE_HAS_EDAT1 && pmd_none(*pm_dir) && address &&
113 !(address & ~PMD_MASK) && (address + PMD_SIZE <= end)) { 120 !(address & ~PMD_MASK) && (address + PMD_SIZE <= end)) {
@@ -160,6 +167,11 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
160 address += PUD_SIZE; 167 address += PUD_SIZE;
161 continue; 168 continue;
162 } 169 }
170 if (pud_large(*pu_dir)) {
171 pud_clear(pu_dir);
172 address += PUD_SIZE;
173 continue;
174 }
163 pm_dir = pmd_offset(pu_dir, address); 175 pm_dir = pmd_offset(pu_dir, address);
164 if (pmd_none(*pm_dir)) { 176 if (pmd_none(*pm_dir)) {
165 address += PMD_SIZE; 177 address += PMD_SIZE;
@@ -193,7 +205,7 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
193 start_addr = (unsigned long) start; 205 start_addr = (unsigned long) start;
194 end_addr = (unsigned long) (start + nr); 206 end_addr = (unsigned long) (start + nr);
195 207
196 for (address = start_addr; address < end_addr; address += PAGE_SIZE) { 208 for (address = start_addr; address < end_addr;) {
197 pg_dir = pgd_offset_k(address); 209 pg_dir = pgd_offset_k(address);
198 if (pgd_none(*pg_dir)) { 210 if (pgd_none(*pg_dir)) {
199 pu_dir = vmem_pud_alloc(); 211 pu_dir = vmem_pud_alloc();
@@ -212,10 +224,33 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
212 224
213 pm_dir = pmd_offset(pu_dir, address); 225 pm_dir = pmd_offset(pu_dir, address);
214 if (pmd_none(*pm_dir)) { 226 if (pmd_none(*pm_dir)) {
227#ifdef CONFIG_64BIT
228 /* Use 1MB frames for vmemmap if available. We always
229 * use large frames even if they are only partially
230 * used.
231 * Otherwise we would have also page tables since
232 * vmemmap_populate gets called for each section
233 * separately. */
234 if (MACHINE_HAS_EDAT1) {
235 void *new_page;
236
237 new_page = vmemmap_alloc_block(PMD_SIZE, node);
238 if (!new_page)
239 goto out;
240 pte = mk_pte_phys(__pa(new_page), PAGE_RW);
241 pte_val(pte) |= _SEGMENT_ENTRY_LARGE;
242 pmd_val(*pm_dir) = pte_val(pte);
243 address = (address + PMD_SIZE) & PMD_MASK;
244 continue;
245 }
246#endif
215 pt_dir = vmem_pte_alloc(address); 247 pt_dir = vmem_pte_alloc(address);
216 if (!pt_dir) 248 if (!pt_dir)
217 goto out; 249 goto out;
218 pmd_populate(&init_mm, pm_dir, pt_dir); 250 pmd_populate(&init_mm, pm_dir, pt_dir);
251 } else if (pmd_large(*pm_dir)) {
252 address = (address + PMD_SIZE) & PMD_MASK;
253 continue;
219 } 254 }
220 255
221 pt_dir = pte_offset_kernel(pm_dir, address); 256 pt_dir = pte_offset_kernel(pm_dir, address);
@@ -228,6 +263,7 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
228 pte = pfn_pte(new_page >> PAGE_SHIFT, PAGE_KERNEL); 263 pte = pfn_pte(new_page >> PAGE_SHIFT, PAGE_KERNEL);
229 *pt_dir = pte; 264 *pt_dir = pte;
230 } 265 }
266 address += PAGE_SIZE;
231 } 267 }
232 memset(start, 0, nr * sizeof(struct page)); 268 memset(start, 0, nr * sizeof(struct page));
233 ret = 0; 269 ret = 0;
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 9b355b406af..bb284419b0f 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -341,6 +341,27 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
341 /* lr %r5,%r4 */ 341 /* lr %r5,%r4 */
342 EMIT2(0x1854); 342 EMIT2(0x1854);
343 break; 343 break;
344 case BPF_S_ALU_MOD_X: /* A %= X */
345 jit->seen |= SEEN_XREG | SEEN_RET0;
346 /* ltr %r12,%r12 */
347 EMIT2(0x12cc);
348 /* jz <ret0> */
349 EMIT4_PCREL(0xa7840000, (jit->ret0_ip - jit->prg));
350 /* lhi %r4,0 */
351 EMIT4(0xa7480000);
352 /* dr %r4,%r12 */
353 EMIT2(0x1d4c);
354 /* lr %r5,%r4 */
355 EMIT2(0x1854);
356 break;
357 case BPF_S_ALU_MOD_K: /* A %= K */
358 /* lhi %r4,0 */
359 EMIT4(0xa7480000);
360 /* d %r4,<d(K)>(%r13) */
361 EMIT4_DISP(0x5d40d000, EMIT_CONST(K));
362 /* lr %r5,%r4 */
363 EMIT2(0x1854);
364 break;
344 case BPF_S_ALU_AND_X: /* A &= X */ 365 case BPF_S_ALU_AND_X: /* A &= X */
345 jit->seen |= SEEN_XREG; 366 jit->seen |= SEEN_XREG;
346 /* nr %r5,%r12 */ 367 /* nr %r5,%r12 */
@@ -368,10 +389,17 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
368 EMIT4_DISP(0x5650d000, EMIT_CONST(K)); 389 EMIT4_DISP(0x5650d000, EMIT_CONST(K));
369 break; 390 break;
370 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */ 391 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */
392 case BPF_S_ALU_XOR_X:
371 jit->seen |= SEEN_XREG; 393 jit->seen |= SEEN_XREG;
372 /* xr %r5,%r12 */ 394 /* xr %r5,%r12 */
373 EMIT2(0x175c); 395 EMIT2(0x175c);
374 break; 396 break;
397 case BPF_S_ALU_XOR_K: /* A ^= K */
398 if (!K)
399 break;
400 /* x %r5,<d(K)>(%r13) */
401 EMIT4_DISP(0x5750d000, EMIT_CONST(K));
402 break;
375 case BPF_S_ALU_LSH_X: /* A <<= X; */ 403 case BPF_S_ALU_LSH_X: /* A <<= X; */
376 jit->seen |= SEEN_XREG; 404 jit->seen |= SEEN_XREG;
377 /* sll %r5,0(%r12) */ 405 /* sll %r5,0(%r12) */
diff --git a/arch/s390/pci/Makefile b/arch/s390/pci/Makefile
new file mode 100644
index 00000000000..ab0827b6bc4
--- /dev/null
+++ b/arch/s390/pci/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for the s390 PCI subsystem.
3#
4
5obj-$(CONFIG_PCI) += pci.o pci_dma.o pci_clp.o pci_msi.o \
6 pci_sysfs.o pci_event.o
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
new file mode 100644
index 00000000000..7ed38e5e302
--- /dev/null
+++ b/arch/s390/pci/pci.c
@@ -0,0 +1,1103 @@
1/*
2 * Copyright IBM Corp. 2012
3 *
4 * Author(s):
5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 *
7 * The System z PCI code is a rewrite from a prototype by
8 * the following people (Kudoz!):
9 * Alexander Schmidt
10 * Christoph Raisch
11 * Hannes Hering
12 * Hoang-Nam Nguyen
13 * Jan-Bernd Themann
14 * Stefan Roscher
15 * Thomas Klein
16 */
17
18#define COMPONENT "zPCI"
19#define pr_fmt(fmt) COMPONENT ": " fmt
20
21#include <linux/kernel.h>
22#include <linux/slab.h>
23#include <linux/err.h>
24#include <linux/export.h>
25#include <linux/delay.h>
26#include <linux/irq.h>
27#include <linux/kernel_stat.h>
28#include <linux/seq_file.h>
29#include <linux/pci.h>
30#include <linux/msi.h>
31
32#include <asm/isc.h>
33#include <asm/airq.h>
34#include <asm/facility.h>
35#include <asm/pci_insn.h>
36#include <asm/pci_clp.h>
37#include <asm/pci_dma.h>
38
39#define DEBUG /* enable pr_debug */
40
41#define SIC_IRQ_MODE_ALL 0
42#define SIC_IRQ_MODE_SINGLE 1
43
44#define ZPCI_NR_DMA_SPACES 1
45#define ZPCI_MSI_VEC_BITS 6
46#define ZPCI_NR_DEVICES CONFIG_PCI_NR_FUNCTIONS
47
48/* list of all detected zpci devices */
49LIST_HEAD(zpci_list);
50EXPORT_SYMBOL_GPL(zpci_list);
51DEFINE_MUTEX(zpci_list_lock);
52EXPORT_SYMBOL_GPL(zpci_list_lock);
53
54struct pci_hp_callback_ops hotplug_ops;
55EXPORT_SYMBOL_GPL(hotplug_ops);
56
57static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES);
58static DEFINE_SPINLOCK(zpci_domain_lock);
59
60struct callback {
61 irq_handler_t handler;
62 void *data;
63};
64
65struct zdev_irq_map {
66 unsigned long aibv; /* AI bit vector */
67 int msi_vecs; /* consecutive MSI-vectors used */
68 int __unused;
69 struct callback cb[ZPCI_NR_MSI_VECS]; /* callback handler array */
70 spinlock_t lock; /* protect callbacks against de-reg */
71};
72
73struct intr_bucket {
74 /* amap of adapters, one bit per dev, corresponds to one irq nr */
75 unsigned long *alloc;
76 /* AI summary bit, global page for all devices */
77 unsigned long *aisb;
78 /* pointer to aibv and callback data in zdev */
79 struct zdev_irq_map *imap[ZPCI_NR_DEVICES];
80 /* protects the whole bucket struct */
81 spinlock_t lock;
82};
83
84static struct intr_bucket *bucket;
85
86/* Adapter local summary indicator */
87static u8 *zpci_irq_si;
88
89static atomic_t irq_retries = ATOMIC_INIT(0);
90
91/* I/O Map */
92static DEFINE_SPINLOCK(zpci_iomap_lock);
93static DECLARE_BITMAP(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);
94struct zpci_iomap_entry *zpci_iomap_start;
95EXPORT_SYMBOL_GPL(zpci_iomap_start);
96
97/* highest irq summary bit */
98static int __read_mostly aisb_max;
99
100static struct kmem_cache *zdev_irq_cache;
101
102static inline int irq_to_msi_nr(unsigned int irq)
103{
104 return irq & ZPCI_MSI_MASK;
105}
106
107static inline int irq_to_dev_nr(unsigned int irq)
108{
109 return irq >> ZPCI_MSI_VEC_BITS;
110}
111
112static inline struct zdev_irq_map *get_imap(unsigned int irq)
113{
114 return bucket->imap[irq_to_dev_nr(irq)];
115}
116
117struct zpci_dev *get_zdev(struct pci_dev *pdev)
118{
119 return (struct zpci_dev *) pdev->sysdata;
120}
121
122struct zpci_dev *get_zdev_by_fid(u32 fid)
123{
124 struct zpci_dev *tmp, *zdev = NULL;
125
126 mutex_lock(&zpci_list_lock);
127 list_for_each_entry(tmp, &zpci_list, entry) {
128 if (tmp->fid == fid) {
129 zdev = tmp;
130 break;
131 }
132 }
133 mutex_unlock(&zpci_list_lock);
134 return zdev;
135}
136
137bool zpci_fid_present(u32 fid)
138{
139 return (get_zdev_by_fid(fid) != NULL) ? true : false;
140}
141
142static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)
143{
144 return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
145}
146
147int pci_domain_nr(struct pci_bus *bus)
148{
149 return ((struct zpci_dev *) bus->sysdata)->domain;
150}
151EXPORT_SYMBOL_GPL(pci_domain_nr);
152
153int pci_proc_domain(struct pci_bus *bus)
154{
155 return pci_domain_nr(bus);
156}
157EXPORT_SYMBOL_GPL(pci_proc_domain);
158
159/* Store PCI function information block */
160static int zpci_store_fib(struct zpci_dev *zdev, u8 *fc)
161{
162 struct zpci_fib *fib;
163 u8 status, cc;
164
165 fib = (void *) get_zeroed_page(GFP_KERNEL);
166 if (!fib)
167 return -ENOMEM;
168
169 do {
170 cc = __stpcifc(zdev->fh, 0, fib, &status);
171 if (cc == 2) {
172 msleep(ZPCI_INSN_BUSY_DELAY);
173 memset(fib, 0, PAGE_SIZE);
174 }
175 } while (cc == 2);
176
177 if (cc)
178 pr_err_once("%s: cc: %u status: %u\n",
179 __func__, cc, status);
180
181 /* Return PCI function controls */
182 *fc = fib->fc;
183
184 free_page((unsigned long) fib);
185 return (cc) ? -EIO : 0;
186}
187
188/* Modify PCI: Register adapter interruptions */
189static int zpci_register_airq(struct zpci_dev *zdev, unsigned int aisb,
190 u64 aibv)
191{
192 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT);
193 struct zpci_fib *fib;
194 int rc;
195
196 fib = (void *) get_zeroed_page(GFP_KERNEL);
197 if (!fib)
198 return -ENOMEM;
199
200 fib->isc = PCI_ISC;
201 fib->noi = zdev->irq_map->msi_vecs;
202 fib->sum = 1; /* enable summary notifications */
203 fib->aibv = aibv;
204 fib->aibvo = 0; /* every function has its own page */
205 fib->aisb = (u64) bucket->aisb + aisb / 8;
206 fib->aisbo = aisb & ZPCI_MSI_MASK;
207
208 rc = mpcifc_instr(req, fib);
209 pr_debug("%s mpcifc returned noi: %d\n", __func__, fib->noi);
210
211 free_page((unsigned long) fib);
212 return rc;
213}
214
215struct mod_pci_args {
216 u64 base;
217 u64 limit;
218 u64 iota;
219};
220
221static int mod_pci(struct zpci_dev *zdev, int fn, u8 dmaas, struct mod_pci_args *args)
222{
223 u64 req = ZPCI_CREATE_REQ(zdev->fh, dmaas, fn);
224 struct zpci_fib *fib;
225 int rc;
226
227 /* The FIB must be available even if it's not used */
228 fib = (void *) get_zeroed_page(GFP_KERNEL);
229 if (!fib)
230 return -ENOMEM;
231
232 fib->pba = args->base;
233 fib->pal = args->limit;
234 fib->iota = args->iota;
235
236 rc = mpcifc_instr(req, fib);
237 free_page((unsigned long) fib);
238 return rc;
239}
240
241/* Modify PCI: Register I/O address translation parameters */
242int zpci_register_ioat(struct zpci_dev *zdev, u8 dmaas,
243 u64 base, u64 limit, u64 iota)
244{
245 struct mod_pci_args args = { base, limit, iota };
246
247 WARN_ON_ONCE(iota & 0x3fff);
248 args.iota |= ZPCI_IOTA_RTTO_FLAG;
249 return mod_pci(zdev, ZPCI_MOD_FC_REG_IOAT, dmaas, &args);
250}
251
252/* Modify PCI: Unregister I/O address translation parameters */
253int zpci_unregister_ioat(struct zpci_dev *zdev, u8 dmaas)
254{
255 struct mod_pci_args args = { 0, 0, 0 };
256
257 return mod_pci(zdev, ZPCI_MOD_FC_DEREG_IOAT, dmaas, &args);
258}
259
260/* Modify PCI: Unregister adapter interruptions */
261static int zpci_unregister_airq(struct zpci_dev *zdev)
262{
263 struct mod_pci_args args = { 0, 0, 0 };
264
265 return mod_pci(zdev, ZPCI_MOD_FC_DEREG_INT, 0, &args);
266}
267
268#define ZPCI_PCIAS_CFGSPC 15
269
270static int zpci_cfg_load(struct zpci_dev *zdev, int offset, u32 *val, u8 len)
271{
272 u64 req = ZPCI_CREATE_REQ(zdev->fh, ZPCI_PCIAS_CFGSPC, len);
273 u64 data;
274 int rc;
275
276 rc = pcilg_instr(&data, req, offset);
277 data = data << ((8 - len) * 8);
278 data = le64_to_cpu(data);
279 if (!rc)
280 *val = (u32) data;
281 else
282 *val = 0xffffffff;
283 return rc;
284}
285
286static int zpci_cfg_store(struct zpci_dev *zdev, int offset, u32 val, u8 len)
287{
288 u64 req = ZPCI_CREATE_REQ(zdev->fh, ZPCI_PCIAS_CFGSPC, len);
289 u64 data = val;
290 int rc;
291
292 data = cpu_to_le64(data);
293 data = data >> ((8 - len) * 8);
294 rc = pcistg_instr(data, req, offset);
295 return rc;
296}
297
298void synchronize_irq(unsigned int irq)
299{
300 /*
301 * Not needed, the handler is protected by a lock and IRQs that occur
302 * after the handler is deleted are just NOPs.
303 */
304}
305EXPORT_SYMBOL_GPL(synchronize_irq);
306
307void enable_irq(unsigned int irq)
308{
309 struct msi_desc *msi = irq_get_msi_desc(irq);
310
311 zpci_msi_set_mask_bits(msi, 1, 0);
312}
313EXPORT_SYMBOL_GPL(enable_irq);
314
315void disable_irq(unsigned int irq)
316{
317 struct msi_desc *msi = irq_get_msi_desc(irq);
318
319 zpci_msi_set_mask_bits(msi, 1, 1);
320}
321EXPORT_SYMBOL_GPL(disable_irq);
322
323void disable_irq_nosync(unsigned int irq)
324{
325 disable_irq(irq);
326}
327EXPORT_SYMBOL_GPL(disable_irq_nosync);
328
329unsigned long probe_irq_on(void)
330{
331 return 0;
332}
333EXPORT_SYMBOL_GPL(probe_irq_on);
334
335int probe_irq_off(unsigned long val)
336{
337 return 0;
338}
339EXPORT_SYMBOL_GPL(probe_irq_off);
340
341unsigned int probe_irq_mask(unsigned long val)
342{
343 return val;
344}
345EXPORT_SYMBOL_GPL(probe_irq_mask);
346
347void __devinit pcibios_fixup_bus(struct pci_bus *bus)
348{
349}
350
351resource_size_t pcibios_align_resource(void *data, const struct resource *res,
352 resource_size_t size,
353 resource_size_t align)
354{
355 return 0;
356}
357
358/* combine single writes by using store-block insn */
359void __iowrite64_copy(void __iomem *to, const void *from, size_t count)
360{
361 zpci_memcpy_toio(to, from, count);
362}
363
364/* Create a virtual mapping cookie for a PCI BAR */
365void __iomem *pci_iomap(struct pci_dev *pdev, int bar, unsigned long max)
366{
367 struct zpci_dev *zdev = get_zdev(pdev);
368 u64 addr;
369 int idx;
370
371 if ((bar & 7) != bar)
372 return NULL;
373
374 idx = zdev->bars[bar].map_idx;
375 spin_lock(&zpci_iomap_lock);
376 zpci_iomap_start[idx].fh = zdev->fh;
377 zpci_iomap_start[idx].bar = bar;
378 spin_unlock(&zpci_iomap_lock);
379
380 addr = ZPCI_IOMAP_ADDR_BASE | ((u64) idx << 48);
381 return (void __iomem *) addr;
382}
383EXPORT_SYMBOL_GPL(pci_iomap);
384
385void pci_iounmap(struct pci_dev *pdev, void __iomem *addr)
386{
387 unsigned int idx;
388
389 idx = (((__force u64) addr) & ~ZPCI_IOMAP_ADDR_BASE) >> 48;
390 spin_lock(&zpci_iomap_lock);
391 zpci_iomap_start[idx].fh = 0;
392 zpci_iomap_start[idx].bar = 0;
393 spin_unlock(&zpci_iomap_lock);
394}
395EXPORT_SYMBOL_GPL(pci_iounmap);
396
397static int pci_read(struct pci_bus *bus, unsigned int devfn, int where,
398 int size, u32 *val)
399{
400 struct zpci_dev *zdev = get_zdev_by_bus(bus);
401
402 if (!zdev || devfn != ZPCI_DEVFN)
403 return 0;
404 return zpci_cfg_load(zdev, where, val, size);
405}
406
407static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
408 int size, u32 val)
409{
410 struct zpci_dev *zdev = get_zdev_by_bus(bus);
411
412 if (!zdev || devfn != ZPCI_DEVFN)
413 return 0;
414 return zpci_cfg_store(zdev, where, val, size);
415}
416
417static struct pci_ops pci_root_ops = {
418 .read = pci_read,
419 .write = pci_write,
420};
421
422/* store the last handled bit to implement fair scheduling of devices */
423static DEFINE_PER_CPU(unsigned long, next_sbit);
424
425static void zpci_irq_handler(void *dont, void *need)
426{
427 unsigned long sbit, mbit, last = 0, start = __get_cpu_var(next_sbit);
428 int rescan = 0, max = aisb_max;
429 struct zdev_irq_map *imap;
430
431 kstat_cpu(smp_processor_id()).irqs[IOINT_PCI]++;
432 sbit = start;
433
434scan:
435 /* find summary_bit */
436 for_each_set_bit_left_cont(sbit, bucket->aisb, max) {
437 clear_bit(63 - (sbit & 63), bucket->aisb + (sbit >> 6));
438 last = sbit;
439
440 /* find vector bit */
441 imap = bucket->imap[sbit];
442 for_each_set_bit_left(mbit, &imap->aibv, imap->msi_vecs) {
443 kstat_cpu(smp_processor_id()).irqs[IOINT_MSI]++;
444 clear_bit(63 - mbit, &imap->aibv);
445
446 spin_lock(&imap->lock);
447 if (imap->cb[mbit].handler)
448 imap->cb[mbit].handler(mbit,
449 imap->cb[mbit].data);
450 spin_unlock(&imap->lock);
451 }
452 }
453
454 if (rescan)
455 goto out;
456
457 /* scan the skipped bits */
458 if (start > 0) {
459 sbit = 0;
460 max = start;
461 start = 0;
462 goto scan;
463 }
464
465 /* enable interrupts again */
466 sic_instr(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC);
467
468 /* check again to not lose initiative */
469 rmb();
470 max = aisb_max;
471 sbit = find_first_bit_left(bucket->aisb, max);
472 if (sbit != max) {
473 atomic_inc(&irq_retries);
474 rescan++;
475 goto scan;
476 }
477out:
478 /* store next device bit to scan */
479 __get_cpu_var(next_sbit) = (++last >= aisb_max) ? 0 : last;
480}
481
482/* msi_vecs - number of requested interrupts, 0 place function to error state */
483static int zpci_setup_msi(struct pci_dev *pdev, int msi_vecs)
484{
485 struct zpci_dev *zdev = get_zdev(pdev);
486 unsigned int aisb, msi_nr;
487 struct msi_desc *msi;
488 int rc;
489
490 /* store the number of used MSI vectors */
491 zdev->irq_map->msi_vecs = min(msi_vecs, ZPCI_NR_MSI_VECS);
492
493 spin_lock(&bucket->lock);
494 aisb = find_first_zero_bit(bucket->alloc, PAGE_SIZE);
495 /* alloc map exhausted? */
496 if (aisb == PAGE_SIZE) {
497 spin_unlock(&bucket->lock);
498 return -EIO;
499 }
500 set_bit(aisb, bucket->alloc);
501 spin_unlock(&bucket->lock);
502
503 zdev->aisb = aisb;
504 if (aisb + 1 > aisb_max)
505 aisb_max = aisb + 1;
506
507 /* wire up IRQ shortcut pointer */
508 bucket->imap[zdev->aisb] = zdev->irq_map;
509 pr_debug("%s: imap[%u] linked to %p\n", __func__, zdev->aisb, zdev->irq_map);
510
511 /* TODO: irq number 0 wont be found if we return less than requested MSIs.
512 * ignore it for now and fix in common code.
513 */
514 msi_nr = aisb << ZPCI_MSI_VEC_BITS;
515
516 list_for_each_entry(msi, &pdev->msi_list, list) {
517 rc = zpci_setup_msi_irq(zdev, msi, msi_nr,
518 aisb << ZPCI_MSI_VEC_BITS);
519 if (rc)
520 return rc;
521 msi_nr++;
522 }
523
524 rc = zpci_register_airq(zdev, aisb, (u64) &zdev->irq_map->aibv);
525 if (rc) {
526 clear_bit(aisb, bucket->alloc);
527 dev_err(&pdev->dev, "register MSI failed with: %d\n", rc);
528 return rc;
529 }
530 return (zdev->irq_map->msi_vecs == msi_vecs) ?
531 0 : zdev->irq_map->msi_vecs;
532}
533
534static void zpci_teardown_msi(struct pci_dev *pdev)
535{
536 struct zpci_dev *zdev = get_zdev(pdev);
537 struct msi_desc *msi;
538 int aisb, rc;
539
540 rc = zpci_unregister_airq(zdev);
541 if (rc) {
542 dev_err(&pdev->dev, "deregister MSI failed with: %d\n", rc);
543 return;
544 }
545
546 msi = list_first_entry(&pdev->msi_list, struct msi_desc, list);
547 aisb = irq_to_dev_nr(msi->irq);
548
549 list_for_each_entry(msi, &pdev->msi_list, list)
550 zpci_teardown_msi_irq(zdev, msi);
551
552 clear_bit(aisb, bucket->alloc);
553 if (aisb + 1 == aisb_max)
554 aisb_max--;
555}
556
557int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
558{
559 pr_debug("%s: requesting %d MSI-X interrupts...", __func__, nvec);
560 if (type != PCI_CAP_ID_MSIX && type != PCI_CAP_ID_MSI)
561 return -EINVAL;
562 return zpci_setup_msi(pdev, nvec);
563}
564
565void arch_teardown_msi_irqs(struct pci_dev *pdev)
566{
567 pr_info("%s: on pdev: %p\n", __func__, pdev);
568 zpci_teardown_msi(pdev);
569}
570
571static void zpci_map_resources(struct zpci_dev *zdev)
572{
573 struct pci_dev *pdev = zdev->pdev;
574 resource_size_t len;
575 int i;
576
577 for (i = 0; i < PCI_BAR_COUNT; i++) {
578 len = pci_resource_len(pdev, i);
579 if (!len)
580 continue;
581 pdev->resource[i].start = (resource_size_t) pci_iomap(pdev, i, 0);
582 pdev->resource[i].end = pdev->resource[i].start + len - 1;
583 pr_debug("BAR%i: -> start: %Lx end: %Lx\n",
584 i, pdev->resource[i].start, pdev->resource[i].end);
585 }
586};
587
588static void zpci_unmap_resources(struct pci_dev *pdev)
589{
590 resource_size_t len;
591 int i;
592
593 for (i = 0; i < PCI_BAR_COUNT; i++) {
594 len = pci_resource_len(pdev, i);
595 if (!len)
596 continue;
597 pci_iounmap(pdev, (void *) pdev->resource[i].start);
598 }
599};
600
601struct zpci_dev *zpci_alloc_device(void)
602{
603 struct zpci_dev *zdev;
604
605 /* Alloc memory for our private pci device data */
606 zdev = kzalloc(sizeof(*zdev), GFP_KERNEL);
607 if (!zdev)
608 return ERR_PTR(-ENOMEM);
609
610 /* Alloc aibv & callback space */
611 zdev->irq_map = kmem_cache_zalloc(zdev_irq_cache, GFP_KERNEL);
612 if (!zdev->irq_map)
613 goto error;
614 WARN_ON((u64) zdev->irq_map & 0xff);
615 return zdev;
616
617error:
618 kfree(zdev);
619 return ERR_PTR(-ENOMEM);
620}
621
622void zpci_free_device(struct zpci_dev *zdev)
623{
624 kmem_cache_free(zdev_irq_cache, zdev->irq_map);
625 kfree(zdev);
626}
627
628/* Called on removal of pci_dev, leaves zpci and bus device */
629static void zpci_remove_device(struct pci_dev *pdev)
630{
631 struct zpci_dev *zdev = get_zdev(pdev);
632
633 dev_info(&pdev->dev, "Removing device %u\n", zdev->domain);
634 zdev->state = ZPCI_FN_STATE_CONFIGURED;
635 zpci_dma_exit_device(zdev);
636 zpci_sysfs_remove_device(&pdev->dev);
637 zpci_unmap_resources(pdev);
638 list_del(&zdev->entry); /* can be called from init */
639 zdev->pdev = NULL;
640}
641
642static void zpci_scan_devices(void)
643{
644 struct zpci_dev *zdev;
645
646 mutex_lock(&zpci_list_lock);
647 list_for_each_entry(zdev, &zpci_list, entry)
648 if (zdev->state == ZPCI_FN_STATE_CONFIGURED)
649 zpci_scan_device(zdev);
650 mutex_unlock(&zpci_list_lock);
651}
652
653/*
654 * Too late for any s390 specific setup, since interrupts must be set up
655 * already which requires DMA setup too and the pci scan will access the
656 * config space, which only works if the function handle is enabled.
657 */
658int pcibios_enable_device(struct pci_dev *pdev, int mask)
659{
660 struct resource *res;
661 u16 cmd;
662 int i;
663
664 pci_read_config_word(pdev, PCI_COMMAND, &cmd);
665
666 for (i = 0; i < PCI_BAR_COUNT; i++) {
667 res = &pdev->resource[i];
668
669 if (res->flags & IORESOURCE_IO)
670 return -EINVAL;
671
672 if (res->flags & IORESOURCE_MEM)
673 cmd |= PCI_COMMAND_MEMORY;
674 }
675 pci_write_config_word(pdev, PCI_COMMAND, cmd);
676 return 0;
677}
678
679void pcibios_disable_device(struct pci_dev *pdev)
680{
681 zpci_remove_device(pdev);
682 pdev->sysdata = NULL;
683}
684
685int pcibios_add_platform_entries(struct pci_dev *pdev)
686{
687 return zpci_sysfs_add_device(&pdev->dev);
688}
689
690int zpci_request_irq(unsigned int irq, irq_handler_t handler, void *data)
691{
692 int msi_nr = irq_to_msi_nr(irq);
693 struct zdev_irq_map *imap;
694 struct msi_desc *msi;
695
696 msi = irq_get_msi_desc(irq);
697 if (!msi)
698 return -EIO;
699
700 imap = get_imap(irq);
701 spin_lock_init(&imap->lock);
702
703 pr_debug("%s: register handler for IRQ:MSI %d:%d\n", __func__, irq >> 6, msi_nr);
704 imap->cb[msi_nr].handler = handler;
705 imap->cb[msi_nr].data = data;
706
707 /*
708 * The generic MSI code returns with the interrupt disabled on the
709 * card, using the MSI mask bits. Firmware doesn't appear to unmask
710 * at that level, so we do it here by hand.
711 */
712 zpci_msi_set_mask_bits(msi, 1, 0);
713 return 0;
714}
715
716void zpci_free_irq(unsigned int irq)
717{
718 struct zdev_irq_map *imap = get_imap(irq);
719 int msi_nr = irq_to_msi_nr(irq);
720 unsigned long flags;
721
722 pr_debug("%s: for irq: %d\n", __func__, irq);
723
724 spin_lock_irqsave(&imap->lock, flags);
725 imap->cb[msi_nr].handler = NULL;
726 imap->cb[msi_nr].data = NULL;
727 spin_unlock_irqrestore(&imap->lock, flags);
728}
729
730int request_irq(unsigned int irq, irq_handler_t handler,
731 unsigned long irqflags, const char *devname, void *dev_id)
732{
733 pr_debug("%s: irq: %d handler: %p flags: %lx dev: %s\n",
734 __func__, irq, handler, irqflags, devname);
735
736 return zpci_request_irq(irq, handler, dev_id);
737}
738EXPORT_SYMBOL_GPL(request_irq);
739
740void free_irq(unsigned int irq, void *dev_id)
741{
742 zpci_free_irq(irq);
743}
744EXPORT_SYMBOL_GPL(free_irq);
745
746static int __init zpci_irq_init(void)
747{
748 int cpu, rc;
749
750 bucket = kzalloc(sizeof(*bucket), GFP_KERNEL);
751 if (!bucket)
752 return -ENOMEM;
753
754 bucket->aisb = (unsigned long *) get_zeroed_page(GFP_KERNEL);
755 if (!bucket->aisb) {
756 rc = -ENOMEM;
757 goto out_aisb;
758 }
759
760 bucket->alloc = (unsigned long *) get_zeroed_page(GFP_KERNEL);
761 if (!bucket->alloc) {
762 rc = -ENOMEM;
763 goto out_alloc;
764 }
765
766 isc_register(PCI_ISC);
767 zpci_irq_si = s390_register_adapter_interrupt(&zpci_irq_handler, NULL, PCI_ISC);
768 if (IS_ERR(zpci_irq_si)) {
769 rc = PTR_ERR(zpci_irq_si);
770 zpci_irq_si = NULL;
771 goto out_ai;
772 }
773
774 for_each_online_cpu(cpu)
775 per_cpu(next_sbit, cpu) = 0;
776
777 spin_lock_init(&bucket->lock);
778 /* set summary to 1 to be called every time for the ISC */
779 *zpci_irq_si = 1;
780 sic_instr(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC);
781 return 0;
782
783out_ai:
784 isc_unregister(PCI_ISC);
785 free_page((unsigned long) bucket->alloc);
786out_alloc:
787 free_page((unsigned long) bucket->aisb);
788out_aisb:
789 kfree(bucket);
790 return rc;
791}
792
793static void zpci_irq_exit(void)
794{
795 free_page((unsigned long) bucket->alloc);
796 free_page((unsigned long) bucket->aisb);
797 s390_unregister_adapter_interrupt(zpci_irq_si, PCI_ISC);
798 isc_unregister(PCI_ISC);
799 kfree(bucket);
800}
801
802static struct resource *zpci_alloc_bus_resource(unsigned long start, unsigned long size,
803 unsigned long flags, int domain)
804{
805 struct resource *r;
806 char *name;
807 int rc;
808
809 r = kzalloc(sizeof(*r), GFP_KERNEL);
810 if (!r)
811 return ERR_PTR(-ENOMEM);
812 r->start = start;
813 r->end = r->start + size - 1;
814 r->flags = flags;
815 r->parent = &iomem_resource;
816 name = kmalloc(18, GFP_KERNEL);
817 if (!name) {
818 kfree(r);
819 return ERR_PTR(-ENOMEM);
820 }
821 sprintf(name, "PCI Bus: %04x:%02x", domain, ZPCI_BUS_NR);
822 r->name = name;
823
824 rc = request_resource(&iomem_resource, r);
825 if (rc)
826 pr_debug("request resource %pR failed\n", r);
827 return r;
828}
829
830static int zpci_alloc_iomap(struct zpci_dev *zdev)
831{
832 int entry;
833
834 spin_lock(&zpci_iomap_lock);
835 entry = find_first_zero_bit(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);
836 if (entry == ZPCI_IOMAP_MAX_ENTRIES) {
837 spin_unlock(&zpci_iomap_lock);
838 return -ENOSPC;
839 }
840 set_bit(entry, zpci_iomap);
841 spin_unlock(&zpci_iomap_lock);
842 return entry;
843}
844
845static void zpci_free_iomap(struct zpci_dev *zdev, int entry)
846{
847 spin_lock(&zpci_iomap_lock);
848 memset(&zpci_iomap_start[entry], 0, sizeof(struct zpci_iomap_entry));
849 clear_bit(entry, zpci_iomap);
850 spin_unlock(&zpci_iomap_lock);
851}
852
853static int zpci_create_device_bus(struct zpci_dev *zdev)
854{
855 struct resource *res;
856 LIST_HEAD(resources);
857 int i;
858
859 /* allocate mapping entry for each used bar */
860 for (i = 0; i < PCI_BAR_COUNT; i++) {
861 unsigned long addr, size, flags;
862 int entry;
863
864 if (!zdev->bars[i].size)
865 continue;
866 entry = zpci_alloc_iomap(zdev);
867 if (entry < 0)
868 return entry;
869 zdev->bars[i].map_idx = entry;
870
871 /* only MMIO is supported */
872 flags = IORESOURCE_MEM;
873 if (zdev->bars[i].val & 8)
874 flags |= IORESOURCE_PREFETCH;
875 if (zdev->bars[i].val & 4)
876 flags |= IORESOURCE_MEM_64;
877
878 addr = ZPCI_IOMAP_ADDR_BASE + ((u64) entry << 48);
879
880 size = 1UL << zdev->bars[i].size;
881
882 res = zpci_alloc_bus_resource(addr, size, flags, zdev->domain);
883 if (IS_ERR(res)) {
884 zpci_free_iomap(zdev, entry);
885 return PTR_ERR(res);
886 }
887 pci_add_resource(&resources, res);
888 }
889
890 zdev->bus = pci_create_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
891 zdev, &resources);
892 if (!zdev->bus)
893 return -EIO;
894
895 zdev->bus->max_bus_speed = zdev->max_bus_speed;
896 return 0;
897}
898
899static int zpci_alloc_domain(struct zpci_dev *zdev)
900{
901 spin_lock(&zpci_domain_lock);
902 zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);
903 if (zdev->domain == ZPCI_NR_DEVICES) {
904 spin_unlock(&zpci_domain_lock);
905 return -ENOSPC;
906 }
907 set_bit(zdev->domain, zpci_domain);
908 spin_unlock(&zpci_domain_lock);
909 return 0;
910}
911
912static void zpci_free_domain(struct zpci_dev *zdev)
913{
914 spin_lock(&zpci_domain_lock);
915 clear_bit(zdev->domain, zpci_domain);
916 spin_unlock(&zpci_domain_lock);
917}
918
919int zpci_enable_device(struct zpci_dev *zdev)
920{
921 int rc;
922
923 rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES);
924 if (rc)
925 goto out;
926 pr_info("Enabled fh: 0x%x fid: 0x%x\n", zdev->fh, zdev->fid);
927
928 rc = zpci_dma_init_device(zdev);
929 if (rc)
930 goto out_dma;
931 return 0;
932
933out_dma:
934 clp_disable_fh(zdev);
935out:
936 return rc;
937}
938EXPORT_SYMBOL_GPL(zpci_enable_device);
939
940int zpci_create_device(struct zpci_dev *zdev)
941{
942 int rc;
943
944 rc = zpci_alloc_domain(zdev);
945 if (rc)
946 goto out;
947
948 rc = zpci_create_device_bus(zdev);
949 if (rc)
950 goto out_bus;
951
952 mutex_lock(&zpci_list_lock);
953 list_add_tail(&zdev->entry, &zpci_list);
954 if (hotplug_ops.create_slot)
955 hotplug_ops.create_slot(zdev);
956 mutex_unlock(&zpci_list_lock);
957
958 if (zdev->state == ZPCI_FN_STATE_STANDBY)
959 return 0;
960
961 rc = zpci_enable_device(zdev);
962 if (rc)
963 goto out_start;
964 return 0;
965
966out_start:
967 mutex_lock(&zpci_list_lock);
968 list_del(&zdev->entry);
969 if (hotplug_ops.remove_slot)
970 hotplug_ops.remove_slot(zdev);
971 mutex_unlock(&zpci_list_lock);
972out_bus:
973 zpci_free_domain(zdev);
974out:
975 return rc;
976}
977
978void zpci_stop_device(struct zpci_dev *zdev)
979{
980 zpci_dma_exit_device(zdev);
981 /*
982 * Note: SCLP disables fh via set-pci-fn so don't
983 * do that here.
984 */
985}
986EXPORT_SYMBOL_GPL(zpci_stop_device);
987
988int zpci_scan_device(struct zpci_dev *zdev)
989{
990 zdev->pdev = pci_scan_single_device(zdev->bus, ZPCI_DEVFN);
991 if (!zdev->pdev) {
992 pr_err("pci_scan_single_device failed for fid: 0x%x\n",
993 zdev->fid);
994 goto out;
995 }
996
997 zpci_map_resources(zdev);
998 pci_bus_add_devices(zdev->bus);
999
1000 /* now that pdev was added to the bus mark it as used */
1001 zdev->state = ZPCI_FN_STATE_ONLINE;
1002 return 0;
1003
1004out:
1005 zpci_dma_exit_device(zdev);
1006 clp_disable_fh(zdev);
1007 return -EIO;
1008}
1009EXPORT_SYMBOL_GPL(zpci_scan_device);
1010
1011static inline int barsize(u8 size)
1012{
1013 return (size) ? (1 << size) >> 10 : 0;
1014}
1015
1016static int zpci_mem_init(void)
1017{
1018 zdev_irq_cache = kmem_cache_create("PCI_IRQ_cache", sizeof(struct zdev_irq_map),
1019 L1_CACHE_BYTES, SLAB_HWCACHE_ALIGN, NULL);
1020 if (!zdev_irq_cache)
1021 goto error_zdev;
1022
1023 /* TODO: use realloc */
1024 zpci_iomap_start = kzalloc(ZPCI_IOMAP_MAX_ENTRIES * sizeof(*zpci_iomap_start),
1025 GFP_KERNEL);
1026 if (!zpci_iomap_start)
1027 goto error_iomap;
1028 return 0;
1029
1030error_iomap:
1031 kmem_cache_destroy(zdev_irq_cache);
1032error_zdev:
1033 return -ENOMEM;
1034}
1035
1036static void zpci_mem_exit(void)
1037{
1038 kfree(zpci_iomap_start);
1039 kmem_cache_destroy(zdev_irq_cache);
1040}
1041
1042unsigned int pci_probe = 1;
1043EXPORT_SYMBOL_GPL(pci_probe);
1044
1045char * __init pcibios_setup(char *str)
1046{
1047 if (!strcmp(str, "off")) {
1048 pci_probe = 0;
1049 return NULL;
1050 }
1051 return str;
1052}
1053
1054static int __init pci_base_init(void)
1055{
1056 int rc;
1057
1058 if (!pci_probe)
1059 return 0;
1060
1061 if (!test_facility(2) || !test_facility(69)
1062 || !test_facility(71) || !test_facility(72))
1063 return 0;
1064
1065 pr_info("Probing PCI hardware: PCI:%d SID:%d AEN:%d\n",
1066 test_facility(69), test_facility(70),
1067 test_facility(71));
1068
1069 rc = zpci_mem_init();
1070 if (rc)
1071 goto out_mem;
1072
1073 rc = zpci_msihash_init();
1074 if (rc)
1075 goto out_hash;
1076
1077 rc = zpci_irq_init();
1078 if (rc)
1079 goto out_irq;
1080
1081 rc = zpci_dma_init();
1082 if (rc)
1083 goto out_dma;
1084
1085 rc = clp_find_pci_devices();
1086 if (rc)
1087 goto out_find;
1088
1089 zpci_scan_devices();
1090 return 0;
1091
1092out_find:
1093 zpci_dma_exit();
1094out_dma:
1095 zpci_irq_exit();
1096out_irq:
1097 zpci_msihash_exit();
1098out_hash:
1099 zpci_mem_exit();
1100out_mem:
1101 return rc;
1102}
1103subsys_initcall(pci_base_init);
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
new file mode 100644
index 00000000000..7f4ce8d874a
--- /dev/null
+++ b/arch/s390/pci/pci_clp.c
@@ -0,0 +1,324 @@
1/*
2 * Copyright IBM Corp. 2012
3 *
4 * Author(s):
5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */
7
8#define COMPONENT "zPCI"
9#define pr_fmt(fmt) COMPONENT ": " fmt
10
11#include <linux/kernel.h>
12#include <linux/slab.h>
13#include <linux/err.h>
14#include <linux/delay.h>
15#include <linux/pci.h>
16#include <asm/pci_clp.h>
17
18/*
19 * Call Logical Processor
20 * Retry logic is handled by the caller.
21 */
22static inline u8 clp_instr(void *req)
23{
24 u64 ilpm;
25 u8 cc;
26
27 asm volatile (
28 " .insn rrf,0xb9a00000,%[ilpm],%[req],0x0,0x2\n"
29 " ipm %[cc]\n"
30 " srl %[cc],28\n"
31 : [cc] "=d" (cc), [ilpm] "=d" (ilpm)
32 : [req] "a" (req)
33 : "cc", "memory");
34 return cc;
35}
36
37static void *clp_alloc_block(void)
38{
39 struct page *page = alloc_pages(GFP_KERNEL, get_order(CLP_BLK_SIZE));
40 return (page) ? page_address(page) : NULL;
41}
42
43static void clp_free_block(void *ptr)
44{
45 free_pages((unsigned long) ptr, get_order(CLP_BLK_SIZE));
46}
47
48static void clp_store_query_pci_fngrp(struct zpci_dev *zdev,
49 struct clp_rsp_query_pci_grp *response)
50{
51 zdev->tlb_refresh = response->refresh;
52 zdev->dma_mask = response->dasm;
53 zdev->msi_addr = response->msia;
54
55 pr_debug("Supported number of MSI vectors: %u\n", response->noi);
56 switch (response->version) {
57 case 1:
58 zdev->max_bus_speed = PCIE_SPEED_5_0GT;
59 break;
60 default:
61 zdev->max_bus_speed = PCI_SPEED_UNKNOWN;
62 break;
63 }
64}
65
66static int clp_query_pci_fngrp(struct zpci_dev *zdev, u8 pfgid)
67{
68 struct clp_req_rsp_query_pci_grp *rrb;
69 int rc;
70
71 rrb = clp_alloc_block();
72 if (!rrb)
73 return -ENOMEM;
74
75 memset(rrb, 0, sizeof(*rrb));
76 rrb->request.hdr.len = sizeof(rrb->request);
77 rrb->request.hdr.cmd = CLP_QUERY_PCI_FNGRP;
78 rrb->response.hdr.len = sizeof(rrb->response);
79 rrb->request.pfgid = pfgid;
80
81 rc = clp_instr(rrb);
82 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
83 clp_store_query_pci_fngrp(zdev, &rrb->response);
84 else {
85 pr_err("Query PCI FNGRP failed with response: %x cc: %d\n",
86 rrb->response.hdr.rsp, rc);
87 rc = -EIO;
88 }
89 clp_free_block(rrb);
90 return rc;
91}
92
93static int clp_store_query_pci_fn(struct zpci_dev *zdev,
94 struct clp_rsp_query_pci *response)
95{
96 int i;
97
98 for (i = 0; i < PCI_BAR_COUNT; i++) {
99 zdev->bars[i].val = le32_to_cpu(response->bar[i]);
100 zdev->bars[i].size = response->bar_size[i];
101 }
102 zdev->start_dma = response->sdma;
103 zdev->end_dma = response->edma;
104 zdev->pchid = response->pchid;
105 zdev->pfgid = response->pfgid;
106 return 0;
107}
108
109static int clp_query_pci_fn(struct zpci_dev *zdev, u32 fh)
110{
111 struct clp_req_rsp_query_pci *rrb;
112 int rc;
113
114 rrb = clp_alloc_block();
115 if (!rrb)
116 return -ENOMEM;
117
118 memset(rrb, 0, sizeof(*rrb));
119 rrb->request.hdr.len = sizeof(rrb->request);
120 rrb->request.hdr.cmd = CLP_QUERY_PCI_FN;
121 rrb->response.hdr.len = sizeof(rrb->response);
122 rrb->request.fh = fh;
123
124 rc = clp_instr(rrb);
125 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) {
126 rc = clp_store_query_pci_fn(zdev, &rrb->response);
127 if (rc)
128 goto out;
129 if (rrb->response.pfgid)
130 rc = clp_query_pci_fngrp(zdev, rrb->response.pfgid);
131 } else {
132 pr_err("Query PCI failed with response: %x cc: %d\n",
133 rrb->response.hdr.rsp, rc);
134 rc = -EIO;
135 }
136out:
137 clp_free_block(rrb);
138 return rc;
139}
140
141int clp_add_pci_device(u32 fid, u32 fh, int configured)
142{
143 struct zpci_dev *zdev;
144 int rc;
145
146 zdev = zpci_alloc_device();
147 if (IS_ERR(zdev))
148 return PTR_ERR(zdev);
149
150 zdev->fh = fh;
151 zdev->fid = fid;
152
153 /* Query function properties and update zdev */
154 rc = clp_query_pci_fn(zdev, fh);
155 if (rc)
156 goto error;
157
158 if (configured)
159 zdev->state = ZPCI_FN_STATE_CONFIGURED;
160 else
161 zdev->state = ZPCI_FN_STATE_STANDBY;
162
163 rc = zpci_create_device(zdev);
164 if (rc)
165 goto error;
166 return 0;
167
168error:
169 zpci_free_device(zdev);
170 return rc;
171}
172
173/*
174 * Enable/Disable a given PCI function defined by its function handle.
175 */
176static int clp_set_pci_fn(u32 *fh, u8 nr_dma_as, u8 command)
177{
178 struct clp_req_rsp_set_pci *rrb;
179 int rc, retries = 1000;
180
181 rrb = clp_alloc_block();
182 if (!rrb)
183 return -ENOMEM;
184
185 do {
186 memset(rrb, 0, sizeof(*rrb));
187 rrb->request.hdr.len = sizeof(rrb->request);
188 rrb->request.hdr.cmd = CLP_SET_PCI_FN;
189 rrb->response.hdr.len = sizeof(rrb->response);
190 rrb->request.fh = *fh;
191 rrb->request.oc = command;
192 rrb->request.ndas = nr_dma_as;
193
194 rc = clp_instr(rrb);
195 if (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY) {
196 retries--;
197 if (retries < 0)
198 break;
199 msleep(1);
200 }
201 } while (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY);
202
203 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
204 *fh = rrb->response.fh;
205 else {
206 pr_err("Set PCI FN failed with response: %x cc: %d\n",
207 rrb->response.hdr.rsp, rc);
208 rc = -EIO;
209 }
210 clp_free_block(rrb);
211 return rc;
212}
213
214int clp_enable_fh(struct zpci_dev *zdev, u8 nr_dma_as)
215{
216 u32 fh = zdev->fh;
217 int rc;
218
219 rc = clp_set_pci_fn(&fh, nr_dma_as, CLP_SET_ENABLE_PCI_FN);
220 if (!rc)
221 /* Success -> store enabled handle in zdev */
222 zdev->fh = fh;
223 return rc;
224}
225
226int clp_disable_fh(struct zpci_dev *zdev)
227{
228 u32 fh = zdev->fh;
229 int rc;
230
231 if (!zdev_enabled(zdev))
232 return 0;
233
234 dev_info(&zdev->pdev->dev, "disabling fn handle: 0x%x\n", fh);
235 rc = clp_set_pci_fn(&fh, 0, CLP_SET_DISABLE_PCI_FN);
236 if (!rc)
237 /* Success -> store disabled handle in zdev */
238 zdev->fh = fh;
239 else
240 dev_err(&zdev->pdev->dev,
241 "Failed to disable fn handle: 0x%x\n", fh);
242 return rc;
243}
244
245static void clp_check_pcifn_entry(struct clp_fh_list_entry *entry)
246{
247 int present, rc;
248
249 if (!entry->vendor_id)
250 return;
251
252 /* TODO: be a little bit more scalable */
253 present = zpci_fid_present(entry->fid);
254
255 if (present)
256 pr_debug("%s: device %x already present\n", __func__, entry->fid);
257
258 /* skip already used functions */
259 if (present && entry->config_state)
260 return;
261
262 /* aev 306: function moved to stand-by state */
263 if (present && !entry->config_state) {
264 /*
265 * The handle is already disabled, that means no iota/irq freeing via
266 * the firmware interfaces anymore. Need to free resources manually
267 * (DMA memory, debug, sysfs)...
268 */
269 zpci_stop_device(get_zdev_by_fid(entry->fid));
270 return;
271 }
272
273 rc = clp_add_pci_device(entry->fid, entry->fh, entry->config_state);
274 if (rc)
275 pr_err("Failed to add fid: 0x%x\n", entry->fid);
276}
277
278int clp_find_pci_devices(void)
279{
280 struct clp_req_rsp_list_pci *rrb;
281 u64 resume_token = 0;
282 int entries, i, rc;
283
284 rrb = clp_alloc_block();
285 if (!rrb)
286 return -ENOMEM;
287
288 do {
289 memset(rrb, 0, sizeof(*rrb));
290 rrb->request.hdr.len = sizeof(rrb->request);
291 rrb->request.hdr.cmd = CLP_LIST_PCI;
292 /* store as many entries as possible */
293 rrb->response.hdr.len = CLP_BLK_SIZE - LIST_PCI_HDR_LEN;
294 rrb->request.resume_token = resume_token;
295
296 /* Get PCI function handle list */
297 rc = clp_instr(rrb);
298 if (rc || rrb->response.hdr.rsp != CLP_RC_OK) {
299 pr_err("List PCI failed with response: 0x%x cc: %d\n",
300 rrb->response.hdr.rsp, rc);
301 rc = -EIO;
302 goto out;
303 }
304
305 WARN_ON_ONCE(rrb->response.entry_size !=
306 sizeof(struct clp_fh_list_entry));
307
308 entries = (rrb->response.hdr.len - LIST_PCI_HDR_LEN) /
309 rrb->response.entry_size;
310 pr_info("Detected number of PCI functions: %u\n", entries);
311
312 /* Store the returned resume token as input for the next call */
313 resume_token = rrb->response.resume_token;
314
315 for (i = 0; i < entries; i++)
316 clp_check_pcifn_entry(&rrb->response.fh_list[i]);
317 } while (resume_token);
318
319 pr_debug("Maximum number of supported PCI functions: %u\n",
320 rrb->response.max_fn);
321out:
322 clp_free_block(rrb);
323 return rc;
324}
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
new file mode 100644
index 00000000000..c64b4b294b0
--- /dev/null
+++ b/arch/s390/pci/pci_dma.c
@@ -0,0 +1,506 @@
1/*
2 * Copyright IBM Corp. 2012
3 *
4 * Author(s):
5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */
7
8#include <linux/kernel.h>
9#include <linux/slab.h>
10#include <linux/export.h>
11#include <linux/iommu-helper.h>
12#include <linux/dma-mapping.h>
13#include <linux/pci.h>
14#include <asm/pci_dma.h>
15
16static enum zpci_ioat_dtype zpci_ioat_dt = ZPCI_IOTA_RTTO;
17
18static struct kmem_cache *dma_region_table_cache;
19static struct kmem_cache *dma_page_table_cache;
20
21static unsigned long *dma_alloc_cpu_table(void)
22{
23 unsigned long *table, *entry;
24
25 table = kmem_cache_alloc(dma_region_table_cache, GFP_ATOMIC);
26 if (!table)
27 return NULL;
28
29 for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++)
30 *entry = ZPCI_TABLE_INVALID | ZPCI_TABLE_PROTECTED;
31 return table;
32}
33
34static void dma_free_cpu_table(void *table)
35{
36 kmem_cache_free(dma_region_table_cache, table);
37}
38
39static unsigned long *dma_alloc_page_table(void)
40{
41 unsigned long *table, *entry;
42
43 table = kmem_cache_alloc(dma_page_table_cache, GFP_ATOMIC);
44 if (!table)
45 return NULL;
46
47 for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++)
48 *entry = ZPCI_PTE_INVALID | ZPCI_TABLE_PROTECTED;
49 return table;
50}
51
52static void dma_free_page_table(void *table)
53{
54 kmem_cache_free(dma_page_table_cache, table);
55}
56
57static unsigned long *dma_get_seg_table_origin(unsigned long *entry)
58{
59 unsigned long *sto;
60
61 if (reg_entry_isvalid(*entry))
62 sto = get_rt_sto(*entry);
63 else {
64 sto = dma_alloc_cpu_table();
65 if (!sto)
66 return NULL;
67
68 set_rt_sto(entry, sto);
69 validate_rt_entry(entry);
70 entry_clr_protected(entry);
71 }
72 return sto;
73}
74
75static unsigned long *dma_get_page_table_origin(unsigned long *entry)
76{
77 unsigned long *pto;
78
79 if (reg_entry_isvalid(*entry))
80 pto = get_st_pto(*entry);
81 else {
82 pto = dma_alloc_page_table();
83 if (!pto)
84 return NULL;
85 set_st_pto(entry, pto);
86 validate_st_entry(entry);
87 entry_clr_protected(entry);
88 }
89 return pto;
90}
91
92static unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr)
93{
94 unsigned long *sto, *pto;
95 unsigned int rtx, sx, px;
96
97 rtx = calc_rtx(dma_addr);
98 sto = dma_get_seg_table_origin(&rto[rtx]);
99 if (!sto)
100 return NULL;
101
102 sx = calc_sx(dma_addr);
103 pto = dma_get_page_table_origin(&sto[sx]);
104 if (!pto)
105 return NULL;
106
107 px = calc_px(dma_addr);
108 return &pto[px];
109}
110
111static void dma_update_cpu_trans(struct zpci_dev *zdev, void *page_addr,
112 dma_addr_t dma_addr, int flags)
113{
114 unsigned long *entry;
115
116 entry = dma_walk_cpu_trans(zdev->dma_table, dma_addr);
117 if (!entry) {
118 WARN_ON_ONCE(1);
119 return;
120 }
121
122 if (flags & ZPCI_PTE_INVALID) {
123 invalidate_pt_entry(entry);
124 return;
125 } else {
126 set_pt_pfaa(entry, page_addr);
127 validate_pt_entry(entry);
128 }
129
130 if (flags & ZPCI_TABLE_PROTECTED)
131 entry_set_protected(entry);
132 else
133 entry_clr_protected(entry);
134}
135
136static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa,
137 dma_addr_t dma_addr, size_t size, int flags)
138{
139 unsigned int nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
140 u8 *page_addr = (u8 *) (pa & PAGE_MASK);
141 dma_addr_t start_dma_addr = dma_addr;
142 unsigned long irq_flags;
143 int i, rc = 0;
144
145 if (!nr_pages)
146 return -EINVAL;
147
148 spin_lock_irqsave(&zdev->dma_table_lock, irq_flags);
149 if (!zdev->dma_table) {
150 dev_err(&zdev->pdev->dev, "Missing DMA table\n");
151 goto no_refresh;
152 }
153
154 for (i = 0; i < nr_pages; i++) {
155 dma_update_cpu_trans(zdev, page_addr, dma_addr, flags);
156 page_addr += PAGE_SIZE;
157 dma_addr += PAGE_SIZE;
158 }
159
160 /*
161 * rpcit is not required to establish new translations when previously
162 * invalid translation-table entries are validated, however it is
163 * required when altering previously valid entries.
164 */
165 if (!zdev->tlb_refresh &&
166 ((flags & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID))
167 /*
168 * TODO: also need to check that the old entry is indeed INVALID
169 * and not only for one page but for the whole range...
170 * -> now we WARN_ON in that case but with lazy unmap that
171 * needs to be redone!
172 */
173 goto no_refresh;
174 rc = rpcit_instr((u64) zdev->fh << 32, start_dma_addr,
175 nr_pages * PAGE_SIZE);
176
177no_refresh:
178 spin_unlock_irqrestore(&zdev->dma_table_lock, irq_flags);
179 return rc;
180}
181
182static void dma_free_seg_table(unsigned long entry)
183{
184 unsigned long *sto = get_rt_sto(entry);
185 int sx;
186
187 for (sx = 0; sx < ZPCI_TABLE_ENTRIES; sx++)
188 if (reg_entry_isvalid(sto[sx]))
189 dma_free_page_table(get_st_pto(sto[sx]));
190
191 dma_free_cpu_table(sto);
192}
193
194static void dma_cleanup_tables(struct zpci_dev *zdev)
195{
196 unsigned long *table;
197 int rtx;
198
199 if (!zdev || !zdev->dma_table)
200 return;
201
202 table = zdev->dma_table;
203 for (rtx = 0; rtx < ZPCI_TABLE_ENTRIES; rtx++)
204 if (reg_entry_isvalid(table[rtx]))
205 dma_free_seg_table(table[rtx]);
206
207 dma_free_cpu_table(table);
208 zdev->dma_table = NULL;
209}
210
211static unsigned long __dma_alloc_iommu(struct zpci_dev *zdev, unsigned long start,
212 int size)
213{
214 unsigned long boundary_size = 0x1000000;
215
216 return iommu_area_alloc(zdev->iommu_bitmap, zdev->iommu_pages,
217 start, size, 0, boundary_size, 0);
218}
219
220static unsigned long dma_alloc_iommu(struct zpci_dev *zdev, int size)
221{
222 unsigned long offset, flags;
223
224 spin_lock_irqsave(&zdev->iommu_bitmap_lock, flags);
225 offset = __dma_alloc_iommu(zdev, zdev->next_bit, size);
226 if (offset == -1)
227 offset = __dma_alloc_iommu(zdev, 0, size);
228
229 if (offset != -1) {
230 zdev->next_bit = offset + size;
231 if (zdev->next_bit >= zdev->iommu_pages)
232 zdev->next_bit = 0;
233 }
234 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags);
235 return offset;
236}
237
238static void dma_free_iommu(struct zpci_dev *zdev, unsigned long offset, int size)
239{
240 unsigned long flags;
241
242 spin_lock_irqsave(&zdev->iommu_bitmap_lock, flags);
243 if (!zdev->iommu_bitmap)
244 goto out;
245 bitmap_clear(zdev->iommu_bitmap, offset, size);
246 if (offset >= zdev->next_bit)
247 zdev->next_bit = offset + size;
248out:
249 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags);
250}
251
252int dma_set_mask(struct device *dev, u64 mask)
253{
254 if (!dev->dma_mask || !dma_supported(dev, mask))
255 return -EIO;
256
257 *dev->dma_mask = mask;
258 return 0;
259}
260EXPORT_SYMBOL_GPL(dma_set_mask);
261
262static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
263 unsigned long offset, size_t size,
264 enum dma_data_direction direction,
265 struct dma_attrs *attrs)
266{
267 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev));
268 unsigned long nr_pages, iommu_page_index;
269 unsigned long pa = page_to_phys(page) + offset;
270 int flags = ZPCI_PTE_VALID;
271 dma_addr_t dma_addr;
272
273 WARN_ON_ONCE(offset > PAGE_SIZE);
274
275 /* This rounds up number of pages based on size and offset */
276 nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
277 iommu_page_index = dma_alloc_iommu(zdev, nr_pages);
278 if (iommu_page_index == -1)
279 goto out_err;
280
281 /* Use rounded up size */
282 size = nr_pages * PAGE_SIZE;
283
284 dma_addr = zdev->start_dma + iommu_page_index * PAGE_SIZE;
285 if (dma_addr + size > zdev->end_dma) {
286 dev_err(dev, "(dma_addr: 0x%16.16LX + size: 0x%16.16lx) > end_dma: 0x%16.16Lx\n",
287 dma_addr, size, zdev->end_dma);
288 goto out_free;
289 }
290
291 if (direction == DMA_NONE || direction == DMA_TO_DEVICE)
292 flags |= ZPCI_TABLE_PROTECTED;
293
294 if (!dma_update_trans(zdev, pa, dma_addr, size, flags))
295 return dma_addr + offset;
296
297out_free:
298 dma_free_iommu(zdev, iommu_page_index, nr_pages);
299out_err:
300 dev_err(dev, "Failed to map addr: %lx\n", pa);
301 return DMA_ERROR_CODE;
302}
303
304static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
305 size_t size, enum dma_data_direction direction,
306 struct dma_attrs *attrs)
307{
308 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev));
309 unsigned long iommu_page_index;
310 int npages;
311
312 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
313 dma_addr = dma_addr & PAGE_MASK;
314 if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
315 ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID))
316 dev_err(dev, "Failed to unmap addr: %Lx\n", dma_addr);
317
318 iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT;
319 dma_free_iommu(zdev, iommu_page_index, npages);
320}
321
322static void *s390_dma_alloc(struct device *dev, size_t size,
323 dma_addr_t *dma_handle, gfp_t flag,
324 struct dma_attrs *attrs)
325{
326 struct page *page;
327 unsigned long pa;
328 dma_addr_t map;
329
330 size = PAGE_ALIGN(size);
331 page = alloc_pages(flag, get_order(size));
332 if (!page)
333 return NULL;
334 pa = page_to_phys(page);
335 memset((void *) pa, 0, size);
336
337 map = s390_dma_map_pages(dev, page, pa % PAGE_SIZE,
338 size, DMA_BIDIRECTIONAL, NULL);
339 if (dma_mapping_error(dev, map)) {
340 free_pages(pa, get_order(size));
341 return NULL;
342 }
343
344 if (dma_handle)
345 *dma_handle = map;
346 return (void *) pa;
347}
348
349static void s390_dma_free(struct device *dev, size_t size,
350 void *pa, dma_addr_t dma_handle,
351 struct dma_attrs *attrs)
352{
353 s390_dma_unmap_pages(dev, dma_handle, PAGE_ALIGN(size),
354 DMA_BIDIRECTIONAL, NULL);
355 free_pages((unsigned long) pa, get_order(size));
356}
357
358static int s390_dma_map_sg(struct device *dev, struct scatterlist *sg,
359 int nr_elements, enum dma_data_direction dir,
360 struct dma_attrs *attrs)
361{
362 int mapped_elements = 0;
363 struct scatterlist *s;
364 int i;
365
366 for_each_sg(sg, s, nr_elements, i) {
367 struct page *page = sg_page(s);
368 s->dma_address = s390_dma_map_pages(dev, page, s->offset,
369 s->length, dir, NULL);
370 if (!dma_mapping_error(dev, s->dma_address)) {
371 s->dma_length = s->length;
372 mapped_elements++;
373 } else
374 goto unmap;
375 }
376out:
377 return mapped_elements;
378
379unmap:
380 for_each_sg(sg, s, mapped_elements, i) {
381 if (s->dma_address)
382 s390_dma_unmap_pages(dev, s->dma_address, s->dma_length,
383 dir, NULL);
384 s->dma_address = 0;
385 s->dma_length = 0;
386 }
387 mapped_elements = 0;
388 goto out;
389}
390
391static void s390_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
392 int nr_elements, enum dma_data_direction dir,
393 struct dma_attrs *attrs)
394{
395 struct scatterlist *s;
396 int i;
397
398 for_each_sg(sg, s, nr_elements, i) {
399 s390_dma_unmap_pages(dev, s->dma_address, s->dma_length, dir, NULL);
400 s->dma_address = 0;
401 s->dma_length = 0;
402 }
403}
404
405int zpci_dma_init_device(struct zpci_dev *zdev)
406{
407 unsigned int bitmap_order;
408 int rc;
409
410 spin_lock_init(&zdev->iommu_bitmap_lock);
411 spin_lock_init(&zdev->dma_table_lock);
412
413 zdev->dma_table = dma_alloc_cpu_table();
414 if (!zdev->dma_table) {
415 rc = -ENOMEM;
416 goto out_clean;
417 }
418
419 zdev->iommu_size = (unsigned long) high_memory - PAGE_OFFSET;
420 zdev->iommu_pages = zdev->iommu_size >> PAGE_SHIFT;
421 bitmap_order = get_order(zdev->iommu_pages / 8);
422 pr_info("iommu_size: 0x%lx iommu_pages: 0x%lx bitmap_order: %i\n",
423 zdev->iommu_size, zdev->iommu_pages, bitmap_order);
424
425 zdev->iommu_bitmap = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
426 bitmap_order);
427 if (!zdev->iommu_bitmap) {
428 rc = -ENOMEM;
429 goto out_reg;
430 }
431
432 rc = zpci_register_ioat(zdev,
433 0,
434 zdev->start_dma + PAGE_OFFSET,
435 zdev->start_dma + zdev->iommu_size - 1,
436 (u64) zdev->dma_table);
437 if (rc)
438 goto out_reg;
439 return 0;
440
441out_reg:
442 dma_free_cpu_table(zdev->dma_table);
443out_clean:
444 return rc;
445}
446
447void zpci_dma_exit_device(struct zpci_dev *zdev)
448{
449 zpci_unregister_ioat(zdev, 0);
450 dma_cleanup_tables(zdev);
451 free_pages((unsigned long) zdev->iommu_bitmap,
452 get_order(zdev->iommu_pages / 8));
453 zdev->iommu_bitmap = NULL;
454 zdev->next_bit = 0;
455}
456
457static int __init dma_alloc_cpu_table_caches(void)
458{
459 dma_region_table_cache = kmem_cache_create("PCI_DMA_region_tables",
460 ZPCI_TABLE_SIZE, ZPCI_TABLE_ALIGN,
461 0, NULL);
462 if (!dma_region_table_cache)
463 return -ENOMEM;
464
465 dma_page_table_cache = kmem_cache_create("PCI_DMA_page_tables",
466 ZPCI_PT_SIZE, ZPCI_PT_ALIGN,
467 0, NULL);
468 if (!dma_page_table_cache) {
469 kmem_cache_destroy(dma_region_table_cache);
470 return -ENOMEM;
471 }
472 return 0;
473}
474
475int __init zpci_dma_init(void)
476{
477 return dma_alloc_cpu_table_caches();
478}
479
480void zpci_dma_exit(void)
481{
482 kmem_cache_destroy(dma_page_table_cache);
483 kmem_cache_destroy(dma_region_table_cache);
484}
485
486#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
487
488static int __init dma_debug_do_init(void)
489{
490 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
491 return 0;
492}
493fs_initcall(dma_debug_do_init);
494
495struct dma_map_ops s390_dma_ops = {
496 .alloc = s390_dma_alloc,
497 .free = s390_dma_free,
498 .map_sg = s390_dma_map_sg,
499 .unmap_sg = s390_dma_unmap_sg,
500 .map_page = s390_dma_map_pages,
501 .unmap_page = s390_dma_unmap_pages,
502 /* if we support direct DMA this must be conditional */
503 .is_phys = 0,
504 /* dma_supported is unconditionally true without a callback */
505};
506EXPORT_SYMBOL_GPL(s390_dma_ops);
diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c
new file mode 100644
index 00000000000..dbed8cd3370
--- /dev/null
+++ b/arch/s390/pci/pci_event.c
@@ -0,0 +1,93 @@
1/*
2 * Copyright IBM Corp. 2012
3 *
4 * Author(s):
5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */
7
8#define COMPONENT "zPCI"
9#define pr_fmt(fmt) COMPONENT ": " fmt
10
11#include <linux/kernel.h>
12#include <linux/pci.h>
13
14/* Content Code Description for PCI Function Error */
15struct zpci_ccdf_err {
16 u32 reserved1;
17 u32 fh; /* function handle */
18 u32 fid; /* function id */
19 u32 ett : 4; /* expected table type */
20 u32 mvn : 12; /* MSI vector number */
21 u32 dmaas : 8; /* DMA address space */
22 u32 : 6;
23 u32 q : 1; /* event qualifier */
24 u32 rw : 1; /* read/write */
25 u64 faddr; /* failing address */
26 u32 reserved3;
27 u16 reserved4;
28 u16 pec; /* PCI event code */
29} __packed;
30
31/* Content Code Description for PCI Function Availability */
32struct zpci_ccdf_avail {
33 u32 reserved1;
34 u32 fh; /* function handle */
35 u32 fid; /* function id */
36 u32 reserved2;
37 u32 reserved3;
38 u32 reserved4;
39 u32 reserved5;
40 u16 reserved6;
41 u16 pec; /* PCI event code */
42} __packed;
43
44static void zpci_event_log_err(struct zpci_ccdf_err *ccdf)
45{
46 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
47
48 dev_err(&zdev->pdev->dev, "event code: 0x%x\n", ccdf->pec);
49}
50
51static void zpci_event_log_avail(struct zpci_ccdf_avail *ccdf)
52{
53 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
54
55 pr_err("%s%s: availability event: fh: 0x%x fid: 0x%x event code: 0x%x reason:",
56 (zdev) ? dev_driver_string(&zdev->pdev->dev) : "?",
57 (zdev) ? dev_name(&zdev->pdev->dev) : "?",
58 ccdf->fh, ccdf->fid, ccdf->pec);
59 print_hex_dump(KERN_CONT, "ccdf", DUMP_PREFIX_OFFSET,
60 16, 1, ccdf, sizeof(*ccdf), false);
61
62 switch (ccdf->pec) {
63 case 0x0301:
64 zpci_enable_device(zdev);
65 break;
66 case 0x0302:
67 clp_add_pci_device(ccdf->fid, ccdf->fh, 0);
68 break;
69 case 0x0306:
70 clp_find_pci_devices();
71 break;
72 default:
73 break;
74 }
75}
76
77void zpci_event_error(void *data)
78{
79 struct zpci_ccdf_err *ccdf = data;
80 struct zpci_dev *zdev;
81
82 zpci_event_log_err(ccdf);
83 zdev = get_zdev_by_fid(ccdf->fid);
84 if (!zdev) {
85 pr_err("Error event for unknown fid: %x", ccdf->fid);
86 return;
87 }
88}
89
90void zpci_event_availability(void *data)
91{
92 zpci_event_log_avail(data);
93}
diff --git a/arch/s390/pci/pci_msi.c b/arch/s390/pci/pci_msi.c
new file mode 100644
index 00000000000..90fd3482b9e
--- /dev/null
+++ b/arch/s390/pci/pci_msi.c
@@ -0,0 +1,141 @@
1/*
2 * Copyright IBM Corp. 2012
3 *
4 * Author(s):
5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */
7
8#define COMPONENT "zPCI"
9#define pr_fmt(fmt) COMPONENT ": " fmt
10
11#include <linux/kernel.h>
12#include <linux/err.h>
13#include <linux/rculist.h>
14#include <linux/hash.h>
15#include <linux/pci.h>
16#include <linux/msi.h>
17#include <asm/hw_irq.h>
18
19/* mapping of irq numbers to msi_desc */
20static struct hlist_head *msi_hash;
21static unsigned int msihash_shift = 6;
22#define msi_hashfn(nr) hash_long(nr, msihash_shift)
23
24static DEFINE_SPINLOCK(msi_map_lock);
25
26struct msi_desc *__irq_get_msi_desc(unsigned int irq)
27{
28 struct hlist_node *entry;
29 struct msi_map *map;
30
31 hlist_for_each_entry_rcu(map, entry,
32 &msi_hash[msi_hashfn(irq)], msi_chain)
33 if (map->irq == irq)
34 return map->msi;
35 return NULL;
36}
37
38int zpci_msi_set_mask_bits(struct msi_desc *msi, u32 mask, u32 flag)
39{
40 if (msi->msi_attrib.is_msix) {
41 int offset = msi->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE +
42 PCI_MSIX_ENTRY_VECTOR_CTRL;
43 msi->masked = readl(msi->mask_base + offset);
44 writel(flag, msi->mask_base + offset);
45 } else {
46 if (msi->msi_attrib.maskbit) {
47 int pos;
48 u32 mask_bits;
49
50 pos = (long) msi->mask_base;
51 pci_read_config_dword(msi->dev, pos, &mask_bits);
52 mask_bits &= ~(mask);
53 mask_bits |= flag & mask;
54 pci_write_config_dword(msi->dev, pos, mask_bits);
55 } else {
56 return 0;
57 }
58 }
59
60 msi->msi_attrib.maskbit = !!flag;
61 return 1;
62}
63
64int zpci_setup_msi_irq(struct zpci_dev *zdev, struct msi_desc *msi,
65 unsigned int nr, int offset)
66{
67 struct msi_map *map;
68 struct msi_msg msg;
69 int rc;
70
71 map = kmalloc(sizeof(*map), GFP_KERNEL);
72 if (map == NULL)
73 return -ENOMEM;
74
75 map->irq = nr;
76 map->msi = msi;
77 zdev->msi_map[nr & ZPCI_MSI_MASK] = map;
78
79 pr_debug("%s hashing irq: %u to bucket nr: %llu\n",
80 __func__, nr, msi_hashfn(nr));
81 hlist_add_head_rcu(&map->msi_chain, &msi_hash[msi_hashfn(nr)]);
82
83 spin_lock(&msi_map_lock);
84 rc = irq_set_msi_desc(nr, msi);
85 if (rc) {
86 spin_unlock(&msi_map_lock);
87 hlist_del_rcu(&map->msi_chain);
88 kfree(map);
89 zdev->msi_map[nr & ZPCI_MSI_MASK] = NULL;
90 return rc;
91 }
92 spin_unlock(&msi_map_lock);
93
94 msg.data = nr - offset;
95 msg.address_lo = zdev->msi_addr & 0xffffffff;
96 msg.address_hi = zdev->msi_addr >> 32;
97 write_msi_msg(nr, &msg);
98 return 0;
99}
100
101void zpci_teardown_msi_irq(struct zpci_dev *zdev, struct msi_desc *msi)
102{
103 int irq = msi->irq & ZPCI_MSI_MASK;
104 struct msi_map *map;
105
106 msi->msg.address_lo = 0;
107 msi->msg.address_hi = 0;
108 msi->msg.data = 0;
109 msi->irq = 0;
110 zpci_msi_set_mask_bits(msi, 1, 1);
111
112 spin_lock(&msi_map_lock);
113 map = zdev->msi_map[irq];
114 hlist_del_rcu(&map->msi_chain);
115 kfree(map);
116 zdev->msi_map[irq] = NULL;
117 spin_unlock(&msi_map_lock);
118}
119
120/*
121 * The msi hash table has 256 entries which is good for 4..20
122 * devices (a typical device allocates 10 + CPUs MSI's). Maybe make
123 * the hash table size adjustable later.
124 */
125int __init zpci_msihash_init(void)
126{
127 unsigned int i;
128
129 msi_hash = kmalloc(256 * sizeof(*msi_hash), GFP_KERNEL);
130 if (!msi_hash)
131 return -ENOMEM;
132
133 for (i = 0; i < (1U << msihash_shift); i++)
134 INIT_HLIST_HEAD(&msi_hash[i]);
135 return 0;
136}
137
138void __init zpci_msihash_exit(void)
139{
140 kfree(msi_hash);
141}
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
new file mode 100644
index 00000000000..a42cce69d0a
--- /dev/null
+++ b/arch/s390/pci/pci_sysfs.c
@@ -0,0 +1,86 @@
1/*
2 * Copyright IBM Corp. 2012
3 *
4 * Author(s):
5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */
7
8#define COMPONENT "zPCI"
9#define pr_fmt(fmt) COMPONENT ": " fmt
10
11#include <linux/kernel.h>
12#include <linux/stat.h>
13#include <linux/pci.h>
14
15static ssize_t show_fid(struct device *dev, struct device_attribute *attr,
16 char *buf)
17{
18 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev));
19
20 sprintf(buf, "0x%08x\n", zdev->fid);
21 return strlen(buf);
22}
23static DEVICE_ATTR(function_id, S_IRUGO, show_fid, NULL);
24
25static ssize_t show_fh(struct device *dev, struct device_attribute *attr,
26 char *buf)
27{
28 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev));
29
30 sprintf(buf, "0x%08x\n", zdev->fh);
31 return strlen(buf);
32}
33static DEVICE_ATTR(function_handle, S_IRUGO, show_fh, NULL);
34
35static ssize_t show_pchid(struct device *dev, struct device_attribute *attr,
36 char *buf)
37{
38 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev));
39
40 sprintf(buf, "0x%04x\n", zdev->pchid);
41 return strlen(buf);
42}
43static DEVICE_ATTR(pchid, S_IRUGO, show_pchid, NULL);
44
45static ssize_t show_pfgid(struct device *dev, struct device_attribute *attr,
46 char *buf)
47{
48 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev));
49
50 sprintf(buf, "0x%02x\n", zdev->pfgid);
51 return strlen(buf);
52}
53static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL);
54
55static struct device_attribute *zpci_dev_attrs[] = {
56 &dev_attr_function_id,
57 &dev_attr_function_handle,
58 &dev_attr_pchid,
59 &dev_attr_pfgid,
60 NULL,
61};
62
63int zpci_sysfs_add_device(struct device *dev)
64{
65 int i, rc = 0;
66
67 for (i = 0; zpci_dev_attrs[i]; i++) {
68 rc = device_create_file(dev, zpci_dev_attrs[i]);
69 if (rc)
70 goto error;
71 }
72 return 0;
73
74error:
75 while (--i >= 0)
76 device_remove_file(dev, zpci_dev_attrs[i]);
77 return rc;
78}
79
80void zpci_sysfs_remove_device(struct device *dev)
81{
82 int i;
83
84 for (i = 0; zpci_dev_attrs[i]; i++)
85 device_remove_file(dev, zpci_dev_attrs[i]);
86}
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index 4f93a431a45..45893390c7d 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -13,6 +13,9 @@ config SCORE
13 select GENERIC_CLOCKEVENTS 13 select GENERIC_CLOCKEVENTS
14 select HAVE_MOD_ARCH_SPECIFIC 14 select HAVE_MOD_ARCH_SPECIFIC
15 select MODULES_USE_ELF_REL 15 select MODULES_USE_ELF_REL
16 select GENERIC_KERNEL_THREAD
17 select GENERIC_KERNEL_EXECVE
18 select CLONE_BACKWARDS
16 19
17choice 20choice
18 prompt "System type" 21 prompt "System type"
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index ec697aeefd0..16e41fe1a41 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -3,3 +3,4 @@ include include/asm-generic/Kbuild.asm
3header-y += 3header-y +=
4 4
5generic-y += clkdev.h 5generic-y += clkdev.h
6generic-y += trace_clock.h
diff --git a/arch/score/include/asm/processor.h b/arch/score/include/asm/processor.h
index ab3aceb5420..d9a922d8711 100644
--- a/arch/score/include/asm/processor.h
+++ b/arch/score/include/asm/processor.h
@@ -13,7 +13,6 @@ struct task_struct;
13 */ 13 */
14extern void (*cpu_wait)(void); 14extern void (*cpu_wait)(void);
15 15
16extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
17extern unsigned long thread_saved_pc(struct task_struct *tsk); 16extern unsigned long thread_saved_pc(struct task_struct *tsk);
18extern void start_thread(struct pt_regs *regs, 17extern void start_thread(struct pt_regs *regs,
19 unsigned long pc, unsigned long sp); 18 unsigned long pc, unsigned long sp);
diff --git a/arch/score/include/asm/syscalls.h b/arch/score/include/asm/syscalls.h
index 1dd5e0d6b0c..acaeed68095 100644
--- a/arch/score/include/asm/syscalls.h
+++ b/arch/score/include/asm/syscalls.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_SCORE_SYSCALLS_H 1#ifndef _ASM_SCORE_SYSCALLS_H
2#define _ASM_SCORE_SYSCALLS_H 2#define _ASM_SCORE_SYSCALLS_H
3 3
4asmlinkage long score_clone(struct pt_regs *regs);
5asmlinkage long score_execve(struct pt_regs *regs);
6asmlinkage long score_sigaltstack(struct pt_regs *regs); 4asmlinkage long score_sigaltstack(struct pt_regs *regs);
7asmlinkage long score_rt_sigreturn(struct pt_regs *regs); 5asmlinkage long score_rt_sigreturn(struct pt_regs *regs);
8 6
diff --git a/arch/score/include/asm/unistd.h b/arch/score/include/asm/unistd.h
index a862384e9c1..56001c93095 100644
--- a/arch/score/include/asm/unistd.h
+++ b/arch/score/include/asm/unistd.h
@@ -4,5 +4,9 @@
4#define __ARCH_WANT_SYSCALL_NO_FLAGS 4#define __ARCH_WANT_SYSCALL_NO_FLAGS
5#define __ARCH_WANT_SYSCALL_OFF_T 5#define __ARCH_WANT_SYSCALL_OFF_T
6#define __ARCH_WANT_SYSCALL_DEPRECATED 6#define __ARCH_WANT_SYSCALL_DEPRECATED
7#define __ARCH_WANT_SYS_EXECVE
8#define __ARCH_WANT_SYS_CLONE
9#define __ARCH_WANT_SYS_FORK
10#define __ARCH_WANT_SYS_VFORK
7 11
8#include <asm-generic/unistd.h> 12#include <asm-generic/unistd.h>
diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S
index 83bb96079c4..1557ca1a295 100644
--- a/arch/score/kernel/entry.S
+++ b/arch/score/kernel/entry.S
@@ -278,6 +278,13 @@ need_resched:
278 nop 278 nop
279#endif 279#endif
280 280
281ENTRY(ret_from_kernel_thread)
282 bl schedule_tail # r4=struct task_struct *prev
283 nop
284 mv r4, r13
285 brl r12
286 j syscall_exit
287
281ENTRY(ret_from_fork) 288ENTRY(ret_from_fork)
282 bl schedule_tail # r4=struct task_struct *prev 289 bl schedule_tail # r4=struct task_struct *prev
283 290
@@ -480,16 +487,6 @@ illegal_syscall:
480 sw r9, [r0, PT_R7] 487 sw r9, [r0, PT_R7]
481 j syscall_return 488 j syscall_return
482 489
483ENTRY(sys_execve)
484 mv r4, r0
485 la r8, score_execve
486 br r8
487
488ENTRY(sys_clone)
489 mv r4, r0
490 la r8, score_clone
491 br r8
492
493ENTRY(sys_rt_sigreturn) 490ENTRY(sys_rt_sigreturn)
494 mv r4, r0 491 mv r4, r0
495 la r8, score_rt_sigreturn 492 la r8, score_rt_sigreturn
@@ -499,16 +496,3 @@ ENTRY(sys_sigaltstack)
499 mv r4, r0 496 mv r4, r0
500 la r8, score_sigaltstack 497 la r8, score_sigaltstack
501 br r8 498 br r8
502
503#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
504ENTRY(sys_fork)
505 mv r4, r0
506 la r8, score_fork
507 br r8
508
509ENTRY(sys_vfork)
510 mv r4, r0
511 la r8, score_vfork
512 br r8
513#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
514
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index 637970cfd3f..79568466b57 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -60,6 +60,7 @@ void __noreturn cpu_idle(void)
60} 60}
61 61
62void ret_from_fork(void); 62void ret_from_fork(void);
63void ret_from_kernel_thread(void);
63 64
64void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) 65void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
65{ 66{
@@ -86,29 +87,27 @@ void flush_thread(void) {}
86 * set up the kernel stack and exception frames for a new process 87 * set up the kernel stack and exception frames for a new process
87 */ 88 */
88int copy_thread(unsigned long clone_flags, unsigned long usp, 89int copy_thread(unsigned long clone_flags, unsigned long usp,
89 unsigned long unused, 90 unsigned long arg, struct task_struct *p)
90 struct task_struct *p, struct pt_regs *regs)
91{ 91{
92 struct thread_info *ti = task_thread_info(p); 92 struct thread_info *ti = task_thread_info(p);
93 struct pt_regs *childregs = task_pt_regs(p); 93 struct pt_regs *childregs = task_pt_regs(p);
94 struct pt_regs *regs = current_pt_regs();
94 95
95 p->set_child_tid = NULL; 96 p->thread.reg0 = (unsigned long) childregs;
96 p->clear_child_tid = NULL; 97 if (unlikely(p->flags & PF_KTHREAD)) {
97 98 memset(childregs, 0, sizeof(struct pt_regs));
98 *childregs = *regs; 99 p->thread->reg12 = usp;
99 childregs->regs[7] = 0; /* Clear error flag */ 100 p->thread->reg13 = arg;
100 childregs->regs[4] = 0; /* Child gets zero as return value */ 101 p->thread.reg3 = (unsigned long) ret_from_kernel_thread;
101 regs->regs[4] = p->pid;
102
103 if (childregs->cp0_psr & 0x8) { /* test kernel fork or user fork */
104 childregs->regs[0] = usp; /* user fork */
105 } else { 102 } else {
106 childregs->regs[28] = (unsigned long) ti; /* kernel fork */ 103 *childregs = *current_pt_regs();
107 childregs->regs[0] = (unsigned long) childregs; 104 childregs->regs[7] = 0; /* Clear error flag */
105 childregs->regs[4] = 0; /* Child gets zero as return value */
106 if (usp)
107 childregs->regs[0] = usp; /* user fork */
108 p->thread.reg3 = (unsigned long) ret_from_fork;
108 } 109 }
109 110
110 p->thread.reg0 = (unsigned long) childregs;
111 p->thread.reg3 = (unsigned long) ret_from_fork;
112 p->thread.cp0_psr = 0; 111 p->thread.cp0_psr = 0;
113 112
114 return 0; 113 return 0;
@@ -120,32 +119,6 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
120 return 1; 119 return 1;
121} 120}
122 121
123static void __noreturn
124kernel_thread_helper(void *unused0, int (*fn)(void *),
125 void *arg, void *unused1)
126{
127 do_exit(fn(arg));
128}
129
130/*
131 * Create a kernel thread.
132 */
133long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
134{
135 struct pt_regs regs;
136
137 memset(&regs, 0, sizeof(regs));
138
139 regs.regs[6] = (unsigned long) arg;
140 regs.regs[5] = (unsigned long) fn;
141 regs.cp0_epc = (unsigned long) kernel_thread_helper;
142 regs.cp0_psr = (regs.cp0_psr & ~(0x1|0x4|0x8)) | \
143 ((regs.cp0_psr & 0x3) << 2);
144
145 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, \
146 0, &regs, 0, NULL, NULL);
147}
148
149unsigned long thread_saved_pc(struct task_struct *tsk) 122unsigned long thread_saved_pc(struct task_struct *tsk)
150{ 123{
151 return task_pt_regs(tsk)->cp0_epc; 124 return task_pt_regs(tsk)->cp0_epc;
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
index c268bbf8b41..02353bde92d 100644
--- a/arch/score/kernel/signal.c
+++ b/arch/score/kernel/signal.c
@@ -148,7 +148,6 @@ score_rt_sigreturn(struct pt_regs *regs)
148{ 148{
149 struct rt_sigframe __user *frame; 149 struct rt_sigframe __user *frame;
150 sigset_t set; 150 sigset_t set;
151 stack_t st;
152 int sig; 151 int sig;
153 152
154 /* Always make any pending restarted system calls return -EINTR */ 153 /* Always make any pending restarted system calls return -EINTR */
@@ -168,12 +167,10 @@ score_rt_sigreturn(struct pt_regs *regs)
168 else if (sig) 167 else if (sig)
169 force_sig(sig, current); 168 force_sig(sig, current);
170 169
171 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st)))
172 goto badframe;
173
174 /* It is more difficult to avoid calling this function than to 170 /* It is more difficult to avoid calling this function than to
175 call it and ignore errors. */ 171 call it and ignore errors. */
176 do_sigaltstack((stack_t __user *)&st, NULL, regs->regs[0]); 172 if (do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs->regs[0]) == -EFAULT)
173 goto badframe;
177 regs->is_syscall = 0; 174 regs->is_syscall = 0;
178 175
179 __asm__ __volatile__( 176 __asm__ __volatile__(
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
index d45cf00a335..47c20ba4616 100644
--- a/arch/score/kernel/sys_score.c
+++ b/arch/score/kernel/sys_score.c
@@ -48,92 +48,3 @@ sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
48 return -EINVAL; 48 return -EINVAL;
49 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 49 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
50} 50}
51
52asmlinkage long
53score_fork(struct pt_regs *regs)
54{
55 return do_fork(SIGCHLD, regs->regs[0], regs, 0, NULL, NULL);
56}
57
58/*
59 * Clone a task - this clones the calling program thread.
60 * This is called indirectly via a small wrapper
61 */
62asmlinkage long
63score_clone(struct pt_regs *regs)
64{
65 unsigned long clone_flags;
66 unsigned long newsp;
67 int __user *parent_tidptr, *child_tidptr;
68
69 clone_flags = regs->regs[4];
70 newsp = regs->regs[5];
71 if (!newsp)
72 newsp = regs->regs[0];
73 parent_tidptr = (int __user *)regs->regs[6];
74 child_tidptr = (int __user *)regs->regs[8];
75
76 return do_fork(clone_flags, newsp, regs, 0,
77 parent_tidptr, child_tidptr);
78}
79
80asmlinkage long
81score_vfork(struct pt_regs *regs)
82{
83 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
84 regs->regs[0], regs, 0, NULL, NULL);
85}
86
87/*
88 * sys_execve() executes a new program.
89 * This is called indirectly via a small wrapper
90 */
91asmlinkage long
92score_execve(struct pt_regs *regs)
93{
94 int error;
95 struct filename *filename;
96
97 filename = getname((char __user*)regs->regs[4]);
98 error = PTR_ERR(filename);
99 if (IS_ERR(filename))
100 return error;
101
102 error = do_execve(filename->name,
103 (const char __user *const __user *)regs->regs[5],
104 (const char __user *const __user *)regs->regs[6],
105 regs);
106
107 putname(filename);
108 return error;
109}
110
111/*
112 * Do a system call from kernel instead of calling sys_execve so we
113 * end up with proper pt_regs.
114 */
115asmlinkage
116int kernel_execve(const char *filename,
117 const char *const argv[],
118 const char *const envp[])
119{
120 register unsigned long __r4 asm("r4") = (unsigned long) filename;
121 register unsigned long __r5 asm("r5") = (unsigned long) argv;
122 register unsigned long __r6 asm("r6") = (unsigned long) envp;
123 register unsigned long __r7 asm("r7");
124
125 __asm__ __volatile__ (" \n"
126 "ldi r27, %5 \n"
127 "syscall \n"
128 "mv %0, r4 \n"
129 "mv %1, r7 \n"
130 : "=&r" (__r4), "=r" (__r7)
131 : "r" (__r4), "r" (__r5), "r" (__r6), "i" (__NR_execve)
132 : "r8", "r9", "r10", "r11", "r22", "r23", "r24", "r25",
133 "r26", "r27", "memory");
134
135 if (__r7 == 0)
136 return __r4;
137
138 return -__r4;
139}
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index babc2b826c5..8451317eed5 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -40,6 +40,8 @@ config SUPERH
40 select GENERIC_STRNLEN_USER 40 select GENERIC_STRNLEN_USER
41 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER 41 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
42 select MODULES_USE_ELF_RELA 42 select MODULES_USE_ELF_RELA
43 select GENERIC_KERNEL_THREAD
44 select GENERIC_KERNEL_EXECVE
43 help 45 help
44 The SuperH is a RISC processor targeted for use in embedded systems 46 The SuperH is a RISC processor targeted for use in embedded systems
45 and consumer electronics; it was also used in the Sega Dreamcast 47 and consumer electronics; it was also used in the Sega Dreamcast
diff --git a/arch/sh/boards/board-espt.c b/arch/sh/boards/board-espt.c
index 6cba0a7068b..d71a0bcf814 100644
--- a/arch/sh/boards/board-espt.c
+++ b/arch/sh/boards/board-espt.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Data Technology Inc. ESPT-GIGA board suport 2 * Data Technology Inc. ESPT-GIGA board support
3 * 3 *
4 * Copyright (C) 2008, 2009 Renesas Solutions Corp. 4 * Copyright (C) 2008, 2009 Renesas Solutions Corp.
5 * Copyright (C) 2008, 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> 5 * Copyright (C) 2008, 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
diff --git a/arch/sh/configs/ecovec24_defconfig b/arch/sh/configs/ecovec24_defconfig
index 911e30c9abf..c6c2becdc8a 100644
--- a/arch/sh/configs/ecovec24_defconfig
+++ b/arch/sh/configs/ecovec24_defconfig
@@ -112,7 +112,7 @@ CONFIG_USB_MON=y
112CONFIG_USB_R8A66597_HCD=y 112CONFIG_USB_R8A66597_HCD=y
113CONFIG_USB_STORAGE=y 113CONFIG_USB_STORAGE=y
114CONFIG_USB_GADGET=y 114CONFIG_USB_GADGET=y
115CONFIG_USB_FILE_STORAGE=m 115CONFIG_USB_MASS_STORAGE=m
116CONFIG_MMC=y 116CONFIG_MMC=y
117CONFIG_MMC_SPI=y 117CONFIG_MMC_SPI=y
118CONFIG_MMC_SDHI=y 118CONFIG_MMC_SDHI=y
diff --git a/arch/sh/configs/se7724_defconfig b/arch/sh/configs/se7724_defconfig
index ed35093e375..1faa788aeca 100644
--- a/arch/sh/configs/se7724_defconfig
+++ b/arch/sh/configs/se7724_defconfig
@@ -109,7 +109,7 @@ CONFIG_USB_STORAGE=y
109CONFIG_USB_GADGET=y 109CONFIG_USB_GADGET=y
110CONFIG_USB_ETH=m 110CONFIG_USB_ETH=m
111CONFIG_USB_GADGETFS=m 111CONFIG_USB_GADGETFS=m
112CONFIG_USB_FILE_STORAGE=m 112CONFIG_USB_MASS_STORAGE=m
113CONFIG_USB_G_SERIAL=m 113CONFIG_USB_G_SERIAL=m
114CONFIG_MMC=y 114CONFIG_MMC=y
115CONFIG_MMC_SPI=y 115CONFIG_MMC_SPI=y
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index a7e078f2e2e..81e5dafed3e 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -319,7 +319,5 @@ EXPORT_SYMBOL(pci_iounmap);
319 319
320#endif /* CONFIG_GENERIC_IOMAP */ 320#endif /* CONFIG_GENERIC_IOMAP */
321 321
322#ifdef CONFIG_HOTPLUG
323EXPORT_SYMBOL(PCIBIOS_MIN_IO); 322EXPORT_SYMBOL(PCIBIOS_MIN_IO);
324EXPORT_SYMBOL(PCIBIOS_MIN_MEM); 323EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
325#endif
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 29f83beeef7..280bea9e5e2 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -31,5 +31,6 @@ generic-y += socket.h
31generic-y += statfs.h 31generic-y += statfs.h
32generic-y += termbits.h 32generic-y += termbits.h
33generic-y += termios.h 33generic-y += termios.h
34generic-y += trace_clock.h
34generic-y += ucontext.h 35generic-y += ucontext.h
35generic-y += xor.h 36generic-y += xor.h
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 73a23f4617a..629db2ad791 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -382,7 +382,7 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
382#define xlate_dev_kmem_ptr(p) p 382#define xlate_dev_kmem_ptr(p) p
383 383
384#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 384#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
385int valid_phys_addr_range(unsigned long addr, size_t size); 385int valid_phys_addr_range(phys_addr_t addr, size_t size);
386int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 386int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
387 387
388#endif /* __KERNEL__ */ 388#endif /* __KERNEL__ */
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index b6311fd2d06..b1320d55ca3 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -126,11 +126,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned lo
126/* Free all resources held by a thread. */ 126/* Free all resources held by a thread. */
127extern void release_thread(struct task_struct *); 127extern void release_thread(struct task_struct *);
128 128
129/*
130 * create a kernel thread without removing it from tasklists
131 */
132extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
133
134/* Copy and release all segment info associated with a VM */ 129/* Copy and release all segment info associated with a VM */
135#define copy_segments(p, mm) do { } while(0) 130#define copy_segments(p, mm) do { } while(0)
136#define release_segments(mm) do { } while(0) 131#define release_segments(mm) do { } while(0)
diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
index cd6029fb2c0..1ee8946f095 100644
--- a/arch/sh/include/asm/processor_64.h
+++ b/arch/sh/include/asm/processor_64.h
@@ -159,11 +159,6 @@ struct mm_struct;
159 159
160/* Free all resources held by a thread. */ 160/* Free all resources held by a thread. */
161extern void release_thread(struct task_struct *); 161extern void release_thread(struct task_struct *);
162/*
163 * create a kernel thread without removing it from tasklists
164 */
165extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
166
167 162
168/* Copy and release all segment info associated with a VM */ 163/* Copy and release all segment info associated with a VM */
169#define copy_segments(p, mm) do { } while (0) 164#define copy_segments(p, mm) do { } while (0)
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index 6c1fa559753..cc25485996b 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -9,20 +9,6 @@
9 9
10struct pt_regs; 10struct pt_regs;
11 11
12asmlinkage int sys_fork(unsigned long r4, unsigned long r5,
13 unsigned long r6, unsigned long r7,
14 struct pt_regs __regs);
15asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
16 unsigned long parent_tidptr,
17 unsigned long child_tidptr,
18 struct pt_regs __regs);
19asmlinkage int sys_vfork(unsigned long r4, unsigned long r5,
20 unsigned long r6, unsigned long r7,
21 struct pt_regs __regs);
22asmlinkage int sys_execve(const char __user *ufilename,
23 const char __user *const __user *uargv,
24 const char __user *const __user *uenvp,
25 unsigned long r7, struct pt_regs __regs);
26asmlinkage int sys_sigsuspend(old_sigset_t mask); 12asmlinkage int sys_sigsuspend(old_sigset_t mask);
27asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act, 13asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act,
28 struct old_sigaction __user *oact); 14 struct old_sigaction __user *oact);
diff --git a/arch/sh/include/asm/syscalls_64.h b/arch/sh/include/asm/syscalls_64.h
index ee519f41d95..d62e8eb22f7 100644
--- a/arch/sh/include/asm/syscalls_64.h
+++ b/arch/sh/include/asm/syscalls_64.h
@@ -9,23 +9,6 @@
9 9
10struct pt_regs; 10struct pt_regs;
11 11
12asmlinkage int sys_fork(unsigned long r2, unsigned long r3,
13 unsigned long r4, unsigned long r5,
14 unsigned long r6, unsigned long r7,
15 struct pt_regs *pregs);
16asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
17 unsigned long r4, unsigned long r5,
18 unsigned long r6, unsigned long r7,
19 struct pt_regs *pregs);
20asmlinkage int sys_vfork(unsigned long r2, unsigned long r3,
21 unsigned long r4, unsigned long r5,
22 unsigned long r6, unsigned long r7,
23 struct pt_regs *pregs);
24asmlinkage int sys_execve(const char *ufilename, char **uargv,
25 char **uenvp, unsigned long r5,
26 unsigned long r6, unsigned long r7,
27 struct pt_regs *pregs);
28
29/* Misc syscall related bits */ 12/* Misc syscall related bits */
30asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs); 13asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs);
31asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); 14asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 38956dfa76f..43d3f26b2ea 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -28,6 +28,10 @@
28# define __ARCH_WANT_SYS_SIGPENDING 28# define __ARCH_WANT_SYS_SIGPENDING
29# define __ARCH_WANT_SYS_SIGPROCMASK 29# define __ARCH_WANT_SYS_SIGPROCMASK
30# define __ARCH_WANT_SYS_RT_SIGACTION 30# define __ARCH_WANT_SYS_RT_SIGACTION
31# define __ARCH_WANT_SYS_EXECVE
32# define __ARCH_WANT_SYS_FORK
33# define __ARCH_WANT_SYS_VFORK
34# define __ARCH_WANT_SYS_CLONE
31 35
32/* 36/*
33 * "Conditional" syscalls 37 * "Conditional" syscalls
diff --git a/arch/sh/include/uapi/asm/ioctls.h b/arch/sh/include/uapi/asm/ioctls.h
index a6769f352bf..34224107976 100644
--- a/arch/sh/include/uapi/asm/ioctls.h
+++ b/arch/sh/include/uapi/asm/ioctls.h
@@ -88,6 +88,9 @@
88#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 88#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
89#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ 89#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
90#define TIOCVHANGUP _IO('T', 0x37) 90#define TIOCVHANGUP _IO('T', 0x37)
91#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
92#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
93#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
91 94
92#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ 95#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
93#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */ 96#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 88571ff8eee..f259b37874e 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -16,7 +16,7 @@ obj-y := debugtraps.o dma-nommu.o dumpstack.o \
16 machvec.o nmi_debug.o process.o \ 16 machvec.o nmi_debug.o process.o \
17 process_$(BITS).o ptrace.o ptrace_$(BITS).o \ 17 process_$(BITS).o ptrace.o ptrace_$(BITS).o \
18 reboot.o return_address.o \ 18 reboot.o return_address.o \
19 setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \ 19 setup.o signal_$(BITS).o sys_sh.o \
20 syscalls_$(BITS).o time.o topology.o traps.o \ 20 syscalls_$(BITS).o time.o topology.o traps.o \
21 traps_$(BITS).o unwinder.o 21 traps_$(BITS).o unwinder.o
22 22
@@ -25,6 +25,7 @@ obj-y += iomap.o
25obj-$(CONFIG_HAS_IOPORT) += ioport.o 25obj-$(CONFIG_HAS_IOPORT) += ioport.o
26endif 26endif
27 27
28obj-$(CONFIG_SUPERH32) += sys_sh32.o
28obj-y += cpu/ 29obj-y += cpu/
29obj-$(CONFIG_VSYSCALL) += vsyscall/ 30obj-$(CONFIG_VSYSCALL) += vsyscall/
30obj-$(CONFIG_SMP) += smp.o 31obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
index 0c2f1b2c2e1..42d991f632b 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -20,6 +20,7 @@
20#include <linux/serial_sci.h> 20#include <linux/serial_sci.h>
21#include <linux/sh_timer.h> 21#include <linux/sh_timer.h>
22#include <linux/sh_intc.h> 22#include <linux/sh_intc.h>
23#include <linux/usb/ohci_pdriver.h>
23#include <asm/rtc.h> 24#include <asm/rtc.h>
24#include <cpu/serial.h> 25#include <cpu/serial.h>
25 26
@@ -103,12 +104,15 @@ static struct resource usb_ohci_resources[] = {
103 104
104static u64 usb_ohci_dma_mask = 0xffffffffUL; 105static u64 usb_ohci_dma_mask = 0xffffffffUL;
105 106
107static struct usb_ohci_pdata usb_ohci_pdata;
108
106static struct platform_device usb_ohci_device = { 109static struct platform_device usb_ohci_device = {
107 .name = "sh_ohci", 110 .name = "ohci-platform",
108 .id = -1, 111 .id = -1,
109 .dev = { 112 .dev = {
110 .dma_mask = &usb_ohci_dma_mask, 113 .dma_mask = &usb_ohci_dma_mask,
111 .coherent_dma_mask = 0xffffffff, 114 .coherent_dma_mask = 0xffffffff,
115 .platform_data = &usb_ohci_pdata,
112 }, 116 },
113 .num_resources = ARRAY_SIZE(usb_ohci_resources), 117 .num_resources = ARRAY_SIZE(usb_ohci_resources),
114 .resource = usb_ohci_resources, 118 .resource = usb_ohci_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 4a2f357f4df..9079a0f9ea9 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -19,6 +19,7 @@
19#include <linux/sh_timer.h> 19#include <linux/sh_timer.h>
20#include <linux/sh_dma.h> 20#include <linux/sh_dma.h>
21#include <linux/sh_intc.h> 21#include <linux/sh_intc.h>
22#include <linux/usb/ohci_pdriver.h>
22#include <cpu/dma-register.h> 23#include <cpu/dma-register.h>
23#include <cpu/sh7757.h> 24#include <cpu/sh7757.h>
24 25
@@ -750,12 +751,15 @@ static struct resource usb_ohci_resources[] = {
750 }, 751 },
751}; 752};
752 753
754static struct usb_ohci_pdata usb_ohci_pdata;
755
753static struct platform_device usb_ohci_device = { 756static struct platform_device usb_ohci_device = {
754 .name = "sh_ohci", 757 .name = "ohci-platform",
755 .id = -1, 758 .id = -1,
756 .dev = { 759 .dev = {
757 .dma_mask = &usb_ohci_device.dev.coherent_dma_mask, 760 .dma_mask = &usb_ohci_device.dev.coherent_dma_mask,
758 .coherent_dma_mask = DMA_BIT_MASK(32), 761 .coherent_dma_mask = DMA_BIT_MASK(32),
762 .platform_data = &usb_ohci_pdata,
759 }, 763 },
760 .num_resources = ARRAY_SIZE(usb_ohci_resources), 764 .num_resources = ARRAY_SIZE(usb_ohci_resources),
761 .resource = usb_ohci_resources, 765 .resource = usb_ohci_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index bd0a8fbe610..1686acaaf45 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -16,6 +16,7 @@
16#include <linux/sh_intc.h> 16#include <linux/sh_intc.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/serial_sci.h> 18#include <linux/serial_sci.h>
19#include <linux/usb/ohci_pdriver.h>
19 20
20static struct plat_sci_port scif0_platform_data = { 21static struct plat_sci_port scif0_platform_data = {
21 .mapbase = 0xffe00000, 22 .mapbase = 0xffe00000,
@@ -106,12 +107,15 @@ static struct resource usb_ohci_resources[] = {
106 107
107static u64 usb_ohci_dma_mask = 0xffffffffUL; 108static u64 usb_ohci_dma_mask = 0xffffffffUL;
108 109
110static struct usb_ohci_pdata usb_ohci_pdata;
111
109static struct platform_device usb_ohci_device = { 112static struct platform_device usb_ohci_device = {
110 .name = "sh_ohci", 113 .name = "ohci-platform",
111 .id = -1, 114 .id = -1,
112 .dev = { 115 .dev = {
113 .dma_mask = &usb_ohci_dma_mask, 116 .dma_mask = &usb_ohci_dma_mask,
114 .coherent_dma_mask = 0xffffffff, 117 .coherent_dma_mask = 0xffffffff,
118 .platform_data = &usb_ohci_pdata,
115 }, 119 },
116 .num_resources = ARRAY_SIZE(usb_ohci_resources), 120 .num_resources = ARRAY_SIZE(usb_ohci_resources),
117 .resource = usb_ohci_resources, 121 .resource = usb_ohci_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index 2e6952f8784..ab52d4d4484 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -23,6 +23,7 @@
23#include <linux/sh_timer.h> 23#include <linux/sh_timer.h>
24#include <linux/sh_dma.h> 24#include <linux/sh_dma.h>
25#include <linux/sh_intc.h> 25#include <linux/sh_intc.h>
26#include <linux/usb/ohci_pdriver.h>
26#include <cpu/dma-register.h> 27#include <cpu/dma-register.h>
27#include <asm/mmzone.h> 28#include <asm/mmzone.h>
28 29
@@ -583,12 +584,15 @@ static struct resource usb_ohci_resources[] = {
583 }, 584 },
584}; 585};
585 586
587static struct usb_ohci_pdata usb_ohci_pdata;
588
586static struct platform_device usb_ohci_device = { 589static struct platform_device usb_ohci_device = {
587 .name = "sh_ohci", 590 .name = "ohci-platform",
588 .id = -1, 591 .id = -1,
589 .dev = { 592 .dev = {
590 .dma_mask = &usb_ohci_device.dev.coherent_dma_mask, 593 .dma_mask = &usb_ohci_device.dev.coherent_dma_mask,
591 .coherent_dma_mask = DMA_BIT_MASK(32), 594 .coherent_dma_mask = DMA_BIT_MASK(32),
595 .platform_data = &usb_ohci_pdata,
592 }, 596 },
593 .num_resources = ARRAY_SIZE(usb_ohci_resources), 597 .num_resources = ARRAY_SIZE(usb_ohci_resources),
594 .resource = usb_ohci_resources, 598 .resource = usb_ohci_resources,
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S
index 7e605b95592..0c8d0377d40 100644
--- a/arch/sh/kernel/cpu/sh5/entry.S
+++ b/arch/sh/kernel/cpu/sh5/entry.S
@@ -1228,6 +1228,25 @@ ret_from_fork:
1228 pta ret_from_syscall, tr0 1228 pta ret_from_syscall, tr0
1229 blink tr0, ZERO 1229 blink tr0, ZERO
1230 1230
1231.global ret_from_kernel_thread
1232ret_from_kernel_thread:
1233
1234 movi schedule_tail,r5
1235 ori r5, 1, r5
1236 ptabs r5, tr0
1237 blink tr0, LINK
1238
1239 ld.q SP, FRAME_R(2), r2
1240 ld.q SP, FRAME_R(3), r3
1241 ptabs r3, tr0
1242 blink tr0, LINK
1243
1244 ld.q SP, FRAME_S(FSPC), r2
1245 addi r2, 4, r2 /* Move PC, being pre-execution event */
1246 st.q SP, FRAME_S(FSPC), r2
1247 pta ret_from_syscall, tr0
1248 blink tr0, ZERO
1249
1231syscall_allowed: 1250syscall_allowed:
1232 /* Use LINK to deflect the exit point, default is syscall_ret */ 1251 /* Use LINK to deflect the exit point, default is syscall_ret */
1233 pta syscall_ret, tr0 1252 pta syscall_ret, tr0
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index b96489d8b27..9b6e4beeb29 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -297,6 +297,19 @@ ret_from_fork:
297 mov r0, r4 297 mov r0, r4
298 bra syscall_exit 298 bra syscall_exit
299 nop 299 nop
300
301 .align 2
302 .globl ret_from_kernel_thread
303ret_from_kernel_thread:
304 mov.l 1f, r8
305 jsr @r8
306 mov r0, r4
307 mov.l @(OFF_R5,r15), r5 ! fn
308 jsr @r5
309 mov.l @(OFF_R4,r15), r4 ! arg
310 bra syscall_exit
311 nop
312
300 .align 2 313 .align 2
3011: .long schedule_tail 3141: .long schedule_tail
302 315
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index ba7345f37bc..73eb66fc625 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -68,38 +68,6 @@ void show_regs(struct pt_regs * regs)
68 show_code(regs); 68 show_code(regs);
69} 69}
70 70
71/*
72 * Create a kernel thread
73 */
74__noreturn void kernel_thread_helper(void *arg, int (*fn)(void *))
75{
76 do_exit(fn(arg));
77}
78
79/* Don't use this in BL=1(cli). Or else, CPU resets! */
80int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
81{
82 struct pt_regs regs;
83 int pid;
84
85 memset(&regs, 0, sizeof(regs));
86 regs.regs[4] = (unsigned long)arg;
87 regs.regs[5] = (unsigned long)fn;
88
89 regs.pc = (unsigned long)kernel_thread_helper;
90 regs.sr = SR_MD;
91#if defined(CONFIG_SH_FPU)
92 regs.sr |= SR_FD;
93#endif
94
95 /* Ok, create the new process.. */
96 pid = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
97 &regs, 0, NULL, NULL);
98
99 return pid;
100}
101EXPORT_SYMBOL(kernel_thread);
102
103void start_thread(struct pt_regs *regs, unsigned long new_pc, 71void start_thread(struct pt_regs *regs, unsigned long new_pc,
104 unsigned long new_sp) 72 unsigned long new_sp)
105{ 73{
@@ -157,10 +125,10 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
157EXPORT_SYMBOL(dump_fpu); 125EXPORT_SYMBOL(dump_fpu);
158 126
159asmlinkage void ret_from_fork(void); 127asmlinkage void ret_from_fork(void);
128asmlinkage void ret_from_kernel_thread(void);
160 129
161int copy_thread(unsigned long clone_flags, unsigned long usp, 130int copy_thread(unsigned long clone_flags, unsigned long usp,
162 unsigned long unused, 131 unsigned long arg, struct task_struct *p)
163 struct task_struct *p, struct pt_regs *regs)
164{ 132{
165 struct thread_info *ti = task_thread_info(p); 133 struct thread_info *ti = task_thread_info(p);
166 struct pt_regs *childregs; 134 struct pt_regs *childregs;
@@ -177,29 +145,35 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
177 } 145 }
178#endif 146#endif
179 147
180 childregs = task_pt_regs(p); 148 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
181 *childregs = *regs;
182 149
183 if (user_mode(regs)) { 150 childregs = task_pt_regs(p);
184 childregs->regs[15] = usp; 151 p->thread.sp = (unsigned long) childregs;
185 ti->addr_limit = USER_DS; 152 if (unlikely(p->flags & PF_KTHREAD)) {
186 } else { 153 memset(childregs, 0, sizeof(struct pt_regs));
187 childregs->regs[15] = (unsigned long)childregs; 154 p->thread.pc = (unsigned long) ret_from_kernel_thread;
155 childregs->regs[4] = arg;
156 childregs->regs[5] = usp;
157 childregs->sr = SR_MD;
158#if defined(CONFIG_SH_FPU)
159 childregs->sr |= SR_FD;
160#endif
188 ti->addr_limit = KERNEL_DS; 161 ti->addr_limit = KERNEL_DS;
189 ti->status &= ~TS_USEDFPU; 162 ti->status &= ~TS_USEDFPU;
190 p->fpu_counter = 0; 163 p->fpu_counter = 0;
164 return 0;
191 } 165 }
166 *childregs = *current_pt_regs();
167
168 if (usp)
169 childregs->regs[15] = usp;
170 ti->addr_limit = USER_DS;
192 171
193 if (clone_flags & CLONE_SETTLS) 172 if (clone_flags & CLONE_SETTLS)
194 childregs->gbr = childregs->regs[0]; 173 childregs->gbr = childregs->regs[0];
195 174
196 childregs->regs[0] = 0; /* Set return value for child */ 175 childregs->regs[0] = 0; /* Set return value for child */
197
198 p->thread.sp = (unsigned long) childregs;
199 p->thread.pc = (unsigned long) ret_from_fork; 176 p->thread.pc = (unsigned long) ret_from_fork;
200
201 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
202
203 return 0; 177 return 0;
204} 178}
205 179
@@ -243,74 +217,6 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
243 return prev; 217 return prev;
244} 218}
245 219
246asmlinkage int sys_fork(unsigned long r4, unsigned long r5,
247 unsigned long r6, unsigned long r7,
248 struct pt_regs __regs)
249{
250#ifdef CONFIG_MMU
251 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
252 return do_fork(SIGCHLD, regs->regs[15], regs, 0, NULL, NULL);
253#else
254 /* fork almost works, enough to trick you into looking elsewhere :-( */
255 return -EINVAL;
256#endif
257}
258
259asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
260 unsigned long parent_tidptr,
261 unsigned long child_tidptr,
262 struct pt_regs __regs)
263{
264 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
265 if (!newsp)
266 newsp = regs->regs[15];
267 return do_fork(clone_flags, newsp, regs, 0,
268 (int __user *)parent_tidptr,
269 (int __user *)child_tidptr);
270}
271
272/*
273 * This is trivial, and on the face of it looks like it
274 * could equally well be done in user mode.
275 *
276 * Not so, for quite unobvious reasons - register pressure.
277 * In user mode vfork() cannot have a stack frame, and if
278 * done by calling the "clone()" system call directly, you
279 * do not have enough call-clobbered registers to hold all
280 * the information you need.
281 */
282asmlinkage int sys_vfork(unsigned long r4, unsigned long r5,
283 unsigned long r6, unsigned long r7,
284 struct pt_regs __regs)
285{
286 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
287 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->regs[15], regs,
288 0, NULL, NULL);
289}
290
291/*
292 * sys_execve() executes a new program.
293 */
294asmlinkage int sys_execve(const char __user *ufilename,
295 const char __user *const __user *uargv,
296 const char __user *const __user *uenvp,
297 unsigned long r7, struct pt_regs __regs)
298{
299 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
300 int error;
301 struct filename *filename;
302
303 filename = getname(ufilename);
304 error = PTR_ERR(filename);
305 if (IS_ERR(filename))
306 goto out;
307
308 error = do_execve(filename->name, uargv, uenvp, regs);
309 putname(filename);
310out:
311 return error;
312}
313
314unsigned long get_wchan(struct task_struct *p) 220unsigned long get_wchan(struct task_struct *p)
315{ 221{
316 unsigned long pc; 222 unsigned long pc;
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index 98a709f0c3c..e611c85144b 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -285,39 +285,6 @@ void show_regs(struct pt_regs *regs)
285} 285}
286 286
287/* 287/*
288 * Create a kernel thread
289 */
290__noreturn void kernel_thread_helper(void *arg, int (*fn)(void *))
291{
292 do_exit(fn(arg));
293}
294
295/*
296 * This is the mechanism for creating a new kernel thread.
297 *
298 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
299 * who haven't done an "execve()") should use this: it will work within
300 * a system call from a "real" process, but the process memory space will
301 * not be freed until both the parent and the child have exited.
302 */
303int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
304{
305 struct pt_regs regs;
306
307 memset(&regs, 0, sizeof(regs));
308 regs.regs[2] = (unsigned long)arg;
309 regs.regs[3] = (unsigned long)fn;
310
311 regs.pc = (unsigned long)kernel_thread_helper;
312 regs.sr = (1 << 30);
313
314 /* Ok, create the new process.. */
315 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
316 &regs, 0, NULL, NULL);
317}
318EXPORT_SYMBOL(kernel_thread);
319
320/*
321 * Free current thread data structures etc.. 288 * Free current thread data structures etc..
322 */ 289 */
323void exit_thread(void) 290void exit_thread(void)
@@ -401,26 +368,37 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
401EXPORT_SYMBOL(dump_fpu); 368EXPORT_SYMBOL(dump_fpu);
402 369
403asmlinkage void ret_from_fork(void); 370asmlinkage void ret_from_fork(void);
371asmlinkage void ret_from_kernel_thread(void);
404 372
405int copy_thread(unsigned long clone_flags, unsigned long usp, 373int copy_thread(unsigned long clone_flags, unsigned long usp,
406 unsigned long unused, 374 unsigned long arg, struct task_struct *p)
407 struct task_struct *p, struct pt_regs *regs)
408{ 375{
409 struct pt_regs *childregs; 376 struct pt_regs *childregs, *regs = current_pt_regs();
410 377
411#ifdef CONFIG_SH_FPU 378#ifdef CONFIG_SH_FPU
412 if(last_task_used_math == current) { 379 /* can't happen for a kernel thread */
380 if (last_task_used_math == current) {
413 enable_fpu(); 381 enable_fpu();
414 save_fpu(current); 382 save_fpu(current);
415 disable_fpu(); 383 disable_fpu();
416 last_task_used_math = NULL; 384 last_task_used_math = NULL;
417 regs->sr |= SR_FD; 385 current_pt_regs()->sr |= SR_FD;
418 } 386 }
419#endif 387#endif
420 /* Copy from sh version */ 388 /* Copy from sh version */
421 childregs = (struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1; 389 childregs = (struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1;
390 p->thread.sp = (unsigned long) childregs;
422 391
423 *childregs = *regs; 392 if (unlikely(p->flags & PF_KTHREAD)) {
393 memset(childregs, 0, sizeof(struct pt_regs));
394 childregs->regs[2] = (unsigned long)arg;
395 childregs->regs[3] = (unsigned long)fn;
396 childregs->sr = (1 << 30); /* not user_mode */
397 childregs->sr |= SR_FD; /* Invalidate FPU flag */
398 p->thread.pc = (unsigned long) ret_from_kernel_thread;
399 return 0;
400 }
401 *childregs = *current_pt_regs();
424 402
425 /* 403 /*
426 * Sign extend the edited stack. 404 * Sign extend the edited stack.
@@ -428,85 +406,18 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
428 * 32-bit wide and context switch must take care 406 * 32-bit wide and context switch must take care
429 * of NEFF sign extension. 407 * of NEFF sign extension.
430 */ 408 */
431 if (user_mode(regs)) { 409 if (usp)
432 childregs->regs[15] = neff_sign_extend(usp); 410 childregs->regs[15] = neff_sign_extend(usp);
433 p->thread.uregs = childregs; 411 p->thread.uregs = childregs;
434 } else {
435 childregs->regs[15] =
436 neff_sign_extend((unsigned long)task_stack_page(p) +
437 THREAD_SIZE);
438 }
439 412
440 childregs->regs[9] = 0; /* Set return value for child */ 413 childregs->regs[9] = 0; /* Set return value for child */
441 childregs->sr |= SR_FD; /* Invalidate FPU flag */ 414 childregs->sr |= SR_FD; /* Invalidate FPU flag */
442 415
443 p->thread.sp = (unsigned long) childregs;
444 p->thread.pc = (unsigned long) ret_from_fork; 416 p->thread.pc = (unsigned long) ret_from_fork;
445 417
446 return 0; 418 return 0;
447} 419}
448 420
449asmlinkage int sys_fork(unsigned long r2, unsigned long r3,
450 unsigned long r4, unsigned long r5,
451 unsigned long r6, unsigned long r7,
452 struct pt_regs *pregs)
453{
454 return do_fork(SIGCHLD, pregs->regs[15], pregs, 0, 0, 0);
455}
456
457asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
458 unsigned long r4, unsigned long r5,
459 unsigned long r6, unsigned long r7,
460 struct pt_regs *pregs)
461{
462 if (!newsp)
463 newsp = pregs->regs[15];
464 return do_fork(clone_flags, newsp, pregs, 0, 0, 0);
465}
466
467/*
468 * This is trivial, and on the face of it looks like it
469 * could equally well be done in user mode.
470 *
471 * Not so, for quite unobvious reasons - register pressure.
472 * In user mode vfork() cannot have a stack frame, and if
473 * done by calling the "clone()" system call directly, you
474 * do not have enough call-clobbered registers to hold all
475 * the information you need.
476 */
477asmlinkage int sys_vfork(unsigned long r2, unsigned long r3,
478 unsigned long r4, unsigned long r5,
479 unsigned long r6, unsigned long r7,
480 struct pt_regs *pregs)
481{
482 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, pregs->regs[15], pregs, 0, 0, 0);
483}
484
485/*
486 * sys_execve() executes a new program.
487 */
488asmlinkage int sys_execve(const char *ufilename, char **uargv,
489 char **uenvp, unsigned long r5,
490 unsigned long r6, unsigned long r7,
491 struct pt_regs *pregs)
492{
493 int error;
494 struct filename *filename;
495
496 filename = getname((char __user *)ufilename);
497 error = PTR_ERR(filename);
498 if (IS_ERR(filename))
499 goto out;
500
501 error = do_execve(filename->name,
502 (const char __user *const __user *)uargv,
503 (const char __user *const __user *)uenvp,
504 pregs);
505 putname(filename);
506out:
507 return error;
508}
509
510#ifdef CONFIG_FRAME_POINTER 421#ifdef CONFIG_FRAME_POINTER
511static int in_sh64_switch_to(unsigned long pc) 422static int in_sh64_switch_to(unsigned long pc)
512{ 423{
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index 23853814bd1..d867cd95a62 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -347,7 +347,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3,
347{ 347{
348 struct rt_sigframe __user *frame = (struct rt_sigframe __user *) (long) REF_REG_SP; 348 struct rt_sigframe __user *frame = (struct rt_sigframe __user *) (long) REF_REG_SP;
349 sigset_t set; 349 sigset_t set;
350 stack_t __user st;
351 long long ret; 350 long long ret;
352 351
353 /* Always make any pending restarted system calls return -EINTR */ 352 /* Always make any pending restarted system calls return -EINTR */
@@ -365,11 +364,10 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3,
365 goto badframe; 364 goto badframe;
366 regs->pc -= 4; 365 regs->pc -= 4;
367 366
368 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
369 goto badframe;
370 /* It is more difficult to avoid calling this function than to 367 /* It is more difficult to avoid calling this function than to
371 call it and ignore errors. */ 368 call it and ignore errors. */
372 do_sigaltstack(&st, NULL, REF_REG_SP); 369 if (do_sigaltstack(&frame->uc.uc_stack, NULL, REF_REG_SP) == -EFAULT)
370 goto badframe;
373 371
374 return (int) ret; 372 return (int) ret;
375 373
diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c
index f56b6fe5c5d..497bab3a040 100644
--- a/arch/sh/kernel/sys_sh32.c
+++ b/arch/sh/kernel/sys_sh32.c
@@ -60,27 +60,3 @@ asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
60 (u64)len0 << 32 | len1, advice); 60 (u64)len0 << 32 | len1, advice);
61#endif 61#endif
62} 62}
63
64#if defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH2A)
65#define SYSCALL_ARG3 "trapa #0x23"
66#else
67#define SYSCALL_ARG3 "trapa #0x13"
68#endif
69
70/*
71 * Do a system call from kernel instead of calling sys_execve so we
72 * end up with proper pt_regs.
73 */
74int kernel_execve(const char *filename,
75 const char *const argv[],
76 const char *const envp[])
77{
78 register long __sc0 __asm__ ("r3") = __NR_execve;
79 register long __sc4 __asm__ ("r4") = (long) filename;
80 register long __sc5 __asm__ ("r5") = (long) argv;
81 register long __sc6 __asm__ ("r6") = (long) envp;
82 __asm__ __volatile__ (SYSCALL_ARG3 : "=z" (__sc0)
83 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6)
84 : "memory");
85 return __sc0;
86}
diff --git a/arch/sh/kernel/sys_sh64.c b/arch/sh/kernel/sys_sh64.c
deleted file mode 100644
index c5a38c4bf41..00000000000
--- a/arch/sh/kernel/sys_sh64.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/sh/kernel/sys_sh64.c
3 *
4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 *
6 * This file contains various random system calls that
7 * have a non-standard calling sequence on the Linux/SH5
8 * platform.
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14#include <linux/errno.h>
15#include <linux/rwsem.h>
16#include <linux/sched.h>
17#include <linux/mm.h>
18#include <linux/fs.h>
19#include <linux/smp.h>
20#include <linux/sem.h>
21#include <linux/msg.h>
22#include <linux/shm.h>
23#include <linux/stat.h>
24#include <linux/mman.h>
25#include <linux/file.h>
26#include <linux/syscalls.h>
27#include <linux/ipc.h>
28#include <asm/uaccess.h>
29#include <asm/ptrace.h>
30#include <asm/unistd.h>
31
32/*
33 * Do a system call from kernel instead of calling sys_execve so we
34 * end up with proper pt_regs.
35 */
36int kernel_execve(const char *filename,
37 const char *const argv[],
38 const char *const envp[])
39{
40 register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve);
41 register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename;
42 register unsigned long __sc3 __asm__ ("r3") = (unsigned long) argv;
43 register unsigned long __sc4 __asm__ ("r4") = (unsigned long) envp;
44 __asm__ __volatile__ ("trapa %1 !\t\t\t execve(%2,%3,%4)"
45 : "=r" (__sc0)
46 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) );
47 __asm__ __volatile__ ("!dummy %0 %1 %2 %3"
48 : : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) : "memory");
49 return __sc0;
50}
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index cbbdcad8fcb..1f49c28affa 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -301,17 +301,6 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
301 __bad_area(regs, error_code, address, SEGV_ACCERR); 301 __bad_area(regs, error_code, address, SEGV_ACCERR);
302} 302}
303 303
304static void out_of_memory(void)
305{
306 /*
307 * We ran out of memory, call the OOM killer, and return the userspace
308 * (which will retry the fault, or kill us if we got oom-killed):
309 */
310 up_read(&current->mm->mmap_sem);
311
312 pagefault_out_of_memory();
313}
314
315static void 304static void
316do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address) 305do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address)
317{ 306{
@@ -353,8 +342,14 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
353 no_context(regs, error_code, address); 342 no_context(regs, error_code, address);
354 return 1; 343 return 1;
355 } 344 }
345 up_read(&current->mm->mmap_sem);
356 346
357 out_of_memory(); 347 /*
348 * We ran out of memory, call the OOM killer, and return the
349 * userspace (which will retry the fault, or kill us if we got
350 * oom-killed):
351 */
352 pagefault_out_of_memory();
358 } else { 353 } else {
359 if (fault & VM_FAULT_SIGBUS) 354 if (fault & VM_FAULT_SIGBUS)
360 do_sigbus(regs, error_code, address); 355 do_sigbus(regs, error_code, address);
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
index afeb710ec5c..6777177807c 100644
--- a/arch/sh/mm/mmap.c
+++ b/arch/sh/mm/mmap.c
@@ -30,25 +30,13 @@ static inline unsigned long COLOUR_ALIGN(unsigned long addr,
30 return base + off; 30 return base + off;
31} 31}
32 32
33static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
34 unsigned long pgoff)
35{
36 unsigned long base = addr & ~shm_align_mask;
37 unsigned long off = (pgoff << PAGE_SHIFT) & shm_align_mask;
38
39 if (base + off <= addr)
40 return base + off;
41
42 return base - off;
43}
44
45unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, 33unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
46 unsigned long len, unsigned long pgoff, unsigned long flags) 34 unsigned long len, unsigned long pgoff, unsigned long flags)
47{ 35{
48 struct mm_struct *mm = current->mm; 36 struct mm_struct *mm = current->mm;
49 struct vm_area_struct *vma; 37 struct vm_area_struct *vma;
50 unsigned long start_addr;
51 int do_colour_align; 38 int do_colour_align;
39 struct vm_unmapped_area_info info;
52 40
53 if (flags & MAP_FIXED) { 41 if (flags & MAP_FIXED) {
54 /* We do not accept a shared mapping if it would violate 42 /* We do not accept a shared mapping if it would violate
@@ -79,47 +67,13 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
79 return addr; 67 return addr;
80 } 68 }
81 69
82 if (len > mm->cached_hole_size) { 70 info.flags = 0;
83 start_addr = addr = mm->free_area_cache; 71 info.length = len;
84 } else { 72 info.low_limit = TASK_UNMAPPED_BASE;
85 mm->cached_hole_size = 0; 73 info.high_limit = TASK_SIZE;
86 start_addr = addr = TASK_UNMAPPED_BASE; 74 info.align_mask = do_colour_align ? (PAGE_MASK & shm_align_mask) : 0;
87 } 75 info.align_offset = pgoff << PAGE_SHIFT;
88 76 return vm_unmapped_area(&info);
89full_search:
90 if (do_colour_align)
91 addr = COLOUR_ALIGN(addr, pgoff);
92 else
93 addr = PAGE_ALIGN(mm->free_area_cache);
94
95 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
96 /* At this point: (!vma || addr < vma->vm_end). */
97 if (unlikely(TASK_SIZE - len < addr)) {
98 /*
99 * Start a new search - just in case we missed
100 * some holes.
101 */
102 if (start_addr != TASK_UNMAPPED_BASE) {
103 start_addr = addr = TASK_UNMAPPED_BASE;
104 mm->cached_hole_size = 0;
105 goto full_search;
106 }
107 return -ENOMEM;
108 }
109 if (likely(!vma || addr + len <= vma->vm_start)) {
110 /*
111 * Remember the place where we stopped the search:
112 */
113 mm->free_area_cache = addr + len;
114 return addr;
115 }
116 if (addr + mm->cached_hole_size < vma->vm_start)
117 mm->cached_hole_size = vma->vm_start - addr;
118
119 addr = vma->vm_end;
120 if (do_colour_align)
121 addr = COLOUR_ALIGN(addr, pgoff);
122 }
123} 77}
124 78
125unsigned long 79unsigned long
@@ -131,6 +85,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
131 struct mm_struct *mm = current->mm; 85 struct mm_struct *mm = current->mm;
132 unsigned long addr = addr0; 86 unsigned long addr = addr0;
133 int do_colour_align; 87 int do_colour_align;
88 struct vm_unmapped_area_info info;
134 89
135 if (flags & MAP_FIXED) { 90 if (flags & MAP_FIXED) {
136 /* We do not accept a shared mapping if it would violate 91 /* We do not accept a shared mapping if it would violate
@@ -162,73 +117,27 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
162 return addr; 117 return addr;
163 } 118 }
164 119
165 /* check if free_area_cache is useful for us */ 120 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
166 if (len <= mm->cached_hole_size) { 121 info.length = len;
167 mm->cached_hole_size = 0; 122 info.low_limit = PAGE_SIZE;
168 mm->free_area_cache = mm->mmap_base; 123 info.high_limit = mm->mmap_base;
169 } 124 info.align_mask = do_colour_align ? (PAGE_MASK & shm_align_mask) : 0;
170 125 info.align_offset = pgoff << PAGE_SHIFT;
171 /* either no address requested or can't fit in requested address hole */ 126 addr = vm_unmapped_area(&info);
172 addr = mm->free_area_cache;
173 if (do_colour_align) {
174 unsigned long base = COLOUR_ALIGN_DOWN(addr-len, pgoff);
175 127
176 addr = base + len;
177 }
178
179 /* make sure it can fit in the remaining address space */
180 if (likely(addr > len)) {
181 vma = find_vma(mm, addr-len);
182 if (!vma || addr <= vma->vm_start) {
183 /* remember the address as a hint for next time */
184 return (mm->free_area_cache = addr-len);
185 }
186 }
187
188 if (unlikely(mm->mmap_base < len))
189 goto bottomup;
190
191 addr = mm->mmap_base-len;
192 if (do_colour_align)
193 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
194
195 do {
196 /*
197 * Lookup failure means no vma is above this address,
198 * else if new region fits below vma->vm_start,
199 * return with success:
200 */
201 vma = find_vma(mm, addr);
202 if (likely(!vma || addr+len <= vma->vm_start)) {
203 /* remember the address as a hint for next time */
204 return (mm->free_area_cache = addr);
205 }
206
207 /* remember the largest hole we saw so far */
208 if (addr + mm->cached_hole_size < vma->vm_start)
209 mm->cached_hole_size = vma->vm_start - addr;
210
211 /* try just below the current vma->vm_start */
212 addr = vma->vm_start-len;
213 if (do_colour_align)
214 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
215 } while (likely(len < vma->vm_start));
216
217bottomup:
218 /* 128 /*
219 * A failed mmap() very likely causes application failure, 129 * A failed mmap() very likely causes application failure,
220 * so fall back to the bottom-up function here. This scenario 130 * so fall back to the bottom-up function here. This scenario
221 * can happen with large stack limits and large mmap() 131 * can happen with large stack limits and large mmap()
222 * allocations. 132 * allocations.
223 */ 133 */
224 mm->cached_hole_size = ~0UL; 134 if (addr & ~PAGE_MASK) {
225 mm->free_area_cache = TASK_UNMAPPED_BASE; 135 VM_BUG_ON(addr != -ENOMEM);
226 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags); 136 info.flags = 0;
227 /* 137 info.low_limit = TASK_UNMAPPED_BASE;
228 * Restore the topdown base: 138 info.high_limit = TASK_SIZE;
229 */ 139 addr = vm_unmapped_area(&info);
230 mm->free_area_cache = mm->mmap_base; 140 }
231 mm->cached_hole_size = ~0UL;
232 141
233 return addr; 142 return addr;
234} 143}
@@ -238,7 +147,7 @@ bottomup:
238 * You really shouldn't be using read() or write() on /dev/mem. This 147 * You really shouldn't be using read() or write() on /dev/mem. This
239 * might go away in the future. 148 * might go away in the future.
240 */ 149 */
241int valid_phys_addr_range(unsigned long addr, size_t count) 150int valid_phys_addr_range(phys_addr_t addr, size_t count)
242{ 151{
243 if (addr < __MEMORY_START) 152 if (addr < __MEMORY_START)
244 return 0; 153 return 0;
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9f2edb5c555..0c7d365fa40 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -41,6 +41,8 @@ config SPARC
41 select GENERIC_STRNCPY_FROM_USER 41 select GENERIC_STRNCPY_FROM_USER
42 select GENERIC_STRNLEN_USER 42 select GENERIC_STRNLEN_USER
43 select MODULES_USE_ELF_RELA 43 select MODULES_USE_ELF_RELA
44 select GENERIC_KERNEL_THREAD
45 select GENERIC_KERNEL_EXECVE
44 46
45config SPARC32 47config SPARC32
46 def_bool !64BIT 48 def_bool !64BIT
diff --git a/arch/sparc/boot/piggyback.c b/arch/sparc/boot/piggyback.c
index c0a798fcf03..bb7c95161d7 100644
--- a/arch/sparc/boot/piggyback.c
+++ b/arch/sparc/boot/piggyback.c
@@ -81,18 +81,18 @@ static void usage(void)
81 81
82static int start_line(const char *line) 82static int start_line(const char *line)
83{ 83{
84 if (strcmp(line + 8, " T _start\n") == 0) 84 if (strcmp(line + 10, " _start\n") == 0)
85 return 1; 85 return 1;
86 else if (strcmp(line + 16, " T _start\n") == 0) 86 else if (strcmp(line + 18, " _start\n") == 0)
87 return 1; 87 return 1;
88 return 0; 88 return 0;
89} 89}
90 90
91static int end_line(const char *line) 91static int end_line(const char *line)
92{ 92{
93 if (strcmp(line + 8, " A _end\n") == 0) 93 if (strcmp(line + 10, " _end\n") == 0)
94 return 1; 94 return 1;
95 else if (strcmp (line + 16, " A _end\n") == 0) 95 else if (strcmp (line + 18, " _end\n") == 0)
96 return 1; 96 return 1;
97 return 0; 97 return 0;
98} 98}
@@ -100,8 +100,8 @@ static int end_line(const char *line)
100/* 100/*
101 * Find address for start and end in System.map. 101 * Find address for start and end in System.map.
102 * The file looks like this: 102 * The file looks like this:
103 * f0004000 T _start 103 * f0004000 ... _start
104 * f0379f79 A _end 104 * f0379f79 ... _end
105 * 1234567890123456 105 * 1234567890123456
106 * ^coloumn 1 106 * ^coloumn 1
107 * There is support for 64 bit addresses too. 107 * There is support for 64 bit addresses too.
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 645a58da0e8..e26d430ce2f 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -8,4 +8,5 @@ generic-y += local64.h
8generic-y += irq_regs.h 8generic-y += irq_regs.h
9generic-y += local.h 9generic-y += local.h
10generic-y += module.h 10generic-y += module.h
11generic-y += trace_clock.h
11generic-y += word-at-a-time.h 12generic-y += word-at-a-time.h
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
index f74ac9ee33a..c1e01914fd9 100644
--- a/arch/sparc/include/asm/processor_32.h
+++ b/arch/sparc/include/asm/processor_32.h
@@ -106,7 +106,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
106 106
107/* Free all resources held by a thread. */ 107/* Free all resources held by a thread. */
108#define release_thread(tsk) do { } while(0) 108#define release_thread(tsk) do { } while(0)
109extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
110 109
111extern unsigned long get_wchan(struct task_struct *); 110extern unsigned long get_wchan(struct task_struct *);
112 111
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index 721e25f0e2e..cce72ce4c33 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -94,6 +94,7 @@ struct thread_struct {
94#ifndef __ASSEMBLY__ 94#ifndef __ASSEMBLY__
95 95
96#include <linux/types.h> 96#include <linux/types.h>
97#include <asm/fpumacro.h>
97 98
98/* Return saved PC of a blocked thread. */ 99/* Return saved PC of a blocked thread. */
99struct task_struct; 100struct task_struct;
@@ -143,6 +144,10 @@ do { \
143 : \ 144 : \
144 : "r" (regs), "r" (sp - sizeof(struct reg_window) - STACK_BIAS), \ 145 : "r" (regs), "r" (sp - sizeof(struct reg_window) - STACK_BIAS), \
145 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \ 146 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
147 fprs_write(0); \
148 current_thread_info()->xfsr[0] = 0; \
149 current_thread_info()->fpsaved[0] = 0; \
150 regs->tstate &= ~TSTATE_PEF; \
146} while (0) 151} while (0)
147 152
148#define start_thread32(regs, pc, sp) \ 153#define start_thread32(regs, pc, sp) \
@@ -183,13 +188,15 @@ do { \
183 : \ 188 : \
184 : "r" (regs), "r" (sp - sizeof(struct reg_window32)), \ 189 : "r" (regs), "r" (sp - sizeof(struct reg_window32)), \
185 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \ 190 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
191 fprs_write(0); \
192 current_thread_info()->xfsr[0] = 0; \
193 current_thread_info()->fpsaved[0] = 0; \
194 regs->tstate &= ~TSTATE_PEF; \
186} while (0) 195} while (0)
187 196
188/* Free all resources held by a thread. */ 197/* Free all resources held by a thread. */
189#define release_thread(tsk) do { } while (0) 198#define release_thread(tsk) do { } while (0)
190 199
191extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
192
193extern unsigned long get_wchan(struct task_struct *task); 200extern unsigned long get_wchan(struct task_struct *task);
194 201
195#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) 202#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index da43bdc6229..bdfafd7af46 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -32,6 +32,9 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
32#define arch_ptrace_stop(exit_code, info) \ 32#define arch_ptrace_stop(exit_code, info) \
33 synchronize_user_stack() 33 synchronize_user_stack()
34 34
35#define current_pt_regs() \
36 ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
37
35struct global_reg_snapshot { 38struct global_reg_snapshot {
36 unsigned long tstate; 39 unsigned long tstate;
37 unsigned long tpc; 40 unsigned long tpc;
@@ -55,9 +58,7 @@ union global_cpu_snapshot {
55 58
56extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS]; 59extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS];
57 60
58#define force_successful_syscall_return() \ 61#define force_successful_syscall_return() set_thread_noerror(1)
59do { current_thread_info()->syscall_noerror = 1; \
60} while (0)
61#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) 62#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
62#define instruction_pointer(regs) ((regs)->tpc) 63#define instruction_pointer(regs) ((regs)->tpc)
63#define instruction_pointer_set(regs, val) ((regs)->tpc = (val)) 64#define instruction_pointer_set(regs, val) ((regs)->tpc = (val))
@@ -100,6 +101,9 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
100#define arch_ptrace_stop(exit_code, info) \ 101#define arch_ptrace_stop(exit_code, info) \
101 synchronize_user_stack() 102 synchronize_user_stack()
102 103
104#define current_pt_regs() \
105 ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
106
103#define user_mode(regs) (!((regs)->psr & PSR_PS)) 107#define user_mode(regs) (!((regs)->psr & PSR_PS))
104#define instruction_pointer(regs) ((regs)->pc) 108#define instruction_pointer(regs) ((regs)->pc)
105#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) 109#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h
index d243c2ae02d..77b85850d54 100644
--- a/arch/sparc/include/asm/signal.h
+++ b/arch/sparc/include/asm/signal.h
@@ -26,7 +26,5 @@ struct k_sigaction {
26 void __user *ka_restorer; 26 void __user *ka_restorer;
27}; 27};
28 28
29#define ptrace_signal_deliver(regs, cookie) do { } while (0)
30
31#endif /* !(__ASSEMBLY__) */ 29#endif /* !(__ASSEMBLY__) */
32#endif /* !(__SPARC_SIGNAL_H) */ 30#endif /* !(__SPARC_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/switch_to_64.h b/arch/sparc/include/asm/switch_to_64.h
index 7923c4a2be3..cad36f56fa0 100644
--- a/arch/sparc/include/asm/switch_to_64.h
+++ b/arch/sparc/include/asm/switch_to_64.h
@@ -23,7 +23,7 @@ do { flush_tlb_pending(); \
23 /* If you are tempted to conditionalize the following */ \ 23 /* If you are tempted to conditionalize the following */ \
24 /* so that ASI is only written if it changes, think again. */ \ 24 /* so that ASI is only written if it changes, think again. */ \
25 __asm__ __volatile__("wr %%g0, %0, %%asi" \ 25 __asm__ __volatile__("wr %%g0, %0, %%asi" \
26 : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\ 26 : : "r" (task_thread_info(next)->current_ds));\
27 trap_block[current_thread_info()->cpu].thread = \ 27 trap_block[current_thread_info()->cpu].thread = \
28 task_thread_info(next); \ 28 task_thread_info(next); \
29 __asm__ __volatile__( \ 29 __asm__ __volatile__( \
diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h
index 45a43f637a1..bf8972adea1 100644
--- a/arch/sparc/include/asm/syscalls.h
+++ b/arch/sparc/include/asm/syscalls.h
@@ -8,6 +8,4 @@ extern asmlinkage long sparc_do_fork(unsigned long clone_flags,
8 struct pt_regs *regs, 8 struct pt_regs *regs,
9 unsigned long stack_size); 9 unsigned long stack_size);
10 10
11extern asmlinkage int sparc_execve(struct pt_regs *regs);
12
13#endif /* _SPARC64_SYSCALLS_H */ 11#endif /* _SPARC64_SYSCALLS_H */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index a3fe4dcc0aa..269bd92313d 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -14,12 +14,12 @@
14#define TI_FLAG_FAULT_CODE_SHIFT 56 14#define TI_FLAG_FAULT_CODE_SHIFT 56
15#define TI_FLAG_BYTE_WSTATE 1 15#define TI_FLAG_BYTE_WSTATE 1
16#define TI_FLAG_WSTATE_SHIFT 48 16#define TI_FLAG_WSTATE_SHIFT 48
17#define TI_FLAG_BYTE_CWP 2 17#define TI_FLAG_BYTE_NOERROR 2
18#define TI_FLAG_CWP_SHIFT 40 18#define TI_FLAG_BYTE_NOERROR_SHIFT 40
19#define TI_FLAG_BYTE_CURRENT_DS 3 19#define TI_FLAG_BYTE_FPDEPTH 3
20#define TI_FLAG_CURRENT_DS_SHIFT 32 20#define TI_FLAG_FPDEPTH_SHIFT 32
21#define TI_FLAG_BYTE_FPDEPTH 4 21#define TI_FLAG_BYTE_CWP 4
22#define TI_FLAG_FPDEPTH_SHIFT 24 22#define TI_FLAG_CWP_SHIFT 24
23#define TI_FLAG_BYTE_WSAVED 5 23#define TI_FLAG_BYTE_WSAVED 5
24#define TI_FLAG_WSAVED_SHIFT 16 24#define TI_FLAG_WSAVED_SHIFT 16
25 25
@@ -47,7 +47,7 @@ struct thread_info {
47 struct exec_domain *exec_domain; 47 struct exec_domain *exec_domain;
48 int preempt_count; /* 0 => preemptable, <0 => BUG */ 48 int preempt_count; /* 0 => preemptable, <0 => BUG */
49 __u8 new_child; 49 __u8 new_child;
50 __u8 syscall_noerror; 50 __u8 current_ds;
51 __u16 cpu; 51 __u16 cpu;
52 52
53 unsigned long *utraps; 53 unsigned long *utraps;
@@ -74,9 +74,9 @@ struct thread_info {
74#define TI_FAULT_CODE (TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE) 74#define TI_FAULT_CODE (TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE)
75#define TI_WSTATE (TI_FLAGS + TI_FLAG_BYTE_WSTATE) 75#define TI_WSTATE (TI_FLAGS + TI_FLAG_BYTE_WSTATE)
76#define TI_CWP (TI_FLAGS + TI_FLAG_BYTE_CWP) 76#define TI_CWP (TI_FLAGS + TI_FLAG_BYTE_CWP)
77#define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS)
78#define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH) 77#define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH)
79#define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED) 78#define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED)
79#define TI_SYS_NOERROR (TI_FLAGS + TI_FLAG_BYTE_NOERROR)
80#define TI_FPSAVED 0x00000010 80#define TI_FPSAVED 0x00000010
81#define TI_KSP 0x00000018 81#define TI_KSP 0x00000018
82#define TI_FAULT_ADDR 0x00000020 82#define TI_FAULT_ADDR 0x00000020
@@ -84,7 +84,7 @@ struct thread_info {
84#define TI_EXEC_DOMAIN 0x00000030 84#define TI_EXEC_DOMAIN 0x00000030
85#define TI_PRE_COUNT 0x00000038 85#define TI_PRE_COUNT 0x00000038
86#define TI_NEW_CHILD 0x0000003c 86#define TI_NEW_CHILD 0x0000003c
87#define TI_SYS_NOERROR 0x0000003d 87#define TI_CURRENT_DS 0x0000003d
88#define TI_CPU 0x0000003e 88#define TI_CPU 0x0000003e
89#define TI_UTRAPS 0x00000040 89#define TI_UTRAPS 0x00000040
90#define TI_REG_WINDOW 0x00000048 90#define TI_REG_WINDOW 0x00000048
@@ -121,7 +121,7 @@ struct thread_info {
121#define INIT_THREAD_INFO(tsk) \ 121#define INIT_THREAD_INFO(tsk) \
122{ \ 122{ \
123 .task = &tsk, \ 123 .task = &tsk, \
124 .flags = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT, \ 124 .current_ds = ASI_P, \
125 .exec_domain = &default_exec_domain, \ 125 .exec_domain = &default_exec_domain, \
126 .preempt_count = INIT_PREEMPT_COUNT, \ 126 .preempt_count = INIT_PREEMPT_COUNT, \
127 .restart_block = { \ 127 .restart_block = { \
@@ -153,13 +153,12 @@ register struct thread_info *current_thread_info_reg asm("g6");
153#define set_thread_wstate(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE] = (val)) 153#define set_thread_wstate(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE] = (val))
154#define get_thread_cwp() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP]) 154#define get_thread_cwp() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP])
155#define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val)) 155#define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val))
156#define get_thread_current_ds() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS]) 156#define get_thread_noerror() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR])
157#define set_thread_current_ds(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS] = (val)) 157#define set_thread_noerror(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR] = (val))
158#define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH]) 158#define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH])
159#define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val)) 159#define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val))
160#define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED]) 160#define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED])
161#define set_thread_wsaved(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED] = (val)) 161#define set_thread_wsaved(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED] = (val))
162
163#endif /* !(__ASSEMBLY__) */ 162#endif /* !(__ASSEMBLY__) */
164 163
165/* 164/*
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index 73083e1d38d..e562d3caee5 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -38,14 +38,14 @@
38#define VERIFY_READ 0 38#define VERIFY_READ 0
39#define VERIFY_WRITE 1 39#define VERIFY_WRITE 1
40 40
41#define get_fs() ((mm_segment_t) { get_thread_current_ds() }) 41#define get_fs() ((mm_segment_t){(current_thread_info()->current_ds)})
42#define get_ds() (KERNEL_DS) 42#define get_ds() (KERNEL_DS)
43 43
44#define segment_eq(a,b) ((a).seg == (b).seg) 44#define segment_eq(a,b) ((a).seg == (b).seg)
45 45
46#define set_fs(val) \ 46#define set_fs(val) \
47do { \ 47do { \
48 set_thread_current_ds((val).seg); \ 48 current_thread_info()->current_ds =(val).seg; \
49 __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg)); \ 49 __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg)); \
50} while(0) 50} while(0)
51 51
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 0ecea6ed943..c3e5d8b6417 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -46,6 +46,7 @@
46#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 46#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
47#define __ARCH_WANT_COMPAT_SYS_SENDFILE 47#define __ARCH_WANT_COMPAT_SYS_SENDFILE
48#endif 48#endif
49#define __ARCH_WANT_SYS_EXECVE
49 50
50/* 51/*
51 * "Conditional" syscalls 52 * "Conditional" syscalls
diff --git a/arch/sparc/include/uapi/asm/ioctls.h b/arch/sparc/include/uapi/asm/ioctls.h
index 9155f7041d4..897d1723fa1 100644
--- a/arch/sparc/include/uapi/asm/ioctls.h
+++ b/arch/sparc/include/uapi/asm/ioctls.h
@@ -21,6 +21,9 @@
21#define TCSETSF2 _IOW('T', 15, struct termios2) 21#define TCSETSF2 _IOW('T', 15, struct termios2)
22#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 22#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
23#define TIOCVHANGUP _IO('T', 0x37) 23#define TIOCVHANGUP _IO('T', 0x37)
24#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
25#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
26#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
24 27
25/* Note that all the ioctls that are not available in Linux have a 28/* Note that all the ioctls that are not available in Linux have a
26 * double underscore on the front to: a) avoid some programs to 29 * double underscore on the front to: a) avoid some programs to
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index bea1568ae4a..c83a937ead0 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -41,6 +41,7 @@
41 41
42#define SO_ATTACH_FILTER 0x001a 42#define SO_ATTACH_FILTER 0x001a
43#define SO_DETACH_FILTER 0x001b 43#define SO_DETACH_FILTER 0x001b
44#define SO_GET_FILTER SO_ATTACH_FILTER
44 45
45#define SO_PEERNAME 0x001c 46#define SO_PEERNAME 0x001c
46#define SO_TIMESTAMP 0x001d 47#define SO_TIMESTAMP 0x001d
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index dcaa1cf0de4..21fd1a8f47d 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -806,23 +806,10 @@ sys_nis_syscall:
806 call c_sys_nis_syscall 806 call c_sys_nis_syscall
807 mov %l5, %o7 807 mov %l5, %o7
808 808
809 .align 4
810 .globl sys_execve
811sys_execve:
812 mov %o7, %l5
813 add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg
814 call sparc_execve
815 mov %l5, %o7
816
817 .globl sunos_execv
818sunos_execv: 809sunos_execv:
819 st %g0, [%sp + STACKFRAME_SZ + PT_I2] 810 .globl sunos_execv
820 811 b sys_execve
821 call sparc_execve 812 clr %i2
822 add %sp, STACKFRAME_SZ, %o0
823
824 b ret_sys_call
825 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
826 813
827 .align 4 814 .align 4
828 .globl sys_sparc_pipe 815 .globl sys_sparc_pipe
@@ -959,17 +946,9 @@ flush_patch_four:
959 .align 4 946 .align 4
960linux_sparc_ni_syscall: 947linux_sparc_ni_syscall:
961 sethi %hi(sys_ni_syscall), %l7 948 sethi %hi(sys_ni_syscall), %l7
962 b syscall_is_too_hard 949 b do_syscall
963 or %l7, %lo(sys_ni_syscall), %l7 950 or %l7, %lo(sys_ni_syscall), %l7
964 951
965linux_fast_syscall:
966 andn %l7, 3, %l7
967 mov %i0, %o0
968 mov %i1, %o1
969 mov %i2, %o2
970 jmpl %l7 + %g0, %g0
971 mov %i3, %o3
972
973linux_syscall_trace: 952linux_syscall_trace:
974 add %sp, STACKFRAME_SZ, %o0 953 add %sp, STACKFRAME_SZ, %o0
975 call syscall_trace 954 call syscall_trace
@@ -991,6 +970,23 @@ ret_from_fork:
991 b ret_sys_call 970 b ret_sys_call
992 ld [%sp + STACKFRAME_SZ + PT_I0], %o0 971 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
993 972
973 .globl ret_from_kernel_thread
974ret_from_kernel_thread:
975 call schedule_tail
976 ld [%g3 + TI_TASK], %o0
977 ld [%sp + STACKFRAME_SZ + PT_G1], %l0
978 call %l0
979 ld [%sp + STACKFRAME_SZ + PT_G2], %o0
980 rd %psr, %l1
981 ld [%sp + STACKFRAME_SZ + PT_PSR], %l0
982 andn %l0, PSR_CWP, %l0
983 nop
984 and %l1, PSR_CWP, %l1
985 or %l0, %l1, %l0
986 st %l0, [%sp + STACKFRAME_SZ + PT_PSR]
987 b ret_sys_call
988 mov 0, %o0
989
994 /* Linux native system calls enter here... */ 990 /* Linux native system calls enter here... */
995 .align 4 991 .align 4
996 .globl linux_sparc_syscall 992 .globl linux_sparc_syscall
@@ -1002,11 +998,8 @@ linux_sparc_syscall:
1002 bgeu linux_sparc_ni_syscall 998 bgeu linux_sparc_ni_syscall
1003 sll %g1, 2, %l4 999 sll %g1, 2, %l4
1004 ld [%l7 + %l4], %l7 1000 ld [%l7 + %l4], %l7
1005 andcc %l7, 1, %g0
1006 bne linux_fast_syscall
1007 /* Just do first insn from SAVE_ALL in the delay slot */
1008 1001
1009syscall_is_too_hard: 1002do_syscall:
1010 SAVE_ALL_HEAD 1003 SAVE_ALL_HEAD
1011 rd %wim, %l3 1004 rd %wim, %l3
1012 1005
diff --git a/arch/sparc/kernel/etrap_64.S b/arch/sparc/kernel/etrap_64.S
index 786b185e6e3..1276ca2567b 100644
--- a/arch/sparc/kernel/etrap_64.S
+++ b/arch/sparc/kernel/etrap_64.S
@@ -92,8 +92,10 @@ etrap_save: save %g2, -STACK_BIAS, %sp
92 rdpr %wstate, %g2 92 rdpr %wstate, %g2
93 wrpr %g0, 0, %canrestore 93 wrpr %g0, 0, %canrestore
94 sll %g2, 3, %g2 94 sll %g2, 3, %g2
95
96 /* Set TI_SYS_FPDEPTH to 1 and clear TI_SYS_NOERROR. */
95 mov 1, %l5 97 mov 1, %l5
96 stb %l5, [%l6 + TI_FPDEPTH] 98 sth %l5, [%l6 + TI_SYS_NOERROR]
97 99
98 wrpr %g3, 0, %otherwin 100 wrpr %g3, 0, %otherwin
99 wrpr %g2, 0, %wstate 101 wrpr %g2, 0, %wstate
@@ -152,7 +154,9 @@ etrap_save: save %g2, -STACK_BIAS, %sp
152 add %l6, TI_FPSAVED + 1, %l4 154 add %l6, TI_FPSAVED + 1, %l4
153 srl %l5, 1, %l3 155 srl %l5, 1, %l3
154 add %l5, 2, %l5 156 add %l5, 2, %l5
155 stb %l5, [%l6 + TI_FPDEPTH] 157
158 /* Set TI_SYS_FPDEPTH to %l5 and clear TI_SYS_NOERROR. */
159 sth %l5, [%l6 + TI_SYS_NOERROR]
156 ba,pt %xcc, 2b 160 ba,pt %xcc, 2b
157 stb %g0, [%l4 + %l3] 161 stb %g0, [%l4 + %l3]
158 nop 162 nop
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 918a2031c8b..5f688531f48 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -88,7 +88,7 @@ struct pci_pbm_info {
88 int chip_revision; 88 int chip_revision;
89 89
90 /* Name used for top-level resources. */ 90 /* Name used for top-level resources. */
91 char *name; 91 const char *name;
92 92
93 /* OBP specific information. */ 93 /* OBP specific information. */
94 struct platform_device *op; 94 struct platform_device *op;
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 487bffb36f5..be8e862bada 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -286,8 +286,7 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
286 parent_tid_ptr = regs->u_regs[UREG_I2]; 286 parent_tid_ptr = regs->u_regs[UREG_I2];
287 child_tid_ptr = regs->u_regs[UREG_I4]; 287 child_tid_ptr = regs->u_regs[UREG_I4];
288 288
289 ret = do_fork(clone_flags, stack_start, 289 ret = do_fork(clone_flags, stack_start, stack_size,
290 regs, stack_size,
291 (int __user *) parent_tid_ptr, 290 (int __user *) parent_tid_ptr,
292 (int __user *) child_tid_ptr); 291 (int __user *) child_tid_ptr);
293 292
@@ -316,13 +315,13 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
316 * XXX See comment above sys_vfork in sparc64. todo. 315 * XXX See comment above sys_vfork in sparc64. todo.
317 */ 316 */
318extern void ret_from_fork(void); 317extern void ret_from_fork(void);
318extern void ret_from_kernel_thread(void);
319 319
320int copy_thread(unsigned long clone_flags, unsigned long sp, 320int copy_thread(unsigned long clone_flags, unsigned long sp,
321 unsigned long unused, 321 unsigned long arg, struct task_struct *p)
322 struct task_struct *p, struct pt_regs *regs)
323{ 322{
324 struct thread_info *ti = task_thread_info(p); 323 struct thread_info *ti = task_thread_info(p);
325 struct pt_regs *childregs; 324 struct pt_regs *childregs, *regs = current_pt_regs();
326 char *new_stack; 325 char *new_stack;
327 326
328#ifndef CONFIG_SMP 327#ifndef CONFIG_SMP
@@ -336,16 +335,13 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
336 } 335 }
337 336
338 /* 337 /*
339 * p->thread_info new_stack childregs 338 * p->thread_info new_stack childregs stack bottom
340 * ! ! ! {if(PSR_PS) } 339 * ! ! ! !
341 * V V (stk.fr.) V (pt_regs) { (stk.fr.) } 340 * V V (stk.fr.) V (pt_regs) V
342 * +----- - - - - - ------+===========+============={+==========}+ 341 * +----- - - - - - ------+===========+=============+
343 */ 342 */
344 new_stack = task_stack_page(p) + THREAD_SIZE; 343 new_stack = task_stack_page(p) + THREAD_SIZE;
345 if (regs->psr & PSR_PS)
346 new_stack -= STACKFRAME_SZ;
347 new_stack -= STACKFRAME_SZ + TRACEREG_SZ; 344 new_stack -= STACKFRAME_SZ + TRACEREG_SZ;
348 memcpy(new_stack, (char *)regs - STACKFRAME_SZ, STACKFRAME_SZ + TRACEREG_SZ);
349 childregs = (struct pt_regs *) (new_stack + STACKFRAME_SZ); 345 childregs = (struct pt_regs *) (new_stack + STACKFRAME_SZ);
350 346
351 /* 347 /*
@@ -356,55 +352,58 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
356 * Thus, kpsr|=PSR_PIL. 352 * Thus, kpsr|=PSR_PIL.
357 */ 353 */
358 ti->ksp = (unsigned long) new_stack; 354 ti->ksp = (unsigned long) new_stack;
355 p->thread.kregs = childregs;
356
357 if (unlikely(p->flags & PF_KTHREAD)) {
358 extern int nwindows;
359 unsigned long psr;
360 memset(new_stack, 0, STACKFRAME_SZ + TRACEREG_SZ);
361 p->thread.flags |= SPARC_FLAG_KTHREAD;
362 p->thread.current_ds = KERNEL_DS;
363 ti->kpc = (((unsigned long) ret_from_kernel_thread) - 0x8);
364 childregs->u_regs[UREG_G1] = sp; /* function */
365 childregs->u_regs[UREG_G2] = arg;
366 psr = childregs->psr = get_psr();
367 ti->kpsr = psr | PSR_PIL;
368 ti->kwim = 1 << (((psr & PSR_CWP) + 1) % nwindows);
369 return 0;
370 }
371 memcpy(new_stack, (char *)regs - STACKFRAME_SZ, STACKFRAME_SZ + TRACEREG_SZ);
372 childregs->u_regs[UREG_FP] = sp;
373 p->thread.flags &= ~SPARC_FLAG_KTHREAD;
374 p->thread.current_ds = USER_DS;
359 ti->kpc = (((unsigned long) ret_from_fork) - 0x8); 375 ti->kpc = (((unsigned long) ret_from_fork) - 0x8);
360 ti->kpsr = current->thread.fork_kpsr | PSR_PIL; 376 ti->kpsr = current->thread.fork_kpsr | PSR_PIL;
361 ti->kwim = current->thread.fork_kwim; 377 ti->kwim = current->thread.fork_kwim;
362 378
363 if(regs->psr & PSR_PS) { 379 if (sp != regs->u_regs[UREG_FP]) {
364 extern struct pt_regs fake_swapper_regs; 380 struct sparc_stackf __user *childstack;
381 struct sparc_stackf __user *parentstack;
365 382
366 p->thread.kregs = &fake_swapper_regs; 383 /*
367 new_stack += STACKFRAME_SZ + TRACEREG_SZ; 384 * This is a clone() call with supplied user stack.
368 childregs->u_regs[UREG_FP] = (unsigned long) new_stack; 385 * Set some valid stack frames to give to the child.
369 p->thread.flags |= SPARC_FLAG_KTHREAD; 386 */
370 p->thread.current_ds = KERNEL_DS; 387 childstack = (struct sparc_stackf __user *)
371 memcpy(new_stack, (void *)regs->u_regs[UREG_FP], STACKFRAME_SZ); 388 (sp & ~0xfUL);
372 childregs->u_regs[UREG_G6] = (unsigned long) ti; 389 parentstack = (struct sparc_stackf __user *)
373 } else { 390 regs->u_regs[UREG_FP];
374 p->thread.kregs = childregs;
375 childregs->u_regs[UREG_FP] = sp;
376 p->thread.flags &= ~SPARC_FLAG_KTHREAD;
377 p->thread.current_ds = USER_DS;
378
379 if (sp != regs->u_regs[UREG_FP]) {
380 struct sparc_stackf __user *childstack;
381 struct sparc_stackf __user *parentstack;
382
383 /*
384 * This is a clone() call with supplied user stack.
385 * Set some valid stack frames to give to the child.
386 */
387 childstack = (struct sparc_stackf __user *)
388 (sp & ~0xfUL);
389 parentstack = (struct sparc_stackf __user *)
390 regs->u_regs[UREG_FP];
391 391
392#if 0 392#if 0
393 printk("clone: parent stack:\n"); 393 printk("clone: parent stack:\n");
394 show_stackframe(parentstack); 394 show_stackframe(parentstack);
395#endif 395#endif
396 396
397 childstack = clone_stackframe(childstack, parentstack); 397 childstack = clone_stackframe(childstack, parentstack);
398 if (!childstack) 398 if (!childstack)
399 return -EFAULT; 399 return -EFAULT;
400 400
401#if 0 401#if 0
402 printk("clone: child stack:\n"); 402 printk("clone: child stack:\n");
403 show_stackframe(childstack); 403 show_stackframe(childstack);
404#endif 404#endif
405 405
406 childregs->u_regs[UREG_FP] = (unsigned long)childstack; 406 childregs->u_regs[UREG_FP] = (unsigned long)childstack;
407 }
408 } 407 }
409 408
410#ifdef CONFIG_SMP 409#ifdef CONFIG_SMP
@@ -475,69 +474,6 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
475 return 1; 474 return 1;
476} 475}
477 476
478/*
479 * sparc_execve() executes a new program after the asm stub has set
480 * things up for us. This should basically do what I want it to.
481 */
482asmlinkage int sparc_execve(struct pt_regs *regs)
483{
484 int error, base = 0;
485 struct filename *filename;
486
487 /* Check for indirect call. */
488 if(regs->u_regs[UREG_G1] == 0)
489 base = 1;
490
491 filename = getname((char __user *)regs->u_regs[base + UREG_I0]);
492 error = PTR_ERR(filename);
493 if(IS_ERR(filename))
494 goto out;
495 error = do_execve(filename->name,
496 (const char __user *const __user *)
497 regs->u_regs[base + UREG_I1],
498 (const char __user *const __user *)
499 regs->u_regs[base + UREG_I2],
500 regs);
501 putname(filename);
502out:
503 return error;
504}
505
506/*
507 * This is the mechanism for creating a new kernel thread.
508 *
509 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
510 * who haven't done an "execve()") should use this: it will work within
511 * a system call from a "real" process, but the process memory space will
512 * not be freed until both the parent and the child have exited.
513 */
514pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
515{
516 long retval;
517
518 __asm__ __volatile__("mov %4, %%g2\n\t" /* Set aside fn ptr... */
519 "mov %5, %%g3\n\t" /* and arg. */
520 "mov %1, %%g1\n\t"
521 "mov %2, %%o0\n\t" /* Clone flags. */
522 "mov 0, %%o1\n\t" /* usp arg == 0 */
523 "t 0x10\n\t" /* Linux/Sparc clone(). */
524 "cmp %%o1, 0\n\t"
525 "be 1f\n\t" /* The parent, just return. */
526 " nop\n\t" /* Delay slot. */
527 "jmpl %%g2, %%o7\n\t" /* Call the function. */
528 " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */
529 "mov %3, %%g1\n\t"
530 "t 0x10\n\t" /* Linux/Sparc exit(). */
531 /* Notreached by child. */
532 "1: mov %%o0, %0\n\t" :
533 "=r" (retval) :
534 "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
535 "i" (__NR_exit), "r" (fn), "r" (arg) :
536 "g1", "g2", "g3", "o0", "o1", "memory", "cc");
537 return retval;
538}
539EXPORT_SYMBOL(kernel_thread);
540
541unsigned long get_wchan(struct task_struct *task) 477unsigned long get_wchan(struct task_struct *task)
542{ 478{
543 unsigned long pc, fp, bias = 0; 479 unsigned long pc, fp, bias = 0;
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index c6e0c291004..cdb80b2adbe 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -601,8 +601,7 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags,
601 child_tid_ptr = (int __user *) regs->u_regs[UREG_I4]; 601 child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
602 } 602 }
603 603
604 ret = do_fork(clone_flags, stack_start, 604 ret = do_fork(clone_flags, stack_start, stack_size,
605 regs, stack_size,
606 parent_tid_ptr, child_tid_ptr); 605 parent_tid_ptr, child_tid_ptr);
607 606
608 /* If we get an error and potentially restart the system 607 /* If we get an error and potentially restart the system
@@ -622,64 +621,55 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags,
622 * Child --> %o0 == parents pid, %o1 == 1 621 * Child --> %o0 == parents pid, %o1 == 1
623 */ 622 */
624int copy_thread(unsigned long clone_flags, unsigned long sp, 623int copy_thread(unsigned long clone_flags, unsigned long sp,
625 unsigned long unused, 624 unsigned long arg, struct task_struct *p)
626 struct task_struct *p, struct pt_regs *regs)
627{ 625{
628 struct thread_info *t = task_thread_info(p); 626 struct thread_info *t = task_thread_info(p);
627 struct pt_regs *regs = current_pt_regs();
629 struct sparc_stackf *parent_sf; 628 struct sparc_stackf *parent_sf;
630 unsigned long child_stack_sz; 629 unsigned long child_stack_sz;
631 char *child_trap_frame; 630 char *child_trap_frame;
632 int kernel_thread;
633
634 kernel_thread = (regs->tstate & TSTATE_PRIV) ? 1 : 0;
635 parent_sf = ((struct sparc_stackf *) regs) - 1;
636 631
637 /* Calculate offset to stack_frame & pt_regs */ 632 /* Calculate offset to stack_frame & pt_regs */
638 child_stack_sz = ((STACKFRAME_SZ + TRACEREG_SZ) + 633 child_stack_sz = (STACKFRAME_SZ + TRACEREG_SZ);
639 (kernel_thread ? STACKFRAME_SZ : 0));
640 child_trap_frame = (task_stack_page(p) + 634 child_trap_frame = (task_stack_page(p) +
641 (THREAD_SIZE - child_stack_sz)); 635 (THREAD_SIZE - child_stack_sz));
642 memcpy(child_trap_frame, parent_sf, child_stack_sz);
643 636
644 t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) |
645 (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) |
646 (((regs->tstate + 1) & TSTATE_CWP) << TI_FLAG_CWP_SHIFT);
647 t->new_child = 1; 637 t->new_child = 1;
648 t->ksp = ((unsigned long) child_trap_frame) - STACK_BIAS; 638 t->ksp = ((unsigned long) child_trap_frame) - STACK_BIAS;
649 t->kregs = (struct pt_regs *) (child_trap_frame + 639 t->kregs = (struct pt_regs *) (child_trap_frame +
650 sizeof(struct sparc_stackf)); 640 sizeof(struct sparc_stackf));
651 t->fpsaved[0] = 0; 641 t->fpsaved[0] = 0;
652 642
653 if (kernel_thread) { 643 if (unlikely(p->flags & PF_KTHREAD)) {
654 struct sparc_stackf *child_sf = (struct sparc_stackf *) 644 memset(child_trap_frame, 0, child_stack_sz);
655 (child_trap_frame + (STACKFRAME_SZ + TRACEREG_SZ)); 645 __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP] =
656 646 (current_pt_regs()->tstate + 1) & TSTATE_CWP;
657 /* Zero terminate the stack backtrace. */ 647 t->current_ds = ASI_P;
658 child_sf->fp = NULL; 648 t->kregs->u_regs[UREG_G1] = sp; /* function */
659 t->kregs->u_regs[UREG_FP] = 649 t->kregs->u_regs[UREG_G2] = arg;
660 ((unsigned long) child_sf) - STACK_BIAS; 650 return 0;
651 }
661 652
662 t->flags |= ((long)ASI_P << TI_FLAG_CURRENT_DS_SHIFT); 653 parent_sf = ((struct sparc_stackf *) regs) - 1;
663 t->kregs->u_regs[UREG_G6] = (unsigned long) t; 654 memcpy(child_trap_frame, parent_sf, child_stack_sz);
664 t->kregs->u_regs[UREG_G4] = (unsigned long) t->task; 655 if (t->flags & _TIF_32BIT) {
665 } else { 656 sp &= 0x00000000ffffffffUL;
666 if (t->flags & _TIF_32BIT) { 657 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL;
667 sp &= 0x00000000ffffffffUL;
668 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL;
669 }
670 t->kregs->u_regs[UREG_FP] = sp;
671 t->flags |= ((long)ASI_AIUS << TI_FLAG_CURRENT_DS_SHIFT);
672 if (sp != regs->u_regs[UREG_FP]) {
673 unsigned long csp;
674
675 csp = clone_stackframe(sp, regs->u_regs[UREG_FP]);
676 if (!csp)
677 return -EFAULT;
678 t->kregs->u_regs[UREG_FP] = csp;
679 }
680 if (t->utraps)
681 t->utraps[0]++;
682 } 658 }
659 t->kregs->u_regs[UREG_FP] = sp;
660 __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP] =
661 (regs->tstate + 1) & TSTATE_CWP;
662 t->current_ds = ASI_AIUS;
663 if (sp != regs->u_regs[UREG_FP]) {
664 unsigned long csp;
665
666 csp = clone_stackframe(sp, regs->u_regs[UREG_FP]);
667 if (!csp)
668 return -EFAULT;
669 t->kregs->u_regs[UREG_FP] = csp;
670 }
671 if (t->utraps)
672 t->utraps[0]++;
683 673
684 /* Set the return value for the child. */ 674 /* Set the return value for the child. */
685 t->kregs->u_regs[UREG_I0] = current->pid; 675 t->kregs->u_regs[UREG_I0] = current->pid;
@@ -694,45 +684,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
694 return 0; 684 return 0;
695} 685}
696 686
697/*
698 * This is the mechanism for creating a new kernel thread.
699 *
700 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
701 * who haven't done an "execve()") should use this: it will work within
702 * a system call from a "real" process, but the process memory space will
703 * not be freed until both the parent and the child have exited.
704 */
705pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
706{
707 long retval;
708
709 /* If the parent runs before fn(arg) is called by the child,
710 * the input registers of this function can be clobbered.
711 * So we stash 'fn' and 'arg' into global registers which
712 * will not be modified by the parent.
713 */
714 __asm__ __volatile__("mov %4, %%g2\n\t" /* Save FN into global */
715 "mov %5, %%g3\n\t" /* Save ARG into global */
716 "mov %1, %%g1\n\t" /* Clone syscall nr. */
717 "mov %2, %%o0\n\t" /* Clone flags. */
718 "mov 0, %%o1\n\t" /* usp arg == 0 */
719 "t 0x6d\n\t" /* Linux/Sparc clone(). */
720 "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
721 " mov %%o0, %0\n\t"
722 "jmpl %%g2, %%o7\n\t" /* Call the function. */
723 " mov %%g3, %%o0\n\t" /* Set arg in delay. */
724 "mov %3, %%g1\n\t"
725 "t 0x6d\n\t" /* Linux/Sparc exit(). */
726 /* Notreached by child. */
727 "1:" :
728 "=r" (retval) :
729 "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
730 "i" (__NR_exit), "r" (fn), "r" (arg) :
731 "g1", "g2", "g3", "o0", "o1", "memory", "cc");
732 return retval;
733}
734EXPORT_SYMBOL(kernel_thread);
735
736typedef struct { 687typedef struct {
737 union { 688 union {
738 unsigned int pr_regs[32]; 689 unsigned int pr_regs[32];
@@ -799,41 +750,6 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
799} 750}
800EXPORT_SYMBOL(dump_fpu); 751EXPORT_SYMBOL(dump_fpu);
801 752
802/*
803 * sparc_execve() executes a new program after the asm stub has set
804 * things up for us. This should basically do what I want it to.
805 */
806asmlinkage int sparc_execve(struct pt_regs *regs)
807{
808 int error, base = 0;
809 struct filename *filename;
810
811 /* User register window flush is done by entry.S */
812
813 /* Check for indirect call. */
814 if (regs->u_regs[UREG_G1] == 0)
815 base = 1;
816
817 filename = getname((char __user *)regs->u_regs[base + UREG_I0]);
818 error = PTR_ERR(filename);
819 if (IS_ERR(filename))
820 goto out;
821 error = do_execve(filename->name,
822 (const char __user *const __user *)
823 regs->u_regs[base + UREG_I1],
824 (const char __user *const __user *)
825 regs->u_regs[base + UREG_I2], regs);
826 putname(filename);
827 if (!error) {
828 fprs_write(0);
829 current_thread_info()->xfsr[0] = 0;
830 current_thread_info()->fpsaved[0] = 0;
831 regs->tstate &= ~TSTATE_PEF;
832 }
833out:
834 return error;
835}
836
837unsigned long get_wchan(struct task_struct *task) 753unsigned long get_wchan(struct task_struct *task)
838{ 754{
839 unsigned long pc, fp, bias = 0; 755 unsigned long pc, fp, bias = 0;
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index 44025f4ba41..8475a474273 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -47,7 +47,7 @@ STUB: sra REG1, 0, REG1; \
47 sra REG4, 0, REG4 47 sra REG4, 0, REG4
48 48
49SIGN1(sys32_exit, sparc_exit, %o0) 49SIGN1(sys32_exit, sparc_exit, %o0)
50SIGN1(sys32_exit_group, sys_exit_group, %o0) 50SIGN1(sys32_exit_group, sparc_exit_group, %o0)
51SIGN1(sys32_wait4, compat_sys_wait4, %o2) 51SIGN1(sys32_wait4, compat_sys_wait4, %o2)
52SIGN1(sys32_creat, sys_creat, %o1) 52SIGN1(sys32_creat, sys_creat, %o1)
53SIGN1(sys32_mknod, sys_mknod, %o1) 53SIGN1(sys32_mknod, sys_mknod, %o1)
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index c3239811a1b..03c7e929ec3 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -396,42 +396,6 @@ asmlinkage long compat_sys_rt_sigaction(int sig,
396 return ret; 396 return ret;
397} 397}
398 398
399/*
400 * sparc32_execve() executes a new program after the asm stub has set
401 * things up for us. This should basically do what I want it to.
402 */
403asmlinkage long sparc32_execve(struct pt_regs *regs)
404{
405 int error, base = 0;
406 struct filename *filename;
407
408 /* User register window flush is done by entry.S */
409
410 /* Check for indirect call. */
411 if ((u32)regs->u_regs[UREG_G1] == 0)
412 base = 1;
413
414 filename = getname(compat_ptr(regs->u_regs[base + UREG_I0]));
415 error = PTR_ERR(filename);
416 if (IS_ERR(filename))
417 goto out;
418
419 error = compat_do_execve(filename->name,
420 compat_ptr(regs->u_regs[base + UREG_I1]),
421 compat_ptr(regs->u_regs[base + UREG_I2]), regs);
422
423 putname(filename);
424
425 if (!error) {
426 fprs_write(0);
427 current_thread_info()->xfsr[0] = 0;
428 current_thread_info()->fpsaved[0] = 0;
429 regs->tstate &= ~TSTATE_PEF;
430 }
431out:
432 return error;
433}
434
435#ifdef CONFIG_MODULES 399#ifdef CONFIG_MODULES
436 400
437asmlinkage long sys32_init_module(void __user *umod, u32 len, 401asmlinkage long sys32_init_module(void __user *umod, u32 len,
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 0c9b31b22e0..2da0bdcae52 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -34,11 +34,9 @@ asmlinkage unsigned long sys_getpagesize(void)
34 return PAGE_SIZE; /* Possibly older binaries want 8192 on sun4's? */ 34 return PAGE_SIZE; /* Possibly older binaries want 8192 on sun4's? */
35} 35}
36 36
37#define COLOUR_ALIGN(addr) (((addr)+SHMLBA-1)&~(SHMLBA-1))
38
39unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) 37unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
40{ 38{
41 struct vm_area_struct * vmm; 39 struct vm_unmapped_area_info info;
42 40
43 if (flags & MAP_FIXED) { 41 if (flags & MAP_FIXED) {
44 /* We do not accept a shared mapping if it would violate 42 /* We do not accept a shared mapping if it would violate
@@ -56,21 +54,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
56 if (!addr) 54 if (!addr)
57 addr = TASK_UNMAPPED_BASE; 55 addr = TASK_UNMAPPED_BASE;
58 56
59 if (flags & MAP_SHARED) 57 info.flags = 0;
60 addr = COLOUR_ALIGN(addr); 58 info.length = len;
61 else 59 info.low_limit = addr;
62 addr = PAGE_ALIGN(addr); 60 info.high_limit = TASK_SIZE;
63 61 info.align_mask = (flags & MAP_SHARED) ?
64 for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { 62 (PAGE_MASK & (SHMLBA - 1)) : 0;
65 /* At this point: (!vmm || addr < vmm->vm_end). */ 63 info.align_offset = pgoff << PAGE_SHIFT;
66 if (TASK_SIZE - PAGE_SIZE - len < addr) 64 return vm_unmapped_area(&info);
67 return -ENOMEM;
68 if (!vmm || addr + len <= vmm->vm_start)
69 return addr;
70 addr = vmm->vm_end;
71 if (flags & MAP_SHARED)
72 addr = COLOUR_ALIGN(addr);
73 }
74} 65}
75 66
76/* 67/*
@@ -258,27 +249,3 @@ out:
258 up_read(&uts_sem); 249 up_read(&uts_sem);
259 return err; 250 return err;
260} 251}
261
262/*
263 * Do a system call from kernel instead of calling sys_execve so we
264 * end up with proper pt_regs.
265 */
266int kernel_execve(const char *filename,
267 const char *const argv[],
268 const char *const envp[])
269{
270 long __res;
271 register long __g1 __asm__ ("g1") = __NR_execve;
272 register long __o0 __asm__ ("o0") = (long)(filename);
273 register long __o1 __asm__ ("o1") = (long)(argv);
274 register long __o2 __asm__ ("o2") = (long)(envp);
275 asm volatile ("t 0x10\n\t"
276 "bcc 1f\n\t"
277 "mov %%o0, %0\n\t"
278 "sub %%g0, %%o0, %0\n\t"
279 "1:\n\t"
280 : "=r" (__res), "=&r" (__o0)
281 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1)
282 : "cc");
283 return __res;
284}
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 878ef3d5fec..708bc29d36a 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -75,7 +75,7 @@ static inline int invalid_64bit_range(unsigned long addr, unsigned long len)
75 * the spitfire/niagara VA-hole. 75 * the spitfire/niagara VA-hole.
76 */ 76 */
77 77
78static inline unsigned long COLOUR_ALIGN(unsigned long addr, 78static inline unsigned long COLOR_ALIGN(unsigned long addr,
79 unsigned long pgoff) 79 unsigned long pgoff)
80{ 80{
81 unsigned long base = (addr+SHMLBA-1)&~(SHMLBA-1); 81 unsigned long base = (addr+SHMLBA-1)&~(SHMLBA-1);
@@ -84,24 +84,13 @@ static inline unsigned long COLOUR_ALIGN(unsigned long addr,
84 return base + off; 84 return base + off;
85} 85}
86 86
87static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
88 unsigned long pgoff)
89{
90 unsigned long base = addr & ~(SHMLBA-1);
91 unsigned long off = (pgoff<<PAGE_SHIFT) & (SHMLBA-1);
92
93 if (base + off <= addr)
94 return base + off;
95 return base - off;
96}
97
98unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) 87unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
99{ 88{
100 struct mm_struct *mm = current->mm; 89 struct mm_struct *mm = current->mm;
101 struct vm_area_struct * vma; 90 struct vm_area_struct * vma;
102 unsigned long task_size = TASK_SIZE; 91 unsigned long task_size = TASK_SIZE;
103 unsigned long start_addr;
104 int do_color_align; 92 int do_color_align;
93 struct vm_unmapped_area_info info;
105 94
106 if (flags & MAP_FIXED) { 95 if (flags & MAP_FIXED) {
107 /* We do not accept a shared mapping if it would violate 96 /* We do not accept a shared mapping if it would violate
@@ -124,7 +113,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
124 113
125 if (addr) { 114 if (addr) {
126 if (do_color_align) 115 if (do_color_align)
127 addr = COLOUR_ALIGN(addr, pgoff); 116 addr = COLOR_ALIGN(addr, pgoff);
128 else 117 else
129 addr = PAGE_ALIGN(addr); 118 addr = PAGE_ALIGN(addr);
130 119
@@ -134,50 +123,22 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
134 return addr; 123 return addr;
135 } 124 }
136 125
137 if (len > mm->cached_hole_size) { 126 info.flags = 0;
138 start_addr = addr = mm->free_area_cache; 127 info.length = len;
139 } else { 128 info.low_limit = TASK_UNMAPPED_BASE;
140 start_addr = addr = TASK_UNMAPPED_BASE; 129 info.high_limit = min(task_size, VA_EXCLUDE_START);
141 mm->cached_hole_size = 0; 130 info.align_mask = do_color_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
131 info.align_offset = pgoff << PAGE_SHIFT;
132 addr = vm_unmapped_area(&info);
133
134 if ((addr & ~PAGE_MASK) && task_size > VA_EXCLUDE_END) {
135 VM_BUG_ON(addr != -ENOMEM);
136 info.low_limit = VA_EXCLUDE_END;
137 info.high_limit = task_size;
138 addr = vm_unmapped_area(&info);
142 } 139 }
143 140
144 task_size -= len; 141 return addr;
145
146full_search:
147 if (do_color_align)
148 addr = COLOUR_ALIGN(addr, pgoff);
149 else
150 addr = PAGE_ALIGN(addr);
151
152 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
153 /* At this point: (!vma || addr < vma->vm_end). */
154 if (addr < VA_EXCLUDE_START &&
155 (addr + len) >= VA_EXCLUDE_START) {
156 addr = VA_EXCLUDE_END;
157 vma = find_vma(mm, VA_EXCLUDE_END);
158 }
159 if (unlikely(task_size < addr)) {
160 if (start_addr != TASK_UNMAPPED_BASE) {
161 start_addr = addr = TASK_UNMAPPED_BASE;
162 mm->cached_hole_size = 0;
163 goto full_search;
164 }
165 return -ENOMEM;
166 }
167 if (likely(!vma || addr + len <= vma->vm_start)) {
168 /*
169 * Remember the place where we stopped the search:
170 */
171 mm->free_area_cache = addr + len;
172 return addr;
173 }
174 if (addr + mm->cached_hole_size < vma->vm_start)
175 mm->cached_hole_size = vma->vm_start - addr;
176
177 addr = vma->vm_end;
178 if (do_color_align)
179 addr = COLOUR_ALIGN(addr, pgoff);
180 }
181} 142}
182 143
183unsigned long 144unsigned long
@@ -190,6 +151,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
190 unsigned long task_size = STACK_TOP32; 151 unsigned long task_size = STACK_TOP32;
191 unsigned long addr = addr0; 152 unsigned long addr = addr0;
192 int do_color_align; 153 int do_color_align;
154 struct vm_unmapped_area_info info;
193 155
194 /* This should only ever run for 32-bit processes. */ 156 /* This should only ever run for 32-bit processes. */
195 BUG_ON(!test_thread_flag(TIF_32BIT)); 157 BUG_ON(!test_thread_flag(TIF_32BIT));
@@ -214,7 +176,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
214 /* requesting a specific address */ 176 /* requesting a specific address */
215 if (addr) { 177 if (addr) {
216 if (do_color_align) 178 if (do_color_align)
217 addr = COLOUR_ALIGN(addr, pgoff); 179 addr = COLOR_ALIGN(addr, pgoff);
218 else 180 else
219 addr = PAGE_ALIGN(addr); 181 addr = PAGE_ALIGN(addr);
220 182
@@ -224,73 +186,27 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
224 return addr; 186 return addr;
225 } 187 }
226 188
227 /* check if free_area_cache is useful for us */ 189 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
228 if (len <= mm->cached_hole_size) { 190 info.length = len;
229 mm->cached_hole_size = 0; 191 info.low_limit = PAGE_SIZE;
230 mm->free_area_cache = mm->mmap_base; 192 info.high_limit = mm->mmap_base;
231 } 193 info.align_mask = do_color_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
232 194 info.align_offset = pgoff << PAGE_SHIFT;
233 /* either no address requested or can't fit in requested address hole */ 195 addr = vm_unmapped_area(&info);
234 addr = mm->free_area_cache;
235 if (do_color_align) {
236 unsigned long base = COLOUR_ALIGN_DOWN(addr-len, pgoff);
237
238 addr = base + len;
239 }
240
241 /* make sure it can fit in the remaining address space */
242 if (likely(addr > len)) {
243 vma = find_vma(mm, addr-len);
244 if (!vma || addr <= vma->vm_start) {
245 /* remember the address as a hint for next time */
246 return (mm->free_area_cache = addr-len);
247 }
248 }
249
250 if (unlikely(mm->mmap_base < len))
251 goto bottomup;
252
253 addr = mm->mmap_base-len;
254 if (do_color_align)
255 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
256
257 do {
258 /*
259 * Lookup failure means no vma is above this address,
260 * else if new region fits below vma->vm_start,
261 * return with success:
262 */
263 vma = find_vma(mm, addr);
264 if (likely(!vma || addr+len <= vma->vm_start)) {
265 /* remember the address as a hint for next time */
266 return (mm->free_area_cache = addr);
267 }
268
269 /* remember the largest hole we saw so far */
270 if (addr + mm->cached_hole_size < vma->vm_start)
271 mm->cached_hole_size = vma->vm_start - addr;
272 196
273 /* try just below the current vma->vm_start */
274 addr = vma->vm_start-len;
275 if (do_color_align)
276 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
277 } while (likely(len < vma->vm_start));
278
279bottomup:
280 /* 197 /*
281 * A failed mmap() very likely causes application failure, 198 * A failed mmap() very likely causes application failure,
282 * so fall back to the bottom-up function here. This scenario 199 * so fall back to the bottom-up function here. This scenario
283 * can happen with large stack limits and large mmap() 200 * can happen with large stack limits and large mmap()
284 * allocations. 201 * allocations.
285 */ 202 */
286 mm->cached_hole_size = ~0UL; 203 if (addr & ~PAGE_MASK) {
287 mm->free_area_cache = TASK_UNMAPPED_BASE; 204 VM_BUG_ON(addr != -ENOMEM);
288 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags); 205 info.flags = 0;
289 /* 206 info.low_limit = TASK_UNMAPPED_BASE;
290 * Restore the topdown base: 207 info.high_limit = STACK_TOP32;
291 */ 208 addr = vm_unmapped_area(&info);
292 mm->free_area_cache = mm->mmap_base; 209 }
293 mm->cached_hole_size = ~0UL;
294 210
295 return addr; 211 return addr;
296} 212}
@@ -730,28 +646,6 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act,
730 return ret; 646 return ret;
731} 647}
732 648
733/*
734 * Do a system call from kernel instead of calling sys_execve so we
735 * end up with proper pt_regs.
736 */
737int kernel_execve(const char *filename,
738 const char *const argv[],
739 const char *const envp[])
740{
741 long __res;
742 register long __g1 __asm__ ("g1") = __NR_execve;
743 register long __o0 __asm__ ("o0") = (long)(filename);
744 register long __o1 __asm__ ("o1") = (long)(argv);
745 register long __o2 __asm__ ("o2") = (long)(envp);
746 asm volatile ("t 0x6d\n\t"
747 "sub %%g0, %%o0, %0\n\t"
748 "movcc %%xcc, %%o0, %0\n\t"
749 : "=r" (__res), "=&r" (__o0)
750 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1)
751 : "cc");
752 return __res;
753}
754
755asmlinkage long sys_kern_features(void) 649asmlinkage long sys_kern_features(void)
756{ 650{
757 return KERN_FEATURE_MIXED_MODE_STACK; 651 return KERN_FEATURE_MIXED_MODE_STACK;
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index 7f5f65d0b3f..e0fed7711a9 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -1,23 +1,19 @@
1 /* SunOS's execv() call only specifies the argv argument, the 1 /* SunOS's execv() call only specifies the argv argument, the
2 * environment settings are the same as the calling processes. 2 * environment settings are the same as the calling processes.
3 */ 3 */
4sys_execve: 4sys64_execve:
5 sethi %hi(sparc_execve), %g1 5 set sys_execve, %g1
6 ba,pt %xcc, execve_merge 6 jmpl %g1, %g0
7 or %g1, %lo(sparc_execve), %g1 7 flushw
8 8
9#ifdef CONFIG_COMPAT 9#ifdef CONFIG_COMPAT
10sunos_execv: 10sunos_execv:
11 stx %g0, [%sp + PTREGS_OFF + PT_V9_I2] 11 mov %g0, %o2
12sys32_execve: 12sys32_execve:
13 sethi %hi(sparc32_execve), %g1 13 set compat_sys_execve, %g1
14 or %g1, %lo(sparc32_execve), %g1
15#endif
16
17execve_merge:
18 flushw
19 jmpl %g1, %g0 14 jmpl %g1, %g0
20 add %sp, PTREGS_OFF, %o0 15 flushw
16#endif
21 17
22 .align 32 18 .align 32
23sys_sparc_pipe: 19sys_sparc_pipe:
@@ -112,16 +108,31 @@ sys_clone:
112ret_from_syscall: 108ret_from_syscall:
113 /* Clear current_thread_info()->new_child. */ 109 /* Clear current_thread_info()->new_child. */
114 stb %g0, [%g6 + TI_NEW_CHILD] 110 stb %g0, [%g6 + TI_NEW_CHILD]
115 ldx [%g6 + TI_FLAGS], %l0
116 call schedule_tail 111 call schedule_tail
117 mov %g7, %o0 112 mov %g7, %o0
113 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
114 brnz,pt %o0, ret_sys_call
115 ldx [%g6 + TI_FLAGS], %l0
116 ldx [%sp + PTREGS_OFF + PT_V9_G1], %l1
117 call %l1
118 ldx [%sp + PTREGS_OFF + PT_V9_G2], %o0
118 ba,pt %xcc, ret_sys_call 119 ba,pt %xcc, ret_sys_call
119 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0 120 mov 0, %o0
121
122 .globl sparc_exit_group
123 .type sparc_exit_group,#function
124sparc_exit_group:
125 sethi %hi(sys_exit_group), %g7
126 ba,pt %xcc, 1f
127 or %g7, %lo(sys_exit_group), %g7
128 .size sparc_exit_group,.-sparc_exit_group
120 129
121 .globl sparc_exit 130 .globl sparc_exit
122 .type sparc_exit,#function 131 .type sparc_exit,#function
123sparc_exit: 132sparc_exit:
124 rdpr %pstate, %g2 133 sethi %hi(sys_exit), %g7
134 or %g7, %lo(sys_exit), %g7
1351: rdpr %pstate, %g2
125 wrpr %g2, PSTATE_IE, %pstate 136 wrpr %g2, PSTATE_IE, %pstate
126 rdpr %otherwin, %g1 137 rdpr %otherwin, %g1
127 rdpr %cansave, %g3 138 rdpr %cansave, %g3
@@ -129,7 +140,7 @@ sparc_exit:
129 wrpr %g3, 0x0, %cansave 140 wrpr %g3, 0x0, %cansave
130 wrpr %g0, 0x0, %otherwin 141 wrpr %g0, 0x0, %otherwin
131 wrpr %g2, 0x0, %pstate 142 wrpr %g2, 0x0, %pstate
132 ba,pt %xcc, sys_exit 143 jmpl %g7, %g0
133 stb %g0, [%g6 + TI_WSAVED] 144 stb %g0, [%g6 + TI_WSAVED]
134 .size sparc_exit,.-sparc_exit 145 .size sparc_exit,.-sparc_exit
135 146
@@ -222,7 +233,6 @@ ret_sys_call:
222 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc 233 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
223 234
2242: 2352:
225 stb %g0, [%g6 + TI_SYS_NOERROR]
226 /* System call success, clear Carry condition code. */ 236 /* System call success, clear Carry condition code. */
227 andn %g3, %g2, %g3 237 andn %g3, %g2, %g3
2283: 2383:
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 1c9af9fa38e..cdbd9b81775 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -107,7 +107,7 @@ sys_call_table:
107/*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall 107/*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall
108 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid 108 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
109/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl 109/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl
110 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve 110 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys64_execve
111/*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize 111/*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize
112 .word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall 112 .word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall
113/*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys_64_munmap, sys_mprotect 113/*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys_64_munmap, sys_mprotect
@@ -133,7 +133,7 @@ sys_call_table:
133/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents 133/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
134 .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr 134 .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
135/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall 135/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall
136 .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname 136 .word sys_setpgid, sys_fremovexattr, sys_tkill, sparc_exit_group, sys_newuname
137/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl 137/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
138 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_nis_syscall, sys_sgetmask 138 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_nis_syscall, sys_sgetmask
139/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall 139/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index b66a77968f3..e7ecf1507d9 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -2688,8 +2688,8 @@ void __init trap_init(void)
2688 TI_PRE_COUNT != offsetof(struct thread_info, 2688 TI_PRE_COUNT != offsetof(struct thread_info,
2689 preempt_count) || 2689 preempt_count) ||
2690 TI_NEW_CHILD != offsetof(struct thread_info, new_child) || 2690 TI_NEW_CHILD != offsetof(struct thread_info, new_child) ||
2691 TI_SYS_NOERROR != offsetof(struct thread_info, 2691 TI_CURRENT_DS != offsetof(struct thread_info,
2692 syscall_noerror) || 2692 current_ds) ||
2693 TI_RESTART_BLOCK != offsetof(struct thread_info, 2693 TI_RESTART_BLOCK != offsetof(struct thread_info,
2694 restart_block) || 2694 restart_block) ||
2695 TI_KUNA_REGS != offsetof(struct thread_info, 2695 TI_KUNA_REGS != offsetof(struct thread_info,
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index f76f83d5ac6..d2b59441ebd 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -30,55 +30,28 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *filp,
30 unsigned long pgoff, 30 unsigned long pgoff,
31 unsigned long flags) 31 unsigned long flags)
32{ 32{
33 struct mm_struct *mm = current->mm;
34 struct vm_area_struct * vma;
35 unsigned long task_size = TASK_SIZE; 33 unsigned long task_size = TASK_SIZE;
36 unsigned long start_addr; 34 struct vm_unmapped_area_info info;
37 35
38 if (test_thread_flag(TIF_32BIT)) 36 if (test_thread_flag(TIF_32BIT))
39 task_size = STACK_TOP32; 37 task_size = STACK_TOP32;
40 if (unlikely(len >= VA_EXCLUDE_START))
41 return -ENOMEM;
42 38
43 if (len > mm->cached_hole_size) { 39 info.flags = 0;
44 start_addr = addr = mm->free_area_cache; 40 info.length = len;
45 } else { 41 info.low_limit = TASK_UNMAPPED_BASE;
46 start_addr = addr = TASK_UNMAPPED_BASE; 42 info.high_limit = min(task_size, VA_EXCLUDE_START);
47 mm->cached_hole_size = 0; 43 info.align_mask = PAGE_MASK & ~HPAGE_MASK;
44 info.align_offset = 0;
45 addr = vm_unmapped_area(&info);
46
47 if ((addr & ~PAGE_MASK) && task_size > VA_EXCLUDE_END) {
48 VM_BUG_ON(addr != -ENOMEM);
49 info.low_limit = VA_EXCLUDE_END;
50 info.high_limit = task_size;
51 addr = vm_unmapped_area(&info);
48 } 52 }
49 53
50 task_size -= len; 54 return addr;
51
52full_search:
53 addr = ALIGN(addr, HPAGE_SIZE);
54
55 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
56 /* At this point: (!vma || addr < vma->vm_end). */
57 if (addr < VA_EXCLUDE_START &&
58 (addr + len) >= VA_EXCLUDE_START) {
59 addr = VA_EXCLUDE_END;
60 vma = find_vma(mm, VA_EXCLUDE_END);
61 }
62 if (unlikely(task_size < addr)) {
63 if (start_addr != TASK_UNMAPPED_BASE) {
64 start_addr = addr = TASK_UNMAPPED_BASE;
65 mm->cached_hole_size = 0;
66 goto full_search;
67 }
68 return -ENOMEM;
69 }
70 if (likely(!vma || addr + len <= vma->vm_start)) {
71 /*
72 * Remember the place where we stopped the search:
73 */
74 mm->free_area_cache = addr + len;
75 return addr;
76 }
77 if (addr + mm->cached_hole_size < vma->vm_start)
78 mm->cached_hole_size = vma->vm_start - addr;
79
80 addr = ALIGN(vma->vm_end, HPAGE_SIZE);
81 }
82} 55}
83 56
84static unsigned long 57static unsigned long
@@ -87,71 +60,34 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
87 const unsigned long pgoff, 60 const unsigned long pgoff,
88 const unsigned long flags) 61 const unsigned long flags)
89{ 62{
90 struct vm_area_struct *vma;
91 struct mm_struct *mm = current->mm; 63 struct mm_struct *mm = current->mm;
92 unsigned long addr = addr0; 64 unsigned long addr = addr0;
65 struct vm_unmapped_area_info info;
93 66
94 /* This should only ever run for 32-bit processes. */ 67 /* This should only ever run for 32-bit processes. */
95 BUG_ON(!test_thread_flag(TIF_32BIT)); 68 BUG_ON(!test_thread_flag(TIF_32BIT));
96 69
97 /* check if free_area_cache is useful for us */ 70 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
98 if (len <= mm->cached_hole_size) { 71 info.length = len;
99 mm->cached_hole_size = 0; 72 info.low_limit = PAGE_SIZE;
100 mm->free_area_cache = mm->mmap_base; 73 info.high_limit = mm->mmap_base;
101 } 74 info.align_mask = PAGE_MASK & ~HPAGE_MASK;
102 75 info.align_offset = 0;
103 /* either no address requested or can't fit in requested address hole */ 76 addr = vm_unmapped_area(&info);
104 addr = mm->free_area_cache & HPAGE_MASK;
105
106 /* make sure it can fit in the remaining address space */
107 if (likely(addr > len)) {
108 vma = find_vma(mm, addr-len);
109 if (!vma || addr <= vma->vm_start) {
110 /* remember the address as a hint for next time */
111 return (mm->free_area_cache = addr-len);
112 }
113 }
114
115 if (unlikely(mm->mmap_base < len))
116 goto bottomup;
117
118 addr = (mm->mmap_base-len) & HPAGE_MASK;
119
120 do {
121 /*
122 * Lookup failure means no vma is above this address,
123 * else if new region fits below vma->vm_start,
124 * return with success:
125 */
126 vma = find_vma(mm, addr);
127 if (likely(!vma || addr+len <= vma->vm_start)) {
128 /* remember the address as a hint for next time */
129 return (mm->free_area_cache = addr);
130 }
131
132 /* remember the largest hole we saw so far */
133 if (addr + mm->cached_hole_size < vma->vm_start)
134 mm->cached_hole_size = vma->vm_start - addr;
135
136 /* try just below the current vma->vm_start */
137 addr = (vma->vm_start-len) & HPAGE_MASK;
138 } while (likely(len < vma->vm_start));
139 77
140bottomup:
141 /* 78 /*
142 * A failed mmap() very likely causes application failure, 79 * A failed mmap() very likely causes application failure,
143 * so fall back to the bottom-up function here. This scenario 80 * so fall back to the bottom-up function here. This scenario
144 * can happen with large stack limits and large mmap() 81 * can happen with large stack limits and large mmap()
145 * allocations. 82 * allocations.
146 */ 83 */
147 mm->cached_hole_size = ~0UL; 84 if (addr & ~PAGE_MASK) {
148 mm->free_area_cache = TASK_UNMAPPED_BASE; 85 VM_BUG_ON(addr != -ENOMEM);
149 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags); 86 info.flags = 0;
150 /* 87 info.low_limit = TASK_UNMAPPED_BASE;
151 * Restore the topdown base: 88 info.high_limit = STACK_TOP32;
152 */ 89 addr = vm_unmapped_area(&info);
153 mm->free_area_cache = mm->mmap_base; 90 }
154 mm->cached_hole_size = ~0UL;
155 91
156 return addr; 92 return addr;
157} 93}
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 9e28a118e6a..85be1ca539b 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -624,7 +624,7 @@ static void __init inherit_prom_mappings(void)
624void prom_world(int enter) 624void prom_world(int enter)
625{ 625{
626 if (!enter) 626 if (!enter)
627 set_fs((mm_segment_t) { get_thread_current_ds() }); 627 set_fs(get_fs());
628 628
629 __asm__ __volatile__("flushw"); 629 __asm__ __volatile__("flushw");
630} 630}
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index 28368701ef7..3109ca684a9 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -3,6 +3,7 @@
3#include <linux/netdevice.h> 3#include <linux/netdevice.h>
4#include <linux/filter.h> 4#include <linux/filter.h>
5#include <linux/cache.h> 5#include <linux/cache.h>
6#include <linux/if_vlan.h>
6 7
7#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
8#include <asm/ptrace.h> 9#include <asm/ptrace.h>
@@ -312,6 +313,12 @@ do { *prog++ = BR_OPC | WDISP22(OFF); \
312#define emit_addi(R1, IMM, R3) \ 313#define emit_addi(R1, IMM, R3) \
313 *prog++ = (ADD | IMMED | RS1(R1) | S13(IMM) | RD(R3)) 314 *prog++ = (ADD | IMMED | RS1(R1) | S13(IMM) | RD(R3))
314 315
316#define emit_and(R1, R2, R3) \
317 *prog++ = (AND | RS1(R1) | RS2(R2) | RD(R3))
318
319#define emit_andi(R1, IMM, R3) \
320 *prog++ = (AND | IMMED | RS1(R1) | S13(IMM) | RD(R3))
321
315#define emit_alloc_stack(SZ) \ 322#define emit_alloc_stack(SZ) \
316 *prog++ = (SUB | IMMED | RS1(SP) | S13(SZ) | RD(SP)) 323 *prog++ = (SUB | IMMED | RS1(SP) | S13(SZ) | RD(SP))
317 324
@@ -415,6 +422,8 @@ void bpf_jit_compile(struct sk_filter *fp)
415 case BPF_S_ANC_IFINDEX: 422 case BPF_S_ANC_IFINDEX:
416 case BPF_S_ANC_MARK: 423 case BPF_S_ANC_MARK:
417 case BPF_S_ANC_RXHASH: 424 case BPF_S_ANC_RXHASH:
425 case BPF_S_ANC_VLAN_TAG:
426 case BPF_S_ANC_VLAN_TAG_PRESENT:
418 case BPF_S_ANC_CPU: 427 case BPF_S_ANC_CPU:
419 case BPF_S_ANC_QUEUE: 428 case BPF_S_ANC_QUEUE:
420 case BPF_S_LD_W_ABS: 429 case BPF_S_LD_W_ABS:
@@ -600,6 +609,16 @@ void bpf_jit_compile(struct sk_filter *fp)
600 case BPF_S_ANC_RXHASH: 609 case BPF_S_ANC_RXHASH:
601 emit_skb_load32(rxhash, r_A); 610 emit_skb_load32(rxhash, r_A);
602 break; 611 break;
612 case BPF_S_ANC_VLAN_TAG:
613 case BPF_S_ANC_VLAN_TAG_PRESENT:
614 emit_skb_load16(vlan_tci, r_A);
615 if (filter[i].code == BPF_S_ANC_VLAN_TAG) {
616 emit_andi(r_A, VLAN_VID_MASK, r_A);
617 } else {
618 emit_loadimm(VLAN_TAG_PRESENT, r_TMP);
619 emit_and(r_A, r_TMP, r_A);
620 }
621 break;
603 622
604 case BPF_S_LD_IMM: 623 case BPF_S_LD_IMM:
605 emit_loadimm(K, r_A); 624 emit_loadimm(K, r_A);
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 875d008828b..ea7f61e8bc9 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -21,6 +21,8 @@ config TILE
21 select ARCH_HAVE_NMI_SAFE_CMPXCHG 21 select ARCH_HAVE_NMI_SAFE_CMPXCHG
22 select GENERIC_CLOCKEVENTS 22 select GENERIC_CLOCKEVENTS
23 select MODULES_USE_ELF_RELA 23 select MODULES_USE_ELF_RELA
24 select GENERIC_KERNEL_THREAD
25 select GENERIC_KERNEL_EXECVE
24 26
25# FIXME: investigate whether we need/want these options. 27# FIXME: investigate whether we need/want these options.
26# select HAVE_IOREMAP_PROT 28# select HAVE_IOREMAP_PROT
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 6948015e08a..b17b9b8e53c 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -34,5 +34,6 @@ generic-y += sockios.h
34generic-y += statfs.h 34generic-y += statfs.h
35generic-y += termbits.h 35generic-y += termbits.h
36generic-y += termios.h 36generic-y += termios.h
37generic-y += trace_clock.h
37generic-y += types.h 38generic-y += types.h
38generic-y += xor.h 39generic-y += xor.h
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h
index 3063e6fc8da..ca61fb4296b 100644
--- a/arch/tile/include/asm/compat.h
+++ b/arch/tile/include/asm/compat.h
@@ -275,18 +275,14 @@ extern int compat_setup_rt_frame(int sig, struct k_sigaction *ka,
275struct compat_sigaction; 275struct compat_sigaction;
276struct compat_siginfo; 276struct compat_siginfo;
277struct compat_sigaltstack; 277struct compat_sigaltstack;
278long compat_sys_execve(const char __user *path,
279 compat_uptr_t __user *argv,
280 compat_uptr_t __user *envp, struct pt_regs *);
281long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, 278long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act,
282 struct compat_sigaction __user *oact, 279 struct compat_sigaction __user *oact,
283 size_t sigsetsize); 280 size_t sigsetsize);
284long compat_sys_rt_sigqueueinfo(int pid, int sig, 281long compat_sys_rt_sigqueueinfo(int pid, int sig,
285 struct compat_siginfo __user *uinfo); 282 struct compat_siginfo __user *uinfo);
286long compat_sys_rt_sigreturn(struct pt_regs *); 283long compat_sys_rt_sigreturn(void);
287long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, 284long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
288 struct compat_sigaltstack __user *uoss_ptr, 285 struct compat_sigaltstack __user *uoss_ptr);
289 struct pt_regs *);
290long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); 286long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high);
291long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); 287long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high);
292long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, 288long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count,
@@ -303,12 +299,7 @@ long compat_sys_fallocate(int fd, int mode,
303long compat_sys_sched_rr_get_interval(compat_pid_t pid, 299long compat_sys_sched_rr_get_interval(compat_pid_t pid,
304 struct compat_timespec __user *interval); 300 struct compat_timespec __user *interval);
305 301
306/* These are the intvec_64.S trampolines. */ 302/* Assembly trampoline to avoid clobbering r0. */
307long _compat_sys_execve(const char __user *path,
308 const compat_uptr_t __user *argv,
309 const compat_uptr_t __user *envp);
310long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
311 struct compat_sigaltstack __user *uoss_ptr);
312long _compat_sys_rt_sigreturn(void); 303long _compat_sys_rt_sigreturn(void);
313 304
314#endif /* _ASM_TILE_COMPAT_H */ 305#endif /* _ASM_TILE_COMPAT_H */
diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index f8ccf08f693..b73e1039c91 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -148,6 +148,7 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
148#define compat_start_thread(regs, ip, usp) do { \ 148#define compat_start_thread(regs, ip, usp) do { \
149 regs->pc = ptr_to_compat_reg((void *)(ip)); \ 149 regs->pc = ptr_to_compat_reg((void *)(ip)); \
150 regs->sp = ptr_to_compat_reg((void *)(usp)); \ 150 regs->sp = ptr_to_compat_reg((void *)(usp)); \
151 single_step_execve(); \
151 } while (0) 152 } while (0)
152 153
153/* 154/*
diff --git a/arch/tile/include/asm/processor.h b/arch/tile/include/asm/processor.h
index 8c4dd9ff91e..2b70dfb1442 100644
--- a/arch/tile/include/asm/processor.h
+++ b/arch/tile/include/asm/processor.h
@@ -211,6 +211,7 @@ static inline void start_thread(struct pt_regs *regs,
211{ 211{
212 regs->pc = pc; 212 regs->pc = pc;
213 regs->sp = usp; 213 regs->sp = usp;
214 single_step_execve();
214} 215}
215 216
216/* Free all resources held by a thread. */ 217/* Free all resources held by a thread. */
@@ -219,8 +220,6 @@ static inline void release_thread(struct task_struct *dead_task)
219 /* Nothing for now */ 220 /* Nothing for now */
220} 221}
221 222
222extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
223
224extern int do_work_pending(struct pt_regs *regs, u32 flags); 223extern int do_work_pending(struct pt_regs *regs, u32 flags);
225 224
226 225
@@ -239,6 +238,9 @@ unsigned long get_wchan(struct task_struct *p);
239#define KSTK_TOP(task) (task_ksp0(task) - STACK_TOP_DELTA) 238#define KSTK_TOP(task) (task_ksp0(task) - STACK_TOP_DELTA)
240#define task_pt_regs(task) \ 239#define task_pt_regs(task) \
241 ((struct pt_regs *)(task_ksp0(task) - KSTK_PTREGS_GAP) - 1) 240 ((struct pt_regs *)(task_ksp0(task) - KSTK_PTREGS_GAP) - 1)
241#define current_pt_regs() \
242 ((struct pt_regs *)((stack_pointer | (THREAD_SIZE - 1)) - \
243 (KSTK_PTREGS_GAP - 1)) - 1)
242#define task_sp(task) (task_pt_regs(task)->sp) 244#define task_sp(task) (task_pt_regs(task)->sp)
243#define task_pc(task) (task_pt_regs(task)->pc) 245#define task_pc(task) (task_pt_regs(task)->pc)
244/* Aliases for pc and sp (used in fs/proc/array.c) */ 246/* Aliases for pc and sp (used in fs/proc/array.c) */
diff --git a/arch/tile/include/asm/switch_to.h b/arch/tile/include/asm/switch_to.h
index 1d48c5fee8b..b8f888cbe6b 100644
--- a/arch/tile/include/asm/switch_to.h
+++ b/arch/tile/include/asm/switch_to.h
@@ -68,7 +68,10 @@ extern unsigned long get_switch_to_pc(void);
68/* Support function for forking a new task. */ 68/* Support function for forking a new task. */
69void ret_from_fork(void); 69void ret_from_fork(void);
70 70
71/* Called from ret_from_fork() when a new process starts up. */ 71/* Support function for forking a new kernel thread. */
72void ret_from_kernel_thread(void *fn, void *arg);
73
74/* Called from ret_from_xxx() when a new process starts up. */
72struct task_struct *sim_notify_fork(struct task_struct *prev); 75struct task_struct *sim_notify_fork(struct task_struct *prev);
73 76
74#endif /* !__ASSEMBLY__ */ 77#endif /* !__ASSEMBLY__ */
diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h
index 06f0464cfed..4c8462a62cb 100644
--- a/arch/tile/include/asm/syscalls.h
+++ b/arch/tile/include/asm/syscalls.h
@@ -51,8 +51,7 @@ long sys_cacheflush(unsigned long addr, unsigned long len,
51 51
52#ifndef __tilegx__ 52#ifndef __tilegx__
53/* mm/fault.c */ 53/* mm/fault.c */
54long sys_cmpxchg_badaddr(unsigned long address, struct pt_regs *); 54long sys_cmpxchg_badaddr(unsigned long address);
55long _sys_cmpxchg_badaddr(unsigned long address);
56#endif 55#endif
57 56
58#ifdef CONFIG_COMPAT 57#ifdef CONFIG_COMPAT
@@ -63,14 +62,16 @@ long sys_truncate64(const char __user *path, loff_t length);
63long sys_ftruncate64(unsigned int fd, loff_t length); 62long sys_ftruncate64(unsigned int fd, loff_t length);
64#endif 63#endif
65 64
65/* Provide versions of standard syscalls that use current_pt_regs(). */
66long sys_rt_sigreturn(void);
67long sys_sigaltstack(const stack_t __user *, stack_t __user *);
68#define sys_rt_sigreturn sys_rt_sigreturn
69#define sys_sigaltstack sys_sigaltstack
70
66/* These are the intvec*.S trampolines. */ 71/* These are the intvec*.S trampolines. */
67long _sys_sigaltstack(const stack_t __user *, stack_t __user *);
68long _sys_rt_sigreturn(void); 72long _sys_rt_sigreturn(void);
69long _sys_clone(unsigned long clone_flags, unsigned long newsp, 73long _sys_clone(unsigned long clone_flags, unsigned long newsp,
70 void __user *parent_tid, void __user *child_tid); 74 void __user *parent_tid, void __user *child_tid);
71long _sys_execve(const char __user *filename,
72 const char __user *const __user *argv,
73 const char __user *const __user *envp);
74 75
75#include <asm-generic/syscalls.h> 76#include <asm-generic/syscalls.h>
76 77
diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h
index 6e032a0a268..b51c6ee3cd6 100644
--- a/arch/tile/include/asm/unistd.h
+++ b/arch/tile/include/asm/unistd.h
@@ -16,4 +16,6 @@
16#define __ARCH_WANT_SYS_LLSEEK 16#define __ARCH_WANT_SYS_LLSEEK
17#endif 17#endif
18#define __ARCH_WANT_SYS_NEWFSTATAT 18#define __ARCH_WANT_SYS_NEWFSTATAT
19#define __ARCH_WANT_SYS_EXECVE
20#define __ARCH_WANT_SYS_CLONE
19#include <uapi/asm/unistd.h> 21#include <uapi/asm/unistd.h>
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index d67459b9ac2..9cd7cb6041c 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -102,9 +102,7 @@ long compat_sys_sched_rr_get_interval(compat_pid_t pid,
102#define compat_sys_fadvise64_64 sys32_fadvise64_64 102#define compat_sys_fadvise64_64 sys32_fadvise64_64
103#define compat_sys_readahead sys32_readahead 103#define compat_sys_readahead sys32_readahead
104 104
105/* Call the trampolines to manage pt_regs where necessary. */ 105/* Call the assembly trampolines where necessary. */
106#define compat_sys_execve _compat_sys_execve
107#define compat_sys_sigaltstack _compat_sys_sigaltstack
108#define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn 106#define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn
109#define sys_clone _sys_clone 107#define sys_clone _sys_clone
110 108
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 08b4fe1717b..2e4cc69224a 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -197,8 +197,7 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
197} 197}
198 198
199long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, 199long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
200 struct compat_sigaltstack __user *uoss_ptr, 200 struct compat_sigaltstack __user *uoss_ptr)
201 struct pt_regs *regs)
202{ 201{
203 stack_t uss, uoss; 202 stack_t uss, uoss;
204 int ret; 203 int ret;
@@ -219,7 +218,7 @@ long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
219 set_fs(KERNEL_DS); 218 set_fs(KERNEL_DS);
220 ret = do_sigaltstack(uss_ptr ? (stack_t __user __force *)&uss : NULL, 219 ret = do_sigaltstack(uss_ptr ? (stack_t __user __force *)&uss : NULL,
221 (stack_t __user __force *)&uoss, 220 (stack_t __user __force *)&uoss,
222 (unsigned long)compat_ptr(regs->sp)); 221 (unsigned long)compat_ptr(current_pt_regs()->sp));
223 set_fs(seg); 222 set_fs(seg);
224 if (ret >= 0 && uoss_ptr) { 223 if (ret >= 0 && uoss_ptr) {
225 if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(*uoss_ptr)) || 224 if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(*uoss_ptr)) ||
@@ -232,8 +231,9 @@ long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
232} 231}
233 232
234/* The assembly shim for this function arranges to ignore the return value. */ 233/* The assembly shim for this function arranges to ignore the return value. */
235long compat_sys_rt_sigreturn(struct pt_regs *regs) 234long compat_sys_rt_sigreturn(void)
236{ 235{
236 struct pt_regs *regs = current_pt_regs();
237 struct compat_rt_sigframe __user *frame = 237 struct compat_rt_sigframe __user *frame =
238 (struct compat_rt_sigframe __user *) compat_ptr(regs->sp); 238 (struct compat_rt_sigframe __user *) compat_ptr(regs->sp);
239 sigset_t set; 239 sigset_t set;
@@ -248,7 +248,7 @@ long compat_sys_rt_sigreturn(struct pt_regs *regs)
248 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 248 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
249 goto badframe; 249 goto badframe;
250 250
251 if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL, regs) != 0) 251 if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL) == -EFAULT)
252 goto badframe; 252 goto badframe;
253 253
254 return 0; 254 return 0;
diff --git a/arch/tile/kernel/entry.S b/arch/tile/kernel/entry.S
index c31637baff2..f116cb0bce2 100644
--- a/arch/tile/kernel/entry.S
+++ b/arch/tile/kernel/entry.S
@@ -28,17 +28,6 @@ STD_ENTRY(current_text_addr)
28 STD_ENDPROC(current_text_addr) 28 STD_ENDPROC(current_text_addr)
29 29
30/* 30/*
31 * Implement execve(). The i386 code has a note that forking from kernel
32 * space results in no copy on write until the execve, so we should be
33 * careful not to write to the stack here.
34 */
35STD_ENTRY(kernel_execve)
36 moveli TREG_SYSCALL_NR_NAME, __NR_execve
37 swint1
38 jrp lr
39 STD_ENDPROC(kernel_execve)
40
41/*
42 * We don't run this function directly, but instead copy it to a page 31 * We don't run this function directly, but instead copy it to a page
43 * we map into every user process. See vdso_setup(). 32 * we map into every user process. See vdso_setup().
44 * 33 *
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 6943515100f..f212bf7cea8 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1291,6 +1291,21 @@ STD_ENTRY(ret_from_fork)
1291 } 1291 }
1292 STD_ENDPROC(ret_from_fork) 1292 STD_ENDPROC(ret_from_fork)
1293 1293
1294STD_ENTRY(ret_from_kernel_thread)
1295 jal sim_notify_fork
1296 jal schedule_tail
1297 FEEDBACK_REENTER(ret_from_fork)
1298 {
1299 move r0, r31
1300 jalr r30
1301 }
1302 FEEDBACK_REENTER(ret_from_kernel_thread)
1303 {
1304 movei r30, 0 /* not an NMI */
1305 j .Lresume_userspace /* jump into middle of interrupt_return */
1306 }
1307 STD_ENDPROC(ret_from_kernel_thread)
1308
1294 /* 1309 /*
1295 * Code for ill interrupt. 1310 * Code for ill interrupt.
1296 */ 1311 */
@@ -1437,15 +1452,6 @@ STD_ENTRY_LOCAL(bad_intr)
1437 panic "Unhandled interrupt %#x: PC %#lx" 1452 panic "Unhandled interrupt %#x: PC %#lx"
1438 STD_ENDPROC(bad_intr) 1453 STD_ENDPROC(bad_intr)
1439 1454
1440/* Put address of pt_regs in reg and jump. */
1441#define PTREGS_SYSCALL(x, reg) \
1442 STD_ENTRY(_##x); \
1443 { \
1444 PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \
1445 j x \
1446 }; \
1447 STD_ENDPROC(_##x)
1448
1449/* 1455/*
1450 * Special-case sigreturn to not write r0 to the stack on return. 1456 * Special-case sigreturn to not write r0 to the stack on return.
1451 * This is technically more efficient, but it also avoids difficulties 1457 * This is technically more efficient, but it also avoids difficulties
@@ -1461,12 +1467,9 @@ STD_ENTRY_LOCAL(bad_intr)
1461 }; \ 1467 }; \
1462 STD_ENDPROC(_##x) 1468 STD_ENDPROC(_##x)
1463 1469
1464PTREGS_SYSCALL(sys_execve, r3)
1465PTREGS_SYSCALL(sys_sigaltstack, r2)
1466PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0) 1470PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0)
1467PTREGS_SYSCALL(sys_cmpxchg_badaddr, r1)
1468 1471
1469/* Save additional callee-saves to pt_regs, put address in r4 and jump. */ 1472/* Save additional callee-saves to pt_regs and jump to standard function. */
1470STD_ENTRY(_sys_clone) 1473STD_ENTRY(_sys_clone)
1471 push_extra_callee_saves r4 1474 push_extra_callee_saves r4
1472 j sys_clone 1475 j sys_clone
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 7c06d597ffd..54bc9a6678e 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1150,6 +1150,21 @@ STD_ENTRY(ret_from_fork)
1150 } 1150 }
1151 STD_ENDPROC(ret_from_fork) 1151 STD_ENDPROC(ret_from_fork)
1152 1152
1153STD_ENTRY(ret_from_kernel_thread)
1154 jal sim_notify_fork
1155 jal schedule_tail
1156 FEEDBACK_REENTER(ret_from_fork)
1157 {
1158 move r0, r31
1159 jalr r30
1160 }
1161 FEEDBACK_REENTER(ret_from_kernel_thread)
1162 {
1163 movei r30, 0 /* not an NMI */
1164 j .Lresume_userspace /* jump into middle of interrupt_return */
1165 }
1166 STD_ENDPROC(ret_from_kernel_thread)
1167
1153/* Various stub interrupt handlers and syscall handlers */ 1168/* Various stub interrupt handlers and syscall handlers */
1154 1169
1155STD_ENTRY_LOCAL(_kernel_double_fault) 1170STD_ENTRY_LOCAL(_kernel_double_fault)
@@ -1166,15 +1181,6 @@ STD_ENTRY_LOCAL(bad_intr)
1166 panic "Unhandled interrupt %#x: PC %#lx" 1181 panic "Unhandled interrupt %#x: PC %#lx"
1167 STD_ENDPROC(bad_intr) 1182 STD_ENDPROC(bad_intr)
1168 1183
1169/* Put address of pt_regs in reg and jump. */
1170#define PTREGS_SYSCALL(x, reg) \
1171 STD_ENTRY(_##x); \
1172 { \
1173 PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \
1174 j x \
1175 }; \
1176 STD_ENDPROC(_##x)
1177
1178/* 1184/*
1179 * Special-case sigreturn to not write r0 to the stack on return. 1185 * Special-case sigreturn to not write r0 to the stack on return.
1180 * This is technically more efficient, but it also avoids difficulties 1186 * This is technically more efficient, but it also avoids difficulties
@@ -1190,16 +1196,12 @@ STD_ENTRY_LOCAL(bad_intr)
1190 }; \ 1196 }; \
1191 STD_ENDPROC(_##x) 1197 STD_ENDPROC(_##x)
1192 1198
1193PTREGS_SYSCALL(sys_execve, r3)
1194PTREGS_SYSCALL(sys_sigaltstack, r2)
1195PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0) 1199PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0)
1196#ifdef CONFIG_COMPAT 1200#ifdef CONFIG_COMPAT
1197PTREGS_SYSCALL(compat_sys_execve, r3)
1198PTREGS_SYSCALL(compat_sys_sigaltstack, r2)
1199PTREGS_SYSCALL_SIGRETURN(compat_sys_rt_sigreturn, r0) 1201PTREGS_SYSCALL_SIGRETURN(compat_sys_rt_sigreturn, r0)
1200#endif 1202#endif
1201 1203
1202/* Save additional callee-saves to pt_regs, put address in r4 and jump. */ 1204/* Save additional callee-saves to pt_regs and jump to standard function. */
1203STD_ENTRY(_sys_clone) 1205STD_ENTRY(_sys_clone)
1204 push_extra_callee_saves r4 1206 push_extra_callee_saves r4
1205 j sys_clone 1207 j sys_clone
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index 307d010696c..0e5661e7d00 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -157,24 +157,43 @@ void arch_release_thread_info(struct thread_info *info)
157static void save_arch_state(struct thread_struct *t); 157static void save_arch_state(struct thread_struct *t);
158 158
159int copy_thread(unsigned long clone_flags, unsigned long sp, 159int copy_thread(unsigned long clone_flags, unsigned long sp,
160 unsigned long stack_size, 160 unsigned long arg, struct task_struct *p)
161 struct task_struct *p, struct pt_regs *regs)
162{ 161{
163 struct pt_regs *childregs; 162 struct pt_regs *childregs = task_pt_regs(p), *regs = current_pt_regs();
164 unsigned long ksp; 163 unsigned long ksp;
164 unsigned long *callee_regs;
165 165
166 /* 166 /*
167 * When creating a new kernel thread we pass sp as zero. 167 * Set up the stack and stack pointer appropriately for the
168 * Assign it to a reasonable value now that we have the stack. 168 * new child to find itself woken up in __switch_to().
169 * The callee-saved registers must be on the stack to be read;
170 * the new task will then jump to assembly support to handle
171 * calling schedule_tail(), etc., and (for userspace tasks)
172 * returning to the context set up in the pt_regs.
169 */ 173 */
170 if (sp == 0 && regs->ex1 == PL_ICS_EX1(KERNEL_PL, 0)) 174 ksp = (unsigned long) childregs;
171 sp = KSTK_TOP(p); 175 ksp -= C_ABI_SAVE_AREA_SIZE; /* interrupt-entry save area */
176 ((long *)ksp)[0] = ((long *)ksp)[1] = 0;
177 ksp -= CALLEE_SAVED_REGS_COUNT * sizeof(unsigned long);
178 callee_regs = (unsigned long *)ksp;
179 ksp -= C_ABI_SAVE_AREA_SIZE; /* __switch_to() save area */
180 ((long *)ksp)[0] = ((long *)ksp)[1] = 0;
181 p->thread.ksp = ksp;
172 182
173 /* 183 /* Record the pid of the task that created this one. */
174 * Do not clone step state from the parent; each thread 184 p->thread.creator_pid = current->pid;
175 * must make its own lazily. 185
176 */ 186 if (unlikely(p->flags & PF_KTHREAD)) {
177 task_thread_info(p)->step_state = NULL; 187 /* kernel thread */
188 memset(childregs, 0, sizeof(struct pt_regs));
189 memset(&callee_regs[2], 0,
190 (CALLEE_SAVED_REGS_COUNT - 2) * sizeof(unsigned long));
191 callee_regs[0] = sp; /* r30 = function */
192 callee_regs[1] = arg; /* r31 = arg */
193 childregs->ex1 = PL_ICS_EX1(KERNEL_PL, 0);
194 p->thread.pc = (unsigned long) ret_from_kernel_thread;
195 return 0;
196 }
178 197
179 /* 198 /*
180 * Start new thread in ret_from_fork so it schedules properly 199 * Start new thread in ret_from_fork so it schedules properly
@@ -182,46 +201,33 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
182 */ 201 */
183 p->thread.pc = (unsigned long) ret_from_fork; 202 p->thread.pc = (unsigned long) ret_from_fork;
184 203
185 /* Save user stack top pointer so we can ID the stack vm area later. */ 204 /*
186 p->thread.usp0 = sp; 205 * Do not clone step state from the parent; each thread
187 206 * must make its own lazily.
188 /* Record the pid of the process that created this one. */ 207 */
189 p->thread.creator_pid = current->pid; 208 task_thread_info(p)->step_state = NULL;
190 209
191 /* 210 /*
192 * Copy the registers onto the kernel stack so the 211 * Copy the registers onto the kernel stack so the
193 * return-from-interrupt code will reload it into registers. 212 * return-from-interrupt code will reload it into registers.
194 */ 213 */
195 childregs = task_pt_regs(p); 214 *childregs = *current_pt_regs();
196 *childregs = *regs;
197 childregs->regs[0] = 0; /* return value is zero */ 215 childregs->regs[0] = 0; /* return value is zero */
198 childregs->sp = sp; /* override with new user stack pointer */ 216 if (sp)
217 childregs->sp = sp; /* override with new user stack pointer */
218 memcpy(callee_regs, &childregs->regs[CALLEE_SAVED_FIRST_REG],
219 CALLEE_SAVED_REGS_COUNT * sizeof(unsigned long));
220
221 /* Save user stack top pointer so we can ID the stack vm area later. */
222 p->thread.usp0 = childregs->sp;
199 223
200 /* 224 /*
201 * If CLONE_SETTLS is set, set "tp" in the new task to "r4", 225 * If CLONE_SETTLS is set, set "tp" in the new task to "r4",
202 * which is passed in as arg #5 to sys_clone(). 226 * which is passed in as arg #5 to sys_clone().
203 */ 227 */
204 if (clone_flags & CLONE_SETTLS) 228 if (clone_flags & CLONE_SETTLS)
205 childregs->tp = regs->regs[4]; 229 childregs->tp = childregs->regs[4];
206 230
207 /*
208 * Copy the callee-saved registers from the passed pt_regs struct
209 * into the context-switch callee-saved registers area.
210 * This way when we start the interrupt-return sequence, the
211 * callee-save registers will be correctly in registers, which
212 * is how we assume the compiler leaves them as we start doing
213 * the normal return-from-interrupt path after calling C code.
214 * Zero out the C ABI save area to mark the top of the stack.
215 */
216 ksp = (unsigned long) childregs;
217 ksp -= C_ABI_SAVE_AREA_SIZE; /* interrupt-entry save area */
218 ((long *)ksp)[0] = ((long *)ksp)[1] = 0;
219 ksp -= CALLEE_SAVED_REGS_COUNT * sizeof(unsigned long);
220 memcpy((void *)ksp, &regs->regs[CALLEE_SAVED_FIRST_REG],
221 CALLEE_SAVED_REGS_COUNT * sizeof(unsigned long));
222 ksp -= C_ABI_SAVE_AREA_SIZE; /* __switch_to() save area */
223 ((long *)ksp)[0] = ((long *)ksp)[1] = 0;
224 p->thread.ksp = ksp;
225 231
226#if CHIP_HAS_TILE_DMA() 232#if CHIP_HAS_TILE_DMA()
227 /* 233 /*
@@ -577,62 +583,6 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
577 panic("work_pending: bad flags %#x\n", thread_info_flags); 583 panic("work_pending: bad flags %#x\n", thread_info_flags);
578} 584}
579 585
580/* Note there is an implicit fifth argument if (clone_flags & CLONE_SETTLS). */
581SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
582 void __user *, parent_tidptr, void __user *, child_tidptr,
583 struct pt_regs *, regs)
584{
585 if (!newsp)
586 newsp = regs->sp;
587 return do_fork(clone_flags, newsp, regs, 0,
588 parent_tidptr, child_tidptr);
589}
590
591/*
592 * sys_execve() executes a new program.
593 */
594SYSCALL_DEFINE4(execve, const char __user *, path,
595 const char __user *const __user *, argv,
596 const char __user *const __user *, envp,
597 struct pt_regs *, regs)
598{
599 long error;
600 struct filename *filename;
601
602 filename = getname(path);
603 error = PTR_ERR(filename);
604 if (IS_ERR(filename))
605 goto out;
606 error = do_execve(filename->name, argv, envp, regs);
607 putname(filename);
608 if (error == 0)
609 single_step_execve();
610out:
611 return error;
612}
613
614#ifdef CONFIG_COMPAT
615long compat_sys_execve(const char __user *path,
616 compat_uptr_t __user *argv,
617 compat_uptr_t __user *envp,
618 struct pt_regs *regs)
619{
620 long error;
621 struct filename *filename;
622
623 filename = getname(path);
624 error = PTR_ERR(filename);
625 if (IS_ERR(filename))
626 goto out;
627 error = compat_do_execve(filename->name, argv, envp, regs);
628 putname(filename);
629 if (error == 0)
630 single_step_execve();
631out:
632 return error;
633}
634#endif
635
636unsigned long get_wchan(struct task_struct *p) 586unsigned long get_wchan(struct task_struct *p)
637{ 587{
638 struct KBacktraceIterator kbt; 588 struct KBacktraceIterator kbt;
@@ -650,37 +600,6 @@ unsigned long get_wchan(struct task_struct *p)
650 return 0; 600 return 0;
651} 601}
652 602
653/*
654 * We pass in lr as zero (cleared in kernel_thread) and the caller
655 * part of the backtrace ABI on the stack also zeroed (in copy_thread)
656 * so that backtraces will stop with this function.
657 * Note that we don't use r0, since copy_thread() clears it.
658 */
659static void start_kernel_thread(int dummy, int (*fn)(int), int arg)
660{
661 do_exit(fn(arg));
662}
663
664/*
665 * Create a kernel thread
666 */
667int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
668{
669 struct pt_regs regs;
670
671 memset(&regs, 0, sizeof(regs));
672 regs.ex1 = PL_ICS_EX1(KERNEL_PL, 0); /* run at kernel PL, no ICS */
673 regs.pc = (long) start_kernel_thread;
674 regs.flags = PT_FLAGS_CALLER_SAVES; /* need to restore r1 and r2 */
675 regs.regs[1] = (long) fn; /* function pointer */
676 regs.regs[2] = (long) arg; /* parameter register */
677
678 /* Ok, create the new process.. */
679 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs,
680 0, NULL, NULL);
681}
682EXPORT_SYMBOL(kernel_thread);
683
684/* Flush thread state. */ 603/* Flush thread state. */
685void flush_thread(void) 604void flush_thread(void)
686{ 605{
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c
index 67efb656d10..657a7ace4ab 100644
--- a/arch/tile/kernel/signal.c
+++ b/arch/tile/kernel/signal.c
@@ -37,10 +37,10 @@
37 37
38#define DEBUG_SIG 0 38#define DEBUG_SIG 0
39 39
40SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, 40SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
41 stack_t __user *, uoss, struct pt_regs *, regs) 41 stack_t __user *, uoss)
42{ 42{
43 return do_sigaltstack(uss, uoss, regs->sp); 43 return do_sigaltstack(uss, uoss, current_pt_regs()->sp);
44} 44}
45 45
46 46
@@ -83,8 +83,9 @@ void signal_fault(const char *type, struct pt_regs *regs,
83} 83}
84 84
85/* The assembly shim for this function arranges to ignore the return value. */ 85/* The assembly shim for this function arranges to ignore the return value. */
86SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) 86SYSCALL_DEFINE0(rt_sigreturn)
87{ 87{
88 struct pt_regs *regs = current_pt_regs();
88 struct rt_sigframe __user *frame = 89 struct rt_sigframe __user *frame =
89 (struct rt_sigframe __user *)(regs->sp); 90 (struct rt_sigframe __user *)(regs->sp);
90 sigset_t set; 91 sigset_t set;
diff --git a/arch/tile/kernel/sys.c b/arch/tile/kernel/sys.c
index b08095b402d..b881a7be24b 100644
--- a/arch/tile/kernel/sys.c
+++ b/arch/tile/kernel/sys.c
@@ -106,14 +106,10 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
106#define sys_readahead sys32_readahead 106#define sys_readahead sys32_readahead
107#endif 107#endif
108 108
109/* Call the trampolines to manage pt_regs where necessary. */ 109/* Call the assembly trampolines where necessary. */
110#define sys_execve _sys_execve 110#undef sys_rt_sigreturn
111#define sys_sigaltstack _sys_sigaltstack
112#define sys_rt_sigreturn _sys_rt_sigreturn 111#define sys_rt_sigreturn _sys_rt_sigreturn
113#define sys_clone _sys_clone 112#define sys_clone _sys_clone
114#ifndef __tilegx__
115#define sys_cmpxchg_badaddr _sys_cmpxchg_badaddr
116#endif
117 113
118/* 114/*
119 * Note that we can't include <linux/unistd.h> here since the header 115 * Note that we can't include <linux/unistd.h> here since the header
diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
index fe811fa5f1b..3d2b81c163a 100644
--- a/arch/tile/mm/fault.c
+++ b/arch/tile/mm/fault.c
@@ -70,9 +70,10 @@ static noinline void force_sig_info_fault(const char *type, int si_signo,
70 * Synthesize the fault a PL0 process would get by doing a word-load of 70 * Synthesize the fault a PL0 process would get by doing a word-load of
71 * an unaligned address or a high kernel address. 71 * an unaligned address or a high kernel address.
72 */ 72 */
73SYSCALL_DEFINE2(cmpxchg_badaddr, unsigned long, address, 73SYSCALL_DEFINE1(cmpxchg_badaddr, unsigned long, address)
74 struct pt_regs *, regs)
75{ 74{
75 struct pt_regs *regs = current_pt_regs();
76
76 if (address >= PAGE_OFFSET) 77 if (address >= PAGE_OFFSET)
77 force_sig_info_fault("atomic segfault", SIGSEGV, SEGV_MAPERR, 78 force_sig_info_fault("atomic segfault", SIGSEGV, SEGV_MAPERR,
78 address, INT_DTLB_MISS, current, regs); 79 address, INT_DTLB_MISS, current, regs);
diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c
index 812e2d03797..650ccff8378 100644
--- a/arch/tile/mm/hugetlbpage.c
+++ b/arch/tile/mm/hugetlbpage.c
@@ -231,42 +231,15 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
231 unsigned long pgoff, unsigned long flags) 231 unsigned long pgoff, unsigned long flags)
232{ 232{
233 struct hstate *h = hstate_file(file); 233 struct hstate *h = hstate_file(file);
234 struct mm_struct *mm = current->mm; 234 struct vm_unmapped_area_info info;
235 struct vm_area_struct *vma; 235
236 unsigned long start_addr; 236 info.flags = 0;
237 237 info.length = len;
238 if (len > mm->cached_hole_size) { 238 info.low_limit = TASK_UNMAPPED_BASE;
239 start_addr = mm->free_area_cache; 239 info.high_limit = TASK_SIZE;
240 } else { 240 info.align_mask = PAGE_MASK & ~huge_page_mask(h);
241 start_addr = TASK_UNMAPPED_BASE; 241 info.align_offset = 0;
242 mm->cached_hole_size = 0; 242 return vm_unmapped_area(&info);
243 }
244
245full_search:
246 addr = ALIGN(start_addr, huge_page_size(h));
247
248 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
249 /* At this point: (!vma || addr < vma->vm_end). */
250 if (TASK_SIZE - len < addr) {
251 /*
252 * Start a new search - just in case we missed
253 * some holes.
254 */
255 if (start_addr != TASK_UNMAPPED_BASE) {
256 start_addr = TASK_UNMAPPED_BASE;
257 mm->cached_hole_size = 0;
258 goto full_search;
259 }
260 return -ENOMEM;
261 }
262 if (!vma || addr + len <= vma->vm_start) {
263 mm->free_area_cache = addr + len;
264 return addr;
265 }
266 if (addr + mm->cached_hole_size < vma->vm_start)
267 mm->cached_hole_size = vma->vm_start - addr;
268 addr = ALIGN(vma->vm_end, huge_page_size(h));
269 }
270} 243}
271 244
272static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file, 245static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
@@ -274,92 +247,30 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
274 unsigned long pgoff, unsigned long flags) 247 unsigned long pgoff, unsigned long flags)
275{ 248{
276 struct hstate *h = hstate_file(file); 249 struct hstate *h = hstate_file(file);
277 struct mm_struct *mm = current->mm; 250 struct vm_unmapped_area_info info;
278 struct vm_area_struct *vma, *prev_vma; 251 unsigned long addr;
279 unsigned long base = mm->mmap_base, addr = addr0;
280 unsigned long largest_hole = mm->cached_hole_size;
281 int first_time = 1;
282
283 /* don't allow allocations above current base */
284 if (mm->free_area_cache > base)
285 mm->free_area_cache = base;
286
287 if (len <= largest_hole) {
288 largest_hole = 0;
289 mm->free_area_cache = base;
290 }
291try_again:
292 /* make sure it can fit in the remaining address space */
293 if (mm->free_area_cache < len)
294 goto fail;
295
296 /* either no address requested or can't fit in requested address hole */
297 addr = (mm->free_area_cache - len) & huge_page_mask(h);
298 do {
299 /*
300 * Lookup failure means no vma is above this address,
301 * i.e. return with success:
302 */
303 vma = find_vma_prev(mm, addr, &prev_vma);
304 if (!vma) {
305 return addr;
306 break;
307 }
308
309 /*
310 * new region fits between prev_vma->vm_end and
311 * vma->vm_start, use it:
312 */
313 if (addr + len <= vma->vm_start &&
314 (!prev_vma || (addr >= prev_vma->vm_end))) {
315 /* remember the address as a hint for next time */
316 mm->cached_hole_size = largest_hole;
317 mm->free_area_cache = addr;
318 return addr;
319 } else {
320 /* pull free_area_cache down to the first hole */
321 if (mm->free_area_cache == vma->vm_end) {
322 mm->free_area_cache = vma->vm_start;
323 mm->cached_hole_size = largest_hole;
324 }
325 }
326 252
327 /* remember the largest hole we saw so far */ 253 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
328 if (addr + largest_hole < vma->vm_start) 254 info.length = len;
329 largest_hole = vma->vm_start - addr; 255 info.low_limit = PAGE_SIZE;
256 info.high_limit = current->mm->mmap_base;
257 info.align_mask = PAGE_MASK & ~huge_page_mask(h);
258 info.align_offset = 0;
259 addr = vm_unmapped_area(&info);
330 260
331 /* try just below the current vma->vm_start */
332 addr = (vma->vm_start - len) & huge_page_mask(h);
333
334 } while (len <= vma->vm_start);
335
336fail:
337 /*
338 * if hint left us with no space for the requested
339 * mapping then try again:
340 */
341 if (first_time) {
342 mm->free_area_cache = base;
343 largest_hole = 0;
344 first_time = 0;
345 goto try_again;
346 }
347 /* 261 /*
348 * A failed mmap() very likely causes application failure, 262 * A failed mmap() very likely causes application failure,
349 * so fall back to the bottom-up function here. This scenario 263 * so fall back to the bottom-up function here. This scenario
350 * can happen with large stack limits and large mmap() 264 * can happen with large stack limits and large mmap()
351 * allocations. 265 * allocations.
352 */ 266 */
353 mm->free_area_cache = TASK_UNMAPPED_BASE; 267 if (addr & ~PAGE_MASK) {
354 mm->cached_hole_size = ~0UL; 268 VM_BUG_ON(addr != -ENOMEM);
355 addr = hugetlb_get_unmapped_area_bottomup(file, addr0, 269 info.flags = 0;
356 len, pgoff, flags); 270 info.low_limit = TASK_UNMAPPED_BASE;
357 271 info.high_limit = TASK_SIZE;
358 /* 272 addr = vm_unmapped_area(&info);
359 * Restore the topdown base: 273 }
360 */
361 mm->free_area_cache = base;
362 mm->cached_hole_size = ~0UL;
363 274
364 return addr; 275 return addr;
365} 276}
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index c3bba73e4be..e9a0abc6a32 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -83,21 +83,8 @@ static const struct chan_ops not_configged_ops = {
83 83
84static void tty_receive_char(struct tty_struct *tty, char ch) 84static void tty_receive_char(struct tty_struct *tty, char ch)
85{ 85{
86 if (tty == NULL) 86 if (tty)
87 return; 87 tty_insert_flip_char(tty, ch, TTY_NORMAL);
88
89 if (I_IXON(tty) && !I_IXOFF(tty) && !tty->raw) {
90 if (ch == STOP_CHAR(tty)) {
91 stop_tty(tty);
92 return;
93 }
94 else if (ch == START_CHAR(tty)) {
95 start_tty(tty);
96 return;
97 }
98 }
99
100 tty_insert_flip_char(tty, ch, TTY_NORMAL);
101} 88}
102 89
103static int open_one_chan(struct chan *chan) 90static int open_one_chan(struct chan *chan)
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index fd9a15b318a..9ffc28bd4b7 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -584,6 +584,8 @@ int register_lines(struct line_driver *line_driver,
584 printk(KERN_ERR "register_lines : can't register %s driver\n", 584 printk(KERN_ERR "register_lines : can't register %s driver\n",
585 line_driver->name); 585 line_driver->name);
586 put_tty_driver(driver); 586 put_tty_driver(driver);
587 for (i = 0; i < nlines; i++)
588 tty_port_destroy(&lines[i].port);
587 return err; 589 return err;
588 } 590 }
589 591
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 79ccfe6c707..49e3b49e552 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -648,7 +648,7 @@ static void stack_proc(void *arg)
648 struct task_struct *from = current, *to = arg; 648 struct task_struct *from = current, *to = arg;
649 649
650 to->thread.saved_task = from; 650 to->thread.saved_task = from;
651 rcu_switch(from, to); 651 rcu_user_hooks_switch(from, to);
652 switch_to(from, to, from); 652 switch_to(from, to, from);
653} 653}
654 654
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 0f6e7b32826..b30f34a7988 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -2,3 +2,4 @@ generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h
2generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h 2generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
3generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h 3generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
4generic-y += switch_to.h clkdev.h 4generic-y += switch_to.h clkdev.h
5generic-y += trace_clock.h
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 3a8ece7d09c..0d7103c9eff 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -32,13 +32,14 @@ void flush_thread(void)
32 "err = %d\n", ret); 32 "err = %d\n", ret);
33 force_sig(SIGKILL, current); 33 force_sig(SIGKILL, current);
34 } 34 }
35 get_safe_registers(current_pt_regs()->regs.gp,
36 current_pt_regs()->regs.fp);
35 37
36 __switch_mm(&current->mm->context.id); 38 __switch_mm(&current->mm->context.id);
37} 39}
38 40
39void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) 41void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
40{ 42{
41 get_safe_registers(regs->regs.gp, regs->regs.fp);
42 PT_REGS_IP(regs) = eip; 43 PT_REGS_IP(regs) = eip;
43 PT_REGS_SP(regs) = esp; 44 PT_REGS_SP(regs) = esp;
44 current->ptrace &= ~PT_DTRACE; 45 current->ptrace &= ~PT_DTRACE;
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index b6d699cdd55..b462b13c5ba 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -161,8 +161,7 @@ void fork_handler(void)
161} 161}
162 162
163int copy_thread(unsigned long clone_flags, unsigned long sp, 163int copy_thread(unsigned long clone_flags, unsigned long sp,
164 unsigned long arg, struct task_struct * p, 164 unsigned long arg, struct task_struct * p)
165 struct pt_regs *regs)
166{ 165{
167 void (*handler)(void); 166 void (*handler)(void);
168 int kthread = current->flags & PF_KTHREAD; 167 int kthread = current->flags & PF_KTHREAD;
@@ -171,7 +170,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
171 p->thread = (struct thread_struct) INIT_THREAD; 170 p->thread = (struct thread_struct) INIT_THREAD;
172 171
173 if (!kthread) { 172 if (!kthread) {
174 memcpy(&p->thread.regs.regs, &regs->regs, 173 memcpy(&p->thread.regs.regs, current_pt_regs(),
175 sizeof(p->thread.regs.regs)); 174 sizeof(p->thread.regs.regs));
176 PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); 175 PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0);
177 if (sp != 0) 176 if (sp != 0)
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index a81f3705e90..c1d0ae069b5 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -14,29 +14,6 @@
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include <asm/unistd.h> 15#include <asm/unistd.h>
16 16
17long sys_fork(void)
18{
19 return do_fork(SIGCHLD, UPT_SP(&current->thread.regs.regs),
20 &current->thread.regs, 0, NULL, NULL);
21}
22
23long sys_vfork(void)
24{
25 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
26 UPT_SP(&current->thread.regs.regs),
27 &current->thread.regs, 0, NULL, NULL);
28}
29
30long sys_clone(unsigned long clone_flags, unsigned long newsp,
31 void __user *parent_tid, void __user *child_tid)
32{
33 if (!newsp)
34 newsp = UPT_SP(&current->thread.regs.regs);
35
36 return do_fork(clone_flags, newsp, &current->thread.regs, 0, parent_tid,
37 child_tid);
38}
39
40long old_mmap(unsigned long addr, unsigned long len, 17long old_mmap(unsigned long addr, unsigned long len,
41 unsigned long prot, unsigned long flags, 18 unsigned long prot, unsigned long flags,
42 unsigned long fd, unsigned long offset) 19 unsigned long fd, unsigned long offset)
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index 601e92f18af..89d8b6c4e39 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -53,6 +53,7 @@ generic-y += syscalls.h
53generic-y += termbits.h 53generic-y += termbits.h
54generic-y += termios.h 54generic-y += termios.h
55generic-y += topology.h 55generic-y += topology.h
56generic-y += trace_clock.h
56generic-y += types.h 57generic-y += types.h
57generic-y += ucontext.h 58generic-y += ucontext.h
58generic-y += unaligned.h 59generic-y += unaligned.h
diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
index d18a3be89b3..00cf5e286fc 100644
--- a/arch/unicore32/include/uapi/asm/unistd.h
+++ b/arch/unicore32/include/uapi/asm/unistd.h
@@ -13,3 +13,4 @@
13/* Use the standard ABI for syscalls. */ 13/* Use the standard ABI for syscalls. */
14#include <asm-generic/unistd.h> 14#include <asm-generic/unistd.h>
15#define __ARCH_WANT_SYS_EXECVE 15#define __ARCH_WANT_SYS_EXECVE
16#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/unicore32/kernel/entry.S b/arch/unicore32/kernel/entry.S
index 7049350c790..581630d9144 100644
--- a/arch/unicore32/kernel/entry.S
+++ b/arch/unicore32/kernel/entry.S
@@ -668,12 +668,6 @@ __cr_alignment:
668#endif 668#endif
669 .ltorg 669 .ltorg
670 670
671ENTRY(sys_clone)
672 add ip, sp, #S_OFF
673 stw ip, [sp+], #4
674 b __sys_clone
675ENDPROC(sys_clone)
676
677ENTRY(sys_rt_sigreturn) 671ENTRY(sys_rt_sigreturn)
678 add r0, sp, #S_OFF 672 add r0, sp, #S_OFF
679 mov why, #0 @ prevent syscall restart handling 673 mov why, #0 @ prevent syscall restart handling
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index b0056f68d32..7c4359240b8 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -250,9 +250,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
250 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n", 250 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n",
251 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis"); 251 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis");
252} 252}
253#ifdef CONFIG_HOTPLUG
254EXPORT_SYMBOL(pcibios_fixup_bus); 253EXPORT_SYMBOL(pcibios_fixup_bus);
255#endif
256 254
257static int __init pci_common_init(void) 255static int __init pci_common_init(void)
258{ 256{
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index a8fe265ce2c..62bad9fed03 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -262,26 +262,27 @@ asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread");
262 262
263int 263int
264copy_thread(unsigned long clone_flags, unsigned long stack_start, 264copy_thread(unsigned long clone_flags, unsigned long stack_start,
265 unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) 265 unsigned long stk_sz, struct task_struct *p)
266{ 266{
267 struct thread_info *thread = task_thread_info(p); 267 struct thread_info *thread = task_thread_info(p);
268 struct pt_regs *childregs = task_pt_regs(p); 268 struct pt_regs *childregs = task_pt_regs(p);
269 269
270 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save)); 270 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
271 thread->cpu_context.sp = (unsigned long)childregs; 271 thread->cpu_context.sp = (unsigned long)childregs;
272 if (unlikely(!regs)) { 272 if (unlikely(p->flags & PF_KTHREAD)) {
273 thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread; 273 thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread;
274 thread->cpu_context.r4 = stack_start; 274 thread->cpu_context.r4 = stack_start;
275 thread->cpu_context.r5 = stk_sz; 275 thread->cpu_context.r5 = stk_sz;
276 memset(childregs, 0, sizeof(struct pt_regs)); 276 memset(childregs, 0, sizeof(struct pt_regs));
277 } else { 277 } else {
278 thread->cpu_context.pc = (unsigned long)ret_from_fork; 278 thread->cpu_context.pc = (unsigned long)ret_from_fork;
279 *childregs = *regs; 279 *childregs = *current_pt_regs();
280 childregs->UCreg_00 = 0; 280 childregs->UCreg_00 = 0;
281 childregs->UCreg_sp = stack_start; 281 if (stack_start)
282 childregs->UCreg_sp = stack_start;
282 283
283 if (clone_flags & CLONE_SETTLS) 284 if (clone_flags & CLONE_SETTLS)
284 childregs->UCreg_16 = regs->UCreg_03; 285 childregs->UCreg_16 = childregs->UCreg_03;
285 } 286 }
286 return 0; 287 return 0;
287} 288}
diff --git a/arch/unicore32/kernel/sys.c b/arch/unicore32/kernel/sys.c
index 9680134b31f..cfe79c9529b 100644
--- a/arch/unicore32/kernel/sys.c
+++ b/arch/unicore32/kernel/sys.c
@@ -28,20 +28,6 @@
28#include <asm/syscalls.h> 28#include <asm/syscalls.h>
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30 30
31/* Clone a task - this clones the calling program thread.
32 * This is called indirectly via a small wrapper
33 */
34asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
35 void __user *parent_tid, void __user *child_tid,
36 struct pt_regs *regs)
37{
38 if (!newsp)
39 newsp = regs->UCreg_sp;
40
41 return do_fork(clone_flags, newsp, regs, 0,
42 parent_tid, child_tid);
43}
44
45/* Note: used by the compat code even in 64-bit Linux. */ 31/* Note: used by the compat code even in 64-bit Linux. */
46SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, 32SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
47 unsigned long, prot, unsigned long, flags, 33 unsigned long, prot, unsigned long, flags,
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 46c3bff3ced..65a872bf72f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -69,8 +69,8 @@ config X86
69 select HAVE_PERF_USER_STACK_DUMP 69 select HAVE_PERF_USER_STACK_DUMP
70 select HAVE_DEBUG_KMEMLEAK 70 select HAVE_DEBUG_KMEMLEAK
71 select ANON_INODES 71 select ANON_INODES
72 select HAVE_ALIGNED_STRUCT_PAGE if SLUB && !M386 72 select HAVE_ALIGNED_STRUCT_PAGE if SLUB
73 select HAVE_CMPXCHG_LOCAL if !M386 73 select HAVE_CMPXCHG_LOCAL
74 select HAVE_CMPXCHG_DOUBLE 74 select HAVE_CMPXCHG_DOUBLE
75 select HAVE_ARCH_KMEMCHECK 75 select HAVE_ARCH_KMEMCHECK
76 select HAVE_USER_RETURN_NOTIFIER 76 select HAVE_USER_RETURN_NOTIFIER
@@ -106,12 +106,13 @@ config X86
106 select KTIME_SCALAR if X86_32 106 select KTIME_SCALAR if X86_32
107 select GENERIC_STRNCPY_FROM_USER 107 select GENERIC_STRNCPY_FROM_USER
108 select GENERIC_STRNLEN_USER 108 select GENERIC_STRNLEN_USER
109 select HAVE_RCU_USER_QS if X86_64 109 select HAVE_CONTEXT_TRACKING if X86_64
110 select HAVE_IRQ_TIME_ACCOUNTING 110 select HAVE_IRQ_TIME_ACCOUNTING
111 select GENERIC_KERNEL_THREAD 111 select GENERIC_KERNEL_THREAD
112 select GENERIC_KERNEL_EXECVE 112 select GENERIC_KERNEL_EXECVE
113 select MODULES_USE_ELF_REL if X86_32 113 select MODULES_USE_ELF_REL if X86_32
114 select MODULES_USE_ELF_RELA if X86_64 114 select MODULES_USE_ELF_RELA if X86_64
115 select CLONE_BACKWARDS if X86_32
115 116
116config INSTRUCTION_DECODER 117config INSTRUCTION_DECODER
117 def_bool y 118 def_bool y
@@ -171,13 +172,8 @@ config ARCH_MAY_HAVE_PC_FDC
171 def_bool y 172 def_bool y
172 depends on ISA_DMA_API 173 depends on ISA_DMA_API
173 174
174config RWSEM_GENERIC_SPINLOCK
175 def_bool y
176 depends on !X86_XADD
177
178config RWSEM_XCHGADD_ALGORITHM 175config RWSEM_XCHGADD_ALGORITHM
179 def_bool y 176 def_bool y
180 depends on X86_XADD
181 177
182config GENERIC_CALIBRATE_DELAY 178config GENERIC_CALIBRATE_DELAY
183 def_bool y 179 def_bool y
@@ -310,7 +306,7 @@ config X86_X2APIC
310 If you don't know what to do here, say N. 306 If you don't know what to do here, say N.
311 307
312config X86_MPPARSE 308config X86_MPPARSE
313 bool "Enable MPS table" if ACPI 309 bool "Enable MPS table" if ACPI || SFI
314 default y 310 default y
315 depends on X86_LOCAL_APIC 311 depends on X86_LOCAL_APIC
316 ---help--- 312 ---help---
@@ -374,6 +370,7 @@ config X86_NUMACHIP
374 depends on NUMA 370 depends on NUMA
375 depends on SMP 371 depends on SMP
376 depends on X86_X2APIC 372 depends on X86_X2APIC
373 depends on PCI_MMCONFIG
377 ---help--- 374 ---help---
378 Adds support for Numascale NumaChip large-SMP systems. Needed to 375 Adds support for Numascale NumaChip large-SMP systems. Needed to
379 enable more than ~168 cores. 376 enable more than ~168 cores.
@@ -1100,7 +1097,7 @@ config HIGHMEM4G
1100 1097
1101config HIGHMEM64G 1098config HIGHMEM64G
1102 bool "64GB" 1099 bool "64GB"
1103 depends on !M386 && !M486 1100 depends on !M486
1104 select X86_PAE 1101 select X86_PAE
1105 ---help--- 1102 ---help---
1106 Select this if you have a 32-bit processor and more than 4 1103 Select this if you have a 32-bit processor and more than 4
@@ -1698,6 +1695,50 @@ config HOTPLUG_CPU
1698 automatically on SMP systems. ) 1695 automatically on SMP systems. )
1699 Say N if you want to disable CPU hotplug. 1696 Say N if you want to disable CPU hotplug.
1700 1697
1698config BOOTPARAM_HOTPLUG_CPU0
1699 bool "Set default setting of cpu0_hotpluggable"
1700 default n
1701 depends on HOTPLUG_CPU && EXPERIMENTAL
1702 ---help---
1703 Set whether default state of cpu0_hotpluggable is on or off.
1704
1705 Say Y here to enable CPU0 hotplug by default. If this switch
1706 is turned on, there is no need to give cpu0_hotplug kernel
1707 parameter and the CPU0 hotplug feature is enabled by default.
1708
1709 Please note: there are two known CPU0 dependencies if you want
1710 to enable the CPU0 hotplug feature either by this switch or by
1711 cpu0_hotplug kernel parameter.
1712
1713 First, resume from hibernate or suspend always starts from CPU0.
1714 So hibernate and suspend are prevented if CPU0 is offline.
1715
1716 Second dependency is PIC interrupts always go to CPU0. CPU0 can not
1717 offline if any interrupt can not migrate out of CPU0. There may
1718 be other CPU0 dependencies.
1719
1720 Please make sure the dependencies are under your control before
1721 you enable this feature.
1722
1723 Say N if you don't want to enable CPU0 hotplug feature by default.
1724 You still can enable the CPU0 hotplug feature at boot by kernel
1725 parameter cpu0_hotplug.
1726
1727config DEBUG_HOTPLUG_CPU0
1728 def_bool n
1729 prompt "Debug CPU0 hotplug"
1730 depends on HOTPLUG_CPU && EXPERIMENTAL
1731 ---help---
1732 Enabling this option offlines CPU0 (if CPU0 can be offlined) as
1733 soon as possible and boots up userspace with CPU0 offlined. User
1734 can online CPU0 back after boot time.
1735
1736 To debug CPU0 hotplug, you need to enable CPU0 offline/online
1737 feature by either turning on CONFIG_BOOTPARAM_HOTPLUG_CPU0 during
1738 compilation or giving cpu0_hotplug kernel parameter at boot.
1739
1740 If unsure, say N.
1741
1701config COMPAT_VDSO 1742config COMPAT_VDSO
1702 def_bool y 1743 def_bool y
1703 prompt "Compat VDSO support" 1744 prompt "Compat VDSO support"
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index f3b86d0df44..c026cca5602 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -4,23 +4,24 @@ choice
4 default M686 if X86_32 4 default M686 if X86_32
5 default GENERIC_CPU if X86_64 5 default GENERIC_CPU if X86_64
6 6
7config M386 7config M486
8 bool "386" 8 bool "486"
9 depends on X86_32 && !UML 9 depends on X86_32
10 ---help--- 10 ---help---
11 This is the processor type of your CPU. This information is used for 11 This is the processor type of your CPU. This information is
12 optimizing purposes. In order to compile a kernel that can run on 12 used for optimizing purposes. In order to compile a kernel
13 all x86 CPU types (albeit not optimally fast), you can specify 13 that can run on all supported x86 CPU types (albeit not
14 "386" here. 14 optimally fast), you can specify "486" here.
15
16 Note that the 386 is no longer supported, this includes
17 AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI 486DLC/DLC2,
18 UMC 486SX-S and the NexGen Nx586.
15 19
16 The kernel will not necessarily run on earlier architectures than 20 The kernel will not necessarily run on earlier architectures than
17 the one you have chosen, e.g. a Pentium optimized kernel will run on 21 the one you have chosen, e.g. a Pentium optimized kernel will run on
18 a PPro, but not necessarily on a i486. 22 a PPro, but not necessarily on a i486.
19 23
20 Here are the settings recommended for greatest speed: 24 Here are the settings recommended for greatest speed:
21 - "386" for the AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI
22 486DLC/DLC2, and UMC 486SX-S. Only "386" kernels will run on a 386
23 class machine.
24 - "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or 25 - "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or
25 SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S. 26 SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
26 - "586" for generic Pentium CPUs lacking the TSC 27 - "586" for generic Pentium CPUs lacking the TSC
@@ -43,16 +44,7 @@ config M386
43 - "VIA C3-2" for VIA C3-2 "Nehemiah" (model 9 and above). 44 - "VIA C3-2" for VIA C3-2 "Nehemiah" (model 9 and above).
44 - "VIA C7" for VIA C7. 45 - "VIA C7" for VIA C7.
45 46
46 If you don't know what to do, choose "386". 47 If you don't know what to do, choose "486".
47
48config M486
49 bool "486"
50 depends on X86_32
51 ---help---
52 Select this for a 486 series processor, either Intel or one of the
53 compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX,
54 DX2, and DX4 variants; also SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or
55 U5S.
56 48
57config M586 49config M586
58 bool "586/K5/5x86/6x86/6x86MX" 50 bool "586/K5/5x86/6x86/6x86MX"
@@ -305,24 +297,16 @@ config X86_INTERNODE_CACHE_SHIFT
305 default "12" if X86_VSMP 297 default "12" if X86_VSMP
306 default X86_L1_CACHE_SHIFT 298 default X86_L1_CACHE_SHIFT
307 299
308config X86_CMPXCHG
309 def_bool y
310 depends on X86_64 || (X86_32 && !M386)
311
312config X86_L1_CACHE_SHIFT 300config X86_L1_CACHE_SHIFT
313 int 301 int
314 default "7" if MPENTIUM4 || MPSC 302 default "7" if MPENTIUM4 || MPSC
315 default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU 303 default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
316 default "4" if MELAN || M486 || M386 || MGEODEGX1 304 default "4" if MELAN || M486 || MGEODEGX1
317 default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX 305 default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
318 306
319config X86_XADD
320 def_bool y
321 depends on !M386
322
323config X86_PPRO_FENCE 307config X86_PPRO_FENCE
324 bool "PentiumPro memory ordering errata workaround" 308 bool "PentiumPro memory ordering errata workaround"
325 depends on M686 || M586MMX || M586TSC || M586 || M486 || M386 || MGEODEGX1 309 depends on M686 || M586MMX || M586TSC || M586 || M486 || MGEODEGX1
326 ---help--- 310 ---help---
327 Old PentiumPro multiprocessor systems had errata that could cause 311 Old PentiumPro multiprocessor systems had errata that could cause
328 memory operations to violate the x86 ordering standard in rare cases. 312 memory operations to violate the x86 ordering standard in rare cases.
@@ -335,27 +319,11 @@ config X86_PPRO_FENCE
335 319
336config X86_F00F_BUG 320config X86_F00F_BUG
337 def_bool y 321 def_bool y
338 depends on M586MMX || M586TSC || M586 || M486 || M386 322 depends on M586MMX || M586TSC || M586 || M486
339 323
340config X86_INVD_BUG 324config X86_INVD_BUG
341 def_bool y 325 def_bool y
342 depends on M486 || M386 326 depends on M486
343
344config X86_WP_WORKS_OK
345 def_bool y
346 depends on !M386
347
348config X86_INVLPG
349 def_bool y
350 depends on X86_32 && !M386
351
352config X86_BSWAP
353 def_bool y
354 depends on X86_32 && !M386
355
356config X86_POPAD_OK
357 def_bool y
358 depends on X86_32 && !M386
359 327
360config X86_ALIGNMENT_16 328config X86_ALIGNMENT_16
361 def_bool y 329 def_bool y
@@ -412,12 +380,11 @@ config X86_MINIMUM_CPU_FAMILY
412 default "64" if X86_64 380 default "64" if X86_64
413 default "6" if X86_32 && X86_P6_NOP 381 default "6" if X86_32 && X86_P6_NOP
414 default "5" if X86_32 && X86_CMPXCHG64 382 default "5" if X86_32 && X86_CMPXCHG64
415 default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK) 383 default "4"
416 default "3"
417 384
418config X86_DEBUGCTLMSR 385config X86_DEBUGCTLMSR
419 def_bool y 386 def_bool y
420 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) && !UML 387 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486) && !UML
421 388
422menuconfig PROCESSOR_SELECT 389menuconfig PROCESSOR_SELECT
423 bool "Supported processor vendors" if EXPERT 390 bool "Supported processor vendors" if EXPERT
@@ -441,7 +408,7 @@ config CPU_SUP_INTEL
441config CPU_SUP_CYRIX_32 408config CPU_SUP_CYRIX_32
442 default y 409 default y
443 bool "Support Cyrix processors" if PROCESSOR_SELECT 410 bool "Support Cyrix processors" if PROCESSOR_SELECT
444 depends on M386 || M486 || M586 || M586TSC || M586MMX || (EXPERT && !64BIT) 411 depends on M486 || M586 || M586TSC || M586MMX || (EXPERT && !64BIT)
445 ---help--- 412 ---help---
446 This enables detection, tunings and quirks for Cyrix processors 413 This enables detection, tunings and quirks for Cyrix processors
447 414
@@ -495,7 +462,7 @@ config CPU_SUP_TRANSMETA_32
495config CPU_SUP_UMC_32 462config CPU_SUP_UMC_32
496 default y 463 default y
497 bool "Support UMC processors" if PROCESSOR_SELECT 464 bool "Support UMC processors" if PROCESSOR_SELECT
498 depends on M386 || M486 || (EXPERT && !64BIT) 465 depends on M486 || (EXPERT && !64BIT)
499 ---help--- 466 ---help---
500 This enables detection, tunings and quirks for UMC processors 467 This enables detection, tunings and quirks for UMC processors
501 468
diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu
index 86cee7b749e..6647ed49c66 100644
--- a/arch/x86/Makefile_32.cpu
+++ b/arch/x86/Makefile_32.cpu
@@ -10,7 +10,6 @@ tune = $(call cc-option,-mcpu=$(1),$(2))
10endif 10endif
11 11
12align := $(cc-option-align) 12align := $(cc-option-align)
13cflags-$(CONFIG_M386) += -march=i386
14cflags-$(CONFIG_M486) += -march=i486 13cflags-$(CONFIG_M486) += -march=i486
15cflags-$(CONFIG_M586) += -march=i586 14cflags-$(CONFIG_M586) += -march=i586
16cflags-$(CONFIG_M586TSC) += -march=i586 15cflags-$(CONFIG_M586TSC) += -march=i586
diff --git a/arch/x86/boot/.gitignore b/arch/x86/boot/.gitignore
index 851fe936d24..e3cf9f682be 100644
--- a/arch/x86/boot/.gitignore
+++ b/arch/x86/boot/.gitignore
@@ -2,7 +2,6 @@ bootsect
2bzImage 2bzImage
3cpustr.h 3cpustr.h
4mkcpustr 4mkcpustr
5offsets.h
6voffset.h 5voffset.h
7zoffset.h 6zoffset.h
8setup 7setup
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index e87b0cac14b..b1942e22276 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -8,6 +8,7 @@
8 * ----------------------------------------------------------------------- */ 8 * ----------------------------------------------------------------------- */
9 9
10#include <linux/efi.h> 10#include <linux/efi.h>
11#include <linux/pci.h>
11#include <asm/efi.h> 12#include <asm/efi.h>
12#include <asm/setup.h> 13#include <asm/setup.h>
13#include <asm/desc.h> 14#include <asm/desc.h>
@@ -245,6 +246,121 @@ static void find_bits(unsigned long mask, u8 *pos, u8 *size)
245 *size = len; 246 *size = len;
246} 247}
247 248
249static efi_status_t setup_efi_pci(struct boot_params *params)
250{
251 efi_pci_io_protocol *pci;
252 efi_status_t status;
253 void **pci_handle;
254 efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID;
255 unsigned long nr_pci, size = 0;
256 int i;
257 struct setup_data *data;
258
259 data = (struct setup_data *)params->hdr.setup_data;
260
261 while (data && data->next)
262 data = (struct setup_data *)data->next;
263
264 status = efi_call_phys5(sys_table->boottime->locate_handle,
265 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
266 NULL, &size, pci_handle);
267
268 if (status == EFI_BUFFER_TOO_SMALL) {
269 status = efi_call_phys3(sys_table->boottime->allocate_pool,
270 EFI_LOADER_DATA, size, &pci_handle);
271
272 if (status != EFI_SUCCESS)
273 return status;
274
275 status = efi_call_phys5(sys_table->boottime->locate_handle,
276 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
277 NULL, &size, pci_handle);
278 }
279
280 if (status != EFI_SUCCESS)
281 goto free_handle;
282
283 nr_pci = size / sizeof(void *);
284 for (i = 0; i < nr_pci; i++) {
285 void *h = pci_handle[i];
286 uint64_t attributes;
287 struct pci_setup_rom *rom;
288
289 status = efi_call_phys3(sys_table->boottime->handle_protocol,
290 h, &pci_proto, &pci);
291
292 if (status != EFI_SUCCESS)
293 continue;
294
295 if (!pci)
296 continue;
297
298 status = efi_call_phys4(pci->attributes, pci,
299 EfiPciIoAttributeOperationGet, 0,
300 &attributes);
301
302 if (status != EFI_SUCCESS)
303 continue;
304
305 if (!attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)
306 continue;
307
308 if (!pci->romimage || !pci->romsize)
309 continue;
310
311 size = pci->romsize + sizeof(*rom);
312
313 status = efi_call_phys3(sys_table->boottime->allocate_pool,
314 EFI_LOADER_DATA, size, &rom);
315
316 if (status != EFI_SUCCESS)
317 continue;
318
319 rom->data.type = SETUP_PCI;
320 rom->data.len = size - sizeof(struct setup_data);
321 rom->data.next = 0;
322 rom->pcilen = pci->romsize;
323
324 status = efi_call_phys5(pci->pci.read, pci,
325 EfiPciIoWidthUint16, PCI_VENDOR_ID,
326 1, &(rom->vendor));
327
328 if (status != EFI_SUCCESS)
329 goto free_struct;
330
331 status = efi_call_phys5(pci->pci.read, pci,
332 EfiPciIoWidthUint16, PCI_DEVICE_ID,
333 1, &(rom->devid));
334
335 if (status != EFI_SUCCESS)
336 goto free_struct;
337
338 status = efi_call_phys5(pci->get_location, pci,
339 &(rom->segment), &(rom->bus),
340 &(rom->device), &(rom->function));
341
342 if (status != EFI_SUCCESS)
343 goto free_struct;
344
345 memcpy(rom->romdata, pci->romimage, pci->romsize);
346
347 if (data)
348 data->next = (uint64_t)rom;
349 else
350 params->hdr.setup_data = (uint64_t)rom;
351
352 data = (struct setup_data *)rom;
353
354 continue;
355 free_struct:
356 efi_call_phys1(sys_table->boottime->free_pool, rom);
357 }
358
359free_handle:
360 efi_call_phys1(sys_table->boottime->free_pool, pci_handle);
361 return status;
362}
363
248/* 364/*
249 * See if we have Graphics Output Protocol 365 * See if we have Graphics Output Protocol
250 */ 366 */
@@ -1028,6 +1144,8 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
1028 1144
1029 setup_graphics(boot_params); 1145 setup_graphics(boot_params);
1030 1146
1147 setup_efi_pci(boot_params);
1148
1031 status = efi_call_phys3(sys_table->boottime->allocate_pool, 1149 status = efi_call_phys3(sys_table->boottime->allocate_pool,
1032 EFI_LOADER_DATA, sizeof(*gdt), 1150 EFI_LOADER_DATA, sizeof(*gdt),
1033 (void **)&gdt); 1151 (void **)&gdt);
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 07b3a68d2d2..a703af19c28 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -35,7 +35,7 @@
35#undef WARN_OLD 35#undef WARN_OLD
36#undef CORE_DUMP /* definitely broken */ 36#undef CORE_DUMP /* definitely broken */
37 37
38static int load_aout_binary(struct linux_binprm *, struct pt_regs *regs); 38static int load_aout_binary(struct linux_binprm *);
39static int load_aout_library(struct file *); 39static int load_aout_library(struct file *);
40 40
41#ifdef CORE_DUMP 41#ifdef CORE_DUMP
@@ -260,9 +260,10 @@ static u32 __user *create_aout_tables(char __user *p, struct linux_binprm *bprm)
260 * These are the functions used to load a.out style executables and shared 260 * These are the functions used to load a.out style executables and shared
261 * libraries. There is no binary dependent code anywhere else. 261 * libraries. There is no binary dependent code anywhere else.
262 */ 262 */
263static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) 263static int load_aout_binary(struct linux_binprm *bprm)
264{ 264{
265 unsigned long error, fd_offset, rlim; 265 unsigned long error, fd_offset, rlim;
266 struct pt_regs *regs = current_pt_regs();
266 struct exec ex; 267 struct exec ex;
267 int retval; 268 int retval;
268 269
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 076745fc804..32e6f05ddaa 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -467,11 +467,16 @@ GLOBAL(\label)
467 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx 467 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx
468 PTREGSCALL stub32_execve, compat_sys_execve, %rcx 468 PTREGSCALL stub32_execve, compat_sys_execve, %rcx
469 PTREGSCALL stub32_fork, sys_fork, %rdi 469 PTREGSCALL stub32_fork, sys_fork, %rdi
470 PTREGSCALL stub32_clone, sys32_clone, %rdx
471 PTREGSCALL stub32_vfork, sys_vfork, %rdi 470 PTREGSCALL stub32_vfork, sys_vfork, %rdi
472 PTREGSCALL stub32_iopl, sys_iopl, %rsi 471 PTREGSCALL stub32_iopl, sys_iopl, %rsi
473 472
474 ALIGN 473 ALIGN
474GLOBAL(stub32_clone)
475 leaq sys_clone(%rip),%rax
476 mov %r8, %rcx
477 jmp ia32_ptregs_common
478
479 ALIGN
475ia32_ptregs_common: 480ia32_ptregs_common:
476 popq %r11 481 popq %r11
477 CFI_ENDPROC 482 CFI_ENDPROC
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 86d68d1c880..d0b689ba7be 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -385,17 +385,6 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd,
385 return ret; 385 return ret;
386} 386}
387 387
388asmlinkage long sys32_clone(unsigned int clone_flags, unsigned int newsp,
389 struct pt_regs *regs)
390{
391 void __user *parent_tid = (void __user *)regs->dx;
392 void __user *child_tid = (void __user *)regs->di;
393
394 if (!newsp)
395 newsp = regs->sp;
396 return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
397}
398
399/* 388/*
400 * Some system calls that need sign extended arguments. This could be 389 * Some system calls that need sign extended arguments. This could be
401 * done by a generic wrapper. 390 * done by a generic wrapper.
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 66e5f0ef052..79fd8a3418f 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -12,6 +12,7 @@ header-y += mce.h
12header-y += msr-index.h 12header-y += msr-index.h
13header-y += msr.h 13header-y += msr.h
14header-y += mtrr.h 14header-y += mtrr.h
15header-y += perf_regs.h
15header-y += posix_types_32.h 16header-y += posix_types_32.h
16header-y += posix_types_64.h 17header-y += posix_types_64.h
17header-y += posix_types_x32.h 18header-y += posix_types_x32.h
@@ -19,8 +20,10 @@ header-y += prctl.h
19header-y += processor-flags.h 20header-y += processor-flags.h
20header-y += ptrace-abi.h 21header-y += ptrace-abi.h
21header-y += sigcontext32.h 22header-y += sigcontext32.h
23header-y += svm.h
22header-y += ucontext.h 24header-y += ucontext.h
23header-y += vm86.h 25header-y += vm86.h
26header-y += vmx.h
24header-y += vsyscall.h 27header-y += vsyscall.h
25 28
26genhdr-y += unistd_32.h 29genhdr-y += unistd_32.h
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index b6c3b821acf..722aa3b0462 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -172,23 +172,7 @@ static inline int atomic_add_negative(int i, atomic_t *v)
172 */ 172 */
173static inline int atomic_add_return(int i, atomic_t *v) 173static inline int atomic_add_return(int i, atomic_t *v)
174{ 174{
175#ifdef CONFIG_M386
176 int __i;
177 unsigned long flags;
178 if (unlikely(boot_cpu_data.x86 <= 3))
179 goto no_xadd;
180#endif
181 /* Modern 486+ processor */
182 return i + xadd(&v->counter, i); 175 return i + xadd(&v->counter, i);
183
184#ifdef CONFIG_M386
185no_xadd: /* Legacy 386 processor */
186 raw_local_irq_save(flags);
187 __i = atomic_read(v);
188 atomic_set(v, i + __i);
189 raw_local_irq_restore(flags);
190 return i + __i;
191#endif
192} 176}
193 177
194/** 178/**
diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
index 2ad874cb661..92862cd9020 100644
--- a/arch/x86/include/asm/bootparam.h
+++ b/arch/x86/include/asm/bootparam.h
@@ -13,6 +13,7 @@
13#define SETUP_NONE 0 13#define SETUP_NONE 0
14#define SETUP_E820_EXT 1 14#define SETUP_E820_EXT 1
15#define SETUP_DTB 2 15#define SETUP_DTB 2
16#define SETUP_PCI 3
16 17
17/* extensible setup data list node */ 18/* extensible setup data list node */
18struct setup_data { 19struct setup_data {
diff --git a/arch/x86/include/asm/clocksource.h b/arch/x86/include/asm/clocksource.h
index 0bdbbb3b9ce..16a57f4ed64 100644
--- a/arch/x86/include/asm/clocksource.h
+++ b/arch/x86/include/asm/clocksource.h
@@ -8,6 +8,7 @@
8#define VCLOCK_NONE 0 /* No vDSO clock available. */ 8#define VCLOCK_NONE 0 /* No vDSO clock available. */
9#define VCLOCK_TSC 1 /* vDSO should use vread_tsc. */ 9#define VCLOCK_TSC 1 /* vDSO should use vread_tsc. */
10#define VCLOCK_HPET 2 /* vDSO should use vread_hpet. */ 10#define VCLOCK_HPET 2 /* vDSO should use vread_hpet. */
11#define VCLOCK_PVCLOCK 3 /* vDSO should use vread_pvclock. */
11 12
12struct arch_clocksource_data { 13struct arch_clocksource_data {
13 int vclock_mode; 14 int vclock_mode;
diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h
index 53f4b219336..f8bf2eecab8 100644
--- a/arch/x86/include/asm/cmpxchg_32.h
+++ b/arch/x86/include/asm/cmpxchg_32.h
@@ -34,9 +34,7 @@ static inline void set_64bit(volatile u64 *ptr, u64 value)
34 : "memory"); 34 : "memory");
35} 35}
36 36
37#ifdef CONFIG_X86_CMPXCHG
38#define __HAVE_ARCH_CMPXCHG 1 37#define __HAVE_ARCH_CMPXCHG 1
39#endif
40 38
41#ifdef CONFIG_X86_CMPXCHG64 39#ifdef CONFIG_X86_CMPXCHG64
42#define cmpxchg64(ptr, o, n) \ 40#define cmpxchg64(ptr, o, n) \
@@ -73,59 +71,6 @@ static inline u64 __cmpxchg64_local(volatile u64 *ptr, u64 old, u64 new)
73 return prev; 71 return prev;
74} 72}
75 73
76#ifndef CONFIG_X86_CMPXCHG
77/*
78 * Building a kernel capable running on 80386. It may be necessary to
79 * simulate the cmpxchg on the 80386 CPU. For that purpose we define
80 * a function for each of the sizes we support.
81 */
82
83extern unsigned long cmpxchg_386_u8(volatile void *, u8, u8);
84extern unsigned long cmpxchg_386_u16(volatile void *, u16, u16);
85extern unsigned long cmpxchg_386_u32(volatile void *, u32, u32);
86
87static inline unsigned long cmpxchg_386(volatile void *ptr, unsigned long old,
88 unsigned long new, int size)
89{
90 switch (size) {
91 case 1:
92 return cmpxchg_386_u8(ptr, old, new);
93 case 2:
94 return cmpxchg_386_u16(ptr, old, new);
95 case 4:
96 return cmpxchg_386_u32(ptr, old, new);
97 }
98 return old;
99}
100
101#define cmpxchg(ptr, o, n) \
102({ \
103 __typeof__(*(ptr)) __ret; \
104 if (likely(boot_cpu_data.x86 > 3)) \
105 __ret = (__typeof__(*(ptr)))__cmpxchg((ptr), \
106 (unsigned long)(o), (unsigned long)(n), \
107 sizeof(*(ptr))); \
108 else \
109 __ret = (__typeof__(*(ptr)))cmpxchg_386((ptr), \
110 (unsigned long)(o), (unsigned long)(n), \
111 sizeof(*(ptr))); \
112 __ret; \
113})
114#define cmpxchg_local(ptr, o, n) \
115({ \
116 __typeof__(*(ptr)) __ret; \
117 if (likely(boot_cpu_data.x86 > 3)) \
118 __ret = (__typeof__(*(ptr)))__cmpxchg_local((ptr), \
119 (unsigned long)(o), (unsigned long)(n), \
120 sizeof(*(ptr))); \
121 else \
122 __ret = (__typeof__(*(ptr)))cmpxchg_386((ptr), \
123 (unsigned long)(o), (unsigned long)(n), \
124 sizeof(*(ptr))); \
125 __ret; \
126})
127#endif
128
129#ifndef CONFIG_X86_CMPXCHG64 74#ifndef CONFIG_X86_CMPXCHG64
130/* 75/*
131 * Building a kernel capable running on 80386 and 80486. It may be necessary 76 * Building a kernel capable running on 80386 and 80486. It may be necessary
diff --git a/arch/x86/include/asm/rcu.h b/arch/x86/include/asm/context_tracking.h
index d1ac07a2397..1616562683e 100644
--- a/arch/x86/include/asm/rcu.h
+++ b/arch/x86/include/asm/context_tracking.h
@@ -1,27 +1,26 @@
1#ifndef _ASM_X86_RCU_H 1#ifndef _ASM_X86_CONTEXT_TRACKING_H
2#define _ASM_X86_RCU_H 2#define _ASM_X86_CONTEXT_TRACKING_H
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5#include <linux/context_tracking.h>
6#include <linux/rcupdate.h>
7#include <asm/ptrace.h> 6#include <asm/ptrace.h>
8 7
9static inline void exception_enter(struct pt_regs *regs) 8static inline void exception_enter(struct pt_regs *regs)
10{ 9{
11 rcu_user_exit(); 10 user_exit();
12} 11}
13 12
14static inline void exception_exit(struct pt_regs *regs) 13static inline void exception_exit(struct pt_regs *regs)
15{ 14{
16#ifdef CONFIG_RCU_USER_QS 15#ifdef CONFIG_CONTEXT_TRACKING
17 if (user_mode(regs)) 16 if (user_mode(regs))
18 rcu_user_enter(); 17 user_enter();
19#endif 18#endif
20} 19}
21 20
22#else /* __ASSEMBLY__ */ 21#else /* __ASSEMBLY__ */
23 22
24#ifdef CONFIG_RCU_USER_QS 23#ifdef CONFIG_CONTEXT_TRACKING
25# define SCHEDULE_USER call schedule_user 24# define SCHEDULE_USER call schedule_user
26#else 25#else
27# define SCHEDULE_USER call schedule 26# define SCHEDULE_USER call schedule
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index 4564c8e28a3..5f9a1243190 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -28,6 +28,10 @@ struct x86_cpu {
28#ifdef CONFIG_HOTPLUG_CPU 28#ifdef CONFIG_HOTPLUG_CPU
29extern int arch_register_cpu(int num); 29extern int arch_register_cpu(int num);
30extern void arch_unregister_cpu(int); 30extern void arch_unregister_cpu(int);
31extern void __cpuinit start_cpu0(void);
32#ifdef CONFIG_DEBUG_HOTPLUG_CPU0
33extern int _debug_hotplug_cpu(int cpu, int action);
34#endif
31#endif 35#endif
32 36
33DECLARE_PER_CPU(int, cpu_state); 37DECLARE_PER_CPU(int, cpu_state);
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 8c297aa53ee..2d9075e863a 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -202,6 +202,7 @@
202 202
203/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ 203/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */
204#define X86_FEATURE_FSGSBASE (9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/ 204#define X86_FEATURE_FSGSBASE (9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/
205#define X86_FEATURE_TSC_ADJUST (9*32+ 1) /* TSC adjustment MSR 0x3b */
205#define X86_FEATURE_BMI1 (9*32+ 3) /* 1st group bit manipulation extensions */ 206#define X86_FEATURE_BMI1 (9*32+ 3) /* 1st group bit manipulation extensions */
206#define X86_FEATURE_HLE (9*32+ 4) /* Hardware Lock Elision */ 207#define X86_FEATURE_HLE (9*32+ 4) /* Hardware Lock Elision */
207#define X86_FEATURE_AVX2 (9*32+ 5) /* AVX2 instructions */ 208#define X86_FEATURE_AVX2 (9*32+ 5) /* AVX2 instructions */
@@ -311,12 +312,7 @@ extern const char * const x86_power_flags[32];
311#define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8) 312#define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8)
312#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16) 313#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16)
313#define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU) 314#define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU)
314 315#define cpu_has_topoext boot_cpu_has(X86_FEATURE_TOPOEXT)
315#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
316# define cpu_has_invlpg 1
317#else
318# define cpu_has_invlpg (boot_cpu_data.x86 > 3)
319#endif
320 316
321#ifdef CONFIG_X86_64 317#ifdef CONFIG_X86_64
322 318
diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h
index 93e1c55f14a..03dd72957d2 100644
--- a/arch/x86/include/asm/device.h
+++ b/arch/x86/include/asm/device.h
@@ -2,9 +2,6 @@
2#define _ASM_X86_DEVICE_H 2#define _ASM_X86_DEVICE_H
3 3
4struct dev_archdata { 4struct dev_archdata {
5#ifdef CONFIG_ACPI
6 void *acpi_handle;
7#endif
8#ifdef CONFIG_X86_DEV_DMA_OPS 5#ifdef CONFIG_X86_DEV_DMA_OPS
9 struct dma_map_ops *dma_ops; 6 struct dma_map_ops *dma_ops;
10#endif 7#endif
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 6e8fdf5ad11..fd13815fe85 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -69,23 +69,37 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
69 efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ 69 efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
70 (u64)(a4), (u64)(a5), (u64)(a6)) 70 (u64)(a4), (u64)(a5), (u64)(a6))
71 71
72extern unsigned long efi_call_virt_prelog(void);
73extern void efi_call_virt_epilog(unsigned long);
74
75#define efi_callx(x, func, ...) \
76 ({ \
77 efi_status_t __status; \
78 unsigned long __pgd; \
79 \
80 __pgd = efi_call_virt_prelog(); \
81 __status = efi_call##x(func, __VA_ARGS__); \
82 efi_call_virt_epilog(__pgd); \
83 __status; \
84 })
85
72#define efi_call_virt0(f) \ 86#define efi_call_virt0(f) \
73 efi_call0((void *)(efi.systab->runtime->f)) 87 efi_callx(0, (void *)(efi.systab->runtime->f))
74#define efi_call_virt1(f, a1) \ 88#define efi_call_virt1(f, a1) \
75 efi_call1((void *)(efi.systab->runtime->f), (u64)(a1)) 89 efi_callx(1, (void *)(efi.systab->runtime->f), (u64)(a1))
76#define efi_call_virt2(f, a1, a2) \ 90#define efi_call_virt2(f, a1, a2) \
77 efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2)) 91 efi_callx(2, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2))
78#define efi_call_virt3(f, a1, a2, a3) \ 92#define efi_call_virt3(f, a1, a2, a3) \
79 efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 93 efi_callx(3, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
80 (u64)(a3)) 94 (u64)(a3))
81#define efi_call_virt4(f, a1, a2, a3, a4) \ 95#define efi_call_virt4(f, a1, a2, a3, a4) \
82 efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 96 efi_callx(4, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
83 (u64)(a3), (u64)(a4)) 97 (u64)(a3), (u64)(a4))
84#define efi_call_virt5(f, a1, a2, a3, a4, a5) \ 98#define efi_call_virt5(f, a1, a2, a3, a4, a5) \
85 efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 99 efi_callx(5, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
86 (u64)(a3), (u64)(a4), (u64)(a5)) 100 (u64)(a3), (u64)(a4), (u64)(a5))
87#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ 101#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
88 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 102 efi_callx(6, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
89 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) 103 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
90 104
91extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, 105extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 5939f44fe0c..9c999c1674f 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -354,12 +354,10 @@ static inline int mmap_is_ia32(void)
354 return 0; 354 return 0;
355} 355}
356 356
357/* The first two values are special, do not change. See align_addr() */ 357/* Do not change the values. See get_align_mask() */
358enum align_flags { 358enum align_flags {
359 ALIGN_VA_32 = BIT(0), 359 ALIGN_VA_32 = BIT(0),
360 ALIGN_VA_64 = BIT(1), 360 ALIGN_VA_64 = BIT(1),
361 ALIGN_VDSO = BIT(2),
362 ALIGN_TOPDOWN = BIT(3),
363}; 361};
364 362
365struct va_alignment { 363struct va_alignment {
@@ -368,5 +366,5 @@ struct va_alignment {
368} ____cacheline_aligned; 366} ____cacheline_aligned;
369 367
370extern struct va_alignment va_align; 368extern struct va_alignment va_align;
371extern unsigned long align_addr(unsigned long, struct file *, enum align_flags); 369extern unsigned long align_vdso_addr(unsigned long);
372#endif /* _ASM_X86_ELF_H */ 370#endif /* _ASM_X86_ELF_H */
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index 4da3c0c4c97..a09c2857106 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -19,6 +19,7 @@
19#include <asm/acpi.h> 19#include <asm/acpi.h>
20#include <asm/apicdef.h> 20#include <asm/apicdef.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/pvclock.h>
22#ifdef CONFIG_X86_32 23#ifdef CONFIG_X86_32
23#include <linux/threads.h> 24#include <linux/threads.h>
24#include <asm/kmap_types.h> 25#include <asm/kmap_types.h>
@@ -81,6 +82,10 @@ enum fixed_addresses {
81 VVAR_PAGE, 82 VVAR_PAGE,
82 VSYSCALL_HPET, 83 VSYSCALL_HPET,
83#endif 84#endif
85#ifdef CONFIG_PARAVIRT_CLOCK
86 PVCLOCK_FIXMAP_BEGIN,
87 PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1,
88#endif
84 FIX_DBGP_BASE, 89 FIX_DBGP_BASE,
85 FIX_EARLYCON_MEM_BASE, 90 FIX_EARLYCON_MEM_BASE,
86#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT 91#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 831dbb9c6c0..41ab26ea656 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -399,14 +399,17 @@ static inline void drop_init_fpu(struct task_struct *tsk)
399typedef struct { int preload; } fpu_switch_t; 399typedef struct { int preload; } fpu_switch_t;
400 400
401/* 401/*
402 * FIXME! We could do a totally lazy restore, but we need to 402 * Must be run with preemption disabled: this clears the fpu_owner_task,
403 * add a per-cpu "this was the task that last touched the FPU 403 * on this CPU.
404 * on this CPU" variable, and the task needs to have a "I last
405 * touched the FPU on this CPU" and check them.
406 * 404 *
407 * We don't do that yet, so "fpu_lazy_restore()" always returns 405 * This will disable any lazy FPU state restore of the current FPU state,
408 * false, but some day.. 406 * but if the current thread owns the FPU, it will still be saved by.
409 */ 407 */
408static inline void __cpu_disable_lazy_restore(unsigned int cpu)
409{
410 per_cpu(fpu_owner_task, cpu) = NULL;
411}
412
410static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu) 413static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
411{ 414{
412 return new == this_cpu_read_stable(fpu_owner_task) && 415 return new == this_cpu_read_stable(fpu_owner_task) &&
diff --git a/arch/x86/include/asm/futex.h b/arch/x86/include/asm/futex.h
index f373046e63e..be27ba1e947 100644
--- a/arch/x86/include/asm/futex.h
+++ b/arch/x86/include/asm/futex.h
@@ -55,12 +55,6 @@ static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
55 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) 55 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
56 return -EFAULT; 56 return -EFAULT;
57 57
58#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
59 /* Real i386 machines can only support FUTEX_OP_SET */
60 if (op != FUTEX_OP_SET && boot_cpu_data.x86 == 3)
61 return -ENOSYS;
62#endif
63
64 pagefault_disable(); 58 pagefault_disable();
65 59
66 switch (op) { 60 switch (op) {
@@ -118,12 +112,6 @@ static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
118{ 112{
119 int ret = 0; 113 int ret = 0;
120 114
121#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
122 /* Real i386 machines have no cmpxchg instruction */
123 if (boot_cpu_data.x86 == 3)
124 return -ENOSYS;
125#endif
126
127 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) 115 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
128 return -EFAULT; 116 return -EFAULT;
129 117
diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
index 317ff1703d0..6080d2694ba 100644
--- a/arch/x86/include/asm/kexec.h
+++ b/arch/x86/include/asm/kexec.h
@@ -163,6 +163,9 @@ struct kimage_arch {
163}; 163};
164#endif 164#endif
165 165
166typedef void crash_vmclear_fn(void);
167extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss;
168
166#endif /* __ASSEMBLY__ */ 169#endif /* __ASSEMBLY__ */
167 170
168#endif /* _ASM_X86_KEXEC_H */ 171#endif /* _ASM_X86_KEXEC_H */
diff --git a/arch/x86/include/asm/kvm_guest.h b/arch/x86/include/asm/kvm_guest.h
new file mode 100644
index 00000000000..a92b1763c41
--- /dev/null
+++ b/arch/x86/include/asm/kvm_guest.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_X86_KVM_GUEST_H
2#define _ASM_X86_KVM_GUEST_H
3
4int kvm_setup_vsyscall_timeinfo(void);
5
6#endif /* _ASM_X86_KVM_GUEST_H */
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index b2e11f45243..dc87b65e9c3 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -22,6 +22,8 @@
22#include <linux/kvm_para.h> 22#include <linux/kvm_para.h>
23#include <linux/kvm_types.h> 23#include <linux/kvm_types.h>
24#include <linux/perf_event.h> 24#include <linux/perf_event.h>
25#include <linux/pvclock_gtod.h>
26#include <linux/clocksource.h>
25 27
26#include <asm/pvclock-abi.h> 28#include <asm/pvclock-abi.h>
27#include <asm/desc.h> 29#include <asm/desc.h>
@@ -442,6 +444,7 @@ struct kvm_vcpu_arch {
442 s8 virtual_tsc_shift; 444 s8 virtual_tsc_shift;
443 u32 virtual_tsc_mult; 445 u32 virtual_tsc_mult;
444 u32 virtual_tsc_khz; 446 u32 virtual_tsc_khz;
447 s64 ia32_tsc_adjust_msr;
445 448
446 atomic_t nmi_queued; /* unprocessed asynchronous NMIs */ 449 atomic_t nmi_queued; /* unprocessed asynchronous NMIs */
447 unsigned nmi_pending; /* NMI queued after currently running handler */ 450 unsigned nmi_pending; /* NMI queued after currently running handler */
@@ -559,6 +562,12 @@ struct kvm_arch {
559 u64 cur_tsc_write; 562 u64 cur_tsc_write;
560 u64 cur_tsc_offset; 563 u64 cur_tsc_offset;
561 u8 cur_tsc_generation; 564 u8 cur_tsc_generation;
565 int nr_vcpus_matched_tsc;
566
567 spinlock_t pvclock_gtod_sync_lock;
568 bool use_master_clock;
569 u64 master_kernel_ns;
570 cycle_t master_cycle_now;
562 571
563 struct kvm_xen_hvm_config xen_hvm_config; 572 struct kvm_xen_hvm_config xen_hvm_config;
564 573
@@ -612,6 +621,12 @@ struct kvm_vcpu_stat {
612 621
613struct x86_instruction_info; 622struct x86_instruction_info;
614 623
624struct msr_data {
625 bool host_initiated;
626 u32 index;
627 u64 data;
628};
629
615struct kvm_x86_ops { 630struct kvm_x86_ops {
616 int (*cpu_has_kvm_support)(void); /* __init */ 631 int (*cpu_has_kvm_support)(void); /* __init */
617 int (*disabled_by_bios)(void); /* __init */ 632 int (*disabled_by_bios)(void); /* __init */
@@ -634,7 +649,7 @@ struct kvm_x86_ops {
634 649
635 void (*update_db_bp_intercept)(struct kvm_vcpu *vcpu); 650 void (*update_db_bp_intercept)(struct kvm_vcpu *vcpu);
636 int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata); 651 int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
637 int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); 652 int (*set_msr)(struct kvm_vcpu *vcpu, struct msr_data *msr);
638 u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg); 653 u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg);
639 void (*get_segment)(struct kvm_vcpu *vcpu, 654 void (*get_segment)(struct kvm_vcpu *vcpu,
640 struct kvm_segment *var, int seg); 655 struct kvm_segment *var, int seg);
@@ -697,10 +712,11 @@ struct kvm_x86_ops {
697 bool (*has_wbinvd_exit)(void); 712 bool (*has_wbinvd_exit)(void);
698 713
699 void (*set_tsc_khz)(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale); 714 void (*set_tsc_khz)(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale);
715 u64 (*read_tsc_offset)(struct kvm_vcpu *vcpu);
700 void (*write_tsc_offset)(struct kvm_vcpu *vcpu, u64 offset); 716 void (*write_tsc_offset)(struct kvm_vcpu *vcpu, u64 offset);
701 717
702 u64 (*compute_tsc_offset)(struct kvm_vcpu *vcpu, u64 target_tsc); 718 u64 (*compute_tsc_offset)(struct kvm_vcpu *vcpu, u64 target_tsc);
703 u64 (*read_l1_tsc)(struct kvm_vcpu *vcpu); 719 u64 (*read_l1_tsc)(struct kvm_vcpu *vcpu, u64 host_tsc);
704 720
705 void (*get_exit_info)(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2); 721 void (*get_exit_info)(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2);
706 722
@@ -785,7 +801,7 @@ static inline int emulate_instruction(struct kvm_vcpu *vcpu,
785 801
786void kvm_enable_efer_bits(u64); 802void kvm_enable_efer_bits(u64);
787int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data); 803int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data);
788int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); 804int kvm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr);
789 805
790struct x86_emulate_ctxt; 806struct x86_emulate_ctxt;
791 807
@@ -812,7 +828,7 @@ void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l);
812int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr); 828int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr);
813 829
814int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata); 830int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata);
815int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data); 831int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr);
816 832
817unsigned long kvm_get_rflags(struct kvm_vcpu *vcpu); 833unsigned long kvm_get_rflags(struct kvm_vcpu *vcpu);
818void kvm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags); 834void kvm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags);
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
index c8bed0da434..2d89e3980cb 100644
--- a/arch/x86/include/asm/local.h
+++ b/arch/x86/include/asm/local.h
@@ -124,27 +124,11 @@ static inline int local_add_negative(long i, local_t *l)
124 */ 124 */
125static inline long local_add_return(long i, local_t *l) 125static inline long local_add_return(long i, local_t *l)
126{ 126{
127 long __i; 127 long __i = i;
128#ifdef CONFIG_M386
129 unsigned long flags;
130 if (unlikely(boot_cpu_data.x86 <= 3))
131 goto no_xadd;
132#endif
133 /* Modern 486+ processor */
134 __i = i;
135 asm volatile(_ASM_XADD "%0, %1;" 128 asm volatile(_ASM_XADD "%0, %1;"
136 : "+r" (i), "+m" (l->a.counter) 129 : "+r" (i), "+m" (l->a.counter)
137 : : "memory"); 130 : : "memory");
138 return i + __i; 131 return i + __i;
139
140#ifdef CONFIG_M386
141no_xadd: /* Legacy 386 processor */
142 local_irq_save(flags);
143 __i = local_read(l);
144 local_set(l, i + __i);
145 local_irq_restore(flags);
146 return i + __i;
147#endif
148} 132}
149 133
150static inline long local_sub_return(long i, local_t *l) 134static inline long local_sub_return(long i, local_t *l)
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 54d73b1f00a..d90c2fccc30 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -119,6 +119,23 @@ struct mce_log {
119#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1) 119#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1)
120 120
121#ifdef __KERNEL__ 121#ifdef __KERNEL__
122
123struct mca_config {
124 bool dont_log_ce;
125 bool cmci_disabled;
126 bool ignore_ce;
127 bool disabled;
128 bool ser;
129 bool bios_cmci_threshold;
130 u8 banks;
131 s8 bootlog;
132 int tolerant;
133 int monarch_timeout;
134 int panic_timeout;
135 u32 rip_msr;
136};
137
138extern struct mca_config mca_cfg;
122extern void mce_register_decode_chain(struct notifier_block *nb); 139extern void mce_register_decode_chain(struct notifier_block *nb);
123extern void mce_unregister_decode_chain(struct notifier_block *nb); 140extern void mce_unregister_decode_chain(struct notifier_block *nb);
124 141
@@ -126,7 +143,6 @@ extern void mce_unregister_decode_chain(struct notifier_block *nb);
126#include <linux/init.h> 143#include <linux/init.h>
127#include <linux/atomic.h> 144#include <linux/atomic.h>
128 145
129extern int mce_disabled;
130extern int mce_p5_enabled; 146extern int mce_p5_enabled;
131 147
132#ifdef CONFIG_X86_MCE 148#ifdef CONFIG_X86_MCE
@@ -159,9 +175,6 @@ DECLARE_PER_CPU(struct device *, mce_device);
159#define MAX_NR_BANKS 32 175#define MAX_NR_BANKS 32
160 176
161#ifdef CONFIG_X86_MCE_INTEL 177#ifdef CONFIG_X86_MCE_INTEL
162extern int mce_cmci_disabled;
163extern int mce_ignore_ce;
164extern int mce_bios_cmci_threshold;
165void mce_intel_feature_init(struct cpuinfo_x86 *c); 178void mce_intel_feature_init(struct cpuinfo_x86 *c);
166void cmci_clear(void); 179void cmci_clear(void);
167void cmci_reenable(void); 180void cmci_reenable(void);
diff --git a/arch/x86/include/asm/mman.h b/arch/x86/include/asm/mman.h
index 593e51d4643..513b05f15bb 100644
--- a/arch/x86/include/asm/mman.h
+++ b/arch/x86/include/asm/mman.h
@@ -3,6 +3,9 @@
3 3
4#define MAP_32BIT 0x40 /* only give out 32bit addresses */ 4#define MAP_32BIT 0x40 /* only give out 32bit addresses */
5 5
6#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
7#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
8
6#include <asm-generic/mman.h> 9#include <asm-generic/mman.h>
7 10
8#endif /* _ASM_X86_MMAN_H */ 11#endif /* _ASM_X86_MMAN_H */
diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h
index 9eae7752ae9..e3b7819caee 100644
--- a/arch/x86/include/asm/module.h
+++ b/arch/x86/include/asm/module.h
@@ -5,8 +5,6 @@
5 5
6#ifdef CONFIG_X86_64 6#ifdef CONFIG_X86_64
7/* X86_64 does not define MODULE_PROC_FAMILY */ 7/* X86_64 does not define MODULE_PROC_FAMILY */
8#elif defined CONFIG_M386
9#define MODULE_PROC_FAMILY "386 "
10#elif defined CONFIG_M486 8#elif defined CONFIG_M486
11#define MODULE_PROC_FAMILY "486 " 9#define MODULE_PROC_FAMILY "486 "
12#elif defined CONFIG_M586 10#elif defined CONFIG_M586
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 7f0edceb756..6e930b21872 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -236,6 +236,7 @@
236#define MSR_IA32_EBL_CR_POWERON 0x0000002a 236#define MSR_IA32_EBL_CR_POWERON 0x0000002a
237#define MSR_EBC_FREQUENCY_ID 0x0000002c 237#define MSR_EBC_FREQUENCY_ID 0x0000002c
238#define MSR_IA32_FEATURE_CONTROL 0x0000003a 238#define MSR_IA32_FEATURE_CONTROL 0x0000003a
239#define MSR_IA32_TSC_ADJUST 0x0000003b
239 240
240#define FEATURE_CONTROL_LOCKED (1<<0) 241#define FEATURE_CONTROL_LOCKED (1<<0)
241#define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX (1<<1) 242#define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX (1<<1)
@@ -337,6 +338,8 @@
337#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL << 38) 338#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL << 38)
338#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE (1ULL << 39) 339#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE (1ULL << 39)
339 340
341#define MSR_IA32_TSC_DEADLINE 0x000006E0
342
340/* P4/Xeon+ specific */ 343/* P4/Xeon+ specific */
341#define MSR_IA32_MCG_EAX 0x00000180 344#define MSR_IA32_MCG_EAX 0x00000180
342#define MSR_IA32_MCG_EBX 0x00000181 345#define MSR_IA32_MCG_EBX 0x00000181
diff --git a/arch/x86/include/asm/numachip/numachip.h b/arch/x86/include/asm/numachip/numachip.h
new file mode 100644
index 00000000000..1c6f7f6212c
--- /dev/null
+++ b/arch/x86/include/asm/numachip/numachip.h
@@ -0,0 +1,19 @@
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 * Numascale NumaConnect-specific header file
7 *
8 * Copyright (C) 2012 Numascale AS. All rights reserved.
9 *
10 * Send feedback to <support@numascale.com>
11 *
12 */
13
14#ifndef _ASM_X86_NUMACHIP_NUMACHIP_H
15#define _ASM_X86_NUMACHIP_NUMACHIP_H
16
17extern int __init pci_numachip_init(void);
18
19#endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 6e41b934392..dba7805176b 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -171,4 +171,16 @@ cpumask_of_pcibus(const struct pci_bus *bus)
171} 171}
172#endif 172#endif
173 173
174struct pci_setup_rom {
175 struct setup_data data;
176 uint16_t vendor;
177 uint16_t devid;
178 uint64_t pcilen;
179 unsigned long segment;
180 unsigned long bus;
181 unsigned long device;
182 unsigned long function;
183 uint8_t romdata[0];
184};
185
174#endif /* _ASM_X86_PCI_H */ 186#endif /* _ASM_X86_PCI_H */
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 1104afaba52..0da5200ee79 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -406,7 +406,6 @@ do { \
406#define this_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval) 406#define this_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval)
407#define this_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval) 407#define this_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval)
408 408
409#ifndef CONFIG_M386
410#define __this_cpu_add_return_1(pcp, val) percpu_add_return_op(pcp, val) 409#define __this_cpu_add_return_1(pcp, val) percpu_add_return_op(pcp, val)
411#define __this_cpu_add_return_2(pcp, val) percpu_add_return_op(pcp, val) 410#define __this_cpu_add_return_2(pcp, val) percpu_add_return_op(pcp, val)
412#define __this_cpu_add_return_4(pcp, val) percpu_add_return_op(pcp, val) 411#define __this_cpu_add_return_4(pcp, val) percpu_add_return_op(pcp, val)
@@ -421,8 +420,6 @@ do { \
421#define this_cpu_cmpxchg_2(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) 420#define this_cpu_cmpxchg_2(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
422#define this_cpu_cmpxchg_4(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) 421#define this_cpu_cmpxchg_4(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
423 422
424#endif /* !CONFIG_M386 */
425
426#ifdef CONFIG_X86_CMPXCHG64 423#ifdef CONFIG_X86_CMPXCHG64
427#define percpu_cmpxchg8b_double(pcp1, pcp2, o1, o2, n1, n2) \ 424#define percpu_cmpxchg8b_double(pcp1, pcp2, o1, o2, n1, n2) \
428({ \ 425({ \
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index ad1fc851167..888184b2fc8 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -178,8 +178,6 @@ static inline int hlt_works(int cpu)
178 178
179extern void cpu_detect(struct cpuinfo_x86 *c); 179extern void cpu_detect(struct cpuinfo_x86 *c);
180 180
181extern struct pt_regs *idle_regs(struct pt_regs *);
182
183extern void early_cpu_init(void); 181extern void early_cpu_init(void);
184extern void identify_boot_cpu(void); 182extern void identify_boot_cpu(void);
185extern void identify_secondary_cpu(struct cpuinfo_x86 *); 183extern void identify_secondary_cpu(struct cpuinfo_x86 *);
@@ -187,7 +185,7 @@ extern void print_cpu_info(struct cpuinfo_x86 *);
187void print_cpu_msr(struct cpuinfo_x86 *); 185void print_cpu_msr(struct cpuinfo_x86 *);
188extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); 186extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
189extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 187extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
190extern unsigned short num_cache_leaves; 188extern void init_amd_cacheinfo(struct cpuinfo_x86 *c);
191 189
192extern void detect_extended_topology(struct cpuinfo_x86 *c); 190extern void detect_extended_topology(struct cpuinfo_x86 *c);
193extern void detect_ht(struct cpuinfo_x86 *c); 191extern void detect_ht(struct cpuinfo_x86 *c);
@@ -672,18 +670,29 @@ static inline void sync_core(void)
672{ 670{
673 int tmp; 671 int tmp;
674 672
675#if defined(CONFIG_M386) || defined(CONFIG_M486) 673#ifdef CONFIG_M486
676 if (boot_cpu_data.x86 < 5) 674 /*
677 /* There is no speculative execution. 675 * Do a CPUID if available, otherwise do a jump. The jump
678 * jmp is a barrier to prefetching. */ 676 * can conveniently enough be the jump around CPUID.
679 asm volatile("jmp 1f\n1:\n" ::: "memory"); 677 */
680 else 678 asm volatile("cmpl %2,%1\n\t"
679 "jl 1f\n\t"
680 "cpuid\n"
681 "1:"
682 : "=a" (tmp)
683 : "rm" (boot_cpu_data.cpuid_level), "ri" (0), "0" (1)
684 : "ebx", "ecx", "edx", "memory");
685#else
686 /*
687 * CPUID is a barrier to speculative execution.
688 * Prefetched instructions are automatically
689 * invalidated when modified.
690 */
691 asm volatile("cpuid"
692 : "=a" (tmp)
693 : "0" (1)
694 : "ebx", "ecx", "edx", "memory");
681#endif 695#endif
682 /* cpuid is a barrier to speculative execution.
683 * Prefetched instructions are automatically
684 * invalidated when modified. */
685 asm volatile("cpuid" : "=a" (tmp) : "0" (1)
686 : "ebx", "ecx", "edx", "memory");
687} 696}
688 697
689static inline void __monitor(const void *eax, unsigned long ecx, 698static inline void __monitor(const void *eax, unsigned long ecx,
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 19f16ebaf4f..54d80fddb73 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -239,6 +239,15 @@ static inline unsigned long regs_get_register(struct pt_regs *regs,
239{ 239{
240 if (unlikely(offset > MAX_REG_OFFSET)) 240 if (unlikely(offset > MAX_REG_OFFSET))
241 return 0; 241 return 0;
242#ifdef CONFIG_X86_32
243 /*
244 * Traps from the kernel do not save sp and ss.
245 * Use the helper function to retrieve sp.
246 */
247 if (offset == offsetof(struct pt_regs, sp) &&
248 regs->cs == __KERNEL_CS)
249 return kernel_stack_pointer(regs);
250#endif
242 return *(unsigned long *)((unsigned long)regs + offset); 251 return *(unsigned long *)((unsigned long)regs + offset);
243} 252}
244 253
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index c59cc97fe6c..109a9dd5d45 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -6,6 +6,7 @@
6 6
7/* some helper functions for xen and kvm pv clock sources */ 7/* some helper functions for xen and kvm pv clock sources */
8cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src); 8cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
9u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src);
9void pvclock_set_flags(u8 flags); 10void pvclock_set_flags(u8 flags);
10unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src); 11unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
11void pvclock_read_wallclock(struct pvclock_wall_clock *wall, 12void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
@@ -56,4 +57,50 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
56 return product; 57 return product;
57} 58}
58 59
60static __always_inline
61u64 pvclock_get_nsec_offset(const struct pvclock_vcpu_time_info *src)
62{
63 u64 delta = __native_read_tsc() - src->tsc_timestamp;
64 return pvclock_scale_delta(delta, src->tsc_to_system_mul,
65 src->tsc_shift);
66}
67
68static __always_inline
69unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
70 cycle_t *cycles, u8 *flags)
71{
72 unsigned version;
73 cycle_t ret, offset;
74 u8 ret_flags;
75
76 version = src->version;
77 /* Note: emulated platforms which do not advertise SSE2 support
78 * result in kvmclock not using the necessary RDTSC barriers.
79 * Without barriers, it is possible that RDTSC instruction reads from
80 * the time stamp counter outside rdtsc_barrier protected section
81 * below, resulting in violation of monotonicity.
82 */
83 rdtsc_barrier();
84 offset = pvclock_get_nsec_offset(src);
85 ret = src->system_time + offset;
86 ret_flags = src->flags;
87 rdtsc_barrier();
88
89 *cycles = ret;
90 *flags = ret_flags;
91 return version;
92}
93
94struct pvclock_vsyscall_time_info {
95 struct pvclock_vcpu_time_info pvti;
96 u32 migrate_count;
97} __attribute__((__aligned__(SMP_CACHE_BYTES)));
98
99#define PVTI_SIZE sizeof(struct pvclock_vsyscall_time_info)
100#define PVCLOCK_VSYSCALL_NR_PAGES (((NR_CPUS-1)/(PAGE_SIZE/PVTI_SIZE))+1)
101
102int __init pvclock_init_vsyscall(struct pvclock_vsyscall_time_info *i,
103 int size);
104struct pvclock_vcpu_time_info *pvclock_get_vsyscall_time_info(int cpu);
105
59#endif /* _ASM_X86_PVCLOCK_H */ 106#endif /* _ASM_X86_PVCLOCK_H */
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 323973f4abf..0dba8b7a6ac 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -260,8 +260,6 @@ struct pt_regs;
260 260
261#endif /* !__i386__ */ 261#endif /* !__i386__ */
262 262
263#define ptrace_signal_deliver(regs, cookie) do { } while (0)
264
265#endif /* __KERNEL__ */ 263#endif /* __KERNEL__ */
266#endif /* __ASSEMBLY__ */ 264#endif /* __ASSEMBLY__ */
267 265
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 4f19a152603..b073aaea747 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -166,6 +166,7 @@ void native_send_call_func_ipi(const struct cpumask *mask);
166void native_send_call_func_single_ipi(int cpu); 166void native_send_call_func_single_ipi(int cpu);
167void x86_idle_thread_init(unsigned int cpu, struct task_struct *idle); 167void x86_idle_thread_init(unsigned int cpu, struct task_struct *idle);
168 168
169void smp_store_boot_cpu_info(void);
169void smp_store_cpu_info(int id); 170void smp_store_cpu_info(int id);
170#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) 171#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
171 172
diff --git a/arch/x86/include/asm/swab.h b/arch/x86/include/asm/swab.h
index 557cd9f0066..7f235c7105c 100644
--- a/arch/x86/include/asm/swab.h
+++ b/arch/x86/include/asm/swab.h
@@ -6,22 +6,7 @@
6 6
7static inline __attribute_const__ __u32 __arch_swab32(__u32 val) 7static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
8{ 8{
9#ifdef __i386__ 9 asm("bswapl %0" : "=r" (val) : "0" (val));
10# ifdef CONFIG_X86_BSWAP
11 asm("bswap %0" : "=r" (val) : "0" (val));
12# else
13 asm("xchgb %b0,%h0\n\t" /* swap lower bytes */
14 "rorl $16,%0\n\t" /* swap words */
15 "xchgb %b0,%h0" /* swap higher bytes */
16 : "=q" (val)
17 : "0" (val));
18# endif
19
20#else /* __i386__ */
21 asm("bswapl %0"
22 : "=r" (val)
23 : "0" (val));
24#endif
25 return val; 10 return val;
26} 11}
27#define __arch_swab32 __arch_swab32 12#define __arch_swab32 __arch_swab32
@@ -37,22 +22,12 @@ static inline __attribute_const__ __u64 __arch_swab64(__u64 val)
37 __u64 u; 22 __u64 u;
38 } v; 23 } v;
39 v.u = val; 24 v.u = val;
40# ifdef CONFIG_X86_BSWAP
41 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 25 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
42 : "=r" (v.s.a), "=r" (v.s.b) 26 : "=r" (v.s.a), "=r" (v.s.b)
43 : "0" (v.s.a), "1" (v.s.b)); 27 : "0" (v.s.a), "1" (v.s.b));
44# else
45 v.s.a = __arch_swab32(v.s.a);
46 v.s.b = __arch_swab32(v.s.b);
47 asm("xchgl %0,%1"
48 : "=r" (v.s.a), "=r" (v.s.b)
49 : "0" (v.s.a), "1" (v.s.b));
50# endif
51 return v.u; 28 return v.u;
52#else /* __i386__ */ 29#else /* __i386__ */
53 asm("bswapq %0" 30 asm("bswapq %0" : "=r" (val) : "0" (val));
54 : "=r" (val)
55 : "0" (val));
56 return val; 31 return val;
57#endif 32#endif
58} 33}
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index a9a8cf3da49..c76fae4d90b 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -54,8 +54,6 @@ asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32);
54asmlinkage long sys32_personality(unsigned long); 54asmlinkage long sys32_personality(unsigned long);
55asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32); 55asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
56 56
57asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *);
58
59long sys32_lseek(unsigned int, int, unsigned int); 57long sys32_lseek(unsigned int, int, unsigned int);
60long sys32_kill(int, int); 58long sys32_kill(int, int);
61long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int); 59long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int);
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 2be0b880417..2f8374718aa 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -20,15 +20,6 @@
20asmlinkage long sys_ioperm(unsigned long, unsigned long, int); 20asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
21long sys_iopl(unsigned int, struct pt_regs *); 21long sys_iopl(unsigned int, struct pt_regs *);
22 22
23/* kernel/process.c */
24int sys_fork(struct pt_regs *);
25int sys_vfork(struct pt_regs *);
26long sys_execve(const char __user *,
27 const char __user *const __user *,
28 const char __user *const __user *);
29long sys_clone(unsigned long, unsigned long, void __user *,
30 void __user *, struct pt_regs *);
31
32/* kernel/ldt.c */ 23/* kernel/ldt.c */
33asmlinkage int sys_modify_ldt(int, void __user *, unsigned long); 24asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
34 25
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 74a44333545..0fee48e279c 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -56,10 +56,7 @@ static inline void __flush_tlb_all(void)
56 56
57static inline void __flush_tlb_one(unsigned long addr) 57static inline void __flush_tlb_one(unsigned long addr)
58{ 58{
59 if (cpu_has_invlpg)
60 __flush_tlb_single(addr); 59 __flush_tlb_single(addr);
61 else
62 __flush_tlb();
63} 60}
64 61
65#define TLB_FLUSH_ALL -1UL 62#define TLB_FLUSH_ALL -1UL
diff --git a/arch/x86/include/asm/trace_clock.h b/arch/x86/include/asm/trace_clock.h
new file mode 100644
index 00000000000..beab86cc282
--- /dev/null
+++ b/arch/x86/include/asm/trace_clock.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_X86_TRACE_CLOCK_H
2#define _ASM_X86_TRACE_CLOCK_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7#ifdef CONFIG_X86_TSC
8
9extern u64 notrace trace_clock_x86_tsc(void);
10
11# define ARCH_TRACE_CLOCKS \
12 { trace_clock_x86_tsc, "x86-tsc", .in_ns = 0 },
13
14#else /* !CONFIG_X86_TSC */
15
16#define ARCH_TRACE_CLOCKS
17
18#endif
19
20#endif /* _ASM_X86_TRACE_CLOCK_H */
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 7ccf8d13153..1709801d18e 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -237,8 +237,6 @@ extern void __put_user_2(void);
237extern void __put_user_4(void); 237extern void __put_user_4(void);
238extern void __put_user_8(void); 238extern void __put_user_8(void);
239 239
240#ifdef CONFIG_X86_WP_WORKS_OK
241
242/** 240/**
243 * put_user: - Write a simple value into user space. 241 * put_user: - Write a simple value into user space.
244 * @x: Value to copy to user space. 242 * @x: Value to copy to user space.
@@ -326,29 +324,6 @@ do { \
326 } \ 324 } \
327} while (0) 325} while (0)
328 326
329#else
330
331#define __put_user_size(x, ptr, size, retval, errret) \
332do { \
333 __typeof__(*(ptr))__pus_tmp = x; \
334 retval = 0; \
335 \
336 if (unlikely(__copy_to_user_ll(ptr, &__pus_tmp, size) != 0)) \
337 retval = errret; \
338} while (0)
339
340#define put_user(x, ptr) \
341({ \
342 int __ret_pu; \
343 __typeof__(*(ptr))__pus_tmp = x; \
344 __ret_pu = 0; \
345 if (unlikely(__copy_to_user_ll(ptr, &__pus_tmp, \
346 sizeof(*(ptr))) != 0)) \
347 __ret_pu = -EFAULT; \
348 __ret_pu; \
349})
350#endif
351
352#ifdef CONFIG_X86_32 327#ifdef CONFIG_X86_32
353#define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() 328#define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad()
354#define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad() 329#define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad()
@@ -543,29 +518,12 @@ struct __large_struct { unsigned long buf[100]; };
543 (x) = (__force __typeof__(*(ptr)))__gue_val; \ 518 (x) = (__force __typeof__(*(ptr)))__gue_val; \
544} while (0) 519} while (0)
545 520
546#ifdef CONFIG_X86_WP_WORKS_OK
547
548#define put_user_try uaccess_try 521#define put_user_try uaccess_try
549#define put_user_catch(err) uaccess_catch(err) 522#define put_user_catch(err) uaccess_catch(err)
550 523
551#define put_user_ex(x, ptr) \ 524#define put_user_ex(x, ptr) \
552 __put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) 525 __put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
553 526
554#else /* !CONFIG_X86_WP_WORKS_OK */
555
556#define put_user_try do { \
557 int __uaccess_err = 0;
558
559#define put_user_catch(err) \
560 (err) |= __uaccess_err; \
561} while (0)
562
563#define put_user_ex(x, ptr) do { \
564 __uaccess_err |= __put_user(x, ptr); \
565} while (0)
566
567#endif /* CONFIG_X86_WP_WORKS_OK */
568
569extern unsigned long 527extern unsigned long
570copy_from_user_nmi(void *to, const void __user *from, unsigned long n); 528copy_from_user_nmi(void *to, const void __user *from, unsigned long n);
571extern __must_check long 529extern __must_check long
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 16f3fc6ebf2..0e7dea7d366 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -51,6 +51,9 @@
51# define __ARCH_WANT_SYS_UTIME 51# define __ARCH_WANT_SYS_UTIME
52# define __ARCH_WANT_SYS_WAITPID 52# define __ARCH_WANT_SYS_WAITPID
53# define __ARCH_WANT_SYS_EXECVE 53# define __ARCH_WANT_SYS_EXECVE
54# define __ARCH_WANT_SYS_FORK
55# define __ARCH_WANT_SYS_VFORK
56# define __ARCH_WANT_SYS_CLONE
54 57
55/* 58/*
56 * "Conditional" syscalls 59 * "Conditional" syscalls
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 36ec21c36d6..c2d56b34830 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -445,8 +445,7 @@ enum vmcs_field {
445#define VMX_EPTP_WB_BIT (1ull << 14) 445#define VMX_EPTP_WB_BIT (1ull << 14)
446#define VMX_EPT_2MB_PAGE_BIT (1ull << 16) 446#define VMX_EPT_2MB_PAGE_BIT (1ull << 16)
447#define VMX_EPT_1GB_PAGE_BIT (1ull << 17) 447#define VMX_EPT_1GB_PAGE_BIT (1ull << 17)
448#define VMX_EPT_AD_BIT (1ull << 21) 448#define VMX_EPT_AD_BIT (1ull << 21)
449#define VMX_EPT_EXTENT_INDIVIDUAL_BIT (1ull << 24)
450#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25) 449#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25)
451#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) 450#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26)
452 451
diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
index eaea1d31f75..80f80955cfd 100644
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -33,6 +33,26 @@ extern void map_vsyscall(void);
33 */ 33 */
34extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address); 34extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
35 35
36#ifdef CONFIG_X86_64
37
38#define VGETCPU_CPU_MASK 0xfff
39
40static inline unsigned int __getcpu(void)
41{
42 unsigned int p;
43
44 if (VVAR(vgetcpu_mode) == VGETCPU_RDTSCP) {
45 /* Load per CPU data from RDTSCP */
46 native_read_tscp(&p);
47 } else {
48 /* Load per CPU data from GDT */
49 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
50 }
51
52 return p;
53}
54#endif /* CONFIG_X86_64 */
55
36#endif /* __KERNEL__ */ 56#endif /* __KERNEL__ */
37 57
38#endif /* _ASM_X86_VSYSCALL_H */ 58#endif /* _ASM_X86_VSYSCALL_H */
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h
index 54d52ff1304..fd9cb7695b5 100644
--- a/arch/x86/include/asm/xen/interface.h
+++ b/arch/x86/include/asm/xen/interface.h
@@ -63,6 +63,7 @@ DEFINE_GUEST_HANDLE(void);
63DEFINE_GUEST_HANDLE(uint64_t); 63DEFINE_GUEST_HANDLE(uint64_t);
64DEFINE_GUEST_HANDLE(uint32_t); 64DEFINE_GUEST_HANDLE(uint32_t);
65DEFINE_GUEST_HANDLE(xen_pfn_t); 65DEFINE_GUEST_HANDLE(xen_pfn_t);
66DEFINE_GUEST_HANDLE(xen_ulong_t);
66#endif 67#endif
67 68
68#ifndef HYPERVISOR_VIRT_START 69#ifndef HYPERVISOR_VIRT_START
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 91ce48f05f9..34e923a5376 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -9,7 +9,6 @@ CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
9ifdef CONFIG_FUNCTION_TRACER 9ifdef CONFIG_FUNCTION_TRACER
10# Do not profile debug and lowlevel utilities 10# Do not profile debug and lowlevel utilities
11CFLAGS_REMOVE_tsc.o = -pg 11CFLAGS_REMOVE_tsc.o = -pg
12CFLAGS_REMOVE_rtc.o = -pg
13CFLAGS_REMOVE_paravirt-spinlocks.o = -pg 12CFLAGS_REMOVE_paravirt-spinlocks.o = -pg
14CFLAGS_REMOVE_pvclock.o = -pg 13CFLAGS_REMOVE_pvclock.o = -pg
15CFLAGS_REMOVE_kvmclock.o = -pg 14CFLAGS_REMOVE_kvmclock.o = -pg
@@ -62,6 +61,7 @@ obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o
62obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 61obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
63obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 62obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
64obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o 63obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
64obj-$(CONFIG_X86_TSC) += trace_clock.o
65obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o 65obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o
66obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o 66obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
67obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o 67obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index e651f7a589a..bacf4b0d91f 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -574,6 +574,12 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
574 574
575 return irq; 575 return irq;
576} 576}
577EXPORT_SYMBOL_GPL(acpi_register_gsi);
578
579void acpi_unregister_gsi(u32 gsi)
580{
581}
582EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
577 583
578void __init acpi_set_irq_model_pic(void) 584void __init acpi_set_irq_model_pic(void)
579{ 585{
@@ -1700,3 +1706,9 @@ int __acpi_release_global_lock(unsigned int *lock)
1700 } while (unlikely (val != old)); 1706 } while (unlikely (val != old));
1701 return old & 0x1; 1707 return old & 0x1;
1702} 1708}
1709
1710void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
1711{
1712 e820_add_region(addr, size, E820_ACPI);
1713 update_e820();
1714}
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 11676cf65ae..d5e0d717005 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -101,6 +101,8 @@ static int __init acpi_sleep_setup(char *str)
101#endif 101#endif
102 if (strncmp(str, "nonvs", 5) == 0) 102 if (strncmp(str, "nonvs", 5) == 0)
103 acpi_nvs_nosave(); 103 acpi_nvs_nosave();
104 if (strncmp(str, "nonvs_s3", 8) == 0)
105 acpi_nvs_nosave_s3();
104 if (strncmp(str, "old_ordering", 12) == 0) 106 if (strncmp(str, "old_ordering", 12) == 0)
105 acpi_old_suspend_ordering(); 107 acpi_old_suspend_ordering();
106 str = strchr(str, ','); 108 str = strchr(str, ',');
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index b17416e72fb..b994cc84aa7 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -90,21 +90,6 @@ EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
90 */ 90 */
91DEFINE_EARLY_PER_CPU_READ_MOSTLY(int, x86_cpu_to_logical_apicid, BAD_APICID); 91DEFINE_EARLY_PER_CPU_READ_MOSTLY(int, x86_cpu_to_logical_apicid, BAD_APICID);
92 92
93/*
94 * Knob to control our willingness to enable the local APIC.
95 *
96 * +1=force-enable
97 */
98static int force_enable_local_apic __initdata;
99/*
100 * APIC command line parameters
101 */
102static int __init parse_lapic(char *arg)
103{
104 force_enable_local_apic = 1;
105 return 0;
106}
107early_param("lapic", parse_lapic);
108/* Local APIC was disabled by the BIOS and enabled by the kernel */ 93/* Local APIC was disabled by the BIOS and enabled by the kernel */
109static int enabled_via_apicbase; 94static int enabled_via_apicbase;
110 95
@@ -133,6 +118,25 @@ static inline void imcr_apic_to_pic(void)
133} 118}
134#endif 119#endif
135 120
121/*
122 * Knob to control our willingness to enable the local APIC.
123 *
124 * +1=force-enable
125 */
126static int force_enable_local_apic __initdata;
127/*
128 * APIC command line parameters
129 */
130static int __init parse_lapic(char *arg)
131{
132 if (config_enabled(CONFIG_X86_32) && !arg)
133 force_enable_local_apic = 1;
134 else if (!strncmp(arg, "notscdeadline", 13))
135 setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
136 return 0;
137}
138early_param("lapic", parse_lapic);
139
136#ifdef CONFIG_X86_64 140#ifdef CONFIG_X86_64
137static int apic_calibrate_pmtmr __initdata; 141static int apic_calibrate_pmtmr __initdata;
138static __init int setup_apicpmtimer(char *s) 142static __init int setup_apicpmtimer(char *s)
@@ -315,6 +319,7 @@ int lapic_get_maxlvt(void)
315 319
316/* Clock divisor */ 320/* Clock divisor */
317#define APIC_DIVISOR 16 321#define APIC_DIVISOR 16
322#define TSC_DIVISOR 32
318 323
319/* 324/*
320 * This function sets up the local APIC timer, with a timeout of 325 * This function sets up the local APIC timer, with a timeout of
@@ -333,6 +338,9 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
333 lvtt_value = LOCAL_TIMER_VECTOR; 338 lvtt_value = LOCAL_TIMER_VECTOR;
334 if (!oneshot) 339 if (!oneshot)
335 lvtt_value |= APIC_LVT_TIMER_PERIODIC; 340 lvtt_value |= APIC_LVT_TIMER_PERIODIC;
341 else if (boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER))
342 lvtt_value |= APIC_LVT_TIMER_TSCDEADLINE;
343
336 if (!lapic_is_integrated()) 344 if (!lapic_is_integrated())
337 lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV); 345 lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV);
338 346
@@ -341,6 +349,11 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
341 349
342 apic_write(APIC_LVTT, lvtt_value); 350 apic_write(APIC_LVTT, lvtt_value);
343 351
352 if (lvtt_value & APIC_LVT_TIMER_TSCDEADLINE) {
353 printk_once(KERN_DEBUG "TSC deadline timer enabled\n");
354 return;
355 }
356
344 /* 357 /*
345 * Divide PICLK by 16 358 * Divide PICLK by 16
346 */ 359 */
@@ -453,6 +466,16 @@ static int lapic_next_event(unsigned long delta,
453 return 0; 466 return 0;
454} 467}
455 468
469static int lapic_next_deadline(unsigned long delta,
470 struct clock_event_device *evt)
471{
472 u64 tsc;
473
474 rdtscll(tsc);
475 wrmsrl(MSR_IA32_TSC_DEADLINE, tsc + (((u64) delta) * TSC_DIVISOR));
476 return 0;
477}
478
456/* 479/*
457 * Setup the lapic timer in periodic or oneshot mode 480 * Setup the lapic timer in periodic or oneshot mode
458 */ 481 */
@@ -533,7 +556,15 @@ static void __cpuinit setup_APIC_timer(void)
533 memcpy(levt, &lapic_clockevent, sizeof(*levt)); 556 memcpy(levt, &lapic_clockevent, sizeof(*levt));
534 levt->cpumask = cpumask_of(smp_processor_id()); 557 levt->cpumask = cpumask_of(smp_processor_id());
535 558
536 clockevents_register_device(levt); 559 if (this_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER)) {
560 levt->features &= ~(CLOCK_EVT_FEAT_PERIODIC |
561 CLOCK_EVT_FEAT_DUMMY);
562 levt->set_next_event = lapic_next_deadline;
563 clockevents_config_and_register(levt,
564 (tsc_khz / TSC_DIVISOR) * 1000,
565 0xF, ~0UL);
566 } else
567 clockevents_register_device(levt);
537} 568}
538 569
539/* 570/*
@@ -661,7 +692,9 @@ static int __init calibrate_APIC_clock(void)
661 * in the clockevent structure and return. 692 * in the clockevent structure and return.
662 */ 693 */
663 694
664 if (lapic_timer_frequency) { 695 if (boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER)) {
696 return 0;
697 } else if (lapic_timer_frequency) {
665 apic_printk(APIC_VERBOSE, "lapic timer already calibrated %d\n", 698 apic_printk(APIC_VERBOSE, "lapic timer already calibrated %d\n",
666 lapic_timer_frequency); 699 lapic_timer_frequency);
667 lapic_clockevent.mult = div_sc(lapic_timer_frequency/APIC_DIVISOR, 700 lapic_clockevent.mult = div_sc(lapic_timer_frequency/APIC_DIVISOR,
@@ -674,6 +707,9 @@ static int __init calibrate_APIC_clock(void)
674 return 0; 707 return 0;
675 } 708 }
676 709
710 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
711 "calibrating APIC timer ...\n");
712
677 local_irq_disable(); 713 local_irq_disable();
678 714
679 /* Replace the global interrupt handler */ 715 /* Replace the global interrupt handler */
@@ -811,9 +847,6 @@ void __init setup_boot_APIC_clock(void)
811 return; 847 return;
812 } 848 }
813 849
814 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
815 "calibrating APIC timer ...\n");
816
817 if (calibrate_APIC_clock()) { 850 if (calibrate_APIC_clock()) {
818 /* No broadcast on UP ! */ 851 /* No broadcast on UP ! */
819 if (num_possible_cpus() > 1) 852 if (num_possible_cpus() > 1)
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index a65829ac2b9..9c2aa89a11c 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -22,6 +22,7 @@
22#include <linux/hardirq.h> 22#include <linux/hardirq.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24 24
25#include <asm/numachip/numachip.h>
25#include <asm/numachip/numachip_csr.h> 26#include <asm/numachip/numachip_csr.h>
26#include <asm/smp.h> 27#include <asm/smp.h>
27#include <asm/apic.h> 28#include <asm/apic.h>
@@ -179,6 +180,7 @@ static int __init numachip_system_init(void)
179 return 0; 180 return 0;
180 181
181 x86_cpuinit.fixup_cpu_id = fixup_cpu_id; 182 x86_cpuinit.fixup_cpu_id = fixup_cpu_id;
183 x86_init.pci.arch_init = pci_numachip_init;
182 184
183 map_csrs(); 185 map_csrs();
184 186
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 1817fa91102..b739d398bb2 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -234,11 +234,11 @@ int __init arch_early_irq_init(void)
234 zalloc_cpumask_var_node(&cfg[i].old_domain, GFP_KERNEL, node); 234 zalloc_cpumask_var_node(&cfg[i].old_domain, GFP_KERNEL, node);
235 /* 235 /*
236 * For legacy IRQ's, start with assigning irq0 to irq15 to 236 * For legacy IRQ's, start with assigning irq0 to irq15 to
237 * IRQ0_VECTOR to IRQ15_VECTOR on cpu 0. 237 * IRQ0_VECTOR to IRQ15_VECTOR for all cpu's.
238 */ 238 */
239 if (i < legacy_pic->nr_legacy_irqs) { 239 if (i < legacy_pic->nr_legacy_irqs) {
240 cfg[i].vector = IRQ0_VECTOR + i; 240 cfg[i].vector = IRQ0_VECTOR + i;
241 cpumask_set_cpu(0, cfg[i].domain); 241 cpumask_setall(cfg[i].domain);
242 } 242 }
243 } 243 }
244 244
@@ -1141,7 +1141,8 @@ __assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask)
1141 * allocation for the members that are not used anymore. 1141 * allocation for the members that are not used anymore.
1142 */ 1142 */
1143 cpumask_andnot(cfg->old_domain, cfg->domain, tmp_mask); 1143 cpumask_andnot(cfg->old_domain, cfg->domain, tmp_mask);
1144 cfg->move_in_progress = 1; 1144 cfg->move_in_progress =
1145 cpumask_intersects(cfg->old_domain, cpu_online_mask);
1145 cpumask_and(cfg->domain, cfg->domain, tmp_mask); 1146 cpumask_and(cfg->domain, cfg->domain, tmp_mask);
1146 break; 1147 break;
1147 } 1148 }
@@ -1172,8 +1173,9 @@ next:
1172 current_vector = vector; 1173 current_vector = vector;
1173 current_offset = offset; 1174 current_offset = offset;
1174 if (cfg->vector) { 1175 if (cfg->vector) {
1175 cfg->move_in_progress = 1;
1176 cpumask_copy(cfg->old_domain, cfg->domain); 1176 cpumask_copy(cfg->old_domain, cfg->domain);
1177 cfg->move_in_progress =
1178 cpumask_intersects(cfg->old_domain, cpu_online_mask);
1177 } 1179 }
1178 for_each_cpu_and(new_cpu, tmp_mask, cpu_online_mask) 1180 for_each_cpu_and(new_cpu, tmp_mask, cpu_online_mask)
1179 per_cpu(vector_irq, new_cpu)[vector] = irq; 1181 per_cpu(vector_irq, new_cpu)[vector] = irq;
@@ -1241,12 +1243,6 @@ void __setup_vector_irq(int cpu)
1241 cfg = irq_get_chip_data(irq); 1243 cfg = irq_get_chip_data(irq);
1242 if (!cfg) 1244 if (!cfg)
1243 continue; 1245 continue;
1244 /*
1245 * If it is a legacy IRQ handled by the legacy PIC, this cpu
1246 * will be part of the irq_cfg's domain.
1247 */
1248 if (irq < legacy_pic->nr_legacy_irqs && !IO_APIC_IRQ(irq))
1249 cpumask_set_cpu(cpu, cfg->domain);
1250 1246
1251 if (!cpumask_test_cpu(cpu, cfg->domain)) 1247 if (!cpumask_test_cpu(cpu, cfg->domain))
1252 continue; 1248 continue;
@@ -1356,16 +1352,6 @@ static void setup_ioapic_irq(unsigned int irq, struct irq_cfg *cfg,
1356 if (!IO_APIC_IRQ(irq)) 1352 if (!IO_APIC_IRQ(irq))
1357 return; 1353 return;
1358 1354
1359 /*
1360 * For legacy irqs, cfg->domain starts with cpu 0. Now that IO-APIC
1361 * can handle this irq and the apic driver is finialized at this point,
1362 * update the cfg->domain.
1363 */
1364 if (irq < legacy_pic->nr_legacy_irqs &&
1365 cpumask_equal(cfg->domain, cpumask_of(0)))
1366 apic->vector_allocation_domain(0, cfg->domain,
1367 apic->target_cpus());
1368
1369 if (assign_irq_vector(irq, cfg, apic->target_cpus())) 1355 if (assign_irq_vector(irq, cfg, apic->target_cpus()))
1370 return; 1356 return;
1371 1357
@@ -2199,9 +2185,11 @@ static int ioapic_retrigger_irq(struct irq_data *data)
2199{ 2185{
2200 struct irq_cfg *cfg = data->chip_data; 2186 struct irq_cfg *cfg = data->chip_data;
2201 unsigned long flags; 2187 unsigned long flags;
2188 int cpu;
2202 2189
2203 raw_spin_lock_irqsave(&vector_lock, flags); 2190 raw_spin_lock_irqsave(&vector_lock, flags);
2204 apic->send_IPI_mask(cpumask_of(cpumask_first(cfg->domain)), cfg->vector); 2191 cpu = cpumask_first_and(cfg->domain, cpu_online_mask);
2192 apic->send_IPI_mask(cpumask_of(cpu), cfg->vector);
2205 raw_spin_unlock_irqrestore(&vector_lock, flags); 2193 raw_spin_unlock_irqrestore(&vector_lock, flags);
2206 2194
2207 return 1; 2195 return 1;
@@ -3317,8 +3305,9 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3317 int ret; 3305 int ret;
3318 3306
3319 if (irq_remapping_enabled) { 3307 if (irq_remapping_enabled) {
3320 if (!setup_hpet_msi_remapped(irq, id)) 3308 ret = setup_hpet_msi_remapped(irq, id);
3321 return -1; 3309 if (ret)
3310 return ret;
3322 } 3311 }
3323 3312
3324 ret = msi_compose_msg(NULL, irq, &msg, id); 3313 ret = msi_compose_msg(NULL, irq, &msg, id);
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 1b7d1656a04..15239fffd6f 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -304,7 +304,7 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
304 int cpu = smp_processor_id(); 304 int cpu = smp_processor_id();
305 305
306 /* get information required for multi-node processors */ 306 /* get information required for multi-node processors */
307 if (cpu_has(c, X86_FEATURE_TOPOEXT)) { 307 if (cpu_has_topoext) {
308 u32 eax, ebx, ecx, edx; 308 u32 eax, ebx, ecx, edx;
309 309
310 cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); 310 cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
@@ -657,12 +657,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
657 detect_ht(c); 657 detect_ht(c);
658#endif 658#endif
659 659
660 if (c->extended_cpuid_level >= 0x80000006) { 660 init_amd_cacheinfo(c);
661 if (cpuid_edx(0x80000006) & 0xf000)
662 num_cache_leaves = 4;
663 else
664 num_cache_leaves = 3;
665 }
666 661
667 if (c->x86 >= 0xf) 662 if (c->x86 >= 0xf)
668 set_cpu_cap(c, X86_FEATURE_K8); 663 set_cpu_cap(c, X86_FEATURE_K8);
@@ -753,9 +748,6 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
753 748
754static void __cpuinit cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c) 749static void __cpuinit cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c)
755{ 750{
756 if (!cpu_has_invlpg)
757 return;
758
759 tlb_flushall_shift = 5; 751 tlb_flushall_shift = 5;
760 752
761 if (c->x86 <= 0x11) 753 if (c->x86 <= 0x11)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index d0e910da16c..92dfec986a4 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -107,53 +107,17 @@ static void __init check_hlt(void)
107} 107}
108 108
109/* 109/*
110 * Most 386 processors have a bug where a POPAD can lock the
111 * machine even from user space.
112 */
113
114static void __init check_popad(void)
115{
116#ifndef CONFIG_X86_POPAD_OK
117 int res, inp = (int) &res;
118
119 pr_info("Checking for popad bug... ");
120 __asm__ __volatile__(
121 "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx "
122 : "=&a" (res)
123 : "d" (inp)
124 : "ecx", "edi");
125 /*
126 * If this fails, it means that any user program may lock the
127 * CPU hard. Too bad.
128 */
129 if (res != 12345678)
130 pr_cont("Buggy\n");
131 else
132 pr_cont("OK\n");
133#endif
134}
135
136/*
137 * Check whether we are able to run this kernel safely on SMP. 110 * Check whether we are able to run this kernel safely on SMP.
138 * 111 *
139 * - In order to run on a i386, we need to be compiled for i386 112 * - i386 is no longer supported.
140 * (for due to lack of "invlpg" and working WP on a i386)
141 * - In order to run on anything without a TSC, we need to be 113 * - In order to run on anything without a TSC, we need to be
142 * compiled for a i486. 114 * compiled for a i486.
143 */ 115 */
144 116
145static void __init check_config(void) 117static void __init check_config(void)
146{ 118{
147/* 119 if (boot_cpu_data.x86 < 4)
148 * We'd better not be a i386 if we're configured to use some
149 * i486+ only features! (WP works in supervisor mode and the
150 * new "invlpg" and "bswap" instructions)
151 */
152#if defined(CONFIG_X86_WP_WORKS_OK) || defined(CONFIG_X86_INVLPG) || \
153 defined(CONFIG_X86_BSWAP)
154 if (boot_cpu_data.x86 == 3)
155 panic("Kernel requires i486+ for 'invlpg' and other features"); 120 panic("Kernel requires i486+ for 'invlpg' and other features");
156#endif
157} 121}
158 122
159 123
@@ -166,7 +130,6 @@ void __init check_bugs(void)
166#endif 130#endif
167 check_config(); 131 check_config();
168 check_hlt(); 132 check_hlt();
169 check_popad();
170 init_utsname()->machine[1] = 133 init_utsname()->machine[1] =
171 '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); 134 '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
172 alternative_instructions(); 135 alternative_instructions();
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 7505f7b13e7..9c3ab43a695 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1173,15 +1173,6 @@ DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
1173DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary); 1173DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
1174#endif 1174#endif
1175 1175
1176/* Make sure %fs and %gs are initialized properly in idle threads */
1177struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
1178{
1179 memset(regs, 0, sizeof(struct pt_regs));
1180 regs->fs = __KERNEL_PERCPU;
1181 regs->gs = __KERNEL_STACK_CANARY;
1182
1183 return regs;
1184}
1185#endif /* CONFIG_X86_64 */ 1176#endif /* CONFIG_X86_64 */
1186 1177
1187/* 1178/*
@@ -1237,7 +1228,7 @@ void __cpuinit cpu_init(void)
1237 oist = &per_cpu(orig_ist, cpu); 1228 oist = &per_cpu(orig_ist, cpu);
1238 1229
1239#ifdef CONFIG_NUMA 1230#ifdef CONFIG_NUMA
1240 if (cpu != 0 && this_cpu_read(numa_node) == 0 && 1231 if (this_cpu_read(numa_node) == 0 &&
1241 early_cpu_to_node(cpu) != NUMA_NO_NODE) 1232 early_cpu_to_node(cpu) != NUMA_NO_NODE)
1242 set_numa_node(early_cpu_to_node(cpu)); 1233 set_numa_node(early_cpu_to_node(cpu));
1243#endif 1234#endif
@@ -1269,8 +1260,7 @@ void __cpuinit cpu_init(void)
1269 barrier(); 1260 barrier();
1270 1261
1271 x86_configure_nx(); 1262 x86_configure_nx();
1272 if (cpu != 0) 1263 enable_x2apic();
1273 enable_x2apic();
1274 1264
1275 /* 1265 /*
1276 * set up and load the per-CPU TSS 1266 * set up and load the per-CPU TSS
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 198e019a531..fcaabd0432c 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -612,10 +612,6 @@ static void __cpuinit intel_tlb_lookup(const unsigned char desc)
612 612
613static void __cpuinit intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c) 613static void __cpuinit intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c)
614{ 614{
615 if (!cpu_has_invlpg) {
616 tlb_flushall_shift = -1;
617 return;
618 }
619 switch ((c->x86 << 8) + c->x86_model) { 615 switch ((c->x86 << 8) + c->x86_model) {
620 case 0x60f: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */ 616 case 0x60f: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */
621 case 0x616: /* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */ 617 case 0x616: /* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 93c5451bdd5..fe9edec6698 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -538,7 +538,11 @@ __cpuinit cpuid4_cache_lookup_regs(int index,
538 unsigned edx; 538 unsigned edx;
539 539
540 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { 540 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
541 amd_cpuid4(index, &eax, &ebx, &ecx); 541 if (cpu_has_topoext)
542 cpuid_count(0x8000001d, index, &eax.full,
543 &ebx.full, &ecx.full, &edx);
544 else
545 amd_cpuid4(index, &eax, &ebx, &ecx);
542 amd_init_l3_cache(this_leaf, index); 546 amd_init_l3_cache(this_leaf, index);
543 } else { 547 } else {
544 cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); 548 cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx);
@@ -557,21 +561,39 @@ __cpuinit cpuid4_cache_lookup_regs(int index,
557 return 0; 561 return 0;
558} 562}
559 563
560static int __cpuinit find_num_cache_leaves(void) 564static int __cpuinit find_num_cache_leaves(struct cpuinfo_x86 *c)
561{ 565{
562 unsigned int eax, ebx, ecx, edx; 566 unsigned int eax, ebx, ecx, edx, op;
563 union _cpuid4_leaf_eax cache_eax; 567 union _cpuid4_leaf_eax cache_eax;
564 int i = -1; 568 int i = -1;
565 569
570 if (c->x86_vendor == X86_VENDOR_AMD)
571 op = 0x8000001d;
572 else
573 op = 4;
574
566 do { 575 do {
567 ++i; 576 ++i;
568 /* Do cpuid(4) loop to find out num_cache_leaves */ 577 /* Do cpuid(op) loop to find out num_cache_leaves */
569 cpuid_count(4, i, &eax, &ebx, &ecx, &edx); 578 cpuid_count(op, i, &eax, &ebx, &ecx, &edx);
570 cache_eax.full = eax; 579 cache_eax.full = eax;
571 } while (cache_eax.split.type != CACHE_TYPE_NULL); 580 } while (cache_eax.split.type != CACHE_TYPE_NULL);
572 return i; 581 return i;
573} 582}
574 583
584void __cpuinit init_amd_cacheinfo(struct cpuinfo_x86 *c)
585{
586
587 if (cpu_has_topoext) {
588 num_cache_leaves = find_num_cache_leaves(c);
589 } else if (c->extended_cpuid_level >= 0x80000006) {
590 if (cpuid_edx(0x80000006) & 0xf000)
591 num_cache_leaves = 4;
592 else
593 num_cache_leaves = 3;
594 }
595}
596
575unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) 597unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
576{ 598{
577 /* Cache sizes */ 599 /* Cache sizes */
@@ -588,7 +610,7 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
588 610
589 if (is_initialized == 0) { 611 if (is_initialized == 0) {
590 /* Init num_cache_leaves from boot CPU */ 612 /* Init num_cache_leaves from boot CPU */
591 num_cache_leaves = find_num_cache_leaves(); 613 num_cache_leaves = find_num_cache_leaves(c);
592 is_initialized++; 614 is_initialized++;
593 } 615 }
594 616
@@ -728,37 +750,50 @@ static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info);
728static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index) 750static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)
729{ 751{
730 struct _cpuid4_info *this_leaf; 752 struct _cpuid4_info *this_leaf;
731 int ret, i, sibling; 753 int i, sibling;
732 struct cpuinfo_x86 *c = &cpu_data(cpu);
733 754
734 ret = 0; 755 if (cpu_has_topoext) {
735 if (index == 3) { 756 unsigned int apicid, nshared, first, last;
736 ret = 1; 757
737 for_each_cpu(i, cpu_llc_shared_mask(cpu)) { 758 if (!per_cpu(ici_cpuid4_info, cpu))
759 return 0;
760
761 this_leaf = CPUID4_INFO_IDX(cpu, index);
762 nshared = this_leaf->base.eax.split.num_threads_sharing + 1;
763 apicid = cpu_data(cpu).apicid;
764 first = apicid - (apicid % nshared);
765 last = first + nshared - 1;
766
767 for_each_online_cpu(i) {
768 apicid = cpu_data(i).apicid;
769 if ((apicid < first) || (apicid > last))
770 continue;
738 if (!per_cpu(ici_cpuid4_info, i)) 771 if (!per_cpu(ici_cpuid4_info, i))
739 continue; 772 continue;
740 this_leaf = CPUID4_INFO_IDX(i, index); 773 this_leaf = CPUID4_INFO_IDX(i, index);
741 for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) { 774
742 if (!cpu_online(sibling)) 775 for_each_online_cpu(sibling) {
776 apicid = cpu_data(sibling).apicid;
777 if ((apicid < first) || (apicid > last))
743 continue; 778 continue;
744 set_bit(sibling, this_leaf->shared_cpu_map); 779 set_bit(sibling, this_leaf->shared_cpu_map);
745 } 780 }
746 } 781 }
747 } else if ((c->x86 == 0x15) && ((index == 1) || (index == 2))) { 782 } else if (index == 3) {
748 ret = 1; 783 for_each_cpu(i, cpu_llc_shared_mask(cpu)) {
749 for_each_cpu(i, cpu_sibling_mask(cpu)) {
750 if (!per_cpu(ici_cpuid4_info, i)) 784 if (!per_cpu(ici_cpuid4_info, i))
751 continue; 785 continue;
752 this_leaf = CPUID4_INFO_IDX(i, index); 786 this_leaf = CPUID4_INFO_IDX(i, index);
753 for_each_cpu(sibling, cpu_sibling_mask(cpu)) { 787 for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) {
754 if (!cpu_online(sibling)) 788 if (!cpu_online(sibling))
755 continue; 789 continue;
756 set_bit(sibling, this_leaf->shared_cpu_map); 790 set_bit(sibling, this_leaf->shared_cpu_map);
757 } 791 }
758 } 792 }
759 } 793 } else
794 return 0;
760 795
761 return ret; 796 return 1;
762} 797}
763 798
764static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) 799static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index 6a05c1d327a..5b7d4fa5d3b 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -24,8 +24,6 @@ struct mce_bank {
24int mce_severity(struct mce *a, int tolerant, char **msg); 24int mce_severity(struct mce *a, int tolerant, char **msg);
25struct dentry *mce_get_debugfs_dir(void); 25struct dentry *mce_get_debugfs_dir(void);
26 26
27extern int mce_ser;
28
29extern struct mce_bank *mce_banks; 27extern struct mce_bank *mce_banks;
30 28
31#ifdef CONFIG_X86_MCE_INTEL 29#ifdef CONFIG_X86_MCE_INTEL
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index 13017626f9a..beb1f1689e5 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -193,9 +193,9 @@ int mce_severity(struct mce *m, int tolerant, char **msg)
193 continue; 193 continue;
194 if ((m->mcgstatus & s->mcgmask) != s->mcgres) 194 if ((m->mcgstatus & s->mcgmask) != s->mcgres)
195 continue; 195 continue;
196 if (s->ser == SER_REQUIRED && !mce_ser) 196 if (s->ser == SER_REQUIRED && !mca_cfg.ser)
197 continue; 197 continue;
198 if (s->ser == NO_SER && mce_ser) 198 if (s->ser == NO_SER && mca_cfg.ser)
199 continue; 199 continue;
200 if (s->context && ctx != s->context) 200 if (s->context && ctx != s->context)
201 continue; 201 continue;
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 46cbf868969..80dbda84f1c 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -58,34 +58,26 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex);
58#define CREATE_TRACE_POINTS 58#define CREATE_TRACE_POINTS
59#include <trace/events/mce.h> 59#include <trace/events/mce.h>
60 60
61int mce_disabled __read_mostly;
62
63#define SPINUNIT 100 /* 100ns */ 61#define SPINUNIT 100 /* 100ns */
64 62
65atomic_t mce_entry; 63atomic_t mce_entry;
66 64
67DEFINE_PER_CPU(unsigned, mce_exception_count); 65DEFINE_PER_CPU(unsigned, mce_exception_count);
68 66
69/* 67struct mce_bank *mce_banks __read_mostly;
70 * Tolerant levels: 68
71 * 0: always panic on uncorrected errors, log corrected errors 69struct mca_config mca_cfg __read_mostly = {
72 * 1: panic or SIGBUS on uncorrected errors, log corrected errors 70 .bootlog = -1,
73 * 2: SIGBUS or log uncorrected errors (if possible), log corrected errors 71 /*
74 * 3: never panic or SIGBUS, log all errors (for testing only) 72 * Tolerant levels:
75 */ 73 * 0: always panic on uncorrected errors, log corrected errors
76static int tolerant __read_mostly = 1; 74 * 1: panic or SIGBUS on uncorrected errors, log corrected errors
77static int banks __read_mostly; 75 * 2: SIGBUS or log uncorrected errors (if possible), log corr. errors
78static int rip_msr __read_mostly; 76 * 3: never panic or SIGBUS, log all errors (for testing only)
79static int mce_bootlog __read_mostly = -1; 77 */
80static int monarch_timeout __read_mostly = -1; 78 .tolerant = 1,
81static int mce_panic_timeout __read_mostly; 79 .monarch_timeout = -1
82static int mce_dont_log_ce __read_mostly; 80};
83int mce_cmci_disabled __read_mostly;
84int mce_ignore_ce __read_mostly;
85int mce_ser __read_mostly;
86int mce_bios_cmci_threshold __read_mostly;
87
88struct mce_bank *mce_banks __read_mostly;
89 81
90/* User mode helper program triggered by machine check event */ 82/* User mode helper program triggered by machine check event */
91static unsigned long mce_need_notify; 83static unsigned long mce_need_notify;
@@ -302,7 +294,7 @@ static void wait_for_panic(void)
302 while (timeout-- > 0) 294 while (timeout-- > 0)
303 udelay(1); 295 udelay(1);
304 if (panic_timeout == 0) 296 if (panic_timeout == 0)
305 panic_timeout = mce_panic_timeout; 297 panic_timeout = mca_cfg.panic_timeout;
306 panic("Panicing machine check CPU died"); 298 panic("Panicing machine check CPU died");
307} 299}
308 300
@@ -360,7 +352,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
360 pr_emerg(HW_ERR "Machine check: %s\n", exp); 352 pr_emerg(HW_ERR "Machine check: %s\n", exp);
361 if (!fake_panic) { 353 if (!fake_panic) {
362 if (panic_timeout == 0) 354 if (panic_timeout == 0)
363 panic_timeout = mce_panic_timeout; 355 panic_timeout = mca_cfg.panic_timeout;
364 panic(msg); 356 panic(msg);
365 } else 357 } else
366 pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); 358 pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg);
@@ -372,7 +364,7 @@ static int msr_to_offset(u32 msr)
372{ 364{
373 unsigned bank = __this_cpu_read(injectm.bank); 365 unsigned bank = __this_cpu_read(injectm.bank);
374 366
375 if (msr == rip_msr) 367 if (msr == mca_cfg.rip_msr)
376 return offsetof(struct mce, ip); 368 return offsetof(struct mce, ip);
377 if (msr == MSR_IA32_MCx_STATUS(bank)) 369 if (msr == MSR_IA32_MCx_STATUS(bank))
378 return offsetof(struct mce, status); 370 return offsetof(struct mce, status);
@@ -451,8 +443,8 @@ static inline void mce_gather_info(struct mce *m, struct pt_regs *regs)
451 m->cs |= 3; 443 m->cs |= 3;
452 } 444 }
453 /* Use accurate RIP reporting if available. */ 445 /* Use accurate RIP reporting if available. */
454 if (rip_msr) 446 if (mca_cfg.rip_msr)
455 m->ip = mce_rdmsrl(rip_msr); 447 m->ip = mce_rdmsrl(mca_cfg.rip_msr);
456 } 448 }
457} 449}
458 450
@@ -513,7 +505,7 @@ static int mce_ring_add(unsigned long pfn)
513 505
514int mce_available(struct cpuinfo_x86 *c) 506int mce_available(struct cpuinfo_x86 *c)
515{ 507{
516 if (mce_disabled) 508 if (mca_cfg.disabled)
517 return 0; 509 return 0;
518 return cpu_has(c, X86_FEATURE_MCE) && cpu_has(c, X86_FEATURE_MCA); 510 return cpu_has(c, X86_FEATURE_MCE) && cpu_has(c, X86_FEATURE_MCA);
519} 511}
@@ -565,7 +557,7 @@ static void mce_read_aux(struct mce *m, int i)
565 /* 557 /*
566 * Mask the reported address by the reported granularity. 558 * Mask the reported address by the reported granularity.
567 */ 559 */
568 if (mce_ser && (m->status & MCI_STATUS_MISCV)) { 560 if (mca_cfg.ser && (m->status & MCI_STATUS_MISCV)) {
569 u8 shift = MCI_MISC_ADDR_LSB(m->misc); 561 u8 shift = MCI_MISC_ADDR_LSB(m->misc);
570 m->addr >>= shift; 562 m->addr >>= shift;
571 m->addr <<= shift; 563 m->addr <<= shift;
@@ -599,7 +591,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
599 591
600 mce_gather_info(&m, NULL); 592 mce_gather_info(&m, NULL);
601 593
602 for (i = 0; i < banks; i++) { 594 for (i = 0; i < mca_cfg.banks; i++) {
603 if (!mce_banks[i].ctl || !test_bit(i, *b)) 595 if (!mce_banks[i].ctl || !test_bit(i, *b))
604 continue; 596 continue;
605 597
@@ -620,7 +612,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
620 * TBD do the same check for MCI_STATUS_EN here? 612 * TBD do the same check for MCI_STATUS_EN here?
621 */ 613 */
622 if (!(flags & MCP_UC) && 614 if (!(flags & MCP_UC) &&
623 (m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC))) 615 (m.status & (mca_cfg.ser ? MCI_STATUS_S : MCI_STATUS_UC)))
624 continue; 616 continue;
625 617
626 mce_read_aux(&m, i); 618 mce_read_aux(&m, i);
@@ -631,7 +623,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
631 * Don't get the IP here because it's unlikely to 623 * Don't get the IP here because it's unlikely to
632 * have anything to do with the actual error location. 624 * have anything to do with the actual error location.
633 */ 625 */
634 if (!(flags & MCP_DONTLOG) && !mce_dont_log_ce) 626 if (!(flags & MCP_DONTLOG) && !mca_cfg.dont_log_ce)
635 mce_log(&m); 627 mce_log(&m);
636 628
637 /* 629 /*
@@ -658,14 +650,14 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
658{ 650{
659 int i, ret = 0; 651 int i, ret = 0;
660 652
661 for (i = 0; i < banks; i++) { 653 for (i = 0; i < mca_cfg.banks; i++) {
662 m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i)); 654 m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i));
663 if (m->status & MCI_STATUS_VAL) { 655 if (m->status & MCI_STATUS_VAL) {
664 __set_bit(i, validp); 656 __set_bit(i, validp);
665 if (quirk_no_way_out) 657 if (quirk_no_way_out)
666 quirk_no_way_out(i, m, regs); 658 quirk_no_way_out(i, m, regs);
667 } 659 }
668 if (mce_severity(m, tolerant, msg) >= MCE_PANIC_SEVERITY) 660 if (mce_severity(m, mca_cfg.tolerant, msg) >= MCE_PANIC_SEVERITY)
669 ret = 1; 661 ret = 1;
670 } 662 }
671 return ret; 663 return ret;
@@ -696,11 +688,11 @@ static int mce_timed_out(u64 *t)
696 rmb(); 688 rmb();
697 if (atomic_read(&mce_paniced)) 689 if (atomic_read(&mce_paniced))
698 wait_for_panic(); 690 wait_for_panic();
699 if (!monarch_timeout) 691 if (!mca_cfg.monarch_timeout)
700 goto out; 692 goto out;
701 if ((s64)*t < SPINUNIT) { 693 if ((s64)*t < SPINUNIT) {
702 /* CHECKME: Make panic default for 1 too? */ 694 /* CHECKME: Make panic default for 1 too? */
703 if (tolerant < 1) 695 if (mca_cfg.tolerant < 1)
704 mce_panic("Timeout synchronizing machine check over CPUs", 696 mce_panic("Timeout synchronizing machine check over CPUs",
705 NULL, NULL); 697 NULL, NULL);
706 cpu_missing = 1; 698 cpu_missing = 1;
@@ -750,7 +742,8 @@ static void mce_reign(void)
750 * Grade the severity of the errors of all the CPUs. 742 * Grade the severity of the errors of all the CPUs.
751 */ 743 */
752 for_each_possible_cpu(cpu) { 744 for_each_possible_cpu(cpu) {
753 int severity = mce_severity(&per_cpu(mces_seen, cpu), tolerant, 745 int severity = mce_severity(&per_cpu(mces_seen, cpu),
746 mca_cfg.tolerant,
754 &nmsg); 747 &nmsg);
755 if (severity > global_worst) { 748 if (severity > global_worst) {
756 msg = nmsg; 749 msg = nmsg;
@@ -764,7 +757,7 @@ static void mce_reign(void)
764 * This dumps all the mces in the log buffer and stops the 757 * This dumps all the mces in the log buffer and stops the
765 * other CPUs. 758 * other CPUs.
766 */ 759 */
767 if (m && global_worst >= MCE_PANIC_SEVERITY && tolerant < 3) 760 if (m && global_worst >= MCE_PANIC_SEVERITY && mca_cfg.tolerant < 3)
768 mce_panic("Fatal Machine check", m, msg); 761 mce_panic("Fatal Machine check", m, msg);
769 762
770 /* 763 /*
@@ -777,7 +770,7 @@ static void mce_reign(void)
777 * No machine check event found. Must be some external 770 * No machine check event found. Must be some external
778 * source or one CPU is hung. Panic. 771 * source or one CPU is hung. Panic.
779 */ 772 */
780 if (global_worst <= MCE_KEEP_SEVERITY && tolerant < 3) 773 if (global_worst <= MCE_KEEP_SEVERITY && mca_cfg.tolerant < 3)
781 mce_panic("Machine check from unknown source", NULL, NULL); 774 mce_panic("Machine check from unknown source", NULL, NULL);
782 775
783 /* 776 /*
@@ -801,7 +794,7 @@ static int mce_start(int *no_way_out)
801{ 794{
802 int order; 795 int order;
803 int cpus = num_online_cpus(); 796 int cpus = num_online_cpus();
804 u64 timeout = (u64)monarch_timeout * NSEC_PER_USEC; 797 u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC;
805 798
806 if (!timeout) 799 if (!timeout)
807 return -1; 800 return -1;
@@ -865,7 +858,7 @@ static int mce_start(int *no_way_out)
865static int mce_end(int order) 858static int mce_end(int order)
866{ 859{
867 int ret = -1; 860 int ret = -1;
868 u64 timeout = (u64)monarch_timeout * NSEC_PER_USEC; 861 u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC;
869 862
870 if (!timeout) 863 if (!timeout)
871 goto reset; 864 goto reset;
@@ -946,7 +939,7 @@ static void mce_clear_state(unsigned long *toclear)
946{ 939{
947 int i; 940 int i;
948 941
949 for (i = 0; i < banks; i++) { 942 for (i = 0; i < mca_cfg.banks; i++) {
950 if (test_bit(i, toclear)) 943 if (test_bit(i, toclear))
951 mce_wrmsrl(MSR_IA32_MCx_STATUS(i), 0); 944 mce_wrmsrl(MSR_IA32_MCx_STATUS(i), 0);
952 } 945 }
@@ -1011,6 +1004,7 @@ static void mce_clear_info(struct mce_info *mi)
1011 */ 1004 */
1012void do_machine_check(struct pt_regs *regs, long error_code) 1005void do_machine_check(struct pt_regs *regs, long error_code)
1013{ 1006{
1007 struct mca_config *cfg = &mca_cfg;
1014 struct mce m, *final; 1008 struct mce m, *final;
1015 int i; 1009 int i;
1016 int worst = 0; 1010 int worst = 0;
@@ -1022,7 +1016,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1022 int order; 1016 int order;
1023 /* 1017 /*
1024 * If no_way_out gets set, there is no safe way to recover from this 1018 * If no_way_out gets set, there is no safe way to recover from this
1025 * MCE. If tolerant is cranked up, we'll try anyway. 1019 * MCE. If mca_cfg.tolerant is cranked up, we'll try anyway.
1026 */ 1020 */
1027 int no_way_out = 0; 1021 int no_way_out = 0;
1028 /* 1022 /*
@@ -1038,7 +1032,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1038 1032
1039 this_cpu_inc(mce_exception_count); 1033 this_cpu_inc(mce_exception_count);
1040 1034
1041 if (!banks) 1035 if (!cfg->banks)
1042 goto out; 1036 goto out;
1043 1037
1044 mce_gather_info(&m, regs); 1038 mce_gather_info(&m, regs);
@@ -1065,7 +1059,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1065 * because the first one to see it will clear it. 1059 * because the first one to see it will clear it.
1066 */ 1060 */
1067 order = mce_start(&no_way_out); 1061 order = mce_start(&no_way_out);
1068 for (i = 0; i < banks; i++) { 1062 for (i = 0; i < cfg->banks; i++) {
1069 __clear_bit(i, toclear); 1063 __clear_bit(i, toclear);
1070 if (!test_bit(i, valid_banks)) 1064 if (!test_bit(i, valid_banks))
1071 continue; 1065 continue;
@@ -1084,7 +1078,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1084 * Non uncorrected or non signaled errors are handled by 1078 * Non uncorrected or non signaled errors are handled by
1085 * machine_check_poll. Leave them alone, unless this panics. 1079 * machine_check_poll. Leave them alone, unless this panics.
1086 */ 1080 */
1087 if (!(m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC)) && 1081 if (!(m.status & (cfg->ser ? MCI_STATUS_S : MCI_STATUS_UC)) &&
1088 !no_way_out) 1082 !no_way_out)
1089 continue; 1083 continue;
1090 1084
@@ -1093,7 +1087,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1093 */ 1087 */
1094 add_taint(TAINT_MACHINE_CHECK); 1088 add_taint(TAINT_MACHINE_CHECK);
1095 1089
1096 severity = mce_severity(&m, tolerant, NULL); 1090 severity = mce_severity(&m, cfg->tolerant, NULL);
1097 1091
1098 /* 1092 /*
1099 * When machine check was for corrected handler don't touch, 1093 * When machine check was for corrected handler don't touch,
@@ -1117,7 +1111,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1117 * When the ring overflows we just ignore the AO error. 1111 * When the ring overflows we just ignore the AO error.
1118 * RED-PEN add some logging mechanism when 1112 * RED-PEN add some logging mechanism when
1119 * usable_address or mce_add_ring fails. 1113 * usable_address or mce_add_ring fails.
1120 * RED-PEN don't ignore overflow for tolerant == 0 1114 * RED-PEN don't ignore overflow for mca_cfg.tolerant == 0
1121 */ 1115 */
1122 if (severity == MCE_AO_SEVERITY && mce_usable_address(&m)) 1116 if (severity == MCE_AO_SEVERITY && mce_usable_address(&m))
1123 mce_ring_add(m.addr >> PAGE_SHIFT); 1117 mce_ring_add(m.addr >> PAGE_SHIFT);
@@ -1149,7 +1143,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1149 * issues we try to recover, or limit damage to the current 1143 * issues we try to recover, or limit damage to the current
1150 * process. 1144 * process.
1151 */ 1145 */
1152 if (tolerant < 3) { 1146 if (cfg->tolerant < 3) {
1153 if (no_way_out) 1147 if (no_way_out)
1154 mce_panic("Fatal machine check on current CPU", &m, msg); 1148 mce_panic("Fatal machine check on current CPU", &m, msg);
1155 if (worst == MCE_AR_SEVERITY) { 1149 if (worst == MCE_AR_SEVERITY) {
@@ -1377,11 +1371,13 @@ EXPORT_SYMBOL_GPL(mce_notify_irq);
1377static int __cpuinit __mcheck_cpu_mce_banks_init(void) 1371static int __cpuinit __mcheck_cpu_mce_banks_init(void)
1378{ 1372{
1379 int i; 1373 int i;
1374 u8 num_banks = mca_cfg.banks;
1380 1375
1381 mce_banks = kzalloc(banks * sizeof(struct mce_bank), GFP_KERNEL); 1376 mce_banks = kzalloc(num_banks * sizeof(struct mce_bank), GFP_KERNEL);
1382 if (!mce_banks) 1377 if (!mce_banks)
1383 return -ENOMEM; 1378 return -ENOMEM;
1384 for (i = 0; i < banks; i++) { 1379
1380 for (i = 0; i < num_banks; i++) {
1385 struct mce_bank *b = &mce_banks[i]; 1381 struct mce_bank *b = &mce_banks[i];
1386 1382
1387 b->ctl = -1ULL; 1383 b->ctl = -1ULL;
@@ -1401,7 +1397,7 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
1401 rdmsrl(MSR_IA32_MCG_CAP, cap); 1397 rdmsrl(MSR_IA32_MCG_CAP, cap);
1402 1398
1403 b = cap & MCG_BANKCNT_MASK; 1399 b = cap & MCG_BANKCNT_MASK;
1404 if (!banks) 1400 if (!mca_cfg.banks)
1405 pr_info("CPU supports %d MCE banks\n", b); 1401 pr_info("CPU supports %d MCE banks\n", b);
1406 1402
1407 if (b > MAX_NR_BANKS) { 1403 if (b > MAX_NR_BANKS) {
@@ -1411,8 +1407,9 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
1411 } 1407 }
1412 1408
1413 /* Don't support asymmetric configurations today */ 1409 /* Don't support asymmetric configurations today */
1414 WARN_ON(banks != 0 && b != banks); 1410 WARN_ON(mca_cfg.banks != 0 && b != mca_cfg.banks);
1415 banks = b; 1411 mca_cfg.banks = b;
1412
1416 if (!mce_banks) { 1413 if (!mce_banks) {
1417 int err = __mcheck_cpu_mce_banks_init(); 1414 int err = __mcheck_cpu_mce_banks_init();
1418 1415
@@ -1422,25 +1419,29 @@ static int __cpuinit __mcheck_cpu_cap_init(void)
1422 1419
1423 /* Use accurate RIP reporting if available. */ 1420 /* Use accurate RIP reporting if available. */
1424 if ((cap & MCG_EXT_P) && MCG_EXT_CNT(cap) >= 9) 1421 if ((cap & MCG_EXT_P) && MCG_EXT_CNT(cap) >= 9)
1425 rip_msr = MSR_IA32_MCG_EIP; 1422 mca_cfg.rip_msr = MSR_IA32_MCG_EIP;
1426 1423
1427 if (cap & MCG_SER_P) 1424 if (cap & MCG_SER_P)
1428 mce_ser = 1; 1425 mca_cfg.ser = true;
1429 1426
1430 return 0; 1427 return 0;
1431} 1428}
1432 1429
1433static void __mcheck_cpu_init_generic(void) 1430static void __mcheck_cpu_init_generic(void)
1434{ 1431{
1432 enum mcp_flags m_fl = 0;
1435 mce_banks_t all_banks; 1433 mce_banks_t all_banks;
1436 u64 cap; 1434 u64 cap;
1437 int i; 1435 int i;
1438 1436
1437 if (!mca_cfg.bootlog)
1438 m_fl = MCP_DONTLOG;
1439
1439 /* 1440 /*
1440 * Log the machine checks left over from the previous reset. 1441 * Log the machine checks left over from the previous reset.
1441 */ 1442 */
1442 bitmap_fill(all_banks, MAX_NR_BANKS); 1443 bitmap_fill(all_banks, MAX_NR_BANKS);
1443 machine_check_poll(MCP_UC|(!mce_bootlog ? MCP_DONTLOG : 0), &all_banks); 1444 machine_check_poll(MCP_UC | m_fl, &all_banks);
1444 1445
1445 set_in_cr4(X86_CR4_MCE); 1446 set_in_cr4(X86_CR4_MCE);
1446 1447
@@ -1448,7 +1449,7 @@ static void __mcheck_cpu_init_generic(void)
1448 if (cap & MCG_CTL_P) 1449 if (cap & MCG_CTL_P)
1449 wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff); 1450 wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff);
1450 1451
1451 for (i = 0; i < banks; i++) { 1452 for (i = 0; i < mca_cfg.banks; i++) {
1452 struct mce_bank *b = &mce_banks[i]; 1453 struct mce_bank *b = &mce_banks[i];
1453 1454
1454 if (!b->init) 1455 if (!b->init)
@@ -1489,6 +1490,8 @@ static void quirk_sandybridge_ifu(int bank, struct mce *m, struct pt_regs *regs)
1489/* Add per CPU specific workarounds here */ 1490/* Add per CPU specific workarounds here */
1490static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) 1491static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1491{ 1492{
1493 struct mca_config *cfg = &mca_cfg;
1494
1492 if (c->x86_vendor == X86_VENDOR_UNKNOWN) { 1495 if (c->x86_vendor == X86_VENDOR_UNKNOWN) {
1493 pr_info("unknown CPU type - not enabling MCE support\n"); 1496 pr_info("unknown CPU type - not enabling MCE support\n");
1494 return -EOPNOTSUPP; 1497 return -EOPNOTSUPP;
@@ -1496,7 +1499,7 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1496 1499
1497 /* This should be disabled by the BIOS, but isn't always */ 1500 /* This should be disabled by the BIOS, but isn't always */
1498 if (c->x86_vendor == X86_VENDOR_AMD) { 1501 if (c->x86_vendor == X86_VENDOR_AMD) {
1499 if (c->x86 == 15 && banks > 4) { 1502 if (c->x86 == 15 && cfg->banks > 4) {
1500 /* 1503 /*
1501 * disable GART TBL walk error reporting, which 1504 * disable GART TBL walk error reporting, which
1502 * trips off incorrectly with the IOMMU & 3ware 1505 * trips off incorrectly with the IOMMU & 3ware
@@ -1504,18 +1507,18 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1504 */ 1507 */
1505 clear_bit(10, (unsigned long *)&mce_banks[4].ctl); 1508 clear_bit(10, (unsigned long *)&mce_banks[4].ctl);
1506 } 1509 }
1507 if (c->x86 <= 17 && mce_bootlog < 0) { 1510 if (c->x86 <= 17 && cfg->bootlog < 0) {
1508 /* 1511 /*
1509 * Lots of broken BIOS around that don't clear them 1512 * Lots of broken BIOS around that don't clear them
1510 * by default and leave crap in there. Don't log: 1513 * by default and leave crap in there. Don't log:
1511 */ 1514 */
1512 mce_bootlog = 0; 1515 cfg->bootlog = 0;
1513 } 1516 }
1514 /* 1517 /*
1515 * Various K7s with broken bank 0 around. Always disable 1518 * Various K7s with broken bank 0 around. Always disable
1516 * by default. 1519 * by default.
1517 */ 1520 */
1518 if (c->x86 == 6 && banks > 0) 1521 if (c->x86 == 6 && cfg->banks > 0)
1519 mce_banks[0].ctl = 0; 1522 mce_banks[0].ctl = 0;
1520 1523
1521 /* 1524 /*
@@ -1566,7 +1569,7 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1566 * valid event later, merely don't write CTL0. 1569 * valid event later, merely don't write CTL0.
1567 */ 1570 */
1568 1571
1569 if (c->x86 == 6 && c->x86_model < 0x1A && banks > 0) 1572 if (c->x86 == 6 && c->x86_model < 0x1A && cfg->banks > 0)
1570 mce_banks[0].init = 0; 1573 mce_banks[0].init = 0;
1571 1574
1572 /* 1575 /*
@@ -1574,23 +1577,23 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1574 * synchronization with a one second timeout. 1577 * synchronization with a one second timeout.
1575 */ 1578 */
1576 if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) && 1579 if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) &&
1577 monarch_timeout < 0) 1580 cfg->monarch_timeout < 0)
1578 monarch_timeout = USEC_PER_SEC; 1581 cfg->monarch_timeout = USEC_PER_SEC;
1579 1582
1580 /* 1583 /*
1581 * There are also broken BIOSes on some Pentium M and 1584 * There are also broken BIOSes on some Pentium M and
1582 * earlier systems: 1585 * earlier systems:
1583 */ 1586 */
1584 if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0) 1587 if (c->x86 == 6 && c->x86_model <= 13 && cfg->bootlog < 0)
1585 mce_bootlog = 0; 1588 cfg->bootlog = 0;
1586 1589
1587 if (c->x86 == 6 && c->x86_model == 45) 1590 if (c->x86 == 6 && c->x86_model == 45)
1588 quirk_no_way_out = quirk_sandybridge_ifu; 1591 quirk_no_way_out = quirk_sandybridge_ifu;
1589 } 1592 }
1590 if (monarch_timeout < 0) 1593 if (cfg->monarch_timeout < 0)
1591 monarch_timeout = 0; 1594 cfg->monarch_timeout = 0;
1592 if (mce_bootlog != 0) 1595 if (cfg->bootlog != 0)
1593 mce_panic_timeout = 30; 1596 cfg->panic_timeout = 30;
1594 1597
1595 return 0; 1598 return 0;
1596} 1599}
@@ -1635,7 +1638,7 @@ static void mce_start_timer(unsigned int cpu, struct timer_list *t)
1635 1638
1636 __this_cpu_write(mce_next_interval, iv); 1639 __this_cpu_write(mce_next_interval, iv);
1637 1640
1638 if (mce_ignore_ce || !iv) 1641 if (mca_cfg.ignore_ce || !iv)
1639 return; 1642 return;
1640 1643
1641 t->expires = round_jiffies(jiffies + iv); 1644 t->expires = round_jiffies(jiffies + iv);
@@ -1668,7 +1671,7 @@ void (*machine_check_vector)(struct pt_regs *, long error_code) =
1668 */ 1671 */
1669void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c) 1672void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
1670{ 1673{
1671 if (mce_disabled) 1674 if (mca_cfg.disabled)
1672 return; 1675 return;
1673 1676
1674 if (__mcheck_cpu_ancient_init(c)) 1677 if (__mcheck_cpu_ancient_init(c))
@@ -1678,7 +1681,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
1678 return; 1681 return;
1679 1682
1680 if (__mcheck_cpu_cap_init() < 0 || __mcheck_cpu_apply_quirks(c) < 0) { 1683 if (__mcheck_cpu_cap_init() < 0 || __mcheck_cpu_apply_quirks(c) < 0) {
1681 mce_disabled = 1; 1684 mca_cfg.disabled = true;
1682 return; 1685 return;
1683 } 1686 }
1684 1687
@@ -1951,6 +1954,8 @@ static struct miscdevice mce_chrdev_device = {
1951 */ 1954 */
1952static int __init mcheck_enable(char *str) 1955static int __init mcheck_enable(char *str)
1953{ 1956{
1957 struct mca_config *cfg = &mca_cfg;
1958
1954 if (*str == 0) { 1959 if (*str == 0) {
1955 enable_p5_mce(); 1960 enable_p5_mce();
1956 return 1; 1961 return 1;
@@ -1958,22 +1963,22 @@ static int __init mcheck_enable(char *str)
1958 if (*str == '=') 1963 if (*str == '=')
1959 str++; 1964 str++;
1960 if (!strcmp(str, "off")) 1965 if (!strcmp(str, "off"))
1961 mce_disabled = 1; 1966 cfg->disabled = true;
1962 else if (!strcmp(str, "no_cmci")) 1967 else if (!strcmp(str, "no_cmci"))
1963 mce_cmci_disabled = 1; 1968 cfg->cmci_disabled = true;
1964 else if (!strcmp(str, "dont_log_ce")) 1969 else if (!strcmp(str, "dont_log_ce"))
1965 mce_dont_log_ce = 1; 1970 cfg->dont_log_ce = true;
1966 else if (!strcmp(str, "ignore_ce")) 1971 else if (!strcmp(str, "ignore_ce"))
1967 mce_ignore_ce = 1; 1972 cfg->ignore_ce = true;
1968 else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog")) 1973 else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
1969 mce_bootlog = (str[0] == 'b'); 1974 cfg->bootlog = (str[0] == 'b');
1970 else if (!strcmp(str, "bios_cmci_threshold")) 1975 else if (!strcmp(str, "bios_cmci_threshold"))
1971 mce_bios_cmci_threshold = 1; 1976 cfg->bios_cmci_threshold = true;
1972 else if (isdigit(str[0])) { 1977 else if (isdigit(str[0])) {
1973 get_option(&str, &tolerant); 1978 get_option(&str, &(cfg->tolerant));
1974 if (*str == ',') { 1979 if (*str == ',') {
1975 ++str; 1980 ++str;
1976 get_option(&str, &monarch_timeout); 1981 get_option(&str, &(cfg->monarch_timeout));
1977 } 1982 }
1978 } else { 1983 } else {
1979 pr_info("mce argument %s ignored. Please use /sys\n", str); 1984 pr_info("mce argument %s ignored. Please use /sys\n", str);
@@ -2002,7 +2007,7 @@ static int mce_disable_error_reporting(void)
2002{ 2007{
2003 int i; 2008 int i;
2004 2009
2005 for (i = 0; i < banks; i++) { 2010 for (i = 0; i < mca_cfg.banks; i++) {
2006 struct mce_bank *b = &mce_banks[i]; 2011 struct mce_bank *b = &mce_banks[i];
2007 2012
2008 if (b->init) 2013 if (b->init)
@@ -2142,15 +2147,15 @@ static ssize_t set_ignore_ce(struct device *s,
2142 if (strict_strtoull(buf, 0, &new) < 0) 2147 if (strict_strtoull(buf, 0, &new) < 0)
2143 return -EINVAL; 2148 return -EINVAL;
2144 2149
2145 if (mce_ignore_ce ^ !!new) { 2150 if (mca_cfg.ignore_ce ^ !!new) {
2146 if (new) { 2151 if (new) {
2147 /* disable ce features */ 2152 /* disable ce features */
2148 mce_timer_delete_all(); 2153 mce_timer_delete_all();
2149 on_each_cpu(mce_disable_cmci, NULL, 1); 2154 on_each_cpu(mce_disable_cmci, NULL, 1);
2150 mce_ignore_ce = 1; 2155 mca_cfg.ignore_ce = true;
2151 } else { 2156 } else {
2152 /* enable ce features */ 2157 /* enable ce features */
2153 mce_ignore_ce = 0; 2158 mca_cfg.ignore_ce = false;
2154 on_each_cpu(mce_enable_ce, (void *)1, 1); 2159 on_each_cpu(mce_enable_ce, (void *)1, 1);
2155 } 2160 }
2156 } 2161 }
@@ -2166,14 +2171,14 @@ static ssize_t set_cmci_disabled(struct device *s,
2166 if (strict_strtoull(buf, 0, &new) < 0) 2171 if (strict_strtoull(buf, 0, &new) < 0)
2167 return -EINVAL; 2172 return -EINVAL;
2168 2173
2169 if (mce_cmci_disabled ^ !!new) { 2174 if (mca_cfg.cmci_disabled ^ !!new) {
2170 if (new) { 2175 if (new) {
2171 /* disable cmci */ 2176 /* disable cmci */
2172 on_each_cpu(mce_disable_cmci, NULL, 1); 2177 on_each_cpu(mce_disable_cmci, NULL, 1);
2173 mce_cmci_disabled = 1; 2178 mca_cfg.cmci_disabled = true;
2174 } else { 2179 } else {
2175 /* enable cmci */ 2180 /* enable cmci */
2176 mce_cmci_disabled = 0; 2181 mca_cfg.cmci_disabled = false;
2177 on_each_cpu(mce_enable_ce, NULL, 1); 2182 on_each_cpu(mce_enable_ce, NULL, 1);
2178 } 2183 }
2179 } 2184 }
@@ -2190,9 +2195,9 @@ static ssize_t store_int_with_restart(struct device *s,
2190} 2195}
2191 2196
2192static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger); 2197static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger);
2193static DEVICE_INT_ATTR(tolerant, 0644, tolerant); 2198static DEVICE_INT_ATTR(tolerant, 0644, mca_cfg.tolerant);
2194static DEVICE_INT_ATTR(monarch_timeout, 0644, monarch_timeout); 2199static DEVICE_INT_ATTR(monarch_timeout, 0644, mca_cfg.monarch_timeout);
2195static DEVICE_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); 2200static DEVICE_BOOL_ATTR(dont_log_ce, 0644, mca_cfg.dont_log_ce);
2196 2201
2197static struct dev_ext_attribute dev_attr_check_interval = { 2202static struct dev_ext_attribute dev_attr_check_interval = {
2198 __ATTR(check_interval, 0644, device_show_int, store_int_with_restart), 2203 __ATTR(check_interval, 0644, device_show_int, store_int_with_restart),
@@ -2200,13 +2205,13 @@ static struct dev_ext_attribute dev_attr_check_interval = {
2200}; 2205};
2201 2206
2202static struct dev_ext_attribute dev_attr_ignore_ce = { 2207static struct dev_ext_attribute dev_attr_ignore_ce = {
2203 __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce), 2208 __ATTR(ignore_ce, 0644, device_show_bool, set_ignore_ce),
2204 &mce_ignore_ce 2209 &mca_cfg.ignore_ce
2205}; 2210};
2206 2211
2207static struct dev_ext_attribute dev_attr_cmci_disabled = { 2212static struct dev_ext_attribute dev_attr_cmci_disabled = {
2208 __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled), 2213 __ATTR(cmci_disabled, 0644, device_show_bool, set_cmci_disabled),
2209 &mce_cmci_disabled 2214 &mca_cfg.cmci_disabled
2210}; 2215};
2211 2216
2212static struct device_attribute *mce_device_attrs[] = { 2217static struct device_attribute *mce_device_attrs[] = {
@@ -2253,7 +2258,7 @@ static __cpuinit int mce_device_create(unsigned int cpu)
2253 if (err) 2258 if (err)
2254 goto error; 2259 goto error;
2255 } 2260 }
2256 for (j = 0; j < banks; j++) { 2261 for (j = 0; j < mca_cfg.banks; j++) {
2257 err = device_create_file(dev, &mce_banks[j].attr); 2262 err = device_create_file(dev, &mce_banks[j].attr);
2258 if (err) 2263 if (err)
2259 goto error2; 2264 goto error2;
@@ -2285,7 +2290,7 @@ static __cpuinit void mce_device_remove(unsigned int cpu)
2285 for (i = 0; mce_device_attrs[i]; i++) 2290 for (i = 0; mce_device_attrs[i]; i++)
2286 device_remove_file(dev, mce_device_attrs[i]); 2291 device_remove_file(dev, mce_device_attrs[i]);
2287 2292
2288 for (i = 0; i < banks; i++) 2293 for (i = 0; i < mca_cfg.banks; i++)
2289 device_remove_file(dev, &mce_banks[i].attr); 2294 device_remove_file(dev, &mce_banks[i].attr);
2290 2295
2291 device_unregister(dev); 2296 device_unregister(dev);
@@ -2304,7 +2309,7 @@ static void __cpuinit mce_disable_cpu(void *h)
2304 2309
2305 if (!(action & CPU_TASKS_FROZEN)) 2310 if (!(action & CPU_TASKS_FROZEN))
2306 cmci_clear(); 2311 cmci_clear();
2307 for (i = 0; i < banks; i++) { 2312 for (i = 0; i < mca_cfg.banks; i++) {
2308 struct mce_bank *b = &mce_banks[i]; 2313 struct mce_bank *b = &mce_banks[i];
2309 2314
2310 if (b->init) 2315 if (b->init)
@@ -2322,7 +2327,7 @@ static void __cpuinit mce_reenable_cpu(void *h)
2322 2327
2323 if (!(action & CPU_TASKS_FROZEN)) 2328 if (!(action & CPU_TASKS_FROZEN))
2324 cmci_reenable(); 2329 cmci_reenable();
2325 for (i = 0; i < banks; i++) { 2330 for (i = 0; i < mca_cfg.banks; i++) {
2326 struct mce_bank *b = &mce_banks[i]; 2331 struct mce_bank *b = &mce_banks[i];
2327 2332
2328 if (b->init) 2333 if (b->init)
@@ -2375,7 +2380,7 @@ static __init void mce_init_banks(void)
2375{ 2380{
2376 int i; 2381 int i;
2377 2382
2378 for (i = 0; i < banks; i++) { 2383 for (i = 0; i < mca_cfg.banks; i++) {
2379 struct mce_bank *b = &mce_banks[i]; 2384 struct mce_bank *b = &mce_banks[i];
2380 struct device_attribute *a = &b->attr; 2385 struct device_attribute *a = &b->attr;
2381 2386
@@ -2426,7 +2431,7 @@ device_initcall_sync(mcheck_init_device);
2426 */ 2431 */
2427static int __init mcheck_disable(char *str) 2432static int __init mcheck_disable(char *str)
2428{ 2433{
2429 mce_disabled = 1; 2434 mca_cfg.disabled = true;
2430 return 1; 2435 return 1;
2431} 2436}
2432__setup("nomce", mcheck_disable); 2437__setup("nomce", mcheck_disable);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 4f9a3cbfc4a..402c454fbff 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -53,7 +53,7 @@ static int cmci_supported(int *banks)
53{ 53{
54 u64 cap; 54 u64 cap;
55 55
56 if (mce_cmci_disabled || mce_ignore_ce) 56 if (mca_cfg.cmci_disabled || mca_cfg.ignore_ce)
57 return 0; 57 return 0;
58 58
59 /* 59 /*
@@ -200,7 +200,7 @@ static void cmci_discover(int banks)
200 continue; 200 continue;
201 } 201 }
202 202
203 if (!mce_bios_cmci_threshold) { 203 if (!mca_cfg.bios_cmci_threshold) {
204 val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK; 204 val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK;
205 val |= CMCI_THRESHOLD; 205 val |= CMCI_THRESHOLD;
206 } else if (!(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) { 206 } else if (!(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) {
@@ -227,7 +227,7 @@ static void cmci_discover(int banks)
227 * set the thresholds properly or does not work with 227 * set the thresholds properly or does not work with
228 * this boot option. Note down now and report later. 228 * this boot option. Note down now and report later.
229 */ 229 */
230 if (mce_bios_cmci_threshold && bios_zero_thresh && 230 if (mca_cfg.bios_cmci_threshold && bios_zero_thresh &&
231 (val & MCI_CTL2_CMCI_THRESHOLD_MASK)) 231 (val & MCI_CTL2_CMCI_THRESHOLD_MASK))
232 bios_wrong_thresh = 1; 232 bios_wrong_thresh = 1;
233 } else { 233 } else {
@@ -235,7 +235,7 @@ static void cmci_discover(int banks)
235 } 235 }
236 } 236 }
237 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); 237 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
238 if (mce_bios_cmci_threshold && bios_wrong_thresh) { 238 if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) {
239 pr_info_once( 239 pr_info_once(
240 "bios_cmci_threshold: Some banks do not have valid thresholds set\n"); 240 "bios_cmci_threshold: Some banks do not have valid thresholds set\n");
241 pr_info_once( 241 pr_info_once(
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 6b96110bb0c..726bf963c22 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -606,7 +606,7 @@ void __init mtrr_bp_init(void)
606 606
607 /* 607 /*
608 * This is an AMD specific MSR, but we assume(hope?) that 608 * This is an AMD specific MSR, but we assume(hope?) that
609 * Intel will implement it to when they extend the address 609 * Intel will implement it too when they extend the address
610 * bus of the Xeon. 610 * bus of the Xeon.
611 */ 611 */
612 if (cpuid_eax(0x80000000) >= 0x80000008) { 612 if (cpuid_eax(0x80000000) >= 0x80000008) {
@@ -695,11 +695,16 @@ void mtrr_ap_init(void)
695} 695}
696 696
697/** 697/**
698 * Save current fixed-range MTRR state of the BSP 698 * Save current fixed-range MTRR state of the first cpu in cpu_online_mask.
699 */ 699 */
700void mtrr_save_state(void) 700void mtrr_save_state(void)
701{ 701{
702 smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1); 702 int first_cpu;
703
704 get_online_cpus();
705 first_cpu = cpumask_first(cpu_online_mask);
706 smp_call_function_single(first_cpu, mtrr_save_fixed_ranges, NULL, 1);
707 put_online_cpus();
703} 708}
704 709
705void set_mtrr_aps_delayed_init(void) 710void set_mtrr_aps_delayed_init(void)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 4a3374e61a9..4428fd178bc 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1316,6 +1316,121 @@ static struct attribute_group x86_pmu_format_group = {
1316 .attrs = NULL, 1316 .attrs = NULL,
1317}; 1317};
1318 1318
1319struct perf_pmu_events_attr {
1320 struct device_attribute attr;
1321 u64 id;
1322};
1323
1324/*
1325 * Remove all undefined events (x86_pmu.event_map(id) == 0)
1326 * out of events_attr attributes.
1327 */
1328static void __init filter_events(struct attribute **attrs)
1329{
1330 int i, j;
1331
1332 for (i = 0; attrs[i]; i++) {
1333 if (x86_pmu.event_map(i))
1334 continue;
1335
1336 for (j = i; attrs[j]; j++)
1337 attrs[j] = attrs[j + 1];
1338
1339 /* Check the shifted attr. */
1340 i--;
1341 }
1342}
1343
1344static ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
1345 char *page)
1346{
1347 struct perf_pmu_events_attr *pmu_attr = \
1348 container_of(attr, struct perf_pmu_events_attr, attr);
1349
1350 u64 config = x86_pmu.event_map(pmu_attr->id);
1351 return x86_pmu.events_sysfs_show(page, config);
1352}
1353
1354#define EVENT_VAR(_id) event_attr_##_id
1355#define EVENT_PTR(_id) &event_attr_##_id.attr.attr
1356
1357#define EVENT_ATTR(_name, _id) \
1358static struct perf_pmu_events_attr EVENT_VAR(_id) = { \
1359 .attr = __ATTR(_name, 0444, events_sysfs_show, NULL), \
1360 .id = PERF_COUNT_HW_##_id, \
1361};
1362
1363EVENT_ATTR(cpu-cycles, CPU_CYCLES );
1364EVENT_ATTR(instructions, INSTRUCTIONS );
1365EVENT_ATTR(cache-references, CACHE_REFERENCES );
1366EVENT_ATTR(cache-misses, CACHE_MISSES );
1367EVENT_ATTR(branch-instructions, BRANCH_INSTRUCTIONS );
1368EVENT_ATTR(branch-misses, BRANCH_MISSES );
1369EVENT_ATTR(bus-cycles, BUS_CYCLES );
1370EVENT_ATTR(stalled-cycles-frontend, STALLED_CYCLES_FRONTEND );
1371EVENT_ATTR(stalled-cycles-backend, STALLED_CYCLES_BACKEND );
1372EVENT_ATTR(ref-cycles, REF_CPU_CYCLES );
1373
1374static struct attribute *empty_attrs;
1375
1376static struct attribute *events_attr[] = {
1377 EVENT_PTR(CPU_CYCLES),
1378 EVENT_PTR(INSTRUCTIONS),
1379 EVENT_PTR(CACHE_REFERENCES),
1380 EVENT_PTR(CACHE_MISSES),
1381 EVENT_PTR(BRANCH_INSTRUCTIONS),
1382 EVENT_PTR(BRANCH_MISSES),
1383 EVENT_PTR(BUS_CYCLES),
1384 EVENT_PTR(STALLED_CYCLES_FRONTEND),
1385 EVENT_PTR(STALLED_CYCLES_BACKEND),
1386 EVENT_PTR(REF_CPU_CYCLES),
1387 NULL,
1388};
1389
1390static struct attribute_group x86_pmu_events_group = {
1391 .name = "events",
1392 .attrs = events_attr,
1393};
1394
1395ssize_t x86_event_sysfs_show(char *page, u64 config, u64 event)
1396{
1397 u64 umask = (config & ARCH_PERFMON_EVENTSEL_UMASK) >> 8;
1398 u64 cmask = (config & ARCH_PERFMON_EVENTSEL_CMASK) >> 24;
1399 bool edge = (config & ARCH_PERFMON_EVENTSEL_EDGE);
1400 bool pc = (config & ARCH_PERFMON_EVENTSEL_PIN_CONTROL);
1401 bool any = (config & ARCH_PERFMON_EVENTSEL_ANY);
1402 bool inv = (config & ARCH_PERFMON_EVENTSEL_INV);
1403 ssize_t ret;
1404
1405 /*
1406 * We have whole page size to spend and just little data
1407 * to write, so we can safely use sprintf.
1408 */
1409 ret = sprintf(page, "event=0x%02llx", event);
1410
1411 if (umask)
1412 ret += sprintf(page + ret, ",umask=0x%02llx", umask);
1413
1414 if (edge)
1415 ret += sprintf(page + ret, ",edge");
1416
1417 if (pc)
1418 ret += sprintf(page + ret, ",pc");
1419
1420 if (any)
1421 ret += sprintf(page + ret, ",any");
1422
1423 if (inv)
1424 ret += sprintf(page + ret, ",inv");
1425
1426 if (cmask)
1427 ret += sprintf(page + ret, ",cmask=0x%02llx", cmask);
1428
1429 ret += sprintf(page + ret, "\n");
1430
1431 return ret;
1432}
1433
1319static int __init init_hw_perf_events(void) 1434static int __init init_hw_perf_events(void)
1320{ 1435{
1321 struct x86_pmu_quirk *quirk; 1436 struct x86_pmu_quirk *quirk;
@@ -1362,6 +1477,11 @@ static int __init init_hw_perf_events(void)
1362 x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */ 1477 x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */
1363 x86_pmu_format_group.attrs = x86_pmu.format_attrs; 1478 x86_pmu_format_group.attrs = x86_pmu.format_attrs;
1364 1479
1480 if (!x86_pmu.events_sysfs_show)
1481 x86_pmu_events_group.attrs = &empty_attrs;
1482 else
1483 filter_events(x86_pmu_events_group.attrs);
1484
1365 pr_info("... version: %d\n", x86_pmu.version); 1485 pr_info("... version: %d\n", x86_pmu.version);
1366 pr_info("... bit width: %d\n", x86_pmu.cntval_bits); 1486 pr_info("... bit width: %d\n", x86_pmu.cntval_bits);
1367 pr_info("... generic registers: %d\n", x86_pmu.num_counters); 1487 pr_info("... generic registers: %d\n", x86_pmu.num_counters);
@@ -1651,6 +1771,7 @@ static struct attribute_group x86_pmu_attr_group = {
1651static const struct attribute_group *x86_pmu_attr_groups[] = { 1771static const struct attribute_group *x86_pmu_attr_groups[] = {
1652 &x86_pmu_attr_group, 1772 &x86_pmu_attr_group,
1653 &x86_pmu_format_group, 1773 &x86_pmu_format_group,
1774 &x86_pmu_events_group,
1654 NULL, 1775 NULL,
1655}; 1776};
1656 1777
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 271d2570029..115c1ea9774 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -354,6 +354,8 @@ struct x86_pmu {
354 int attr_rdpmc; 354 int attr_rdpmc;
355 struct attribute **format_attrs; 355 struct attribute **format_attrs;
356 356
357 ssize_t (*events_sysfs_show)(char *page, u64 config);
358
357 /* 359 /*
358 * CPU Hotplug hooks 360 * CPU Hotplug hooks
359 */ 361 */
@@ -536,6 +538,9 @@ static inline void set_linear_ip(struct pt_regs *regs, unsigned long ip)
536 regs->ip = ip; 538 regs->ip = ip;
537} 539}
538 540
541ssize_t x86_event_sysfs_show(char *page, u64 config, u64 event);
542ssize_t intel_event_sysfs_show(char *page, u64 config);
543
539#ifdef CONFIG_CPU_SUP_AMD 544#ifdef CONFIG_CPU_SUP_AMD
540 545
541int amd_pmu_init(void); 546int amd_pmu_init(void);
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 4528ae7b6ec..c93bc4e813a 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -568,6 +568,14 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *ev
568 } 568 }
569} 569}
570 570
571static ssize_t amd_event_sysfs_show(char *page, u64 config)
572{
573 u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT) |
574 (config & AMD64_EVENTSEL_EVENT) >> 24;
575
576 return x86_event_sysfs_show(page, config, event);
577}
578
571static __initconst const struct x86_pmu amd_pmu = { 579static __initconst const struct x86_pmu amd_pmu = {
572 .name = "AMD", 580 .name = "AMD",
573 .handle_irq = x86_pmu_handle_irq, 581 .handle_irq = x86_pmu_handle_irq,
@@ -591,6 +599,7 @@ static __initconst const struct x86_pmu amd_pmu = {
591 .put_event_constraints = amd_put_event_constraints, 599 .put_event_constraints = amd_put_event_constraints,
592 600
593 .format_attrs = amd_format_attr, 601 .format_attrs = amd_format_attr,
602 .events_sysfs_show = amd_event_sysfs_show,
594 603
595 .cpu_prepare = amd_pmu_cpu_prepare, 604 .cpu_prepare = amd_pmu_cpu_prepare,
596 .cpu_starting = amd_pmu_cpu_starting, 605 .cpu_starting = amd_pmu_cpu_starting,
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 324bb523d9d..93b9e1181f8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1603,6 +1603,13 @@ static struct attribute *intel_arch_formats_attr[] = {
1603 NULL, 1603 NULL,
1604}; 1604};
1605 1605
1606ssize_t intel_event_sysfs_show(char *page, u64 config)
1607{
1608 u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT);
1609
1610 return x86_event_sysfs_show(page, config, event);
1611}
1612
1606static __initconst const struct x86_pmu core_pmu = { 1613static __initconst const struct x86_pmu core_pmu = {
1607 .name = "core", 1614 .name = "core",
1608 .handle_irq = x86_pmu_handle_irq, 1615 .handle_irq = x86_pmu_handle_irq,
@@ -1628,6 +1635,7 @@ static __initconst const struct x86_pmu core_pmu = {
1628 .event_constraints = intel_core_event_constraints, 1635 .event_constraints = intel_core_event_constraints,
1629 .guest_get_msrs = core_guest_get_msrs, 1636 .guest_get_msrs = core_guest_get_msrs,
1630 .format_attrs = intel_arch_formats_attr, 1637 .format_attrs = intel_arch_formats_attr,
1638 .events_sysfs_show = intel_event_sysfs_show,
1631}; 1639};
1632 1640
1633struct intel_shared_regs *allocate_shared_regs(int cpu) 1641struct intel_shared_regs *allocate_shared_regs(int cpu)
@@ -1766,6 +1774,7 @@ static __initconst const struct x86_pmu intel_pmu = {
1766 .pebs_aliases = intel_pebs_aliases_core2, 1774 .pebs_aliases = intel_pebs_aliases_core2,
1767 1775
1768 .format_attrs = intel_arch3_formats_attr, 1776 .format_attrs = intel_arch3_formats_attr,
1777 .events_sysfs_show = intel_event_sysfs_show,
1769 1778
1770 .cpu_prepare = intel_pmu_cpu_prepare, 1779 .cpu_prepare = intel_pmu_cpu_prepare,
1771 .cpu_starting = intel_pmu_cpu_starting, 1780 .cpu_starting = intel_pmu_cpu_starting,
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c
index 7d0270bd793..f2af39f5dc3 100644
--- a/arch/x86/kernel/cpu/perf_event_p6.c
+++ b/arch/x86/kernel/cpu/perf_event_p6.c
@@ -227,6 +227,8 @@ static __initconst const struct x86_pmu p6_pmu = {
227 .event_constraints = p6_event_constraints, 227 .event_constraints = p6_event_constraints,
228 228
229 .format_attrs = intel_p6_formats_attr, 229 .format_attrs = intel_p6_formats_attr,
230 .events_sysfs_show = intel_event_sysfs_show,
231
230}; 232};
231 233
232__init int p6_pmu_init(void) 234__init int p6_pmu_init(void)
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 13ad89971d4..74467feb4dc 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -16,6 +16,7 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/elf.h> 17#include <linux/elf.h>
18#include <linux/elfcore.h> 18#include <linux/elfcore.h>
19#include <linux/module.h>
19 20
20#include <asm/processor.h> 21#include <asm/processor.h>
21#include <asm/hardirq.h> 22#include <asm/hardirq.h>
@@ -30,6 +31,27 @@
30 31
31int in_crash_kexec; 32int in_crash_kexec;
32 33
34/*
35 * This is used to VMCLEAR all VMCSs loaded on the
36 * processor. And when loading kvm_intel module, the
37 * callback function pointer will be assigned.
38 *
39 * protected by rcu.
40 */
41crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss = NULL;
42EXPORT_SYMBOL_GPL(crash_vmclear_loaded_vmcss);
43
44static inline void cpu_crash_vmclear_loaded_vmcss(void)
45{
46 crash_vmclear_fn *do_vmclear_operation = NULL;
47
48 rcu_read_lock();
49 do_vmclear_operation = rcu_dereference(crash_vmclear_loaded_vmcss);
50 if (do_vmclear_operation)
51 do_vmclear_operation();
52 rcu_read_unlock();
53}
54
33#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) 55#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
34 56
35static void kdump_nmi_callback(int cpu, struct pt_regs *regs) 57static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
@@ -46,6 +68,11 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
46#endif 68#endif
47 crash_save_cpu(regs, cpu); 69 crash_save_cpu(regs, cpu);
48 70
71 /*
72 * VMCLEAR VMCSs loaded on all cpus if needed.
73 */
74 cpu_crash_vmclear_loaded_vmcss();
75
49 /* Disable VMX or SVM if needed. 76 /* Disable VMX or SVM if needed.
50 * 77 *
51 * We need to disable virtualization on all CPUs. 78 * We need to disable virtualization on all CPUs.
@@ -88,6 +115,11 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
88 115
89 kdump_nmi_shootdown_cpus(); 116 kdump_nmi_shootdown_cpus();
90 117
118 /*
119 * VMCLEAR VMCSs loaded on this cpu if needed.
120 */
121 cpu_crash_vmclear_loaded_vmcss();
122
91 /* Booting kdump kernel with VMX or SVM enabled won't work, 123 /* Booting kdump kernel with VMX or SVM enabled won't work,
92 * because (among other limitations) we can't disable paging 124 * because (among other limitations) we can't disable paging
93 * with the virt flags. 125 * with the virt flags.
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 88b725aa1d5..c763116c535 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -739,30 +739,12 @@ ENTRY(ptregs_##name) ; \
739ENDPROC(ptregs_##name) 739ENDPROC(ptregs_##name)
740 740
741PTREGSCALL1(iopl) 741PTREGSCALL1(iopl)
742PTREGSCALL0(fork)
743PTREGSCALL0(vfork)
744PTREGSCALL2(sigaltstack) 742PTREGSCALL2(sigaltstack)
745PTREGSCALL0(sigreturn) 743PTREGSCALL0(sigreturn)
746PTREGSCALL0(rt_sigreturn) 744PTREGSCALL0(rt_sigreturn)
747PTREGSCALL2(vm86) 745PTREGSCALL2(vm86)
748PTREGSCALL1(vm86old) 746PTREGSCALL1(vm86old)
749 747
750/* Clone is an oddball. The 4th arg is in %edi */
751ENTRY(ptregs_clone)
752 CFI_STARTPROC
753 leal 4(%esp),%eax
754 pushl_cfi %eax
755 pushl_cfi PT_EDI(%eax)
756 movl PT_EDX(%eax),%ecx
757 movl PT_ECX(%eax),%edx
758 movl PT_EBX(%eax),%eax
759 call sys_clone
760 addl $8,%esp
761 CFI_ADJUST_CFA_OFFSET -8
762 ret
763 CFI_ENDPROC
764ENDPROC(ptregs_clone)
765
766.macro FIXUP_ESPFIX_STACK 748.macro FIXUP_ESPFIX_STACK
767/* 749/*
768 * Switch back for ESPFIX stack to the normal zerobased stack 750 * Switch back for ESPFIX stack to the normal zerobased stack
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1328fe49a3f..70641aff0c2 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -56,7 +56,7 @@
56#include <asm/ftrace.h> 56#include <asm/ftrace.h>
57#include <asm/percpu.h> 57#include <asm/percpu.h>
58#include <asm/asm.h> 58#include <asm/asm.h>
59#include <asm/rcu.h> 59#include <asm/context_tracking.h>
60#include <asm/smap.h> 60#include <asm/smap.h>
61#include <linux/err.h> 61#include <linux/err.h>
62 62
@@ -845,9 +845,25 @@ ENTRY(\label)
845END(\label) 845END(\label)
846 .endm 846 .endm
847 847
848 PTREGSCALL stub_clone, sys_clone, %r8 848 .macro FORK_LIKE func
849 PTREGSCALL stub_fork, sys_fork, %rdi 849ENTRY(stub_\func)
850 PTREGSCALL stub_vfork, sys_vfork, %rdi 850 CFI_STARTPROC
851 popq %r11 /* save return address */
852 PARTIAL_FRAME 0
853 SAVE_REST
854 pushq %r11 /* put it back on stack */
855 FIXUP_TOP_OF_STACK %r11, 8
856 DEFAULT_FRAME 0 8 /* offset 8: return address */
857 call sys_\func
858 RESTORE_TOP_OF_STACK %r11, 8
859 ret $REST_SKIP /* pop extended registers */
860 CFI_ENDPROC
861END(stub_\func)
862 .endm
863
864 FORK_LIKE clone
865 FORK_LIKE fork
866 FORK_LIKE vfork
851 PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx 867 PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx
852 PTREGSCALL stub_iopl, sys_iopl, %rsi 868 PTREGSCALL stub_iopl, sys_iopl, %rsi
853 869
@@ -1699,9 +1715,10 @@ nested_nmi:
1699 1715
17001: 17161:
1701 /* Set up the interrupted NMIs stack to jump to repeat_nmi */ 1717 /* Set up the interrupted NMIs stack to jump to repeat_nmi */
1702 leaq -6*8(%rsp), %rdx 1718 leaq -1*8(%rsp), %rdx
1703 movq %rdx, %rsp 1719 movq %rdx, %rsp
1704 CFI_ADJUST_CFA_OFFSET 6*8 1720 CFI_ADJUST_CFA_OFFSET 1*8
1721 leaq -10*8(%rsp), %rdx
1705 pushq_cfi $__KERNEL_DS 1722 pushq_cfi $__KERNEL_DS
1706 pushq_cfi %rdx 1723 pushq_cfi %rdx
1707 pushfq_cfi 1724 pushfq_cfi
@@ -1709,8 +1726,8 @@ nested_nmi:
1709 pushq_cfi $repeat_nmi 1726 pushq_cfi $repeat_nmi
1710 1727
1711 /* Put stack back */ 1728 /* Put stack back */
1712 addq $(11*8), %rsp 1729 addq $(6*8), %rsp
1713 CFI_ADJUST_CFA_OFFSET -11*8 1730 CFI_ADJUST_CFA_OFFSET -6*8
1714 1731
1715nested_nmi_out: 1732nested_nmi_out:
1716 popq_cfi %rdx 1733 popq_cfi %rdx
@@ -1736,18 +1753,18 @@ first_nmi:
1736 * +-------------------------+ 1753 * +-------------------------+
1737 * | NMI executing variable | 1754 * | NMI executing variable |
1738 * +-------------------------+ 1755 * +-------------------------+
1739 * | Saved SS |
1740 * | Saved Return RSP |
1741 * | Saved RFLAGS |
1742 * | Saved CS |
1743 * | Saved RIP |
1744 * +-------------------------+
1745 * | copied SS | 1756 * | copied SS |
1746 * | copied Return RSP | 1757 * | copied Return RSP |
1747 * | copied RFLAGS | 1758 * | copied RFLAGS |
1748 * | copied CS | 1759 * | copied CS |
1749 * | copied RIP | 1760 * | copied RIP |
1750 * +-------------------------+ 1761 * +-------------------------+
1762 * | Saved SS |
1763 * | Saved Return RSP |
1764 * | Saved RFLAGS |
1765 * | Saved CS |
1766 * | Saved RIP |
1767 * +-------------------------+
1751 * | pt_regs | 1768 * | pt_regs |
1752 * +-------------------------+ 1769 * +-------------------------+
1753 * 1770 *
@@ -1763,9 +1780,14 @@ first_nmi:
1763 /* Set the NMI executing variable on the stack. */ 1780 /* Set the NMI executing variable on the stack. */
1764 pushq_cfi $1 1781 pushq_cfi $1
1765 1782
1783 /*
1784 * Leave room for the "copied" frame
1785 */
1786 subq $(5*8), %rsp
1787
1766 /* Copy the stack frame to the Saved frame */ 1788 /* Copy the stack frame to the Saved frame */
1767 .rept 5 1789 .rept 5
1768 pushq_cfi 6*8(%rsp) 1790 pushq_cfi 11*8(%rsp)
1769 .endr 1791 .endr
1770 CFI_DEF_CFA_OFFSET SS+8-RIP 1792 CFI_DEF_CFA_OFFSET SS+8-RIP
1771 1793
@@ -1786,12 +1808,15 @@ repeat_nmi:
1786 * is benign for the non-repeat case, where 1 was pushed just above 1808 * is benign for the non-repeat case, where 1 was pushed just above
1787 * to this very stack slot). 1809 * to this very stack slot).
1788 */ 1810 */
1789 movq $1, 5*8(%rsp) 1811 movq $1, 10*8(%rsp)
1790 1812
1791 /* Make another copy, this one may be modified by nested NMIs */ 1813 /* Make another copy, this one may be modified by nested NMIs */
1814 addq $(10*8), %rsp
1815 CFI_ADJUST_CFA_OFFSET -10*8
1792 .rept 5 1816 .rept 5
1793 pushq_cfi 4*8(%rsp) 1817 pushq_cfi -6*8(%rsp)
1794 .endr 1818 .endr
1819 subq $(5*8), %rsp
1795 CFI_DEF_CFA_OFFSET SS+8-RIP 1820 CFI_DEF_CFA_OFFSET SS+8-RIP
1796end_repeat_nmi: 1821end_repeat_nmi:
1797 1822
@@ -1842,8 +1867,12 @@ nmi_swapgs:
1842 SWAPGS_UNSAFE_STACK 1867 SWAPGS_UNSAFE_STACK
1843nmi_restore: 1868nmi_restore:
1844 RESTORE_ALL 8 1869 RESTORE_ALL 8
1870
1871 /* Pop the extra iret frame */
1872 addq $(5*8), %rsp
1873
1845 /* Clear the NMI executing stack variable */ 1874 /* Clear the NMI executing stack variable */
1846 movq $0, 10*8(%rsp) 1875 movq $0, 5*8(%rsp)
1847 jmp irq_return 1876 jmp irq_return
1848 CFI_ENDPROC 1877 CFI_ENDPROC
1849END(nmi) 1878END(nmi)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 957a47aec64..8e7f6556028 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -266,6 +266,19 @@ num_subarch_entries = (. - subarch_entries) / 4
266 jmp default_entry 266 jmp default_entry
267#endif /* CONFIG_PARAVIRT */ 267#endif /* CONFIG_PARAVIRT */
268 268
269#ifdef CONFIG_HOTPLUG_CPU
270/*
271 * Boot CPU0 entry point. It's called from play_dead(). Everything has been set
272 * up already except stack. We just set up stack here. Then call
273 * start_secondary().
274 */
275ENTRY(start_cpu0)
276 movl stack_start, %ecx
277 movl %ecx, %esp
278 jmp *(initial_code)
279ENDPROC(start_cpu0)
280#endif
281
269/* 282/*
270 * Non-boot CPU entry point; entered from trampoline.S 283 * Non-boot CPU entry point; entered from trampoline.S
271 * We can't lgdt here, because lgdt itself uses a data segment, but 284 * We can't lgdt here, because lgdt itself uses a data segment, but
@@ -292,8 +305,8 @@ default_entry:
292 * be using the global pages. 305 * be using the global pages.
293 * 306 *
294 * NOTE! If we are on a 486 we may have no cr4 at all! 307 * NOTE! If we are on a 486 we may have no cr4 at all!
295 * Specifically, cr4 exists if and only if CPUID exists, 308 * Specifically, cr4 exists if and only if CPUID exists
296 * which in turn exists if and only if EFLAGS.ID exists. 309 * and has flags other than the FPU flag set.
297 */ 310 */
298 movl $X86_EFLAGS_ID,%ecx 311 movl $X86_EFLAGS_ID,%ecx
299 pushl %ecx 312 pushl %ecx
@@ -308,6 +321,11 @@ default_entry:
308 testl %ecx,%eax 321 testl %ecx,%eax
309 jz 6f # No ID flag = no CPUID = no CR4 322 jz 6f # No ID flag = no CPUID = no CR4
310 323
324 movl $1,%eax
325 cpuid
326 andl $~1,%edx # Ignore CPUID.FPU
327 jz 6f # No flags or only CPUID.FPU = no CR4
328
311 movl pa(mmu_cr4_features),%eax 329 movl pa(mmu_cr4_features),%eax
312 movl %eax,%cr4 330 movl %eax,%cr4
313 331
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 94bf9cc2c7e..980053c4b9c 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -252,6 +252,22 @@ ENTRY(secondary_startup_64)
252 pushq %rax # target address in negative space 252 pushq %rax # target address in negative space
253 lretq 253 lretq
254 254
255#ifdef CONFIG_HOTPLUG_CPU
256/*
257 * Boot CPU0 entry point. It's called from play_dead(). Everything has been set
258 * up already except stack. We just set up stack here. Then call
259 * start_secondary().
260 */
261ENTRY(start_cpu0)
262 movq stack_start(%rip),%rsp
263 movq initial_code(%rip),%rax
264 pushq $0 # fake return address to stop unwinder
265 pushq $__KERNEL_CS # set correct cs
266 pushq %rax # target address in negative space
267 lretq
268ENDPROC(start_cpu0)
269#endif
270
255 /* SMP bootup changes these two */ 271 /* SMP bootup changes these two */
256 __REFDATA 272 __REFDATA
257 .align 8 273 .align 8
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 1460a5df92f..e28670f9a58 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -434,7 +434,7 @@ void hpet_msi_unmask(struct irq_data *data)
434 434
435 /* unmask it */ 435 /* unmask it */
436 cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); 436 cfg = hpet_readl(HPET_Tn_CFG(hdev->num));
437 cfg |= HPET_TN_FSB; 437 cfg |= HPET_TN_ENABLE | HPET_TN_FSB;
438 hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); 438 hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
439} 439}
440 440
@@ -445,7 +445,7 @@ void hpet_msi_mask(struct irq_data *data)
445 445
446 /* mask it */ 446 /* mask it */
447 cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); 447 cfg = hpet_readl(HPET_Tn_CFG(hdev->num));
448 cfg &= ~HPET_TN_FSB; 448 cfg &= ~(HPET_TN_ENABLE | HPET_TN_FSB);
449 hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); 449 hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
450} 450}
451 451
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 675a0501244..245a71db401 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -175,7 +175,11 @@ void __cpuinit fpu_init(void)
175 cr0 |= X86_CR0_EM; 175 cr0 |= X86_CR0_EM;
176 write_cr0(cr0); 176 write_cr0(cr0);
177 177
178 if (!smp_processor_id()) 178 /*
179 * init_thread_xstate is only called once to avoid overriding
180 * xstate_size during boot time or during CPU hotplug.
181 */
182 if (xstate_size == 0)
179 init_thread_xstate(); 183 init_thread_xstate();
180 184
181 mxcsr_feature_mask_init(); 185 mxcsr_feature_mask_init();
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 4180a874c76..08b973f6403 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -42,6 +42,7 @@
42#include <asm/apic.h> 42#include <asm/apic.h>
43#include <asm/apicdef.h> 43#include <asm/apicdef.h>
44#include <asm/hypervisor.h> 44#include <asm/hypervisor.h>
45#include <asm/kvm_guest.h>
45 46
46static int kvmapf = 1; 47static int kvmapf = 1;
47 48
@@ -62,6 +63,15 @@ static int parse_no_stealacc(char *arg)
62 63
63early_param("no-steal-acc", parse_no_stealacc); 64early_param("no-steal-acc", parse_no_stealacc);
64 65
66static int kvmclock_vsyscall = 1;
67static int parse_no_kvmclock_vsyscall(char *arg)
68{
69 kvmclock_vsyscall = 0;
70 return 0;
71}
72
73early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall);
74
65static DEFINE_PER_CPU(struct kvm_vcpu_pv_apf_data, apf_reason) __aligned(64); 75static DEFINE_PER_CPU(struct kvm_vcpu_pv_apf_data, apf_reason) __aligned(64);
66static DEFINE_PER_CPU(struct kvm_steal_time, steal_time) __aligned(64); 76static DEFINE_PER_CPU(struct kvm_steal_time, steal_time) __aligned(64);
67static int has_steal_clock = 0; 77static int has_steal_clock = 0;
@@ -110,11 +120,6 @@ void kvm_async_pf_task_wait(u32 token)
110 struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; 120 struct kvm_task_sleep_head *b = &async_pf_sleepers[key];
111 struct kvm_task_sleep_node n, *e; 121 struct kvm_task_sleep_node n, *e;
112 DEFINE_WAIT(wait); 122 DEFINE_WAIT(wait);
113 int cpu, idle;
114
115 cpu = get_cpu();
116 idle = idle_cpu(cpu);
117 put_cpu();
118 123
119 spin_lock(&b->lock); 124 spin_lock(&b->lock);
120 e = _find_apf_task(b, token); 125 e = _find_apf_task(b, token);
@@ -128,7 +133,7 @@ void kvm_async_pf_task_wait(u32 token)
128 133
129 n.token = token; 134 n.token = token;
130 n.cpu = smp_processor_id(); 135 n.cpu = smp_processor_id();
131 n.halted = idle || preempt_count() > 1; 136 n.halted = is_idle_task(current) || preempt_count() > 1;
132 init_waitqueue_head(&n.wq); 137 init_waitqueue_head(&n.wq);
133 hlist_add_head(&n.link, &b->list); 138 hlist_add_head(&n.link, &b->list);
134 spin_unlock(&b->lock); 139 spin_unlock(&b->lock);
@@ -471,6 +476,9 @@ void __init kvm_guest_init(void)
471 if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) 476 if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
472 apic_set_eoi_write(kvm_guest_apic_eoi_write); 477 apic_set_eoi_write(kvm_guest_apic_eoi_write);
473 478
479 if (kvmclock_vsyscall)
480 kvm_setup_vsyscall_timeinfo();
481
474#ifdef CONFIG_SMP 482#ifdef CONFIG_SMP
475 smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu; 483 smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu;
476 register_cpu_notifier(&kvm_cpu_notifier); 484 register_cpu_notifier(&kvm_cpu_notifier);
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index f1b42b3a186..220a360010f 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -23,6 +23,7 @@
23#include <asm/apic.h> 23#include <asm/apic.h>
24#include <linux/percpu.h> 24#include <linux/percpu.h>
25#include <linux/hardirq.h> 25#include <linux/hardirq.h>
26#include <linux/memblock.h>
26 27
27#include <asm/x86_init.h> 28#include <asm/x86_init.h>
28#include <asm/reboot.h> 29#include <asm/reboot.h>
@@ -39,7 +40,7 @@ static int parse_no_kvmclock(char *arg)
39early_param("no-kvmclock", parse_no_kvmclock); 40early_param("no-kvmclock", parse_no_kvmclock);
40 41
41/* The hypervisor will put information about time periodically here */ 42/* The hypervisor will put information about time periodically here */
42static DEFINE_PER_CPU_SHARED_ALIGNED(struct pvclock_vcpu_time_info, hv_clock); 43static struct pvclock_vsyscall_time_info *hv_clock;
43static struct pvclock_wall_clock wall_clock; 44static struct pvclock_wall_clock wall_clock;
44 45
45/* 46/*
@@ -52,15 +53,20 @@ static unsigned long kvm_get_wallclock(void)
52 struct pvclock_vcpu_time_info *vcpu_time; 53 struct pvclock_vcpu_time_info *vcpu_time;
53 struct timespec ts; 54 struct timespec ts;
54 int low, high; 55 int low, high;
56 int cpu;
55 57
56 low = (int)__pa_symbol(&wall_clock); 58 low = (int)__pa_symbol(&wall_clock);
57 high = ((u64)__pa_symbol(&wall_clock) >> 32); 59 high = ((u64)__pa_symbol(&wall_clock) >> 32);
58 60
59 native_write_msr(msr_kvm_wall_clock, low, high); 61 native_write_msr(msr_kvm_wall_clock, low, high);
60 62
61 vcpu_time = &get_cpu_var(hv_clock); 63 preempt_disable();
64 cpu = smp_processor_id();
65
66 vcpu_time = &hv_clock[cpu].pvti;
62 pvclock_read_wallclock(&wall_clock, vcpu_time, &ts); 67 pvclock_read_wallclock(&wall_clock, vcpu_time, &ts);
63 put_cpu_var(hv_clock); 68
69 preempt_enable();
64 70
65 return ts.tv_sec; 71 return ts.tv_sec;
66} 72}
@@ -74,9 +80,11 @@ static cycle_t kvm_clock_read(void)
74{ 80{
75 struct pvclock_vcpu_time_info *src; 81 struct pvclock_vcpu_time_info *src;
76 cycle_t ret; 82 cycle_t ret;
83 int cpu;
77 84
78 preempt_disable_notrace(); 85 preempt_disable_notrace();
79 src = &__get_cpu_var(hv_clock); 86 cpu = smp_processor_id();
87 src = &hv_clock[cpu].pvti;
80 ret = pvclock_clocksource_read(src); 88 ret = pvclock_clocksource_read(src);
81 preempt_enable_notrace(); 89 preempt_enable_notrace();
82 return ret; 90 return ret;
@@ -99,8 +107,15 @@ static cycle_t kvm_clock_get_cycles(struct clocksource *cs)
99static unsigned long kvm_get_tsc_khz(void) 107static unsigned long kvm_get_tsc_khz(void)
100{ 108{
101 struct pvclock_vcpu_time_info *src; 109 struct pvclock_vcpu_time_info *src;
102 src = &per_cpu(hv_clock, 0); 110 int cpu;
103 return pvclock_tsc_khz(src); 111 unsigned long tsc_khz;
112
113 preempt_disable();
114 cpu = smp_processor_id();
115 src = &hv_clock[cpu].pvti;
116 tsc_khz = pvclock_tsc_khz(src);
117 preempt_enable();
118 return tsc_khz;
104} 119}
105 120
106static void kvm_get_preset_lpj(void) 121static void kvm_get_preset_lpj(void)
@@ -119,10 +134,14 @@ bool kvm_check_and_clear_guest_paused(void)
119{ 134{
120 bool ret = false; 135 bool ret = false;
121 struct pvclock_vcpu_time_info *src; 136 struct pvclock_vcpu_time_info *src;
137 int cpu = smp_processor_id();
122 138
123 src = &__get_cpu_var(hv_clock); 139 if (!hv_clock)
140 return ret;
141
142 src = &hv_clock[cpu].pvti;
124 if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { 143 if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
125 __this_cpu_and(hv_clock.flags, ~PVCLOCK_GUEST_STOPPED); 144 src->flags &= ~PVCLOCK_GUEST_STOPPED;
126 ret = true; 145 ret = true;
127 } 146 }
128 147
@@ -141,9 +160,10 @@ int kvm_register_clock(char *txt)
141{ 160{
142 int cpu = smp_processor_id(); 161 int cpu = smp_processor_id();
143 int low, high, ret; 162 int low, high, ret;
163 struct pvclock_vcpu_time_info *src = &hv_clock[cpu].pvti;
144 164
145 low = (int)__pa(&per_cpu(hv_clock, cpu)) | 1; 165 low = (int)__pa(src) | 1;
146 high = ((u64)__pa(&per_cpu(hv_clock, cpu)) >> 32); 166 high = ((u64)__pa(src) >> 32);
147 ret = native_write_msr_safe(msr_kvm_system_time, low, high); 167 ret = native_write_msr_safe(msr_kvm_system_time, low, high);
148 printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n", 168 printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n",
149 cpu, high, low, txt); 169 cpu, high, low, txt);
@@ -197,6 +217,8 @@ static void kvm_shutdown(void)
197 217
198void __init kvmclock_init(void) 218void __init kvmclock_init(void)
199{ 219{
220 unsigned long mem;
221
200 if (!kvm_para_available()) 222 if (!kvm_para_available())
201 return; 223 return;
202 224
@@ -209,8 +231,18 @@ void __init kvmclock_init(void)
209 printk(KERN_INFO "kvm-clock: Using msrs %x and %x", 231 printk(KERN_INFO "kvm-clock: Using msrs %x and %x",
210 msr_kvm_system_time, msr_kvm_wall_clock); 232 msr_kvm_system_time, msr_kvm_wall_clock);
211 233
212 if (kvm_register_clock("boot clock")) 234 mem = memblock_alloc(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS,
235 PAGE_SIZE);
236 if (!mem)
237 return;
238 hv_clock = __va(mem);
239
240 if (kvm_register_clock("boot clock")) {
241 hv_clock = NULL;
242 memblock_free(mem,
243 sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);
213 return; 244 return;
245 }
214 pv_time_ops.sched_clock = kvm_clock_read; 246 pv_time_ops.sched_clock = kvm_clock_read;
215 x86_platform.calibrate_tsc = kvm_get_tsc_khz; 247 x86_platform.calibrate_tsc = kvm_get_tsc_khz;
216 x86_platform.get_wallclock = kvm_get_wallclock; 248 x86_platform.get_wallclock = kvm_get_wallclock;
@@ -233,3 +265,37 @@ void __init kvmclock_init(void)
233 if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE_STABLE_BIT)) 265 if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE_STABLE_BIT))
234 pvclock_set_flags(PVCLOCK_TSC_STABLE_BIT); 266 pvclock_set_flags(PVCLOCK_TSC_STABLE_BIT);
235} 267}
268
269int __init kvm_setup_vsyscall_timeinfo(void)
270{
271#ifdef CONFIG_X86_64
272 int cpu;
273 int ret;
274 u8 flags;
275 struct pvclock_vcpu_time_info *vcpu_time;
276 unsigned int size;
277
278 size = sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS;
279
280 preempt_disable();
281 cpu = smp_processor_id();
282
283 vcpu_time = &hv_clock[cpu].pvti;
284 flags = pvclock_read_flags(vcpu_time);
285
286 if (!(flags & PVCLOCK_TSC_STABLE_BIT)) {
287 preempt_enable();
288 return 1;
289 }
290
291 if ((ret = pvclock_init_vsyscall(hv_clock, size))) {
292 preempt_enable();
293 return ret;
294 }
295
296 preempt_enable();
297
298 kvm_clock.archdata.vclock_mode = VCLOCK_PVCLOCK;
299#endif
300 return 0;
301}
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index b644e1c765d..2ed787f15bf 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -262,36 +262,6 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
262 propagate_user_return_notify(prev_p, next_p); 262 propagate_user_return_notify(prev_p, next_p);
263} 263}
264 264
265int sys_fork(struct pt_regs *regs)
266{
267 return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
268}
269
270/*
271 * This is trivial, and on the face of it looks like it
272 * could equally well be done in user mode.
273 *
274 * Not so, for quite unobvious reasons - register pressure.
275 * In user mode vfork() cannot have a stack frame, and if
276 * done by calling the "clone()" system call directly, you
277 * do not have enough call-clobbered registers to hold all
278 * the information you need.
279 */
280int sys_vfork(struct pt_regs *regs)
281{
282 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->sp, regs, 0,
283 NULL, NULL);
284}
285
286long
287sys_clone(unsigned long clone_flags, unsigned long newsp,
288 void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
289{
290 if (!newsp)
291 newsp = regs->sp;
292 return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
293}
294
295/* 265/*
296 * Idle related variables and functions 266 * Idle related variables and functions
297 */ 267 */
@@ -306,11 +276,6 @@ void (*pm_idle)(void);
306EXPORT_SYMBOL(pm_idle); 276EXPORT_SYMBOL(pm_idle);
307#endif 277#endif
308 278
309static inline int hlt_use_halt(void)
310{
311 return 1;
312}
313
314#ifndef CONFIG_SMP 279#ifndef CONFIG_SMP
315static inline void play_dead(void) 280static inline void play_dead(void)
316{ 281{
@@ -410,28 +375,22 @@ void cpu_idle(void)
410 */ 375 */
411void default_idle(void) 376void default_idle(void)
412{ 377{
413 if (hlt_use_halt()) { 378 trace_power_start_rcuidle(POWER_CSTATE, 1, smp_processor_id());
414 trace_power_start_rcuidle(POWER_CSTATE, 1, smp_processor_id()); 379 trace_cpu_idle_rcuidle(1, smp_processor_id());
415 trace_cpu_idle_rcuidle(1, smp_processor_id()); 380 current_thread_info()->status &= ~TS_POLLING;
416 current_thread_info()->status &= ~TS_POLLING; 381 /*
417 /* 382 * TS_POLLING-cleared state must be visible before we
418 * TS_POLLING-cleared state must be visible before we 383 * test NEED_RESCHED:
419 * test NEED_RESCHED: 384 */
420 */ 385 smp_mb();
421 smp_mb();
422 386
423 if (!need_resched()) 387 if (!need_resched())
424 safe_halt(); /* enables interrupts racelessly */ 388 safe_halt(); /* enables interrupts racelessly */
425 else 389 else
426 local_irq_enable();
427 current_thread_info()->status |= TS_POLLING;
428 trace_power_end_rcuidle(smp_processor_id());
429 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
430 } else {
431 local_irq_enable(); 390 local_irq_enable();
432 /* loop is done by the caller */ 391 current_thread_info()->status |= TS_POLLING;
433 cpu_relax(); 392 trace_power_end_rcuidle(smp_processor_id());
434 } 393 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
435} 394}
436#ifdef CONFIG_APM_MODULE 395#ifdef CONFIG_APM_MODULE
437EXPORT_SYMBOL(default_idle); 396EXPORT_SYMBOL(default_idle);
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 44e0bff38e7..b5a8905785e 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -128,8 +128,7 @@ void release_thread(struct task_struct *dead_task)
128} 128}
129 129
130int copy_thread(unsigned long clone_flags, unsigned long sp, 130int copy_thread(unsigned long clone_flags, unsigned long sp,
131 unsigned long arg, 131 unsigned long arg, struct task_struct *p)
132 struct task_struct *p, struct pt_regs *regs)
133{ 132{
134 struct pt_regs *childregs = task_pt_regs(p); 133 struct pt_regs *childregs = task_pt_regs(p);
135 struct task_struct *tsk; 134 struct task_struct *tsk;
@@ -138,7 +137,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
138 p->thread.sp = (unsigned long) childregs; 137 p->thread.sp = (unsigned long) childregs;
139 p->thread.sp0 = (unsigned long) (childregs+1); 138 p->thread.sp0 = (unsigned long) (childregs+1);
140 139
141 if (unlikely(!regs)) { 140 if (unlikely(p->flags & PF_KTHREAD)) {
142 /* kernel thread */ 141 /* kernel thread */
143 memset(childregs, 0, sizeof(struct pt_regs)); 142 memset(childregs, 0, sizeof(struct pt_regs));
144 p->thread.ip = (unsigned long) ret_from_kernel_thread; 143 p->thread.ip = (unsigned long) ret_from_kernel_thread;
@@ -156,12 +155,13 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
156 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps)); 155 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
157 return 0; 156 return 0;
158 } 157 }
159 *childregs = *regs; 158 *childregs = *current_pt_regs();
160 childregs->ax = 0; 159 childregs->ax = 0;
161 childregs->sp = sp; 160 if (sp)
161 childregs->sp = sp;
162 162
163 p->thread.ip = (unsigned long) ret_from_fork; 163 p->thread.ip = (unsigned long) ret_from_fork;
164 task_user_gs(p) = get_user_gs(regs); 164 task_user_gs(p) = get_user_gs(current_pt_regs());
165 165
166 p->fpu_counter = 0; 166 p->fpu_counter = 0;
167 p->thread.io_bitmap_ptr = NULL; 167 p->thread.io_bitmap_ptr = NULL;
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 16c6365e2b8..6e68a619496 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -146,8 +146,7 @@ static inline u32 read_32bit_tls(struct task_struct *t, int tls)
146} 146}
147 147
148int copy_thread(unsigned long clone_flags, unsigned long sp, 148int copy_thread(unsigned long clone_flags, unsigned long sp,
149 unsigned long arg, 149 unsigned long arg, struct task_struct *p)
150 struct task_struct *p, struct pt_regs *regs)
151{ 150{
152 int err; 151 int err;
153 struct pt_regs *childregs; 152 struct pt_regs *childregs;
@@ -169,7 +168,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
169 savesegment(ds, p->thread.ds); 168 savesegment(ds, p->thread.ds);
170 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps)); 169 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
171 170
172 if (unlikely(!regs)) { 171 if (unlikely(p->flags & PF_KTHREAD)) {
173 /* kernel thread */ 172 /* kernel thread */
174 memset(childregs, 0, sizeof(struct pt_regs)); 173 memset(childregs, 0, sizeof(struct pt_regs));
175 childregs->sp = (unsigned long)childregs; 174 childregs->sp = (unsigned long)childregs;
@@ -181,10 +180,11 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
181 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_BIT1; 180 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_BIT1;
182 return 0; 181 return 0;
183 } 182 }
184 *childregs = *regs; 183 *childregs = *current_pt_regs();
185 184
186 childregs->ax = 0; 185 childregs->ax = 0;
187 childregs->sp = sp; 186 if (sp)
187 childregs->sp = sp;
188 188
189 err = -ENOMEM; 189 err = -ENOMEM;
190 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps)); 190 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 5e0596b0632..b629bbe0d9b 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -23,6 +23,7 @@
23#include <linux/hw_breakpoint.h> 23#include <linux/hw_breakpoint.h>
24#include <linux/rcupdate.h> 24#include <linux/rcupdate.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/context_tracking.h>
26 27
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28#include <asm/pgtable.h> 29#include <asm/pgtable.h>
@@ -1491,7 +1492,7 @@ long syscall_trace_enter(struct pt_regs *regs)
1491{ 1492{
1492 long ret = 0; 1493 long ret = 0;
1493 1494
1494 rcu_user_exit(); 1495 user_exit();
1495 1496
1496 /* 1497 /*
1497 * If we stepped into a sysenter/syscall insn, it trapped in 1498 * If we stepped into a sysenter/syscall insn, it trapped in
@@ -1541,6 +1542,13 @@ void syscall_trace_leave(struct pt_regs *regs)
1541{ 1542{
1542 bool step; 1543 bool step;
1543 1544
1545 /*
1546 * We may come here right after calling schedule_user()
1547 * or do_notify_resume(), in which case we can be in RCU
1548 * user mode.
1549 */
1550 user_exit();
1551
1544 audit_syscall_exit(regs); 1552 audit_syscall_exit(regs);
1545 1553
1546 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1554 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
@@ -1557,5 +1565,5 @@ void syscall_trace_leave(struct pt_regs *regs)
1557 if (step || test_thread_flag(TIF_SYSCALL_TRACE)) 1565 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
1558 tracehook_report_syscall_exit(regs, step); 1566 tracehook_report_syscall_exit(regs, step);
1559 1567
1560 rcu_user_enter(); 1568 user_enter();
1561} 1569}
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index 42eb3300dfc..85c39590c1a 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -17,23 +17,13 @@
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/percpu.h> 19#include <linux/percpu.h>
20#include <linux/notifier.h>
21#include <linux/sched.h>
22#include <linux/gfp.h>
23#include <linux/bootmem.h>
24#include <asm/fixmap.h>
20#include <asm/pvclock.h> 25#include <asm/pvclock.h>
21 26
22/*
23 * These are perodically updated
24 * xen: magic shared_info page
25 * kvm: gpa registered via msr
26 * and then copied here.
27 */
28struct pvclock_shadow_time {
29 u64 tsc_timestamp; /* TSC at last update of time vals. */
30 u64 system_timestamp; /* Time, in nanosecs, since boot. */
31 u32 tsc_to_nsec_mul;
32 int tsc_shift;
33 u32 version;
34 u8 flags;
35};
36
37static u8 valid_flags __read_mostly = 0; 27static u8 valid_flags __read_mostly = 0;
38 28
39void pvclock_set_flags(u8 flags) 29void pvclock_set_flags(u8 flags)
@@ -41,34 +31,6 @@ void pvclock_set_flags(u8 flags)
41 valid_flags = flags; 31 valid_flags = flags;
42} 32}
43 33
44static u64 pvclock_get_nsec_offset(struct pvclock_shadow_time *shadow)
45{
46 u64 delta = native_read_tsc() - shadow->tsc_timestamp;
47 return pvclock_scale_delta(delta, shadow->tsc_to_nsec_mul,
48 shadow->tsc_shift);
49}
50
51/*
52 * Reads a consistent set of time-base values from hypervisor,
53 * into a shadow data area.
54 */
55static unsigned pvclock_get_time_values(struct pvclock_shadow_time *dst,
56 struct pvclock_vcpu_time_info *src)
57{
58 do {
59 dst->version = src->version;
60 rmb(); /* fetch version before data */
61 dst->tsc_timestamp = src->tsc_timestamp;
62 dst->system_timestamp = src->system_time;
63 dst->tsc_to_nsec_mul = src->tsc_to_system_mul;
64 dst->tsc_shift = src->tsc_shift;
65 dst->flags = src->flags;
66 rmb(); /* test version after fetching data */
67 } while ((src->version & 1) || (dst->version != src->version));
68
69 return dst->version;
70}
71
72unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src) 34unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src)
73{ 35{
74 u64 pv_tsc_khz = 1000000ULL << 32; 36 u64 pv_tsc_khz = 1000000ULL << 32;
@@ -88,23 +50,32 @@ void pvclock_resume(void)
88 atomic64_set(&last_value, 0); 50 atomic64_set(&last_value, 0);
89} 51}
90 52
53u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src)
54{
55 unsigned version;
56 cycle_t ret;
57 u8 flags;
58
59 do {
60 version = __pvclock_read_cycles(src, &ret, &flags);
61 } while ((src->version & 1) || version != src->version);
62
63 return flags & valid_flags;
64}
65
91cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src) 66cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
92{ 67{
93 struct pvclock_shadow_time shadow;
94 unsigned version; 68 unsigned version;
95 cycle_t ret, offset; 69 cycle_t ret;
96 u64 last; 70 u64 last;
71 u8 flags;
97 72
98 do { 73 do {
99 version = pvclock_get_time_values(&shadow, src); 74 version = __pvclock_read_cycles(src, &ret, &flags);
100 barrier(); 75 } while ((src->version & 1) || version != src->version);
101 offset = pvclock_get_nsec_offset(&shadow);
102 ret = shadow.system_timestamp + offset;
103 barrier();
104 } while (version != src->version);
105 76
106 if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) && 77 if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) &&
107 (shadow.flags & PVCLOCK_TSC_STABLE_BIT)) 78 (flags & PVCLOCK_TSC_STABLE_BIT))
108 return ret; 79 return ret;
109 80
110 /* 81 /*
@@ -156,3 +127,71 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
156 127
157 set_normalized_timespec(ts, now.tv_sec, now.tv_nsec); 128 set_normalized_timespec(ts, now.tv_sec, now.tv_nsec);
158} 129}
130
131static struct pvclock_vsyscall_time_info *pvclock_vdso_info;
132
133static struct pvclock_vsyscall_time_info *
134pvclock_get_vsyscall_user_time_info(int cpu)
135{
136 if (!pvclock_vdso_info) {
137 BUG();
138 return NULL;
139 }
140
141 return &pvclock_vdso_info[cpu];
142}
143
144struct pvclock_vcpu_time_info *pvclock_get_vsyscall_time_info(int cpu)
145{
146 return &pvclock_get_vsyscall_user_time_info(cpu)->pvti;
147}
148
149#ifdef CONFIG_X86_64
150static int pvclock_task_migrate(struct notifier_block *nb, unsigned long l,
151 void *v)
152{
153 struct task_migration_notifier *mn = v;
154 struct pvclock_vsyscall_time_info *pvti;
155
156 pvti = pvclock_get_vsyscall_user_time_info(mn->from_cpu);
157
158 /* this is NULL when pvclock vsyscall is not initialized */
159 if (unlikely(pvti == NULL))
160 return NOTIFY_DONE;
161
162 pvti->migrate_count++;
163
164 return NOTIFY_DONE;
165}
166
167static struct notifier_block pvclock_migrate = {
168 .notifier_call = pvclock_task_migrate,
169};
170
171/*
172 * Initialize the generic pvclock vsyscall state. This will allocate
173 * a/some page(s) for the per-vcpu pvclock information, set up a
174 * fixmap mapping for the page(s)
175 */
176
177int __init pvclock_init_vsyscall(struct pvclock_vsyscall_time_info *i,
178 int size)
179{
180 int idx;
181
182 WARN_ON (size != PVCLOCK_VSYSCALL_NR_PAGES*PAGE_SIZE);
183
184 pvclock_vdso_info = i;
185
186 for (idx = 0; idx <= (PVCLOCK_FIXMAP_END-PVCLOCK_FIXMAP_BEGIN); idx++) {
187 __set_fixmap(PVCLOCK_FIXMAP_BEGIN + idx,
188 __pa_symbol(i) + (idx*PAGE_SIZE),
189 PAGE_KERNEL_VVAR);
190 }
191
192
193 register_task_migration_notifier(&pvclock_migrate);
194
195 return 0;
196}
197#endif
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 4929c1be0ac..801602b5d74 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -195,12 +195,6 @@ void read_persistent_clock(struct timespec *ts)
195 ts->tv_nsec = 0; 195 ts->tv_nsec = 0;
196} 196}
197 197
198unsigned long long native_read_tsc(void)
199{
200 return __native_read_tsc();
201}
202EXPORT_SYMBOL(native_read_tsc);
203
204 198
205static struct resource rtc_resources[] = { 199static struct resource rtc_resources[] = {
206 [0] = { 200 [0] = {
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index ca45696f30f..23ddd558fbd 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -143,11 +143,7 @@ int default_check_phys_apicid_present(int phys_apicid)
143} 143}
144#endif 144#endif
145 145
146#ifndef CONFIG_DEBUG_BOOT_PARAMS
147struct boot_params __initdata boot_params;
148#else
149struct boot_params boot_params; 146struct boot_params boot_params;
150#endif
151 147
152/* 148/*
153 * Machine setup.. 149 * Machine setup..
@@ -956,6 +952,10 @@ void __init setup_arch(char **cmdline_p)
956 952
957 reserve_initrd(); 953 reserve_initrd();
958 954
955#if defined(CONFIG_ACPI) && defined(CONFIG_BLK_DEV_INITRD)
956 acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
957#endif
958
959 reserve_crashkernel(); 959 reserve_crashkernel();
960 960
961 vsmp_init(); 961 vsmp_init();
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 70b27ee6118..fbbb604313a 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -22,6 +22,7 @@
22#include <linux/uaccess.h> 22#include <linux/uaccess.h>
23#include <linux/user-return-notifier.h> 23#include <linux/user-return-notifier.h>
24#include <linux/uprobes.h> 24#include <linux/uprobes.h>
25#include <linux/context_tracking.h>
25 26
26#include <asm/processor.h> 27#include <asm/processor.h>
27#include <asm/ucontext.h> 28#include <asm/ucontext.h>
@@ -816,7 +817,7 @@ static void do_signal(struct pt_regs *regs)
816void 817void
817do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) 818do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
818{ 819{
819 rcu_user_exit(); 820 user_exit();
820 821
821#ifdef CONFIG_X86_MCE 822#ifdef CONFIG_X86_MCE
822 /* notify userspace of pending MCEs */ 823 /* notify userspace of pending MCEs */
@@ -838,7 +839,7 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
838 if (thread_info_flags & _TIF_USER_RETURN_NOTIFY) 839 if (thread_info_flags & _TIF_USER_RETURN_NOTIFY)
839 fire_user_return_notifiers(); 840 fire_user_return_notifiers();
840 841
841 rcu_user_enter(); 842 user_enter();
842} 843}
843 844
844void signal_fault(struct pt_regs *regs, void __user *frame, char *where) 845void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index c80a33bc528..ed0fe385289 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -68,6 +68,8 @@
68#include <asm/mwait.h> 68#include <asm/mwait.h>
69#include <asm/apic.h> 69#include <asm/apic.h>
70#include <asm/io_apic.h> 70#include <asm/io_apic.h>
71#include <asm/i387.h>
72#include <asm/fpu-internal.h>
71#include <asm/setup.h> 73#include <asm/setup.h>
72#include <asm/uv/uv.h> 74#include <asm/uv/uv.h>
73#include <linux/mc146818rtc.h> 75#include <linux/mc146818rtc.h>
@@ -125,8 +127,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_info);
125atomic_t init_deasserted; 127atomic_t init_deasserted;
126 128
127/* 129/*
128 * Report back to the Boot Processor. 130 * Report back to the Boot Processor during boot time or to the caller processor
129 * Running on AP. 131 * during CPU online.
130 */ 132 */
131static void __cpuinit smp_callin(void) 133static void __cpuinit smp_callin(void)
132{ 134{
@@ -138,15 +140,17 @@ static void __cpuinit smp_callin(void)
138 * we may get here before an INIT-deassert IPI reaches 140 * we may get here before an INIT-deassert IPI reaches
139 * our local APIC. We have to wait for the IPI or we'll 141 * our local APIC. We have to wait for the IPI or we'll
140 * lock up on an APIC access. 142 * lock up on an APIC access.
143 *
144 * Since CPU0 is not wakened up by INIT, it doesn't wait for the IPI.
141 */ 145 */
142 if (apic->wait_for_init_deassert) 146 cpuid = smp_processor_id();
147 if (apic->wait_for_init_deassert && cpuid != 0)
143 apic->wait_for_init_deassert(&init_deasserted); 148 apic->wait_for_init_deassert(&init_deasserted);
144 149
145 /* 150 /*
146 * (This works even if the APIC is not enabled.) 151 * (This works even if the APIC is not enabled.)
147 */ 152 */
148 phys_id = read_apic_id(); 153 phys_id = read_apic_id();
149 cpuid = smp_processor_id();
150 if (cpumask_test_cpu(cpuid, cpu_callin_mask)) { 154 if (cpumask_test_cpu(cpuid, cpu_callin_mask)) {
151 panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, 155 panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__,
152 phys_id, cpuid); 156 phys_id, cpuid);
@@ -228,6 +232,8 @@ static void __cpuinit smp_callin(void)
228 cpumask_set_cpu(cpuid, cpu_callin_mask); 232 cpumask_set_cpu(cpuid, cpu_callin_mask);
229} 233}
230 234
235static int cpu0_logical_apicid;
236static int enable_start_cpu0;
231/* 237/*
232 * Activate a secondary processor. 238 * Activate a secondary processor.
233 */ 239 */
@@ -243,6 +249,8 @@ notrace static void __cpuinit start_secondary(void *unused)
243 preempt_disable(); 249 preempt_disable();
244 smp_callin(); 250 smp_callin();
245 251
252 enable_start_cpu0 = 0;
253
246#ifdef CONFIG_X86_32 254#ifdef CONFIG_X86_32
247 /* switch away from the initial page table */ 255 /* switch away from the initial page table */
248 load_cr3(swapper_pg_dir); 256 load_cr3(swapper_pg_dir);
@@ -279,19 +287,30 @@ notrace static void __cpuinit start_secondary(void *unused)
279 cpu_idle(); 287 cpu_idle();
280} 288}
281 289
290void __init smp_store_boot_cpu_info(void)
291{
292 int id = 0; /* CPU 0 */
293 struct cpuinfo_x86 *c = &cpu_data(id);
294
295 *c = boot_cpu_data;
296 c->cpu_index = id;
297}
298
282/* 299/*
283 * The bootstrap kernel entry code has set these up. Save them for 300 * The bootstrap kernel entry code has set these up. Save them for
284 * a given CPU 301 * a given CPU
285 */ 302 */
286
287void __cpuinit smp_store_cpu_info(int id) 303void __cpuinit smp_store_cpu_info(int id)
288{ 304{
289 struct cpuinfo_x86 *c = &cpu_data(id); 305 struct cpuinfo_x86 *c = &cpu_data(id);
290 306
291 *c = boot_cpu_data; 307 *c = boot_cpu_data;
292 c->cpu_index = id; 308 c->cpu_index = id;
293 if (id != 0) 309 /*
294 identify_secondary_cpu(c); 310 * During boot time, CPU0 has this setup already. Save the info when
311 * bringing up AP or offlined CPU0.
312 */
313 identify_secondary_cpu(c);
295} 314}
296 315
297static bool __cpuinit 316static bool __cpuinit
@@ -313,7 +332,7 @@ do { \
313 332
314static bool __cpuinit match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) 333static bool __cpuinit match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
315{ 334{
316 if (cpu_has(c, X86_FEATURE_TOPOEXT)) { 335 if (cpu_has_topoext) {
317 int cpu1 = c->cpu_index, cpu2 = o->cpu_index; 336 int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
318 337
319 if (c->phys_proc_id == o->phys_proc_id && 338 if (c->phys_proc_id == o->phys_proc_id &&
@@ -481,7 +500,7 @@ void __inquire_remote_apic(int apicid)
481 * won't ... remember to clear down the APIC, etc later. 500 * won't ... remember to clear down the APIC, etc later.
482 */ 501 */
483int __cpuinit 502int __cpuinit
484wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip) 503wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip)
485{ 504{
486 unsigned long send_status, accept_status = 0; 505 unsigned long send_status, accept_status = 0;
487 int maxlvt; 506 int maxlvt;
@@ -489,7 +508,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
489 /* Target chip */ 508 /* Target chip */
490 /* Boot on the stack */ 509 /* Boot on the stack */
491 /* Kick the second */ 510 /* Kick the second */
492 apic_icr_write(APIC_DM_NMI | apic->dest_logical, logical_apicid); 511 apic_icr_write(APIC_DM_NMI | apic->dest_logical, apicid);
493 512
494 pr_debug("Waiting for send to finish...\n"); 513 pr_debug("Waiting for send to finish...\n");
495 send_status = safe_apic_wait_icr_idle(); 514 send_status = safe_apic_wait_icr_idle();
@@ -649,6 +668,63 @@ static void __cpuinit announce_cpu(int cpu, int apicid)
649 node, cpu, apicid); 668 node, cpu, apicid);
650} 669}
651 670
671static int wakeup_cpu0_nmi(unsigned int cmd, struct pt_regs *regs)
672{
673 int cpu;
674
675 cpu = smp_processor_id();
676 if (cpu == 0 && !cpu_online(cpu) && enable_start_cpu0)
677 return NMI_HANDLED;
678
679 return NMI_DONE;
680}
681
682/*
683 * Wake up AP by INIT, INIT, STARTUP sequence.
684 *
685 * Instead of waiting for STARTUP after INITs, BSP will execute the BIOS
686 * boot-strap code which is not a desired behavior for waking up BSP. To
687 * void the boot-strap code, wake up CPU0 by NMI instead.
688 *
689 * This works to wake up soft offlined CPU0 only. If CPU0 is hard offlined
690 * (i.e. physically hot removed and then hot added), NMI won't wake it up.
691 * We'll change this code in the future to wake up hard offlined CPU0 if
692 * real platform and request are available.
693 */
694static int __cpuinit
695wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid,
696 int *cpu0_nmi_registered)
697{
698 int id;
699 int boot_error;
700
701 /*
702 * Wake up AP by INIT, INIT, STARTUP sequence.
703 */
704 if (cpu)
705 return wakeup_secondary_cpu_via_init(apicid, start_ip);
706
707 /*
708 * Wake up BSP by nmi.
709 *
710 * Register a NMI handler to help wake up CPU0.
711 */
712 boot_error = register_nmi_handler(NMI_LOCAL,
713 wakeup_cpu0_nmi, 0, "wake_cpu0");
714
715 if (!boot_error) {
716 enable_start_cpu0 = 1;
717 *cpu0_nmi_registered = 1;
718 if (apic->dest_logical == APIC_DEST_LOGICAL)
719 id = cpu0_logical_apicid;
720 else
721 id = apicid;
722 boot_error = wakeup_secondary_cpu_via_nmi(id, start_ip);
723 }
724
725 return boot_error;
726}
727
652/* 728/*
653 * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad 729 * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad
654 * (ie clustered apic addressing mode), this is a LOGICAL apic ID. 730 * (ie clustered apic addressing mode), this is a LOGICAL apic ID.
@@ -664,6 +740,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
664 740
665 unsigned long boot_error = 0; 741 unsigned long boot_error = 0;
666 int timeout; 742 int timeout;
743 int cpu0_nmi_registered = 0;
667 744
668 /* Just in case we booted with a single CPU. */ 745 /* Just in case we booted with a single CPU. */
669 alternatives_enable_smp(); 746 alternatives_enable_smp();
@@ -711,13 +788,16 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
711 } 788 }
712 789
713 /* 790 /*
714 * Kick the secondary CPU. Use the method in the APIC driver 791 * Wake up a CPU in difference cases:
715 * if it's defined - or use an INIT boot APIC message otherwise: 792 * - Use the method in the APIC driver if it's defined
793 * Otherwise,
794 * - Use an INIT boot APIC message for APs or NMI for BSP.
716 */ 795 */
717 if (apic->wakeup_secondary_cpu) 796 if (apic->wakeup_secondary_cpu)
718 boot_error = apic->wakeup_secondary_cpu(apicid, start_ip); 797 boot_error = apic->wakeup_secondary_cpu(apicid, start_ip);
719 else 798 else
720 boot_error = wakeup_secondary_cpu_via_init(apicid, start_ip); 799 boot_error = wakeup_cpu_via_init_nmi(cpu, start_ip, apicid,
800 &cpu0_nmi_registered);
721 801
722 if (!boot_error) { 802 if (!boot_error) {
723 /* 803 /*
@@ -782,6 +862,13 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
782 */ 862 */
783 smpboot_restore_warm_reset_vector(); 863 smpboot_restore_warm_reset_vector();
784 } 864 }
865 /*
866 * Clean up the nmi handler. Do this after the callin and callout sync
867 * to avoid impact of possible long unregister time.
868 */
869 if (cpu0_nmi_registered)
870 unregister_nmi_handler(NMI_LOCAL, "wake_cpu0");
871
785 return boot_error; 872 return boot_error;
786} 873}
787 874
@@ -795,7 +882,7 @@ int __cpuinit native_cpu_up(unsigned int cpu, struct task_struct *tidle)
795 882
796 pr_debug("++++++++++++++++++++=_---CPU UP %u\n", cpu); 883 pr_debug("++++++++++++++++++++=_---CPU UP %u\n", cpu);
797 884
798 if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid || 885 if (apicid == BAD_APICID ||
799 !physid_isset(apicid, phys_cpu_present_map) || 886 !physid_isset(apicid, phys_cpu_present_map) ||
800 !apic->apic_id_valid(apicid)) { 887 !apic->apic_id_valid(apicid)) {
801 pr_err("%s: bad cpu %d\n", __func__, cpu); 888 pr_err("%s: bad cpu %d\n", __func__, cpu);
@@ -818,6 +905,9 @@ int __cpuinit native_cpu_up(unsigned int cpu, struct task_struct *tidle)
818 905
819 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 906 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
820 907
908 /* the FPU context is blank, nobody can own it */
909 __cpu_disable_lazy_restore(cpu);
910
821 err = do_boot_cpu(apicid, cpu, tidle); 911 err = do_boot_cpu(apicid, cpu, tidle);
822 if (err) { 912 if (err) {
823 pr_debug("do_boot_cpu failed %d\n", err); 913 pr_debug("do_boot_cpu failed %d\n", err);
@@ -990,7 +1080,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
990 /* 1080 /*
991 * Setup boot CPU information 1081 * Setup boot CPU information
992 */ 1082 */
993 smp_store_cpu_info(0); /* Final full version of the data */ 1083 smp_store_boot_cpu_info(); /* Final full version of the data */
994 cpumask_copy(cpu_callin_mask, cpumask_of(0)); 1084 cpumask_copy(cpu_callin_mask, cpumask_of(0));
995 mb(); 1085 mb();
996 1086
@@ -1026,6 +1116,11 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1026 */ 1116 */
1027 setup_local_APIC(); 1117 setup_local_APIC();
1028 1118
1119 if (x2apic_mode)
1120 cpu0_logical_apicid = apic_read(APIC_LDR);
1121 else
1122 cpu0_logical_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
1123
1029 /* 1124 /*
1030 * Enable IO APIC before setting up error vector 1125 * Enable IO APIC before setting up error vector
1031 */ 1126 */
@@ -1214,19 +1309,6 @@ void cpu_disable_common(void)
1214 1309
1215int native_cpu_disable(void) 1310int native_cpu_disable(void)
1216{ 1311{
1217 int cpu = smp_processor_id();
1218
1219 /*
1220 * Perhaps use cpufreq to drop frequency, but that could go
1221 * into generic code.
1222 *
1223 * We won't take down the boot processor on i386 due to some
1224 * interrupts only being able to be serviced by the BSP.
1225 * Especially so if we're not using an IOAPIC -zwane
1226 */
1227 if (cpu == 0)
1228 return -EBUSY;
1229
1230 clear_local_APIC(); 1312 clear_local_APIC();
1231 1313
1232 cpu_disable_common(); 1314 cpu_disable_common();
@@ -1266,6 +1348,14 @@ void play_dead_common(void)
1266 local_irq_disable(); 1348 local_irq_disable();
1267} 1349}
1268 1350
1351static bool wakeup_cpu0(void)
1352{
1353 if (smp_processor_id() == 0 && enable_start_cpu0)
1354 return true;
1355
1356 return false;
1357}
1358
1269/* 1359/*
1270 * We need to flush the caches before going to sleep, lest we have 1360 * We need to flush the caches before going to sleep, lest we have
1271 * dirty data in our caches when we come back up. 1361 * dirty data in our caches when we come back up.
@@ -1329,6 +1419,11 @@ static inline void mwait_play_dead(void)
1329 __monitor(mwait_ptr, 0, 0); 1419 __monitor(mwait_ptr, 0, 0);
1330 mb(); 1420 mb();
1331 __mwait(eax, 0); 1421 __mwait(eax, 0);
1422 /*
1423 * If NMI wants to wake up CPU0, start CPU0.
1424 */
1425 if (wakeup_cpu0())
1426 start_cpu0();
1332 } 1427 }
1333} 1428}
1334 1429
@@ -1339,6 +1434,11 @@ static inline void hlt_play_dead(void)
1339 1434
1340 while (1) { 1435 while (1) {
1341 native_halt(); 1436 native_halt();
1437 /*
1438 * If NMI wants to wake up CPU0, start CPU0.
1439 */
1440 if (wakeup_cpu0())
1441 start_cpu0();
1342 } 1442 }
1343} 1443}
1344 1444
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index b4d3c3927dd..97ef74b88e0 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -21,37 +21,23 @@
21 21
22/* 22/*
23 * Align a virtual address to avoid aliasing in the I$ on AMD F15h. 23 * Align a virtual address to avoid aliasing in the I$ on AMD F15h.
24 *
25 * @flags denotes the allocation direction - bottomup or topdown -
26 * or vDSO; see call sites below.
27 */ 24 */
28unsigned long align_addr(unsigned long addr, struct file *filp, 25static unsigned long get_align_mask(void)
29 enum align_flags flags)
30{ 26{
31 unsigned long tmp_addr;
32
33 /* handle 32- and 64-bit case with a single conditional */ 27 /* handle 32- and 64-bit case with a single conditional */
34 if (va_align.flags < 0 || !(va_align.flags & (2 - mmap_is_ia32()))) 28 if (va_align.flags < 0 || !(va_align.flags & (2 - mmap_is_ia32())))
35 return addr; 29 return 0;
36 30
37 if (!(current->flags & PF_RANDOMIZE)) 31 if (!(current->flags & PF_RANDOMIZE))
38 return addr; 32 return 0;
39
40 if (!((flags & ALIGN_VDSO) || filp))
41 return addr;
42
43 tmp_addr = addr;
44
45 /*
46 * We need an address which is <= than the original
47 * one only when in topdown direction.
48 */
49 if (!(flags & ALIGN_TOPDOWN))
50 tmp_addr += va_align.mask;
51 33
52 tmp_addr &= ~va_align.mask; 34 return va_align.mask;
35}
53 36
54 return tmp_addr; 37unsigned long align_vdso_addr(unsigned long addr)
38{
39 unsigned long align_mask = get_align_mask();
40 return (addr + align_mask) & ~align_mask;
55} 41}
56 42
57static int __init control_va_addr_alignment(char *str) 43static int __init control_va_addr_alignment(char *str)
@@ -126,7 +112,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
126{ 112{
127 struct mm_struct *mm = current->mm; 113 struct mm_struct *mm = current->mm;
128 struct vm_area_struct *vma; 114 struct vm_area_struct *vma;
129 unsigned long start_addr; 115 struct vm_unmapped_area_info info;
130 unsigned long begin, end; 116 unsigned long begin, end;
131 117
132 if (flags & MAP_FIXED) 118 if (flags & MAP_FIXED)
@@ -144,50 +130,16 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
144 (!vma || addr + len <= vma->vm_start)) 130 (!vma || addr + len <= vma->vm_start))
145 return addr; 131 return addr;
146 } 132 }
147 if (((flags & MAP_32BIT) || test_thread_flag(TIF_ADDR32))
148 && len <= mm->cached_hole_size) {
149 mm->cached_hole_size = 0;
150 mm->free_area_cache = begin;
151 }
152 addr = mm->free_area_cache;
153 if (addr < begin)
154 addr = begin;
155 start_addr = addr;
156
157full_search:
158
159 addr = align_addr(addr, filp, 0);
160
161 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
162 /* At this point: (!vma || addr < vma->vm_end). */
163 if (end - len < addr) {
164 /*
165 * Start a new search - just in case we missed
166 * some holes.
167 */
168 if (start_addr != begin) {
169 start_addr = addr = begin;
170 mm->cached_hole_size = 0;
171 goto full_search;
172 }
173 return -ENOMEM;
174 }
175 if (!vma || addr + len <= vma->vm_start) {
176 /*
177 * Remember the place where we stopped the search:
178 */
179 mm->free_area_cache = addr + len;
180 return addr;
181 }
182 if (addr + mm->cached_hole_size < vma->vm_start)
183 mm->cached_hole_size = vma->vm_start - addr;
184 133
185 addr = vma->vm_end; 134 info.flags = 0;
186 addr = align_addr(addr, filp, 0); 135 info.length = len;
187 } 136 info.low_limit = begin;
137 info.high_limit = end;
138 info.align_mask = filp ? get_align_mask() : 0;
139 info.align_offset = pgoff << PAGE_SHIFT;
140 return vm_unmapped_area(&info);
188} 141}
189 142
190
191unsigned long 143unsigned long
192arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, 144arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
193 const unsigned long len, const unsigned long pgoff, 145 const unsigned long len, const unsigned long pgoff,
@@ -195,7 +147,8 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
195{ 147{
196 struct vm_area_struct *vma; 148 struct vm_area_struct *vma;
197 struct mm_struct *mm = current->mm; 149 struct mm_struct *mm = current->mm;
198 unsigned long addr = addr0, start_addr; 150 unsigned long addr = addr0;
151 struct vm_unmapped_area_info info;
199 152
200 /* requested length too big for entire address space */ 153 /* requested length too big for entire address space */
201 if (len > TASK_SIZE) 154 if (len > TASK_SIZE)
@@ -217,51 +170,16 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
217 return addr; 170 return addr;
218 } 171 }
219 172
220 /* check if free_area_cache is useful for us */ 173 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
221 if (len <= mm->cached_hole_size) { 174 info.length = len;
222 mm->cached_hole_size = 0; 175 info.low_limit = PAGE_SIZE;
223 mm->free_area_cache = mm->mmap_base; 176 info.high_limit = mm->mmap_base;
224 } 177 info.align_mask = filp ? get_align_mask() : 0;
225 178 info.align_offset = pgoff << PAGE_SHIFT;
226try_again: 179 addr = vm_unmapped_area(&info);
227 /* either no address requested or can't fit in requested address hole */ 180 if (!(addr & ~PAGE_MASK))
228 start_addr = addr = mm->free_area_cache; 181 return addr;
229 182 VM_BUG_ON(addr != -ENOMEM);
230 if (addr < len)
231 goto fail;
232
233 addr -= len;
234 do {
235 addr = align_addr(addr, filp, ALIGN_TOPDOWN);
236
237 /*
238 * Lookup failure means no vma is above this address,
239 * else if new region fits below vma->vm_start,
240 * return with success:
241 */
242 vma = find_vma(mm, addr);
243 if (!vma || addr+len <= vma->vm_start)
244 /* remember the address as a hint for next time */
245 return mm->free_area_cache = addr;
246
247 /* remember the largest hole we saw so far */
248 if (addr + mm->cached_hole_size < vma->vm_start)
249 mm->cached_hole_size = vma->vm_start - addr;
250
251 /* try just below the current vma->vm_start */
252 addr = vma->vm_start-len;
253 } while (len < vma->vm_start);
254
255fail:
256 /*
257 * if hint left us with no space for the requested
258 * mapping then try again:
259 */
260 if (start_addr != mm->mmap_base) {
261 mm->free_area_cache = mm->mmap_base;
262 mm->cached_hole_size = 0;
263 goto try_again;
264 }
265 183
266bottomup: 184bottomup:
267 /* 185 /*
@@ -270,14 +188,5 @@ bottomup:
270 * can happen with large stack limits and large mmap() 188 * can happen with large stack limits and large mmap()
271 * allocations. 189 * allocations.
272 */ 190 */
273 mm->cached_hole_size = ~0UL; 191 return arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
274 mm->free_area_cache = TASK_UNMAPPED_BASE;
275 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
276 /*
277 * Restore the topdown base:
278 */
279 mm->free_area_cache = mm->mmap_base;
280 mm->cached_hole_size = ~0UL;
281
282 return addr;
283} 192}
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00fad4..d4f460f962e 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -103,71 +103,13 @@ void __init tboot_probe(void)
103 pr_debug("tboot_size: 0x%x\n", tboot->tboot_size); 103 pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
104} 104}
105 105
106static pgd_t *tboot_pg_dir;
107static struct mm_struct tboot_mm = {
108 .mm_rb = RB_ROOT,
109 .pgd = swapper_pg_dir,
110 .mm_users = ATOMIC_INIT(2),
111 .mm_count = ATOMIC_INIT(1),
112 .mmap_sem = __RWSEM_INITIALIZER(init_mm.mmap_sem),
113 .page_table_lock = __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock),
114 .mmlist = LIST_HEAD_INIT(init_mm.mmlist),
115};
116
117static inline void switch_to_tboot_pt(void) 106static inline void switch_to_tboot_pt(void)
118{ 107{
119 write_cr3(virt_to_phys(tboot_pg_dir)); 108#ifdef CONFIG_X86_32
120} 109 load_cr3(initial_page_table);
121 110#else
122static int map_tboot_page(unsigned long vaddr, unsigned long pfn, 111 write_cr3(real_mode_header->trampoline_pgd);
123 pgprot_t prot) 112#endif
124{
125 pgd_t *pgd;
126 pud_t *pud;
127 pmd_t *pmd;
128 pte_t *pte;
129
130 pgd = pgd_offset(&tboot_mm, vaddr);
131 pud = pud_alloc(&tboot_mm, pgd, vaddr);
132 if (!pud)
133 return -1;
134 pmd = pmd_alloc(&tboot_mm, pud, vaddr);
135 if (!pmd)
136 return -1;
137 pte = pte_alloc_map(&tboot_mm, NULL, pmd, vaddr);
138 if (!pte)
139 return -1;
140 set_pte_at(&tboot_mm, vaddr, pte, pfn_pte(pfn, prot));
141 pte_unmap(pte);
142 return 0;
143}
144
145static int map_tboot_pages(unsigned long vaddr, unsigned long start_pfn,
146 unsigned long nr)
147{
148 /* Reuse the original kernel mapping */
149 tboot_pg_dir = pgd_alloc(&tboot_mm);
150 if (!tboot_pg_dir)
151 return -1;
152
153 for (; nr > 0; nr--, vaddr += PAGE_SIZE, start_pfn++) {
154 if (map_tboot_page(vaddr, start_pfn, PAGE_KERNEL_EXEC))
155 return -1;
156 }
157
158 return 0;
159}
160
161static void tboot_create_trampoline(void)
162{
163 u32 map_base, map_size;
164
165 /* Create identity map for tboot shutdown code. */
166 map_base = PFN_DOWN(tboot->tboot_base);
167 map_size = PFN_UP(tboot->tboot_size);
168 if (map_tboot_pages(map_base << PAGE_SHIFT, map_base, map_size))
169 panic("tboot: Error mapping tboot pages (mfns) @ 0x%x, 0x%x\n",
170 map_base, map_size);
171} 113}
172 114
173#ifdef CONFIG_ACPI_SLEEP 115#ifdef CONFIG_ACPI_SLEEP
@@ -225,14 +167,6 @@ void tboot_shutdown(u32 shutdown_type)
225 if (!tboot_enabled()) 167 if (!tboot_enabled())
226 return; 168 return;
227 169
228 /*
229 * if we're being called before the 1:1 mapping is set up then just
230 * return and let the normal shutdown happen; this should only be
231 * due to very early panic()
232 */
233 if (!tboot_pg_dir)
234 return;
235
236 /* if this is S3 then set regions to MAC */ 170 /* if this is S3 then set regions to MAC */
237 if (shutdown_type == TB_SHUTDOWN_S3) 171 if (shutdown_type == TB_SHUTDOWN_S3)
238 if (tboot_setup_sleep()) 172 if (tboot_setup_sleep())
@@ -343,8 +277,6 @@ static __init int tboot_late_init(void)
343 if (!tboot_enabled()) 277 if (!tboot_enabled())
344 return 0; 278 return 0;
345 279
346 tboot_create_trampoline();
347
348 atomic_set(&ap_wfs_count, 0); 280 atomic_set(&ap_wfs_count, 0);
349 register_hotcpu_notifier(&tboot_cpu_notifier); 281 register_hotcpu_notifier(&tboot_cpu_notifier);
350 282
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 76ee97709a0..6e60b5fe224 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -30,23 +30,110 @@
30#include <linux/mmzone.h> 30#include <linux/mmzone.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/smp.h> 32#include <linux/smp.h>
33#include <linux/irq.h>
33#include <asm/cpu.h> 34#include <asm/cpu.h>
34 35
35static DEFINE_PER_CPU(struct x86_cpu, cpu_devices); 36static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
36 37
37#ifdef CONFIG_HOTPLUG_CPU 38#ifdef CONFIG_HOTPLUG_CPU
39
40#ifdef CONFIG_BOOTPARAM_HOTPLUG_CPU0
41static int cpu0_hotpluggable = 1;
42#else
43static int cpu0_hotpluggable;
44static int __init enable_cpu0_hotplug(char *str)
45{
46 cpu0_hotpluggable = 1;
47 return 1;
48}
49
50__setup("cpu0_hotplug", enable_cpu0_hotplug);
51#endif
52
53#ifdef CONFIG_DEBUG_HOTPLUG_CPU0
54/*
55 * This function offlines a CPU as early as possible and allows userspace to
56 * boot up without the CPU. The CPU can be onlined back by user after boot.
57 *
58 * This is only called for debugging CPU offline/online feature.
59 */
60int __ref _debug_hotplug_cpu(int cpu, int action)
61{
62 struct device *dev = get_cpu_device(cpu);
63 int ret;
64
65 if (!cpu_is_hotpluggable(cpu))
66 return -EINVAL;
67
68 cpu_hotplug_driver_lock();
69
70 switch (action) {
71 case 0:
72 ret = cpu_down(cpu);
73 if (!ret) {
74 pr_info("CPU %u is now offline\n", cpu);
75 kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
76 } else
77 pr_debug("Can't offline CPU%d.\n", cpu);
78 break;
79 case 1:
80 ret = cpu_up(cpu);
81 if (!ret)
82 kobject_uevent(&dev->kobj, KOBJ_ONLINE);
83 else
84 pr_debug("Can't online CPU%d.\n", cpu);
85 break;
86 default:
87 ret = -EINVAL;
88 }
89
90 cpu_hotplug_driver_unlock();
91
92 return ret;
93}
94
95static int __init debug_hotplug_cpu(void)
96{
97 _debug_hotplug_cpu(0, 0);
98 return 0;
99}
100
101late_initcall_sync(debug_hotplug_cpu);
102#endif /* CONFIG_DEBUG_HOTPLUG_CPU0 */
103
38int __ref arch_register_cpu(int num) 104int __ref arch_register_cpu(int num)
39{ 105{
106 struct cpuinfo_x86 *c = &cpu_data(num);
107
108 /*
109 * Currently CPU0 is only hotpluggable on Intel platforms. Other
110 * vendors can add hotplug support later.
111 */
112 if (c->x86_vendor != X86_VENDOR_INTEL)
113 cpu0_hotpluggable = 0;
114
40 /* 115 /*
41 * CPU0 cannot be offlined due to several 116 * Two known BSP/CPU0 dependencies: Resume from suspend/hibernate
42 * restrictions and assumptions in kernel. This basically 117 * depends on BSP. PIC interrupts depend on BSP.
43 * doesn't add a control file, one cannot attempt to offline
44 * BSP.
45 * 118 *
46 * Also certain PCI quirks require not to enable hotplug control 119 * If the BSP depencies are under control, one can tell kernel to
47 * for all CPU's. 120 * enable BSP hotplug. This basically adds a control file and
121 * one can attempt to offline BSP.
48 */ 122 */
49 if (num) 123 if (num == 0 && cpu0_hotpluggable) {
124 unsigned int irq;
125 /*
126 * We won't take down the boot processor on i386 if some
127 * interrupts only are able to be serviced by the BSP in PIC.
128 */
129 for_each_active_irq(irq) {
130 if (!IO_APIC_IRQ(irq) && irq_has_action(irq)) {
131 cpu0_hotpluggable = 0;
132 break;
133 }
134 }
135 }
136 if (num || cpu0_hotpluggable)
50 per_cpu(cpu_devices, num).cpu.hotpluggable = 1; 137 per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
51 138
52 return register_cpu(&per_cpu(cpu_devices, num).cpu, num); 139 return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
diff --git a/arch/x86/kernel/trace_clock.c b/arch/x86/kernel/trace_clock.c
new file mode 100644
index 00000000000..25b993729f9
--- /dev/null
+++ b/arch/x86/kernel/trace_clock.c
@@ -0,0 +1,21 @@
1/*
2 * X86 trace clocks
3 */
4#include <asm/trace_clock.h>
5#include <asm/barrier.h>
6#include <asm/msr.h>
7
8/*
9 * trace_clock_x86_tsc(): A clock that is just the cycle counter.
10 *
11 * Unlike the other clocks, this is not in nanoseconds.
12 */
13u64 notrace trace_clock_x86_tsc(void)
14{
15 u64 ret;
16
17 rdtsc_barrier();
18 rdtscll(ret);
19
20 return ret;
21}
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 8276dc6794c..eb8586693e0 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -55,7 +55,7 @@
55#include <asm/i387.h> 55#include <asm/i387.h>
56#include <asm/fpu-internal.h> 56#include <asm/fpu-internal.h>
57#include <asm/mce.h> 57#include <asm/mce.h>
58#include <asm/rcu.h> 58#include <asm/context_tracking.h>
59 59
60#include <asm/mach_traps.h> 60#include <asm/mach_traps.h>
61 61
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index cfa5d4f7ca5..06ccb5073a3 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -77,6 +77,12 @@ unsigned long long
77sched_clock(void) __attribute__((alias("native_sched_clock"))); 77sched_clock(void) __attribute__((alias("native_sched_clock")));
78#endif 78#endif
79 79
80unsigned long long native_read_tsc(void)
81{
82 return __native_read_tsc();
83}
84EXPORT_SYMBOL(native_read_tsc);
85
80int check_tsc_unstable(void) 86int check_tsc_unstable(void)
81{ 87{
82 return tsc_unstable; 88 return tsc_unstable;
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index aafa5557b39..c71025b6746 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -478,6 +478,11 @@ int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
478 regs->ip = current->utask->xol_vaddr; 478 regs->ip = current->utask->xol_vaddr;
479 pre_xol_rip_insn(auprobe, regs, autask); 479 pre_xol_rip_insn(auprobe, regs, autask);
480 480
481 autask->saved_tf = !!(regs->flags & X86_EFLAGS_TF);
482 regs->flags |= X86_EFLAGS_TF;
483 if (test_tsk_thread_flag(current, TIF_BLOCKSTEP))
484 set_task_blockstep(current, false);
485
481 return 0; 486 return 0;
482} 487}
483 488
@@ -603,6 +608,16 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
603 if (auprobe->fixups & UPROBE_FIX_CALL) 608 if (auprobe->fixups & UPROBE_FIX_CALL)
604 result = adjust_ret_addr(regs->sp, correction); 609 result = adjust_ret_addr(regs->sp, correction);
605 610
611 /*
612 * arch_uprobe_pre_xol() doesn't save the state of TIF_BLOCKSTEP
613 * so we can get an extra SIGTRAP if we do not clear TF. We need
614 * to examine the opcode to make it right.
615 */
616 if (utask->autask.saved_tf)
617 send_sig(SIGTRAP, current, 0);
618 else if (!(auprobe->fixups & UPROBE_FIX_SETF))
619 regs->flags &= ~X86_EFLAGS_TF;
620
606 return result; 621 return result;
607} 622}
608 623
@@ -647,6 +662,10 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
647 current->thread.trap_nr = utask->autask.saved_trap_nr; 662 current->thread.trap_nr = utask->autask.saved_trap_nr;
648 handle_riprel_post_xol(auprobe, regs, NULL); 663 handle_riprel_post_xol(auprobe, regs, NULL);
649 instruction_pointer_set(regs, utask->vaddr); 664 instruction_pointer_set(regs, utask->vaddr);
665
666 /* clear TF if it was set by us in arch_uprobe_pre_xol() */
667 if (!utask->autask.saved_tf)
668 regs->flags &= ~X86_EFLAGS_TF;
650} 669}
651 670
652/* 671/*
@@ -676,38 +695,3 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
676 send_sig(SIGTRAP, current, 0); 695 send_sig(SIGTRAP, current, 0);
677 return ret; 696 return ret;
678} 697}
679
680void arch_uprobe_enable_step(struct arch_uprobe *auprobe)
681{
682 struct task_struct *task = current;
683 struct arch_uprobe_task *autask = &task->utask->autask;
684 struct pt_regs *regs = task_pt_regs(task);
685
686 autask->saved_tf = !!(regs->flags & X86_EFLAGS_TF);
687
688 regs->flags |= X86_EFLAGS_TF;
689 if (test_tsk_thread_flag(task, TIF_BLOCKSTEP))
690 set_task_blockstep(task, false);
691}
692
693void arch_uprobe_disable_step(struct arch_uprobe *auprobe)
694{
695 struct task_struct *task = current;
696 struct arch_uprobe_task *autask = &task->utask->autask;
697 bool trapped = (task->utask->state == UTASK_SSTEP_TRAPPED);
698 struct pt_regs *regs = task_pt_regs(task);
699 /*
700 * The state of TIF_BLOCKSTEP was not saved so we can get an extra
701 * SIGTRAP if we do not clear TF. We need to examine the opcode to
702 * make it right.
703 */
704 if (unlikely(trapped)) {
705 if (!autask->saved_tf)
706 regs->flags &= ~X86_EFLAGS_TF;
707 } else {
708 if (autask->saved_tf)
709 send_sig(SIGTRAP, task, 0);
710 else if (!(auprobe->fixups & UPROBE_FIX_SETF))
711 regs->flags &= ~X86_EFLAGS_TF;
712 }
713}
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index 5c9687b1bde..1dfe69cc78a 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -182,7 +182,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
182 if (pud_none_or_clear_bad(pud)) 182 if (pud_none_or_clear_bad(pud))
183 goto out; 183 goto out;
184 pmd = pmd_offset(pud, 0xA0000); 184 pmd = pmd_offset(pud, 0xA0000);
185 split_huge_page_pmd(mm, pmd); 185 split_huge_page_pmd_mm(mm, 0xA0000, pmd);
186 if (pmd_none_or_clear_bad(pmd)) 186 if (pmd_none_or_clear_bad(pmd))
187 goto out; 187 goto out;
188 pte = pte_offset_map_lock(mm, pmd, 0xA0000, &ptl); 188 pte = pte_offset_map_lock(mm, pmd, 0xA0000, &ptl);
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index ec79e773342..a20ecb5b6cb 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -320,6 +320,8 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
320 if (index == 0) { 320 if (index == 0) {
321 entry->ebx &= kvm_supported_word9_x86_features; 321 entry->ebx &= kvm_supported_word9_x86_features;
322 cpuid_mask(&entry->ebx, 9); 322 cpuid_mask(&entry->ebx, 9);
323 // TSC_ADJUST is emulated
324 entry->ebx |= F(TSC_ADJUST);
323 } else 325 } else
324 entry->ebx = 0; 326 entry->ebx = 0;
325 entry->eax = 0; 327 entry->eax = 0;
@@ -659,6 +661,7 @@ void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
659 } else 661 } else
660 *eax = *ebx = *ecx = *edx = 0; 662 *eax = *ebx = *ecx = *edx = 0;
661} 663}
664EXPORT_SYMBOL_GPL(kvm_cpuid);
662 665
663void kvm_emulate_cpuid(struct kvm_vcpu *vcpu) 666void kvm_emulate_cpuid(struct kvm_vcpu *vcpu)
664{ 667{
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index 58fc5148882..b7fd0798488 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -31,6 +31,14 @@ static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
31 return best && (best->ecx & bit(X86_FEATURE_XSAVE)); 31 return best && (best->ecx & bit(X86_FEATURE_XSAVE));
32} 32}
33 33
34static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu)
35{
36 struct kvm_cpuid_entry2 *best;
37
38 best = kvm_find_cpuid_entry(vcpu, 7, 0);
39 return best && (best->ebx & bit(X86_FEATURE_TSC_ADJUST));
40}
41
34static inline bool guest_cpuid_has_smep(struct kvm_vcpu *vcpu) 42static inline bool guest_cpuid_has_smep(struct kvm_vcpu *vcpu)
35{ 43{
36 struct kvm_cpuid_entry2 *best; 44 struct kvm_cpuid_entry2 *best;
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 39171cb307e..a27e7637110 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -426,8 +426,7 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
426 _ASM_EXTABLE(1b, 3b) \ 426 _ASM_EXTABLE(1b, 3b) \
427 : "=m" ((ctxt)->eflags), "=&r" (_tmp), \ 427 : "=m" ((ctxt)->eflags), "=&r" (_tmp), \
428 "+a" (*rax), "+d" (*rdx), "+qm"(_ex) \ 428 "+a" (*rax), "+d" (*rdx), "+qm"(_ex) \
429 : "i" (EFLAGS_MASK), "m" ((ctxt)->src.val), \ 429 : "i" (EFLAGS_MASK), "m" ((ctxt)->src.val)); \
430 "a" (*rax), "d" (*rdx)); \
431 } while (0) 430 } while (0)
432 431
433/* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */ 432/* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */
@@ -677,8 +676,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
677 addr.seg); 676 addr.seg);
678 if (!usable) 677 if (!usable)
679 goto bad; 678 goto bad;
680 /* code segment or read-only data segment */ 679 /* code segment in protected mode or read-only data segment */
681 if (((desc.type & 8) || !(desc.type & 2)) && write) 680 if ((((ctxt->mode != X86EMUL_MODE_REAL) && (desc.type & 8))
681 || !(desc.type & 2)) && write)
682 goto bad; 682 goto bad;
683 /* unreadable code segment */ 683 /* unreadable code segment */
684 if (!fetch && (desc.type & 8) && !(desc.type & 2)) 684 if (!fetch && (desc.type & 8) && !(desc.type & 2))
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 43e9fadca5d..9392f527f10 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1011,7 +1011,7 @@ static void start_apic_timer(struct kvm_lapic *apic)
1011 local_irq_save(flags); 1011 local_irq_save(flags);
1012 1012
1013 now = apic->lapic_timer.timer.base->get_time(); 1013 now = apic->lapic_timer.timer.base->get_time();
1014 guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu); 1014 guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu, native_read_tsc());
1015 if (likely(tscdeadline > guest_tsc)) { 1015 if (likely(tscdeadline > guest_tsc)) {
1016 ns = (tscdeadline - guest_tsc) * 1000000ULL; 1016 ns = (tscdeadline - guest_tsc) * 1000000ULL;
1017 do_div(ns, this_tsc_khz); 1017 do_div(ns, this_tsc_khz);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 6f85fe0bf95..01d7c2ad05f 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2382,12 +2382,20 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
2382 || (!vcpu->arch.mmu.direct_map && write_fault 2382 || (!vcpu->arch.mmu.direct_map && write_fault
2383 && !is_write_protection(vcpu) && !user_fault)) { 2383 && !is_write_protection(vcpu) && !user_fault)) {
2384 2384
2385 /*
2386 * There are two cases:
2387 * - the one is other vcpu creates new sp in the window
2388 * between mapping_level() and acquiring mmu-lock.
2389 * - the another case is the new sp is created by itself
2390 * (page-fault path) when guest uses the target gfn as
2391 * its page table.
2392 * Both of these cases can be fixed by allowing guest to
2393 * retry the access, it will refault, then we can establish
2394 * the mapping by using small page.
2395 */
2385 if (level > PT_PAGE_TABLE_LEVEL && 2396 if (level > PT_PAGE_TABLE_LEVEL &&
2386 has_wrprotected_page(vcpu->kvm, gfn, level)) { 2397 has_wrprotected_page(vcpu->kvm, gfn, level))
2387 ret = 1;
2388 drop_spte(vcpu->kvm, sptep);
2389 goto done; 2398 goto done;
2390 }
2391 2399
2392 spte |= PT_WRITABLE_MASK | SPTE_MMU_WRITEABLE; 2400 spte |= PT_WRITABLE_MASK | SPTE_MMU_WRITEABLE;
2393 2401
@@ -2505,6 +2513,14 @@ static void nonpaging_new_cr3(struct kvm_vcpu *vcpu)
2505 mmu_free_roots(vcpu); 2513 mmu_free_roots(vcpu);
2506} 2514}
2507 2515
2516static bool is_rsvd_bits_set(struct kvm_mmu *mmu, u64 gpte, int level)
2517{
2518 int bit7;
2519
2520 bit7 = (gpte >> 7) & 1;
2521 return (gpte & mmu->rsvd_bits_mask[bit7][level-1]) != 0;
2522}
2523
2508static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, 2524static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn,
2509 bool no_dirty_log) 2525 bool no_dirty_log)
2510{ 2526{
@@ -2517,6 +2533,26 @@ static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn,
2517 return gfn_to_pfn_memslot_atomic(slot, gfn); 2533 return gfn_to_pfn_memslot_atomic(slot, gfn);
2518} 2534}
2519 2535
2536static bool prefetch_invalid_gpte(struct kvm_vcpu *vcpu,
2537 struct kvm_mmu_page *sp, u64 *spte,
2538 u64 gpte)
2539{
2540 if (is_rsvd_bits_set(&vcpu->arch.mmu, gpte, PT_PAGE_TABLE_LEVEL))
2541 goto no_present;
2542
2543 if (!is_present_gpte(gpte))
2544 goto no_present;
2545
2546 if (!(gpte & PT_ACCESSED_MASK))
2547 goto no_present;
2548
2549 return false;
2550
2551no_present:
2552 drop_spte(vcpu->kvm, spte);
2553 return true;
2554}
2555
2520static int direct_pte_prefetch_many(struct kvm_vcpu *vcpu, 2556static int direct_pte_prefetch_many(struct kvm_vcpu *vcpu,
2521 struct kvm_mmu_page *sp, 2557 struct kvm_mmu_page *sp,
2522 u64 *start, u64 *end) 2558 u64 *start, u64 *end)
@@ -2671,7 +2707,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu,
2671 * PT_PAGE_TABLE_LEVEL and there would be no adjustment done 2707 * PT_PAGE_TABLE_LEVEL and there would be no adjustment done
2672 * here. 2708 * here.
2673 */ 2709 */
2674 if (!is_error_pfn(pfn) && !kvm_is_mmio_pfn(pfn) && 2710 if (!is_error_noslot_pfn(pfn) && !kvm_is_mmio_pfn(pfn) &&
2675 level == PT_PAGE_TABLE_LEVEL && 2711 level == PT_PAGE_TABLE_LEVEL &&
2676 PageTransCompound(pfn_to_page(pfn)) && 2712 PageTransCompound(pfn_to_page(pfn)) &&
2677 !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) { 2713 !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) {
@@ -2699,18 +2735,13 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu,
2699 } 2735 }
2700} 2736}
2701 2737
2702static bool mmu_invalid_pfn(pfn_t pfn)
2703{
2704 return unlikely(is_invalid_pfn(pfn));
2705}
2706
2707static bool handle_abnormal_pfn(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn, 2738static bool handle_abnormal_pfn(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
2708 pfn_t pfn, unsigned access, int *ret_val) 2739 pfn_t pfn, unsigned access, int *ret_val)
2709{ 2740{
2710 bool ret = true; 2741 bool ret = true;
2711 2742
2712 /* The pfn is invalid, report the error! */ 2743 /* The pfn is invalid, report the error! */
2713 if (unlikely(is_invalid_pfn(pfn))) { 2744 if (unlikely(is_error_pfn(pfn))) {
2714 *ret_val = kvm_handle_bad_page(vcpu, gfn, pfn); 2745 *ret_val = kvm_handle_bad_page(vcpu, gfn, pfn);
2715 goto exit; 2746 goto exit;
2716 } 2747 }
@@ -2862,7 +2893,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, u32 error_code,
2862 return r; 2893 return r;
2863 2894
2864 spin_lock(&vcpu->kvm->mmu_lock); 2895 spin_lock(&vcpu->kvm->mmu_lock);
2865 if (mmu_notifier_retry(vcpu, mmu_seq)) 2896 if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
2866 goto out_unlock; 2897 goto out_unlock;
2867 kvm_mmu_free_some_pages(vcpu); 2898 kvm_mmu_free_some_pages(vcpu);
2868 if (likely(!force_pt_level)) 2899 if (likely(!force_pt_level))
@@ -3331,7 +3362,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, u32 error_code,
3331 return r; 3362 return r;
3332 3363
3333 spin_lock(&vcpu->kvm->mmu_lock); 3364 spin_lock(&vcpu->kvm->mmu_lock);
3334 if (mmu_notifier_retry(vcpu, mmu_seq)) 3365 if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
3335 goto out_unlock; 3366 goto out_unlock;
3336 kvm_mmu_free_some_pages(vcpu); 3367 kvm_mmu_free_some_pages(vcpu);
3337 if (likely(!force_pt_level)) 3368 if (likely(!force_pt_level))
@@ -3399,14 +3430,6 @@ static void paging_free(struct kvm_vcpu *vcpu)
3399 nonpaging_free(vcpu); 3430 nonpaging_free(vcpu);
3400} 3431}
3401 3432
3402static bool is_rsvd_bits_set(struct kvm_mmu *mmu, u64 gpte, int level)
3403{
3404 int bit7;
3405
3406 bit7 = (gpte >> 7) & 1;
3407 return (gpte & mmu->rsvd_bits_mask[bit7][level-1]) != 0;
3408}
3409
3410static inline void protect_clean_gpte(unsigned *access, unsigned gpte) 3433static inline void protect_clean_gpte(unsigned *access, unsigned gpte)
3411{ 3434{
3412 unsigned mask; 3435 unsigned mask;
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 714e2c01a6f..891eb6d93b8 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -305,51 +305,43 @@ static int FNAME(walk_addr_nested)(struct guest_walker *walker,
305 addr, access); 305 addr, access);
306} 306}
307 307
308static bool FNAME(prefetch_invalid_gpte)(struct kvm_vcpu *vcpu, 308static bool
309 struct kvm_mmu_page *sp, u64 *spte, 309FNAME(prefetch_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
310 pt_element_t gpte) 310 u64 *spte, pt_element_t gpte, bool no_dirty_log)
311{ 311{
312 if (is_rsvd_bits_set(&vcpu->arch.mmu, gpte, PT_PAGE_TABLE_LEVEL))
313 goto no_present;
314
315 if (!is_present_gpte(gpte))
316 goto no_present;
317
318 if (!(gpte & PT_ACCESSED_MASK))
319 goto no_present;
320
321 return false;
322
323no_present:
324 drop_spte(vcpu->kvm, spte);
325 return true;
326}
327
328static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
329 u64 *spte, const void *pte)
330{
331 pt_element_t gpte;
332 unsigned pte_access; 312 unsigned pte_access;
313 gfn_t gfn;
333 pfn_t pfn; 314 pfn_t pfn;
334 315
335 gpte = *(const pt_element_t *)pte; 316 if (prefetch_invalid_gpte(vcpu, sp, spte, gpte))
336 if (FNAME(prefetch_invalid_gpte)(vcpu, sp, spte, gpte)) 317 return false;
337 return;
338 318
339 pgprintk("%s: gpte %llx spte %p\n", __func__, (u64)gpte, spte); 319 pgprintk("%s: gpte %llx spte %p\n", __func__, (u64)gpte, spte);
320
321 gfn = gpte_to_gfn(gpte);
340 pte_access = sp->role.access & gpte_access(vcpu, gpte); 322 pte_access = sp->role.access & gpte_access(vcpu, gpte);
341 protect_clean_gpte(&pte_access, gpte); 323 protect_clean_gpte(&pte_access, gpte);
342 pfn = gfn_to_pfn_atomic(vcpu->kvm, gpte_to_gfn(gpte)); 324 pfn = pte_prefetch_gfn_to_pfn(vcpu, gfn,
343 if (mmu_invalid_pfn(pfn)) 325 no_dirty_log && (pte_access & ACC_WRITE_MASK));
344 return; 326 if (is_error_pfn(pfn))
327 return false;
345 328
346 /* 329 /*
347 * we call mmu_set_spte() with host_writable = true because that 330 * we call mmu_set_spte() with host_writable = true because
348 * vcpu->arch.update_pte.pfn was fetched from get_user_pages(write = 1). 331 * pte_prefetch_gfn_to_pfn always gets a writable pfn.
349 */ 332 */
350 mmu_set_spte(vcpu, spte, sp->role.access, pte_access, 0, 0, 333 mmu_set_spte(vcpu, spte, sp->role.access, pte_access, 0, 0,
351 NULL, PT_PAGE_TABLE_LEVEL, 334 NULL, PT_PAGE_TABLE_LEVEL, gfn, pfn, true, true);
352 gpte_to_gfn(gpte), pfn, true, true); 335
336 return true;
337}
338
339static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
340 u64 *spte, const void *pte)
341{
342 pt_element_t gpte = *(const pt_element_t *)pte;
343
344 FNAME(prefetch_gpte)(vcpu, sp, spte, gpte, false);
353} 345}
354 346
355static bool FNAME(gpte_changed)(struct kvm_vcpu *vcpu, 347static bool FNAME(gpte_changed)(struct kvm_vcpu *vcpu,
@@ -395,53 +387,34 @@ static void FNAME(pte_prefetch)(struct kvm_vcpu *vcpu, struct guest_walker *gw,
395 spte = sp->spt + i; 387 spte = sp->spt + i;
396 388
397 for (i = 0; i < PTE_PREFETCH_NUM; i++, spte++) { 389 for (i = 0; i < PTE_PREFETCH_NUM; i++, spte++) {
398 pt_element_t gpte;
399 unsigned pte_access;
400 gfn_t gfn;
401 pfn_t pfn;
402
403 if (spte == sptep) 390 if (spte == sptep)
404 continue; 391 continue;
405 392
406 if (is_shadow_present_pte(*spte)) 393 if (is_shadow_present_pte(*spte))
407 continue; 394 continue;
408 395
409 gpte = gptep[i]; 396 if (!FNAME(prefetch_gpte)(vcpu, sp, spte, gptep[i], true))
410
411 if (FNAME(prefetch_invalid_gpte)(vcpu, sp, spte, gpte))
412 continue;
413
414 pte_access = sp->role.access & gpte_access(vcpu, gpte);
415 protect_clean_gpte(&pte_access, gpte);
416 gfn = gpte_to_gfn(gpte);
417 pfn = pte_prefetch_gfn_to_pfn(vcpu, gfn,
418 pte_access & ACC_WRITE_MASK);
419 if (mmu_invalid_pfn(pfn))
420 break; 397 break;
421
422 mmu_set_spte(vcpu, spte, sp->role.access, pte_access, 0, 0,
423 NULL, PT_PAGE_TABLE_LEVEL, gfn,
424 pfn, true, true);
425 } 398 }
426} 399}
427 400
428/* 401/*
429 * Fetch a shadow pte for a specific level in the paging hierarchy. 402 * Fetch a shadow pte for a specific level in the paging hierarchy.
403 * If the guest tries to write a write-protected page, we need to
404 * emulate this operation, return 1 to indicate this case.
430 */ 405 */
431static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, 406static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
432 struct guest_walker *gw, 407 struct guest_walker *gw,
433 int user_fault, int write_fault, int hlevel, 408 int user_fault, int write_fault, int hlevel,
434 int *emulate, pfn_t pfn, bool map_writable, 409 pfn_t pfn, bool map_writable, bool prefault)
435 bool prefault)
436{ 410{
437 unsigned access = gw->pt_access;
438 struct kvm_mmu_page *sp = NULL; 411 struct kvm_mmu_page *sp = NULL;
439 int top_level;
440 unsigned direct_access;
441 struct kvm_shadow_walk_iterator it; 412 struct kvm_shadow_walk_iterator it;
413 unsigned direct_access, access = gw->pt_access;
414 int top_level, emulate = 0;
442 415
443 if (!is_present_gpte(gw->ptes[gw->level - 1])) 416 if (!is_present_gpte(gw->ptes[gw->level - 1]))
444 return NULL; 417 return 0;
445 418
446 direct_access = gw->pte_access; 419 direct_access = gw->pte_access;
447 420
@@ -505,17 +478,17 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
505 478
506 clear_sp_write_flooding_count(it.sptep); 479 clear_sp_write_flooding_count(it.sptep);
507 mmu_set_spte(vcpu, it.sptep, access, gw->pte_access, 480 mmu_set_spte(vcpu, it.sptep, access, gw->pte_access,
508 user_fault, write_fault, emulate, it.level, 481 user_fault, write_fault, &emulate, it.level,
509 gw->gfn, pfn, prefault, map_writable); 482 gw->gfn, pfn, prefault, map_writable);
510 FNAME(pte_prefetch)(vcpu, gw, it.sptep); 483 FNAME(pte_prefetch)(vcpu, gw, it.sptep);
511 484
512 return it.sptep; 485 return emulate;
513 486
514out_gpte_changed: 487out_gpte_changed:
515 if (sp) 488 if (sp)
516 kvm_mmu_put_page(sp, it.sptep); 489 kvm_mmu_put_page(sp, it.sptep);
517 kvm_release_pfn_clean(pfn); 490 kvm_release_pfn_clean(pfn);
518 return NULL; 491 return 0;
519} 492}
520 493
521/* 494/*
@@ -538,8 +511,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
538 int write_fault = error_code & PFERR_WRITE_MASK; 511 int write_fault = error_code & PFERR_WRITE_MASK;
539 int user_fault = error_code & PFERR_USER_MASK; 512 int user_fault = error_code & PFERR_USER_MASK;
540 struct guest_walker walker; 513 struct guest_walker walker;
541 u64 *sptep;
542 int emulate = 0;
543 int r; 514 int r;
544 pfn_t pfn; 515 pfn_t pfn;
545 int level = PT_PAGE_TABLE_LEVEL; 516 int level = PT_PAGE_TABLE_LEVEL;
@@ -594,24 +565,20 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
594 return r; 565 return r;
595 566
596 spin_lock(&vcpu->kvm->mmu_lock); 567 spin_lock(&vcpu->kvm->mmu_lock);
597 if (mmu_notifier_retry(vcpu, mmu_seq)) 568 if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
598 goto out_unlock; 569 goto out_unlock;
599 570
600 kvm_mmu_audit(vcpu, AUDIT_PRE_PAGE_FAULT); 571 kvm_mmu_audit(vcpu, AUDIT_PRE_PAGE_FAULT);
601 kvm_mmu_free_some_pages(vcpu); 572 kvm_mmu_free_some_pages(vcpu);
602 if (!force_pt_level) 573 if (!force_pt_level)
603 transparent_hugepage_adjust(vcpu, &walker.gfn, &pfn, &level); 574 transparent_hugepage_adjust(vcpu, &walker.gfn, &pfn, &level);
604 sptep = FNAME(fetch)(vcpu, addr, &walker, user_fault, write_fault, 575 r = FNAME(fetch)(vcpu, addr, &walker, user_fault, write_fault,
605 level, &emulate, pfn, map_writable, prefault); 576 level, pfn, map_writable, prefault);
606 (void)sptep;
607 pgprintk("%s: shadow pte %p %llx emulate %d\n", __func__,
608 sptep, *sptep, emulate);
609
610 ++vcpu->stat.pf_fixed; 577 ++vcpu->stat.pf_fixed;
611 kvm_mmu_audit(vcpu, AUDIT_POST_PAGE_FAULT); 578 kvm_mmu_audit(vcpu, AUDIT_POST_PAGE_FAULT);
612 spin_unlock(&vcpu->kvm->mmu_lock); 579 spin_unlock(&vcpu->kvm->mmu_lock);
613 580
614 return emulate; 581 return r;
615 582
616out_unlock: 583out_unlock:
617 spin_unlock(&vcpu->kvm->mmu_lock); 584 spin_unlock(&vcpu->kvm->mmu_lock);
@@ -757,7 +724,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
757 sizeof(pt_element_t))) 724 sizeof(pt_element_t)))
758 return -EINVAL; 725 return -EINVAL;
759 726
760 if (FNAME(prefetch_invalid_gpte)(vcpu, sp, &sp->spt[i], gpte)) { 727 if (prefetch_invalid_gpte(vcpu, sp, &sp->spt[i], gpte)) {
761 vcpu->kvm->tlbs_dirty++; 728 vcpu->kvm->tlbs_dirty++;
762 continue; 729 continue;
763 } 730 }
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index d017df3899e..d29d3cd1c15 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -20,6 +20,7 @@
20#include "mmu.h" 20#include "mmu.h"
21#include "kvm_cache_regs.h" 21#include "kvm_cache_regs.h"
22#include "x86.h" 22#include "x86.h"
23#include "cpuid.h"
23 24
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/mod_devicetable.h> 26#include <linux/mod_devicetable.h>
@@ -630,15 +631,12 @@ static int svm_hardware_enable(void *garbage)
630 return -EBUSY; 631 return -EBUSY;
631 632
632 if (!has_svm()) { 633 if (!has_svm()) {
633 printk(KERN_ERR "svm_hardware_enable: err EOPNOTSUPP on %d\n", 634 pr_err("%s: err EOPNOTSUPP on %d\n", __func__, me);
634 me);
635 return -EINVAL; 635 return -EINVAL;
636 } 636 }
637 sd = per_cpu(svm_data, me); 637 sd = per_cpu(svm_data, me);
638
639 if (!sd) { 638 if (!sd) {
640 printk(KERN_ERR "svm_hardware_enable: svm_data is NULL on %d\n", 639 pr_err("%s: svm_data is NULL on %d\n", __func__, me);
641 me);
642 return -EINVAL; 640 return -EINVAL;
643 } 641 }
644 642
@@ -1012,6 +1010,13 @@ static void svm_set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
1012 svm->tsc_ratio = ratio; 1010 svm->tsc_ratio = ratio;
1013} 1011}
1014 1012
1013static u64 svm_read_tsc_offset(struct kvm_vcpu *vcpu)
1014{
1015 struct vcpu_svm *svm = to_svm(vcpu);
1016
1017 return svm->vmcb->control.tsc_offset;
1018}
1019
1015static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset) 1020static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset)
1016{ 1021{
1017 struct vcpu_svm *svm = to_svm(vcpu); 1022 struct vcpu_svm *svm = to_svm(vcpu);
@@ -1189,6 +1194,8 @@ static void init_vmcb(struct vcpu_svm *svm)
1189static int svm_vcpu_reset(struct kvm_vcpu *vcpu) 1194static int svm_vcpu_reset(struct kvm_vcpu *vcpu)
1190{ 1195{
1191 struct vcpu_svm *svm = to_svm(vcpu); 1196 struct vcpu_svm *svm = to_svm(vcpu);
1197 u32 dummy;
1198 u32 eax = 1;
1192 1199
1193 init_vmcb(svm); 1200 init_vmcb(svm);
1194 1201
@@ -1197,8 +1204,9 @@ static int svm_vcpu_reset(struct kvm_vcpu *vcpu)
1197 svm->vmcb->save.cs.base = svm->vcpu.arch.sipi_vector << 12; 1204 svm->vmcb->save.cs.base = svm->vcpu.arch.sipi_vector << 12;
1198 svm->vmcb->save.cs.selector = svm->vcpu.arch.sipi_vector << 8; 1205 svm->vmcb->save.cs.selector = svm->vcpu.arch.sipi_vector << 8;
1199 } 1206 }
1200 vcpu->arch.regs_avail = ~0; 1207
1201 vcpu->arch.regs_dirty = ~0; 1208 kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy);
1209 kvm_register_write(vcpu, VCPU_REGS_RDX, eax);
1202 1210
1203 return 0; 1211 return 0;
1204} 1212}
@@ -1254,11 +1262,6 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
1254 svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; 1262 svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT;
1255 svm->asid_generation = 0; 1263 svm->asid_generation = 0;
1256 init_vmcb(svm); 1264 init_vmcb(svm);
1257 kvm_write_tsc(&svm->vcpu, 0);
1258
1259 err = fx_init(&svm->vcpu);
1260 if (err)
1261 goto free_page4;
1262 1265
1263 svm->vcpu.arch.apic_base = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; 1266 svm->vcpu.arch.apic_base = 0xfee00000 | MSR_IA32_APICBASE_ENABLE;
1264 if (kvm_vcpu_is_bsp(&svm->vcpu)) 1267 if (kvm_vcpu_is_bsp(&svm->vcpu))
@@ -1268,8 +1271,6 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
1268 1271
1269 return &svm->vcpu; 1272 return &svm->vcpu;
1270 1273
1271free_page4:
1272 __free_page(hsave_page);
1273free_page3: 1274free_page3:
1274 __free_pages(nested_msrpm_pages, MSRPM_ALLOC_ORDER); 1275 __free_pages(nested_msrpm_pages, MSRPM_ALLOC_ORDER);
1275free_page2: 1276free_page2:
@@ -3008,11 +3009,11 @@ static int cr8_write_interception(struct vcpu_svm *svm)
3008 return 0; 3009 return 0;
3009} 3010}
3010 3011
3011u64 svm_read_l1_tsc(struct kvm_vcpu *vcpu) 3012u64 svm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc)
3012{ 3013{
3013 struct vmcb *vmcb = get_host_vmcb(to_svm(vcpu)); 3014 struct vmcb *vmcb = get_host_vmcb(to_svm(vcpu));
3014 return vmcb->control.tsc_offset + 3015 return vmcb->control.tsc_offset +
3015 svm_scale_tsc(vcpu, native_read_tsc()); 3016 svm_scale_tsc(vcpu, host_tsc);
3016} 3017}
3017 3018
3018static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data) 3019static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
@@ -3131,13 +3132,15 @@ static int svm_set_vm_cr(struct kvm_vcpu *vcpu, u64 data)
3131 return 0; 3132 return 0;
3132} 3133}
3133 3134
3134static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data) 3135static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
3135{ 3136{
3136 struct vcpu_svm *svm = to_svm(vcpu); 3137 struct vcpu_svm *svm = to_svm(vcpu);
3137 3138
3139 u32 ecx = msr->index;
3140 u64 data = msr->data;
3138 switch (ecx) { 3141 switch (ecx) {
3139 case MSR_IA32_TSC: 3142 case MSR_IA32_TSC:
3140 kvm_write_tsc(vcpu, data); 3143 kvm_write_tsc(vcpu, msr);
3141 break; 3144 break;
3142 case MSR_STAR: 3145 case MSR_STAR:
3143 svm->vmcb->save.star = data; 3146 svm->vmcb->save.star = data;
@@ -3192,20 +3195,24 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
3192 vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data); 3195 vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data);
3193 break; 3196 break;
3194 default: 3197 default:
3195 return kvm_set_msr_common(vcpu, ecx, data); 3198 return kvm_set_msr_common(vcpu, msr);
3196 } 3199 }
3197 return 0; 3200 return 0;
3198} 3201}
3199 3202
3200static int wrmsr_interception(struct vcpu_svm *svm) 3203static int wrmsr_interception(struct vcpu_svm *svm)
3201{ 3204{
3205 struct msr_data msr;
3202 u32 ecx = svm->vcpu.arch.regs[VCPU_REGS_RCX]; 3206 u32 ecx = svm->vcpu.arch.regs[VCPU_REGS_RCX];
3203 u64 data = (svm->vcpu.arch.regs[VCPU_REGS_RAX] & -1u) 3207 u64 data = (svm->vcpu.arch.regs[VCPU_REGS_RAX] & -1u)
3204 | ((u64)(svm->vcpu.arch.regs[VCPU_REGS_RDX] & -1u) << 32); 3208 | ((u64)(svm->vcpu.arch.regs[VCPU_REGS_RDX] & -1u) << 32);
3205 3209
3210 msr.data = data;
3211 msr.index = ecx;
3212 msr.host_initiated = false;
3206 3213
3207 svm->next_rip = kvm_rip_read(&svm->vcpu) + 2; 3214 svm->next_rip = kvm_rip_read(&svm->vcpu) + 2;
3208 if (svm_set_msr(&svm->vcpu, ecx, data)) { 3215 if (svm_set_msr(&svm->vcpu, &msr)) {
3209 trace_kvm_msr_write_ex(ecx, data); 3216 trace_kvm_msr_write_ex(ecx, data);
3210 kvm_inject_gp(&svm->vcpu, 0); 3217 kvm_inject_gp(&svm->vcpu, 0);
3211 } else { 3218 } else {
@@ -4302,6 +4309,7 @@ static struct kvm_x86_ops svm_x86_ops = {
4302 .has_wbinvd_exit = svm_has_wbinvd_exit, 4309 .has_wbinvd_exit = svm_has_wbinvd_exit,
4303 4310
4304 .set_tsc_khz = svm_set_tsc_khz, 4311 .set_tsc_khz = svm_set_tsc_khz,
4312 .read_tsc_offset = svm_read_tsc_offset,
4305 .write_tsc_offset = svm_write_tsc_offset, 4313 .write_tsc_offset = svm_write_tsc_offset,
4306 .adjust_tsc_offset = svm_adjust_tsc_offset, 4314 .adjust_tsc_offset = svm_adjust_tsc_offset,
4307 .compute_tsc_offset = svm_compute_tsc_offset, 4315 .compute_tsc_offset = svm_compute_tsc_offset,
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index bca63f04dcc..fe5e00ed703 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -4,6 +4,7 @@
4#include <linux/tracepoint.h> 4#include <linux/tracepoint.h>
5#include <asm/vmx.h> 5#include <asm/vmx.h>
6#include <asm/svm.h> 6#include <asm/svm.h>
7#include <asm/clocksource.h>
7 8
8#undef TRACE_SYSTEM 9#undef TRACE_SYSTEM
9#define TRACE_SYSTEM kvm 10#define TRACE_SYSTEM kvm
@@ -754,6 +755,68 @@ TRACE_EVENT(
754 __entry->write ? "Write" : "Read", 755 __entry->write ? "Write" : "Read",
755 __entry->gpa_match ? "GPA" : "GVA") 756 __entry->gpa_match ? "GPA" : "GVA")
756); 757);
758
759#ifdef CONFIG_X86_64
760
761#define host_clocks \
762 {VCLOCK_NONE, "none"}, \
763 {VCLOCK_TSC, "tsc"}, \
764 {VCLOCK_HPET, "hpet"} \
765
766TRACE_EVENT(kvm_update_master_clock,
767 TP_PROTO(bool use_master_clock, unsigned int host_clock, bool offset_matched),
768 TP_ARGS(use_master_clock, host_clock, offset_matched),
769
770 TP_STRUCT__entry(
771 __field( bool, use_master_clock )
772 __field( unsigned int, host_clock )
773 __field( bool, offset_matched )
774 ),
775
776 TP_fast_assign(
777 __entry->use_master_clock = use_master_clock;
778 __entry->host_clock = host_clock;
779 __entry->offset_matched = offset_matched;
780 ),
781
782 TP_printk("masterclock %d hostclock %s offsetmatched %u",
783 __entry->use_master_clock,
784 __print_symbolic(__entry->host_clock, host_clocks),
785 __entry->offset_matched)
786);
787
788TRACE_EVENT(kvm_track_tsc,
789 TP_PROTO(unsigned int vcpu_id, unsigned int nr_matched,
790 unsigned int online_vcpus, bool use_master_clock,
791 unsigned int host_clock),
792 TP_ARGS(vcpu_id, nr_matched, online_vcpus, use_master_clock,
793 host_clock),
794
795 TP_STRUCT__entry(
796 __field( unsigned int, vcpu_id )
797 __field( unsigned int, nr_vcpus_matched_tsc )
798 __field( unsigned int, online_vcpus )
799 __field( bool, use_master_clock )
800 __field( unsigned int, host_clock )
801 ),
802
803 TP_fast_assign(
804 __entry->vcpu_id = vcpu_id;
805 __entry->nr_vcpus_matched_tsc = nr_matched;
806 __entry->online_vcpus = online_vcpus;
807 __entry->use_master_clock = use_master_clock;
808 __entry->host_clock = host_clock;
809 ),
810
811 TP_printk("vcpu_id %u masterclock %u offsetmatched %u nr_online %u"
812 " hostclock %s",
813 __entry->vcpu_id, __entry->use_master_clock,
814 __entry->nr_vcpus_matched_tsc, __entry->online_vcpus,
815 __print_symbolic(__entry->host_clock, host_clocks))
816);
817
818#endif /* CONFIG_X86_64 */
819
757#endif /* _TRACE_KVM_H */ 820#endif /* _TRACE_KVM_H */
758 821
759#undef TRACE_INCLUDE_PATH 822#undef TRACE_INCLUDE_PATH
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index f85815945fc..9120ae1901e 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -42,6 +42,7 @@
42#include <asm/i387.h> 42#include <asm/i387.h>
43#include <asm/xcr.h> 43#include <asm/xcr.h>
44#include <asm/perf_event.h> 44#include <asm/perf_event.h>
45#include <asm/kexec.h>
45 46
46#include "trace.h" 47#include "trace.h"
47 48
@@ -802,11 +803,6 @@ static inline bool cpu_has_vmx_ept_ad_bits(void)
802 return vmx_capability.ept & VMX_EPT_AD_BIT; 803 return vmx_capability.ept & VMX_EPT_AD_BIT;
803} 804}
804 805
805static inline bool cpu_has_vmx_invept_individual_addr(void)
806{
807 return vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT;
808}
809
810static inline bool cpu_has_vmx_invept_context(void) 806static inline bool cpu_has_vmx_invept_context(void)
811{ 807{
812 return vmx_capability.ept & VMX_EPT_EXTENT_CONTEXT_BIT; 808 return vmx_capability.ept & VMX_EPT_EXTENT_CONTEXT_BIT;
@@ -992,6 +988,46 @@ static void vmcs_load(struct vmcs *vmcs)
992 vmcs, phys_addr); 988 vmcs, phys_addr);
993} 989}
994 990
991#ifdef CONFIG_KEXEC
992/*
993 * This bitmap is used to indicate whether the vmclear
994 * operation is enabled on all cpus. All disabled by
995 * default.
996 */
997static cpumask_t crash_vmclear_enabled_bitmap = CPU_MASK_NONE;
998
999static inline void crash_enable_local_vmclear(int cpu)
1000{
1001 cpumask_set_cpu(cpu, &crash_vmclear_enabled_bitmap);
1002}
1003
1004static inline void crash_disable_local_vmclear(int cpu)
1005{
1006 cpumask_clear_cpu(cpu, &crash_vmclear_enabled_bitmap);
1007}
1008
1009static inline int crash_local_vmclear_enabled(int cpu)
1010{
1011 return cpumask_test_cpu(cpu, &crash_vmclear_enabled_bitmap);
1012}
1013
1014static void crash_vmclear_local_loaded_vmcss(void)
1015{
1016 int cpu = raw_smp_processor_id();
1017 struct loaded_vmcs *v;
1018
1019 if (!crash_local_vmclear_enabled(cpu))
1020 return;
1021
1022 list_for_each_entry(v, &per_cpu(loaded_vmcss_on_cpu, cpu),
1023 loaded_vmcss_on_cpu_link)
1024 vmcs_clear(v->vmcs);
1025}
1026#else
1027static inline void crash_enable_local_vmclear(int cpu) { }
1028static inline void crash_disable_local_vmclear(int cpu) { }
1029#endif /* CONFIG_KEXEC */
1030
995static void __loaded_vmcs_clear(void *arg) 1031static void __loaded_vmcs_clear(void *arg)
996{ 1032{
997 struct loaded_vmcs *loaded_vmcs = arg; 1033 struct loaded_vmcs *loaded_vmcs = arg;
@@ -1001,15 +1037,28 @@ static void __loaded_vmcs_clear(void *arg)
1001 return; /* vcpu migration can race with cpu offline */ 1037 return; /* vcpu migration can race with cpu offline */
1002 if (per_cpu(current_vmcs, cpu) == loaded_vmcs->vmcs) 1038 if (per_cpu(current_vmcs, cpu) == loaded_vmcs->vmcs)
1003 per_cpu(current_vmcs, cpu) = NULL; 1039 per_cpu(current_vmcs, cpu) = NULL;
1040 crash_disable_local_vmclear(cpu);
1004 list_del(&loaded_vmcs->loaded_vmcss_on_cpu_link); 1041 list_del(&loaded_vmcs->loaded_vmcss_on_cpu_link);
1042
1043 /*
1044 * we should ensure updating loaded_vmcs->loaded_vmcss_on_cpu_link
1045 * is before setting loaded_vmcs->vcpu to -1 which is done in
1046 * loaded_vmcs_init. Otherwise, other cpu can see vcpu = -1 fist
1047 * then adds the vmcs into percpu list before it is deleted.
1048 */
1049 smp_wmb();
1050
1005 loaded_vmcs_init(loaded_vmcs); 1051 loaded_vmcs_init(loaded_vmcs);
1052 crash_enable_local_vmclear(cpu);
1006} 1053}
1007 1054
1008static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs) 1055static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs)
1009{ 1056{
1010 if (loaded_vmcs->cpu != -1) 1057 int cpu = loaded_vmcs->cpu;
1011 smp_call_function_single( 1058
1012 loaded_vmcs->cpu, __loaded_vmcs_clear, loaded_vmcs, 1); 1059 if (cpu != -1)
1060 smp_call_function_single(cpu,
1061 __loaded_vmcs_clear, loaded_vmcs, 1);
1013} 1062}
1014 1063
1015static inline void vpid_sync_vcpu_single(struct vcpu_vmx *vmx) 1064static inline void vpid_sync_vcpu_single(struct vcpu_vmx *vmx)
@@ -1051,17 +1100,6 @@ static inline void ept_sync_context(u64 eptp)
1051 } 1100 }
1052} 1101}
1053 1102
1054static inline void ept_sync_individual_addr(u64 eptp, gpa_t gpa)
1055{
1056 if (enable_ept) {
1057 if (cpu_has_vmx_invept_individual_addr())
1058 __invept(VMX_EPT_EXTENT_INDIVIDUAL_ADDR,
1059 eptp, gpa);
1060 else
1061 ept_sync_context(eptp);
1062 }
1063}
1064
1065static __always_inline unsigned long vmcs_readl(unsigned long field) 1103static __always_inline unsigned long vmcs_readl(unsigned long field)
1066{ 1104{
1067 unsigned long value; 1105 unsigned long value;
@@ -1535,8 +1573,18 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1535 1573
1536 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); 1574 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
1537 local_irq_disable(); 1575 local_irq_disable();
1576 crash_disable_local_vmclear(cpu);
1577
1578 /*
1579 * Read loaded_vmcs->cpu should be before fetching
1580 * loaded_vmcs->loaded_vmcss_on_cpu_link.
1581 * See the comments in __loaded_vmcs_clear().
1582 */
1583 smp_rmb();
1584
1538 list_add(&vmx->loaded_vmcs->loaded_vmcss_on_cpu_link, 1585 list_add(&vmx->loaded_vmcs->loaded_vmcss_on_cpu_link,
1539 &per_cpu(loaded_vmcss_on_cpu, cpu)); 1586 &per_cpu(loaded_vmcss_on_cpu, cpu));
1587 crash_enable_local_vmclear(cpu);
1540 local_irq_enable(); 1588 local_irq_enable();
1541 1589
1542 /* 1590 /*
@@ -1839,11 +1887,10 @@ static u64 guest_read_tsc(void)
1839 * Like guest_read_tsc, but always returns L1's notion of the timestamp 1887 * Like guest_read_tsc, but always returns L1's notion of the timestamp
1840 * counter, even if a nested guest (L2) is currently running. 1888 * counter, even if a nested guest (L2) is currently running.
1841 */ 1889 */
1842u64 vmx_read_l1_tsc(struct kvm_vcpu *vcpu) 1890u64 vmx_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc)
1843{ 1891{
1844 u64 host_tsc, tsc_offset; 1892 u64 tsc_offset;
1845 1893
1846 rdtscll(host_tsc);
1847 tsc_offset = is_guest_mode(vcpu) ? 1894 tsc_offset = is_guest_mode(vcpu) ?
1848 to_vmx(vcpu)->nested.vmcs01_tsc_offset : 1895 to_vmx(vcpu)->nested.vmcs01_tsc_offset :
1849 vmcs_read64(TSC_OFFSET); 1896 vmcs_read64(TSC_OFFSET);
@@ -1866,6 +1913,11 @@ static void vmx_set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
1866 WARN(1, "user requested TSC rate below hardware speed\n"); 1913 WARN(1, "user requested TSC rate below hardware speed\n");
1867} 1914}
1868 1915
1916static u64 vmx_read_tsc_offset(struct kvm_vcpu *vcpu)
1917{
1918 return vmcs_read64(TSC_OFFSET);
1919}
1920
1869/* 1921/*
1870 * writes 'offset' into guest's timestamp counter offset register 1922 * writes 'offset' into guest's timestamp counter offset register
1871 */ 1923 */
@@ -2202,15 +2254,17 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2202 * Returns 0 on success, non-0 otherwise. 2254 * Returns 0 on success, non-0 otherwise.
2203 * Assumes vcpu_load() was already called. 2255 * Assumes vcpu_load() was already called.
2204 */ 2256 */
2205static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) 2257static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2206{ 2258{
2207 struct vcpu_vmx *vmx = to_vmx(vcpu); 2259 struct vcpu_vmx *vmx = to_vmx(vcpu);
2208 struct shared_msr_entry *msr; 2260 struct shared_msr_entry *msr;
2209 int ret = 0; 2261 int ret = 0;
2262 u32 msr_index = msr_info->index;
2263 u64 data = msr_info->data;
2210 2264
2211 switch (msr_index) { 2265 switch (msr_index) {
2212 case MSR_EFER: 2266 case MSR_EFER:
2213 ret = kvm_set_msr_common(vcpu, msr_index, data); 2267 ret = kvm_set_msr_common(vcpu, msr_info);
2214 break; 2268 break;
2215#ifdef CONFIG_X86_64 2269#ifdef CONFIG_X86_64
2216 case MSR_FS_BASE: 2270 case MSR_FS_BASE:
@@ -2236,7 +2290,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
2236 vmcs_writel(GUEST_SYSENTER_ESP, data); 2290 vmcs_writel(GUEST_SYSENTER_ESP, data);
2237 break; 2291 break;
2238 case MSR_IA32_TSC: 2292 case MSR_IA32_TSC:
2239 kvm_write_tsc(vcpu, data); 2293 kvm_write_tsc(vcpu, msr_info);
2240 break; 2294 break;
2241 case MSR_IA32_CR_PAT: 2295 case MSR_IA32_CR_PAT:
2242 if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) { 2296 if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) {
@@ -2244,7 +2298,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
2244 vcpu->arch.pat = data; 2298 vcpu->arch.pat = data;
2245 break; 2299 break;
2246 } 2300 }
2247 ret = kvm_set_msr_common(vcpu, msr_index, data); 2301 ret = kvm_set_msr_common(vcpu, msr_info);
2302 break;
2303 case MSR_IA32_TSC_ADJUST:
2304 ret = kvm_set_msr_common(vcpu, msr_info);
2248 break; 2305 break;
2249 case MSR_TSC_AUX: 2306 case MSR_TSC_AUX:
2250 if (!vmx->rdtscp_enabled) 2307 if (!vmx->rdtscp_enabled)
@@ -2267,7 +2324,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
2267 } 2324 }
2268 break; 2325 break;
2269 } 2326 }
2270 ret = kvm_set_msr_common(vcpu, msr_index, data); 2327 ret = kvm_set_msr_common(vcpu, msr_info);
2271 } 2328 }
2272 2329
2273 return ret; 2330 return ret;
@@ -2341,6 +2398,18 @@ static int hardware_enable(void *garbage)
2341 return -EBUSY; 2398 return -EBUSY;
2342 2399
2343 INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); 2400 INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
2401
2402 /*
2403 * Now we can enable the vmclear operation in kdump
2404 * since the loaded_vmcss_on_cpu list on this cpu
2405 * has been initialized.
2406 *
2407 * Though the cpu is not in VMX operation now, there
2408 * is no problem to enable the vmclear operation
2409 * for the loaded_vmcss_on_cpu list is empty!
2410 */
2411 crash_enable_local_vmclear(cpu);
2412
2344 rdmsrl(MSR_IA32_FEATURE_CONTROL, old); 2413 rdmsrl(MSR_IA32_FEATURE_CONTROL, old);
2345 2414
2346 test_bits = FEATURE_CONTROL_LOCKED; 2415 test_bits = FEATURE_CONTROL_LOCKED;
@@ -2697,6 +2766,7 @@ static void fix_pmode_dataseg(struct kvm_vcpu *vcpu, int seg, struct kvm_segment
2697 if (!(vmcs_readl(sf->base) == tmp.base && tmp.s)) { 2766 if (!(vmcs_readl(sf->base) == tmp.base && tmp.s)) {
2698 tmp.base = vmcs_readl(sf->base); 2767 tmp.base = vmcs_readl(sf->base);
2699 tmp.selector = vmcs_read16(sf->selector); 2768 tmp.selector = vmcs_read16(sf->selector);
2769 tmp.dpl = tmp.selector & SELECTOR_RPL_MASK;
2700 tmp.s = 1; 2770 tmp.s = 1;
2701 } 2771 }
2702 vmx_set_segment(vcpu, &tmp, seg); 2772 vmx_set_segment(vcpu, &tmp, seg);
@@ -3246,7 +3316,7 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu,
3246 * unrestricted guest like Westmere to older host that don't have 3316 * unrestricted guest like Westmere to older host that don't have
3247 * unrestricted guest like Nehelem. 3317 * unrestricted guest like Nehelem.
3248 */ 3318 */
3249 if (!enable_unrestricted_guest && vmx->rmode.vm86_active) { 3319 if (vmx->rmode.vm86_active) {
3250 switch (seg) { 3320 switch (seg) {
3251 case VCPU_SREG_CS: 3321 case VCPU_SREG_CS:
3252 vmcs_write32(GUEST_CS_AR_BYTES, 0xf3); 3322 vmcs_write32(GUEST_CS_AR_BYTES, 0xf3);
@@ -3897,8 +3967,6 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
3897 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL); 3967 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL);
3898 set_cr4_guest_host_mask(vmx); 3968 set_cr4_guest_host_mask(vmx);
3899 3969
3900 kvm_write_tsc(&vmx->vcpu, 0);
3901
3902 return 0; 3970 return 0;
3903} 3971}
3904 3972
@@ -3908,8 +3976,6 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
3908 u64 msr; 3976 u64 msr;
3909 int ret; 3977 int ret;
3910 3978
3911 vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP));
3912
3913 vmx->rmode.vm86_active = 0; 3979 vmx->rmode.vm86_active = 0;
3914 3980
3915 vmx->soft_vnmi_blocked = 0; 3981 vmx->soft_vnmi_blocked = 0;
@@ -3921,10 +3987,6 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
3921 msr |= MSR_IA32_APICBASE_BSP; 3987 msr |= MSR_IA32_APICBASE_BSP;
3922 kvm_set_apic_base(&vmx->vcpu, msr); 3988 kvm_set_apic_base(&vmx->vcpu, msr);
3923 3989
3924 ret = fx_init(&vmx->vcpu);
3925 if (ret != 0)
3926 goto out;
3927
3928 vmx_segment_cache_clear(vmx); 3990 vmx_segment_cache_clear(vmx);
3929 3991
3930 seg_setup(VCPU_SREG_CS); 3992 seg_setup(VCPU_SREG_CS);
@@ -3965,7 +4027,6 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
3965 kvm_rip_write(vcpu, 0xfff0); 4027 kvm_rip_write(vcpu, 0xfff0);
3966 else 4028 else
3967 kvm_rip_write(vcpu, 0); 4029 kvm_rip_write(vcpu, 0);
3968 kvm_register_write(vcpu, VCPU_REGS_RSP, 0);
3969 4030
3970 vmcs_writel(GUEST_GDTR_BASE, 0); 4031 vmcs_writel(GUEST_GDTR_BASE, 0);
3971 vmcs_write32(GUEST_GDTR_LIMIT, 0xffff); 4032 vmcs_write32(GUEST_GDTR_LIMIT, 0xffff);
@@ -4015,7 +4076,6 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4015 /* HACK: Don't enable emulation on guest boot/reset */ 4076 /* HACK: Don't enable emulation on guest boot/reset */
4016 vmx->emulation_required = 0; 4077 vmx->emulation_required = 0;
4017 4078
4018out:
4019 return ret; 4079 return ret;
4020} 4080}
4021 4081
@@ -4287,16 +4347,6 @@ static int handle_exception(struct kvm_vcpu *vcpu)
4287 if (is_machine_check(intr_info)) 4347 if (is_machine_check(intr_info))
4288 return handle_machine_check(vcpu); 4348 return handle_machine_check(vcpu);
4289 4349
4290 if ((vect_info & VECTORING_INFO_VALID_MASK) &&
4291 !is_page_fault(intr_info)) {
4292 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
4293 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;
4294 vcpu->run->internal.ndata = 2;
4295 vcpu->run->internal.data[0] = vect_info;
4296 vcpu->run->internal.data[1] = intr_info;
4297 return 0;
4298 }
4299
4300 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR) 4350 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)
4301 return 1; /* already handled by vmx_vcpu_run() */ 4351 return 1; /* already handled by vmx_vcpu_run() */
4302 4352
@@ -4315,6 +4365,22 @@ static int handle_exception(struct kvm_vcpu *vcpu)
4315 error_code = 0; 4365 error_code = 0;
4316 if (intr_info & INTR_INFO_DELIVER_CODE_MASK) 4366 if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
4317 error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); 4367 error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);
4368
4369 /*
4370 * The #PF with PFEC.RSVD = 1 indicates the guest is accessing
4371 * MMIO, it is better to report an internal error.
4372 * See the comments in vmx_handle_exit.
4373 */
4374 if ((vect_info & VECTORING_INFO_VALID_MASK) &&
4375 !(is_page_fault(intr_info) && !(error_code & PFERR_RSVD_MASK))) {
4376 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
4377 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;
4378 vcpu->run->internal.ndata = 2;
4379 vcpu->run->internal.data[0] = vect_info;
4380 vcpu->run->internal.data[1] = intr_info;
4381 return 0;
4382 }
4383
4318 if (is_page_fault(intr_info)) { 4384 if (is_page_fault(intr_info)) {
4319 /* EPT won't cause page fault directly */ 4385 /* EPT won't cause page fault directly */
4320 BUG_ON(enable_ept); 4386 BUG_ON(enable_ept);
@@ -4626,11 +4692,15 @@ static int handle_rdmsr(struct kvm_vcpu *vcpu)
4626 4692
4627static int handle_wrmsr(struct kvm_vcpu *vcpu) 4693static int handle_wrmsr(struct kvm_vcpu *vcpu)
4628{ 4694{
4695 struct msr_data msr;
4629 u32 ecx = vcpu->arch.regs[VCPU_REGS_RCX]; 4696 u32 ecx = vcpu->arch.regs[VCPU_REGS_RCX];
4630 u64 data = (vcpu->arch.regs[VCPU_REGS_RAX] & -1u) 4697 u64 data = (vcpu->arch.regs[VCPU_REGS_RAX] & -1u)
4631 | ((u64)(vcpu->arch.regs[VCPU_REGS_RDX] & -1u) << 32); 4698 | ((u64)(vcpu->arch.regs[VCPU_REGS_RDX] & -1u) << 32);
4632 4699
4633 if (vmx_set_msr(vcpu, ecx, data) != 0) { 4700 msr.data = data;
4701 msr.index = ecx;
4702 msr.host_initiated = false;
4703 if (vmx_set_msr(vcpu, &msr) != 0) {
4634 trace_kvm_msr_write_ex(ecx, data); 4704 trace_kvm_msr_write_ex(ecx, data);
4635 kvm_inject_gp(vcpu, 0); 4705 kvm_inject_gp(vcpu, 0);
4636 return 1; 4706 return 1;
@@ -4827,11 +4897,6 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
4827 4897
4828 exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 4898 exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
4829 4899
4830 if (exit_qualification & (1 << 6)) {
4831 printk(KERN_ERR "EPT: GPA exceeds GAW!\n");
4832 return -EINVAL;
4833 }
4834
4835 gla_validity = (exit_qualification >> 7) & 0x3; 4900 gla_validity = (exit_qualification >> 7) & 0x3;
4836 if (gla_validity != 0x3 && gla_validity != 0x1 && gla_validity != 0) { 4901 if (gla_validity != 0x3 && gla_validity != 0x1 && gla_validity != 0) {
4837 printk(KERN_ERR "EPT: Handling EPT violation failed!\n"); 4902 printk(KERN_ERR "EPT: Handling EPT violation failed!\n");
@@ -5979,13 +6044,24 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
5979 return 0; 6044 return 0;
5980 } 6045 }
5981 6046
6047 /*
6048 * Note:
6049 * Do not try to fix EXIT_REASON_EPT_MISCONFIG if it caused by
6050 * delivery event since it indicates guest is accessing MMIO.
6051 * The vm-exit can be triggered again after return to guest that
6052 * will cause infinite loop.
6053 */
5982 if ((vectoring_info & VECTORING_INFO_VALID_MASK) && 6054 if ((vectoring_info & VECTORING_INFO_VALID_MASK) &&
5983 (exit_reason != EXIT_REASON_EXCEPTION_NMI && 6055 (exit_reason != EXIT_REASON_EXCEPTION_NMI &&
5984 exit_reason != EXIT_REASON_EPT_VIOLATION && 6056 exit_reason != EXIT_REASON_EPT_VIOLATION &&
5985 exit_reason != EXIT_REASON_TASK_SWITCH)) 6057 exit_reason != EXIT_REASON_TASK_SWITCH)) {
5986 printk(KERN_WARNING "%s: unexpected, valid vectoring info " 6058 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
5987 "(0x%x) and exit reason is 0x%x\n", 6059 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV;
5988 __func__, vectoring_info, exit_reason); 6060 vcpu->run->internal.ndata = 2;
6061 vcpu->run->internal.data[0] = vectoring_info;
6062 vcpu->run->internal.data[1] = exit_reason;
6063 return 0;
6064 }
5989 6065
5990 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked && 6066 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked &&
5991 !(is_guest_mode(vcpu) && nested_cpu_has_virtual_nmis( 6067 !(is_guest_mode(vcpu) && nested_cpu_has_virtual_nmis(
@@ -7309,6 +7385,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
7309 .has_wbinvd_exit = cpu_has_vmx_wbinvd_exit, 7385 .has_wbinvd_exit = cpu_has_vmx_wbinvd_exit,
7310 7386
7311 .set_tsc_khz = vmx_set_tsc_khz, 7387 .set_tsc_khz = vmx_set_tsc_khz,
7388 .read_tsc_offset = vmx_read_tsc_offset,
7312 .write_tsc_offset = vmx_write_tsc_offset, 7389 .write_tsc_offset = vmx_write_tsc_offset,
7313 .adjust_tsc_offset = vmx_adjust_tsc_offset, 7390 .adjust_tsc_offset = vmx_adjust_tsc_offset,
7314 .compute_tsc_offset = vmx_compute_tsc_offset, 7391 .compute_tsc_offset = vmx_compute_tsc_offset,
@@ -7367,6 +7444,11 @@ static int __init vmx_init(void)
7367 if (r) 7444 if (r)
7368 goto out3; 7445 goto out3;
7369 7446
7447#ifdef CONFIG_KEXEC
7448 rcu_assign_pointer(crash_vmclear_loaded_vmcss,
7449 crash_vmclear_local_loaded_vmcss);
7450#endif
7451
7370 vmx_disable_intercept_for_msr(MSR_FS_BASE, false); 7452 vmx_disable_intercept_for_msr(MSR_FS_BASE, false);
7371 vmx_disable_intercept_for_msr(MSR_GS_BASE, false); 7453 vmx_disable_intercept_for_msr(MSR_GS_BASE, false);
7372 vmx_disable_intercept_for_msr(MSR_KERNEL_GS_BASE, true); 7454 vmx_disable_intercept_for_msr(MSR_KERNEL_GS_BASE, true);
@@ -7404,6 +7486,11 @@ static void __exit vmx_exit(void)
7404 free_page((unsigned long)vmx_io_bitmap_b); 7486 free_page((unsigned long)vmx_io_bitmap_b);
7405 free_page((unsigned long)vmx_io_bitmap_a); 7487 free_page((unsigned long)vmx_io_bitmap_a);
7406 7488
7489#ifdef CONFIG_KEXEC
7490 rcu_assign_pointer(crash_vmclear_loaded_vmcss, NULL);
7491 synchronize_rcu();
7492#endif
7493
7407 kvm_exit(); 7494 kvm_exit();
7408} 7495}
7409 7496
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4f7641756be..76f54461f7c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -46,6 +46,8 @@
46#include <linux/uaccess.h> 46#include <linux/uaccess.h>
47#include <linux/hash.h> 47#include <linux/hash.h>
48#include <linux/pci.h> 48#include <linux/pci.h>
49#include <linux/timekeeper_internal.h>
50#include <linux/pvclock_gtod.h>
49#include <trace/events/kvm.h> 51#include <trace/events/kvm.h>
50 52
51#define CREATE_TRACE_POINTS 53#define CREATE_TRACE_POINTS
@@ -158,7 +160,9 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
158 160
159u64 __read_mostly host_xcr0; 161u64 __read_mostly host_xcr0;
160 162
161int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt); 163static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt);
164
165static int kvm_vcpu_reset(struct kvm_vcpu *vcpu);
162 166
163static inline void kvm_async_pf_hash_reset(struct kvm_vcpu *vcpu) 167static inline void kvm_async_pf_hash_reset(struct kvm_vcpu *vcpu)
164{ 168{
@@ -633,7 +637,7 @@ int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
633 } 637 }
634 638
635 if (is_long_mode(vcpu)) { 639 if (is_long_mode(vcpu)) {
636 if (kvm_read_cr4(vcpu) & X86_CR4_PCIDE) { 640 if (kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE)) {
637 if (cr3 & CR3_PCID_ENABLED_RESERVED_BITS) 641 if (cr3 & CR3_PCID_ENABLED_RESERVED_BITS)
638 return 1; 642 return 1;
639 } else 643 } else
@@ -827,6 +831,7 @@ static u32 msrs_to_save[] = {
827static unsigned num_msrs_to_save; 831static unsigned num_msrs_to_save;
828 832
829static const u32 emulated_msrs[] = { 833static const u32 emulated_msrs[] = {
834 MSR_IA32_TSC_ADJUST,
830 MSR_IA32_TSCDEADLINE, 835 MSR_IA32_TSCDEADLINE,
831 MSR_IA32_MISC_ENABLE, 836 MSR_IA32_MISC_ENABLE,
832 MSR_IA32_MCG_STATUS, 837 MSR_IA32_MCG_STATUS,
@@ -886,9 +891,9 @@ EXPORT_SYMBOL_GPL(kvm_enable_efer_bits);
886 * Returns 0 on success, non-0 otherwise. 891 * Returns 0 on success, non-0 otherwise.
887 * Assumes vcpu_load() was already called. 892 * Assumes vcpu_load() was already called.
888 */ 893 */
889int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) 894int kvm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
890{ 895{
891 return kvm_x86_ops->set_msr(vcpu, msr_index, data); 896 return kvm_x86_ops->set_msr(vcpu, msr);
892} 897}
893 898
894/* 899/*
@@ -896,9 +901,63 @@ int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
896 */ 901 */
897static int do_set_msr(struct kvm_vcpu *vcpu, unsigned index, u64 *data) 902static int do_set_msr(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
898{ 903{
899 return kvm_set_msr(vcpu, index, *data); 904 struct msr_data msr;
905
906 msr.data = *data;
907 msr.index = index;
908 msr.host_initiated = true;
909 return kvm_set_msr(vcpu, &msr);
900} 910}
901 911
912#ifdef CONFIG_X86_64
913struct pvclock_gtod_data {
914 seqcount_t seq;
915
916 struct { /* extract of a clocksource struct */
917 int vclock_mode;
918 cycle_t cycle_last;
919 cycle_t mask;
920 u32 mult;
921 u32 shift;
922 } clock;
923
924 /* open coded 'struct timespec' */
925 u64 monotonic_time_snsec;
926 time_t monotonic_time_sec;
927};
928
929static struct pvclock_gtod_data pvclock_gtod_data;
930
931static void update_pvclock_gtod(struct timekeeper *tk)
932{
933 struct pvclock_gtod_data *vdata = &pvclock_gtod_data;
934
935 write_seqcount_begin(&vdata->seq);
936
937 /* copy pvclock gtod data */
938 vdata->clock.vclock_mode = tk->clock->archdata.vclock_mode;
939 vdata->clock.cycle_last = tk->clock->cycle_last;
940 vdata->clock.mask = tk->clock->mask;
941 vdata->clock.mult = tk->mult;
942 vdata->clock.shift = tk->shift;
943
944 vdata->monotonic_time_sec = tk->xtime_sec
945 + tk->wall_to_monotonic.tv_sec;
946 vdata->monotonic_time_snsec = tk->xtime_nsec
947 + (tk->wall_to_monotonic.tv_nsec
948 << tk->shift);
949 while (vdata->monotonic_time_snsec >=
950 (((u64)NSEC_PER_SEC) << tk->shift)) {
951 vdata->monotonic_time_snsec -=
952 ((u64)NSEC_PER_SEC) << tk->shift;
953 vdata->monotonic_time_sec++;
954 }
955
956 write_seqcount_end(&vdata->seq);
957}
958#endif
959
960
902static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock) 961static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
903{ 962{
904 int version; 963 int version;
@@ -995,6 +1054,10 @@ static inline u64 get_kernel_ns(void)
995 return timespec_to_ns(&ts); 1054 return timespec_to_ns(&ts);
996} 1055}
997 1056
1057#ifdef CONFIG_X86_64
1058static atomic_t kvm_guest_has_master_clock = ATOMIC_INIT(0);
1059#endif
1060
998static DEFINE_PER_CPU(unsigned long, cpu_tsc_khz); 1061static DEFINE_PER_CPU(unsigned long, cpu_tsc_khz);
999unsigned long max_tsc_khz; 1062unsigned long max_tsc_khz;
1000 1063
@@ -1046,12 +1109,47 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns)
1046 return tsc; 1109 return tsc;
1047} 1110}
1048 1111
1049void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data) 1112void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
1113{
1114#ifdef CONFIG_X86_64
1115 bool vcpus_matched;
1116 bool do_request = false;
1117 struct kvm_arch *ka = &vcpu->kvm->arch;
1118 struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
1119
1120 vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 ==
1121 atomic_read(&vcpu->kvm->online_vcpus));
1122
1123 if (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC)
1124 if (!ka->use_master_clock)
1125 do_request = 1;
1126
1127 if (!vcpus_matched && ka->use_master_clock)
1128 do_request = 1;
1129
1130 if (do_request)
1131 kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
1132
1133 trace_kvm_track_tsc(vcpu->vcpu_id, ka->nr_vcpus_matched_tsc,
1134 atomic_read(&vcpu->kvm->online_vcpus),
1135 ka->use_master_clock, gtod->clock.vclock_mode);
1136#endif
1137}
1138
1139static void update_ia32_tsc_adjust_msr(struct kvm_vcpu *vcpu, s64 offset)
1140{
1141 u64 curr_offset = kvm_x86_ops->read_tsc_offset(vcpu);
1142 vcpu->arch.ia32_tsc_adjust_msr += offset - curr_offset;
1143}
1144
1145void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr)
1050{ 1146{
1051 struct kvm *kvm = vcpu->kvm; 1147 struct kvm *kvm = vcpu->kvm;
1052 u64 offset, ns, elapsed; 1148 u64 offset, ns, elapsed;
1053 unsigned long flags; 1149 unsigned long flags;
1054 s64 usdiff; 1150 s64 usdiff;
1151 bool matched;
1152 u64 data = msr->data;
1055 1153
1056 raw_spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags); 1154 raw_spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags);
1057 offset = kvm_x86_ops->compute_tsc_offset(vcpu, data); 1155 offset = kvm_x86_ops->compute_tsc_offset(vcpu, data);
@@ -1094,6 +1192,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)
1094 offset = kvm_x86_ops->compute_tsc_offset(vcpu, data); 1192 offset = kvm_x86_ops->compute_tsc_offset(vcpu, data);
1095 pr_debug("kvm: adjusted tsc offset by %llu\n", delta); 1193 pr_debug("kvm: adjusted tsc offset by %llu\n", delta);
1096 } 1194 }
1195 matched = true;
1097 } else { 1196 } else {
1098 /* 1197 /*
1099 * We split periods of matched TSC writes into generations. 1198 * We split periods of matched TSC writes into generations.
@@ -1108,6 +1207,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)
1108 kvm->arch.cur_tsc_nsec = ns; 1207 kvm->arch.cur_tsc_nsec = ns;
1109 kvm->arch.cur_tsc_write = data; 1208 kvm->arch.cur_tsc_write = data;
1110 kvm->arch.cur_tsc_offset = offset; 1209 kvm->arch.cur_tsc_offset = offset;
1210 matched = false;
1111 pr_debug("kvm: new tsc generation %u, clock %llu\n", 1211 pr_debug("kvm: new tsc generation %u, clock %llu\n",
1112 kvm->arch.cur_tsc_generation, data); 1212 kvm->arch.cur_tsc_generation, data);
1113 } 1213 }
@@ -1129,26 +1229,195 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)
1129 vcpu->arch.this_tsc_nsec = kvm->arch.cur_tsc_nsec; 1229 vcpu->arch.this_tsc_nsec = kvm->arch.cur_tsc_nsec;
1130 vcpu->arch.this_tsc_write = kvm->arch.cur_tsc_write; 1230 vcpu->arch.this_tsc_write = kvm->arch.cur_tsc_write;
1131 1231
1232 if (guest_cpuid_has_tsc_adjust(vcpu) && !msr->host_initiated)
1233 update_ia32_tsc_adjust_msr(vcpu, offset);
1132 kvm_x86_ops->write_tsc_offset(vcpu, offset); 1234 kvm_x86_ops->write_tsc_offset(vcpu, offset);
1133 raw_spin_unlock_irqrestore(&kvm->arch.tsc_write_lock, flags); 1235 raw_spin_unlock_irqrestore(&kvm->arch.tsc_write_lock, flags);
1236
1237 spin_lock(&kvm->arch.pvclock_gtod_sync_lock);
1238 if (matched)
1239 kvm->arch.nr_vcpus_matched_tsc++;
1240 else
1241 kvm->arch.nr_vcpus_matched_tsc = 0;
1242
1243 kvm_track_tsc_matching(vcpu);
1244 spin_unlock(&kvm->arch.pvclock_gtod_sync_lock);
1134} 1245}
1135 1246
1136EXPORT_SYMBOL_GPL(kvm_write_tsc); 1247EXPORT_SYMBOL_GPL(kvm_write_tsc);
1137 1248
1249#ifdef CONFIG_X86_64
1250
1251static cycle_t read_tsc(void)
1252{
1253 cycle_t ret;
1254 u64 last;
1255
1256 /*
1257 * Empirically, a fence (of type that depends on the CPU)
1258 * before rdtsc is enough to ensure that rdtsc is ordered
1259 * with respect to loads. The various CPU manuals are unclear
1260 * as to whether rdtsc can be reordered with later loads,
1261 * but no one has ever seen it happen.
1262 */
1263 rdtsc_barrier();
1264 ret = (cycle_t)vget_cycles();
1265
1266 last = pvclock_gtod_data.clock.cycle_last;
1267
1268 if (likely(ret >= last))
1269 return ret;
1270
1271 /*
1272 * GCC likes to generate cmov here, but this branch is extremely
1273 * predictable (it's just a funciton of time and the likely is
1274 * very likely) and there's a data dependence, so force GCC
1275 * to generate a branch instead. I don't barrier() because
1276 * we don't actually need a barrier, and if this function
1277 * ever gets inlined it will generate worse code.
1278 */
1279 asm volatile ("");
1280 return last;
1281}
1282
1283static inline u64 vgettsc(cycle_t *cycle_now)
1284{
1285 long v;
1286 struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
1287
1288 *cycle_now = read_tsc();
1289
1290 v = (*cycle_now - gtod->clock.cycle_last) & gtod->clock.mask;
1291 return v * gtod->clock.mult;
1292}
1293
1294static int do_monotonic(struct timespec *ts, cycle_t *cycle_now)
1295{
1296 unsigned long seq;
1297 u64 ns;
1298 int mode;
1299 struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
1300
1301 ts->tv_nsec = 0;
1302 do {
1303 seq = read_seqcount_begin(&gtod->seq);
1304 mode = gtod->clock.vclock_mode;
1305 ts->tv_sec = gtod->monotonic_time_sec;
1306 ns = gtod->monotonic_time_snsec;
1307 ns += vgettsc(cycle_now);
1308 ns >>= gtod->clock.shift;
1309 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
1310 timespec_add_ns(ts, ns);
1311
1312 return mode;
1313}
1314
1315/* returns true if host is using tsc clocksource */
1316static bool kvm_get_time_and_clockread(s64 *kernel_ns, cycle_t *cycle_now)
1317{
1318 struct timespec ts;
1319
1320 /* checked again under seqlock below */
1321 if (pvclock_gtod_data.clock.vclock_mode != VCLOCK_TSC)
1322 return false;
1323
1324 if (do_monotonic(&ts, cycle_now) != VCLOCK_TSC)
1325 return false;
1326
1327 monotonic_to_bootbased(&ts);
1328 *kernel_ns = timespec_to_ns(&ts);
1329
1330 return true;
1331}
1332#endif
1333
1334/*
1335 *
1336 * Assuming a stable TSC across physical CPUS, and a stable TSC
1337 * across virtual CPUs, the following condition is possible.
1338 * Each numbered line represents an event visible to both
1339 * CPUs at the next numbered event.
1340 *
1341 * "timespecX" represents host monotonic time. "tscX" represents
1342 * RDTSC value.
1343 *
1344 * VCPU0 on CPU0 | VCPU1 on CPU1
1345 *
1346 * 1. read timespec0,tsc0
1347 * 2. | timespec1 = timespec0 + N
1348 * | tsc1 = tsc0 + M
1349 * 3. transition to guest | transition to guest
1350 * 4. ret0 = timespec0 + (rdtsc - tsc0) |
1351 * 5. | ret1 = timespec1 + (rdtsc - tsc1)
1352 * | ret1 = timespec0 + N + (rdtsc - (tsc0 + M))
1353 *
1354 * Since ret0 update is visible to VCPU1 at time 5, to obey monotonicity:
1355 *
1356 * - ret0 < ret1
1357 * - timespec0 + (rdtsc - tsc0) < timespec0 + N + (rdtsc - (tsc0 + M))
1358 * ...
1359 * - 0 < N - M => M < N
1360 *
1361 * That is, when timespec0 != timespec1, M < N. Unfortunately that is not
1362 * always the case (the difference between two distinct xtime instances
1363 * might be smaller then the difference between corresponding TSC reads,
1364 * when updating guest vcpus pvclock areas).
1365 *
1366 * To avoid that problem, do not allow visibility of distinct
1367 * system_timestamp/tsc_timestamp values simultaneously: use a master
1368 * copy of host monotonic time values. Update that master copy
1369 * in lockstep.
1370 *
1371 * Rely on synchronization of host TSCs and guest TSCs for monotonicity.
1372 *
1373 */
1374
1375static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
1376{
1377#ifdef CONFIG_X86_64
1378 struct kvm_arch *ka = &kvm->arch;
1379 int vclock_mode;
1380 bool host_tsc_clocksource, vcpus_matched;
1381
1382 vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 ==
1383 atomic_read(&kvm->online_vcpus));
1384
1385 /*
1386 * If the host uses TSC clock, then passthrough TSC as stable
1387 * to the guest.
1388 */
1389 host_tsc_clocksource = kvm_get_time_and_clockread(
1390 &ka->master_kernel_ns,
1391 &ka->master_cycle_now);
1392
1393 ka->use_master_clock = host_tsc_clocksource & vcpus_matched;
1394
1395 if (ka->use_master_clock)
1396 atomic_set(&kvm_guest_has_master_clock, 1);
1397
1398 vclock_mode = pvclock_gtod_data.clock.vclock_mode;
1399 trace_kvm_update_master_clock(ka->use_master_clock, vclock_mode,
1400 vcpus_matched);
1401#endif
1402}
1403
1138static int kvm_guest_time_update(struct kvm_vcpu *v) 1404static int kvm_guest_time_update(struct kvm_vcpu *v)
1139{ 1405{
1140 unsigned long flags; 1406 unsigned long flags, this_tsc_khz;
1141 struct kvm_vcpu_arch *vcpu = &v->arch; 1407 struct kvm_vcpu_arch *vcpu = &v->arch;
1408 struct kvm_arch *ka = &v->kvm->arch;
1142 void *shared_kaddr; 1409 void *shared_kaddr;
1143 unsigned long this_tsc_khz;
1144 s64 kernel_ns, max_kernel_ns; 1410 s64 kernel_ns, max_kernel_ns;
1145 u64 tsc_timestamp; 1411 u64 tsc_timestamp, host_tsc;
1412 struct pvclock_vcpu_time_info *guest_hv_clock;
1146 u8 pvclock_flags; 1413 u8 pvclock_flags;
1414 bool use_master_clock;
1415
1416 kernel_ns = 0;
1417 host_tsc = 0;
1147 1418
1148 /* Keep irq disabled to prevent changes to the clock */ 1419 /* Keep irq disabled to prevent changes to the clock */
1149 local_irq_save(flags); 1420 local_irq_save(flags);
1150 tsc_timestamp = kvm_x86_ops->read_l1_tsc(v);
1151 kernel_ns = get_kernel_ns();
1152 this_tsc_khz = __get_cpu_var(cpu_tsc_khz); 1421 this_tsc_khz = __get_cpu_var(cpu_tsc_khz);
1153 if (unlikely(this_tsc_khz == 0)) { 1422 if (unlikely(this_tsc_khz == 0)) {
1154 local_irq_restore(flags); 1423 local_irq_restore(flags);
@@ -1157,6 +1426,24 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
1157 } 1426 }
1158 1427
1159 /* 1428 /*
1429 * If the host uses TSC clock, then passthrough TSC as stable
1430 * to the guest.
1431 */
1432 spin_lock(&ka->pvclock_gtod_sync_lock);
1433 use_master_clock = ka->use_master_clock;
1434 if (use_master_clock) {
1435 host_tsc = ka->master_cycle_now;
1436 kernel_ns = ka->master_kernel_ns;
1437 }
1438 spin_unlock(&ka->pvclock_gtod_sync_lock);
1439 if (!use_master_clock) {
1440 host_tsc = native_read_tsc();
1441 kernel_ns = get_kernel_ns();
1442 }
1443
1444 tsc_timestamp = kvm_x86_ops->read_l1_tsc(v, host_tsc);
1445
1446 /*
1160 * We may have to catch up the TSC to match elapsed wall clock 1447 * We may have to catch up the TSC to match elapsed wall clock
1161 * time for two reasons, even if kvmclock is used. 1448 * time for two reasons, even if kvmclock is used.
1162 * 1) CPU could have been running below the maximum TSC rate 1449 * 1) CPU could have been running below the maximum TSC rate
@@ -1217,23 +1504,20 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
1217 vcpu->hw_tsc_khz = this_tsc_khz; 1504 vcpu->hw_tsc_khz = this_tsc_khz;
1218 } 1505 }
1219 1506
1220 if (max_kernel_ns > kernel_ns) 1507 /* with a master <monotonic time, tsc value> tuple,
1221 kernel_ns = max_kernel_ns; 1508 * pvclock clock reads always increase at the (scaled) rate
1222 1509 * of guest TSC - no need to deal with sampling errors.
1510 */
1511 if (!use_master_clock) {
1512 if (max_kernel_ns > kernel_ns)
1513 kernel_ns = max_kernel_ns;
1514 }
1223 /* With all the info we got, fill in the values */ 1515 /* With all the info we got, fill in the values */
1224 vcpu->hv_clock.tsc_timestamp = tsc_timestamp; 1516 vcpu->hv_clock.tsc_timestamp = tsc_timestamp;
1225 vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; 1517 vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
1226 vcpu->last_kernel_ns = kernel_ns; 1518 vcpu->last_kernel_ns = kernel_ns;
1227 vcpu->last_guest_tsc = tsc_timestamp; 1519 vcpu->last_guest_tsc = tsc_timestamp;
1228 1520
1229 pvclock_flags = 0;
1230 if (vcpu->pvclock_set_guest_stopped_request) {
1231 pvclock_flags |= PVCLOCK_GUEST_STOPPED;
1232 vcpu->pvclock_set_guest_stopped_request = false;
1233 }
1234
1235 vcpu->hv_clock.flags = pvclock_flags;
1236
1237 /* 1521 /*
1238 * The interface expects us to write an even number signaling that the 1522 * The interface expects us to write an even number signaling that the
1239 * update is finished. Since the guest won't see the intermediate 1523 * update is finished. Since the guest won't see the intermediate
@@ -1243,6 +1527,22 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
1243 1527
1244 shared_kaddr = kmap_atomic(vcpu->time_page); 1528 shared_kaddr = kmap_atomic(vcpu->time_page);
1245 1529
1530 guest_hv_clock = shared_kaddr + vcpu->time_offset;
1531
1532 /* retain PVCLOCK_GUEST_STOPPED if set in guest copy */
1533 pvclock_flags = (guest_hv_clock->flags & PVCLOCK_GUEST_STOPPED);
1534
1535 if (vcpu->pvclock_set_guest_stopped_request) {
1536 pvclock_flags |= PVCLOCK_GUEST_STOPPED;
1537 vcpu->pvclock_set_guest_stopped_request = false;
1538 }
1539
1540 /* If the host uses TSC clocksource, then it is stable */
1541 if (use_master_clock)
1542 pvclock_flags |= PVCLOCK_TSC_STABLE_BIT;
1543
1544 vcpu->hv_clock.flags = pvclock_flags;
1545
1246 memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock, 1546 memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock,
1247 sizeof(vcpu->hv_clock)); 1547 sizeof(vcpu->hv_clock));
1248 1548
@@ -1572,9 +1872,11 @@ static void record_steal_time(struct kvm_vcpu *vcpu)
1572 &vcpu->arch.st.steal, sizeof(struct kvm_steal_time)); 1872 &vcpu->arch.st.steal, sizeof(struct kvm_steal_time));
1573} 1873}
1574 1874
1575int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) 1875int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
1576{ 1876{
1577 bool pr = false; 1877 bool pr = false;
1878 u32 msr = msr_info->index;
1879 u64 data = msr_info->data;
1578 1880
1579 switch (msr) { 1881 switch (msr) {
1580 case MSR_EFER: 1882 case MSR_EFER:
@@ -1625,6 +1927,15 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1625 case MSR_IA32_TSCDEADLINE: 1927 case MSR_IA32_TSCDEADLINE:
1626 kvm_set_lapic_tscdeadline_msr(vcpu, data); 1928 kvm_set_lapic_tscdeadline_msr(vcpu, data);
1627 break; 1929 break;
1930 case MSR_IA32_TSC_ADJUST:
1931 if (guest_cpuid_has_tsc_adjust(vcpu)) {
1932 if (!msr_info->host_initiated) {
1933 u64 adj = data - vcpu->arch.ia32_tsc_adjust_msr;
1934 kvm_x86_ops->adjust_tsc_offset(vcpu, adj, true);
1935 }
1936 vcpu->arch.ia32_tsc_adjust_msr = data;
1937 }
1938 break;
1628 case MSR_IA32_MISC_ENABLE: 1939 case MSR_IA32_MISC_ENABLE:
1629 vcpu->arch.ia32_misc_enable_msr = data; 1940 vcpu->arch.ia32_misc_enable_msr = data;
1630 break; 1941 break;
@@ -1984,6 +2295,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
1984 case MSR_IA32_TSCDEADLINE: 2295 case MSR_IA32_TSCDEADLINE:
1985 data = kvm_get_lapic_tscdeadline_msr(vcpu); 2296 data = kvm_get_lapic_tscdeadline_msr(vcpu);
1986 break; 2297 break;
2298 case MSR_IA32_TSC_ADJUST:
2299 data = (u64)vcpu->arch.ia32_tsc_adjust_msr;
2300 break;
1987 case MSR_IA32_MISC_ENABLE: 2301 case MSR_IA32_MISC_ENABLE:
1988 data = vcpu->arch.ia32_misc_enable_msr; 2302 data = vcpu->arch.ia32_misc_enable_msr;
1989 break; 2303 break;
@@ -2342,7 +2656,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
2342 kvm_x86_ops->write_tsc_offset(vcpu, offset); 2656 kvm_x86_ops->write_tsc_offset(vcpu, offset);
2343 vcpu->arch.tsc_catchup = 1; 2657 vcpu->arch.tsc_catchup = 1;
2344 } 2658 }
2345 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); 2659 /*
2660 * On a host with synchronized TSC, there is no need to update
2661 * kvmclock on vcpu->cpu migration
2662 */
2663 if (!vcpu->kvm->arch.use_master_clock || vcpu->cpu == -1)
2664 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
2346 if (vcpu->cpu != cpu) 2665 if (vcpu->cpu != cpu)
2347 kvm_migrate_timers(vcpu); 2666 kvm_migrate_timers(vcpu);
2348 vcpu->cpu = cpu; 2667 vcpu->cpu = cpu;
@@ -2691,15 +3010,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2691 if (!vcpu->arch.apic) 3010 if (!vcpu->arch.apic)
2692 goto out; 3011 goto out;
2693 u.lapic = memdup_user(argp, sizeof(*u.lapic)); 3012 u.lapic = memdup_user(argp, sizeof(*u.lapic));
2694 if (IS_ERR(u.lapic)) { 3013 if (IS_ERR(u.lapic))
2695 r = PTR_ERR(u.lapic); 3014 return PTR_ERR(u.lapic);
2696 goto out;
2697 }
2698 3015
2699 r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic); 3016 r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic);
2700 if (r)
2701 goto out;
2702 r = 0;
2703 break; 3017 break;
2704 } 3018 }
2705 case KVM_INTERRUPT: { 3019 case KVM_INTERRUPT: {
@@ -2709,16 +3023,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2709 if (copy_from_user(&irq, argp, sizeof irq)) 3023 if (copy_from_user(&irq, argp, sizeof irq))
2710 goto out; 3024 goto out;
2711 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); 3025 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
2712 if (r)
2713 goto out;
2714 r = 0;
2715 break; 3026 break;
2716 } 3027 }
2717 case KVM_NMI: { 3028 case KVM_NMI: {
2718 r = kvm_vcpu_ioctl_nmi(vcpu); 3029 r = kvm_vcpu_ioctl_nmi(vcpu);
2719 if (r)
2720 goto out;
2721 r = 0;
2722 break; 3030 break;
2723 } 3031 }
2724 case KVM_SET_CPUID: { 3032 case KVM_SET_CPUID: {
@@ -2729,8 +3037,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2729 if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) 3037 if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
2730 goto out; 3038 goto out;
2731 r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries); 3039 r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries);
2732 if (r)
2733 goto out;
2734 break; 3040 break;
2735 } 3041 }
2736 case KVM_SET_CPUID2: { 3042 case KVM_SET_CPUID2: {
@@ -2742,8 +3048,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2742 goto out; 3048 goto out;
2743 r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid, 3049 r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid,
2744 cpuid_arg->entries); 3050 cpuid_arg->entries);
2745 if (r)
2746 goto out;
2747 break; 3051 break;
2748 } 3052 }
2749 case KVM_GET_CPUID2: { 3053 case KVM_GET_CPUID2: {
@@ -2875,10 +3179,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2875 } 3179 }
2876 case KVM_SET_XSAVE: { 3180 case KVM_SET_XSAVE: {
2877 u.xsave = memdup_user(argp, sizeof(*u.xsave)); 3181 u.xsave = memdup_user(argp, sizeof(*u.xsave));
2878 if (IS_ERR(u.xsave)) { 3182 if (IS_ERR(u.xsave))
2879 r = PTR_ERR(u.xsave); 3183 return PTR_ERR(u.xsave);
2880 goto out;
2881 }
2882 3184
2883 r = kvm_vcpu_ioctl_x86_set_xsave(vcpu, u.xsave); 3185 r = kvm_vcpu_ioctl_x86_set_xsave(vcpu, u.xsave);
2884 break; 3186 break;
@@ -2900,10 +3202,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2900 } 3202 }
2901 case KVM_SET_XCRS: { 3203 case KVM_SET_XCRS: {
2902 u.xcrs = memdup_user(argp, sizeof(*u.xcrs)); 3204 u.xcrs = memdup_user(argp, sizeof(*u.xcrs));
2903 if (IS_ERR(u.xcrs)) { 3205 if (IS_ERR(u.xcrs))
2904 r = PTR_ERR(u.xcrs); 3206 return PTR_ERR(u.xcrs);
2905 goto out;
2906 }
2907 3207
2908 r = kvm_vcpu_ioctl_x86_set_xcrs(vcpu, u.xcrs); 3208 r = kvm_vcpu_ioctl_x86_set_xcrs(vcpu, u.xcrs);
2909 break; 3209 break;
@@ -2951,7 +3251,7 @@ static int kvm_vm_ioctl_set_tss_addr(struct kvm *kvm, unsigned long addr)
2951 int ret; 3251 int ret;
2952 3252
2953 if (addr > (unsigned int)(-3 * PAGE_SIZE)) 3253 if (addr > (unsigned int)(-3 * PAGE_SIZE))
2954 return -1; 3254 return -EINVAL;
2955 ret = kvm_x86_ops->set_tss_addr(kvm, addr); 3255 ret = kvm_x86_ops->set_tss_addr(kvm, addr);
2956 return ret; 3256 return ret;
2957} 3257}
@@ -3212,8 +3512,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3212 switch (ioctl) { 3512 switch (ioctl) {
3213 case KVM_SET_TSS_ADDR: 3513 case KVM_SET_TSS_ADDR:
3214 r = kvm_vm_ioctl_set_tss_addr(kvm, arg); 3514 r = kvm_vm_ioctl_set_tss_addr(kvm, arg);
3215 if (r < 0)
3216 goto out;
3217 break; 3515 break;
3218 case KVM_SET_IDENTITY_MAP_ADDR: { 3516 case KVM_SET_IDENTITY_MAP_ADDR: {
3219 u64 ident_addr; 3517 u64 ident_addr;
@@ -3222,14 +3520,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
3222 if (copy_from_user(&ident_addr, argp, sizeof ident_addr)) 3520 if (copy_from_user(&ident_addr, argp, sizeof ident_addr))
3223 goto out; 3521 goto out;
3224 r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr); 3522 r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr);
3225 if (r < 0)
3226 goto out;
3227 break; 3523 break;
3228 } 3524 }
3229 case KVM_SET_NR_MMU_PAGES: 3525 case KVM_SET_NR_MMU_PAGES:
3230 r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg); 3526 r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg);
3231 if (r)
3232 goto out;
3233 break; 3527 break;
3234 case KVM_GET_NR_MMU_PAGES: 3528 case KVM_GET_NR_MMU_PAGES:
3235 r = kvm_vm_ioctl_get_nr_mmu_pages(kvm); 3529 r = kvm_vm_ioctl_get_nr_mmu_pages(kvm);
@@ -3320,8 +3614,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3320 r = 0; 3614 r = 0;
3321 get_irqchip_out: 3615 get_irqchip_out:
3322 kfree(chip); 3616 kfree(chip);
3323 if (r)
3324 goto out;
3325 break; 3617 break;
3326 } 3618 }
3327 case KVM_SET_IRQCHIP: { 3619 case KVM_SET_IRQCHIP: {
@@ -3343,8 +3635,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3343 r = 0; 3635 r = 0;
3344 set_irqchip_out: 3636 set_irqchip_out:
3345 kfree(chip); 3637 kfree(chip);
3346 if (r)
3347 goto out;
3348 break; 3638 break;
3349 } 3639 }
3350 case KVM_GET_PIT: { 3640 case KVM_GET_PIT: {
@@ -3371,9 +3661,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3371 if (!kvm->arch.vpit) 3661 if (!kvm->arch.vpit)
3372 goto out; 3662 goto out;
3373 r = kvm_vm_ioctl_set_pit(kvm, &u.ps); 3663 r = kvm_vm_ioctl_set_pit(kvm, &u.ps);
3374 if (r)
3375 goto out;
3376 r = 0;
3377 break; 3664 break;
3378 } 3665 }
3379 case KVM_GET_PIT2: { 3666 case KVM_GET_PIT2: {
@@ -3397,9 +3684,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3397 if (!kvm->arch.vpit) 3684 if (!kvm->arch.vpit)
3398 goto out; 3685 goto out;
3399 r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2); 3686 r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2);
3400 if (r)
3401 goto out;
3402 r = 0;
3403 break; 3687 break;
3404 } 3688 }
3405 case KVM_REINJECT_CONTROL: { 3689 case KVM_REINJECT_CONTROL: {
@@ -3408,9 +3692,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3408 if (copy_from_user(&control, argp, sizeof(control))) 3692 if (copy_from_user(&control, argp, sizeof(control)))
3409 goto out; 3693 goto out;
3410 r = kvm_vm_ioctl_reinject(kvm, &control); 3694 r = kvm_vm_ioctl_reinject(kvm, &control);
3411 if (r)
3412 goto out;
3413 r = 0;
3414 break; 3695 break;
3415 } 3696 }
3416 case KVM_XEN_HVM_CONFIG: { 3697 case KVM_XEN_HVM_CONFIG: {
@@ -4273,7 +4554,12 @@ static int emulator_get_msr(struct x86_emulate_ctxt *ctxt,
4273static int emulator_set_msr(struct x86_emulate_ctxt *ctxt, 4554static int emulator_set_msr(struct x86_emulate_ctxt *ctxt,
4274 u32 msr_index, u64 data) 4555 u32 msr_index, u64 data)
4275{ 4556{
4276 return kvm_set_msr(emul_to_vcpu(ctxt), msr_index, data); 4557 struct msr_data msr;
4558
4559 msr.data = data;
4560 msr.index = msr_index;
4561 msr.host_initiated = false;
4562 return kvm_set_msr(emul_to_vcpu(ctxt), &msr);
4277} 4563}
4278 4564
4279static int emulator_read_pmc(struct x86_emulate_ctxt *ctxt, 4565static int emulator_read_pmc(struct x86_emulate_ctxt *ctxt,
@@ -4495,7 +4781,7 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)
4495 * instruction -> ... 4781 * instruction -> ...
4496 */ 4782 */
4497 pfn = gfn_to_pfn(vcpu->kvm, gpa_to_gfn(gpa)); 4783 pfn = gfn_to_pfn(vcpu->kvm, gpa_to_gfn(gpa));
4498 if (!is_error_pfn(pfn)) { 4784 if (!is_error_noslot_pfn(pfn)) {
4499 kvm_release_pfn_clean(pfn); 4785 kvm_release_pfn_clean(pfn);
4500 return true; 4786 return true;
4501 } 4787 }
@@ -4881,6 +5167,50 @@ static void kvm_set_mmio_spte_mask(void)
4881 kvm_mmu_set_mmio_spte_mask(mask); 5167 kvm_mmu_set_mmio_spte_mask(mask);
4882} 5168}
4883 5169
5170#ifdef CONFIG_X86_64
5171static void pvclock_gtod_update_fn(struct work_struct *work)
5172{
5173 struct kvm *kvm;
5174
5175 struct kvm_vcpu *vcpu;
5176 int i;
5177
5178 raw_spin_lock(&kvm_lock);
5179 list_for_each_entry(kvm, &vm_list, vm_list)
5180 kvm_for_each_vcpu(i, vcpu, kvm)
5181 set_bit(KVM_REQ_MASTERCLOCK_UPDATE, &vcpu->requests);
5182 atomic_set(&kvm_guest_has_master_clock, 0);
5183 raw_spin_unlock(&kvm_lock);
5184}
5185
5186static DECLARE_WORK(pvclock_gtod_work, pvclock_gtod_update_fn);
5187
5188/*
5189 * Notification about pvclock gtod data update.
5190 */
5191static int pvclock_gtod_notify(struct notifier_block *nb, unsigned long unused,
5192 void *priv)
5193{
5194 struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
5195 struct timekeeper *tk = priv;
5196
5197 update_pvclock_gtod(tk);
5198
5199 /* disable master clock if host does not trust, or does not
5200 * use, TSC clocksource
5201 */
5202 if (gtod->clock.vclock_mode != VCLOCK_TSC &&
5203 atomic_read(&kvm_guest_has_master_clock) != 0)
5204 queue_work(system_long_wq, &pvclock_gtod_work);
5205
5206 return 0;
5207}
5208
5209static struct notifier_block pvclock_gtod_notifier = {
5210 .notifier_call = pvclock_gtod_notify,
5211};
5212#endif
5213
4884int kvm_arch_init(void *opaque) 5214int kvm_arch_init(void *opaque)
4885{ 5215{
4886 int r; 5216 int r;
@@ -4922,6 +5252,10 @@ int kvm_arch_init(void *opaque)
4922 host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK); 5252 host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
4923 5253
4924 kvm_lapic_init(); 5254 kvm_lapic_init();
5255#ifdef CONFIG_X86_64
5256 pvclock_gtod_register_notifier(&pvclock_gtod_notifier);
5257#endif
5258
4925 return 0; 5259 return 0;
4926 5260
4927out: 5261out:
@@ -4936,6 +5270,9 @@ void kvm_arch_exit(void)
4936 cpufreq_unregister_notifier(&kvmclock_cpufreq_notifier_block, 5270 cpufreq_unregister_notifier(&kvmclock_cpufreq_notifier_block,
4937 CPUFREQ_TRANSITION_NOTIFIER); 5271 CPUFREQ_TRANSITION_NOTIFIER);
4938 unregister_hotcpu_notifier(&kvmclock_cpu_notifier_block); 5272 unregister_hotcpu_notifier(&kvmclock_cpu_notifier_block);
5273#ifdef CONFIG_X86_64
5274 pvclock_gtod_unregister_notifier(&pvclock_gtod_notifier);
5275#endif
4939 kvm_x86_ops = NULL; 5276 kvm_x86_ops = NULL;
4940 kvm_mmu_module_exit(); 5277 kvm_mmu_module_exit();
4941} 5278}
@@ -5059,7 +5396,7 @@ out:
5059} 5396}
5060EXPORT_SYMBOL_GPL(kvm_emulate_hypercall); 5397EXPORT_SYMBOL_GPL(kvm_emulate_hypercall);
5061 5398
5062int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt) 5399static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt)
5063{ 5400{
5064 struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); 5401 struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
5065 char instruction[3]; 5402 char instruction[3];
@@ -5235,6 +5572,29 @@ static void process_nmi(struct kvm_vcpu *vcpu)
5235 kvm_make_request(KVM_REQ_EVENT, vcpu); 5572 kvm_make_request(KVM_REQ_EVENT, vcpu);
5236} 5573}
5237 5574
5575static void kvm_gen_update_masterclock(struct kvm *kvm)
5576{
5577#ifdef CONFIG_X86_64
5578 int i;
5579 struct kvm_vcpu *vcpu;
5580 struct kvm_arch *ka = &kvm->arch;
5581
5582 spin_lock(&ka->pvclock_gtod_sync_lock);
5583 kvm_make_mclock_inprogress_request(kvm);
5584 /* no guest entries from this point */
5585 pvclock_update_vm_gtod_copy(kvm);
5586
5587 kvm_for_each_vcpu(i, vcpu, kvm)
5588 set_bit(KVM_REQ_CLOCK_UPDATE, &vcpu->requests);
5589
5590 /* guest entries allowed */
5591 kvm_for_each_vcpu(i, vcpu, kvm)
5592 clear_bit(KVM_REQ_MCLOCK_INPROGRESS, &vcpu->requests);
5593
5594 spin_unlock(&ka->pvclock_gtod_sync_lock);
5595#endif
5596}
5597
5238static int vcpu_enter_guest(struct kvm_vcpu *vcpu) 5598static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5239{ 5599{
5240 int r; 5600 int r;
@@ -5247,6 +5607,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5247 kvm_mmu_unload(vcpu); 5607 kvm_mmu_unload(vcpu);
5248 if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu)) 5608 if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu))
5249 __kvm_migrate_timers(vcpu); 5609 __kvm_migrate_timers(vcpu);
5610 if (kvm_check_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu))
5611 kvm_gen_update_masterclock(vcpu->kvm);
5250 if (kvm_check_request(KVM_REQ_CLOCK_UPDATE, vcpu)) { 5612 if (kvm_check_request(KVM_REQ_CLOCK_UPDATE, vcpu)) {
5251 r = kvm_guest_time_update(vcpu); 5613 r = kvm_guest_time_update(vcpu);
5252 if (unlikely(r)) 5614 if (unlikely(r))
@@ -5362,7 +5724,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5362 if (hw_breakpoint_active()) 5724 if (hw_breakpoint_active())
5363 hw_breakpoint_restore(); 5725 hw_breakpoint_restore();
5364 5726
5365 vcpu->arch.last_guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu); 5727 vcpu->arch.last_guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu,
5728 native_read_tsc());
5366 5729
5367 vcpu->mode = OUTSIDE_GUEST_MODE; 5730 vcpu->mode = OUTSIDE_GUEST_MODE;
5368 smp_wmb(); 5731 smp_wmb();
@@ -5419,7 +5782,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
5419 pr_debug("vcpu %d received sipi with vector # %x\n", 5782 pr_debug("vcpu %d received sipi with vector # %x\n",
5420 vcpu->vcpu_id, vcpu->arch.sipi_vector); 5783 vcpu->vcpu_id, vcpu->arch.sipi_vector);
5421 kvm_lapic_reset(vcpu); 5784 kvm_lapic_reset(vcpu);
5422 r = kvm_arch_vcpu_reset(vcpu); 5785 r = kvm_vcpu_reset(vcpu);
5423 if (r) 5786 if (r)
5424 return r; 5787 return r;
5425 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 5788 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
@@ -6047,7 +6410,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
6047 r = vcpu_load(vcpu); 6410 r = vcpu_load(vcpu);
6048 if (r) 6411 if (r)
6049 return r; 6412 return r;
6050 r = kvm_arch_vcpu_reset(vcpu); 6413 r = kvm_vcpu_reset(vcpu);
6051 if (r == 0) 6414 if (r == 0)
6052 r = kvm_mmu_setup(vcpu); 6415 r = kvm_mmu_setup(vcpu);
6053 vcpu_put(vcpu); 6416 vcpu_put(vcpu);
@@ -6055,6 +6418,23 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
6055 return r; 6418 return r;
6056} 6419}
6057 6420
6421int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
6422{
6423 int r;
6424 struct msr_data msr;
6425
6426 r = vcpu_load(vcpu);
6427 if (r)
6428 return r;
6429 msr.data = 0x0;
6430 msr.index = MSR_IA32_TSC;
6431 msr.host_initiated = true;
6432 kvm_write_tsc(vcpu, &msr);
6433 vcpu_put(vcpu);
6434
6435 return r;
6436}
6437
6058void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) 6438void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
6059{ 6439{
6060 int r; 6440 int r;
@@ -6069,7 +6449,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
6069 kvm_x86_ops->vcpu_free(vcpu); 6449 kvm_x86_ops->vcpu_free(vcpu);
6070} 6450}
6071 6451
6072int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu) 6452static int kvm_vcpu_reset(struct kvm_vcpu *vcpu)
6073{ 6453{
6074 atomic_set(&vcpu->arch.nmi_queued, 0); 6454 atomic_set(&vcpu->arch.nmi_queued, 0);
6075 vcpu->arch.nmi_pending = 0; 6455 vcpu->arch.nmi_pending = 0;
@@ -6092,6 +6472,10 @@ int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu)
6092 6472
6093 kvm_pmu_reset(vcpu); 6473 kvm_pmu_reset(vcpu);
6094 6474
6475 memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs));
6476 vcpu->arch.regs_avail = ~0;
6477 vcpu->arch.regs_dirty = ~0;
6478
6095 return kvm_x86_ops->vcpu_reset(vcpu); 6479 return kvm_x86_ops->vcpu_reset(vcpu);
6096} 6480}
6097 6481
@@ -6168,6 +6552,8 @@ int kvm_arch_hardware_enable(void *garbage)
6168 kvm_for_each_vcpu(i, vcpu, kvm) { 6552 kvm_for_each_vcpu(i, vcpu, kvm) {
6169 vcpu->arch.tsc_offset_adjustment += delta_cyc; 6553 vcpu->arch.tsc_offset_adjustment += delta_cyc;
6170 vcpu->arch.last_host_tsc = local_tsc; 6554 vcpu->arch.last_host_tsc = local_tsc;
6555 set_bit(KVM_REQ_MASTERCLOCK_UPDATE,
6556 &vcpu->requests);
6171 } 6557 }
6172 6558
6173 /* 6559 /*
@@ -6258,10 +6644,17 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
6258 if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) 6644 if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL))
6259 goto fail_free_mce_banks; 6645 goto fail_free_mce_banks;
6260 6646
6647 r = fx_init(vcpu);
6648 if (r)
6649 goto fail_free_wbinvd_dirty_mask;
6650
6651 vcpu->arch.ia32_tsc_adjust_msr = 0x0;
6261 kvm_async_pf_hash_reset(vcpu); 6652 kvm_async_pf_hash_reset(vcpu);
6262 kvm_pmu_init(vcpu); 6653 kvm_pmu_init(vcpu);
6263 6654
6264 return 0; 6655 return 0;
6656fail_free_wbinvd_dirty_mask:
6657 free_cpumask_var(vcpu->arch.wbinvd_dirty_mask);
6265fail_free_mce_banks: 6658fail_free_mce_banks:
6266 kfree(vcpu->arch.mce_banks); 6659 kfree(vcpu->arch.mce_banks);
6267fail_free_lapic: 6660fail_free_lapic:
@@ -6305,6 +6698,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
6305 6698
6306 raw_spin_lock_init(&kvm->arch.tsc_write_lock); 6699 raw_spin_lock_init(&kvm->arch.tsc_write_lock);
6307 mutex_init(&kvm->arch.apic_map_lock); 6700 mutex_init(&kvm->arch.apic_map_lock);
6701 spin_lock_init(&kvm->arch.pvclock_gtod_sync_lock);
6702
6703 pvclock_update_vm_gtod_copy(kvm);
6308 6704
6309 return 0; 6705 return 0;
6310} 6706}
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 2b5219c12ac..e224f7a671b 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -112,7 +112,7 @@ void kvm_before_handle_nmi(struct kvm_vcpu *vcpu);
112void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); 112void kvm_after_handle_nmi(struct kvm_vcpu *vcpu);
113int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip); 113int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip);
114 114
115void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data); 115void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr);
116 116
117int kvm_read_guest_virt(struct x86_emulate_ctxt *ctxt, 117int kvm_read_guest_virt(struct x86_emulate_ctxt *ctxt,
118 gva_t addr, void *val, unsigned int bytes, 118 gva_t addr, void *val, unsigned int bytes,
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 642d8805bc1..df4176cdbb3 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1412,7 +1412,7 @@ __init void lguest_init(void)
1412 1412
1413 /* We don't have features. We have puppies! Puppies! */ 1413 /* We don't have features. We have puppies! Puppies! */
1414#ifdef CONFIG_X86_MCE 1414#ifdef CONFIG_X86_MCE
1415 mce_disabled = 1; 1415 mca_cfg.disabled = true;
1416#endif 1416#endif
1417#ifdef CONFIG_ACPI 1417#ifdef CONFIG_ACPI
1418 acpi_disabled = 1; 1418 acpi_disabled = 1;
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index b00f6785da7..96b2c6697c9 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -32,7 +32,6 @@ ifeq ($(CONFIG_X86_32),y)
32 lib-y += checksum_32.o 32 lib-y += checksum_32.o
33 lib-y += strstr_32.o 33 lib-y += strstr_32.o
34 lib-y += string_32.o 34 lib-y += string_32.o
35 lib-y += cmpxchg.o
36ifneq ($(CONFIG_X86_CMPXCHG64),y) 35ifneq ($(CONFIG_X86_CMPXCHG64),y)
37 lib-y += cmpxchg8b_emu.o atomic64_386_32.o 36 lib-y += cmpxchg8b_emu.o atomic64_386_32.o
38endif 37endif
diff --git a/arch/x86/lib/cmpxchg.c b/arch/x86/lib/cmpxchg.c
deleted file mode 100644
index 5d619f6df3e..00000000000
--- a/arch/x86/lib/cmpxchg.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * cmpxchg*() fallbacks for CPU not supporting these instructions
3 */
4
5#include <linux/kernel.h>
6#include <linux/smp.h>
7#include <linux/module.h>
8
9#ifndef CONFIG_X86_CMPXCHG
10unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new)
11{
12 u8 prev;
13 unsigned long flags;
14
15 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
16 local_irq_save(flags);
17 prev = *(u8 *)ptr;
18 if (prev == old)
19 *(u8 *)ptr = new;
20 local_irq_restore(flags);
21 return prev;
22}
23EXPORT_SYMBOL(cmpxchg_386_u8);
24
25unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new)
26{
27 u16 prev;
28 unsigned long flags;
29
30 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
31 local_irq_save(flags);
32 prev = *(u16 *)ptr;
33 if (prev == old)
34 *(u16 *)ptr = new;
35 local_irq_restore(flags);
36 return prev;
37}
38EXPORT_SYMBOL(cmpxchg_386_u16);
39
40unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new)
41{
42 u32 prev;
43 unsigned long flags;
44
45 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
46 local_irq_save(flags);
47 prev = *(u32 *)ptr;
48 if (prev == old)
49 *(u32 *)ptr = new;
50 local_irq_restore(flags);
51 return prev;
52}
53EXPORT_SYMBOL(cmpxchg_386_u32);
54#endif
diff --git a/arch/x86/lib/copy_page_64.S b/arch/x86/lib/copy_page_64.S
index 6b34d04d096..176cca67212 100644
--- a/arch/x86/lib/copy_page_64.S
+++ b/arch/x86/lib/copy_page_64.S
@@ -5,91 +5,89 @@
5#include <asm/alternative-asm.h> 5#include <asm/alternative-asm.h>
6 6
7 ALIGN 7 ALIGN
8copy_page_c: 8copy_page_rep:
9 CFI_STARTPROC 9 CFI_STARTPROC
10 movl $4096/8,%ecx 10 movl $4096/8, %ecx
11 rep movsq 11 rep movsq
12 ret 12 ret
13 CFI_ENDPROC 13 CFI_ENDPROC
14ENDPROC(copy_page_c) 14ENDPROC(copy_page_rep)
15 15
16/* Don't use streaming store because it's better when the target 16/*
17 ends up in cache. */ 17 * Don't use streaming copy unless the CPU indicates X86_FEATURE_REP_GOOD.
18 18 * Could vary the prefetch distance based on SMP/UP.
19/* Could vary the prefetch distance based on SMP/UP */ 19*/
20 20
21ENTRY(copy_page) 21ENTRY(copy_page)
22 CFI_STARTPROC 22 CFI_STARTPROC
23 subq $2*8,%rsp 23 subq $2*8, %rsp
24 CFI_ADJUST_CFA_OFFSET 2*8 24 CFI_ADJUST_CFA_OFFSET 2*8
25 movq %rbx,(%rsp) 25 movq %rbx, (%rsp)
26 CFI_REL_OFFSET rbx, 0 26 CFI_REL_OFFSET rbx, 0
27 movq %r12,1*8(%rsp) 27 movq %r12, 1*8(%rsp)
28 CFI_REL_OFFSET r12, 1*8 28 CFI_REL_OFFSET r12, 1*8
29 29
30 movl $(4096/64)-5,%ecx 30 movl $(4096/64)-5, %ecx
31 .p2align 4 31 .p2align 4
32.Loop64: 32.Loop64:
33 dec %rcx 33 dec %rcx
34 34 movq 0x8*0(%rsi), %rax
35 movq (%rsi), %rax 35 movq 0x8*1(%rsi), %rbx
36 movq 8 (%rsi), %rbx 36 movq 0x8*2(%rsi), %rdx
37 movq 16 (%rsi), %rdx 37 movq 0x8*3(%rsi), %r8
38 movq 24 (%rsi), %r8 38 movq 0x8*4(%rsi), %r9
39 movq 32 (%rsi), %r9 39 movq 0x8*5(%rsi), %r10
40 movq 40 (%rsi), %r10 40 movq 0x8*6(%rsi), %r11
41 movq 48 (%rsi), %r11 41 movq 0x8*7(%rsi), %r12
42 movq 56 (%rsi), %r12
43 42
44 prefetcht0 5*64(%rsi) 43 prefetcht0 5*64(%rsi)
45 44
46 movq %rax, (%rdi) 45 movq %rax, 0x8*0(%rdi)
47 movq %rbx, 8 (%rdi) 46 movq %rbx, 0x8*1(%rdi)
48 movq %rdx, 16 (%rdi) 47 movq %rdx, 0x8*2(%rdi)
49 movq %r8, 24 (%rdi) 48 movq %r8, 0x8*3(%rdi)
50 movq %r9, 32 (%rdi) 49 movq %r9, 0x8*4(%rdi)
51 movq %r10, 40 (%rdi) 50 movq %r10, 0x8*5(%rdi)
52 movq %r11, 48 (%rdi) 51 movq %r11, 0x8*6(%rdi)
53 movq %r12, 56 (%rdi) 52 movq %r12, 0x8*7(%rdi)
54 53
55 leaq 64 (%rsi), %rsi 54 leaq 64 (%rsi), %rsi
56 leaq 64 (%rdi), %rdi 55 leaq 64 (%rdi), %rdi
57 56
58 jnz .Loop64 57 jnz .Loop64
59 58
60 movl $5,%ecx 59 movl $5, %ecx
61 .p2align 4 60 .p2align 4
62.Loop2: 61.Loop2:
63 decl %ecx 62 decl %ecx
64 63
65 movq (%rsi), %rax 64 movq 0x8*0(%rsi), %rax
66 movq 8 (%rsi), %rbx 65 movq 0x8*1(%rsi), %rbx
67 movq 16 (%rsi), %rdx 66 movq 0x8*2(%rsi), %rdx
68 movq 24 (%rsi), %r8 67 movq 0x8*3(%rsi), %r8
69 movq 32 (%rsi), %r9 68 movq 0x8*4(%rsi), %r9
70 movq 40 (%rsi), %r10 69 movq 0x8*5(%rsi), %r10
71 movq 48 (%rsi), %r11 70 movq 0x8*6(%rsi), %r11
72 movq 56 (%rsi), %r12 71 movq 0x8*7(%rsi), %r12
73 72
74 movq %rax, (%rdi) 73 movq %rax, 0x8*0(%rdi)
75 movq %rbx, 8 (%rdi) 74 movq %rbx, 0x8*1(%rdi)
76 movq %rdx, 16 (%rdi) 75 movq %rdx, 0x8*2(%rdi)
77 movq %r8, 24 (%rdi) 76 movq %r8, 0x8*3(%rdi)
78 movq %r9, 32 (%rdi) 77 movq %r9, 0x8*4(%rdi)
79 movq %r10, 40 (%rdi) 78 movq %r10, 0x8*5(%rdi)
80 movq %r11, 48 (%rdi) 79 movq %r11, 0x8*6(%rdi)
81 movq %r12, 56 (%rdi) 80 movq %r12, 0x8*7(%rdi)
82 81
83 leaq 64(%rdi),%rdi 82 leaq 64(%rdi), %rdi
84 leaq 64(%rsi),%rsi 83 leaq 64(%rsi), %rsi
85
86 jnz .Loop2 84 jnz .Loop2
87 85
88 movq (%rsp),%rbx 86 movq (%rsp), %rbx
89 CFI_RESTORE rbx 87 CFI_RESTORE rbx
90 movq 1*8(%rsp),%r12 88 movq 1*8(%rsp), %r12
91 CFI_RESTORE r12 89 CFI_RESTORE r12
92 addq $2*8,%rsp 90 addq $2*8, %rsp
93 CFI_ADJUST_CFA_OFFSET -2*8 91 CFI_ADJUST_CFA_OFFSET -2*8
94 ret 92 ret
95.Lcopy_page_end: 93.Lcopy_page_end:
@@ -103,7 +101,7 @@ ENDPROC(copy_page)
103 101
104 .section .altinstr_replacement,"ax" 102 .section .altinstr_replacement,"ax"
1051: .byte 0xeb /* jmp <disp8> */ 1031: .byte 0xeb /* jmp <disp8> */
106 .byte (copy_page_c - copy_page) - (2f - 1b) /* offset */ 104 .byte (copy_page_rep - copy_page) - (2f - 1b) /* offset */
1072: 1052:
108 .previous 106 .previous
109 .section .altinstructions,"a" 107 .section .altinstructions,"a"
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index 98f6d6b68f5..f0312d74640 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -570,63 +570,6 @@ do { \
570unsigned long __copy_to_user_ll(void __user *to, const void *from, 570unsigned long __copy_to_user_ll(void __user *to, const void *from,
571 unsigned long n) 571 unsigned long n)
572{ 572{
573#ifndef CONFIG_X86_WP_WORKS_OK
574 if (unlikely(boot_cpu_data.wp_works_ok == 0) &&
575 ((unsigned long)to) < TASK_SIZE) {
576 /*
577 * When we are in an atomic section (see
578 * mm/filemap.c:file_read_actor), return the full
579 * length to take the slow path.
580 */
581 if (in_atomic())
582 return n;
583
584 /*
585 * CPU does not honor the WP bit when writing
586 * from supervisory mode, and due to preemption or SMP,
587 * the page tables can change at any time.
588 * Do it manually. Manfred <manfred@colorfullife.com>
589 */
590 while (n) {
591 unsigned long offset = ((unsigned long)to)%PAGE_SIZE;
592 unsigned long len = PAGE_SIZE - offset;
593 int retval;
594 struct page *pg;
595 void *maddr;
596
597 if (len > n)
598 len = n;
599
600survive:
601 down_read(&current->mm->mmap_sem);
602 retval = get_user_pages(current, current->mm,
603 (unsigned long)to, 1, 1, 0, &pg, NULL);
604
605 if (retval == -ENOMEM && is_global_init(current)) {
606 up_read(&current->mm->mmap_sem);
607 congestion_wait(BLK_RW_ASYNC, HZ/50);
608 goto survive;
609 }
610
611 if (retval != 1) {
612 up_read(&current->mm->mmap_sem);
613 break;
614 }
615
616 maddr = kmap_atomic(pg);
617 memcpy(maddr + offset, from, len);
618 kunmap_atomic(maddr);
619 set_page_dirty_lock(pg);
620 put_page(pg);
621 up_read(&current->mm->mmap_sem);
622
623 from += len;
624 to += len;
625 n -= len;
626 }
627 return n;
628 }
629#endif
630 stac(); 573 stac();
631 if (movsl_is_ok(to, from, n)) 574 if (movsl_is_ok(to, from, n))
632 __copy_user(to, from, n); 575 __copy_user(to, from, n);
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 8e13ecb41be..027088f2f7d 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -18,7 +18,7 @@
18#include <asm/pgalloc.h> /* pgd_*(), ... */ 18#include <asm/pgalloc.h> /* pgd_*(), ... */
19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
20#include <asm/fixmap.h> /* VSYSCALL_START */ 20#include <asm/fixmap.h> /* VSYSCALL_START */
21#include <asm/rcu.h> /* exception_enter(), ... */ 21#include <asm/context_tracking.h> /* exception_enter(), ... */
22 22
23/* 23/*
24 * Page fault error code bits: 24 * Page fault error code bits:
@@ -803,20 +803,6 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
803 __bad_area(regs, error_code, address, SEGV_ACCERR); 803 __bad_area(regs, error_code, address, SEGV_ACCERR);
804} 804}
805 805
806/* TODO: fixup for "mm-invoke-oom-killer-from-page-fault.patch" */
807static void
808out_of_memory(struct pt_regs *regs, unsigned long error_code,
809 unsigned long address)
810{
811 /*
812 * We ran out of memory, call the OOM killer, and return the userspace
813 * (which will retry the fault, or kill us if we got oom-killed):
814 */
815 up_read(&current->mm->mmap_sem);
816
817 pagefault_out_of_memory();
818}
819
820static void 806static void
821do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, 807do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
822 unsigned int fault) 808 unsigned int fault)
@@ -879,7 +865,14 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
879 return 1; 865 return 1;
880 } 866 }
881 867
882 out_of_memory(regs, error_code, address); 868 up_read(&current->mm->mmap_sem);
869
870 /*
871 * We ran out of memory, call the OOM killer, and return the
872 * userspace (which will retry the fault, or kill us if we got
873 * oom-killed):
874 */
875 pagefault_out_of_memory();
883 } else { 876 } else {
884 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON| 877 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
885 VM_FAULT_HWPOISON_LARGE)) 878 VM_FAULT_HWPOISON_LARGE))
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index 937bff5cdaa..ae1aa71d011 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -274,42 +274,15 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
274 unsigned long pgoff, unsigned long flags) 274 unsigned long pgoff, unsigned long flags)
275{ 275{
276 struct hstate *h = hstate_file(file); 276 struct hstate *h = hstate_file(file);
277 struct mm_struct *mm = current->mm; 277 struct vm_unmapped_area_info info;
278 struct vm_area_struct *vma; 278
279 unsigned long start_addr; 279 info.flags = 0;
280 280 info.length = len;
281 if (len > mm->cached_hole_size) { 281 info.low_limit = TASK_UNMAPPED_BASE;
282 start_addr = mm->free_area_cache; 282 info.high_limit = TASK_SIZE;
283 } else { 283 info.align_mask = PAGE_MASK & ~huge_page_mask(h);
284 start_addr = TASK_UNMAPPED_BASE; 284 info.align_offset = 0;
285 mm->cached_hole_size = 0; 285 return vm_unmapped_area(&info);
286 }
287
288full_search:
289 addr = ALIGN(start_addr, huge_page_size(h));
290
291 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
292 /* At this point: (!vma || addr < vma->vm_end). */
293 if (TASK_SIZE - len < addr) {
294 /*
295 * Start a new search - just in case we missed
296 * some holes.
297 */
298 if (start_addr != TASK_UNMAPPED_BASE) {
299 start_addr = TASK_UNMAPPED_BASE;
300 mm->cached_hole_size = 0;
301 goto full_search;
302 }
303 return -ENOMEM;
304 }
305 if (!vma || addr + len <= vma->vm_start) {
306 mm->free_area_cache = addr + len;
307 return addr;
308 }
309 if (addr + mm->cached_hole_size < vma->vm_start)
310 mm->cached_hole_size = vma->vm_start - addr;
311 addr = ALIGN(vma->vm_end, huge_page_size(h));
312 }
313} 286}
314 287
315static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file, 288static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
@@ -317,83 +290,30 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
317 unsigned long pgoff, unsigned long flags) 290 unsigned long pgoff, unsigned long flags)
318{ 291{
319 struct hstate *h = hstate_file(file); 292 struct hstate *h = hstate_file(file);
320 struct mm_struct *mm = current->mm; 293 struct vm_unmapped_area_info info;
321 struct vm_area_struct *vma; 294 unsigned long addr;
322 unsigned long base = mm->mmap_base;
323 unsigned long addr = addr0;
324 unsigned long largest_hole = mm->cached_hole_size;
325 unsigned long start_addr;
326
327 /* don't allow allocations above current base */
328 if (mm->free_area_cache > base)
329 mm->free_area_cache = base;
330
331 if (len <= largest_hole) {
332 largest_hole = 0;
333 mm->free_area_cache = base;
334 }
335try_again:
336 start_addr = mm->free_area_cache;
337
338 /* make sure it can fit in the remaining address space */
339 if (mm->free_area_cache < len)
340 goto fail;
341
342 /* either no address requested or can't fit in requested address hole */
343 addr = (mm->free_area_cache - len) & huge_page_mask(h);
344 do {
345 /*
346 * Lookup failure means no vma is above this address,
347 * i.e. return with success:
348 */
349 vma = find_vma(mm, addr);
350 if (!vma)
351 return addr;
352 295
353 if (addr + len <= vma->vm_start) { 296 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
354 /* remember the address as a hint for next time */ 297 info.length = len;
355 mm->cached_hole_size = largest_hole; 298 info.low_limit = PAGE_SIZE;
356 return (mm->free_area_cache = addr); 299 info.high_limit = current->mm->mmap_base;
357 } else if (mm->free_area_cache == vma->vm_end) { 300 info.align_mask = PAGE_MASK & ~huge_page_mask(h);
358 /* pull free_area_cache down to the first hole */ 301 info.align_offset = 0;
359 mm->free_area_cache = vma->vm_start; 302 addr = vm_unmapped_area(&info);
360 mm->cached_hole_size = largest_hole;
361 }
362 303
363 /* remember the largest hole we saw so far */
364 if (addr + largest_hole < vma->vm_start)
365 largest_hole = vma->vm_start - addr;
366
367 /* try just below the current vma->vm_start */
368 addr = (vma->vm_start - len) & huge_page_mask(h);
369 } while (len <= vma->vm_start);
370
371fail:
372 /*
373 * if hint left us with no space for the requested
374 * mapping then try again:
375 */
376 if (start_addr != base) {
377 mm->free_area_cache = base;
378 largest_hole = 0;
379 goto try_again;
380 }
381 /* 304 /*
382 * A failed mmap() very likely causes application failure, 305 * A failed mmap() very likely causes application failure,
383 * so fall back to the bottom-up function here. This scenario 306 * so fall back to the bottom-up function here. This scenario
384 * can happen with large stack limits and large mmap() 307 * can happen with large stack limits and large mmap()
385 * allocations. 308 * allocations.
386 */ 309 */
387 mm->free_area_cache = TASK_UNMAPPED_BASE; 310 if (addr & ~PAGE_MASK) {
388 mm->cached_hole_size = ~0UL; 311 VM_BUG_ON(addr != -ENOMEM);
389 addr = hugetlb_get_unmapped_area_bottomup(file, addr0, 312 info.flags = 0;
390 len, pgoff, flags); 313 info.low_limit = TASK_UNMAPPED_BASE;
391 314 info.high_limit = TASK_SIZE;
392 /* 315 addr = vm_unmapped_area(&info);
393 * Restore the topdown base: 316 }
394 */
395 mm->free_area_cache = base;
396 mm->cached_hole_size = ~0UL;
397 317
398 return addr; 318 return addr;
399} 319}
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 11a58001b4c..745d66b843c 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -715,10 +715,7 @@ static void __init test_wp_bit(void)
715 715
716 if (!boot_cpu_data.wp_works_ok) { 716 if (!boot_cpu_data.wp_works_ok) {
717 printk(KERN_CONT "No.\n"); 717 printk(KERN_CONT "No.\n");
718#ifdef CONFIG_X86_WP_WORKS_OK 718 panic("Linux doesn't support CPUs with broken WP.");
719 panic(
720 "This kernel doesn't support CPU's with broken WP. Recompile it for a 386!");
721#endif
722 } else { 719 } else {
723 printk(KERN_CONT "Ok.\n"); 720 printk(KERN_CONT "Ok.\n");
724 } 721 }
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 3baff255ada..07519a12044 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -108,13 +108,13 @@ void sync_global_pgds(unsigned long start, unsigned long end)
108 for (address = start; address <= end; address += PGDIR_SIZE) { 108 for (address = start; address <= end; address += PGDIR_SIZE) {
109 const pgd_t *pgd_ref = pgd_offset_k(address); 109 const pgd_t *pgd_ref = pgd_offset_k(address);
110 struct page *page; 110 struct page *page;
111 pgd_t *pgd;
111 112
112 if (pgd_none(*pgd_ref)) 113 if (pgd_none(*pgd_ref))
113 continue; 114 continue;
114 115
115 spin_lock(&pgd_lock); 116 spin_lock(&pgd_lock);
116 list_for_each_entry(page, &pgd_list, lru) { 117 list_for_each_entry(page, &pgd_list, lru) {
117 pgd_t *pgd;
118 spinlock_t *pgt_lock; 118 spinlock_t *pgt_lock;
119 119
120 pgd = (pgd_t *)page_address(page) + pgd_index(address); 120 pgd = (pgd_t *)page_address(page) + pgd_index(address);
@@ -130,6 +130,13 @@ void sync_global_pgds(unsigned long start, unsigned long end)
130 130
131 spin_unlock(pgt_lock); 131 spin_unlock(pgt_lock);
132 } 132 }
133
134 pgd = __va(real_mode_header->trampoline_pgd);
135 pgd += pgd_index(address);
136
137 if (pgd_none(*pgd))
138 set_pgd(pgd, *pgd_ref);
139
133 spin_unlock(&pgd_lock); 140 spin_unlock(&pgd_lock);
134 } 141 }
135} 142}
@@ -630,7 +637,9 @@ void __init paging_init(void)
630 * numa support is not compiled in, and later node_set_state 637 * numa support is not compiled in, and later node_set_state
631 * will not set it back. 638 * will not set it back.
632 */ 639 */
633 node_clear_state(0, N_NORMAL_MEMORY); 640 node_clear_state(0, N_MEMORY);
641 if (N_MEMORY != N_NORMAL_MEMORY)
642 node_clear_state(0, N_NORMAL_MEMORY);
634 643
635 zone_sizes_init(); 644 zone_sizes_init();
636} 645}
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 78fe3f1ac49..e190f7b5665 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -50,6 +50,107 @@ int ioremap_change_attr(unsigned long vaddr, unsigned long size,
50 return err; 50 return err;
51} 51}
52 52
53#ifdef CONFIG_X86_64
54static void ident_pte_range(unsigned long paddr, unsigned long vaddr,
55 pmd_t *ppmd, pmd_t *vpmd, unsigned long end)
56{
57 pte_t *ppte = pte_offset_kernel(ppmd, paddr);
58 pte_t *vpte = pte_offset_kernel(vpmd, vaddr);
59
60 do {
61 set_pte(ppte, *vpte);
62 } while (ppte++, vpte++, vaddr += PAGE_SIZE, vaddr != end);
63}
64
65static int ident_pmd_range(unsigned long paddr, unsigned long vaddr,
66 pud_t *ppud, pud_t *vpud, unsigned long end)
67{
68 pmd_t *ppmd = pmd_offset(ppud, paddr);
69 pmd_t *vpmd = pmd_offset(vpud, vaddr);
70 unsigned long next;
71
72 do {
73 next = pmd_addr_end(vaddr, end);
74
75 if (!pmd_present(*ppmd)) {
76 pte_t *ppte = (pte_t *)get_zeroed_page(GFP_KERNEL);
77 if (!ppte)
78 return 1;
79
80 set_pmd(ppmd, __pmd(_KERNPG_TABLE | __pa(ppte)));
81 }
82
83 ident_pte_range(paddr, vaddr, ppmd, vpmd, next);
84 } while (ppmd++, vpmd++, vaddr = next, vaddr != end);
85
86 return 0;
87}
88
89static int ident_pud_range(unsigned long paddr, unsigned long vaddr,
90 pgd_t *ppgd, pgd_t *vpgd, unsigned long end)
91{
92 pud_t *ppud = pud_offset(ppgd, paddr);
93 pud_t *vpud = pud_offset(vpgd, vaddr);
94 unsigned long next;
95
96 do {
97 next = pud_addr_end(vaddr, end);
98
99 if (!pud_present(*ppud)) {
100 pmd_t *ppmd = (pmd_t *)get_zeroed_page(GFP_KERNEL);
101 if (!ppmd)
102 return 1;
103
104 set_pud(ppud, __pud(_KERNPG_TABLE | __pa(ppmd)));
105 }
106
107 if (ident_pmd_range(paddr, vaddr, ppud, vpud, next))
108 return 1;
109 } while (ppud++, vpud++, vaddr = next, vaddr != end);
110
111 return 0;
112}
113
114static int insert_identity_mapping(resource_size_t paddr, unsigned long vaddr,
115 unsigned long size)
116{
117 unsigned long end = vaddr + size;
118 unsigned long next;
119 pgd_t *vpgd, *ppgd;
120
121 /* Don't map over the guard hole. */
122 if (paddr >= 0x800000000000 || paddr + size > 0x800000000000)
123 return 1;
124
125 ppgd = __va(real_mode_header->trampoline_pgd) + pgd_index(paddr);
126
127 vpgd = pgd_offset_k(vaddr);
128 do {
129 next = pgd_addr_end(vaddr, end);
130
131 if (!pgd_present(*ppgd)) {
132 pud_t *ppud = (pud_t *)get_zeroed_page(GFP_KERNEL);
133 if (!ppud)
134 return 1;
135
136 set_pgd(ppgd, __pgd(_KERNPG_TABLE | __pa(ppud)));
137 }
138
139 if (ident_pud_range(paddr, vaddr, ppgd, vpgd, next))
140 return 1;
141 } while (ppgd++, vpgd++, vaddr = next, vaddr != end);
142
143 return 0;
144}
145#else
146static inline int insert_identity_mapping(resource_size_t paddr,
147 unsigned long vaddr,
148 unsigned long size)
149{
150 return 0;
151}
152#endif /* CONFIG_X86_64 */
153
53/* 154/*
54 * Remap an arbitrary physical address space into the kernel virtual 155 * Remap an arbitrary physical address space into the kernel virtual
55 * address space. Needed when the kernel wants to access high addresses 156 * address space. Needed when the kernel wants to access high addresses
@@ -163,6 +264,10 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
163 ret_addr = (void __iomem *) (vaddr + offset); 264 ret_addr = (void __iomem *) (vaddr + offset);
164 mmiotrace_ioremap(unaligned_phys_addr, unaligned_size, ret_addr); 265 mmiotrace_ioremap(unaligned_phys_addr, unaligned_size, ret_addr);
165 266
267 if (insert_identity_mapping(phys_addr, vaddr, size))
268 printk(KERN_WARNING "ioremap: unable to map 0x%llx in identity pagetable\n",
269 (unsigned long long)phys_addr);
270
166 /* 271 /*
167 * Check if the request spans more than any BAR in the iomem resource 272 * Check if the request spans more than any BAR in the iomem resource
168 * tree. 273 * tree.
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index a718e0d2350..931930a9616 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -919,11 +919,13 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
919 919
920 /* 920 /*
921 * On success we use clflush, when the CPU supports it to 921 * On success we use clflush, when the CPU supports it to
922 * avoid the wbindv. If the CPU does not support it and in the 922 * avoid the wbindv. If the CPU does not support it, in the
923 * error case we fall back to cpa_flush_all (which uses 923 * error case, and during early boot (for EFI) we fall back
924 * wbindv): 924 * to cpa_flush_all (which uses wbinvd):
925 */ 925 */
926 if (!ret && cpu_has_clflush) { 926 if (early_boot_irqs_disabled)
927 __cpa_flush_all((void *)(long)cache);
928 else if (!ret && cpu_has_clflush) {
927 if (cpa.flags & (CPA_PAGES_ARRAY | CPA_ARRAY)) { 929 if (cpa.flags & (CPA_PAGES_ARRAY | CPA_ARRAY)) {
928 cpa_flush_array(addr, numpages, cache, 930 cpa_flush_array(addr, numpages, cache,
929 cpa.flags, pages); 931 cpa.flags, pages);
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 8573b83a63d..217eb705fac 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -137,7 +137,7 @@ static void pgd_dtor(pgd_t *pgd)
137 * against pageattr.c; it is the unique case in which a valid change 137 * against pageattr.c; it is the unique case in which a valid change
138 * of kernel pagetables can't be lazily synchronized by vmalloc faults. 138 * of kernel pagetables can't be lazily synchronized by vmalloc faults.
139 * vmalloc faults work because attached pagetables are never freed. 139 * vmalloc faults work because attached pagetables are never freed.
140 * -- wli 140 * -- nyc
141 */ 141 */
142 142
143#ifdef CONFIG_X86_PAE 143#ifdef CONFIG_X86_PAE
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 60f926cd8b0..13a6b29e2e5 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -104,7 +104,7 @@ static void flush_tlb_func(void *info)
104 return; 104 return;
105 105
106 if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { 106 if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) {
107 if (f->flush_end == TLB_FLUSH_ALL || !cpu_has_invlpg) 107 if (f->flush_end == TLB_FLUSH_ALL)
108 local_flush_tlb(); 108 local_flush_tlb();
109 else if (!f->flush_end) 109 else if (!f->flush_end)
110 __flush_tlb_single(f->flush_start); 110 __flush_tlb_single(f->flush_start);
@@ -337,10 +337,8 @@ static const struct file_operations fops_tlbflush = {
337 337
338static int __cpuinit create_tlb_flushall_shift(void) 338static int __cpuinit create_tlb_flushall_shift(void)
339{ 339{
340 if (cpu_has_invlpg) { 340 debugfs_create_file("tlb_flushall_shift", S_IRUSR | S_IWUSR,
341 debugfs_create_file("tlb_flushall_shift", S_IRUSR | S_IWUSR, 341 arch_debugfs_dir, NULL, &fops_tlbflush);
342 arch_debugfs_dir, NULL, &fops_tlbflush);
343 }
344 return 0; 342 return 0;
345} 343}
346late_initcall(create_tlb_flushall_shift); 344late_initcall(create_tlb_flushall_shift);
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 520d2bd0b9c..d11a47099d3 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -11,6 +11,7 @@
11#include <asm/cacheflush.h> 11#include <asm/cacheflush.h>
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/filter.h> 13#include <linux/filter.h>
14#include <linux/if_vlan.h>
14 15
15/* 16/*
16 * Conventions : 17 * Conventions :
@@ -212,6 +213,8 @@ void bpf_jit_compile(struct sk_filter *fp)
212 case BPF_S_ANC_MARK: 213 case BPF_S_ANC_MARK:
213 case BPF_S_ANC_RXHASH: 214 case BPF_S_ANC_RXHASH:
214 case BPF_S_ANC_CPU: 215 case BPF_S_ANC_CPU:
216 case BPF_S_ANC_VLAN_TAG:
217 case BPF_S_ANC_VLAN_TAG_PRESENT:
215 case BPF_S_ANC_QUEUE: 218 case BPF_S_ANC_QUEUE:
216 case BPF_S_LD_W_ABS: 219 case BPF_S_LD_W_ABS:
217 case BPF_S_LD_H_ABS: 220 case BPF_S_LD_H_ABS:
@@ -515,6 +518,24 @@ void bpf_jit_compile(struct sk_filter *fp)
515 CLEAR_A(); 518 CLEAR_A();
516#endif 519#endif
517 break; 520 break;
521 case BPF_S_ANC_VLAN_TAG:
522 case BPF_S_ANC_VLAN_TAG_PRESENT:
523 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
524 if (is_imm8(offsetof(struct sk_buff, vlan_tci))) {
525 /* movzwl off8(%rdi),%eax */
526 EMIT4(0x0f, 0xb7, 0x47, offsetof(struct sk_buff, vlan_tci));
527 } else {
528 EMIT3(0x0f, 0xb7, 0x87); /* movzwl off32(%rdi),%eax */
529 EMIT(offsetof(struct sk_buff, vlan_tci), 4);
530 }
531 BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
532 if (filter[i].code == BPF_S_ANC_VLAN_TAG) {
533 EMIT3(0x80, 0xe4, 0xef); /* and $0xef,%ah */
534 } else {
535 EMIT3(0xc1, 0xe8, 0x0c); /* shr $0xc,%eax */
536 EMIT3(0x83, 0xe0, 0x01); /* and $0x1,%eax */
537 }
538 break;
518 case BPF_S_LD_W_ABS: 539 case BPF_S_LD_W_ABS:
519 func = CHOOSE_LOAD_FUNC(K, sk_load_word); 540 func = CHOOSE_LOAD_FUNC(K, sk_load_word);
520common_load: seen |= SEEN_DATAREF; 541common_load: seen |= SEEN_DATAREF;
diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index 3af5a1e79c9..ee0af58ca5b 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_STA2X11) += sta2x11-fixup.o
16obj-$(CONFIG_X86_VISWS) += visws.o 16obj-$(CONFIG_X86_VISWS) += visws.o
17 17
18obj-$(CONFIG_X86_NUMAQ) += numaq_32.o 18obj-$(CONFIG_X86_NUMAQ) += numaq_32.o
19obj-$(CONFIG_X86_NUMACHIP) += numachip.o
19 20
20obj-$(CONFIG_X86_INTEL_MID) += mrst.o 21obj-$(CONFIG_X86_INTEL_MID) += mrst.o
21 22
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 192397c9860..0c01261fe5a 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -12,6 +12,7 @@ struct pci_root_info {
12 char name[16]; 12 char name[16];
13 unsigned int res_num; 13 unsigned int res_num;
14 struct resource *res; 14 struct resource *res;
15 resource_size_t *res_offset;
15 struct pci_sysdata sd; 16 struct pci_sysdata sd;
16#ifdef CONFIG_PCI_MMCONFIG 17#ifdef CONFIG_PCI_MMCONFIG
17 bool mcfg_added; 18 bool mcfg_added;
@@ -22,6 +23,7 @@ struct pci_root_info {
22}; 23};
23 24
24static bool pci_use_crs = true; 25static bool pci_use_crs = true;
26static bool pci_ignore_seg = false;
25 27
26static int __init set_use_crs(const struct dmi_system_id *id) 28static int __init set_use_crs(const struct dmi_system_id *id)
27{ 29{
@@ -35,7 +37,14 @@ static int __init set_nouse_crs(const struct dmi_system_id *id)
35 return 0; 37 return 0;
36} 38}
37 39
38static const struct dmi_system_id pci_use_crs_table[] __initconst = { 40static int __init set_ignore_seg(const struct dmi_system_id *id)
41{
42 printk(KERN_INFO "PCI: %s detected: ignoring ACPI _SEG\n", id->ident);
43 pci_ignore_seg = true;
44 return 0;
45}
46
47static const struct dmi_system_id pci_crs_quirks[] __initconst = {
39 /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */ 48 /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */
40 { 49 {
41 .callback = set_use_crs, 50 .callback = set_use_crs,
@@ -98,6 +107,16 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = {
98 DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"), 107 DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"),
99 }, 108 },
100 }, 109 },
110
111 /* https://bugzilla.kernel.org/show_bug.cgi?id=15362 */
112 {
113 .callback = set_ignore_seg,
114 .ident = "HP xw9300",
115 .matches = {
116 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
117 DMI_MATCH(DMI_PRODUCT_NAME, "HP xw9300 Workstation"),
118 },
119 },
101 {} 120 {}
102}; 121};
103 122
@@ -108,7 +127,7 @@ void __init pci_acpi_crs_quirks(void)
108 if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year < 2008) 127 if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year < 2008)
109 pci_use_crs = false; 128 pci_use_crs = false;
110 129
111 dmi_check_system(pci_use_crs_table); 130 dmi_check_system(pci_crs_quirks);
112 131
113 /* 132 /*
114 * If the user specifies "pci=use_crs" or "pci=nocrs" explicitly, that 133 * If the user specifies "pci=use_crs" or "pci=nocrs" explicitly, that
@@ -305,6 +324,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
305 res->flags = flags; 324 res->flags = flags;
306 res->start = start; 325 res->start = start;
307 res->end = end; 326 res->end = end;
327 info->res_offset[info->res_num] = addr.translation_offset;
308 328
309 if (!pci_use_crs) { 329 if (!pci_use_crs) {
310 dev_printk(KERN_DEBUG, &info->bridge->dev, 330 dev_printk(KERN_DEBUG, &info->bridge->dev,
@@ -374,7 +394,8 @@ static void add_resources(struct pci_root_info *info,
374 "ignoring host bridge window %pR (conflicts with %s %pR)\n", 394 "ignoring host bridge window %pR (conflicts with %s %pR)\n",
375 res, conflict->name, conflict); 395 res, conflict->name, conflict);
376 else 396 else
377 pci_add_resource(resources, res); 397 pci_add_resource_offset(resources, res,
398 info->res_offset[i]);
378 } 399 }
379} 400}
380 401
@@ -382,6 +403,8 @@ static void free_pci_root_info_res(struct pci_root_info *info)
382{ 403{
383 kfree(info->res); 404 kfree(info->res);
384 info->res = NULL; 405 info->res = NULL;
406 kfree(info->res_offset);
407 info->res_offset = NULL;
385 info->res_num = 0; 408 info->res_num = 0;
386} 409}
387 410
@@ -432,10 +455,20 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
432 return; 455 return;
433 456
434 size = sizeof(*info->res) * info->res_num; 457 size = sizeof(*info->res) * info->res_num;
435 info->res_num = 0;
436 info->res = kzalloc(size, GFP_KERNEL); 458 info->res = kzalloc(size, GFP_KERNEL);
437 if (!info->res) 459 if (!info->res) {
460 info->res_num = 0;
461 return;
462 }
463
464 size = sizeof(*info->res_offset) * info->res_num;
465 info->res_num = 0;
466 info->res_offset = kzalloc(size, GFP_KERNEL);
467 if (!info->res_offset) {
468 kfree(info->res);
469 info->res = NULL;
438 return; 470 return;
471 }
439 472
440 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, 473 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
441 info); 474 info);
@@ -455,6 +488,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
455 int pxm; 488 int pxm;
456#endif 489#endif
457 490
491 if (pci_ignore_seg)
492 domain = 0;
493
458 if (domain && !pci_domains_supported) { 494 if (domain && !pci_domains_supported) {
459 printk(KERN_WARNING "pci_bus %04x:%02x: " 495 printk(KERN_WARNING "pci_bus %04x:%02x: "
460 "ignored (multiple domains not supported)\n", 496 "ignored (multiple domains not supported)\n",
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 720e973fc34..1b1dda90a94 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -17,6 +17,7 @@
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/smp.h> 18#include <asm/smp.h>
19#include <asm/pci_x86.h> 19#include <asm/pci_x86.h>
20#include <asm/setup.h>
20 21
21unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 | 22unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
22 PCI_PROBE_MMCONF; 23 PCI_PROBE_MMCONF;
@@ -608,6 +609,35 @@ unsigned int pcibios_assign_all_busses(void)
608 return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0; 609 return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
609} 610}
610 611
612int pcibios_add_device(struct pci_dev *dev)
613{
614 struct setup_data *data;
615 struct pci_setup_rom *rom;
616 u64 pa_data;
617
618 pa_data = boot_params.hdr.setup_data;
619 while (pa_data) {
620 data = phys_to_virt(pa_data);
621
622 if (data->type == SETUP_PCI) {
623 rom = (struct pci_setup_rom *)data;
624
625 if ((pci_domain_nr(dev->bus) == rom->segment) &&
626 (dev->bus->number == rom->bus) &&
627 (PCI_SLOT(dev->devfn) == rom->device) &&
628 (PCI_FUNC(dev->devfn) == rom->function) &&
629 (dev->vendor == rom->vendor) &&
630 (dev->device == rom->devid)) {
631 dev->rom = pa_data +
632 offsetof(struct pci_setup_rom, romdata);
633 dev->romlen = rom->pcilen;
634 }
635 }
636 pa_data = data->next;
637 }
638 return 0;
639}
640
611int pcibios_enable_device(struct pci_dev *dev, int mask) 641int pcibios_enable_device(struct pci_dev *dev, int mask)
612{ 642{
613 int err; 643 int err;
@@ -626,7 +656,7 @@ void pcibios_disable_device (struct pci_dev *dev)
626 pcibios_disable_irq(dev); 656 pcibios_disable_irq(dev);
627} 657}
628 658
629int pci_ext_cfg_avail(struct pci_dev *dev) 659int pci_ext_cfg_avail(void)
630{ 660{
631 if (raw_pci_ext_ops) 661 if (raw_pci_ext_ops)
632 return 1; 662 return 1;
diff --git a/arch/x86/pci/numachip.c b/arch/x86/pci/numachip.c
new file mode 100644
index 00000000000..7307d9d12d1
--- /dev/null
+++ b/arch/x86/pci/numachip.c
@@ -0,0 +1,129 @@
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 * Numascale NumaConnect-specific PCI code
7 *
8 * Copyright (C) 2012 Numascale AS. All rights reserved.
9 *
10 * Send feedback to <support@numascale.com>
11 *
12 * PCI accessor functions derived from mmconfig_64.c
13 *
14 */
15
16#include <linux/pci.h>
17#include <asm/pci_x86.h>
18
19static u8 limit __read_mostly;
20
21static inline char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
22{
23 struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus);
24
25 if (cfg && cfg->virt)
26 return cfg->virt + (PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12));
27 return NULL;
28}
29
30static int pci_mmcfg_read_numachip(unsigned int seg, unsigned int bus,
31 unsigned int devfn, int reg, int len, u32 *value)
32{
33 char __iomem *addr;
34
35 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
36 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
37err: *value = -1;
38 return -EINVAL;
39 }
40
41 /* Ensure AMD Northbridges don't decode reads to other devices */
42 if (unlikely(bus == 0 && devfn >= limit)) {
43 *value = -1;
44 return 0;
45 }
46
47 rcu_read_lock();
48 addr = pci_dev_base(seg, bus, devfn);
49 if (!addr) {
50 rcu_read_unlock();
51 goto err;
52 }
53
54 switch (len) {
55 case 1:
56 *value = mmio_config_readb(addr + reg);
57 break;
58 case 2:
59 *value = mmio_config_readw(addr + reg);
60 break;
61 case 4:
62 *value = mmio_config_readl(addr + reg);
63 break;
64 }
65 rcu_read_unlock();
66
67 return 0;
68}
69
70static int pci_mmcfg_write_numachip(unsigned int seg, unsigned int bus,
71 unsigned int devfn, int reg, int len, u32 value)
72{
73 char __iomem *addr;
74
75 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
76 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095)))
77 return -EINVAL;
78
79 /* Ensure AMD Northbridges don't decode writes to other devices */
80 if (unlikely(bus == 0 && devfn >= limit))
81 return 0;
82
83 rcu_read_lock();
84 addr = pci_dev_base(seg, bus, devfn);
85 if (!addr) {
86 rcu_read_unlock();
87 return -EINVAL;
88 }
89
90 switch (len) {
91 case 1:
92 mmio_config_writeb(addr + reg, value);
93 break;
94 case 2:
95 mmio_config_writew(addr + reg, value);
96 break;
97 case 4:
98 mmio_config_writel(addr + reg, value);
99 break;
100 }
101 rcu_read_unlock();
102
103 return 0;
104}
105
106const struct pci_raw_ops pci_mmcfg_numachip = {
107 .read = pci_mmcfg_read_numachip,
108 .write = pci_mmcfg_write_numachip,
109};
110
111int __init pci_numachip_init(void)
112{
113 int ret = 0;
114 u32 val;
115
116 /* For remote I/O, restrict bus 0 access to the actual number of AMD
117 Northbridges, which starts at device number 0x18 */
118 ret = raw_pci_read(0, 0, PCI_DEVFN(0x18, 0), 0x60, sizeof(val), &val);
119 if (ret)
120 goto out;
121
122 /* HyperTransport fabric size in bits 6:4 */
123 limit = PCI_DEVFN(0x18 + ((val >> 4) & 7) + 1, 0);
124
125 /* Use NumaChip PCI accessors for non-extended and extended access */
126 raw_pci_ops = raw_pci_ext_ops = &pci_mmcfg_numachip;
127out:
128 return ret;
129}
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index 92525cb8e54..f8ab4945892 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -105,8 +105,11 @@ static void ce4100_serial_fixup(int port, struct uart_port *up,
105 up->membase = 105 up->membase =
106 (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE); 106 (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
107 up->membase += up->mapbase & ~PAGE_MASK; 107 up->membase += up->mapbase & ~PAGE_MASK;
108 up->mapbase += port * 0x100;
109 up->membase += port * 0x100;
108 up->iotype = UPIO_MEM32; 110 up->iotype = UPIO_MEM32;
109 up->regshift = 2; 111 up->regshift = 2;
112 up->irq = 4;
110 } 113 }
111#endif 114#endif
112 up->iobase = 0; 115 up->iobase = 0;
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index f6a0c1b8e51..d9c1b95af17 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -39,6 +39,8 @@ void efi_bgrt_init(void)
39 if (ACPI_FAILURE(status)) 39 if (ACPI_FAILURE(status))
40 return; 40 return;
41 41
42 if (bgrt_tab->header.length < sizeof(*bgrt_tab))
43 return;
42 if (bgrt_tab->version != 1) 44 if (bgrt_tab->version != 1)
43 return; 45 return;
44 if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address) 46 if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address)
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index ad4439145f8..0a34d9e9c26 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -239,22 +239,7 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
239 return status; 239 return status;
240} 240}
241 241
242static efi_status_t __init phys_efi_get_time(efi_time_t *tm, 242static int efi_set_rtc_mmss(unsigned long nowtime)
243 efi_time_cap_t *tc)
244{
245 unsigned long flags;
246 efi_status_t status;
247
248 spin_lock_irqsave(&rtc_lock, flags);
249 efi_call_phys_prelog();
250 status = efi_call_phys2(efi_phys.get_time, virt_to_phys(tm),
251 virt_to_phys(tc));
252 efi_call_phys_epilog();
253 spin_unlock_irqrestore(&rtc_lock, flags);
254 return status;
255}
256
257int efi_set_rtc_mmss(unsigned long nowtime)
258{ 243{
259 int real_seconds, real_minutes; 244 int real_seconds, real_minutes;
260 efi_status_t status; 245 efi_status_t status;
@@ -283,7 +268,7 @@ int efi_set_rtc_mmss(unsigned long nowtime)
283 return 0; 268 return 0;
284} 269}
285 270
286unsigned long efi_get_time(void) 271static unsigned long efi_get_time(void)
287{ 272{
288 efi_status_t status; 273 efi_status_t status;
289 efi_time_t eft; 274 efi_time_t eft;
@@ -639,18 +624,13 @@ static int __init efi_runtime_init(void)
639 } 624 }
640 /* 625 /*
641 * We will only need *early* access to the following 626 * We will only need *early* access to the following
642 * two EFI runtime services before set_virtual_address_map 627 * EFI runtime service before set_virtual_address_map
643 * is invoked. 628 * is invoked.
644 */ 629 */
645 efi_phys.get_time = (efi_get_time_t *)runtime->get_time;
646 efi_phys.set_virtual_address_map = 630 efi_phys.set_virtual_address_map =
647 (efi_set_virtual_address_map_t *) 631 (efi_set_virtual_address_map_t *)
648 runtime->set_virtual_address_map; 632 runtime->set_virtual_address_map;
649 /* 633
650 * Make efi_get_time can be called before entering
651 * virtual mode.
652 */
653 efi.get_time = phys_efi_get_time;
654 early_iounmap(runtime, sizeof(efi_runtime_services_t)); 634 early_iounmap(runtime, sizeof(efi_runtime_services_t));
655 635
656 return 0; 636 return 0;
@@ -736,12 +716,10 @@ void __init efi_init(void)
736 efi_enabled = 0; 716 efi_enabled = 0;
737 return; 717 return;
738 } 718 }
739#ifdef CONFIG_X86_32
740 if (efi_is_native()) { 719 if (efi_is_native()) {
741 x86_platform.get_wallclock = efi_get_time; 720 x86_platform.get_wallclock = efi_get_time;
742 x86_platform.set_wallclock = efi_set_rtc_mmss; 721 x86_platform.set_wallclock = efi_set_rtc_mmss;
743 } 722 }
744#endif
745 723
746#if EFI_DEBUG 724#if EFI_DEBUG
747 print_efi_memmap(); 725 print_efi_memmap();
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 95fd505dfeb..06c8b2e662a 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -58,6 +58,21 @@ static void __init early_code_mapping_set_exec(int executable)
58 } 58 }
59} 59}
60 60
61unsigned long efi_call_virt_prelog(void)
62{
63 unsigned long saved;
64
65 saved = read_cr3();
66 write_cr3(real_mode_header->trampoline_pgd);
67
68 return saved;
69}
70
71void efi_call_virt_epilog(unsigned long saved)
72{
73 write_cr3(saved);
74}
75
61void __init efi_call_phys_prelog(void) 76void __init efi_call_phys_prelog(void)
62{ 77{
63 unsigned long vaddress; 78 unsigned long vaddress;
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
index 218cdb16163..120cee1c3f8 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -21,6 +21,7 @@
21#include <asm/suspend.h> 21#include <asm/suspend.h>
22#include <asm/debugreg.h> 22#include <asm/debugreg.h>
23#include <asm/fpu-internal.h> /* pcntxt_mask */ 23#include <asm/fpu-internal.h> /* pcntxt_mask */
24#include <asm/cpu.h>
24 25
25#ifdef CONFIG_X86_32 26#ifdef CONFIG_X86_32
26static struct saved_context saved_context; 27static struct saved_context saved_context;
@@ -237,3 +238,84 @@ void restore_processor_state(void)
237#ifdef CONFIG_X86_32 238#ifdef CONFIG_X86_32
238EXPORT_SYMBOL(restore_processor_state); 239EXPORT_SYMBOL(restore_processor_state);
239#endif 240#endif
241
242/*
243 * When bsp_check() is called in hibernate and suspend, cpu hotplug
244 * is disabled already. So it's unnessary to handle race condition between
245 * cpumask query and cpu hotplug.
246 */
247static int bsp_check(void)
248{
249 if (cpumask_first(cpu_online_mask) != 0) {
250 pr_warn("CPU0 is offline.\n");
251 return -ENODEV;
252 }
253
254 return 0;
255}
256
257static int bsp_pm_callback(struct notifier_block *nb, unsigned long action,
258 void *ptr)
259{
260 int ret = 0;
261
262 switch (action) {
263 case PM_SUSPEND_PREPARE:
264 case PM_HIBERNATION_PREPARE:
265 ret = bsp_check();
266 break;
267#ifdef CONFIG_DEBUG_HOTPLUG_CPU0
268 case PM_RESTORE_PREPARE:
269 /*
270 * When system resumes from hibernation, online CPU0 because
271 * 1. it's required for resume and
272 * 2. the CPU was online before hibernation
273 */
274 if (!cpu_online(0))
275 _debug_hotplug_cpu(0, 1);
276 break;
277 case PM_POST_RESTORE:
278 /*
279 * When a resume really happens, this code won't be called.
280 *
281 * This code is called only when user space hibernation software
282 * prepares for snapshot device during boot time. So we just
283 * call _debug_hotplug_cpu() to restore to CPU0's state prior to
284 * preparing the snapshot device.
285 *
286 * This works for normal boot case in our CPU0 hotplug debug
287 * mode, i.e. CPU0 is offline and user mode hibernation
288 * software initializes during boot time.
289 *
290 * If CPU0 is online and user application accesses snapshot
291 * device after boot time, this will offline CPU0 and user may
292 * see different CPU0 state before and after accessing
293 * the snapshot device. But hopefully this is not a case when
294 * user debugging CPU0 hotplug. Even if users hit this case,
295 * they can easily online CPU0 back.
296 *
297 * To simplify this debug code, we only consider normal boot
298 * case. Otherwise we need to remember CPU0's state and restore
299 * to that state and resolve racy conditions etc.
300 */
301 _debug_hotplug_cpu(0, 0);
302 break;
303#endif
304 default:
305 break;
306 }
307 return notifier_from_errno(ret);
308}
309
310static int __init bsp_pm_check_init(void)
311{
312 /*
313 * Set this bsp_pm_callback as lower priority than
314 * cpu_hotplug_pm_callback. So cpu_hotplug_pm_callback will be called
315 * earlier to disable cpu hotplug before bsp online check.
316 */
317 pm_notifier(bsp_pm_callback, -INT_MAX);
318 return 0;
319}
320
321core_initcall(bsp_pm_check_init);
diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
index cbca565af5b..8e6ab613785 100644
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
@@ -78,8 +78,21 @@ void __init setup_real_mode(void)
78 *trampoline_cr4_features = read_cr4(); 78 *trampoline_cr4_features = read_cr4();
79 79
80 trampoline_pgd = (u64 *) __va(real_mode_header->trampoline_pgd); 80 trampoline_pgd = (u64 *) __va(real_mode_header->trampoline_pgd);
81 trampoline_pgd[0] = __pa(level3_ident_pgt) + _KERNPG_TABLE; 81
82 trampoline_pgd[511] = __pa(level3_kernel_pgt) + _KERNPG_TABLE; 82 /*
83 * Create an identity mapping for all of physical memory.
84 */
85 for (i = 0; i <= pgd_index(max_pfn << PAGE_SHIFT); i++) {
86 int index = pgd_index(PAGE_OFFSET) + i;
87
88 trampoline_pgd[i] = (u64)pgd_val(swapper_pg_dir[index]);
89 }
90
91 /*
92 * Copy the upper-half of the kernel pages tables.
93 */
94 for (i = pgd_index(PAGE_OFFSET); i < PTRS_PER_PGD; i++)
95 trampoline_pgd[i] = (u64)pgd_val(swapper_pg_dir[i]);
83#endif 96#endif
84} 97}
85 98
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index a47103fbc69..ee3c220ee50 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -8,7 +8,7 @@
8# 8#
90 i386 restart_syscall sys_restart_syscall 90 i386 restart_syscall sys_restart_syscall
101 i386 exit sys_exit 101 i386 exit sys_exit
112 i386 fork ptregs_fork stub32_fork 112 i386 fork sys_fork stub32_fork
123 i386 read sys_read 123 i386 read sys_read
134 i386 write sys_write 134 i386 write sys_write
145 i386 open sys_open compat_sys_open 145 i386 open sys_open compat_sys_open
@@ -126,7 +126,7 @@
126117 i386 ipc sys_ipc sys32_ipc 126117 i386 ipc sys_ipc sys32_ipc
127118 i386 fsync sys_fsync 127118 i386 fsync sys_fsync
128119 i386 sigreturn ptregs_sigreturn stub32_sigreturn 128119 i386 sigreturn ptregs_sigreturn stub32_sigreturn
129120 i386 clone ptregs_clone stub32_clone 129120 i386 clone sys_clone stub32_clone
130121 i386 setdomainname sys_setdomainname 130121 i386 setdomainname sys_setdomainname
131122 i386 uname sys_newuname 131122 i386 uname sys_newuname
132123 i386 modify_ldt sys_modify_ldt 132123 i386 modify_ldt sys_modify_ldt
@@ -196,7 +196,7 @@
196187 i386 sendfile sys_sendfile sys32_sendfile 196187 i386 sendfile sys_sendfile sys32_sendfile
197188 i386 getpmsg 197188 i386 getpmsg
198189 i386 putpmsg 198189 i386 putpmsg
199190 i386 vfork ptregs_vfork stub32_vfork 199190 i386 vfork sys_vfork stub32_vfork
200191 i386 ugetrlimit sys_getrlimit compat_sys_getrlimit 200191 i386 ugetrlimit sys_getrlimit compat_sys_getrlimit
201192 i386 mmap2 sys_mmap_pgoff 201192 i386 mmap2 sys_mmap_pgoff
202193 i386 truncate64 sys_truncate64 sys32_truncate64 202193 i386 truncate64 sys_truncate64 sys32_truncate64
diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk
index ddcf39b1a18..e6773dc8ac4 100644
--- a/arch/x86/tools/gen-insn-attr-x86.awk
+++ b/arch/x86/tools/gen-insn-attr-x86.awk
@@ -356,7 +356,7 @@ END {
356 exit 1 356 exit 1
357 # print escape opcode map's array 357 # print escape opcode map's array
358 print "/* Escape opcode map array */" 358 print "/* Escape opcode map array */"
359 print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX + 1]" \ 359 print "const insn_attr_t * const inat_escape_tables[INAT_ESC_MAX + 1]" \
360 "[INAT_LSTPFX_MAX + 1] = {" 360 "[INAT_LSTPFX_MAX + 1] = {"
361 for (i = 0; i < geid; i++) 361 for (i = 0; i < geid; i++)
362 for (j = 0; j < max_lprefix; j++) 362 for (j = 0; j < max_lprefix; j++)
@@ -365,7 +365,7 @@ END {
365 print "};\n" 365 print "};\n"
366 # print group opcode map's array 366 # print group opcode map's array
367 print "/* Group opcode map array */" 367 print "/* Group opcode map array */"
368 print "const insn_attr_t const *inat_group_tables[INAT_GRP_MAX + 1]"\ 368 print "const insn_attr_t * const inat_group_tables[INAT_GRP_MAX + 1]"\
369 "[INAT_LSTPFX_MAX + 1] = {" 369 "[INAT_LSTPFX_MAX + 1] = {"
370 for (i = 0; i < ggid; i++) 370 for (i = 0; i < ggid; i++)
371 for (j = 0; j < max_lprefix; j++) 371 for (j = 0; j < max_lprefix; j++)
@@ -374,7 +374,7 @@ END {
374 print "};\n" 374 print "};\n"
375 # print AVX opcode map's array 375 # print AVX opcode map's array
376 print "/* AVX opcode map array */" 376 print "/* AVX opcode map array */"
377 print "const insn_attr_t const *inat_avx_tables[X86_VEX_M_MAX + 1]"\ 377 print "const insn_attr_t * const inat_avx_tables[X86_VEX_M_MAX + 1]"\
378 "[INAT_LSTPFX_MAX + 1] = {" 378 "[INAT_LSTPFX_MAX + 1] = {"
379 for (i = 0; i < gaid; i++) 379 for (i = 0; i < gaid; i++)
380 for (j = 0; j < max_lprefix; j++) 380 for (j = 0; j < max_lprefix; j++)
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 07611759ce3..98399704196 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -25,13 +25,14 @@ config X86_32
25 select HAVE_AOUT 25 select HAVE_AOUT
26 select ARCH_WANT_IPC_PARSE_VERSION 26 select ARCH_WANT_IPC_PARSE_VERSION
27 select MODULES_USE_ELF_REL 27 select MODULES_USE_ELF_REL
28 select CLONE_BACKWARDS
28 29
29config X86_64 30config X86_64
30 def_bool 64BIT 31 def_bool 64BIT
31 select MODULES_USE_ELF_RELA 32 select MODULES_USE_ELF_RELA
32 33
33config RWSEM_XCHGADD_ALGORITHM 34config RWSEM_XCHGADD_ALGORITHM
34 def_bool X86_XADD && 64BIT 35 def_bool 64BIT
35 36
36config RWSEM_GENERIC_SPINLOCK 37config RWSEM_GENERIC_SPINLOCK
37 def_bool !RWSEM_XCHGADD_ALGORITHM 38 def_bool !RWSEM_XCHGADD_ALGORITHM
diff --git a/arch/x86/um/shared/sysdep/syscalls.h b/arch/x86/um/shared/sysdep/syscalls.h
index ca255a805ed..bd9a89b67e4 100644
--- a/arch/x86/um/shared/sysdep/syscalls.h
+++ b/arch/x86/um/shared/sysdep/syscalls.h
@@ -1,5 +1,3 @@
1extern long sys_clone(unsigned long clone_flags, unsigned long newsp,
2 void __user *parent_tid, void __user *child_tid);
3#ifdef __i386__ 1#ifdef __i386__
4#include "syscalls_32.h" 2#include "syscalls_32.h"
5#else 3#else
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c
index 232e60504b3..812e98c098e 100644
--- a/arch/x86/um/sys_call_table_32.c
+++ b/arch/x86/um/sys_call_table_32.c
@@ -24,13 +24,10 @@
24 24
25#define old_mmap sys_old_mmap 25#define old_mmap sys_old_mmap
26 26
27#define ptregs_fork sys_fork
28#define ptregs_iopl sys_iopl 27#define ptregs_iopl sys_iopl
29#define ptregs_vm86old sys_vm86old 28#define ptregs_vm86old sys_vm86old
30#define ptregs_clone i386_clone
31#define ptregs_vm86 sys_vm86 29#define ptregs_vm86 sys_vm86
32#define ptregs_sigaltstack sys_sigaltstack 30#define ptregs_sigaltstack sys_sigaltstack
33#define ptregs_vfork sys_vfork
34 31
35#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ; 32#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ;
36#include <asm/syscalls_32.h> 33#include <asm/syscalls_32.h>
diff --git a/arch/x86/um/syscalls_32.c b/arch/x86/um/syscalls_32.c
index db444c7218f..e8bcea99acd 100644
--- a/arch/x86/um/syscalls_32.c
+++ b/arch/x86/um/syscalls_32.c
@@ -6,21 +6,6 @@
6#include <linux/syscalls.h> 6#include <linux/syscalls.h>
7#include <sysdep/syscalls.h> 7#include <sysdep/syscalls.h>
8 8
9/*
10 * The prototype on i386 is:
11 *
12 * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls
13 *
14 * and the "newtls" arg. on i386 is read by copy_thread directly from the
15 * register saved on the stack.
16 */
17long i386_clone(unsigned long clone_flags, unsigned long newsp,
18 int __user *parent_tid, void *newtls, int __user *child_tid)
19{
20 return sys_clone(clone_flags, newsp, parent_tid, child_tid);
21}
22
23
24long sys_sigaction(int sig, const struct old_sigaction __user *act, 9long sys_sigaction(int sig, const struct old_sigaction __user *act,
25 struct old_sigaction __user *oact) 10 struct old_sigaction __user *oact)
26{ 11{
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 4df6c373421..205ad328aa5 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -22,6 +22,7 @@
22#include <asm/hpet.h> 22#include <asm/hpet.h>
23#include <asm/unistd.h> 23#include <asm/unistd.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/pvclock.h>
25 26
26#define gtod (&VVAR(vsyscall_gtod_data)) 27#define gtod (&VVAR(vsyscall_gtod_data))
27 28
@@ -62,6 +63,76 @@ static notrace cycle_t vread_hpet(void)
62 return readl((const void __iomem *)fix_to_virt(VSYSCALL_HPET) + 0xf0); 63 return readl((const void __iomem *)fix_to_virt(VSYSCALL_HPET) + 0xf0);
63} 64}
64 65
66#ifdef CONFIG_PARAVIRT_CLOCK
67
68static notrace const struct pvclock_vsyscall_time_info *get_pvti(int cpu)
69{
70 const struct pvclock_vsyscall_time_info *pvti_base;
71 int idx = cpu / (PAGE_SIZE/PVTI_SIZE);
72 int offset = cpu % (PAGE_SIZE/PVTI_SIZE);
73
74 BUG_ON(PVCLOCK_FIXMAP_BEGIN + idx > PVCLOCK_FIXMAP_END);
75
76 pvti_base = (struct pvclock_vsyscall_time_info *)
77 __fix_to_virt(PVCLOCK_FIXMAP_BEGIN+idx);
78
79 return &pvti_base[offset];
80}
81
82static notrace cycle_t vread_pvclock(int *mode)
83{
84 const struct pvclock_vsyscall_time_info *pvti;
85 cycle_t ret;
86 u64 last;
87 u32 version;
88 u32 migrate_count;
89 u8 flags;
90 unsigned cpu, cpu1;
91
92
93 /*
94 * When looping to get a consistent (time-info, tsc) pair, we
95 * also need to deal with the possibility we can switch vcpus,
96 * so make sure we always re-fetch time-info for the current vcpu.
97 */
98 do {
99 cpu = __getcpu() & VGETCPU_CPU_MASK;
100 /* TODO: We can put vcpu id into higher bits of pvti.version.
101 * This will save a couple of cycles by getting rid of
102 * __getcpu() calls (Gleb).
103 */
104
105 pvti = get_pvti(cpu);
106
107 migrate_count = pvti->migrate_count;
108
109 version = __pvclock_read_cycles(&pvti->pvti, &ret, &flags);
110
111 /*
112 * Test we're still on the cpu as well as the version.
113 * We could have been migrated just after the first
114 * vgetcpu but before fetching the version, so we
115 * wouldn't notice a version change.
116 */
117 cpu1 = __getcpu() & VGETCPU_CPU_MASK;
118 } while (unlikely(cpu != cpu1 ||
119 (pvti->pvti.version & 1) ||
120 pvti->pvti.version != version ||
121 pvti->migrate_count != migrate_count));
122
123 if (unlikely(!(flags & PVCLOCK_TSC_STABLE_BIT)))
124 *mode = VCLOCK_NONE;
125
126 /* refer to tsc.c read_tsc() comment for rationale */
127 last = VVAR(vsyscall_gtod_data).clock.cycle_last;
128
129 if (likely(ret >= last))
130 return ret;
131
132 return last;
133}
134#endif
135
65notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) 136notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
66{ 137{
67 long ret; 138 long ret;
@@ -80,7 +151,7 @@ notrace static long vdso_fallback_gtod(struct timeval *tv, struct timezone *tz)
80} 151}
81 152
82 153
83notrace static inline u64 vgetsns(void) 154notrace static inline u64 vgetsns(int *mode)
84{ 155{
85 long v; 156 long v;
86 cycles_t cycles; 157 cycles_t cycles;
@@ -88,6 +159,10 @@ notrace static inline u64 vgetsns(void)
88 cycles = vread_tsc(); 159 cycles = vread_tsc();
89 else if (gtod->clock.vclock_mode == VCLOCK_HPET) 160 else if (gtod->clock.vclock_mode == VCLOCK_HPET)
90 cycles = vread_hpet(); 161 cycles = vread_hpet();
162#ifdef CONFIG_PARAVIRT_CLOCK
163 else if (gtod->clock.vclock_mode == VCLOCK_PVCLOCK)
164 cycles = vread_pvclock(mode);
165#endif
91 else 166 else
92 return 0; 167 return 0;
93 v = (cycles - gtod->clock.cycle_last) & gtod->clock.mask; 168 v = (cycles - gtod->clock.cycle_last) & gtod->clock.mask;
@@ -107,7 +182,7 @@ notrace static int __always_inline do_realtime(struct timespec *ts)
107 mode = gtod->clock.vclock_mode; 182 mode = gtod->clock.vclock_mode;
108 ts->tv_sec = gtod->wall_time_sec; 183 ts->tv_sec = gtod->wall_time_sec;
109 ns = gtod->wall_time_snsec; 184 ns = gtod->wall_time_snsec;
110 ns += vgetsns(); 185 ns += vgetsns(&mode);
111 ns >>= gtod->clock.shift; 186 ns >>= gtod->clock.shift;
112 } while (unlikely(read_seqcount_retry(&gtod->seq, seq))); 187 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
113 188
@@ -127,7 +202,7 @@ notrace static int do_monotonic(struct timespec *ts)
127 mode = gtod->clock.vclock_mode; 202 mode = gtod->clock.vclock_mode;
128 ts->tv_sec = gtod->monotonic_time_sec; 203 ts->tv_sec = gtod->monotonic_time_sec;
129 ns = gtod->monotonic_time_snsec; 204 ns = gtod->monotonic_time_snsec;
130 ns += vgetsns(); 205 ns += vgetsns(&mode);
131 ns >>= gtod->clock.shift; 206 ns >>= gtod->clock.shift;
132 } while (unlikely(read_seqcount_retry(&gtod->seq, seq))); 207 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
133 timespec_add_ns(ts, ns); 208 timespec_add_ns(ts, ns);
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index 5463ad55857..2f94b039e55 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -17,15 +17,10 @@ __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
17{ 17{
18 unsigned int p; 18 unsigned int p;
19 19
20 if (VVAR(vgetcpu_mode) == VGETCPU_RDTSCP) { 20 p = __getcpu();
21 /* Load per CPU data from RDTSCP */ 21
22 native_read_tscp(&p);
23 } else {
24 /* Load per CPU data from GDT */
25 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
26 }
27 if (cpu) 22 if (cpu)
28 *cpu = p & 0xfff; 23 *cpu = p & VGETCPU_CPU_MASK;
29 if (node) 24 if (node)
30 *node = p >> 12; 25 *node = p >> 12;
31 return 0; 26 return 0;
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 00aaf047b39..431e8754441 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -141,7 +141,7 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
141 * unaligned here as a result of stack start randomization. 141 * unaligned here as a result of stack start randomization.
142 */ 142 */
143 addr = PAGE_ALIGN(addr); 143 addr = PAGE_ALIGN(addr);
144 addr = align_addr(addr, NULL, ALIGN_VDSO); 144 addr = align_vdso_addr(addr);
145 145
146 return addr; 146 return addr;
147} 147}
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index fdce49c7aff..131dacd2748 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -6,8 +6,9 @@ config XEN
6 bool "Xen guest support" 6 bool "Xen guest support"
7 select PARAVIRT 7 select PARAVIRT
8 select PARAVIRT_CLOCK 8 select PARAVIRT_CLOCK
9 select XEN_HAVE_PVMMU
9 depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS) 10 depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS)
10 depends on X86_CMPXCHG && X86_TSC 11 depends on X86_TSC
11 help 12 help
12 This is the Linux Xen port. Enabling this will allow the 13 This is the Linux Xen port. Enabling this will allow the
13 kernel to boot in a paravirtualized environment under the 14 kernel to boot in a paravirtualized environment under the
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 586d83812b6..3aeaa933b52 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -223,6 +223,21 @@ static void __init xen_banner(void)
223 version >> 16, version & 0xffff, extra.extraversion, 223 version >> 16, version & 0xffff, extra.extraversion,
224 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); 224 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
225} 225}
226/* Check if running on Xen version (major, minor) or later */
227bool
228xen_running_on_version_or_later(unsigned int major, unsigned int minor)
229{
230 unsigned int version;
231
232 if (!xen_domain())
233 return false;
234
235 version = HYPERVISOR_xen_version(XENVER_version, NULL);
236 if ((((version >> 16) == major) && ((version & 0xffff) >= minor)) ||
237 ((version >> 16) > major))
238 return true;
239 return false;
240}
226 241
227#define CPUID_THERM_POWER_LEAF 6 242#define CPUID_THERM_POWER_LEAF 6
228#define APERFMPERF_PRESENT 0 243#define APERFMPERF_PRESENT 0
@@ -287,8 +302,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
287 302
288static bool __init xen_check_mwait(void) 303static bool __init xen_check_mwait(void)
289{ 304{
290#if defined(CONFIG_ACPI) && !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) && \ 305#ifdef CONFIG_ACPI
291 !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE)
292 struct xen_platform_op op = { 306 struct xen_platform_op op = {
293 .cmd = XENPF_set_processor_pminfo, 307 .cmd = XENPF_set_processor_pminfo,
294 .u.set_pminfo.id = -1, 308 .u.set_pminfo.id = -1,
@@ -309,6 +323,13 @@ static bool __init xen_check_mwait(void)
309 if (!xen_initial_domain()) 323 if (!xen_initial_domain())
310 return false; 324 return false;
311 325
326 /*
327 * When running under platform earlier than Xen4.2, do not expose
328 * mwait, to avoid the risk of loading native acpi pad driver
329 */
330 if (!xen_running_on_version_or_later(4, 2))
331 return false;
332
312 ax = 1; 333 ax = 1;
313 cx = 0; 334 cx = 0;
314 335
@@ -1495,51 +1516,72 @@ asmlinkage void __init xen_start_kernel(void)
1495#endif 1516#endif
1496} 1517}
1497 1518
1498void __ref xen_hvm_init_shared_info(void) 1519#ifdef CONFIG_XEN_PVHVM
1520#define HVM_SHARED_INFO_ADDR 0xFE700000UL
1521static struct shared_info *xen_hvm_shared_info;
1522static unsigned long xen_hvm_sip_phys;
1523static int xen_major, xen_minor;
1524
1525static void xen_hvm_connect_shared_info(unsigned long pfn)
1499{ 1526{
1500 int cpu;
1501 struct xen_add_to_physmap xatp; 1527 struct xen_add_to_physmap xatp;
1502 static struct shared_info *shared_info_page = 0;
1503 1528
1504 if (!shared_info_page)
1505 shared_info_page = (struct shared_info *)
1506 extend_brk(PAGE_SIZE, PAGE_SIZE);
1507 xatp.domid = DOMID_SELF; 1529 xatp.domid = DOMID_SELF;
1508 xatp.idx = 0; 1530 xatp.idx = 0;
1509 xatp.space = XENMAPSPACE_shared_info; 1531 xatp.space = XENMAPSPACE_shared_info;
1510 xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT; 1532 xatp.gpfn = pfn;
1511 if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) 1533 if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
1512 BUG(); 1534 BUG();
1513 1535
1514 HYPERVISOR_shared_info = (struct shared_info *)shared_info_page; 1536}
1537static void __init xen_hvm_set_shared_info(struct shared_info *sip)
1538{
1539 int cpu;
1540
1541 HYPERVISOR_shared_info = sip;
1515 1542
1516 /* xen_vcpu is a pointer to the vcpu_info struct in the shared_info 1543 /* xen_vcpu is a pointer to the vcpu_info struct in the shared_info
1517 * page, we use it in the event channel upcall and in some pvclock 1544 * page, we use it in the event channel upcall and in some pvclock
1518 * related functions. We don't need the vcpu_info placement 1545 * related functions. We don't need the vcpu_info placement
1519 * optimizations because we don't use any pv_mmu or pv_irq op on 1546 * optimizations because we don't use any pv_mmu or pv_irq op on
1520 * HVM. 1547 * HVM. */
1521 * When xen_hvm_init_shared_info is run at boot time only vcpu 0 is 1548 for_each_online_cpu(cpu)
1522 * online but xen_hvm_init_shared_info is run at resume time too and
1523 * in that case multiple vcpus might be online. */
1524 for_each_online_cpu(cpu) {
1525 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; 1549 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
1550}
1551
1552/* Reconnect the shared_info pfn to a (new) mfn */
1553void xen_hvm_resume_shared_info(void)
1554{
1555 xen_hvm_connect_shared_info(xen_hvm_sip_phys >> PAGE_SHIFT);
1556}
1557
1558/* Xen tools prior to Xen 4 do not provide a E820_Reserved area for guest usage.
1559 * On these old tools the shared info page will be placed in E820_Ram.
1560 * Xen 4 provides a E820_Reserved area at 0xFC000000, and this code expects
1561 * that nothing is mapped up to HVM_SHARED_INFO_ADDR.
1562 * Xen 4.3+ provides an explicit 1MB area at HVM_SHARED_INFO_ADDR which is used
1563 * here for the shared info page. */
1564static void __init xen_hvm_init_shared_info(void)
1565{
1566 if (xen_major < 4) {
1567 xen_hvm_shared_info = extend_brk(PAGE_SIZE, PAGE_SIZE);
1568 xen_hvm_sip_phys = __pa(xen_hvm_shared_info);
1569 } else {
1570 xen_hvm_sip_phys = HVM_SHARED_INFO_ADDR;
1571 set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_hvm_sip_phys);
1572 xen_hvm_shared_info =
1573 (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);
1526 } 1574 }
1575 xen_hvm_connect_shared_info(xen_hvm_sip_phys >> PAGE_SHIFT);
1576 xen_hvm_set_shared_info(xen_hvm_shared_info);
1527} 1577}
1528 1578
1529#ifdef CONFIG_XEN_PVHVM
1530static void __init init_hvm_pv_info(void) 1579static void __init init_hvm_pv_info(void)
1531{ 1580{
1532 int major, minor; 1581 uint32_t ecx, edx, pages, msr, base;
1533 uint32_t eax, ebx, ecx, edx, pages, msr, base;
1534 u64 pfn; 1582 u64 pfn;
1535 1583
1536 base = xen_cpuid_base(); 1584 base = xen_cpuid_base();
1537 cpuid(base + 1, &eax, &ebx, &ecx, &edx);
1538
1539 major = eax >> 16;
1540 minor = eax & 0xffff;
1541 printk(KERN_INFO "Xen version %d.%d.\n", major, minor);
1542
1543 cpuid(base + 2, &pages, &msr, &ecx, &edx); 1585 cpuid(base + 2, &pages, &msr, &ecx, &edx);
1544 1586
1545 pfn = __pa(hypercall_page); 1587 pfn = __pa(hypercall_page);
@@ -1590,12 +1632,22 @@ static void __init xen_hvm_guest_init(void)
1590 1632
1591static bool __init xen_hvm_platform(void) 1633static bool __init xen_hvm_platform(void)
1592{ 1634{
1635 uint32_t eax, ebx, ecx, edx, base;
1636
1593 if (xen_pv_domain()) 1637 if (xen_pv_domain())
1594 return false; 1638 return false;
1595 1639
1596 if (!xen_cpuid_base()) 1640 base = xen_cpuid_base();
1641 if (!base)
1597 return false; 1642 return false;
1598 1643
1644 cpuid(base + 1, &eax, &ebx, &ecx, &edx);
1645
1646 xen_major = eax >> 16;
1647 xen_minor = eax & 0xffff;
1648
1649 printk(KERN_INFO "Xen version %d.%d.\n", xen_major, xen_minor);
1650
1599 return true; 1651 return true;
1600} 1652}
1601 1653
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index dcf5f2dd91e..01de35c7722 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -2497,8 +2497,10 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token,
2497 2497
2498int xen_remap_domain_mfn_range(struct vm_area_struct *vma, 2498int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
2499 unsigned long addr, 2499 unsigned long addr,
2500 unsigned long mfn, int nr, 2500 xen_pfn_t mfn, int nr,
2501 pgprot_t prot, unsigned domid) 2501 pgprot_t prot, unsigned domid,
2502 struct page **pages)
2503
2502{ 2504{
2503 struct remap_data rmd; 2505 struct remap_data rmd;
2504 struct mmu_update mmu_update[REMAP_BATCH_SIZE]; 2506 struct mmu_update mmu_update[REMAP_BATCH_SIZE];
@@ -2542,3 +2544,14 @@ out:
2542 return err; 2544 return err;
2543} 2545}
2544EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); 2546EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
2547
2548/* Returns: 0 success */
2549int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
2550 int numpgs, struct page **pages)
2551{
2552 if (!pages || !xen_feature(XENFEAT_auto_translated_physmap))
2553 return 0;
2554
2555 return -EINVAL;
2556}
2557EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 45329c8c226..ae8a00c39de 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -30,7 +30,7 @@ void xen_arch_hvm_post_suspend(int suspend_cancelled)
30{ 30{
31#ifdef CONFIG_XEN_PVHVM 31#ifdef CONFIG_XEN_PVHVM
32 int cpu; 32 int cpu;
33 xen_hvm_init_shared_info(); 33 xen_hvm_resume_shared_info();
34 xen_callback_vector(); 34 xen_callback_vector();
35 xen_unplug_emulated_devices(); 35 xen_unplug_emulated_devices();
36 if (xen_feature(XENFEAT_hvm_safe_pvclock)) { 36 if (xen_feature(XENFEAT_hvm_safe_pvclock)) {
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index a95b41744ad..d2e73d19d36 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -40,7 +40,7 @@ void xen_enable_syscall(void);
40void xen_vcpu_restore(void); 40void xen_vcpu_restore(void);
41 41
42void xen_callback_vector(void); 42void xen_callback_vector(void);
43void xen_hvm_init_shared_info(void); 43void xen_hvm_resume_shared_info(void);
44void xen_unplug_emulated_devices(void); 44void xen_unplug_emulated_devices(void);
45 45
46void __init xen_build_dynamic_phys_to_machine(void); 46void __init xen_build_dynamic_phys_to_machine(void);
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0d1f36a22c9..2481f267be2 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -16,6 +16,7 @@ config XTENSA
16 select GENERIC_KERNEL_THREAD 16 select GENERIC_KERNEL_THREAD
17 select GENERIC_KERNEL_EXECVE 17 select GENERIC_KERNEL_EXECVE
18 select ARCH_WANT_OPTIONAL_GPIOLIB 18 select ARCH_WANT_OPTIONAL_GPIOLIB
19 select CLONE_BACKWARDS
19 help 20 help
20 Xtensa processors are 32-bit RISC machines designed by Tensilica 21 Xtensa processors are 32-bit RISC machines designed by Tensilica
21 primarily for embedded systems. These processors are both 22 primarily for embedded systems. These processors are both
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 6d130278999..095f0a2244f 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -25,4 +25,5 @@ generic-y += siginfo.h
25generic-y += statfs.h 25generic-y += statfs.h
26generic-y += termios.h 26generic-y += termios.h
27generic-y += topology.h 27generic-y += topology.h
28generic-y += trace_clock.h
28generic-y += xor.h 29generic-y += xor.h
diff --git a/arch/xtensa/include/asm/signal.h b/arch/xtensa/include/asm/signal.h
index 72fd44c85b7..6f586bd90e1 100644
--- a/arch/xtensa/include/asm/signal.h
+++ b/arch/xtensa/include/asm/signal.h
@@ -27,7 +27,6 @@ struct k_sigaction {
27}; 27};
28 28
29#include <asm/sigcontext.h> 29#include <asm/sigcontext.h>
30#define ptrace_signal_deliver(regs, cookie) do { } while (0)
31 30
32#endif /* __ASSEMBLY__ */ 31#endif /* __ASSEMBLY__ */
33#endif /* _XTENSA_SIGNAL_H */ 32#endif /* _XTENSA_SIGNAL_H */
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
index 124aeee0d38..b00c928d4cc 100644
--- a/arch/xtensa/include/asm/syscall.h
+++ b/arch/xtensa/include/asm/syscall.h
@@ -10,8 +10,6 @@
10 10
11struct pt_regs; 11struct pt_regs;
12struct sigaction; 12struct sigaction;
13asmlinkage long sys_execve(char*, char**, char**, struct pt_regs*);
14asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);
15asmlinkage long xtensa_ptrace(long, long, long, long); 13asmlinkage long xtensa_ptrace(long, long, long, long);
16asmlinkage long xtensa_sigreturn(struct pt_regs*); 14asmlinkage long xtensa_sigreturn(struct pt_regs*);
17asmlinkage long xtensa_rt_sigreturn(struct pt_regs*); 15asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index f4e6eaa40d1..e002dbcc88b 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -2,6 +2,7 @@
2#define _XTENSA_UNISTD_H 2#define _XTENSA_UNISTD_H
3 3
4#define __ARCH_WANT_SYS_EXECVE 4#define __ARCH_WANT_SYS_EXECVE
5#define __ARCH_WANT_SYS_CLONE
5#include <uapi/asm/unistd.h> 6#include <uapi/asm/unistd.h>
6 7
7/* 8/*
diff --git a/arch/xtensa/include/uapi/asm/ioctls.h b/arch/xtensa/include/uapi/asm/ioctls.h
index 2aa4cd9f0ce..b4cb1100c0f 100644
--- a/arch/xtensa/include/uapi/asm/ioctls.h
+++ b/arch/xtensa/include/uapi/asm/ioctls.h
@@ -101,6 +101,9 @@
101#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 101#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
102#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ 102#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
103#define TIOCVHANGUP _IO('T', 0x37) 103#define TIOCVHANGUP _IO('T', 0x37)
104#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
105#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
106#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
104 107
105#define TIOCSERCONFIG _IO('T', 83) 108#define TIOCSERCONFIG _IO('T', 83)
106#define TIOCSERGWILD _IOR('T', 84, int) 109#define TIOCSERGWILD _IOR('T', 84, int)
diff --git a/arch/xtensa/include/uapi/asm/mman.h b/arch/xtensa/include/uapi/asm/mman.h
index 25bc6c1309c..00eed6786d7 100644
--- a/arch/xtensa/include/uapi/asm/mman.h
+++ b/arch/xtensa/include/uapi/asm/mman.h
@@ -93,4 +93,15 @@
93/* compatibility flags */ 93/* compatibility flags */
94#define MAP_FILE 0 94#define MAP_FILE 0
95 95
96/*
97 * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
98 * This gives us 6 bits, which is enough until someone invents 128 bit address
99 * spaces.
100 *
101 * Assume these are all power of twos.
102 * When 0 use the default page size.
103 */
104#define MAP_HUGE_SHIFT 26
105#define MAP_HUGE_MASK 0x3f
106
96#endif /* _XTENSA_MMAN_H */ 107#endif /* _XTENSA_MMAN_H */
diff --git a/arch/xtensa/include/uapi/asm/socket.h b/arch/xtensa/include/uapi/asm/socket.h
index e36c6818492..38079be1cf1 100644
--- a/arch/xtensa/include/uapi/asm/socket.h
+++ b/arch/xtensa/include/uapi/asm/socket.h
@@ -52,6 +52,7 @@
52 52
53#define SO_ATTACH_FILTER 26 53#define SO_ATTACH_FILTER 26
54#define SO_DETACH_FILTER 27 54#define SO_DETACH_FILTER 27
55#define SO_GET_FILTER SO_ATTACH_FILTER
55 56
56#define SO_PEERNAME 28 57#define SO_PEERNAME 28
57#define SO_TIMESTAMP 29 58#define SO_TIMESTAMP 29
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
index 9f36d0e3e0a..5162418c5d9 100644
--- a/arch/xtensa/include/uapi/asm/unistd.h
+++ b/arch/xtensa/include/uapi/asm/unistd.h
@@ -260,7 +260,7 @@ __SYSCALL(115, sys_sendmmsg, 4)
260/* Process Operations */ 260/* Process Operations */
261 261
262#define __NR_clone 116 262#define __NR_clone 116
263__SYSCALL(116, xtensa_clone, 5) 263__SYSCALL(116, sys_clone, 5)
264#define __NR_execve 117 264#define __NR_execve 117
265__SYSCALL(117, sys_execve, 3) 265__SYSCALL(117, sys_execve, 3)
266#define __NR_exit 118 266#define __NR_exit 118
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 09ae7bfab9a..1accf28da5f 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -199,8 +199,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
199 */ 199 */
200 200
201int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, 201int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
202 unsigned long thread_fn_arg, 202 unsigned long thread_fn_arg, struct task_struct *p)
203 struct task_struct *p, struct pt_regs *unused)
204{ 203{
205 struct pt_regs *childregs = task_pt_regs(p); 204 struct pt_regs *childregs = task_pt_regs(p);
206 205
@@ -364,12 +363,3 @@ int dump_fpu(void)
364{ 363{
365 return 0; 364 return 0;
366} 365}
367
368asmlinkage
369long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
370 void __user *parent_tid, void *child_tls,
371 void __user *child_tid, long a5,
372 struct pt_regs *regs)
373{
374 return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
375}
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 7e74895eee0..8207a119eee 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -221,6 +221,7 @@ static __exit void rs_exit(void)
221 printk("ISS_SERIAL: failed to unregister serial driver (%d)\n", 221 printk("ISS_SERIAL: failed to unregister serial driver (%d)\n",
222 error); 222 error);
223 put_tty_driver(serial_driver); 223 put_tty_driver(serial_driver);
224 tty_port_destroy(&serial_port);
224} 225}
225 226
226 227